JSF-Spring

de.mindmatters.faces.application
Class ViewBuilder

java.lang.Object
  extended by javax.faces.application.ViewHandler
      extended by de.mindmatters.faces.application.ViewBuilder
Direct Known Subclasses:
AbstractDelegatingViewBuilder, FaceletViewBuilder

public abstract class ViewBuilder
extends ViewHandler

ViewBuilder is the pluggablity mechanism for allowing implementations of or applications using the JavaServer Faces specification to provide their own handling of the activities in the Render Response and Restore View phases of the request processing lifecycle.

A ViewBuilder has the ability to create, restore and build a view. Building a view means restoring the component tree structure of a faces view without the need of a serialized tree structure state. Method buildView(FacesContext, String) will be invoked everytime a view id (FacesUtils.VIEWID_PARAM) and no component view state is submitted by a request.

Note: Usually a view created by buildView(FacesContext, String) holds the default component state. Any state changes of the components during the request lifecycle will be ignored since it cannot be restored (because usually whether component tree state nor component value state is submitted)

Author:
Andreas Kuhrwahl
See Also:
AbstractDelegatingViewBuilder, FaceletViewBuilder

Field Summary
 
Fields inherited from class javax.faces.application.ViewHandler
CHARACTER_ENCODING_KEY, DEFAULT_SUFFIX, DEFAULT_SUFFIX_PARAM_NAME
 
Constructor Summary
ViewBuilder()
           
 
Method Summary
abstract  UIViewRoot buildView(FacesContext context, java.lang.String viewId)
          Perform whatever actions are required to build the view associated with the specified FacesContext and viewId.
static void markForTransientState(FacesContext context)
          Marks a request to not save the state of the view into the response.
static void unmarkTransientState(FacesContext context)
          Releases the marker to not save the state of the view into the response.
 void writeState(FacesContext context)
          

Take any appropriate action to either immediately write out the current state information (by calling StateManager.writeState(javax.faces.context.FacesContext, javax.faces.application.StateManager.SerializedView), or noting where state information should later be written.

protected abstract  void writeStateInClient(FacesContext context)
          Writes the state of a view into the response.
 
Methods inherited from class javax.faces.application.ViewHandler
calculateLocale, calculateRenderKitId, createView, getActionURL, getResourceURL, renderView, restoreView
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ViewBuilder

public ViewBuilder()
Method Detail

markForTransientState

public static final void markForTransientState(FacesContext context)
Marks a request to not save the state of the view into the response.

Parameters:
context - FacesContext for the current request

unmarkTransientState

public static final void unmarkTransientState(FacesContext context)
Releases the marker to not save the state of the view into the response.

Parameters:
context - FacesContext for the current request

writeState

public final void writeState(FacesContext context)
                      throws java.io.IOException

Take any appropriate action to either immediately write out the current state information (by calling StateManager.writeState(javax.faces.context.FacesContext, javax.faces.application.StateManager.SerializedView), or noting where state information should later be written.

Specified by:
writeState in class ViewHandler
Parameters:
context - FacesContext for the current request
Throws:
java.io.IOException - if an input/output error occurs

writeStateInClient

protected abstract void writeStateInClient(FacesContext context)
                                    throws java.io.IOException
Writes the state of a view into the response. Usually this is done by calling StateManager.writeState(javax.faces.context.FacesContext, javax.faces.application.StateManager.SerializedView)

Parameters:
context - FacesContext for the current request
Throws:
java.io.IOException - if an input/output error occurs
See Also:
ViewHandler.writeState(FacesContext)

buildView

public abstract UIViewRoot buildView(FacesContext context,
                                     java.lang.String viewId)
Perform whatever actions are required to build the view associated with the specified FacesContext and viewId. Building a view means to restore the component tree structure of a view without the need of a serialized state representing the structure.

Parameters:
context - FacesContext for the current request
viewId - the view identifier for the current request
Returns:
Built UIViewRoot representing the view
Throws:
java.lang.NullPointerException - if context is null
FacesException - if a servlet error occurs

JSF-Spring

Copyright © 2006 mindmatters GmbH & Co. KG