org.sgx.j2s.aui.tree
Class TreeData

Package class diagram package TreeData
java.lang.Object
  extended by org.sgx.j2s.js.NativeWrapper
      extended by org.sgx.j2s.yui3.yui.YUINativeWrapper
          extended by org.sgx.j2s.yui3.yui.event.EventTarget
              extended by org.sgx.j2s.yui3.yui.Attribute
                  extended by org.sgx.j2s.yui3.yui.Base
                      extended by org.sgx.j2s.yui3.yui.widget.Widget
                          extended by org.sgx.j2s.aui.tree.TreeData
Direct Known Subclasses:
TreeNode, TreeView

public class TreeData
extends Widget

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 Note: in AUI, TreeData extends Base not widget. Then in AUI, a TreeView is not a Widget...


Field Summary
 
Fields inherited from class org.sgx.j2s.yui3.yui.YUINativeWrapper
Y
 
Fields inherited from class org.sgx.j2s.js.NativeWrapper
_data, _EMPTYPARAMS
 
Constructor Summary
TreeData()
           
 
Method Summary
 void appendChild(TreeNode node, boolean cancelBubbling)
          Append a child node to the TreeData.
 void bubbleEvent(java.lang.String eventType, java.lang.Object[] args, boolean cancelBubbling, boolean stopActionPropagation)
          Bubble event to all parent nodes.
 void collapseAll()
          Collapse all children of the TreeData.
 TreeNode createNode(java.lang.Object options)
          Create a TreeNode instance.
 void eachChildren(java.lang.Runnable callback, boolean recursive)
          Loop each children and execute the fn callback.
 void eachParent(java.lang.Runnable callback)
          Loop each parent node and execute the fn callback.
 void empty()
          Delete all children of the current TreeData.
 void expandAll()
          expand all children of the TreeData.
 TreeNode[] getChildren(boolean deep)
          Get an Array of the children nodes of the current TreeData.
 java.lang.Object getEventOutputMap(TreeNode node)
          Get an object containing metadata for the custom events.
 TreeNode getNodeByChild(Node child)
          Get a TreeNode instance by a child DOM Node.
 TreeNode getNodeById(java.lang.String id)
          Get a TreeNode by id.
 boolean hasChildNodes()
          Whether the TreeData contains children or not.
 int indexOf(int index)
          Index of the passed TreeNode on the children attribute.
 void insert(TreeNode treeNode, TreeNode refTreeNode, java.lang.String where)
          Insert treeNode before or after the refTreeNode.
 void insertAfter(TreeNode treeNode, TreeNode refTreeNode)
          Insert treeNode after the refTreeNode.
 void insertBefore(TreeNode treeNode, TreeNode refTreeNode)
          Insert treeNode before the refTreeNode.
 boolean isRegistered(TreeNode node)
          Whether the TreeNode is registered on this TreeData.
 TreeNode item(int index)
          Get a TreeNode children by index.
 void refreshIndex()
          Refresh the index (i.e. re-index all nodes).
 void registerNode(TreeNode node)
          Register the passed TreeNode on this TreeData.
 void removeChild(TreeNode node)
          Remove the passed node from the current TreeData.
 void selectAll()
          Select all children of the TreeData.
 void unregisterNode(TreeNode node)
          Unregister the passed TreeNode from this TreeData.
 void unselectAll()
          Unselect all children of the TreeData.
 void updateIndex(java.lang.Object index)
          Update the index attribute value.
 void updateReferences(TreeNode node, TreeNode parentNode, TreeView ownerTree)
          Update the references of the passed TreeNode.
 
Methods inherited from class org.sgx.j2s.yui3.yui.widget.Widget
blur, disable, enable, focus, getByNode, getClassName, getDefaultLocale, getSkinName, getString, getStrings, hide, render, show
 
Methods inherited from class org.sgx.j2s.yui3.yui.Attribute
addAttr, addAttrs, attrAdded, get, getAttrs, modifyAttr, removeAttr, reset, set, setAttrs
 
Methods inherited from class org.sgx.j2s.yui3.yui.event.EventTarget
after, before, detach, detachAll, fire, getEvent, on, once, publish
 
