org.apache.myfaces.custom.behavior
Class ClientBehaviorBase

java.lang.Object
  extended by javax.faces.component.behavior.BehaviorBase
      extended by javax.faces.component.behavior.ClientBehaviorBase
          extended by org.apache.myfaces.custom.behavior.ClientBehaviorBase
All Implemented Interfaces:
javax.faces.component.behavior.Behavior, javax.faces.component.behavior.ClientBehavior, javax.faces.component.PartialStateHolder, javax.faces.component.StateHolder
Direct Known Subclasses:
EffectClientBehaviorBase

public abstract class ClientBehaviorBase
extends javax.faces.component.behavior.ClientBehaviorBase

Base behavior implementation for Apache MyFaces Tomahawk.


Constructor Summary
ClientBehaviorBase()
           
 
Method Summary
protected  javax.faces.context.FacesContext getFacesContext()
           
protected  javax.faces.component.StateHelper getStateHelper()
           
protected  javax.faces.component.StateHelper getStateHelper(boolean create)
          returns a delta state saving enabled state helper for the current component
 javax.el.ValueExpression getValueExpression(java.lang.String name)
           
static java.lang.Object restoreAttachedState(javax.faces.context.FacesContext context, java.lang.Object stateObj)
           
 void restoreState(javax.faces.context.FacesContext facesContext, java.lang.Object o)
           
static java.lang.Object saveAttachedState(javax.faces.context.FacesContext context, java.lang.Object attachedObject)
          Serializes objects which are "attached" to this component but which are not UIComponent children of it.
 java.lang.Object saveState(javax.faces.context.FacesContext facesContext)
           
 void setValueExpression(java.lang.String name, javax.el.ValueExpression expression)
           
 
Methods inherited from class javax.faces.component.behavior.ClientBehaviorBase
decode, getHints, getRenderer, getRendererType, getScript
 
Methods inherited from class javax.faces.component.behavior.BehaviorBase
addBehaviorListener, broadcast, clearInitialState, initialStateMarked, isTransient, markInitialState, removeBehaviorListener, setTransient
 
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.behavior.Behavior
broadcast
 

Constructor Detail

ClientBehaviorBase

public ClientBehaviorBase()
Method Detail

saveState

public java.lang.Object saveState(javax.faces.context.FacesContext facesContext)
Specified by:
saveState in interface javax.faces.component.StateHolder
Overrides:
saveState in class javax.faces.component.behavior.BehaviorBase
Parameters:
context -

restoreState

public void restoreState(javax.faces.context.FacesContext facesContext,
                         java.lang.Object o)
Specified by:
restoreState in interface javax.faces.component.StateHolder
Overrides:
restoreState in class javax.faces.component.behavior.BehaviorBase

getValueExpression

public javax.el.ValueExpression getValueExpression(java.lang.String name)

setValueExpression

public void setValueExpression(java.lang.String name,
                               javax.el.ValueExpression expression)

saveAttachedState

public static java.lang.Object saveAttachedState(javax.faces.context.FacesContext context,
                                                 java.lang.Object attachedObject)
Serializes objects which are "attached" to this component but which are not UIComponent children of it. Examples are validator and listener objects. To be precise, it returns an object which implements java.io.Serializable, and which when serialized will persist the state of the provided object.

If the attachedObject is a List then every object in the list is saved via a call to this method, and the returned wrapper object contains a List object.

If the object implements StateHolder then the object's saveState is called immediately, and a wrapper is returned which contains both this saved state and the original class name. However in the case where the StateHolder.isTransient method returns true, null is returned instead.

If the object implements java.io.Serializable then the object is simply returned immediately; standard java serialization will later be used to store this object.

In all other cases, a wrapper is returned which simply stores the type of the provided object. When deserialized, a default instance of that type will be recreated.


restoreAttachedState

public static java.lang.Object restoreAttachedState(javax.faces.context.FacesContext context,
                                                    java.lang.Object stateObj)
                                             throws java.lang.IllegalStateException
Throws:
java.lang.IllegalStateException

getFacesContext

protected javax.faces.context.FacesContext getFacesContext()

getStateHelper

protected javax.faces.component.StateHelper getStateHelper()

getStateHelper

protected javax.faces.component.StateHelper getStateHelper(boolean create)
returns a delta state saving enabled state helper for the current component

Parameters:
create - if true a state helper is created if not already existing
Returns:
an implementation of the StateHelper interface or null if none exists and create is set to false


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.