org.zkoss.zkdemo.test2.tree
Class BinaryTreeModel

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

public class BinaryTreeModel
extends AbstractTreeModel

A simple implementation of binary tree model by an arraylist

Author:
Jeff Liu
See Also:
Serialized Form

Constructor Summary
BinaryTreeModel(java.util.List tree)
          Constructor
 
Method Summary
 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.
 boolean isLeaf(java.lang.Object node)
          Returns true if node is a leaf.
 
Methods inherited from class org.zkoss.zul.AbstractTreeModel
addTreeDataListener, fireEvent, getPath, getRoot, removeTreeDataListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryTreeModel

public BinaryTreeModel(java.util.List tree)
Constructor

Parameters:
tree - the list is contained all data of nodes.
Method Detail

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

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


Copyright © 2005-2009 Potix Corporation. All Rights Reserved. SourceForge.net Logo