Methods inherited from class org.sgx.j2s.yui3.yui.YUINativeWrapper
_load
 
Methods inherited from class org.sgx.j2s.js.NativeWrapper
_call, _get, _getData, create
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeData

public TreeData()
Method Detail

getNodeById

public TreeNode getNodeById(java.lang.String id)
Get a TreeNode by id.

Parameters:
{String} - uid
Returns:
{TreeNode}

isRegistered

public boolean isRegistered(TreeNode node)
Whether the TreeNode is registered on this TreeData.

Parameters:
{TreeNode} - node
Returns:
{boolean}

updateReferences

public void updateReferences(TreeNode node,
                             TreeNode parentNode,
                             TreeView ownerTree)
Update the references of the passed TreeNode.

Parameters:
{node} - TreeNode
{parentNode} - TreeNode
{ownerTree} - TreeView

refreshIndex

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


registerNode

public void registerNode(TreeNode node)
Register the passed TreeNode on this TreeData.

Parameters:
{TreeNode} - node

updateIndex

public void updateIndex(java.lang.Object index)
Update the index attribute value.

Parameters:
{Object} - index

unregisterNode

public void unregisterNode(TreeNode node)
Unregister the passed TreeNode from this TreeData.

Parameters:
{TreeNode} - node

collapseAll

public void collapseAll()
Collapse all children of the TreeData.


expandAll

public void expandAll()
expand all children of the TreeData.


selectAll

public void selectAll()
Select all children of the TreeData.


unselectAll

public void unselectAll()
Unselect all children of the TreeData.


eachChildren

public void eachChildren(java.lang.Runnable callback,
                         boolean recursive)
Loop each children and execute the fn callback.

Parameters:
{function} - fn callback
{boolean} - fn recursive

eachParent

public void eachParent(java.lang.Runnable callback)
Loop each parent node and execute the fn callback.

Parameters:
{function} - fn callback

bubbleEvent

public void bubbleEvent(java.lang.String eventType,
                        java.lang.Object[] args,
                        boolean cancelBubbling,
                        boolean stopActionPropagation)
Bubble event to all parent nodes.

Parameters:
{String} - eventType
{Array} - args
{boolean} - cancelBubbling
{boolean} - stopActionPropagation

createNode

public TreeNode createNode(java.lang.Object options)
Create a TreeNode instance.

Parameters:
{Object} - options
Returns:
{TreeNode}

appendChild

public void appendChild(TreeNode node,
                        boolean cancelBubbling)
Append a child node to the TreeData.

Parameters:
{TreeNode} - node
{boolean} - cancelBubbling

item

public TreeNode item(int index)
Get a TreeNode children by index.

Parameters:
{Number} - index
Returns:
{TreeNode}

indexOf

public int indexOf(int index)
Index of the passed TreeNode on the children attribute.

Parameters:
{TreeNode} - node
Returns:
{Number}

hasChildNodes

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


getChildren

public TreeNode[] getChildren(boolean deep)
Get an Array of the children nodes of the current TreeData.


getEventOutputMap

public java.lang.Object getEventOutputMap(TreeNode node)
Get an object containing metadata for the custom events.


removeChild

public void removeChild(TreeNode node)
Remove the passed node from the current TreeData.


empty

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


insert

public void insert(TreeNode treeNode,
                   TreeNode refTreeNode,
                   java.lang.String where)
Insert treeNode before or after the refTreeNode.

Parameters:
treeNode -
refTreeNode -
where - 'before' or 'after'

insertAfter

public void insertAfter(TreeNode treeNode,
                        TreeNode refTreeNode)
Insert treeNode after the refTreeNode.

Parameters:
{TreeNode} - treeNode
{TreeNode} - refTreeNode

insertBefore

public void insertBefore(TreeNode treeNode,
                         TreeNode refTreeNode)
Insert treeNode before the refTreeNode.

Parameters:
{TreeNode} - treeNode
{TreeNode} - refTreeNode

getNodeByChild

public TreeNode getNodeByChild(Node child)
Get a TreeNode instance by a child DOM Node.

Parameters:
{Node} - child
Returns:
{TreeNode}