com.ibm.portal
Interface TreeModelController<T,M extends Modifiable>

Type Parameters:
T - the type of the read-only nodes the model exposes
M - the type of the modifiable nodes the model exposes
All Superinterfaces:
Controller, ModelController<T,M>, TreeModel<T>
All Known Subinterfaces:
CommittableTreeModelController<T,M>, ContentModelController<T,M>, LayoutModelController<T,M>, SearchableTreeModelController<T,M>

public interface TreeModelController<T,M extends Modifiable>
extends TreeModel<T>, ModelController<T,M>

This interface provides a controller for tree models which allows updating a model. The insert(Object, Object, Object) method inserts the specified node according to these rules:

  1. if both "aParent" and "aNext" are null, the specified node becomes the new root node of the model; the old root node will be the sole child of the new root node. All nodes of the model controller are preserved.
  2. if "aNext" is null and "aParent" is not null, the node is appended as the last child of "aParent"
  3. if both parameters are not null, the node is inserted as a child of the given parent before the specified sibling.

Since:
6.1.0

Method Summary
 boolean confirmDelete(T aNode)
          Indicates if the specified node may be deleted.
 boolean confirmInsert(T aParent)
          Indicates if a node may be inserted below the specified parent node.
 boolean confirmInsert(T aNode, T aParent, T aNext)
          Indicates if the specified node may be inserted into the location specified by a parent node and a next node.
 void delete(T aNode)
          Deletes a node from the model.
 void insert(T aNode, T aParent, T aNext)
          Inserts the node at the specified location in the tree model controller.
 
Methods inherited from interface com.ibm.portal.TreeModel
getChildren, getParent, getRoot, hasChildren
 
Methods inherited from interface com.ibm.portal.ModelController
confirmCreate, confirmGetModifiableNode, create, getModifiableNode, resolve
 

Method Detail

insert

void insert(T aNode,
            T aParent,
            T aNext)
            throws ObjectNotFoundException,
                   CannotInsertNodeException
Inserts the node at the specified location in the tree model controller. If the node already exists in the tree model, the node is moved to the specified location.

Parameters:
aNode - node to insert
aParent - parent node for the node to insert; may be null; if specified it must be part of the topology of the controller
aNext - successor node for the node to insert; may be null. "aNext" must be a child of "aParent".
Throws:
ObjectNotFoundException - in case one or more specified nodes cannot be found
CannotInsertNodeException - the node cannot be inserted

delete

void delete(T aNode)
            throws ObjectNotFoundException,
                   CannotDeleteNodeException
Deletes a node from the model. All its children are deleted as well.

Parameters:
aNode - the node to delete from the model.
Throws:
ObjectNotFoundException - in case the node cannot be found
CannotDeleteNodeException - in case the node cannot be deleted

confirmInsert

boolean confirmInsert(T aNode,
                      T aParent,
                      T aNext)
                      throws ObjectNotFoundException
Indicates if the specified node may be inserted into the location specified by a parent node and a next node.

Parameters:
aNode - node for which to indicate if it may be inserted
aParent - parent node; may be null.
aNext - successor node; may be null, "aNext" must be a child of "aParent".
Returns:
true if the node may be inserted, false otherwise
Throws:
ObjectNotFoundException - in case one or more specified nodes cannot be found

confirmInsert

boolean confirmInsert(T aParent)
                      throws ObjectNotFoundException
Indicates if a node may be inserted below the specified parent node.

Parameters:
aParent - parent node; may be null.
Returns:
true if a node may be inserted, false otherwise
Throws:
ObjectNotFoundException - in case the specified node cannot be found

confirmDelete

boolean confirmDelete(T aNode)
                      throws ObjectNotFoundException
Indicates if the specified node may be deleted.

Parameters:
aNode - node for which to indicate if it may be deleted.
Returns:
true if the node may be deleted, false otherwise
Throws:
ObjectNotFoundException - in case the node cannot be found