Alloy UI

aui-tree  1.0.1

 
Filters
Configuration Attributes

Class TreeData - extends Base

Known Subclasses:
TreeView TreeNode
A base class for TreeData, providing:
  • Widget Lifecycle (initializer, renderUI, bindUI, syncUI, destructor)
  • Handle the data of the tree
  • Basic DOM implementation (append/remove/insert)
  • Indexing management to handle the children nodes
Check the list of Configuration Attributes available for TreeData.

Constructor

TreeData ( config )
Parameters:
config <Object> Object literal specifying widget configuration properties.

Properties

TreeData.ATTRS - static Object

Static property used to define the default attribute configuration for the TreeData.

TreeData.NAME - static String

Static property provides a string to identify the class.

UI_EVENTS - protected Object

Empty UI_EVENTS.

Properties inherited from Attribute:

Properties inherited from Base:

Configuration Attributes

children - Array

Array of children (i.e. could be a JSON metadata object or a TreeNode instance).
Default Value: []

container - Node | String

Container to nest children nodes. If has cntainer it's not a leaf.
Default Value: null

index - Object

Index the nodes.
Default Value: {}

Configuration attributes inherited from Base:

Methods

_appendChild

protected void _appendChild ( node , cancelBubbling )
Append a child node to the TreeData.
Parameters:
node <TreeNode>
cancelBubbling <boolean>

_collapseAll

protected void _collapseAll ( )
Collapse all children of the TreeData.

_expandAll

protected void _expandAll ( )
Expand all children of the TreeData.

_removeChild

void _removeChild ( node )
Remove the passed node from the current TreeData.
Parameters:
node <TreeData>

_setChildren

protected Array _setChildren ( v )
Setter for children.
Parameters:
v <Array>

appendChild

void appendChild ( node , cancelBubbling )
Append a child node to the TreeData.
Parameters:
node <TreeNode>
cancelBubbling <boolean>

bubbleEvent

void bubbleEvent ( eventType , args , cancelBubbling , stopActionPropagation )
Bubble event to all parent nodes.
Parameters:
eventType <String>
args <Array>
cancelBubbling <boolean>
stopActionPropagation <boolean>

collapseAll

void collapseAll ( )
Collapse all children of the TreeData.

createNode

TreeNode createNode ( options )
Create a TreeNode instance.
Parameters:
options <Object>

eachChildren

void eachChildren ( fn )
Loop each children and execute the fn callback.
Parameters:
fn <function> callback
fn <boolean> recursive

empty

void empty ( )
Delete all children of the current TreeData.

expandAll

void expandAll ( )
Expand all children of the TreeData.

getChildren

Array getChildren ( deep )
Get an Array of the children nodes of the current TreeData.
Parameters:
deep <boolean>

getEventOutputMap

Object getEventOutputMap ( node )
Get an object containing metadata for the custom events.
Parameters:
node <TreeData>

getNodeByChild

TreeNode getNodeByChild ( child )
Get a TreeNode instance by a child DOM Node.
Parameters:
child <Node>

getNodeById

TreeNode getNodeById ( uid )
Get a TreeNode by id.
Parameters:
uid <String>

hasChildNodes

boolean hasChildNodes ( )
Whether the TreeData contains children or not.

indexOf

Number indexOf ( node )
Index of the passed TreeNode on the children attribute.
Parameters:
node <TreeNode>

initializer

protected void initializer ( )
Construction logic executed during TreeData instantiation. Lifecycle.

insert

void insert ( treeNode , refTreeNode , where )
Insert treeNode before or after the refTreeNode.
Parameters:
treeNode <TreeNode>
refTreeNode <TreeNode>
where <TreeNode> 'before' or 'after'

insertAfter

void insertAfter ( treeNode , refTreeNode )
Insert treeNode after the refTreeNode.
Parameters:
treeNode <TreeNode>
refTreeNode <TreeNode>

insertBefore

void insertBefore ( treeNode , refTreeNode )
Insert treeNode before the refTreeNode.
Parameters:
treeNode <TreeNode>
refTreeNode <TreeNode>

isRegistered

boolean isRegistered ( node )
Whether the TreeNode is registered on this TreeData.
Parameters:
node <TreeNode>

item

TreeNode item ( index )
Get a TreeNode children by index.
Parameters:
index <Number>

refreshIndex

void refreshIndex ( )
Refresh the index (i.e. re-index all nodes).

registerNode

void registerNode ( node )
Register the passed TreeNode on this TreeData.
Parameters:
node <TreeNode>

removeChild

void removeChild ( node )
Remove the passed node from the current TreeData.
Parameters:
node <TreeData>

selectAll

void selectAll ( )
Select all children of the TreeData.

unregisterNode

void unregisterNode ( node )
Unregister the passed TreeNode from this TreeData.
Parameters:
node <TreeNode>

updateIndex

void updateIndex ( index )
Update the index attribute value.
Parameters:
index <Object>

updateReferences

void updateReferences ( TreeNode , TreeView )
Update the references of the passed TreeNode.
Parameters:
TreeNode <node>
TreeNode <parentNode>
TreeView <ownerTree>

Events

childrenChange

childrenChange ( event )
Fires when the value for the configuration attribute 'children' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.
Parameters:
event<Event.Facade> An Event Facade object with the following attribute specific properties added:
prevVal
The value of the attribute, prior to it being set
newVal
The value the attribute is to be set to
attrName
The name of the attribute being set
subAttrName
If setting a property within the attribute's value, the name of the sub-attribute property being set

containerChange

containerChange ( event )
Fires when the value for the configuration attribute 'container' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.
Parameters:
event<Event.Facade> An Event Facade object with the following attribute specific properties added:
prevVal
The value of the attribute, prior to it being set
newVal
The value the attribute is to be set to
attrName
The name of the attribute being set
subAttrName
If setting a property within the attribute's value, the name of the sub-attribute property being set

indexChange

indexChange ( event )
Fires when the value for the configuration attribute 'index' is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.
Parameters:
event<Event.Facade> An Event Facade object with the following attribute specific properties added:
prevVal
The value of the attribute, prior to it being set
newVal
The value the attribute is to be set to
attrName
The name of the attribute being set
subAttrName
If setting a property within the attribute's value, the name of the sub-attribute property being set

Events inherited from Base: