|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectDefaultMutableTreeNode
DefaultMutableTreeNode
NamedTreeNode
public class NamedTreeNode
A tree node with a name which may be different than the user object.
Because the JTree component invokes the toString() method for
populating the tree widget, this class is useful when the label to display is different than
the value of userObject.toString().
Localization
Every constructors in this class expect a name of type CharSequence. The names are
typically instances of String, but instances of InternationalString are
also accepted. In the later case, the toString() method may return a localized
string depending on the return value of the getLocale() method. By
default, the later is the locale of the parent node.
| 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 | |
|---|---|
NamedTreeNode(CharSequence name)
Creates a tree node that has no parent and no children, but which allows children. |
|
NamedTreeNode(CharSequence 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(CharSequence 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. |
|
| Method Summary | |
|---|---|
CharSequence |
getName()
Returns the name of this node as an instance of String or InternationalString. |
void |
setName(CharSequence name)
Sets the name of this node. |
String |
toString()
Returns the name given at construction time. |
| Methods inherited from class DefaultMutableTreeNode |
|---|
children, getLocale |
| 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 NamedTreeNode(CharSequence name)
name - The node name to be returned by toString().
public NamedTreeNode(CharSequence name,
Object userObject)
name - The node name to be returned by toString().userObject - an Object provided by the user that constitutes the node's data
public NamedTreeNode(CharSequence name,
Object userObject,
boolean allowsChildren)
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| Method Detail |
|---|
public CharSequence getName()
String or InternationalString.
null if none.public void setName(CharSequence name)
DefaultMutableTreeNode.toString() is designed that way),
it is highly recommended to set only non-null values.
name - The new name of this node.public String toString()
InternationalString and the getLocale() method
returns a non-null value, then the InternationalString.toString(Locale)
value is returned.
toString in class DefaultMutableTreeNodenull if none.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||