com.iplanet.jato.model
Interface TreeModel

All Superinterfaces:
Model
All Known Implementing Classes:
TreeModelBase

public interface TreeModel
extends Model

Defines a model that uses a tree-like backing data structure. Instead of defining a formal node entity, this model operates using the notion of a currently selected node in the tree. Using the available model methods, clients of the model can change the current node position or read or check its properties.

Version:
JATO/1.2.2 $Id: TreeModel.java,v 1.10 2002/03/16 03:26:32 todd Exp $

Field Summary
static int BREADTH_FIRST_TRAVERSAL
           
static int DEPTH_FIRST_TRAVERSAL
           
static int NEXT_CHILD
           
static int NEXT_SIBLING
           
static int ROOT_NODE_LEVEL
           
static int UNDEFINED_NODE_LEVEL
           
 
Method Summary
 void beforeRoot()
          Set the current location to a special position such that the nextNode() operation will result in setting the root node as the current node
 java.lang.String getNodeID()
          Return a unique ID for the current node within the backing data structure.
 int getNodeLevel()
          Return the current node level, meaning the an index indicating how far this node is removed from being the root of the tree.
 java.lang.String getNodeName()
          Return the logical name of the current node
 java.lang.String getNodeType()
          Return the logical type of the current node
 int getTraversalType()
          Return the tree traversal type.
 boolean isChildNode()
          Check if the current node is a child of a parent node
 boolean isParentNode()
          Check if the current node is a parent of other nodes
 boolean nextNode()
          Make the current node the next available node.
 boolean nextNode(int nextNodeType)
          Make the current node the next available node according to the provided next node type.
 void root()
          Make the current node the root node
 void setTraversalType(int value)
          Sets the tree traversal type.
 
Methods inherited from interface com.iplanet.jato.model.Model
getName, getValue, getValues, setName, setValue, setValues
 

Field Detail

DEPTH_FIRST_TRAVERSAL

public static final int DEPTH_FIRST_TRAVERSAL

BREADTH_FIRST_TRAVERSAL

public static final int BREADTH_FIRST_TRAVERSAL

NEXT_CHILD

public static final int NEXT_CHILD

NEXT_SIBLING

public static final int NEXT_SIBLING

UNDEFINED_NODE_LEVEL

public static final int UNDEFINED_NODE_LEVEL

ROOT_NODE_LEVEL

public static final int ROOT_NODE_LEVEL
Method Detail

getNodeName

public java.lang.String getNodeName()
                             throws ModelControlException
Return the logical name of the current node

getNodeType

public java.lang.String getNodeType()
                             throws ModelControlException
Return the logical type of the current node

getNodeLevel

public int getNodeLevel()
Return the current node level, meaning the an index indicating how far this node is removed from being the root of the tree. The root node has a node level of 0. A child of the root would have a node level of 1, and a child of that child would have a root node of 2, etc.

getNodeID

public java.lang.String getNodeID()
Return a unique ID for the current node within the backing data structure. This ID should unambiguously identify the current node within the entire model. In some model implementations and usages, this ID will need to unambiguously identify the node across requests, and even across instantiations of the model instances. In some cases, a fully qualified path to the node will be sufficient; in other cases, a more unique identifier, possible assigned by the model, will be required.

isParentNode

public boolean isParentNode()
Check if the current node is a parent of other nodes

isChildNode

public boolean isChildNode()
Check if the current node is a child of a parent node

getTraversalType

public int getTraversalType()
                     throws ModelControlException
Return the tree traversal type. The traversal type affects the way in which the various node iteration methods traverse the backing tree structure. A particular implementation need not support more than a single traversal type, which will usually be DEPTH_FIRST_TRAVERSAL .

setTraversalType

public void setTraversalType(int value)
                      throws ModelControlException
Sets the tree traversal type. The traversal type affects the way in which the various node iteration methods traverse the backing tree structure. A particular implementation need not support more than a single traversal type, which will usually be DEPTH_FIRST_TRAVERSAL .

beforeRoot

public void beforeRoot()
                throws ModelControlException
Set the current location to a special position such that the nextNode() operation will result in setting the root node as the current node

root

public void root()
          throws ModelControlException
Make the current node the root node

nextNode

public boolean nextNode()
                 throws ModelControlException
Make the current node the next available node. The model determines the next available node according to the current traversal type.

nextNode

public boolean nextNode(int nextNodeType)
                 throws ModelControlException
Make the current node the next available node according to the provided next node type. The currently supported next node type values are NEXT_CHILD and NEXT_SIBLING.