javax.swing.JTree.isExpanded()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.6k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中javax.swing.JTree.isExpanded()方法的一些代码示例,展示了JTree.isExpanded()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTree.isExpanded()方法的具体详情如下:
包路径:javax.swing.JTree
类名称:JTree
方法名:isExpanded

JTree.isExpanded介绍

暂无

代码示例

代码示例来源:origin: deathmarine/Luyten

public Set<String> getExpansionState() {
  Set<String> openedSet = new HashSet<>();
  if (tree != null) {
    int rowCount = tree.getRowCount();
    for (int i = 0; i < rowCount; i++) {
      TreePath path = tree.getPathForRow(i);
      if (tree.isExpanded(path)) {
        String rowPathStr = getRowPathStr(path);
        // for switching Package Explorer on/off
        openedSet.addAll(getAllParentPathsStr(rowPathStr));
      }
    }
  }
  return openedSet;
}

代码示例来源:origin: camunda/camunda-bpm-platform

private void exportXMLElement(CategoryNode node, TreePath path, StringBuffer xml) {
 CategoryExplorerTree tree = _monitor.getCategoryExplorerTree();
 xml.append("\t<").append(CATEGORY).append(" ");
 xml.append(NAME).append("=\"").append(node.getTitle()).append("\" ");
 xml.append(PATH).append("=\"").append(treePathToString(path)).append("\" ");
 xml.append(EXPANDED).append("=\"").append(tree.isExpanded(path)).append("\" ");
 xml.append(SELECTED).append("=\"").append(node.isSelected()).append("\"/>\r\n");
}

代码示例来源:origin: ron190/jsql-injection

@Override
public void mousePressed(MouseEvent e) {
  int selRow = ManagerDatabase.this.tree.getRowForLocation(e.getX(), e.getY());
  TreePath selPath = ManagerDatabase.this.tree.getPathForLocation(e.getX(), e.getY());
  if (selRow != -1 && e.getClickCount() == 2) {
    if (ManagerDatabase.this.tree.isExpanded(selPath)) {
      ManagerDatabase.this.tree.collapsePath(selPath);
    } else {
      ManagerDatabase.this.tree.expandPath(selPath);
    }
  }
}

代码示例来源:origin: INRIA/spoon

@Override
  public void run() {
    TreePath path = new TreePath(node.getPath());
    if (!jTree.isExpanded(path)) {
      jTree.expandPath(path);
      jTree.updateUI();
    }
  }
});

代码示例来源:origin: abbot/abbot

@Override
  public Boolean call() {
    return tree.isExpanded(realPath);
  }
};

代码示例来源:origin: org.netbeans.api/org-openide-explorer

/** Test whether a node is expanded in the tree or not
* @param n the node to test
* @return true if the node is expanded
*/
public boolean isExpanded(Node n) {
  return tree.isExpanded(getTreePath(n));
}

代码示例来源:origin: igvteam/igv

private void expandPath(TreePath treePath) {
  if (!tree.isExpanded(treePath)) {
    tree.expandPath(treePath);
  }
}

代码示例来源:origin: org.jboss.logmanager/log4j-jboss-logmanager

private void exportXMLElement(CategoryNode node, TreePath path, StringBuffer xml) {
 CategoryExplorerTree tree = _monitor.getCategoryExplorerTree();
 xml.append("\t<").append(CATEGORY).append(" ");
 xml.append(NAME).append("=\"").append(node.getTitle()).append("\" ");
 xml.append(PATH).append("=\"").append(treePathToString(path)).append("\" ");
 xml.append(EXPANDED).append("=\"").append(tree.isExpanded(path)).append("\" ");
 xml.append(SELECTED).append("=\"").append(node.isSelected()).append("\"/>\r\n");
}

代码示例来源:origin: org.apache.log4j/com.springsource.org.apache.log4j

