com.ibm.portal
Interface TreeModel<E>

All Known Subinterfaces:
ContentModel<E>, ContentModelController<T,M>, InvalidatableTreeModel<E>, LayoutModel<E>, LayoutModelController<T,M>, NavigationModel<E>, SearchableTreeModel<E>, SearchableTreeModelController<T,M>, TreeModelController<T,M>

public interface TreeModel<E>

This interface provides a generic tree model. Only elements that the model provides are valid input parameters to the methods of the tree model.

Since:
5.1.0.1

Method Summary
 java.util.Iterator<E> getChildren(E aNode)
          Returns an iterator over the child elements for the given node.
 E getParent(E aNode)
          Returns the parent of a given node.
 E getRoot()
          Returns the root node of the tree model.
 boolean hasChildren(E aNode)
          Returns whether or not the given node has children.
 

Method Detail

hasChildren

boolean hasChildren(E aNode)
                    throws ModelException,
                           ObjectNotFoundException
Returns whether or not the given node has children. Please pay attention to the documentation of the return value; it is not guaranteed that children are present if the method returns true - the iterator might be empty.

Parameters:
aNode - the node for which to check if it has children. If this node is no element produced by this model, a runtime exception (such as a ClassCastException or a NullPointerException) may occur.
Returns:
false if it has no children, true if children might be present.
Throws:
ModelException - an error occured during model operation
ObjectNotFoundException - the node or one of its children cannot be found in the model

getChildren

java.util.Iterator<E> getChildren(E aNode)
                                  throws ModelException,
                                         ObjectNotFoundException
Returns an iterator over the child elements for the given node.

Parameters:
aNode - the node for which to return its children. If this node is no element produced by this model, a runtime exception (such as a ClassCastException or a NullPointerException) may occur.
Returns:
an iterator over the child elements. If there are no children, this method returns an empty iterator. Please note that the correct way to call this is to check for children first.
Throws:
ModelException - an error occured during model operation
ObjectNotFoundException - the node or one of its children cannot be found in the model

getParent

E getParent(E aNode)
            throws ModelException,
                   ObjectNotFoundException
Returns the parent of a given node.

Parameters:
aNode - the node for which to return its parent. If this node is no element produced by this model, a runtime exception (such as a ClassCastException or a NullPointerException) may occur.
Returns:
the parent of the given node, or null if the node has no parent
Throws:
ModelException - an error occured during model operation
ObjectNotFoundException - the node or its parent could not be found

getRoot

E getRoot()
          throws ModelException,
                 ObjectNotFoundException
Returns the root node of the tree model.

Returns:
the root node. May be null if the model is empty.
Throws:
ModelException - an error occured during model operation
ObjectNotFoundException - the root node of the model could not be found