org.apache.myfaces.view.facelets
Class FaceletViewDeclarationLanguage

java.lang.Object
  extended by javax.faces.view.ViewDeclarationLanguage
      extended by org.apache.myfaces.shared_impl.view.ViewDeclarationLanguageBase
          extended by org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage

public class FaceletViewDeclarationLanguage
extends ViewDeclarationLanguageBase

This class represents the abstraction of Facelets as a ViewDeclarationLanguage.

Since:
2.0
Version:
$Revision: 696523 $ $Date: 2009-03-21 14:57:08 -0400 (mer., 17 sept. 2008) $
Author:
Simon Lessard (latest modification by $Author: slessard $)

Field Summary
static java.lang.String BUILDING_VIEW_METADATA
           
static java.lang.String CHARACTER_ENCODING_KEY
           
static java.lang.String CLEAN_TRANSIENT_BUILD_ON_RESTORE
           
static java.lang.String DEFAULT_CHARACTER_ENCODING
           
static long DEFAULT_REFRESH_PERIOD
           
static long DEFAULT_REFRESH_PERIOD_PRODUCTION
           
static java.lang.String FILLED_VIEW
           
static java.lang.String MARK_INITIAL_STATE_KEY
          Marker to indicate tag handlers the view currently being built is using partial state saving and it is necessary to call UIComponent.markInitialState after component instances are populated.
static java.lang.String PARAM_BUFFER_SIZE
           
static java.lang.String PARAM_DECORATORS
           
static java.lang.String PARAM_ENCODING
           
static java.lang.String PARAM_LIBRARIES
           
static java.lang.String PARAM_REFRESH_PERIOD
           
static java.lang.String PARAM_RESOURCE_RESOLVER
           
static java.lang.String PARAM_SKIP_COMMENTS
           
static java.lang.String REFRESH_TRANSIENT_BUILD_ON_PSS
           
static java.lang.String REFRESHING_TRANSIENT_BUILD
           
static java.lang.String USING_PSS_ON_THIS_VIEW
           
 
Constructor Summary
FaceletViewDeclarationLanguage(javax.faces.context.FacesContext context)
           
 
Method Summary
static java.lang.Class _javaTypeToClass(java.lang.String type)
          This method is similar to shared ClassUtils.javaTypeToClass, but the default package is java.lang TODO: Move to shared project
