com.sun.rave.web.ui.component
Class TreeNode

java.lang.Object
  extended byjavax.faces.component.UIComponent
      extended byjavax.faces.component.UIComponentBase
          extended bycom.sun.rave.web.ui.component.TemplateComponentBase
              extended bycom.sun.rave.web.ui.component.TreeNodeBase
                  extended bycom.sun.rave.web.ui.component.TreeNode
All Implemented Interfaces:
ChildManager, javax.faces.component.NamingContainer, javax.faces.component.StateHolder, TemplateComponent
Direct Known Subclasses:
TreeBase

public class TreeNode
extends TreeNodeBase

This class defines a TreeNode UIComponent. This component is expected to exist as a child of a Tree or another TreeNode.

Author:
Ken Paulsen

Field Summary
static java.lang.String CONTENT_FACET_KEY
           This is the facet key used to define the content for the TreeNode.
static java.lang.String IMAGE_FACET_KEY
           This is the facet key used to set a custom image for this TreeNode.
static java.lang.String LAYOUT_KEY
           This is the location of the XML file that declares the layout for the PanelGroup.
 
Fields inherited from interface javax.faces.component.NamingContainer
SEPARATOR_CHAR
 
Constructor Summary
TreeNode()
          Constructor.
 
Method Summary
 void addActionListener(javax.faces.event.ActionListener listener)
          Add an action listener instance for the IconHyperlink representing this node's turner.
 void fireTurnerEvent(javax.faces.event.ActionEvent event)
           
 javax.faces.event.ActionListener[] getActionListeners()
          Get all ActionListener instances for this node's turner IconHyperlink click.
protected  java.lang.String getHandleIcon(java.lang.String value)
           This method enables the icon to switch from expanded to collapsed, or from collapsed to expanded depending on the current state of this component.
 java.util.List getImageKeys()
           This method determines the theme images that should be drawn from left to right (0 to x) when rendering the lines before the text for this node.
static TreeNode getParentTreeNode(javax.faces.component.UIComponent node)
           This method returns the closest parent that is a TreeNode, or null if not found.
 void removeActionListener(javax.faces.event.ActionListener listener)
          Remove an action listener instance from the list for this node's turner IconHyperlink.
 void toggleNode(javax.faces.event.ActionEvent event)
           This ActionListener is invoked when the TreeNode expand/collapse icon is clicked.
 
Methods inherited from class com.sun.rave.web.ui.component.TreeNodeBase
getAction, getActionListener, getFamily, getImageURL, getStyle, getStyleClass, getTarget, getText, getToolTip, getUrl, isExpanded, isVisible, restoreState, saveState, setAction, setActionListener, setExpanded, setImageURL, setStyle, setStyleClass, setTarget, setText, setToolTip, setUrl, setVisible
 
Methods inherited from class com.sun.rave.web.ui.component.TemplateComponentBase
getChild, getChild, getLayoutDefinition, getLayoutDefinitionKey, setLayoutDefinitionKey
 
Methods inherited from class javax.faces.component.UIComponentBase
addFacesListener, broadcast, decode, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacesContext, getFacesListeners, getFacet, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, isRendered, isTransient, processDecodes, processRestoreState, processSaveState, processUpdates, processValidators, queueEvent, removeFacesListener, restoreAttachedState, saveAttachedState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IMAGE_FACET_KEY

public static final java.lang.String IMAGE_FACET_KEY

This is the facet key used to set a custom image for this TreeNode. (image)

See Also:
Constant Field Values

CONTENT_FACET_KEY

public static final java.lang.String CONTENT_FACET_KEY

This is the facet key used to define the content for the TreeNode. (content)

See Also:
Constant Field Values

LAYOUT_KEY

public static final java.lang.String LAYOUT_KEY

This is the location of the XML file that declares the layout for the PanelGroup. (layout/tree.xml)

See Also:
Constant Field Values
Constructor Detail

TreeNode

public TreeNode()
Constructor.

Method Detail

getImageKeys

public java.util.List getImageKeys()

This method determines the theme images that should be drawn from left to right (0 to x) when rendering the lines before the text for this node.

Returns:
A List of Strings that represent theme keys for the images to be drawn. The first list element is the first image to display when rendering left to right.

getParentTreeNode

public static TreeNode getParentTreeNode(javax.faces.component.UIComponent node)

This method returns the closest parent that is a TreeNode, or null if not found.

Parameters:
node - The starting TreeNode.
Returns:
The clost parent TreeNode

toggleNode

public void toggleNode(javax.faces.event.ActionEvent event)
                throws javax.faces.event.AbortProcessingException

This ActionListener is invoked when the TreeNode expand/collapse icon is clicked. It will first attempt to invoke user-defined com.sun.rave.web.ui.component.until.event.Handlers, then will perform the default operation of expanding or collapsing this TreeNode. If a user-defined com.sun.rave.web.ui.component.until.event.Handler returns "false", the default functionality will not be performed.

Parameters:
event - The ActionEvent.
Throws:
javax.faces.event.AbortProcessingException

addActionListener

public void addActionListener(javax.faces.event.ActionListener listener)

Add an action listener instance for the IconHyperlink representing this node's turner.

Parameters:
listener - The ActionListener instance to register for turner IconHyperlink clicks.

getActionListeners

public javax.faces.event.ActionListener[] getActionListeners()

Get all ActionListener instances for this node's turner IconHyperlink click.

Returns:
ActionListener[] The list of listeners for this node's turner IconHyperlink click.

removeActionListener

public void removeActionListener(javax.faces.event.ActionListener listener)

Remove an action listener instance from the list for this node's turner IconHyperlink.

Parameters:
listener - The ActionListener instance to remove.

fireTurnerEvent

public void fireTurnerEvent(javax.faces.event.ActionEvent event)
                     throws javax.faces.event.AbortProcessingException
Throws:
javax.faces.event.AbortProcessingException

getHandleIcon

protected java.lang.String getHandleIcon(java.lang.String value)

This method enables the icon to switch from expanded to collapsed, or from collapsed to expanded depending on the current state of this component.

Parameters:
value - The current value of the Icon. It will use the current value to re-use first/last information from the old key.
Returns:
The new (or same if the state hasn't changed) icon state