当前位置: 首页>>代码示例>>Java>>正文


Java TreeSelectionModel.SINGLE_TREE_SELECTION属性代码示例

本文整理汇总了Java中javax.swing.tree.TreeSelectionModel.SINGLE_TREE_SELECTION属性的典型用法代码示例。如果您正苦于以下问题:Java TreeSelectionModel.SINGLE_TREE_SELECTION属性的具体用法?Java TreeSelectionModel.SINGLE_TREE_SELECTION怎么用?Java TreeSelectionModel.SINGLE_TREE_SELECTION使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.swing.tree.TreeSelectionModel的用法示例。


在下文中一共展示了TreeSelectionModel.SINGLE_TREE_SELECTION属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ModuleChooser

public ModuleChooser(Project project, 
                     boolean allowFileSelection,
                     boolean allowMultipleSelection,
                     boolean allowRootSelection,
                     String expertTitle,
                     String selectModulePageTitle) {
  super(expertTitle, project);
  mySelectCVSConfigurationStep = new SelectCVSConfigurationStep(project, this);
  mySelectCvsElementStep = new SelectCvsElementStep(selectModulePageTitle,
                                                    this,
                                                    project,
                                                    mySelectCVSConfigurationStep, allowRootSelection, allowMultipleSelection ?
                                                                        TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION :
                                                                        TreeSelectionModel.SINGLE_TREE_SELECTION, true,
                                                    allowFileSelection);

  addStep(mySelectCVSConfigurationStep);
  addStep(mySelectCvsElementStep);

  init();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ModuleChooser.java

示例2: BrowserPanel

public BrowserPanel(CvsRootConfiguration configuration, Project project, Consumer<VcsException> errorCallback) {
  super(new BorderLayout(2, 0));
  setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
  myProject = project;
  myCvsRootConfiguration = configuration;
  myTree = new CvsTree(project, false, TreeSelectionModel.SINGLE_TREE_SELECTION, true, true, errorCallback);
  add(myTree, BorderLayout.CENTER);
  myTree.init();
  myTree.setCvsRootConfiguration(configuration);
  myCheckoutHelper = new CheckoutHelper(configuration, this);

  TreeUIHelper uiHelper = TreeUIHelper.getInstance();

  uiHelper.installEditSourceOnDoubleClick(myTree.getTree());
  TreeUtil.installActions(myTree.getTree());

  ActionGroup group = getActionGroup();
  PopupHandler.installPopupHandler(myTree.getTree(), group, ActionPlaces.CHECKOUT_POPUP, ActionManager.getInstance());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:BrowserPanel.java

示例3: getAccessibleStateSet

/**
 * Get the state set of this object.
 *
 * @return the state set for this object
 */
public AccessibleStateSet getAccessibleStateSet()
{
  if (isVisible())
    states.add(AccessibleState.VISIBLE);
  if (tree.isCollapsed(tp))
    states.add(AccessibleState.COLLAPSED);
  if (tree.isEditable())
    states.add(AccessibleState.EDITABLE);
  if (mod != null &&
      !mod.isLeaf(tp.getLastPathComponent()))
    states.add(AccessibleState.EXPANDABLE);
  if (tree.isExpanded(tp))
    states.add(AccessibleState.EXPANDED);
  if (isFocusable())
    states.add(AccessibleState.FOCUSABLE);
  if (hasFocus())
    states.add(AccessibleState.FOCUSED);
  if (tree.getSelectionModel().getSelectionMode() !=
    TreeSelectionModel.SINGLE_TREE_SELECTION)
    states.add(AccessibleState.MULTISELECTABLE);
  if (tree.isOpaque())
    states.add(AccessibleState.OPAQUE);
  if (tree.isPathSelected(tp))
    states.add(AccessibleState.SELECTED);
  if (isShowing())
    states.add(AccessibleState.SHOWING);

  states.add(AccessibleState.SELECTABLE);
  return states;
}
 
开发者ID:vilie,项目名称:javify,代码行数:35,代码来源:JTree.java

示例4: selectAllAccessibleSelection

/**
 * Causes every selected item in the object to be selected if the object
 * supports multiple selections.
 */
public void selectAllAccessibleSelection()
{
  if (getSelectionModel().getSelectionMode() !=
    TreeSelectionModel.SINGLE_TREE_SELECTION)
  addSelectionInterval(0, getVisibleRowCount());
}
 
开发者ID:vilie,项目名称:javify,代码行数:10,代码来源:JTree.java

示例5: ImportWizard

public ImportWizard(Project project, VirtualFile selectedFile) {
  super(CvsBundle.message("dialog.title.import.into.cvs"), project);
  final ImportConfiguration importConfig = ImportConfiguration.getInstance();
  mySelectCVSConfigurationStep = new SelectCVSConfigurationStep(project, this);
  mySelectCvsElementStep = new SelectCvsElementStep(CvsBundle.message("dialog.title.select.directory.to.import.into"),
                                                    this,
                                                    project,
                                                    mySelectCVSConfigurationStep,
                                                    true,
                                                    TreeSelectionModel.SINGLE_TREE_SELECTION,
                                                    false,
                                                    false);

  mySelectImportLocationStep = new SelectImportLocationStep(
                                          CvsBundle.message("dialog.title.select.import.directory"),
                                          this,
                                          project,
                                          selectedFile);
  mySettingsStep = new ImportSettingsStep(project, this, mySelectImportLocationStep, importConfig);

  addStep(mySelectCVSConfigurationStep);
  addStep(mySelectCvsElementStep);
  addStep(mySelectImportLocationStep);
  addStep(mySettingsStep);

  init();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:ImportWizard.java

示例6: getAccessibleStateSet

/**
 * Get the state set of this object.
 * 
 * @return the state set for this object
 */
public AccessibleStateSet getAccessibleStateSet()
{
  if (isVisible())
    states.add(AccessibleState.VISIBLE);
  if (tree.isCollapsed(tp))
    states.add(AccessibleState.COLLAPSED);
  if (tree.isEditable())
    states.add(AccessibleState.EDITABLE);
  if (mod != null && 
      !mod.isLeaf(tp.getLastPathComponent()))
    states.add(AccessibleState.EXPANDABLE);
  if (tree.isExpanded(tp))
    states.add(AccessibleState.EXPANDED);
  if (isFocusable())
    states.add(AccessibleState.FOCUSABLE);
  if (hasFocus())
    states.add(AccessibleState.FOCUSED);
  if (tree.getSelectionModel().getSelectionMode() != 
    TreeSelectionModel.SINGLE_TREE_SELECTION)
    states.add(AccessibleState.MULTISELECTABLE);
  if (tree.isOpaque())
    states.add(AccessibleState.OPAQUE);
  if (tree.isPathSelected(tp))
    states.add(AccessibleState.SELECTED);
  if (isShowing())
    states.add(AccessibleState.SHOWING);

  states.add(AccessibleState.SELECTABLE);
  return states;
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:35,代码来源:JTree.java

示例7: selectAllAccessibleSelection

/**
 * Causes every selected item in the object to be selected if the object
 * supports multiple selections.
 */
public void selectAllAccessibleSelection()
{
  if (getSelectionModel().getSelectionMode() != 
    TreeSelectionModel.SINGLE_TREE_SELECTION)
  addSelectionInterval(0, getVisibleRowCount());
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:10,代码来源:JTree.java

示例8: isSelectionModeBroken

/** Check if selection of the nodes could break the selection mode set in TreeSelectionModel.
 * @param nodes the nodes for selection
 * @return true if the selection mode is broken */
private boolean isSelectionModeBroken(Node[] nodes) {
    // if nodes are empty or single the everthing is ok
    // or if discontiguous selection then everthing ok
    if ((nodes.length <= 1) || (getSelectionMode() == TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION)) {
        return false;
    }

    // if many nodes
    // brakes single selection mode
    if (getSelectionMode() == TreeSelectionModel.SINGLE_TREE_SELECTION) {
        return true;
    }

    // check the contiguous selection mode
    TreePath[] paths = new TreePath[nodes.length];
    RowMapper rowMapper = tree.getSelectionModel().getRowMapper();

    // if rowMapper is null then tree bahaves as discontiguous selection mode is set
    if (rowMapper == null) {
        return false;
    }

    ArrayList<Node> toBeExpaned = new ArrayList<Node>(3);

    for (int i = 0; i < nodes.length; i++) {
        toBeExpaned.clear();

        Node n = nodes[i];

        while (n.getParentNode() != null) {
            if (!isExpanded(n)) {
                toBeExpaned.add(n);
            }

            n = n.getParentNode();
        }

        for (int j = toBeExpaned.size() - 1; j >= 0; j--) {
            expandNode(toBeExpaned.get(j));
        }
        paths[i] = getTreePath(nodes[i]);
    }

    int[] rows = rowMapper.getRowsForPaths(paths);

    // check selection's rows
    Arrays.sort(rows);

    for (int i = 1; i < rows.length; i++) {
        if (rows[i] != (rows[i - 1] + 1)) {
            return true;
        }
    }

    // all is ok
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:60,代码来源:TreeView.java

示例9: setSingleSelectionOnly

@Override
public void setSingleSelectionOnly(boolean b)
{
	int mode = b ? TreeSelectionModel.SINGLE_TREE_SELECTION : TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION;
	tree.getSelectionModel().setSelectionMode(mode);
}
 
开发者ID:equella,项目名称:Equella,代码行数:6,代码来源:BrowseFinder.java

示例10: isMultiSelect

@Override
public boolean isMultiSelect() {
    return impl.getSelectionModel().getSelectionMode() != TreeSelectionModel.SINGLE_TREE_SELECTION;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:4,代码来源:DesktopTree.java

示例11: setMultiSelect

@Override
public void setMultiSelect(boolean multiselect) {
    int mode = multiselect ?
            TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION : TreeSelectionModel.SINGLE_TREE_SELECTION;
    impl.getSelectionModel().setSelectionMode(mode);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:6,代码来源:DesktopTree.java

示例12: createDefaultTreeActions

private void createDefaultTreeActions() {
  final EditableTreeModel model = (EditableTreeModel)myTree.getModel();
  myAddAction = new AnActionButtonRunnable() {
    @Override
    public void run(AnActionButton button) {
      final TreePath path = myTree.getSelectionPath();
      final DefaultMutableTreeNode selected =
        path == null ? (DefaultMutableTreeNode)myTree.getModel().getRoot() : (DefaultMutableTreeNode)path.getLastPathComponent();
      final Object selectedNode = selected.getUserObject();

      myTree.stopEditing();
      Object element;
      if (model instanceof DefaultTreeModel && myProducer != null) {
         element = myProducer.createElement();
        if (element == null) return;
      } else {
        element = null;
      }
      DefaultMutableTreeNode parent = selected;
      if ((selectedNode instanceof SimpleNode && ((SimpleNode)selectedNode).isAlwaysLeaf()) || !selected.getAllowsChildren()) {
        parent = (DefaultMutableTreeNode)selected.getParent();
      }
      if (parent != null) {
       parent.insert(new DefaultMutableTreeNode(element), parent.getChildCount());
      }
      final TreePath createdPath = model.addNode(new TreePath(parent.getPath()));
      if (path != null) {
        TreeUtil.selectPath(myTree, createdPath);
        myTree.requestFocus();
      }
    }
  };

  myRemoveAction = new AnActionButtonRunnable() {
    @Override
    public void run(AnActionButton button) {
      myTree.stopEditing();
      if (myTree.getSelectionModel().getSelectionMode() == TreeSelectionModel.SINGLE_TREE_SELECTION) {
        final TreePath path = myTree.getSelectionPath();
        if (path != null) {
          model.removeNode(path);
        }
      }
      else {
        final TreePath[] paths = myTree.getSelectionPaths();
        if (paths != null && paths.length > 0) {
          model.removeNodes(Arrays.asList(paths));
        }
      }
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:52,代码来源:TreeToolbarDecorator.java

示例13: getSelectionMode

@JdkConstants.TreeSelectionMode
protected int getSelectionMode() {
  return TreeSelectionModel.SINGLE_TREE_SELECTION;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:TestConsoleProperties.java

示例14: isToggleSelectionEvent

/**
 * Returning true signifies a mouse event on the node should toggle the
 * selection of only the row under the mouse. The BasisTreeUI treats the
 * event as "toggle selection event" if the CTRL button was pressed while
 * clicking. The event is not counted as toggle event if the associated
 * tree does not support the multiple selection.
 *
 * @param event is the MouseEvent performed on the row.
 * @return true signifies a mouse event on the node should toggle the
 *         selection of only the row under the mouse.
 */
protected boolean isToggleSelectionEvent(MouseEvent event)
{
  return
    (tree.getSelectionModel().getSelectionMode() !=
      TreeSelectionModel.SINGLE_TREE_SELECTION) &&
    ((event.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) != 0);
}
 
开发者ID:vilie,项目名称:javify,代码行数:18,代码来源:BasicTreeUI.java

示例15: isMultiSelectEvent

/**
 * Returning true signifies a mouse event on the node should select from the
 * anchor point. The BasisTreeUI treats the event as "multiple selection
 * event" if the SHIFT button was pressed while clicking. The event is not
 * counted as multiple selection event if the associated tree does not support
 * the multiple selection.
 *
 * @param event is the MouseEvent performed on the node.
 * @return true signifies a mouse event on the node should select from the
 *         anchor point.
 */
protected boolean isMultiSelectEvent(MouseEvent event)
{
  return
    (tree.getSelectionModel().getSelectionMode() !=
      TreeSelectionModel.SINGLE_TREE_SELECTION) &&
    ((event.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) != 0);
}
 
开发者ID:vilie,项目名称:javify,代码行数:18,代码来源:BasicTreeUI.java


注:本文中的javax.swing.tree.TreeSelectionModel.SINGLE_TREE_SELECTION属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。