static void _publishPostBuildComponentTreeOnRestoreViewEvent(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
           
 void buildView(javax.faces.context.FacesContext context, javax.faces.component.UIViewRoot view)
          
protected  java.lang.String calculateViewId(javax.faces.context.FacesContext context, java.lang.String viewId)
          Calculates the effective view identifier for the specified raw view identifier.
static void cleanTransientBuildOnRestore(javax.faces.context.FacesContext context)
           
protected  Compiler createCompiler(javax.faces.context.FacesContext context)
          Creates the Facelet page compiler.
protected  FaceletFactory createFaceletFactory(javax.faces.context.FacesContext context, Compiler compiler)
          Creates a FaceletFactory instance using the specified compiler.
protected  javax.faces.context.ResponseWriter createResponseWriter(javax.faces.context.FacesContext context)
           
 javax.faces.component.UIViewRoot createView(javax.faces.context.FacesContext context, java.lang.String viewId)
          Process the specification required algorithm that is generic to all PDL.
 java.beans.BeanInfo getComponentMetadata(javax.faces.context.FacesContext context, javax.faces.application.Resource componentResource)
          retargetMethodExpressions(FacesContext, UIComponent) has some clues about the behavior of this method
protected  java.lang.String getDefaultSuffix(javax.faces.context.FacesContext context)
           
protected  java.lang.String getRenderedViewId(javax.faces.context.FacesContext context, java.lang.String actionId)
           
protected  java.lang.String getResponseContentType(javax.faces.context.FacesContext context, java.lang.String orig)
          Generate the content type
protected  java.lang.String getResponseEncoding(javax.faces.context.FacesContext context, java.lang.String orig)
          Generate the encoding
 javax.faces.application.Resource getScriptComponentResource(javax.faces.context.FacesContext context, javax.faces.application.Resource componentResource)
          
 javax.faces.view.StateManagementStrategy getStateManagementStrategy(javax.faces.context.FacesContext context, java.lang.String viewId)
          
 javax.faces.view.ViewMetadata getViewMetadata(javax.faces.context.FacesContext context, java.lang.String viewId)
          
protected  void handleFaceletNotFound(javax.faces.context.FacesContext context, java.lang.String viewId)
           
protected  void handleRenderException(javax.faces.context.FacesContext context, java.lang.Exception e)
           
protected  void initialize(javax.faces.context.FacesContext context)
          Initialize the ViewHandler during its first request.
static boolean isBuildingViewMetadata(javax.faces.context.FacesContext context)
          Check if the current facelet applied is used to build view metadata.
static boolean isCleanTransientBuildOnRestore(javax.faces.context.FacesContext context)
           
static boolean isMarkInitialState(javax.faces.context.FacesContext context)
           
static boolean isRefreshingTransientBuild(javax.faces.context.FacesContext context)
           
static boolean isRefreshTransientBuildOnPSS(javax.faces.context.FacesContext context)
           
static boolean isRefreshTransientBuildOnPSSAuto(javax.faces.context.FacesContext context)
           
static boolean isUsingPSSOnThisView(javax.faces.context.FacesContext context)
           
protected  void loadDecorators(javax.faces.context.FacesContext context, Compiler compiler)
          Load the various decorators for Facelets.
protected  void loadLibraries(javax.faces.context.FacesContext context, Compiler compiler)
          Load the various tag libraries for Facelets.
protected  void loadOptions(javax.faces.context.FacesContext context, Compiler compiler)
          Load the various options for Facelets compiler.
 void renderView(javax.faces.context.FacesContext context, javax.faces.component.UIViewRoot view)
          
 javax.faces.component.UIViewRoot restoreView(javax.faces.context.FacesContext context, java.lang.String viewId)
          
 void retargetAttachedObjects(javax.faces.context.FacesContext context, javax.faces.component.UIComponent topLevelComponent, java.util.List<javax.faces.view.AttachedObjectHandler> handlerList)
          In short words, this method take care of "target" an "attached object".
 void retargetMethodExpressions(javax.faces.context.FacesContext context, javax.faces.component.UIComponent topLevelComponent)
           
protected  void sendSourceNotFound(javax.faces.context.FacesContext context, java.lang.String message)
          Send a source not found to the client.
 
Methods inherited from class org.apache.myfaces.shared_impl.view.ViewDeclarationLanguageBase
checkNull
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHARACTER_ENCODING_KEY

public static final java.lang.String CHARACTER_ENCODING_KEY
See Also:
Constant Field Values

DEFAULT_REFRESH_PERIOD

public static final long DEFAULT_REFRESH_PERIOD
See Also:
Constant Field Values

DEFAULT_REFRESH_PERIOD_PRODUCTION

public static final long DEFAULT_REFRESH_PERIOD_PRODUCTION
See Also:
Constant Field Values

DEFAULT_CHARACTER_ENCODING

public static final java.lang.String DEFAULT_CHARACTER_ENCODING
See Also:
Constant Field Values

PARAM_BUFFER_SIZE

@JSFWebConfigParam(since="2.0")
public static final java.lang.String PARAM_BUFFER_SIZE
See Also:
Constant Field Values

PARAM_DECORATORS

@JSFWebConfigParam(since="2.0")
public static final java.lang.String PARAM_DECORATORS
See Also:
Constant Field Values

PARAM_ENCODING

@JSFWebConfigParam(since="2.0")
public static final java.lang.String PARAM_ENCODING
See Also:
Constant Field Values

PARAM_LIBRARIES

@JSFWebConfigParam(since="2.0")
public static final java.lang.String PARAM_LIBRARIES
See Also:
Constant Field Values

PARAM_REFRESH_PERIOD

@JSFWebConfigParam(since="2.0")
public static final java.lang.String PARAM_REFRESH_PERIOD
See Also:
Constant Field Values

PARAM_RESOURCE_RESOLVER

@JSFWebConfigParam(since="2.0")
public static final java.lang.String PARAM_RESOURCE_RESOLVER
See Also:
Constant Field Values

PARAM_SKIP_COMMENTS

@JSFWebConfigParam(since="2.0")
public static final java.lang.String PARAM_SKIP_COMMENTS
See Also:
Constant Field Values

FILLED_VIEW

public static final java.lang.String FILLED_VIEW
See Also:
Constant Field Values

BUILDING_VIEW_METADATA

public static final java.lang.String BUILDING_VIEW_METADATA
See Also:
Constant Field Values

REFRESHING_TRANSIENT_BUILD

public static final java.lang.String REFRESHING_TRANSIENT_BUILD
See Also:
Constant Field Values

REFRESH_TRANSIENT_BUILD_ON_PSS

public static final java.lang.String REFRESH_TRANSIENT_BUILD_ON_PSS
See Also:
Constant Field Values

USING_PSS_ON_THIS_VIEW

public static final java.lang.String USING_PSS_ON_THIS_VIEW
See Also:
Constant Field Values

MARK_INITIAL_STATE_KEY

public static final java.lang.String MARK_INITIAL_STATE_KEY
Marker to indicate tag handlers the view currently being built is using partial state saving and it is necessary to call UIComponent.markInitialState after component instances are populated.

See Also:
Constant Field Values

CLEAN_TRANSIENT_BUILD_ON_RESTORE

public static final java.lang.String CLEAN_TRANSIENT_BUILD_ON_RESTORE
See Also:
Constant Field Values
Constructor Detail

FaceletViewDeclarationLanguage

public FaceletViewDeclarationLanguage(javax.faces.context.FacesContext context)
Method Detail

buildView

public void buildView(javax.faces.context.FacesContext context,
                      javax.faces.component.UIViewRoot view)
               throws java.io.IOException

Specified by:
buildView in class javax.faces.view.ViewDeclarationLanguage
Throws:
java.io.IOException

_publishPostBuildComponentTreeOnRestoreViewEvent

public static void _publishPostBuildComponentTreeOnRestoreViewEvent(javax.faces.context.FacesContext context,
                                                                    javax.faces.component.UIComponent component)

getComponentMetadata

public java.beans.BeanInfo getComponentMetadata(javax.faces.context.FacesContext context,
                                                javax.faces.application.Resource componentResource)
retargetMethodExpressions(FacesContext, UIComponent) has some clues about the behavior of this method

Specified by:
getComponentMetadata in class javax.faces.view.ViewDeclarationLanguage

isBuildingViewMetadata

public static boolean isBuildingViewMetadata(javax.faces.context.FacesContext context)
Check if the current facelet applied is used to build view metadata.

Parameters:
context -
Returns:

isRefreshingTransientBuild

public static boolean isRefreshingTransientBuild(javax.faces.context.FacesContext context)

isMarkInitialState

public static boolean isMarkInitialState(javax.faces.context.FacesContext context)

isRefreshTransientBuildOnPSS

public static boolean isRefreshTransientBuildOnPSS(javax.faces.context.FacesContext context)

isRefreshTransientBuildOnPSSAuto

public static boolean isRefreshTransientBuildOnPSSAuto(javax.faces.context.FacesContext context)

isCleanTransientBuildOnRestore

public static boolean isCleanTransientBuildOnRestore(javax.faces.context.FacesContext context)

cleanTransientBuildOnRestore

public static void cleanTransientBuildOnRestore(javax.faces.context.FacesContext context)

isUsingPSSOnThisView

public static boolean isUsingPSSOnThisView(javax.faces.context.FacesContext context)

retargetAttachedObjects

public void retargetAttachedObjects(javax.faces.context.FacesContext context,
                                    javax.faces.component.UIComponent topLevelComponent,
                                    java.util.List<javax.faces.view.AttachedObjectHandler> handlerList)
In short words, this method take care of "target" an "attached object". This method should be called from some composite component tag handler, after all children of composite component has been applied.

Overrides:
retargetAttachedObjects in class javax.faces.view.ViewDeclarationLanguage

retargetMethodExpressions

public void retargetMethodExpressions(javax.faces.context.FacesContext context,
                                      javax.faces.component.UIComponent topLevelComponent)
Overrides:
retargetMethodExpressions in class javax.faces.view.ViewDeclarationLanguage

_javaTypeToClass

public static java.lang.Class _javaTypeToClass(java.lang.String type)
                                        throws java.lang.ClassNotFoundException
This method is similar to shared ClassUtils.javaTypeToClass, but the default package is java.lang TODO: Move to shared project

Parameters:
type -
Returns:
Throws:
java.lang.ClassNotFoundException

getScriptComponentResource

public javax.faces.application.Resource getScriptComponentResource(javax.faces.context.FacesContext context,
                                                                   javax.faces.application.Resource componentResource)

Specified by:
getScriptComponentResource in class javax.faces.view.ViewDeclarationLanguage

getStateManagementStrategy

public javax.faces.view.StateManagementStrategy getStateManagementStrategy(javax.faces.context.FacesContext context,
                                                                           java.lang.String viewId)

Specified by:
getStateManagementStrategy in class javax.faces.view.ViewDeclarationLanguage

getViewMetadata

public javax.faces.view.ViewMetadata getViewMetadata(javax.faces.context.FacesContext context,
                                                     java.lang.String viewId)

Specified by:
getViewMetadata in class javax.faces.view.ViewDeclarationLanguage

renderView

public void renderView(javax.faces.context.FacesContext context,
                       javax.faces.component.UIViewRoot view)
                throws java.io.IOException

Specified by:
renderView in class javax.faces.view.ViewDeclarationLanguage
Throws:
java.io.IOException

createView

public javax.faces.component.UIViewRoot createView(javax.faces.context.FacesContext context,
                                                   java.lang.String viewId)
Process the specification required algorithm that is generic to all PDL.

Overrides:
createView in class ViewDeclarationLanguageBase

restoreView

public javax.faces.component.UIViewRoot restoreView(javax.faces.context.FacesContext context,
                                                    java.lang.String viewId)

Overrides:
restoreView in class ViewDeclarationLanguageBase

calculateViewId

protected java.lang.String calculateViewId(javax.faces.context.FacesContext context,
                                           java.lang.String viewId)
Calculates the effective view identifier for the specified raw view identifier.

Specified by:
calculateViewId in class ViewDeclarationLanguageBase
Parameters:
context - le current FacesContext
viewId - the raw view identifier
Returns:
the effective view identifier

createCompiler

protected Compiler createCompiler(javax.faces.context.FacesContext context)
Creates the Facelet page compiler.

Parameters:
context - the current FacesContext
Returns:
the application's Facelet page compiler

createFaceletFactory

protected FaceletFactory createFaceletFactory(javax.faces.context.FacesContext context,
                                              Compiler compiler)
Creates a FaceletFactory instance using the specified compiler.

Parameters:
context - the current FacesContext
compiler - the compiler to be used by the factory
Returns:
the factory used by this VDL to load pages

createResponseWriter

protected javax.faces.context.ResponseWriter createResponseWriter(javax.faces.context.FacesContext context)
                                                           throws java.io.IOException,
                                                                  javax.faces.FacesException
Throws:
java.io.IOException
javax.faces.FacesException

getDefaultSuffix

protected java.lang.String getDefaultSuffix(javax.faces.context.FacesContext context)
                                     throws javax.faces.FacesException
Throws:
javax.faces.FacesException

getRenderedViewId

protected java.lang.String getRenderedViewId(javax.faces.context.FacesContext context,
                                             java.lang.String actionId)

getResponseContentType

protected java.lang.String getResponseContentType(javax.faces.context.FacesContext context,
                                                  java.lang.String orig)
Generate the content type

Parameters:
context -
orig -
Returns:

getResponseEncoding

protected java.lang.String getResponseEncoding(javax.faces.context.FacesContext context,
                                               java.lang.String orig)
Generate the encoding

Parameters:
context -
orig -
Returns:

handleFaceletNotFound

protected void handleFaceletNotFound(javax.faces.context.FacesContext context,
                                     java.lang.String viewId)
                              throws javax.faces.FacesException,
                                     java.io.IOException
Throws:
javax.faces.FacesException
java.io.IOException

handleRenderException

protected void handleRenderException(javax.faces.context.FacesContext context,
                                     java.lang.Exception e)
                              throws java.io.IOException,
                                     javax.el.ELException,
                                     javax.faces.FacesException
Throws:
java.io.IOException
javax.el.ELException
javax.faces.FacesException

initialize

protected void initialize(javax.faces.context.FacesContext context)
Initialize the ViewHandler during its first request.


loadDecorators

protected void loadDecorators(javax.faces.context.FacesContext context,
                              Compiler compiler)
Load the various decorators for Facelets.

Parameters:
context - the current FacesContext
compiler - the page compiler

loadLibraries

protected void loadLibraries(javax.faces.context.FacesContext context,
                             Compiler compiler)
Load the various tag libraries for Facelets.

Parameters:
context - the current FacesContext
compiler - the page compiler

loadOptions

protected void loadOptions(javax.faces.context.FacesContext context,
                           Compiler compiler)
Load the various options for Facelets compiler. Currently only comment skipping is supported.

Parameters:
context - the current FacesContext
compiler - the page compiler

sendSourceNotFound

protected void sendSourceNotFound(javax.faces.context.FacesContext context,
                                  java.lang.String message)
Send a source not found to the client. Although it can be considered ok in JSP mode, I think it's pretty lame to have this kind of requirement at VDL level considering VDL represents the page --> JSF tree link, not the transport layer required to send a SC_NOT_FOUND.

Specified by:
sendSourceNotFound in class ViewDeclarationLanguageBase
Parameters:
context - le current FacesContext
message - the message associated with the error


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