com.plumtree.server.treeiterator
Interface IPTTreeIterator


public interface IPTTreeIterator

IPTTreeIterator allows clients to walk a tree of information in a generic manner (e.g. to write a generic tree UI.) An implementation of IPTTreeIterator is stateful. Clients can walk the tree by calling Children to get information about children of the current location, then calling MoveTo to reset the state to be at the location of a child. By calling Children and MoveTo, a client can navigate the entire tree. Helper functions like MoveToParent and MoveToRoot make it easier to implement a client that walks the tree in an application specific manner.


Method Summary
 java.lang.Object Children(int lStart, int lCount)
          Returns information about the children of the current location.
 java.lang.Object CurrentLocInfo()
          Retrieve information about the current location.
 boolean GetAtRoot()
          Is this iterator at root?
 int GetChildCount()
          Returns the number of children (both nodes and containers) of the current location.
 java.lang.String GetLocation()
          Retrieve the identifier of the current location
 int GetStyle()
          Returns the current display style, from PT_TREE_ITERATOR_STYLES.
 void InitializeIterator(java.lang.Object varInitArg)
          Each iterator implmentation requires it's own type of initialization information.
 void MoveTo(java.lang.String sLocation)
          Move to a specified location in the tree.
 void MoveToParent()
          Move "up" one position in the tree, to the parent of the current node
 void MoveToRoot()
          Move to the root of the tree
 void SetStyle(int Value)
          Sets the current display style, to a value from PT_TREE_ITERATOR_STYLES.
 

Method Detail

GetStyle

public int GetStyle()
Returns the current display style, from PT_TREE_ITERATOR_STYLES. The style determines the format of strings returned by the tree iterator. Defaults to PT_TREE_ITERATOR_STYLE_HTML.
Returns:
the current style
See Also:
PT_TREE_ITERATOR_STYLES

SetStyle

public void SetStyle(int Value)
Sets the current display style, to a value from PT_TREE_ITERATOR_STYLES. The style determines the format of strings returned by the tree iterator. Defaults to PT_TREE_ITERATOR_STYLE_HTML.
Parameters:
Value - the desired style
See Also:
PT_TREE_ITERATOR_STYLES

GetChildCount

public int GetChildCount()
Returns the number of children (both nodes and containers) of the current location. Returns -1 if it can't be known without retrieving the children.
Returns:
number of children

Children

public java.lang.Object Children(int lStart,
                                 int lCount)
Returns information about the children of the current location. Return value is a 2D array. The columns are described by PT_TREE_ITERATOR_CHILD_INFO. There is one row per child item.
Parameters:
lStart - number of rows to skip at the beginning, or 0 for none
lCount - maximum number of rows to return, or -1 for all
Returns:
the array of child info
See Also:
PT_TREE_ITERATOR_CHILD_INFO

MoveToParent

public void MoveToParent()
Move "up" one position in the tree, to the parent of the current node

MoveToRoot

public void MoveToRoot()
Move to the root of the tree

MoveTo

public void MoveTo(java.lang.String sLocation)
Move to a specified location in the tree. The location identifier is a value returned in the PT_TREE_ITERATOR_CHILD_INFO_IDENTIFIER column of the result of a call to Children, or through a call to GetLocation.
Parameters:
sLocation - the location to which to move

GetLocation

public java.lang.String GetLocation()
Retrieve the identifier of the current location
Returns:
the current location

CurrentLocInfo

public java.lang.Object CurrentLocInfo()
Retrieve information about the current location. The return value is a 2D array with one row. The columns are identified by PT_TREE_ITERATOR_CHILD_INFO. Conceptually, this function should return the same data as that returned by calling MoveToParent, then calling Children, and picking out the row that represents the current child.
Returns:
information about the current location

GetAtRoot

public boolean GetAtRoot()
Is this iterator at root?
Returns:
at root?

InitializeIterator

public void InitializeIterator(java.lang.Object varInitArg)
Each iterator implmentation requires it's own type of initialization information. This function is a hook to pass in that information, but the format of the argument is not specified- it is implementation specific.
Parameters:
varInitArg - the initialization information, in an implementation specific format


Copyright © 2003 Plumtree Software Inc. All Rights Reserved.