private void exportXMLElement(CategoryNode node, TreePath path, StringBuffer xml) {
 CategoryExplorerTree tree = _monitor.getCategoryExplorerTree();
 xml.append("\t<").append(CATEGORY).append(" ");
 xml.append(NAME).append("=\"").append(node.getTitle()).append("\" ");
 xml.append(PATH).append("=\"").append(treePathToString(path)).append("\" ");
 xml.append(EXPANDED).append("=\"").append(tree.isExpanded(path)).append("\" ");
 xml.append(SELECTED).append("=\"").append(node.isSelected()).append("\"/>\r\n");
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.log4j

private void exportXMLElement(CategoryNode node, TreePath path, StringBuffer xml) {
 CategoryExplorerTree tree = _monitor.getCategoryExplorerTree();
 xml.append("\t<").append(CATEGORY).append(" ");
 xml.append(NAME).append("=\"").append(node.getTitle()).append("\" ");
 xml.append(PATH).append("=\"").append(treePathToString(path)).append("\" ");
 xml.append(EXPANDED).append("=\"").append(tree.isExpanded(path)).append("\" ");
 xml.append(SELECTED).append("=\"").append(node.isSelected()).append("\"/>\r\n");
}

代码示例来源:origin: apache-log4j/log4j

private void exportXMLElement(CategoryNode node, TreePath path, StringBuffer xml) {
 CategoryExplorerTree tree = _monitor.getCategoryExplorerTree();
 xml.append("\t<").append(CATEGORY).append(" ");
 xml.append(NAME).append("=\"").append(node.getTitle()).append("\" ");
 xml.append(PATH).append("=\"").append(treePathToString(path)).append("\" ");
 xml.append(EXPANDED).append("=\"").append(tree.isExpanded(path)).append("\" ");
 xml.append(SELECTED).append("=\"").append(node.isSelected()).append("\"/>\r\n");
}

代码示例来源:origin: org.apache/log4j

private void exportXMLElement(CategoryNode node, TreePath path, StringBuffer xml) {
 CategoryExplorerTree tree = _monitor.getCategoryExplorerTree();
 xml.append("\t<").append(CATEGORY).append(" ");
 xml.append(NAME).append("=\"").append(node.getTitle()).append("\" ");
 xml.append(PATH).append("=\"").append(treePathToString(path)).append("\" ");
 xml.append(EXPANDED).append("=\"").append(tree.isExpanded(path)).append("\" ");
 xml.append(SELECTED).append("=\"").append(node.isSelected()).append("\"/>\r\n");
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Test whether a node is expanded in the tree or not
* @param n the node to test
* @return true if the node is expanded
*/
public boolean isExpanded (Node n) {
  TreePath treePath = new TreePath (
              treeModel.getPathToRoot (
                VisualizerNode.getVisualizer (null, n)
              )
            );
  return tree.isExpanded (treePath);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Test whether a node is expanded in the tree or not
* @param n the node to test
* @return true if the node is expanded
*/
public boolean isExpanded (Node n) {
  TreePath treePath = new TreePath (
              treeModel.getPathToRoot (
                VisualizerNode.getVisualizer (null, n)
              )
            );
  return tree.isExpanded (treePath);
}

代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql

private void onWindowClosing()
{
 JTree tre = _dialog.treFiles;
 tre.isCollapsed(new TreePath(_recentFilesNode.getPath()));
 Preferences.userRoot().putBoolean(PREF_KEY_RECENT_FILES_EXPANDED, tre.isExpanded(new TreePath(_recentFilesNode.getPath())));
 Preferences.userRoot().putBoolean(PREF_KEY_FAVOURITE_FILES_EXPANDED, tre.isExpanded(new TreePath(_favouriteFilesNode.getPath())));
 Preferences.userRoot().putBoolean(PREF_KEY_RECENT_ALIAS_FILES_EXPANDED, tre.isExpanded(new TreePath(_recentFilesForAliasNode.getPath())));
 Preferences.userRoot().putBoolean(PREF_KEY_FAVOURITE_ALIAS_FILES_EXPANDED, tre.isExpanded(new TreePath(_favouriteFilesForAliasNode.getPath())));
}

代码示例来源:origin: zzhang5/zooinspector

private List<String> getExpandedNodes()
{
 List<String> expandedPaths = new ArrayList<String>();
 int rowCount = tree.getRowCount();
 for (int i = 0; i < rowCount; i++) {
   TreePath path = tree.getPathForRow(i);
   if (tree.isExpanded(path)) {
    expandedPaths.add(ZooInspectorUtil.treePathToZnodePath(path));
   }
 }
 return expandedPaths;
}

代码示例来源:origin: net.openhft/spoon-core

public void run() {
    TreePath path = new TreePath(node.getPath());
    if (!jTree.isExpanded(path)) {
      jTree.expandPath(path);
      jTree.updateUI();
    }
  }
});

代码示例来源:origin: joel-costigliola/assertj-swing

@RunsInEDT
static void expandTreePath(final @Nonnull JTree tree, final @Nonnull TreePath path) {
 execute(() -> {
  TreePath realPath = addRootIfInvisible(tree, path);
  if (!tree.isExpanded(path)) {
   tree.expandPath(realPath);
  }
 });
}

代码示例来源:origin: joel-costigliola/assertj-swing

@Override
 protected Triple<Boolean, Point, Integer> executeInEDT() {
  checkEnabledAndShowing(tree);
  TreePath matchingPath = matchingPathFor(tree, path, pathFinder);
  Point p = scrollToTreePath(tree, matchingPath, location);
  return Triple.of(tree.isExpanded(matchingPath), p, tree.getToggleClickCount());
 }
});

代码示例来源:origin: robotframework/SwingLibrary

private Component getNodeComponent(Object node, TreePath treePath) {
  int row = tree.getRowForPath(treePath);
  boolean isLeaf = tree.getModel().isLeaf(node);
  boolean hasFocus = tree.getLeadSelectionRow() == row;
  boolean isSelected = tree.isRowSelected(row);
  boolean isExpanded = tree.isExpanded(row);
  TreeCellRenderer cellRenderer = tree.getCellRenderer();
  return cellRenderer.getTreeCellRendererComponent(tree, node, isSelected, isExpanded, isLeaf, row, hasFocus);
}

相关文章

JTree类方法