Class Index | File Index

Classes


Class MochiKit.Widget.Tree


Extends MochiKit.Widget.
The tree widget class. Used to provide a dynamic tree with expandable tree nodes, using a number of <div> HTML elements. The the "onexpand" and "onselect" event are emitted whenever a node is expanded, collapsed or selected.
Defined in: Widget.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Creates a new tree widget.
Fields borrowed from class MochiKit.Widget:
_id, Classes
Method Summary
Method Attributes Method Name and Description
 
Emits a signal when a node has been expanded or collapsed.
 
Sets the currently selected node in the tree.
 
addChildNode(child)
Adds a single child tree node widget to this widget.
 
addPath(path)
Adds a path to the tree as a recursive list of child nodes.
 
collapseAll(depth)
Recursively collapses all nodes.
 
expandAll(depth)
Recursively expands all nodes.
 
findByPath(path)
Searches for a tree node from the specified path.
 
findRoot(name)
Finds a root tree node with the specified name.
 
Marks all tree nodes as unmodified.
 
Removes all tree nodes that are marked as unmodified.
 
Returns the currently selected tree node.
Methods borrowed from class MochiKit.Widget:
_animQueueId, _createWidgetTreeElem, _eventHandler, _widgetMixin, addAll, addClass, animate, blurAll, createWidget, createWidgetTree, destroy, destroyWidget, emitSignal, getChildNodes, hasClass, hide, isFormField, isHidden, isWidget, removeAll, removeChildNode, removeClass, setAttrs, setStyle, show, toggleClass
Class Detail
MochiKit.Widget.Tree(attrs)
Creates a new tree widget.
Parameters:
{Object} attrs
the widget and node attributes
{Widget} ... Optional
the child tree node widgets
Returns:
{Widget} the widget DOM node
Method Detail
_emitExpand(node)
Emits a signal when a node has been expanded or collapsed.
Parameters:
{Widget} node
the affected tree node

_handleSelect(node)
Sets the currently selected node in the tree. This method is only called from the tree node select() and unselect() methods.
Parameters:
{Widget} node
the new selected tree node, or null for none

addChildNode(child)
Adds a single child tree node widget to this widget.
Parameters:
{Widget} child
the tree node widget to add

{Widget} addPath(path)
Adds a path to the tree as a recursive list of child nodes. If nodes in the specified path already exists, they will be used instead of creating new nodes.
Parameters:
{Array} path
the tree node path (array of names)
Returns:
{Widget} the last node in the path

collapseAll(depth)
Recursively collapses all nodes. If a depth is specified, only nodes below that depth will be collapsed.
Parameters:
{Number} depth Optional
the optional minimum depth

expandAll(depth)
Recursively expands all nodes. If a depth is specified, expansions will not continue below that depth.
Parameters:
{Number} depth Optional
the optional maximum depth

{Widget} findByPath(path)
Searches for a tree node from the specified path.
Parameters:
{Array} path
the tree node path (array of names)
Returns:
{Widget} the descendant tree node found, or null if not found

{Widget} findRoot(name)
Finds a root tree node with the specified name.
Parameters:
{String} name
the root tree node name
Returns:
{Widget} the root tree node found, or null if not found

markAll()
Marks all tree nodes as unmodified. When adding or updating nodes, they (and their parent nodes) are automatically marked as modified. This function makes tree pruning possible, by initially marking all tree nodes (clearing any previous modified flag), touching all nodes to be kept, and finally calling the removeAllMarked() method to remove the remaining nodes.

removeAllMarked()
Removes all tree nodes that are marked as unmodified. When adding or updating nodes, they (and their parent nodes) are automatically marked as modified. This function makes tree pruning possible, by initially marking all tree nodes as unmodified (clearing any previous modified flag), touching all nodes to be kept, and finally calling this method to remove the remaining nodes.

{Widget} selectedChild()
Returns the currently selected tree node.
Returns:
{Widget} the currently selected tree node, or null if no node is selected

Documentation generated by JsDoc Toolkit 2.0.2 on Sun May 24 2009 13:14:17 GMT+0200 (CEST)