org.zkoss.zkdemo.test2.tree
Class TreeModelA

java.lang.Object
  extended by org.zkoss.zul.AbstractTreeModel
      extended by org.zkoss.zkdemo.test2.tree.TreeModelA
All Implemented Interfaces:
java.io.Serializable, TreeModel

public class TreeModelA
extends AbstractTreeModel

A simple implementation of TreeModel.

Author:
Jeff Liu
See Also:
Serialized Form

Constructor Summary
TreeModelA(java.lang.Object root)
          Constructor.
 
Method Summary
 void add(java.lang.Object parent, java.lang.Object[] newNodes)
          append new nodes which parent is parent by new nodes newNodes
 java.lang.Object getChild(java.lang.Object parent, int index)
          Returns the child of parent at index index in the parent's child array.
 int getChildCount(java.lang.Object parent)
          Returns the number of children of parent.
 java.lang.Object getRoot()
          Return the root of tree
 void insert(java.lang.Object parent, int indexFrom, int indexTo, java.lang.Object[] newNodes)
          insert new nodes which parent is parent with indexes indexes by new nodes newNodes
 boolean isLeaf(java.lang.Object node)
          Returns true if node is a leaf.
 void remove(java.lang.Object parent, int indexFrom, int indexTo)
          remove the nodes which parent is parent with indexes indexes
 void set(java.lang.Object parent, int indexFrom, int indexTo, java.lang.Object[] values)
          Modify the nodes which parent is parent with indexes indexes by values
 
Methods inherited from class org.zkoss.zul.AbstractTreeModel
addTreeDataListener, fireEvent, getPath, removeTreeDataListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeModelA

public TreeModelA(java.lang.Object root)
Constructor.

Parameters:
root - - the root of tree
Method Detail

getChildCount

public int getChildCount(java.lang.Object parent)
Description copied from interface: TreeModel
Returns the number of children of parent.

Parameters:
parent - a node in the tree, obtained from this data source
Returns:
the number of children of the node parent

isLeaf

public boolean isLeaf(java.lang.Object node)
Description copied from interface: TreeModel
Returns true if node is a leaf.

Parameters:
node - a node in the tree, obtained from this data source
Returns:
true if node is a leafs

getChild

public java.lang.Object getChild(java.lang.Object parent,
                                 int index)
Description copied from interface: TreeModel
Returns the child of parent at index index in the parent's child array.

Parameters:
parent - a node in the tree, obtained from this data source
Returns:
the child of parent at index index

getRoot

public java.lang.Object getRoot()
Description copied from class: AbstractTreeModel
Return the root of tree

Specified by:
getRoot in interface TreeModel
Overrides:
getRoot in class AbstractTreeModel
Returns:
the root of tree

set

public void set(java.lang.Object parent,
                int indexFrom,
                int indexTo,
                java.lang.Object[] values)
         throws java.lang.IndexOutOfBoundsException
Modify the nodes which parent is parent with indexes indexes by values

Parameters:
parent - The parent of nodes are modified
indexFrom - the lower index of the change range
indexTo - the upper index of the change range
values - The new values of nodes are modified
Throws:
java.lang.IndexOutOfBoundsException - - indexFrom < 0 or indexTo > number of parent's children

remove

public void remove(java.lang.Object parent,
                   int indexFrom,
                   int indexTo)
            throws java.lang.IndexOutOfBoundsException
remove the nodes which parent is parent with indexes indexes

Parameters:
parent - The parent of nodes are removed
indexFrom - the lower index of the change range
indexTo - the upper index of the change range
Throws:
java.lang.IndexOutOfBoundsException - - indexFrom < 0 or indexTo > number of parent's children

add

public void add(java.lang.Object parent,
                java.lang.Object[] newNodes)
append new nodes which parent is parent by new nodes newNodes

Parameters:
parent - The parent of nodes are appended
newNodes - New nodes which are appended

insert

public void insert(java.lang.Object parent,
                   int indexFrom,
                   int indexTo,
                   java.lang.Object[] newNodes)
            throws java.lang.IndexOutOfBoundsException
insert new nodes which parent is parent with indexes indexes by new nodes newNodes

Parameters:
parent - The parent of nodes are inserted
indexFrom - the lower index of the change range
indexTo - the upper index of the change range
newNodes - New nodes which are inserted
Throws:
java.lang.IndexOutOfBoundsException - - indexFrom < 0 or indexTo > number of parent's children


Copyright &copy; 2005-2009 Potix Corporation. All Rights Reserved. SourceForge.net Logo