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

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
                      extended bycom.sun.rave.web.ui.component.TreeBase
                          extended bycom.sun.rave.web.ui.component.Tree
All Implemented Interfaces:
ChildManager, javax.faces.component.EditableValueHolder, javax.faces.component.NamingContainer, javax.faces.component.StateHolder, TemplateComponent, javax.faces.component.ValueHolder

public class Tree
extends TreeBase
implements javax.faces.component.EditableValueHolder

Author:
Ken Paulsen (ken.paulsen@sun.com)

Field Summary
static java.lang.String COOKIE_SUFFIX
           This is the suffix appended to the client id to form the key to the cookie Map needed to retrieve the tree selection.
static java.lang.String COOKIE_SUFFIX_EXPAND
           This is the suffix appended to the client id to form the key to the cookie Map needed to retrieve the node that may need to be expanded (because it was just selected).
static java.lang.String JAVA_SCRIPT_THEME_KEY
           This is the Theme key used to retrieve the JavaScript needed for this component.
static java.lang.String LAYOUT_KEY
           This is the location of the XML file that declares the layout for the PanelGroup.
static java.lang.String SELECTED_SUFFIX
           This is the suffix appended to the client id when forming a request attribute key.
 
Fields inherited from class com.sun.rave.web.ui.component.TreeNode
CONTENT_FACET_KEY, IMAGE_FACET_KEY
 
Fields inherited from interface javax.faces.component.NamingContainer
SEPARATOR_CHAR
 
Constructor Summary
Tree()
          Constructor.
 
Method Summary
 void addValidator(javax.faces.validator.Validator validator)
           Add a Validator instance to the set associated with this component.
 void addValueChangeListener(javax.faces.event.ValueChangeListener listener)
           Add a new ValueChangeListener to the set of listeners interested in being notified when ValueChangeEvents occur.
 void broadcast(javax.faces.event.FacesEvent event)
           In addition to to the default UIComponent#broadcast processing, pass the ValueChangeEvent being broadcast to the method referenced by valueChangeListener.
 void decode(javax.faces.context.FacesContext context)
           Decode any new state of this UIComponent from the request contained in the specified FacesContext, and store this state as needed.
 javax.faces.convert.Converter getConverter()
           Return the Converter (if any) that is registered for this UIComponent.
 java.lang.String getCookieExpandNode()
           This method will return the TreeNode client ID that is selected according the browser cookie.
 java.lang.String getCookieSelectedTreeNode()
           This method returns the TreeNode client ID that is selected according the browser cookie.
 java.lang.Object getLocalValue()
           Return the local value of this UIComponent (if any), without evaluating any associated ValueBinding.
 java.lang.String getSelected()
          Specifies the client id of the selected tree node.
 java.lang.Object getSubmittedValue()
           Return the submittedValue value of this component.
 javax.faces.el.MethodBinding getValidator()
           Return a MethodBinding pointing at a method that will be used to validate the current value of this component.
 javax.faces.validator.Validator[] getValidators()
           Return the set of registered Validators for this component instance.
 java.lang.Object getValue()
           Gets the value of this UIComponent.
 javax.faces.el.MethodBinding getValueChangeListener()
           Return a MethodBinding instance method that will be called after any registered ValueChangeListeners have been notified of a value change.
 javax.faces.event.ValueChangeListener[] getValueChangeListeners()
           Return the set of registered ValueChangeListeners for this component instance.
