com.sas.swing.visuals.util
Class TreeUtil

com.sas.swing.visuals.util.TreeUtil

public abstract class TreeUtil

A utility class for working with the TreeModel interface and JTree.


Constructor Summary
TreeUtil()
           
 
Method Summary
static void expandAllNodes(javax.swing.JTree tree)
           
static void expandFirstPath(javax.swing.JTree tree)
           
static void expandTreeToLevel(javax.swing.JTree tree, int level)
           
static java.lang.Object[] getPathToRoot(javax.swing.tree.TreeModel treeModel, java.lang.Object node)
          Searches the entire tree model for the node's path to the root.
static java.lang.Object[] getPathToRoot(javax.swing.tree.TreeModel treeModel, java.lang.Object node, boolean findFirstMatch)
          Searches a tree model for a node's path to the tree root.
static boolean isNodeSibling(javax.swing.tree.TreeModel treeModel, java.lang.Object node, java.lang.Object siblingNode)
           
 

Constructor Detail

TreeUtil

public TreeUtil()
Method Detail

isNodeSibling

public static boolean isNodeSibling(javax.swing.tree.TreeModel treeModel,
                                    java.lang.Object node,
                                    java.lang.Object siblingNode)

getPathToRoot

public static java.lang.Object[] getPathToRoot(javax.swing.tree.TreeModel treeModel,
                                               java.lang.Object node)
Searches the entire tree model for the node's path to the root. Used when there might be more than one match.

Parameters:
treeModel - the model to be searched
node - the node to search for
Returns:
the array of tree objects showing the path

getPathToRoot

public static java.lang.Object[] getPathToRoot(javax.swing.tree.TreeModel treeModel,
                                               java.lang.Object node,
                                               boolean findFirstMatch)
Searches a tree model for a node's path to the tree root.

Parameters:
treeModel - the model to be searched
node - the node to search for
findFirstMatch - specifies whether to stop the search on the first match
Returns:
the array of tree objects showing the path

expandAllNodes

public static void expandAllNodes(javax.swing.JTree tree)

expandTreeToLevel

public static void expandTreeToLevel(javax.swing.JTree tree,
                                     int level)

expandFirstPath

public static void expandFirstPath(javax.swing.JTree tree)



Copyright © 2009 SAS Institute Inc. All Rights Reserved.