org.geotools.resources
Class OptionalDependencies

java.lang.Object
  extended by org.geotools.resources.OptionalDependencies

public final class OptionalDependencies
extends java.lang.Object

Bridges to optional dependencies (especially widget-swing module).

Since:
2.0
Version:
$Id: OptionalDependencies.java 30640 2008-06-12 17:34:32Z acuster $
Author:
Martin Desruisseaux (IRD)

Method Summary
static javax.swing.tree.MutableTreeNode copy(javax.swing.tree.TreeNode node)
          Returns a copy of the tree starting at the given node.
static javax.swing.tree.DefaultMutableTreeNode createTreeNode(java.lang.String name, java.lang.Object object, boolean allowsChildren)
          Creates an initially empty tree node.
static void format(javax.swing.tree.TreeModel tree, java.lang.Appendable buffer, java.lang.String lineSeparator)
          Writes a graphical representation of the specified tree model in the given buffer.
static void format(javax.swing.tree.TreeNode node, java.lang.Appendable buffer, java.lang.String lineSeparator)
          Writes a graphical representation of the specified tree in the given buffer.
static void show(javax.swing.tree.TreeModel tree, java.lang.String title)
          Display the given tree in a Swing frame.
static void show(javax.swing.tree.TreeNode node, java.lang.String title)
          Display the given tree in a Swing frame.
static java.lang.String toString(javax.swing.tree.TreeModel tree)
          Returns a graphical representation of the specified tree model.
static java.lang.String toString(javax.swing.tree.TreeNode node)
          Returns a graphical representation of the specified tree.
static javax.swing.tree.MutableTreeNode xmlToSwing(org.w3c.dom.Node node)
          Creates a Swing root tree node from a XML root tree node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createTreeNode

public static javax.swing.tree.DefaultMutableTreeNode createTreeNode(java.lang.String name,
                                                                     java.lang.Object object,
                                                                     boolean allowsChildren)
Creates an initially empty tree node.

Parameters:
name - The value to be returned by TreeNode#toString.
object - The user object to be returned by the tree node. May or may not be the same than name.
allowsChildren - if children are allowed.

xmlToSwing

public static javax.swing.tree.MutableTreeNode xmlToSwing(org.w3c.dom.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.

This method should not be defined here, since this class is about optional dependencies. It should be defined in org.geotools.gui.swing.tree.Trees instead. However we put it here (for now) because it is used in some module that don't want to depend on widgets.


copy

public static javax.swing.tree.MutableTreeNode copy(javax.swing.tree.TreeNode node)
Returns a copy of the tree starting at the given node.

Parameters:
tree - The tree to copy (may be null).
Returns:
A mutable copy of the given tree, or null if the tree was null.
Since:
2.5

format

public static void format(javax.swing.tree.TreeModel tree,
                          java.lang.Appendable buffer,
                          java.lang.String lineSeparator)
                   throws java.io.IOException
Writes a graphical representation of the specified tree model in the given buffer.

This method should not be defined here, since this class is about optional dependencies. It should be defined in org.geotools.gui.swing.tree.Trees instead. However we put it here (for now) because it is used in some module that don't want to depend on widgets.

Parameters:
tree - The tree to format.
buffer - Where to format the tree.
lineSeparator - The line separator, or null for the system default.
Throws:
java.io.IOException - if an error occured while writting in the given buffer.
Since:
2.5

format

public static void format(javax.swing.tree.TreeNode node,
                          java.lang.Appendable buffer,
                          java.lang.String lineSeparator)
                   throws java.io.IOException
Writes a graphical representation of the specified tree in the given buffer.

This method should not be defined here, since this class is about optional dependencies. It should be defined in org.geotools.gui.swing.tree.Trees instead. However we put it here (for now) because it is used in some module that don't want to depend on widgets.

Parameters:
node - The root node of the tree to format.
buffer - Where to format the tree.
lineSeparator - The line separator, or null for the system default.
Throws:
java.io.IOException - if an error occured while writting in the given buffer.
Since:
2.5

toString

public static java.lang.String toString(javax.swing.tree.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.

This method should not be defined here, since this class is about optional dependencies. It should be defined in org.geotools.gui.swing.tree.Trees instead. However we put it here (for now) because it is used in some module that don't want to depend on widgets.

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 java.lang.String toString(javax.swing.tree.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.

This method should not be defined here, since this class is about optional dependencies. It should be defined in org.geotools.gui.swing.tree.Trees instead. However we put it here (for now) because it is used in some module that don't want to depend on widgets.

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.

show

public static void show(javax.swing.tree.TreeNode node,
                        java.lang.String title)
Display the given tree in a Swing frame. This is a convenience method for debugging purpose only.

Parameters:
tree - The tree to display in a Swing frame.
title - The frame title, or null if none.
Since:
2.5

show

public static void show(javax.swing.tree.TreeModel tree,
                        java.lang.String title)
Display the given tree in a Swing frame. This is a convenience method for debugging purpose only.

Parameters:
tree - The tree to display in a Swing frame.
title - The frame title, or null if none.
Since:
2.5


Copyright © 1996-2010 Geotools. All Rights Reserved.