Class OptionalDependencies
- Object
-
- OptionalDependencies
-
public final class OptionalDependencies extends Object
Bridges to optional dependencies (especiallywidget-swingmodule).- Since:
- 2.0
- Author:
- Martin Desruisseaux (IRD)
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static MutableTreeNodecopy(TreeNode node)Returns a copy of the tree starting at the given node.static DefaultMutableTreeNodecreateTreeNode(String name, Object object, boolean allowsChildren)Creates an initially empty tree node.static voidformat(TreeModel tree, Appendable buffer, String lineSeparator)Writes a graphical representation of the specified tree model in the given buffer.static voidformat(TreeNode node, Appendable buffer, String lineSeparator)Writes a graphical representation of the specified tree in the given buffer.static voidshow(TreeModel tree, String title)Display the given tree in a Swing frame.static voidshow(TreeNode node, String title)Display the given tree in a Swing frame.static StringtoString(TreeModel tree)Returns a graphical representation of the specified tree model.static StringtoString(TreeNode node)Returns a graphical representation of the specified tree.static MutableTreeNodexmlToSwing(Node node)Creates a Swing root tree node from a XML root tree node.
-
-
-
Method Detail
-
createTreeNode
public static DefaultMutableTreeNode createTreeNode(String name, Object object, boolean allowsChildren)
Creates an initially empty tree node.- Parameters:
name- The value to be returned byTreeNode#toString.object- The user object to be returned by the tree node. May or may not be the same thanname.allowsChildren- if children are allowed.
-
xmlToSwing
public static MutableTreeNode xmlToSwing(Node node)
Creates a Swing root tree node from a XML root tree node. Together withtoString(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.Treesinstead. 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 MutableTreeNode copy(TreeNode node)
Returns a copy of the tree starting at the given node.- Parameters:
node- The tree to copy (may benull).- Returns:
- A mutable copy of the given tree, or
nullif the tree was null. - Since:
- 2.5
-
format
public static void format(TreeModel tree, Appendable buffer, String lineSeparator) throws 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.Treesinstead. 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, ornullfor the system default.- Throws:
IOException- if an error occured while writting in the given buffer.- Since:
- 2.5
-
format
public static void format(TreeNode node, Appendable buffer, String lineSeparator) throws 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.Treesinstead. 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, ornullfor the system default.- Throws:
IOException- if an error occured while writting in the given buffer.- Since:
- 2.5
-
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.This method should not be defined here, since this class is about optional dependencies. It should be defined in
org.geotools.gui.swing.tree.Treesinstead. 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
nullif 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.This method should not be defined here, since this class is about optional dependencies. It should be defined in
org.geotools.gui.swing.tree.Treesinstead. 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
nullif it doesn't contain any node.
-
show
public static void show(TreeNode node, String title)
Display the given tree in a Swing frame. This is a convenience method for debugging purpose only.- Parameters:
node- The tree to display in a Swing frame.title- The frame title, ornullif none.- Since:
- 2.5
-
-