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

Object
  extended by TreeElement
      extended by TreeRootElement
All Implemented Interfaces:
Serializable, INameable, IUrlParams, ITreeRootElement

public class TreeRootElement
extends TreeElement
implements ITreeRootElement

This is a concrete implementation of ITreeRootElement. It is a subclass of the TreeElement and is created for the root element when a tree is defined through JSP tags.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class TreeElement
_attribute, EXPAND_NODE, SELECTED_NODE, TREE_AJAX_COMMAND_PREFIX, TREE_AJAX_PARAMTER, TREE_ANCHOR, TREE_ANCHOR_ID, TREE_ANCHOR_INIT, TREE_COLLAPSE_IMAGE, TREE_COLLAPSE_STATE, TREE_EXPAND, TREE_EXPAND_IMAGE, TREE_EXPAND_PATH, TREE_EXPAND_STATE, TREE_EXPANDED, TREE_ID, TREE_JAVASCRIPT_CLASS, TREE_LEVEL, TREE_NODE_LAST
 
Constructor Summary
TreeRootElement()
          Default constructor for creating a simple tree.
TreeRootElement(String label, boolean expanded)
          Construct a new TreeElement with the specified parameters.
 
Method Summary
 void changeSelected(String selectNode, ServletRequest request)
          Change the node that is selected.
 InheritableState getInheritableState()
          Property that returns the InheritableState that was set on the Tree.
 String getObjectName()
          Returns the ObjectName of the INameable object.
 String getRootNodeCollapsedImage()
          Returns the collapsed image for the root node.
 String getRootNodeExpandedImage()
          Returns the expanded image for the root node.
 TreeElement getSelectedNode()
          Return the currently selected TreeElement.
 TreeRenderState getTreeRenderState()
          return the TreeRenderState for this tree.
 void setInheritableState(InheritableState state)
          Property that sets the InheritableState that is set on the Tree tag.
 void setObjectName(String name)
          Set the ObjectName of the INameable object.
 void setRootNodeCollapsedImage(String rootNodeCollapsedImage)
          Sets the name of the collapsed image for the root node.
 void setRootNodeExpandedImage(String rootNodeExpandedImage)
          Sets the expanded image for the root node.
 void setTreeRenderState(TreeRenderState trs)
          Set the TreeRenderState
 
Methods inherited from class TreeElement
addAttribute, addChild, addChild, addParameter, clearChildren, findNode, getAction, getAttributeList, getChild, getChildren, getClientAction, getContent, getHref, getIcon, getLabel, getLevel, getName, getParams, getParent, getRoot, getScope, getTagId, getTarget, getTitle, isDisabled, isExpanded, isExpandOnServer, isLabelLegalAsAlt, isLast, isLeaf, isSelected, onExpand, onSelect, removeChild, removeChild, setAction, setClientAction, setContent, setDisabled, setExpanded, setExpandOnServer, setHref, setIcon, setLabel, setName, setParent, setScope, setSelected, setTagId, setTarget, setTitle, size, updateName
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeRootElement

public TreeRootElement()
Default constructor for creating a simple tree.


TreeRootElement

public TreeRootElement(String label,
                       boolean expanded)
Construct a new TreeElement with the specified parameters.

Parameters:
expanded - Should this node be expanded?
Method Detail

changeSelected

public void changeSelected(String selectNode,
                           ServletRequest request)
Change the node that is selected. This is an optimization were the root node can track which node is currently selected so it can unselect that node instead of searching the whole tree to find the selected node.

Specified by:
changeSelected in interface ITreeRootElement
Parameters:
selectNode -
request - the ServletRequest.

getSelectedNode

public TreeElement getSelectedNode()
Return the currently selected TreeElement. This method will return null if no element is currently selected.

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

Specified by:
getSelectedNode in interface ITreeRootElement
Returns:
the currently selected node.

getTreeRenderState

public TreeRenderState getTreeRenderState()
return the TreeRenderState for this tree.

Specified by:
getTreeRenderState in interface ITreeRootElement
Returns:
the TreeRenderState

setTreeRenderState

public void setTreeRenderState(TreeRenderState trs)
Set the TreeRenderState

Specified by:
setTreeRenderState in interface ITreeRootElement
Parameters:
trs -

getInheritableState

public InheritableState getInheritableState()
Property that returns the InheritableState that was set on the Tree.

Specified by:
getInheritableState in interface ITreeRootElement
Overrides:
getInheritableState in class TreeElement
Returns:
InheritableState

setInheritableState

public void setInheritableState(InheritableState state)
Property that sets the InheritableState that is set on the Tree tag.

Specified by:
setInheritableState in interface ITreeRootElement
Overrides:
setInheritableState in class TreeElement
Parameters:
state -

getRootNodeExpandedImage

public String getRootNodeExpandedImage()
Returns the expanded image for the root node.

Specified by:
getRootNodeExpandedImage in interface ITreeRootElement
Returns:
the expanded image for the root.

setRootNodeExpandedImage

public void setRootNodeExpandedImage(String rootNodeExpandedImage)
Sets the expanded image for the root node.

Specified by:
setRootNodeExpandedImage in interface ITreeRootElement
Parameters:
rootNodeExpandedImage - the name of the image to display. This will be searched for below the image root.

getRootNodeCollapsedImage

public String getRootNodeCollapsedImage()
Returns the collapsed image for the root node.

Specified by:
getRootNodeCollapsedImage in interface ITreeRootElement
Returns:
the name of the collapsed image for the root.

setRootNodeCollapsedImage

public void setRootNodeCollapsedImage(String rootNodeCollapsedImage)
Sets the name of the collapsed image for the root node.

Specified by:
setRootNodeCollapsedImage in interface ITreeRootElement
Parameters:
rootNodeCollapsedImage - the name of the collapsed image to display. This will be searched for below the image root.

setObjectName

public void setObjectName(String name)
Set the ObjectName of the INameable object. This should only be set once. If it is called a second time an IllegalStateException should be thrown

Specified by:
setObjectName in interface INameable
Parameters:
name - the Object's name.
Throws:
IllegalStateException - if this method is called more than once for an object

getObjectName

public String getObjectName()
Returns the ObjectName of the INameable object.

Specified by:
getObjectName in interface INameable
Returns:
the ObjectName.