org.apache.cocoon.forms.formmodel.tree
Interface TreeModel

All Known Implementing Classes:
DefaultTreeModel, DefaultTreeModel.Sample, SourceTreeModel

public interface TreeModel

Data model for the Tree widget, inspired by Swing's TreeModel, with the difference that child nodes are accessed through keys rather than indices.

Version:
$Id: TreeModel.html 1304258 2012-03-23 10:09:27Z ilgrosso $

Method Summary
 void addTreeModelListener(TreeModelListener l)
          Adds a listener for the TreeModelEvent posted after the tree changes.
 Object getChild(Object parent, String key)
           
 String getChildKey(Object parent, Object child)
           
 Collection getChildren(Object parent)
           
 Object getNode(TreePath path)
           
 Object getRoot()
          Returns the root of the tree.
 boolean isLeaf(Object node)
          Returns true if node is a leaf.
 void removeTreeModelListener(TreeModelListener l)
          Removes a listener previously added with addTreeModelListener(TreeModelListener).
 

Method Detail

getRoot

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

Returns:
the root of the tree

getChildren

Collection getChildren(Object parent)

isLeaf

boolean isLeaf(Object node)
Returns true if node is a leaf. It is possible for this method to return false even if node has no children. A directory in a filesystem, for example, may contain no files; the node representing the directory is not a leaf, but it also has no children.

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

getChildKey

String getChildKey(Object parent,
                   Object child)

getChild

Object getChild(Object parent,
                String key)

getNode

Object getNode(TreePath path)

addTreeModelListener

void addTreeModelListener(TreeModelListener l)
Adds a listener for the TreeModelEvent posted after the tree changes.

Parameters:
l - the listener to add

removeTreeModelListener

void removeTreeModelListener(TreeModelListener l)
Removes a listener previously added with addTreeModelListener(TreeModelListener).

Parameters:
l - the listener to remove


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.