org.ow2.jonas.webapp.taglib
Class TreeControl

java.lang.Object
  extended by org.ow2.jonas.webapp.taglib.TreeControl
All Implemented Interfaces:
Serializable

public class TreeControl
extends Object
implements Serializable

The overall data structure representing a tree control that can be rendered by the TreeControlTag custom tag. Each node of the tree is represented by an instance of TreeControlNode.

Version:
$Revision: 1.4
Author:
Jazmin Jonson, Craig R. McClanahan
See Also:
Serialized Form

Field Summary
static String ID_PREFIX
           
protected  int mi_Id
           
protected  HashMap registry
          The collection of nodes that represent this tree, keyed by name.
protected  TreeControlNode root
          The root node of the entire tree.
protected  TreeControlNode selected
          The most recently selected node.
 
Constructor Summary
TreeControl()
          Construct a new instance with no predefined root node.
TreeControl(TreeControlNode root)
          Construct a new instance with the specified root node.
 
Method Summary
protected  void autoRefresh(TreeControlNode p_AddedNode)
          Search the added node in the removed list and if it's found, copy the expanded info.
 void disableAutoRefresh()
          Disable auto-refresh mode.
 void enableAutoRefresh()
          Enable auto-refresh mode.
 void expandSelectedParents()
          Expand a branch in the tree of the selected node.
 TreeControlNode findNode(String name)
          Find and return the TreeControlNode for the specified node name, if it exists; otherwise, return null.
 TreeControlNode getRoot()
           
 TreeControlNode getSelected()
          Get the last node selected.
 int getWidth()
          The current displayable "width" of this tree (that is, the maximum depth of the visible part of the tree).
 String newId()
           
 void selectNode(String name)
          Mark the specified node as the one-and-only currently selected one, deselecting any previous node that was so marked.
protected  void setRoot(TreeControlNode root)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID_PREFIX

public static final String ID_PREFIX
See Also:
Constant Field Values

registry

protected HashMap registry
The collection of nodes that represent this tree, keyed by name.


selected

protected TreeControlNode selected
The most recently selected node.


mi_Id

protected int mi_Id

root

protected TreeControlNode root
The root node of the entire tree.

Constructor Detail

TreeControl

public TreeControl()
Construct a new instance with no predefined root node.


TreeControl

public TreeControl(TreeControlNode root)
Construct a new instance with the specified root node.

Parameters:
root - The new root node
Method Detail

getRoot

public TreeControlNode getRoot()

setRoot

protected void setRoot(TreeControlNode root)

getWidth

public int getWidth()
The current displayable "width" of this tree (that is, the maximum depth of the visible part of the tree).


findNode

public TreeControlNode findNode(String name)
Find and return the TreeControlNode for the specified node name, if it exists; otherwise, return null.

Parameters:
name - Name of the TreeControlNode to be returned

selectNode

public void selectNode(String name)
Mark the specified node as the one-and-only currently selected one, deselecting any previous node that was so marked.

Parameters:
node - Name of the node to mark as selected, or null if there should be no currently selected node

getSelected

public TreeControlNode getSelected()
Get the last node selected.

Returns:
the current node selected

expandSelectedParents

public void expandSelectedParents()
Expand a branch in the tree of the selected node.


newId

public String newId()

disableAutoRefresh

public void disableAutoRefresh()
Disable auto-refresh mode.


enableAutoRefresh

public void enableAutoRefresh()
Enable auto-refresh mode. When a set of children are refreshed (removed then added), the expanded info is copied of the removed node to the added node. The name is used to retreive the good node. By default, the auto-refresh mode is disabled. Be careful, enabled this mode before the remove of all nodes and disabled it after the add.


autoRefresh

protected void autoRefresh(TreeControlNode p_AddedNode)
Search the added node in the removed list and if it's found, copy the expanded info.

Parameters:
p_AddedNode - The added node


Copyright © 2010 OW2 Consortium. All Rights Reserved.