|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.zkoss.zul.DefaultTreeNode<E>
public class DefaultTreeNode<E>
A general-purpose node in a tree data structure.
Notice that if a node is added to another (i.e., become a child of another node), it will be removed from the previous parent automatically.
Nested Class Summary | |
---|---|
protected class |
DefaultTreeNode.TreeNodeChildrenList
|
Constructor Summary | |
---|---|
DefaultTreeNode(E data)
Creates a leaf node, i.e., it won't allow any children. |
|
DefaultTreeNode(E data,
boolean nullAsMax)
Creates a leaf node, i.e., it won't allow any children. |
|
DefaultTreeNode(E data,
java.util.Collection<? extends TreeNode<E>> children)
Creates a branch (non-leaf) node. |
|
DefaultTreeNode(E data,
java.util.Collection<? extends TreeNode<E>> children,
boolean nullAsMax)
Creates a branch (non-leaf) node. |
|
DefaultTreeNode(E data,
TreeNode<E>[] children)
Creates a branch (non-leaf) node. |
Method Summary | |
---|---|
void |
add(TreeNode<E> child)
Adds a child to this node at the end. |
java.lang.Object |
clone()
Clones the tree node. |
int |
compareTo(DefaultTreeNode<E> node)
|
TreeNode<E> |
getChildAt(int childIndex)
Returns the child TreeNode at index
childIndex . |
int |
getChildCount()
Returns the number of children TreeNode s this node
contains. |
java.util.List<TreeNode<E>> |
getChildren()
Return children of the receiver |
E |
getData()
Returns the application-specific data of this node. |
int |
getIndex(TreeNode<E> node)
Returns the index of node in this node's children. |
DefaultTreeModel<E> |
getModel()
Returns the tree model it belongs to. |
TreeNode<E> |
getParent()
Returns the parent TreeNode of this node. |
void |
insert(TreeNode<E> child,
int index)
Adds child to this node at the given index. |
boolean |
isLeaf()
Returns true if this node is a leaf. |
void |
remove(int index)
Removes the child at index from this node. |
void |
remove(TreeNode<E> child)
Removes the child from this node. |
void |
removeFromParent()
Removes the receiver from its parent. |
void |
setData(E data)
Sets the application-specific data associated with this node. |
void |
setModel(DefaultTreeModel<E> model)
Sets the tree model it belongs to. |
protected void |
setParent(DefaultTreeNode<E> parent)
Sets the parent. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DefaultTreeNode(E data, java.util.Collection<? extends TreeNode<E>> children)
children
- a collection of children (they must be DefaultTreeNode
too).
If null or empty, it means
no children at all. However, it still allows to add children.
If it is not allowed, please use DefaultTreeNode(Object)
instead.public DefaultTreeNode(E data, java.util.Collection<? extends TreeNode<E>> children, boolean nullAsMax)
children
- a collection of children (they must be DefaultTreeNode
too).
If null or empty, it means
no children at all. However, it still allows to add children.
If it is not allowed, please use DefaultTreeNode(Object)
instead.public DefaultTreeNode(E data, TreeNode<E>[] children)
children
- a collection of children (they must be DefaultTreeNode
too).
If null or empty, it means
no children at all. However, it still allows to add children.
If it is not allowed, please use DefaultTreeNode(Object)
instead.public DefaultTreeNode(E data)
public DefaultTreeNode(E data, boolean nullAsMax)
nullAsMax
- whether to consider null as the maximum value.
If false, null is considered as the minimum value.Method Detail |
---|
public void removeFromParent()
public DefaultTreeModel<E> getModel()
TreeNode
getModel
in interface TreeNode<E>
public void setModel(DefaultTreeModel<E> model)
TreeNode
This method is invoked automatically if DefaultTreeModel
,
so you don't have to invoke it.
setModel
in interface TreeNode<E>
public E getData()
TreeNode
getData
in interface TreeNode<E>
public void setData(E data)
TreeNode
setData
in interface TreeNode<E>
public java.util.List<TreeNode<E>> getChildren()
TreeNode
getChildren
in interface TreeNode<E>
public TreeNode<E> getChildAt(int childIndex)
TreeNode
TreeNode
at index
childIndex
.
getChildAt
in interface TreeNode<E>
public int getChildCount()
TreeNode
TreeNode
s this node
contains.
getChildCount
in interface TreeNode<E>
public TreeNode<E> getParent()
TreeNode
TreeNode
of this node.
getParent
in interface TreeNode<E>
protected void setParent(DefaultTreeNode<E> parent)
insert(org.zkoss.zul.TreeNode, int)
, add(org.zkoss.zul.TreeNode)
or remove(int)
is
called.
The deriving class rarely needs to override it.
public int getIndex(TreeNode<E> node)
TreeNode
node
in this node's children.
If this node does not contain node
, -1 will be
returned.
getIndex
in interface TreeNode<E>
public boolean isLeaf()
TreeNode
isLeaf
in interface TreeNode<E>
public void insert(TreeNode<E> child, int index)
TreeNode
insert
in interface TreeNode<E>
public void add(TreeNode<E> child)
TreeNode
add
in interface TreeNode<E>
public void remove(int index)
TreeNode
remove
in interface TreeNode<E>
public void remove(TreeNode<E> child)
TreeNode
remove
in interface TreeNode<E>
public int compareTo(DefaultTreeNode<E> node)
compareTo
in interface java.lang.Comparable<DefaultTreeNode<E>>
public java.lang.Object clone()
TreeNode
Notes:
clone
in interface TreeNode<E>
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |