Class zwt.ui.tree.TreeNode
Extends
zwt.Object.
A tree node represents a single element in a tree model.
It holds an object which is the node data, the state of the node (expanded/collapsed) and a list of child nodes (therefore a tree model can be seen as a linked list).
Defined in: TreeNode.js.
Constructor Attributes | Constructor Name and Description |
---|---|
zwt.ui.tree.TreeNode(object_obj, array_childs, boolean_expanded)
Construct a tree node.
|
Method Attributes | Method Name and Description |
---|---|
addChild(zwt_ui_tree_TreeNode_node)
Add the specified child node.
|
|
collapse()
Collapse the node.
|
|
expand()
Expand the node.
|
|
getChild(int_index)
Return the child node at the specified index.
|
|
Return the number of child nodes.
|
|
Return the object associated to the node.
|
|
Return the node's tree path.
|
|
indexOf(zwt_ui_tree_TreeNode_node)
Return the index of the specified node or -1 if it is not a child of the node.
|
|
insertChild(zwt_ui_tree_TreeNode_node, int_index)
Insert the specified child node at the specified location.
|
|
Determine whether the node is expanded.
|
|
isLeaf()
Determine whether the node is a leaf.
|
|
onEvent(zwt_ui_tree_TreeModelEvent_event)
Dispatch the specified tree model event to the parent node and eventually to the tree model that will dispatch it to appropriate event manage.
|
|
removeChild(zwt_ui_tree_TreeNode_node)
Remove the specified child.
|
|
removeChildAt(int_index)
Remove the specified child at the specified location.
|
|
setChilds(array_childs)
Set the child nodes.
|
|
setObject(object_obj)
Associate the specified object to the node.
|
|
Expand or collapse the node.
|
Class Detail
zwt.ui.tree.TreeNode(object_obj, array_childs, boolean_expanded)
Construct a tree node.
Author: Jeremy KUHN.
Author: Jeremy KUHN.
- Parameters:
- object_obj
- array_childs
- boolean_expanded
Method Detail
addChild(zwt_ui_tree_TreeNode_node)
Add the specified child node.
If the node is already a child of another node, it is first removed from this one.
- Parameters:
- {zwt.ui.tree.TreeNode} zwt_ui_tree_TreeNode_node
- The node to add
collapse()
Collapse the node.
expand()
Expand the node.
{zwt.ui.tree.TreeNode}
getChild(int_index)
Return the child node at the specified index.
- Parameters:
- {Integer} int_index
- A node index
- Returns:
- The child node or null
{Integer}
getChildCount()
Return the number of child nodes.
- Returns:
- The number of child nodes
{Object}
getObject()
Return the object associated to the node.
- Returns:
- The associated object
{Integer[]}
getTreePath()
Return the node's tree path.
- Returns:
- The nodes's tree path
{Integer}
indexOf(zwt_ui_tree_TreeNode_node)
Return the index of the specified node or -1 if it is not a child of the node.
- Parameters:
- zwt_ui_tree_TreeNode_node
- Returns:
- The index of the node or -1
insertChild(zwt_ui_tree_TreeNode_node, int_index)
Insert the specified child node at the specified location.
If the node is already a child of another node, it is first removed from this one.
- Parameters:
- {zwt.ui.tree.TreeNode} zwt_ui_tree_TreeNode_node
- The node to insert
- {Integer} int_index
- The location where to insert the node
{Boolean}
isExpanded()
Determine whether the node is expanded.
- Returns:
- true if the node is expanded
{Boolean}
isLeaf()
Determine whether the node is a leaf.
A node is a leaf if it doesn't have any child node.
- Returns:
- true if the node is a leaf
onEvent(zwt_ui_tree_TreeModelEvent_event)
Dispatch the specified tree model event to the parent node and eventually to the tree model that will dispatch it to appropriate event manage.
- Parameters:
- {zwt.ui.tree.TreeModelEvent} zwt_ui_tree_TreeModelEvent_event
- The tree model event to dispatch
removeChild(zwt_ui_tree_TreeNode_node)
Remove the specified child.
- Parameters:
- {zwt.ui.tree.TreeNode} zwt_ui_tree_TreeNode_node
- The node to remove
removeChildAt(int_index)
Remove the specified child at the specified location.
- Parameters:
- {Integer} int_index
- The location where to remove the node
setChilds(array_childs)
Set the child nodes.
If a node is already a child of another node, it is first removed from this one.
- Parameters:
- {zwt.ui.tree.TreeNode[]} array_childs
- The nodes to set
setObject(object_obj)
Associate the specified object to the node.
- Parameters:
- {Object} object_obj
- The object to set
toggleExpand()
Expand or collapse the node.