com.cc.framework.ui.control
Class TreeLineIterator

java.lang.Object
  extended bycom.cc.framework.ui.control.TreeLineIterator
All Implemented Interfaces:
LineIterator

public class TreeLineIterator
extends java.lang.Object
implements LineIterator

A TreeLineIterator

Since:
1.0
Version:
$Revision: 1.27 $
Author:
Harald Schulz

Field Summary
private  TreeNodeDataModel current
          Field current
private  int maxRows
          The maximum number of rows the iterator can handle before returning done() = true
private  Principal principal
          The principal object used to check permissions
private  TreeStateModel state
          The state model of the tree that holds the expansion state of the tree items.
 
Constructor Summary
TreeLineIterator(TreeNodeDataModel current, Principal principal)
          Constructor for TreeLineIterator
TreeLineIterator(TreeStateModel state, TreeNodeDataModel current, int maxRows, Principal principal)
          Constructor for TreeLineIterator
TreeLineIterator(TreeStateModel state, TreeNodeDataModel current, Principal principal)
          Constructor for TreeLineIterator
 
Method Summary
protected  int countVisibleNodes(TreeNodeDataModel item)
          Counts the visible nodes in the given subtree
 java.lang.Object current()
          Returns the current tree node
 java.lang.Object current(java.lang.String property)
          Method current
 int currentCheckState()
          Returns the check state of the current tree node
 int currentIndex()
          Returns the current row index (offset between the first line and the current line)
 java.lang.String currentKey()
          Returns the unique key of the current node
 boolean done()
          Checks if there tree iterator has reached the end of the collection
protected  int getChildIndex(TreeNodeDataModel child)
          Returns the index of a child node in its parent node
protected  TreeNodeDataModel getLastVisibleTreeItem(TreeNodeDataModel item)
          retrieves the last visible node in the given subtree
 int getMaxRows()
           
protected  TreeNodeDataModel getNextVisibleItem(TreeNodeDataModel item)
          returns the next visible item of the given node
protected  TreeNodeDataModel getNextVisibleSibling(TreeNodeDataModel child, boolean expandSearch)
          Searches for a sibling node of the given child node
protected  TreeNodeDataModel getPrevVisibleItem(TreeNodeDataModel item)
          returns the previous visible item oft the given node
 Principal getPrincipal()
           
 int getVisibleChildren()
          Returns the number of visible children of the current tree node
 boolean isCurrentExpanded()
          Checks if the current node is expanded
 boolean isCurrentSelected()
          Checks if the current node is selected
 boolean isExpanded(TreeNodeDataModel node)
          Checks if the given node is expanded
 boolean isLastVisibleChild(TreeNodeDataModel item)
          Checks if the given node is the last visible node in a child list
 boolean isMarked()
          Checks if the current Item is highlighted
 boolean isValidProperty(java.lang.String property)
          Checks if the current iteration element has the given property
protected  boolean isVisible(TreeNodeDataModel item)
          Checks if the given item is visible
protected  void locate(TreeNodeDataModel current)
          Locates the tree iterator on the given node
static TreeLineIterator locateOnLastVisibleChild(TreeStateModel state, TreeNodeDataModel parent, Principal principal)
          Creates a new tree iterator that is located on the last visible item
 void next()
          Moves the iterator to the next visible tree node
 void prev()
          Moves the iterator to the previous visible tree node
 void reset()
          resets the iterator to the first element of the collection
 void skip(int index)
          Skips a certain number of visible tree nodes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

current

private TreeNodeDataModel current
Field current


maxRows

private int maxRows
The maximum number of rows the iterator can handle before returning done() = true


state

private TreeStateModel state
The state model of the tree that holds the expansion state of the tree items.


principal

private Principal principal
The principal object used to check permissions

Constructor Detail

TreeLineIterator

public TreeLineIterator(TreeNodeDataModel current,
                        Principal principal)
Constructor for TreeLineIterator

Parameters:
current - TreeNodeDataModel
principal - Principal

TreeLineIterator

public TreeLineIterator(TreeStateModel state,
                        TreeNodeDataModel current,
                        Principal principal)
Constructor for TreeLineIterator

Parameters:
state - TreeStateModel
current - TreeNodeDataModel
principal - Principal

TreeLineIterator

public TreeLineIterator(TreeStateModel state,
                        TreeNodeDataModel current,
                        int maxRows,
                        Principal principal)
Constructor for TreeLineIterator

Parameters:
state - TreeStateModel
current - TreeNodeDataModel
maxRows - The maximum number of rows the iterator can handle before returning done() = true
principal - Principal
Method Detail

locateOnLastVisibleChild

public static TreeLineIterator locateOnLastVisibleChild(TreeStateModel state,
                                                        TreeNodeDataModel parent,
                                                        Principal principal)
Creates a new tree iterator that is located on the last visible item

Parameters:
state - TreeStateModel
parent - TreeNodeDataModel
principal - Principal
Returns:
TreeLineIterator

locate

protected void locate(TreeNodeDataModel current)
Locates the tree iterator on the given node

