private
void
_deleteNode
(
)
Deletes the node and recurses children
boolean
animateCollapse
(
el
,
node
)
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
-
node <YAHOO.util.Node>
the node that was expanded
- Returns:
boolean
- true if animation could be invoked, false otherwise
boolean
animateExpand
(
el
,
node
)
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
-
node <YAHOO.util.Node>
the node that was expanded
- Returns:
boolean
- true if animation could be invoked, false otherwise
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. 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.
void
expandComplete
(
)
Function executed when the expand animation completes
private
void
generateId
(
)
Generates an unique id for an element if it doesn't yet have one
HTMLElement
getEl
(
)
Returns the tree's host element
- Returns:
HTMLElement
- the host element
Node
getNodeByIndex
(
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 <int>
the index of the node wanted
- Returns:
Node
- the node with index=nodeIndex, null if no match
Node
getNodeByProperty
(
property
,
value
)
Returns a node that has a matching property and value in the data
object that was passed into its constructor.
- Parameters:
-
property <object>
the property to search (usually a string)
-
value <object>
the value we want to find (usuall an int or string)
- Returns:
Node
- the matching node, null if no match
Array
getNodesByProperty
(
property
,
value
)
Returns a collection of nodes that have a matching property
and value in the data object that was passed into its constructor.
- Parameters:
-
property <object>
the property to search (usually a string)
-
value <object>
the value we want to find (usuall an int or string)
- Returns:
Array
- the matching collection of nodes, null if no match
Node
getRoot
(
)
Returns the root node of this tree
- Returns:
Node
- the root node
private
void
init
(
)
Initializes the tree
void
onCollapse
(
node
)
Abstract method that is executed when a node is collapsed.
- Parameters:
-
node <Node>
the node that was collapsed.
- Returns:
void
Deprecated use treeobj.subscribe("collapse") instead
void
onExpand
(
node
)
Abstract method that is executed when a node is expanded
- Parameters:
-
node <Node>
the node that was expanded
- Returns:
void
Deprecated use treeobj.subscribe("expand") instead
void
popNode
(
the
)
Removes the node from the tree, preserving the child collection
to make it possible to insert the branch into another part of the
tree, or another tree.
- Parameters:
-
the <Node>
node to remove
- Returns:
void
private
void
regNode
(
node
)
Nodes register themselves with the tree instance when they are created.
- Parameters:
-
node <Node>
the node to register
- Returns:
void
void
removeChildren
(
node
)
Deletes this nodes child collection, recursively. Also collapses
the node, and resets the dynamic load flag. The primary use for
this method is to purge a node and allow it to fetch its data
dynamically again.
- Parameters:
-
node <Node>
the node to purge
- Returns:
void
boolean
removeNode
(
The
,
autoRefresh
)
Removes the node and its children, and optionally refreshes the
branch of the tree that was affected.
- Parameters:
-
The <Node>
node to remove
-
autoRefresh <boolean>
automatically refreshes branch if true
- Returns:
boolean
- False is there was a problem, true otherwise.
void
setCollapseAnim
(
the
)
Sets up the animation for collapsing children
- Parameters:
-
the <string>
type of animation (acceptable values defined in
YAHOO.widget.TVAnim)
- Returns:
void
void
setDynamicLoad
(
fnDataLoader
,
iconMode
)
Configures this tree to dynamically load all child data
- Parameters:
-
fnDataLoader <function>
the function that will be called to get the data
-
iconMode <int>
configures the icon that is displayed when a dynamic
load node is expanded the first time without children. By default, the
"collapse" icon will be used. If set to 1, the leaf node icon will be
displayed.
- Returns:
void
void
setExpandAnim
(
type
)
Sets up the animation for expanding children
- Parameters:
-
type <string>
the type of animation (acceptable values defined
in YAHOO.widget.TVAnim)
- Returns:
void
void
setUpLabel
(
oData
)
Sets up the node label
- Parameters:
-
oData <Object>
string containing the label, or an object with a label property
- Returns:
void
string
toString
(
)
TreeView instance toString
- Returns:
string
- string representation of the tree
static
void
YAHOO.widget.TreeView.addHandler
(
el
,
sType
,
fn
)
Add a DOM event
- Parameters:
-
el <Object>
the elment to bind the handler to
-
sType <string>
the type of event handler
-
fn <function>
the callback to invoke
- Returns:
void
static
Node
YAHOO.widget.TreeView.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:
Node
- the node instance requested, null if not found
static
TreeView
YAHOO.widget.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:
TreeView
- the tree instance requested, null if not found.
static
void
YAHOO.widget.TreeView.preload
(
prefix
)
Attempts to preload the images defined in the styles used to draw the tree by
rendering off-screen elements that use the styles.
- Parameters:
-
prefix <string>
the prefix to use to generate the names of the
images to preload, default is ygtv
- Returns:
void
static
void
YAHOO.widget.TreeView.removeHandler
(
el
,
sType
,
fn
)
Remove a DOM event
- Parameters:
-
el <Object>
the elment to bind the handler to
-
sType <string>
the type of event handler
-
fn <function>
the callback to invoke
- Returns:
void