org.apache.myfaces.custom.tree.model
Interface TreeModel

All Known Implementing Classes:
DefaultTreeModel

public interface TreeModel

Version:
$Revision: 472638 $ $Date: 2006-11-08 15:54:13 -0500 (Wed, 08 Nov 2006) $
Author:
Oliver Rossmueller

Method Summary
 java.lang.Object getChild(java.lang.Object parent, int index)
          Return the child of parent at index index in the parent's child array.
 int getChildCount(java.lang.Object parent)
          Answer the number of children of parent.
 int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
          Return the index of child in parent.
 java.lang.Object getRoot()
          Return the root of the tree.
 java.util.Collection getTreeModelListeners()
          Answer the mutable collection of tree model listeners.
 boolean isLeaf(java.lang.Object node)
          Answer true if node is a leaf.
 void valueForPathChanged(TreePath path, java.lang.Object newValue)
          Called when the value for the item identified by path has changed to newValue.
 

Method Detail

getRoot

java.lang.Object getRoot()
Return the root of the tree.

Returns:
the root of the tree or null, it this tree has no nodes

getChild

java.lang.Object getChild(java.lang.Object parent,
                          int index)
Return the child of parent at index index in the parent's child array.

Parameters:
parent - a node in the tree
Returns:
the child of parent at index index

getChildCount

int getChildCount(java.lang.Object parent)
Answer the number of children of parent.

Parameters:
parent - a node in the tree
Returns:
the number of children of the node parent

isLeaf

boolean isLeaf(java.lang.Object node)
Answer true if node is a leaf.

Parameters:
node - a node in the tree
Returns:
true if node is a leaf

valueForPathChanged

void valueForPathChanged(TreePath path,
                         java.lang.Object newValue)
Called when the value for the item identified by path has changed to newValue. If newValue signifies a truly new value the model should post a treeNodesChanged event.

Parameters:
path - path to the node that has been altered
newValue - the new value from the TreeCellEditor

getIndexOfChild

int getIndexOfChild(java.lang.Object parent,
                    java.lang.Object child)
Return the index of child in parent.

Parameters:
parent - a node in the tree
child - the node we are interested in
Returns:
the index of the child in the parent, or -1 if either child or parent are null

getTreeModelListeners

java.util.Collection getTreeModelListeners()
Answer the mutable collection of tree model listeners.

Returns:
Collection


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.