Example usage for javax.swing.tree DefaultMutableTreeNode getChildAfter

List of usage examples for javax.swing.tree DefaultMutableTreeNode getChildAfter

Introduction

In this page you can find the example usage for javax.swing.tree DefaultMutableTreeNode getChildAfter.

Prototype

public TreeNode getChildAfter(TreeNode aChild) 

Source Link

Document

Returns the child in this node's child array that immediately follows aChild, which must be a child of this node.

Usage

From source file:org.artifactory.webapp.wicket.actionable.tree.ActionableItemsTree.java

public TreeNode getNextTreeNode(TreeNode node) {
    ITreeState state = getTreeState();//from  ww  w . j a v a2  s .  c o  m
    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 getNextParent(DefaultMutableTreeNode node) {
    DefaultMutableTreeNode parent = (DefaultMutableTreeNode) node.getParent();
    if (parent == null) {
        return null;
    }//from  ww  w  .  j  a  va 2s  .c om
    TreeNode nextNode = parent.getChildAfter(node);
    if (nextNode == null) {
        return getNextParent(parent);
    }
    return nextNode;
}