protected  boolean isDifferent(java.lang.Object val1, java.lang.Object val2)
           Return true if the objects are not equal.
 boolean isLocalValueSet()
           Return the "local value set" state for this component.
 boolean isValid()
           Return a flag indicating whether the local value of this component is valid (no conversion error has occurred).
 void processDecodes(javax.faces.context.FacesContext context)
           Perform the component tree processing required by the Apply Request Values phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows.
 void processUpdates(javax.faces.context.FacesContext context)
           Perform the component tree processing required by the Update Model Values phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows.
 void processValidators(javax.faces.context.FacesContext context)
           In addition to the standard processValidators behavior inherited from UIComponentBases, calls validate() if the immediate property is false (which is the default); if the component is invalid afterwards, calls FacesContext.renderResponse.
 void removeValidator(javax.faces.validator.Validator validator)
           Remove a Validator instance from the set associated with this component, if it was previously associated.
 void removeValueChangeListener(javax.faces.event.ValueChangeListener listener)
           Remove an existing ValueChangeListener (if any) from the set of listeners interested in being notified when ValueChangeEvents occur.
 void restoreState(javax.faces.context.FacesContext context, java.lang.Object state)
          Restore the state of this component.
 java.lang.Object saveState(javax.faces.context.FacesContext context)
          Save the state of this component.
 void selectTreeNode(java.lang.String clientId)
          Deprecated. Use #setValue(Object)
 void selectTreeNode(TreeNode treeNode)
          Deprecated. Use #setValue(Object)
 void setConverter(javax.faces.convert.Converter conv)
           Set the Converter (if any) that is registered for this UIComponent.
 void setLocalValueSet(boolean value)
           Sets the "local value set" state for this component.
 void setSelected(java.lang.String s)
          Specifies the client id of the selected tree node.
 void setSubmittedValue(java.lang.Object value)
           Set the submittedValue value of this component.
 void setValid(boolean value)
           Set a flag indicating whether the local value of this component is valid (no conversion error has occurred).
 void setValidator(javax.faces.el.MethodBinding valBinding)
           Set a MethodBinding pointing at a method that will be used to validate the current value of this component.
 void setValue(java.lang.Object val)
           Set the value of this UIComponent (if any).
 void setValueChangeListener(javax.faces.el.MethodBinding method)
           Set a MethodBinding instance method that will be called after any registered ValueChangeListeners have been notified of a value change.
 void updateModel(javax.faces.context.FacesContext context)
           Perform the following algorithm to update the model data associated with this component, if any, as appropriate.
 void validate(javax.faces.context.FacesContext context)
           Perform the following algorithm to validate the local value of this UIInput.
protected  void validateValue(javax.faces.context.FacesContext context, java.lang.Object newValue)
           
 
Methods inherited from class com.sun.rave.web.ui.component.TreeBase
getFamily, getStyle, getStyleClass, getText, isClientSide, isExpandOnSelect, isImmediate, isRequired, isVisible, setClientSide, setExpandOnSelect, setImmediate, setRequired, setStyle, setStyleClass, setText, setVisible
 
Methods inherited from class com.sun.rave.web.ui.component.TreeNode
addActionListener, fireTurnerEvent, getActionListeners, getHandleIcon, getImageKeys, getParentTreeNode, removeActionListener, toggleNode
 
Methods inherited from class com.sun.rave.web.ui.component.TreeNodeBase
getAction, getActionListener, getImageURL, getTarget, getToolTip, getUrl, isExpanded, setAction, setActionListener, setExpanded, setImageURL, setTarget, setToolTip, setUrl
 
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, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientId, getFacesContext, getFacesListeners, getFacet, getFacets, getFacetsAndChildren, getId, getParent, getRenderer, getRendererType, getRendersChildren, getValueBinding, isRendered, isTransient, processRestoreState, processSaveState, 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
 
Methods inherited from interface javax.faces.component.EditableValueHolder
isImmediate, isRequired, setImmediate, setRequired
 

Field Detail

JAVA_SCRIPT_THEME_KEY

public static final java.lang.String JAVA_SCRIPT_THEME_KEY

This is the Theme key used to retrieve the JavaScript needed for this component.

See Also:
Theme.getPathToJSFile(String), 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

SELECTED_SUFFIX

public static final java.lang.String SELECTED_SUFFIX

This is the suffix appended to the client id when forming a request attribute key. The value associated with the generated key indicates which node should be selected. The renderer uses this information to generate JavaScript to select this node, overriding the previous selection.

See Also:
Constant Field Values

COOKIE_SUFFIX

public static final java.lang.String COOKIE_SUFFIX

This is the suffix appended to the client id to form the key to the cookie Map needed to retrieve the tree selection.

See Also:
Constant Field Values

COOKIE_SUFFIX_EXPAND

public static final java.lang.String COOKIE_SUFFIX_EXPAND

This is the suffix appended to the client id to form the key to the cookie Map needed to retrieve the node that may need to be expanded (because it was just selected).

See Also:
Constant Field Values
Constructor Detail

Tree

public Tree()
Constructor.

Method Detail

getSelected

public java.lang.String getSelected()
Description copied from class: TreeBase

Specifies the client id of the selected tree node.

Overrides:
getSelected in class TreeBase

setSelected

public void setSelected(java.lang.String s)
Description copied from class: TreeBase

Specifies the client id of the selected tree node.

Overrides:
setSelected in class TreeBase
See Also:
TreeBase.getSelected()

getConverter

public javax.faces.convert.Converter getConverter()

Return the Converter (if any) that is registered for this UIComponent.

Not implemented for this component.

Specified by:
getConverter in interface javax.faces.component.ValueHolder

setConverter

public void setConverter(javax.faces.convert.Converter conv)

Set the Converter (if any) that is registered for this UIComponent.

Not implemented for this component.

Specified by:
setConverter in interface javax.faces.component.ValueHolder
Parameters:
conv - New Converter (or null)

getLocalValue

public java.lang.Object getLocalValue()

