|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
T
- The type of the wrapped data of the tree node.public interface TreeModel<T>
A generic and simple tree data model which is to be used by Tree
component.
Method Summary | |
---|---|
TreeModel<T> |
addChild(T data)
Creates and adds a child tree node with the given wrapped data to the current tree node. |
TreeModel<T> |
addChildNode(TreeModel<T> child)
Adds the given child tree node to the current tree node. |
int |
getChildCount()
Returns the count of the children of the current tree node. |
java.util.List<TreeModel<T>> |
getChildren()
Returns an unmodifiable list of all child tree nodes of the current tree node. |
T |
getData()
Returns the wrapped data of the current tree node. |
java.lang.String |
getIndex()
Returns the zero-based unique index of the current tree node. |
int |
getLevel()
Returns the level of the current tree node. |
TreeModel<T> |
getParent()
Returns the parent tree node of the current tree node. |
boolean |
isFirst()
Returns whether the current tree node is the first child of its parent, if any. |
boolean |
isLast()
Returns whether the current tree node is the last child of its parent, if any. |
boolean |
isLeaf()
Returns whether the current tree node is a leaf node. |
boolean |
isRoot()
Returns whether the current tree node is the root node. |
java.util.Iterator<TreeModel<T>> |
iterator()
Returns an unmodifiable iterator over the children of the current tree node. |
TreeModel<T> |
remove()
Removes the current tree node from its parent, if any. |
void |
setData(T data)
Sets the wrapped data of the current tree node. |
Method Detail |
---|
void setData(T data)
data
- The wrapped data of current tree node.TreeModel<T> addChild(T data)
data
- The wrapped data of the child tree node to be created and added.
TreeModel<T> addChildNode(TreeModel<T> child)
child
- The child tree node to be added.
java.lang.IllegalArgumentException
- When the given child is not an instance of the same class as the parent.TreeModel<T> remove()
T getData()
TreeModel<T> getParent()
int getChildCount()
java.util.List<TreeModel<T>> getChildren()
addChild(Object)
method on the
tree node parent. Removing children should be done by the remove()
method on the tree node itself.
java.util.Iterator<TreeModel<T>> iterator()
iterator
in interface java.lang.Iterable<TreeModel<T>>
Iterable
int getLevel()
java.lang.String getIndex()
null
. The first child has
index 0. The second child of first child has index 0_1. The first child of second child of
third child has index 2_1_0.
boolean isRoot()
true
if the current tree node is the root node, otherwise false
.boolean isLeaf()
true
if the current tree node is a leaf node, otherwise false
.boolean isFirst()
true
if the current tree node is the first child of its parent, otherwise false
.boolean isLast()
true
if the current tree node is the last child of its parent, otherwise false
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |