org.geotools.gui.swing.tree
Class Trees

Object
  extended by Trees

public final class Trees
extends Object

Convenience static methods for trees operations.

Since:
2.0
Author:
Martin Desruisseaux (IRD)
Module:

Method Summary
static TreePath[] getPathsToUserObject(TreeModel model, Object value)
          Returns the path to the specified user object.
static void print(TreeModel tree)
          Prints the specified tree model to the standard output stream.
static void print(TreeNode node)
          Prints the specified tree to the standard output stream.
static String toString(TreeModel tree)
          Returns a graphical representation of the specified tree model.
static String toString(TreeNode node)
          Returns a graphical representation of the specified tree.
static TreeNode xmlToSwing(Node node)
          Creates a Swing root tree node from a XML root tree node.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPathsToUserObject

public static TreePath[] getPathsToUserObject(TreeModel model,
                                              Object value)
Returns the path to the specified user object. For each tree node which are actually instance of Geotools TreeNode, this method compares the specified value against the user object returned by the TreeNode.getUserObject() method.

Parameters:
model - The tree model to inspect.
value - User object to compare to TreeNode.getUserObject().
Returns:
The paths to the specified value, or an empty array if none.

xmlToSwing

public static TreeNode xmlToSwing(Node node)
Creates a Swing root tree node from a XML root tree node. Together with toString(TreeNode), this method provides a convenient way to print the content of a XML document for debugging purpose.


toString

public static String toString(TreeModel tree)
Returns a graphical representation of the specified tree model. This representation can be printed to the standard output stream (for example) if it uses a monospaced font and supports unicode.

Parameters:
tree - The tree to format.
Returns:
A string representation of the tree, or null if it doesn't contain any node.

toString

public static String toString(TreeNode node)
Returns a graphical representation of the specified tree. This representation can be printed to the standard output stream (for example) if it uses a monospaced font and supports unicode.

Parameters:
node - The root node of the tree to format.
Returns:
A string representation of the tree, or null if it doesn't contain any node.

print

public static void print(TreeModel tree)
Prints the specified tree model to the standard output stream. This method is mostly a convenience for debugging purpose.

Since:
2.4

print

public static void print(TreeNode node)
Prints the specified tree to the standard output stream. This method is mostly a convenience for debugging purpose.

Since:
2.4


Copyright © 1996-2009 Geotools. All Rights Reserved.