Return the local value of this UIComponent (if any), without evaluating any associated ValueBinding.

Specified by:
getLocalValue in interface javax.faces.component.ValueHolder

getValue

public java.lang.Object getValue()

Gets the value of this UIComponent. First, consult the local value property of this component. If non-null return it. If non-null, see if we have a ValueBinding for the value property. If so, return the result of evaluating the property, otherwise return null.

Specified by:
getValue in interface javax.faces.component.ValueHolder

setValue

public void setValue(java.lang.Object val)

Set the value of this UIComponent (if any).

Specified by:
setValue in interface javax.faces.component.ValueHolder
Parameters:
val - The new local value

getSubmittedValue

public java.lang.Object getSubmittedValue()

Return the submittedValue value of this component. This method should only be used by the encodeBegin() and/or encodeEnd() methods of this component, or its corresponding Renderer.

Specified by:
getSubmittedValue in interface javax.faces.component.EditableValueHolder

setSubmittedValue

public void setSubmittedValue(java.lang.Object value)

Set the submittedValue value of this component. This method should only be used by the decode() and validate() method of this component, or its corresponding Renderer.

Specified by:
setSubmittedValue in interface javax.faces.component.EditableValueHolder
Parameters:
value - The new submitted value.

isLocalValueSet

public boolean isLocalValueSet()

Return the "local value set" state for this component. Calls to setValue() automatically reset this property to true.

Specified by:
isLocalValueSet in interface javax.faces.component.EditableValueHolder

setLocalValueSet

public void setLocalValueSet(boolean value)

Sets the "local value set" state for this component.

Specified by:
setLocalValueSet in interface javax.faces.component.EditableValueHolder

isValid

public boolean isValid()

Return a flag indicating whether the local value of this component is valid (no conversion error has occurred).

Specified by:
isValid in interface javax.faces.component.EditableValueHolder

setValid

public void setValid(boolean value)

Set a flag indicating whether the local value of this component is valid (no conversion error has occurred).

Specified by:
setValid in interface javax.faces.component.EditableValueHolder
Parameters:
value - The new valid flag.

getValidator

public javax.faces.el.MethodBinding getValidator()

Return a MethodBinding pointing at a method that will be used to validate the current value of this component. This method will be called during the Process Validations or Apply Request Values phases (depending on the value of the immediate property).

Not implemented for this component.

Specified by:
getValidator in interface javax.faces.component.EditableValueHolder

setValidator

public void setValidator(javax.faces.el.MethodBinding valBinding)

Set a MethodBinding pointing at a method that will be used to validate the current value of this component. This method will be called during the Process Validations or Apply Request Values phases (depending on the value of the immediate property).

Any method referenced by such an expression must be public, with a return type of void, and accept parameters of type FacesContext, UIComponent, and Object.

Not implemented for this component.

Specified by:
setValidator in interface javax.faces.component.EditableValueHolder
Parameters:
valBinding - The new MethodBinding instance.

addValidator

public void addValidator(javax.faces.validator.Validator validator)

Add a Validator instance to the set associated with this component.

Not implemented for this component.

Specified by:
addValidator in interface javax.faces.component.EditableValueHolder
Parameters:
validator - The Validator to add.

getValidators

public javax.faces.validator.Validator[] getValidators()

Return the set of registered Validators for this component instance. If there are no registered validators, a zero-length array is returned.

Not implemented for this component.

Specified by:
getValidators in interface javax.faces.component.EditableValueHolder

removeValidator

public void removeValidator(javax.faces.validator.Validator validator)

Remove a Validator instance from the set associated with this component, if it was previously associated. Otherwise, do nothing.

Not implemented for this component.

Specified by:
removeValidator in interface javax.faces.component.EditableValueHolder
Parameters:
validator - The Validator to remove.

getValueChangeListener

public javax.faces.el.MethodBinding getValueChangeListener()

Return a MethodBinding instance method that will be called after any registered ValueChangeListeners have been notified of a value change. This method will be called during the Process Validations or Apply Request Values phases (depending on the value of the immediate property).

Specified by:
getValueChangeListener in interface javax.faces.component.EditableValueHolder

setValueChangeListener

public void setValueChangeListener(javax.faces.el.MethodBinding method)

Set a MethodBinding instance method that will be called after any registered ValueChangeListeners have been notified of a value change. This method will be called during the Process Validations or Apply Request Values phases (depending on the value of the immediate property).

Specified by:
setValueChangeListener in interface javax.faces.component.EditableValueHolder
Parameters:
method - The new MethodBinding instance.

addValueChangeListener

public void addValueChangeListener(javax.faces.event.ValueChangeListener listener)