Parameters:
current - TreeNodeDataModel

done

public boolean done()
Checks if there tree iterator has reached the end of the collection

Specified by:
done in interface LineIterator
Returns:
boolean
See Also:
LineIterator.done()

current

public java.lang.Object current()
Returns the current tree node

Specified by:
current in interface LineIterator
Returns:
Object
See Also:
LineIterator.current()

current

public java.lang.Object current(java.lang.String property)
Description copied from interface: LineIterator
Method current

Specified by:
current in interface LineIterator
Parameters:
property - Bean Property Name
Returns:
Property Value
See Also:
LineIterator.current(String property)

isValidProperty

public boolean isValidProperty(java.lang.String property)
Description copied from interface: LineIterator
Checks if the current iteration element has the given property

Specified by:
isValidProperty in interface LineIterator
Parameters:
property - the property name
Returns:
true if the current bean possesses a matching property
See Also:
LineIterator.isValidProperty(java.lang.String)

currentKey

public java.lang.String currentKey()
Returns the unique key of the current node

Specified by:
currentKey in interface LineIterator
Returns:
String
See Also:
LineIterator.currentKey()

currentIndex

public int currentIndex()
Description copied from interface: LineIterator
Returns the current row index (offset between the first line and the current line)

Specified by:
currentIndex in interface LineIterator
Returns:
row index
See Also:
LineIterator.currentIndex()

isCurrentExpanded

public boolean isCurrentExpanded()
Checks if the current node is expanded

Returns:
boolean

isExpanded

public boolean isExpanded(TreeNodeDataModel node)
Checks if the given node is expanded

Parameters:
node - the node to check
Returns:
boolean

isCurrentSelected

public boolean isCurrentSelected()
Checks if the current node is selected

Returns:
boolean

currentCheckState

public int currentCheckState()
Returns the check state of the current tree node

Specified by:
currentCheckState in interface LineIterator
Returns:
integer
See Also:
LineIterator.currentCheckState()

next

public void next()
Moves the iterator to the next visible tree node

Specified by:
next in interface LineIterator
See Also:
LineIterator.next()

prev

public void prev()
Moves the iterator to the previous visible tree node

Specified by:
prev in interface LineIterator
See Also:
LineIterator.prev()

skip

public void skip(int index)
Skips a certain number of visible tree nodes. The method can skip in both directions

Parameters:
index - Number of visible rows to skip

getVisibleChildren

public int getVisibleChildren()
Returns the number of visible children of the current tree node

Returns:
number of visible children

isLastVisibleChild

public boolean isLastVisibleChild(TreeNodeDataModel item)
Checks if the given node is the last visible node in a child list

Parameters:
item - TreeNodeDataModel
Returns:
boolean

isVisible

protected boolean isVisible(TreeNodeDataModel item)
Checks if the given item is visible

Parameters:
item - TreeNodeDataModel
Returns:
boolean

countVisibleNodes

protected int countVisibleNodes(TreeNodeDataModel item)
Counts the visible nodes in the given subtree

Parameters:
item - the root node of the subtree
Returns:
Number of visible nodes

getLastVisibleTreeItem

protected TreeNodeDataModel getLastVisibleTreeItem(TreeNodeDataModel item)
retrieves the last visible node in the given subtree

Parameters:
item - the root of the subtree
Returns:
TreeNodeDataModel or null

getPrevVisibleItem

protected TreeNodeDataModel getPrevVisibleItem(TreeNodeDataModel item)
returns the previous visible item oft the given node

Parameters:
item - TreeNodeDataModel
Returns:
TreeNodeDataModel or null

getNextVisibleItem

protected TreeNodeDataModel getNextVisibleItem(TreeNodeDataModel item)
returns the next visible item of the given node

Parameters:
item - TreeNodeDataModel
Returns:
TreeNodeDataModel or null

getNextVisibleSibling

protected TreeNodeDataModel getNextVisibleSibling(TreeNodeDataModel child,
                                                  boolean expandSearch)
Searches for a sibling node of the given child node

Parameters:
child - TreeNodeDataModel
expandSearch - permission to expand the search towards the root of the tree
Returns:
TreeNodeDataModel or null

isMarked

public boolean isMarked()
Description copied from interface: LineIterator
Checks if the current Item is highlighted

Specified by:
isMarked in interface LineIterator
Returns:
boolean True if the current item is selected
See Also:
LineIterator.isMarked()

reset

public void reset()
Description copied from interface: LineIterator
resets the iterator to the first element of the collection

Specified by:
reset in interface LineIterator
See Also:
LineIterator.reset()

getChildIndex

protected int getChildIndex(TreeNodeDataModel child)
Returns the index of a child node in its parent node

Parameters:
child - the node whose index is to search
Returns:
index of the child node or -1 if the position could not be calculated

getPrincipal

public Principal getPrincipal()
Returns:
Returns the principal.

getMaxRows

public int getMaxRows()
Returns:
returns the maximum number of rows the iterator can handle before returning done() = true


Copyright © 2000-2005 SCC Informationssysteme GmbH. All Rights Reserved.