List of usage examples for javax.swing.tree TreeNode getAllowsChildren
boolean getAllowsChildren();
From source file:org.artifactory.webapp.wicket.actionable.tree.ActionableItemsTree.java
public TreeNode getNextTreeNode(TreeNode node) { ITreeState state = getTreeState();//from ww w . ja v a 2s .c om DefaultMutableTreeNode parent = (DefaultMutableTreeNode) node.getParent(); if (parent == null) { return null; } if (!node.isLeaf() && node.getAllowsChildren() && state.isNodeExpanded(node)) { return node.getChildAt(0); } TreeNode nextNode = parent.getChildAfter(node); if (nextNode == null) { return getNextParent(parent); } return nextNode; }
From source file:org.artifactory.webapp.wicket.actionable.tree.ActionableItemsTree.java
public TreeNode getPrevTreeNode(TreeNode node) { DefaultMutableTreeNode parent = (DefaultMutableTreeNode) node.getParent(); if (parent == null) { return null; }/* w w w . j a v a 2 s .co m*/ TreeNode prevNode = parent.getChildBefore(node); if (prevNode != null) { ITreeState state = getTreeState(); node = prevNode; while (!node.isLeaf() && node.getAllowsChildren() && state.isNodeExpanded(node)) { node = node.getChildAt(node.getChildCount() - 1); } return node; } DefaultTreeModel treeModel = getTreeModel(); if (parent == treeModel.getRoot()) { return null; } return parent; }