org.geotools.gui.swing.tree
Class NamedTreeNode
Object
DefaultMutableTreeNode
DefaultMutableTreeNode
NamedTreeNode
- All Implemented Interfaces:
- Serializable, Cloneable, MutableTreeNode, TreeNode
public class NamedTreeNode
- extends DefaultMutableTreeNode
A tree node with a name which may be different than the user object. The JTree
component invokes the toString()
method for populating the tree widget. This class
overrides the default implementation (userObject
.toString
)
with a custom label.
- Since:
- 2.0
- Author:
- Martin Desruisseaux (IRD)
- See Also:
- Serialized Form
- Module:
Constructor Summary |
NamedTreeNode(String name)
Creates a tree node that has no parent and no children, but which allows children. |
NamedTreeNode(String name,
Object userObject)
Creates a tree node with no parent, no children, but which allows
children, and initializes it with the specified user object. |
NamedTreeNode(String name,
Object userObject,
boolean allowsChildren)
Creates a tree node with no parent, no children, initialized with
the specified user object, and that allows children only if specified. |
Methods inherited from class DefaultMutableTreeNode |
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject |
NamedTreeNode
public NamedTreeNode(String name)
- Creates a tree node that has no parent and no children, but which allows children.
- Parameters:
name
- The node name to be returned by toString()
.
NamedTreeNode
public NamedTreeNode(String name,
Object userObject)
- Creates a tree node with no parent, no children, but which allows
children, and initializes it with the specified user object.
- Parameters:
name
- The node name to be returned by toString()
.userObject
- an Object provided by the user that constitutes the node's data
NamedTreeNode
public NamedTreeNode(String name,
Object userObject,
boolean allowsChildren)
- Creates a tree node with no parent, no children, initialized with
the specified user object, and that allows children only if specified.
- Parameters:
name
- The node name to be returned by toString()
.userObject
- an Object provided by the user that constitutes the node's dataallowsChildren
- if true, the node is allowed to have child nodes -- otherwise,
it is always a leaf node
toString
public String toString()
- Returns this node label. This method is invoked by
JTree
for populating
the tree widget.
- Overrides:
toString
in class DefaultMutableTreeNode
Copyright © 1996-2009 Geotools. All Rights Reserved.