Class TreeNode
Object
|
+--Widget
|
+--Container
|
+--TreeNode
- class
TreeNode
- extends Container
Defined in tree.js
Method Summary |
function
|
deselect()
|
void
|
expandTo(<int> depth)
Expands this node to depth depth .
|
Tree
|
getRootTree()
Returns the Tree that ultimately contains this node.
|
boolean
|
isExpanded()
Returns true if this node's children are visible.
|
boolean
|
isLastChild()
Returns true if this node is its parent's last child.
|
function
|
select()
|
void
|
setExpansion(<boolean> expanded)
Sets the tree node's expansion state.
|
function
|
setInactive()
|
void
|
setLabel(<Object> label)
Sets the tree node's label to label .
|
void
|
toggleExpansion()
Toggles the tree node's expansion state.
|
void
|
update(<boolean> skipRecursion)
Updates the state of this node's icons and, optionally, the icons of all
of this node's descendants.
|
Methods inherited from class Container |
appendChild, clear, contains, insertAfter, insertAt, insertBefore, isEmpty, prependChild, removeChild, replaceChild, setLayout, setEnabled
|
Methods inherited from class Widget |
installContextMenu, installDefaultContextMenu, uninstallContextMenu, isDraggable, setDraggable, addEventListener, blur, createEventTable, dispose, focus, getAbsoluteBottom, getAbsoluteLeft, getAbsoluteRight, getAbsoluteTop, getBottom, getBounds, getClientHeight, getClientWidth, getCorner, getHeight, getLeft, getPixelsPerEm, getRight, getToolTip, getTop, getWidth, isDisposed, isEnabled, moveToAbsolute, moveTo, raiseEvent, registerEventType, removeEventListener, setAbsoluteBottom, setAbsoluteLeft, setAbsoluteRight, setAbsoluteTop, setBottom, setBounds, setHeight, setLeft, setRight, setToolTip, setTop, setWidth, setParent, toString
|
NEXT_TREE_NODE_ID
<static> int NEXT_TREE_NODE_ID
TreeNode
function TreeNode(<Container> parent, <Object> label, <string> icon)
Creates a tree node. Tree nodes represent individual elements in a tree
and are the only sensible type of widget to insert into a tree. Each node
may contain other child nodes.
Parameters:
parent
- the Tree
or TreeNode
containing this TreeNode
. I think this argument is ignored.
label
- either a string
or a DOMNode
that will be this node's 'label'. The label is clipped to 1.5 ems in height, but can be of any width.
icon
- either null
or a string
to be used as the filename of this node's icon. If icon
is null
this node will not have an icon.
deselect
function deselect()
expandTo
void expandTo(<int> depth)
Expands this node to depth depth
.
Parameters:
depth
- the depth to which this node should be expanded. If depth
is less than zero, this node and all its descendants will be expanded. If depth is zero, this node will be collapsed. If depth is greater than zero, this node will be expanded, and all of its children will be expanded to depth depth - 1
.
getRootTree
Tree getRootTree()
Returns the Tree
that ultimately contains this node.
Returns null
or undefined
if this node has no
parent. May not return an instance of Tree
if this node is
not ultimately contained by a Tree
.
Returns:
the Tree
that is this node's ultimate ancestor
isExpanded
boolean isExpanded()
Returns true
if this node's children are visible. Cannot
return true
if this node has no children.
Returns:
true
if this node's children are visible.
isLastChild
boolean isLastChild()
Returns true
if this node is its parent's last child. If
this node has no parent, then it is, by defintion, its parent's last
child.
Returns:
true
if this node is its parent's last child and false
otherwise.
select
function select()
setExpansion
void setExpansion(<boolean> expanded)
Sets the tree node's expansion state. Expands the node if
expanded
is true
and collapses the node
otherwise.
Parameters:
expanded
- a boolean indicating whether to expand the node (true
) or collapse it (false
)
setInactive
function setInactive()
setLabel
void setLabel(<Object> label)
Sets the tree node's label to label
. If label
is a string
, then just sets the text. If
label
is a DOMNode
, then replaces the node's
label HTML with label
.
Parameters:
label
- the node's new label
toggleExpansion
void toggleExpansion()
Toggles the tree node's expansion state. Does nothing if the node has
no children.
update
void update(<boolean> skipRecursion)
Updates the state of this node's icons and, optionally, the icons of all
of this node's descendants.
Parameters:
skipRecursion
- if skipRecursion
is true
then only this node will be updated. Otherwise this node and all its descendants will be updated
