Skip navigation links


com.essbase.eas.ui.tree
Class Utilities

java.lang.Object
  extended by com.essbase.eas.ui.tree.Utilities


public class Utilities
extends java.lang.Object

static tree utility methods.

Since:
6.5.2
Version:
7.1.0
Author:
Hank Cox

Constructor Summary
Utilities()
           

 

Method Summary
static void expandBranch(javax.swing.JTree tree, javax.swing.tree.TreeNode node)
          expands an entire branch of a tree.
static void expandEntireTree(javax.swing.JTree tree)
          expands an entire tree hierarchy.
static void expandToNode(javax.swing.JTree tree, javax.swing.tree.TreeNode node)
          expands tree to a particular node
static java.awt.Color getBorderColor()
           
static java.awt.Color getDefaultBackground()
          returns the default background color for a tree control.
static java.awt.Color getDefaultForeground()
          returns the default foreground color for a tree control.
static java.awt.Color getDefaultSelectedBackground()
          returns the default selected background color for a tree control.
static java.awt.Color getDefaultSelectedForeground()
          returns the default selected foreground color for a tree control.
static java.lang.Object getNodeForUserObject(javax.swing.JTree tree, java.lang.Object userObj)
          Finds the node in a tree that matches the provided user object.
static javax.swing.tree.TreeNode[] getPath(javax.swing.tree.TreeNode node)
           
static javax.swing.tree.TreeNode[] getPathToRoot(javax.swing.tree.TreeNode aNode, int depth)
           
static int[] organizeChildNodes(javax.swing.tree.TreeNode parentNode, javax.swing.tree.TreeNode[] childNodes)
          sorts an array of child nodes and an associated array of indices in a way that the array of indices and the child nodes can be passed to a tree model's nodesWereInserted(), nodesWereDeleted(), nodesChanged() methods.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

Utilities

public Utilities()

Method Detail

getBorderColor

public static java.awt.Color getBorderColor()

getDefaultBackground

public static java.awt.Color getDefaultBackground()
returns the default background color for a tree control.

getDefaultForeground

public static java.awt.Color getDefaultForeground()
returns the default foreground color for a tree control.

getDefaultSelectedBackground

public static java.awt.Color getDefaultSelectedBackground()
returns the default selected background color for a tree control.

getDefaultSelectedForeground

public static java.awt.Color getDefaultSelectedForeground()
returns the default selected foreground color for a tree control.

expandBranch

public static void expandBranch(javax.swing.JTree tree,
                                javax.swing.tree.TreeNode node)
expands an entire branch of a tree.

getPath

public static javax.swing.tree.TreeNode[] getPath(javax.swing.tree.TreeNode node)

getPathToRoot

public static javax.swing.tree.TreeNode[] getPathToRoot(javax.swing.tree.TreeNode aNode,
                                                        int depth)

expandEntireTree

public static void expandEntireTree(javax.swing.JTree tree)
expands an entire tree hierarchy.

expandToNode

public static void expandToNode(javax.swing.JTree tree,
                                javax.swing.tree.TreeNode node)
expands tree to a particular node

getNodeForUserObject

public static java.lang.Object getNodeForUserObject(javax.swing.JTree tree,
                                                    java.lang.Object userObj)
Finds the node in a tree that matches the provided user object.
Returns:
Returns the node where the user object is found, otherwise returns null.

organizeChildNodes

public static int[] organizeChildNodes(javax.swing.tree.TreeNode parentNode,
                                       javax.swing.tree.TreeNode[] childNodes)
sorts an array of child nodes and an associated array of indices in a way that the array of indices and the child nodes can be passed to a tree model's nodesWereInserted(), nodesWereDeleted(), nodesChanged() methods. Warning: there are no checks done to ensure that all of these items are indeed children of the parent node. It is the callers responsibility to ensure that the data passed to this method is consistent.
Parameters:
parentNode - the TreeNode object that is the parent of the other nodes.
childNodes - array of TreeNode objects that need to be organized.
comparator - a Comparator object that can be passes to Arrays.sort(Object[]).
Returns:
an array of indices in the correct order. Also, the order of the items in the childNodes array might be modified.

Skip navigation links


Copyright © 2001, 2012, Oracle. All rights reserved.