|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectDefaultMutableTreeNode
DefaultMutableTreeNode
public class DefaultMutableTreeNode
General-purpose node in a tree data structure. This default implementation implements
the Geotk MutableTreeNode interface, which inherits a getUserObject()
method. This method is provided in the Swing DefaultMutableTreeNode
implementation but seems to have been forgotten in all Swing interfaces.
In addition, the toString() method has been overridden in order to process
InternationalString specially: if the value returned by getLocale()
is non-null, then that value is used for getting a String from the
InternationalString object.
| utility/geotk-utility (download) | View source code for this class |
| Field Summary |
|---|
| Fields inherited from class DefaultMutableTreeNode |
|---|
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject |
| Constructor Summary | |
|---|---|
DefaultMutableTreeNode()
Creates a tree node that has no parent and no children, but which allows children. |
|
DefaultMutableTreeNode(Object userObject)
Creates a tree node with no parent, no children, but which allows children, and initializes it with the specified user object. |
|
DefaultMutableTreeNode(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. |
|
| Method Summary | |
|---|---|
Enumeration<? extends TreeNode> |
children()
Returns the children of this node as an Enumeration. |
Locale |
getLocale()
Returns the locale to use for the value returned by toString(). |
String |
toString()
Returns the string value of the user object, or null
if none. |
| Methods inherited from class Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface MutableTreeNode |
|---|
insert, remove, remove, removeFromParent, setParent, setUserObject |
| Methods inherited from interface TreeNode |
|---|
getUserObject |
| Methods inherited from interface TreeNode |
|---|
getAllowsChildren, getChildAt, getChildCount, getIndex, getParent, isLeaf |
| Constructor Detail |
|---|
public DefaultMutableTreeNode()
public DefaultMutableTreeNode(Object userObject)
userObject - an Object provided by the user that constitutes the node's data
public DefaultMutableTreeNode(Object userObject,
boolean allowsChildren)
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| Method Detail |
|---|
public Enumeration<? extends TreeNode> children()
Enumeration.
children in interface TreeNodechildren in class DefaultMutableTreeNodepublic Locale getLocale()
toString(). The default
implementation returns the locale of the parent, if any,
or null otherwise.
getLocale in interface Localizednull if not explicitly defined.public String toString()
null
if none. This method is invoked by JTree for populating the tree
widget. The string can be localized if the following conditions are meet:
InternationalString,getLocale() is non-null.
In such case, this method returns the value of InternationalString.toString(Locale).
toString in class DefaultMutableTreeNodenull if none.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||