SourceForge.net Logo

de.mindmatters.faces.component
Class StateHolderStateBuilder

java.lang.Object
  extended byde.mindmatters.faces.component.StateHolderStateBuilder

public final class StateHolderStateBuilder
extends java.lang.Object

Serializes/deserializes the state of the given StateHolder stateHolder. Also serializes declared non-serializable fields of the given StateHolder - so serialization is independent of the configured state-saving method.

The state is saved into the session by a globally unique key. UIComponents, Converters and Validators serialized/deserialized by this builder can hold their own state within multiple browser windows with server-side state-saving (famous bug of sun's jsf RI and myFaces jsf implementation).

Author:
Andreas Kuhrwahl
See Also:
StateHolder, RandomGuid

Method Summary
 void restoreState(FacesContext context, java.lang.Object state)
          Deserializes the given state into the internal StateHolder stateHolder.
static void restoreState(StateHolder stateHolder, FacesContext context, java.lang.Object state)
          Deserializes the given state into the given StateHolder stateHolder.
 java.lang.Object saveState(FacesContext context)
          Serializes the state of the internal StateHolder stateHolder.
static java.lang.Object saveState(StateHolder stateHolder, FacesContext context)
          Serializes the state of the given StateHolder stateHolder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

saveState

public static java.lang.Object saveState(StateHolder stateHolder,
                                         FacesContext context)
Serializes the state of the given StateHolder stateHolder.

Parameters:
stateHolder - object to serialize
context - the FacesContext
Returns:
a globally unique key pointing to the serialized state in the session

restoreState

public static void restoreState(StateHolder stateHolder,
                                FacesContext context,
                                java.lang.Object state)
Deserializes the given state into the given StateHolder stateHolder.

Parameters:
stateHolder - object to deserialize into
context - the FacesContext
state - the globally unique key pointing to the serialized state in the session

saveState

public java.lang.Object saveState(FacesContext context)
Serializes the state of the internal StateHolder stateHolder.

Parameters:
context - the FacesContext
Returns:
a globally unique key pointing to the serialized state of the internal StateHolder in the session

restoreState

public void restoreState(FacesContext context,
                         java.lang.Object state)
Deserializes the given state into the internal StateHolder stateHolder.

Parameters:
context - the FacesContext
state - the globally unique key pointing to the serialized state of the internal StateHolder in the session

SourceForge.net Logo

Copyright © 2002 mindmatters GmbH & Co. KG