Class YAHOO.widget.TreeView

Object
   |
   +--YAHOO.widget.TreeView

class YAHOO.widget.TreeView

Field Summary [top]

String id
The id of tree container element 
boolean locked
We lock the tree control while waiting for the dynamic loader to return 
int maxAnim
The maximum number of animations to run at one time. 
int nodeCount
The total number of nodes in this tree 

Constructor Summary [top]

YAHOO.widget.TreeView
Contains the tree view state data and the root node. 

Method Summary [top]

boolean animateCollapse (el)
Perform the collapse animation if configured, or just show the element if not configured or too many animations are in progress 
boolean animateExpand (el)
Perform the expand animation if configured, or just show the element if not configured or too many animations are in progress 
void collapseAll ()
Collapses all expanded child nodes in the entire tree. 
void collapseComplete ()
Function executed when the collapse animation completes 
void draw ()
Renders the tree boilerplate and visible nodes 
void expandAll ()
Expands all child nodes. 
void expandComplete ()
Function executed when the expand animation completes 
Node getNodeByIndex (<int> nodeIndex)
Returns a node in the tree that has the specified index (this index is created internally, so this function probably will only be used in html generated for a given node.) 
Node getNodeByProperty (<object> property, <object> value)
Returns a node that has a matching property and value in the data object that was passed into its constructor. 
Node getRoot ()
Returns the root node of this tree 
void onCollapse (node)
Abstract method that is executed when a node is collapsed 
void onExpand (node)
Abstract method that is executed when a node is expanded 
void setCollapseAnim (type)
Sets up the animation for collapsing children 
void setDynamicLoad (<function> fnDataLoader)
Configures this tree to dynamically load all child data 
void setExpandAnim (type)
Sets up the animation for expanding children 
void addHandler (el, <string> sType, <function> fn, <boolean> capture)
Adds an event. 
Node getNode (treeId, nodeIndex)
Global method for getting a node by its id. 
TreeView getTree (treeId)
Global method for getting a tree by its id. 
void preload ()
Attempts to preload the images defined in the styles used to draw the tree by rendering off-screen elements that use the styles. 

Field Detail [top]

id

String   id
The id of tree container element

locked

boolean   locked
We lock the tree control while waiting for the dynamic loader to return

maxAnim

int   maxAnim
The maximum number of animations to run at one time.

nodeCount

int   nodeCount
The total number of nodes in this tree

Constructor Detail [top]

YAHOO.widget.TreeView

YAHOO.widget.TreeView ()
Contains the tree view state data and the root node. This is an ordered tree; child nodes will be displayed in the order created, and there currently is no way to change this.
Parameters:
id - The id of the element that the tree will be inserted into.

Method Detail [top]

animateCollapse

boolean animateCollapse (el)
Perform the collapse animation if configured, or just show the element if not configured or too many animations are in progress
Parameters:
el - {HTMLElement} the element to animate
Returns:
true if animation could be invoked, false otherwise

animateExpand

boolean animateExpand (el)
Perform the expand animation if configured, or just show the element if not configured or too many animations are in progress
Parameters:
el - {HTMLElement} the element to animate
Returns:
true if animation could be invoked, false otherwise

collapseAll

void collapseAll ()
Collapses all expanded child nodes in the entire tree.

collapseComplete

void collapseComplete ()
Function executed when the collapse animation completes

draw

void draw ()
Renders the tree boilerplate and visible nodes

expandAll

void expandAll ()
Expands all child nodes. YAHOO.widget.TreeView.prototype.Note = this;conflicts with the "multiExpand" node property. If expand all is called in a tree with nodes that do not allow multiple siblings to be displayed, only the last sibling will be expanded.

expandComplete

void expandComplete ()
Function executed when the expand animation completes

getNodeByIndex

Node getNodeByIndex (<int> nodeIndex)
Returns a node in the tree that has the specified index (this index is created internally, so this function probably will only be used in html generated for a given node.)
Parameters:
nodeIndex - the index of the node wanted
Returns:
the node with index=nodeIndex, null if no match

getNodeByProperty

Node getNodeByProperty (<object> property, <object> value)
Returns a node that has a matching property and value in the data object that was passed into its constructor. Provides a flexible way for the implementer to get a particular node.
Parameters:
property - the property to search (usually a string)
value - the value we want to find (usuall an int or string)
Returns:
the matching node, null if no match

getRoot

Node getRoot ()
Returns the root node of this tree
Returns:
the root node

onCollapse

void onCollapse (node)
Abstract method that is executed when a node is collapsed
Parameters:
node - {Node} the node that was collapsed.

onExpand

void onExpand (node)
Abstract method that is executed when a node is expanded
Parameters:
node - {Node} the node that was expanded

setCollapseAnim

void setCollapseAnim (type)
Sets up the animation for collapsing children
Parameters:
the - type of animation (acceptable constants in YAHOO.widget.TVAnim)

setDynamicLoad

void setDynamicLoad (<function> fnDataLoader)
Configures this tree to dynamically load all child data
Parameters:
fnDataLoader - the function that will be called to get the data

setExpandAnim

void setExpandAnim (type)
Sets up the animation for expanding children
Parameters:
the - type of animation (acceptable constants in YAHOO.widget.TVAnim)

addHandler

void addHandler (el, <string> sType, <function> fn, <boolean> capture)
Adds an event. Replace with event manager when available
Parameters:
el - the elment to bind the handler to
sType - the type of event handler
fn - the callback to invoke
capture - if true event is capture phase, bubble otherwise

getNode

Node getNode (treeId, nodeIndex)
Global method for getting a node by its id. Used in the generated tree html.
Parameters:
treeId - {String} the id of the tree instance
nodeIndex - {String} the index of the node to return
Returns:
the node instance requested, null if not found

getTree

TreeView getTree (treeId)
Global method for getting a tree by its id. Used in the generated tree html.
Parameters:
treeId - {String} the id of the tree instance
Returns:
the tree instance requested, null if not found.

preload

void preload ()
Attempts to preload the images defined in the styles used to draw the tree by rendering off-screen elements that use the styles.