All Packages Class Hierarchy This Package Previous Next Index
Class tea.set.Node
java.lang.Object
|
+----tea.set.Node
- public class Node
- extends Object
Node is used to implement the Forest widget. It contains code
that does most of the actual work of tree related functions.
This class is not intended to be used directly by user other
than for the purpose of traversing the trees.
This class is no longer a widget (component) for the purpose of
resource optimization. It however implements a set of methods
to partially simulate component behaviors.
Node supports the following properties:
Property Name | Property Type | Description |
ChildCount | int |
Number of child nodes. |
Child | Node (Readonly, Indexed) |
Get the n'th child of this node. |
Label | String |
The label of this node. |
Path | String |
The full path of this node. |
-
equals(Object)
- Two nodes are equal if they have same label and parents.
-
getChild(int)
- Get the n'th child.
-
getChildCount()
- Return the number of children.
-
getLabel()
- Return node label.
-
getPath()
- Return node path.
-
getUserData()
- Get the user data of this node.
-
isLeaf()
- True if this node has no child.
-
isOpen()
- True if folder is open (subtree is expended).
-
setLeaf(boolean)
- The Leaf property is determined by whether a node has any children.
-
setUserData(Object)
- Set the user data of a node.
-
toString()
- Convert to full path string.
setUserData
public synchronized void setUserData(Object data)
- Set the user data of a node. The user data is any object that will
be carried by a node.
- Parameters:
- data - user data.
getUserData
public Object getUserData()
- Get the user data of this node.
- Returns:
- user data.
getChildCount
public int getChildCount()
- Return the number of children.
- Returns:
- number of children.
getChild
public synchronized Node getChild(int child)
- Get the n'th child.
- Parameters:
- child - child index.
- Returns:
- child node.
getLabel
public String getLabel()
- Return node label.
- Returns:
- node label.
getPath
public synchronized String getPath()
- Return node path. The path is the labels from root down to this
node separated by the separator.
- Returns:
- node path.
toString
public String toString()
- Convert to full path string.
- Returns:
- node path.
- Overrides:
- toString in class Object
isOpen
public synchronized boolean isOpen()
- True if folder is open (subtree is expended).
- Returns:
- true if node is open.
isLeaf
public boolean isLeaf()
- True if this node has no child.
- Returns:
- true if this is a leaf node.
setLeaf
public void setLeaf(boolean isleaf)
- The Leaf property is determined by whether a node has any children.
It can be overriden explicitly by setting the property through
setLeaf().
- Parameters:
- isleaf - true if the node is always considered a leaf.
equals
public boolean equals(Object o)
- Two nodes are equal if they have same label and parents.
- Parameters:
- o - node.
- Overrides:
- equals in class Object
All Packages Class Hierarchy This Package Previous Next Index