EchoPoint API - 3.0.0b5
App Webcontainer

echopoint.tree
Class DefaultTreeModel

java.lang.Object
  extended by nextapp.echo.extras.app.tree.AbstractTreeModel
      extended by echopoint.tree.DefaultTreeModel
All Implemented Interfaces:
Serializable, TreeModel

public class DefaultTreeModel
extends AbstractTreeModel

A simple tree model that uses TreeNodes.

Since:
3.0.0b3
Version:
$Id: DefaultTreeModel.java 248 2009-10-19 14:20:53Z sptrakesh $
Author:
Brad Baker, Rakesh 2009-05-29
See Also:
Serialized Form

Field Summary
protected  TreeNode root
          Root of the tree.
 
Fields inherited from class nextapp.echo.extras.app.tree.AbstractTreeModel
listenerList
 
Constructor Summary
DefaultTreeModel(TreeNode root)
          Creates a tree with the specified root node.
 
Method Summary
 void addChild(DefaultMutableTreeNode parent, DefaultMutableTreeNode child)
           
 Object getChild(Object parent, int index)
          Returns the child of parent at index index in the parent's child array.
 int getChildCount(Object parent)
          Returns the number of children of parent .
 int getColumnCount()
          
 int getIndexOfChild(Object parent, Object child)
          Returns the index of child in parent.
 Object getRoot()
          Returns the root of the tree.
 Object getValueAt(Object node, int column)
          
 boolean isLeaf(Object node)
          Returns whether the specified node is a leaf node.
 void removeChild(DefaultMutableTreeNode parent, DefaultMutableTreeNode child)
           
 
Methods inherited from class nextapp.echo.extras.app.tree.AbstractTreeModel
addTreeModelListener, fireTreeNodesChanged, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, getColumnClass, getColumnName, removeTreeModelListener, valueForPathChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

root

protected TreeNode root
Root of the tree.

Constructor Detail

DefaultTreeModel

public DefaultTreeModel(TreeNode root)
Creates a tree with the specified root node.

Parameters:
root - a TreeNode object that is the root of the tree
Method Detail

getChild

public Object getChild(Object parent,
                       int index)
Returns the child of parent at index index in the parent's child array. parent must be a node previously obtained from this data source. This should not return null if index is a valid index for parent (that is index >= 0 && index < getChildCount( parent )).

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

getChildCount

public int getChildCount(Object parent)
Returns the number of children of parent . Returns 0 if the node is a leaf or if it has no children. parent must be a node previously obtained from this data source.

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

getColumnCount

public int getColumnCount()


getIndexOfChild

public int getIndexOfChild(Object parent,
                           Object child)
Returns the index of child in parent.


getRoot

public Object getRoot()
Returns the root of the tree. Returns null only if the tree has no nodes.

Returns:
the root of the tree

getValueAt

public Object getValueAt(Object node,
                         int column)


isLeaf

public boolean isLeaf(Object node)
Returns whether the specified node is a leaf node. The way the test is performed depends on the askAllowsChildren setting.


addChild

public void addChild(DefaultMutableTreeNode parent,
                     DefaultMutableTreeNode child)

removeChild

public void removeChild(DefaultMutableTreeNode parent,
                        DefaultMutableTreeNode child)

EchoPoint API - 3.0.0b5
App Webcontainer