Decision Center API

ilog.rules.teamserver.web.tree.impl
Class IlrPreLoadedDataProvider

java.lang.Object
  extended by ilog.rules.teamserver.web.tree.impl.IlrPreLoadedDataProvider
All Implemented Interfaces:
IlrTreeDataProvider

public abstract class IlrPreLoadedDataProvider
extends Object
implements IlrTreeDataProvider

Provides a tree with an entire pre-loaded model.

Nodes handled by this data provider must be instances of IlrPreLoadedTreeNode.

The following code example shows how to build the tree model:

   public class MyPreloadedDataProvider extends IlrPreLoadedDataProvider {

     protected IlrTreeNode createRoot() {
       // Return the root of the tree model
       return new IlrPreLoadedTreeNode(null, "root");
     }
   
     protected void preloadModel(IlrPreLoadedTreeNode root) {
       // Build the entire tree model.
       // For example:
       //   "root"
       //     |__node1
       //     |    |__node12
       //     | 
       //     |__node2
       //
       IlrPreLoadedTreeNode node1 = new IlrPreLoadedTreeNode(root, "node1");
       IlrPreLoadedTreeNode node2 = new IlrPreLoadedTreeNode(root, "node2");
       IlrPreLoadedTreeNode node12 = new IlrPreLoadedTreeNode(node1, "node12");
       // ...
     }
   }
 

See Also:
IlrTreeController, IlrTreeDataProvider, IlrPreLoadedTreeNode

Constructor Summary
IlrPreLoadedDataProvider(IlrTreeController controller)
          Creates a tree data provider for a tree controller.
 
Method Summary
protected abstract  IlrPreLoadedTreeNode createRoot()
          Returns the root node of the tree model.
 List<IlrTreeNode> getChildren(IlrTreeNode parent)
          Returns the children of a node.
 IlrTreeNode getNodeById(String id)
          Returns a node with a given ID.
 IlrTreeNode getParent(IlrTreeNode child)
          Returns the parent of a node.
 IlrTreeNode getRoot()
          Returns the root node of the tree's model.
 boolean hasChildren(IlrTreeNode node)
          Indicates if a node has children.
protected abstract  void preloadModel(IlrPreLoadedTreeNode root)
          Builds the tree model.
 void reset()
          Resets the tree's model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlrPreLoadedDataProvider

public IlrPreLoadedDataProvider(IlrTreeController controller)
Creates a tree data provider for a tree controller.

Parameters:
controller - The controller.
See Also:
IlrTreeController
Method Detail

createRoot

protected abstract IlrPreLoadedTreeNode createRoot()
Returns the root node of the tree model.

Returns:
The root node of the tree model.
See Also:
IlrPreLoadedTreeNode

preloadModel

protected abstract void preloadModel(IlrPreLoadedTreeNode root)
Builds the tree model. Nodes handled by this data provider must be instances of IlrPreLoadedTreeNode.

Parameters:
root - The root node of the tree.
See Also:
IlrPreLoadedTreeNode, createRoot()

getNodeById

public IlrTreeNode getNodeById(String id)
Description copied from interface: IlrTreeDataProvider
Returns a node with a given ID.

It is up to the user to manage the mapping between a node and its ID.

Specified by:
getNodeById in interface IlrTreeDataProvider
Parameters:
id - The ID of the node.
Returns:
The node with a given ID.

getRoot

public IlrTreeNode getRoot()
Description copied from interface: IlrTreeDataProvider
Returns the root node of the tree's model.

This node is given to the IlrTreeDataProvider.getChildren(IlrTreeNode) method to start to render the tree component.

Specified by:
getRoot in interface IlrTreeDataProvider
Returns:
The root node.

getParent

public IlrTreeNode getParent(IlrTreeNode child)
Description copied from interface: IlrTreeDataProvider
Returns the parent of a node.

Specified by:
getParent in interface IlrTreeDataProvider
Parameters:
child - The node to get the parent from.
Returns:
The parent node, or null if it has none or if the parent cannot be computed.

hasChildren

public boolean hasChildren(IlrTreeNode node)
Description copied from interface: IlrTreeDataProvider
Indicates if a node has children.

Specified by:
hasChildren in interface IlrTreeDataProvider
Parameters:
node - The node.
Returns:
true if the given node has children, and false otherwise.

getChildren

public List<IlrTreeNode> getChildren(IlrTreeNode parent)
Description copied from interface: IlrTreeDataProvider
Returns the children of a node.

Specified by:
getChildren in interface IlrTreeDataProvider
Parameters:
parent - The parent node to get the children from.
Returns:
A list of IlrTreeNode.

reset

public void reset()
Description copied from interface: IlrTreeDataProvider
Resets the tree's model.

This method is intended to clear caches potentially used by the implementation.

Specified by:
reset in interface IlrTreeDataProvider

Decision Center API

© Copyright IBM Corp. 1987, 2013