本文整理了Java中javax.swing.JTree.collapsePath()
方法的一些代码示例,展示了JTree.collapsePath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTree.collapsePath()
方法的具体详情如下:
包路径:javax.swing.JTree
类名称:JTree
方法名:collapsePath
暂无
代码示例来源:origin: log4j/log4j
protected void collapse(CategoryNode node) {
_tree.collapsePath(getTreePath(node));
}
代码示例来源:origin: camunda/camunda-bpm-platform
protected void collapse(CategoryNode node) {
_tree.collapsePath(getTreePath(node));
}
代码示例来源: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: triplea-game/triplea
private void adaptStayExpandedPathsOnClickedPath(final TreePath clickedPath) {
if (stayExpandedPaths.contains(clickedPath)) {
stayExpandedPaths.remove(clickedPath);
tree.collapsePath(clickedPath);
} else {
stayExpandedPaths.add(clickedPath);
tree.expandPath(clickedPath);
}
}
代码示例来源:origin: igvteam/igv
private void collapsePath(TreePath treePath) {
if (!tree.isCollapsed(treePath)) {
tree.collapsePath(treePath);
}
}
代码示例来源:origin: org.netbeans.api/org-openide-explorer
@Override
public void run() {
final TreePath path = getTreePath(n);
LOG.log(Level.FINE, "collapseNode: {0} {1}", new Object[] { n, path });
tree.collapsePath(path);
LOG.fine("collapsePath done");
}
});
代码示例来源:origin: org.apache.jmeter/ApacheJMeter_components
private void collapseAll(TreePath parent) {
applyToChildren(parent, this::collapseAll);
tree.collapsePath(parent);
}
代码示例来源:origin: org.apache.log4j/com.springsource.org.apache.log4j
protected void collapse(CategoryNode node) {
_tree.collapsePath(getTreePath(node));
}
代码示例来源:origin: net.sourceforge.jadex/jadex-tools-base-swing
public void customResultAvailable(Object result)
{
if(result!=null)
{
List childs = (List)result;
for(int i=0; i<childs.size(); i++)
{
ISwingTreeNode child = (ISwingTreeNode)childs.get(i);
TreePath tp = new TreePath(new Object[]{root, child});
treepanel.getTree().collapsePath(tp);
}
}
}
});
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.log4j
protected void collapse(CategoryNode node) {
_tree.collapsePath(getTreePath(node));
}
代码示例来源:origin: org.languagetool/languagetool-gui-commons
@Override
public void actionPerformed(ActionEvent e) {
TreeNode root = (TreeNode) configTree[num].getModel().getRoot();
TreePath parent = new TreePath(root);
for (Enumeration categ = root.children(); categ.hasMoreElements();) {
TreeNode n = (TreeNode) categ.nextElement();
TreePath child = parent.pathByAddingChild(n);
configTree[num].collapsePath(child);
}
}
});
代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide
/** Collapses the tree under given node.
*
* @param n node to collapse
*/
public void collapseNode (Node n) {
TreePath treePath = new TreePath (
treeModel.getPathToRoot (
VisualizerNode.getVisualizer (null, n)
)
);
tree.collapsePath (treePath);
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide
/** Collapses the tree under given node.
*
* @param n node to collapse
*/
public void collapseNode (Node n) {
TreePath treePath = new TreePath (
treeModel.getPathToRoot (
VisualizerNode.getVisualizer (null, n)
)
);
tree.collapsePath (treePath);
}
代码示例来源:origin: uk.org.mygrid.taverna.scufl/scufl-ui-api
private static void collapseAll(JTree tree, TreePath parent) {
// Traverse children
TreeNode node = (TreeNode) parent.getLastPathComponent();
if (node.getChildCount() >= 0) {
for (Enumeration e = node.children(); e.hasMoreElements();) {
TreeNode n = (TreeNode) e.nextElement();
TreePath path = parent.pathByAddingChild(n);
collapseAll(tree, path);
}
}
tree.collapsePath(parent);
}
代码示例来源:origin: org.bitbucket.goalhub.simpleide/jedit
public void actionPerformed(ActionEvent evt)
{
TreePath path = resultTree.getSelectionPath();
DefaultMutableTreeNode operNode = (DefaultMutableTreeNode)path.getLastPathComponent();
for (Enumeration e = operNode.children(); e.hasMoreElements();)
{
DefaultMutableTreeNode node = (DefaultMutableTreeNode)e.nextElement();
resultTree.collapsePath(new TreePath(node.getPath()));
}
resultTree.scrollPathToVisible(
new TreePath(operNode.getPath()));
}
}//}}}
代码示例来源:origin: org.biojava.thirdparty/forester
private void collapsePath( final String name ) {
final TreePath tp = getJTree().getNextMatch( name, 0, Position.Bias.Forward );
if ( tp != null ) {
getJTree().collapsePath( tp );
}
}
代码示例来源:origin: triplea-game/triplea
/**
* collapses parents of last path if it is not in the list of expanded path until the new path is a descendant.
*
* @param newPath new path
*/
private void collapseUpFromLastParent(final TreePath newPath) {
TreePath currentParent = lastParent;
while (currentParent != null && !currentParent.isDescendant(newPath)
&& !stayExpandedContainsDescendantOf(currentParent)) {
tree.collapsePath(currentParent);
currentParent = currentParent.getParentPath();
}
}
代码示例来源:origin: info.aduna.clustermap/aduna-clustermap-core
private void collapseChildren(DefaultMutableTreeNode node, JTree tree) {
DefaultMutableTreeNode child;
int nrChildren = node.getChildCount();
for (int i = 0; i < nrChildren; i++) {
child = (DefaultMutableTreeNode) node.getChildAt(i);
if (!child.isLeaf()) {
tree.collapsePath(new TreePath(child.getPath()));
collapseChildren(child, tree);
}
}
}
}
代码示例来源:origin: Vhati/Slipstream-Mod-Manager
/**
* Collapses all nodes by walking the TreeModel.
*/
public void collapseAllNodes( TreePath currentPath ) {
Object currentNode = currentPath.getLastPathComponent();
for ( int i = treeModel.getChildCount( currentNode )-1; i >= 0; i-- ) {
Object childNode = treeModel.getChild( currentNode, i );
TreePath childPath = currentPath.pathByAddingChild( childNode );
collapseAllNodes( childPath );
}
if ( currentNode != treeModel.getRoot() ) tree.collapsePath( currentPath );
}
代码示例来源:origin: org.cytoscape/swing-application-impl
@Override
public void run() {
ignoreTreeSelectionEvents = true;
// apparently this doesn't fire valueChanged
treeTable.getTree().collapsePath(new TreePath(new TreeNode[] { root }));
treeTable.getTree().updateUI();
final TreePath path = new TreePath(dmtn.getPath());
treeTable.getTree().expandPath(path);
treeTable.getTree().scrollPathToVisible(path);
treeTable.doLayout();
ignoreTreeSelectionEvents = false;
}
});
内容来源于网络,如有侵权,请联系作者删除!