org.apache.beehive.netui.tags.tree
Class TreeHelpers

Object
  extended by TreeHelpers

public class TreeHelpers
extends Object

This class provides a set of static helper methods that deal with a trees.


Constructor Summary
TreeHelpers()
           
 
Method Summary
static TreeElement changeSelected(TreeElement root, TreeElement selectedNode, String selectNode, ServletRequest request)
          This is a helper method that will change the selected node.
static TreeElement findSelected(TreeElement root)
          This will return the currently selected node from a tree.
static void processTreeRequest(String treeId, TreeElement treeRoot, HttpServletRequest request, HttpServletResponse response)
          If this tree was selected or expanded this will handle that processing.
protected static void setSelected(TreeElement node, String selected, ServletRequest request)
          Recursive routine to set the selected node.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeHelpers

public TreeHelpers()
Method Detail

processTreeRequest

public static void processTreeRequest(String treeId,
                                      TreeElement treeRoot,
                                      HttpServletRequest request,
                                      HttpServletResponse response)
If this tree was selected or expanded this will handle that processing.

Parameters:
treeId -
treeRoot -
request -

setSelected

protected static void setSelected(TreeElement node,
                                  String selected,
                                  ServletRequest request)
Recursive routine to set the selected node. This will set the selected node and clear the selection on all other nodes. It will walk the full tree.

Parameters:
node -
selected -

findSelected

public static TreeElement findSelected(TreeElement root)
This will return the currently selected node from a tree.

Implementation Note: The method that changes the selected node based on the request, processTreeRequest(String, TreeElement, HttpServletRequest, HttpServletResponse), gets called during the processing of the Tree tag within a JSP. If the findSelected method is called from an Action in a Page Flow Controller, the value of the selected node will have not yet been updated.

Parameters:
root - the root element of the tree.
Returns:
a TreeElement that is the currently selected node. This may return null.

changeSelected

public static TreeElement changeSelected(TreeElement root,
                                         TreeElement selectedNode,
                                         String selectNode,
                                         ServletRequest request)
This is a helper method that will change the selected node. This is provided to make implementation of ITreeRootElement easier. This is called by the changeSelected method there to do the work of changing the selected node.

Parameters:
root - The root of the tree
selectedNode - The node that is currently selected, it may be null
selectNode - The String name of the node that will be selected
request - The ServletRequest
Returns:
a TreeElement representing the new node selected.