org.apache.cocoon.forms.formmodel.tree
Class SourceTreeModel

java.lang.Object
  extended by org.apache.cocoon.forms.formmodel.tree.SourceTreeModel
All Implemented Interfaces:
TreeModel

public class SourceTreeModel
extends Object
implements TreeModel

A TreeModel that builds a hierarchy of TraversableSources.

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

Constructor Summary
SourceTreeModel(SourceResolver resolver, String rootURL)
           
SourceTreeModel(SourceTreeModelDefinition definition)
           
 
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 obj)
          Returns true if node is a leaf.
 void removeTreeModelListener(TreeModelListener l)
          Removes a listener previously added with TreeModel.addTreeModelListener(TreeModelListener).
 void setRootSource(TraversableSource src)
           
 void setRootURL(String url)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SourceTreeModel

public SourceTreeModel(SourceResolver resolver,
                       String rootURL)

SourceTreeModel

public SourceTreeModel(SourceTreeModelDefinition definition)
Method Detail

getRoot

public Object getRoot()
Description copied from interface: TreeModel
Returns the root of the tree. Returns null only if the tree has no nodes.

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

getChildren

public Collection getChildren(Object parent)
Specified by:
getChildren in interface TreeModel

isLeaf

public boolean isLeaf(Object obj)
Description copied from interface: TreeModel
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.

Specified by:
isLeaf in interface TreeModel
Parameters:
obj - a node in the tree, obtained from this data source
Returns:
true if node is a leaf

getChildKey

public String getChildKey(Object parent,
                          Object child)
Specified by:
getChildKey in interface TreeModel

getChild

public Object getChild(Object parent,
                       String key)
Specified by:
getChild in interface TreeModel

setRootURL

public void setRootURL(String url)

setRootSource

public void setRootSource(TraversableSource src)

addTreeModelListener

public void addTreeModelListener(TreeModelListener l)
Description copied from interface: TreeModel
Adds a listener for the TreeModelEvent posted after the tree changes.

Specified by:
addTreeModelListener in interface TreeModel
Parameters:
l - the listener to add

removeTreeModelListener

public void removeTreeModelListener(TreeModelListener l)
Description copied from interface: TreeModel
Removes a listener previously added with TreeModel.addTreeModelListener(TreeModelListener).

Specified by:
removeTreeModelListener in interface TreeModel
Parameters:
l - the listener to remove

getNode

public Object getNode(TreePath path)
Specified by:
getNode in interface TreeModel


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