Add a new ValueChangeListener to the set of listeners interested in being notified when ValueChangeEvents occur.

Specified by:
addValueChangeListener in interface javax.faces.component.EditableValueHolder
Parameters:
listener - The ValueChangeListener to be added.

getValueChangeListeners

public javax.faces.event.ValueChangeListener[] getValueChangeListeners()

Return the set of registered ValueChangeListeners for this component instance. If there are no registered listeners, a zero-length array is returned.

Specified by:
getValueChangeListeners in interface javax.faces.component.EditableValueHolder

removeValueChangeListener

public void removeValueChangeListener(javax.faces.event.ValueChangeListener listener)

Remove an existing ValueChangeListener (if any) from the set of listeners interested in being notified when ValueChangeEvents occur.

Specified by:
removeValueChangeListener in interface javax.faces.component.EditableValueHolder
Parameters:
listener - The ValueChangeListener to be removed.

decode

public void decode(javax.faces.context.FacesContext context)

Decode any new state of this UIComponent from the request contained in the specified FacesContext, and store this state as needed.

During decoding, events may be enqueued for later processing (by event listeners who have registered an interest), by calling queueEvent().

Parameters:
context - FacesContext for the request we are processing.

broadcast

public void broadcast(javax.faces.event.FacesEvent event)
               throws javax.faces.event.AbortProcessingException

In addition to to the default UIComponent#broadcast processing, pass the ValueChangeEvent being broadcast to the method referenced by valueChangeListener.

Parameters:
event - FacesEvent to be broadcast
Throws:
javax.faces.event.AbortProcessingException - Signal the JSF implementation that no further processing on the current event should be performed

processUpdates

public void processUpdates(javax.faces.context.FacesContext context)

Perform the component tree processing required by the Update Model Values phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows.

Parameters:
context - FacesContext for this request

updateModel

public void updateModel(javax.faces.context.FacesContext context)

Perform the following algorithm to update the model data associated with this component, if any, as appropriate.

Parameters:
context - FacesContext for the request we are processing.

processDecodes

public void processDecodes(javax.faces.context.FacesContext context)

Perform the component tree processing required by the Apply Request Values phase of the request processing lifecycle for all facets of this component, all children of this component, and this component itself, as follows.

Parameters:
context - FacesContext for the request.

processValidators

public void processValidators(javax.faces.context.FacesContext context)

In addition to the standard processValidators behavior inherited from UIComponentBases, calls validate() if the immediate property is false (which is the default); if the component is invalid afterwards, calls FacesContext.renderResponse. If a RuntimeException is thrown during validation processing, calls FacesContext.renderResponse and re-throws the exception.


validate

public void validate(javax.faces.context.FacesContext context)

Perform the following algorithm to validate the local value of this UIInput.

Parameters:
context - FacesContext for the current request.

isDifferent

protected boolean isDifferent(java.lang.Object val1,
                              java.lang.Object val2)

Return true if the objects are not equal.

Parameters:
val1 - Value 1
Returns:
true if the 2 values are not equal

validateValue

protected void validateValue(javax.faces.context.FacesContext context,
                             java.lang.Object newValue)

selectTreeNode

public void selectTreeNode(TreeNode treeNode)
Deprecated. Use #setValue(Object)

This method accepts the TreeNode which is to be selected. The previous TreeNode that was selected will unselected. No state is saved with this operation, the state is maintained on the client.

Parameters:
treeNode - The TreeNode to be selected.

selectTreeNode

public void selectTreeNode(java.lang.String clientId)
Deprecated. Use #setValue(Object)

This method accepts the clientId of a TreeNode which is to be selected. The previous TreeNode that was selected will unselected. No state is saved with this operation, the state is maintained on the client-side.

Parameters:
clientId - Client id of the TreeNode to be selected.

getCookieSelectedTreeNode

public java.lang.String getCookieSelectedTreeNode()

This method returns the TreeNode client ID that is selected according the browser cookie. This method is generally only useful during the decode process.

Returns:
The selected tree node (according to the cookie).

getCookieExpandNode

public java.lang.String getCookieExpandNode()

This method will return the TreeNode client ID that is selected according the browser cookie. This method is only useful during the decode process as the cookie will typically be reset to null immediately after the request is processed.

Returns:
The selected tree node (according to the cookie).

saveState

public java.lang.Object saveState(javax.faces.context.FacesContext context)
Description copied from class: TreeBase

Save the state of this component.

Specified by:
saveState in interface javax.faces.component.StateHolder
Overrides:
saveState in class TreeBase

restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         java.lang.Object state)
Description copied from class: TreeBase

Restore the state of this component.

Specified by:
restoreState in interface javax.faces.component.StateHolder
Overrides:
restoreState in class TreeBase