org.apache.myfaces.view.facelets
Class FaceletViewDeclarationLanguage

java.lang.Object
  extended by javax.faces.view.ViewDeclarationLanguage
      extended by org.apache.myfaces.shared.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: 1533114 $ $Date: 2013-10-17 10:25:52 -0500 (Thu, 17 Oct 2013) $
Author:
Simon Lessard (latest modification by $Author: lu4242 $)

Field Summary
static String BUILDING_VIEW_METADATA
           
static String CACHED_COMPONENT_IDS
          Key used to cache component ids for the counter
static String CHARACTER_ENCODING_KEY
           
static String CLEAN_TRANSIENT_BUILD_ON_RESTORE
           
static String DEFAULT_CHARACTER_ENCODING
           
static long DEFAULT_REFRESH_PERIOD
           
static long DEFAULT_REFRESH_PERIOD_PRODUCTION
           
static String FILLED_VIEW
           
static String IS_BUILDING_INITIAL_STATE_KEY_ALIAS
           
static 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 String PARAM_BUFFER_SIZE
          Define the default buffer size value passed to ExternalContext.setResponseBufferResponse() and in a servlet environment to HttpServletResponse.setBufferSize().
static String PARAM_DECORATORS
          Set of class names, separated by ';', implementing TagDecorator interface, used to transform a view definition in a facelet abstract syntax tree, that is used later to generate a component tree.
static String PARAM_ENCODING
          Constant used by EncodingHandler to indicate the current encoding of the page being built, and indicate which one is the response encoding on getResponseEncoding(FacesContext, String) method.
static String PARAM_LIBRARIES
          Set of .taglib.xml files, separated by ';' that should be loaded by facelet engine.
static String PARAM_REFRESH_PERIOD
          Define the period used to refresh the facelet abstract syntax tree from the view definition file.
static String PARAM_RESOURCE_RESOLVER
          Class implementing ResourceResolver interface used to locate facelet resources.
static String PARAM_SKIP_COMMENTS
          Skip comments found on a facelet file.
static String REFRESH_TRANSIENT_BUILD_ON_PSS
           
static String REFRESHING_TRANSIENT_BUILD
           
static String REMOVING_COMPONENTS_BUILD
           
static String USING_PSS_ON_THIS_VIEW
           
 
Fields inherited from class javax.faces.view.ViewDeclarationLanguage
FACELETS_VIEW_DECLARATION_LANGUAGE_ID, JSP_VIEW_DECLARATION_LANGUAGE_ID
 
Constructor Summary
FaceletViewDeclarationLanguage(FacesContext context)
           
FaceletViewDeclarationLanguage(FacesContext context, ViewDeclarationLanguageStrategy strategy)
           
 
Method Summary
static Class _javaTypeToClass(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(FacesContext context, UIComponent component)
           
 void buildView(FacesContext context, UIViewRoot view)
          
protected  String calculateViewId(FacesContext context, String viewId)
          
static void cleanTransientBuildOnRestore(FacesContext context)
           
protected  Compiler createCompiler(FacesContext context)
          Creates the Facelet page compiler.
protected  FaceletFactory createFaceletFactory(FacesContext context, Compiler compiler)
          Creates a FaceletFactory instance using the specified compiler.
protected  ResponseWriter createResponseWriter(FacesContext context)
           
 UIViewRoot createView(FacesContext context, String viewId)
          
 BeanInfo getComponentMetadata(FacesContext context, Resource componentResource)
          retargetMethodExpressions(FacesContext, UIComponent) has some clues about the behavior of this method
protected  String getDefaultSuffix(FacesContext context)
          Deprecated. this code is not used anymore
 String getId()
           
protected  String getRenderedViewId(FacesContext context, String actionId)
          Deprecated.  
protected  String getResponseContentType(FacesContext context, String orig)
          Generate the content type
protected  String getResponseEncoding(FacesContext context, String orig)
          Generate the encoding
 Resource getScriptComponentResource(FacesContext context, Resource componentResource)
          
 StateManagementStrategy getStateManagementStrategy(FacesContext context, String viewId)
          
 ViewMetadata getViewMetadata(FacesContext context, String viewId)
          
protected  void handleFaceletNotFound(FacesContext context, String viewId)
           
protected  void handleRenderException(FacesContext context, Exception e)
           
protected  void initialize(FacesContext context)
          Initialize the ViewHandler during its first request.
static boolean isBuildingViewMetadata(FacesContext context)
          Check if the current facelet applied is used to build view metadata.
static boolean isCleanTransientBuildOnRestore(FacesContext context)
           
static boolean isMarkInitialState(FacesContext context)
           
static boolean isRefreshingTransientBuild(FacesContext context)
           
static boolean isRefreshTransientBuildOnPSS(FacesContext context)
           
static boolean isRefreshTransientBuildOnPSSAuto(FacesContext context)
           
static boolean isRemovingComponentBuild(FacesContext context)
           
static boolean isUsingPSSOnThisView(FacesContext context)
           
protected  void loadDecorators(FacesContext context, Compiler compiler)
          Load the various decorators for Facelets.
protected  void loadLibraries(FacesContext context, Compiler compiler)
          Load the various tag libraries for Facelets.
protected  void loadOptions(FacesContext context, Compiler compiler)
          Load the various options for Facelets compiler.
 void renderView(FacesContext context, UIViewRoot view)
          
 UIViewRoot restoreView(FacesContext context, String viewId)
          
 void retargetAttachedObjects(FacesContext context, UIComponent topLevelComponent, List<AttachedObjectHandler> handlerList)
          In short words, this method take care of "target" an "attached object".
 void retargetMethodExpressions(FacesContext context, UIComponent topLevelComponent)
           
protected  void sendSourceNotFound(FacesContext context, String message)
          
 boolean viewExists(FacesContext facesContext, String viewId)
           
 
Methods inherited from class org.apache.myfaces.shared.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 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 String DEFAULT_CHARACTER_ENCODING
See Also:
Constant Field Values

PARAM_BUFFER_SIZE

@JSFWebConfigParam(since="2.0",
                   alias="facelets.BUFFER_SIZE",
                   classType="java.lang.Integer",
                   tags="performance",
                   desc="Define the default buffer size value passed to ExternalContext.setResponseBufferResponse() and in a servlet environment to HttpServletResponse.setBufferSize()")
public static final String PARAM_BUFFER_SIZE
Define the default buffer size value passed to ExternalContext.setResponseBufferResponse() and in a servlet environment to HttpServletResponse.setBufferSize().

See Also:
Constant Field Values

PARAM_DECORATORS

@JSFWebConfigParam(since="2.0",
                   alias="facelets.DECORATORS")
public static final String PARAM_DECORATORS
Set of class names, separated by ';', implementing TagDecorator interface, used to transform a view definition in a facelet abstract syntax tree, that is used later to generate a component tree.

See Also:
Constant Field Values

PARAM_ENCODING

public static final String PARAM_ENCODING
Constant used by EncodingHandler to indicate the current encoding of the page being built, and indicate which one is the response encoding on getResponseEncoding(FacesContext, String) method.

See Also:
Constant Field Values

PARAM_LIBRARIES

@JSFWebConfigParam(since="2.0",
                   desc="Set of .taglib.xml files, separated by \';\' that should be loaded by facelet engine.",
                   alias="facelets.LIBRARIES")
public static final String PARAM_LIBRARIES
Set of .taglib.xml files, separated by ';' that should be loaded by facelet engine.

See Also:
Constant Field Values

PARAM_REFRESH_PERIOD

@JSFWebConfigParam(since="2.0",
                   defaultValue="-1",
                   alias="facelets.REFRESH_PERIOD",
                   classType="java.lang.Long",
                   tags="performance")
public static final String PARAM_REFRESH_PERIOD
Define the period used to refresh the facelet abstract syntax tree from the view definition file.

By default is infinite (no active).

See Also:
Constant Field Values

PARAM_RESOURCE_RESOLVER

@JSFWebConfigParam(since="2.0",
                   alias="facelets.RESOURCE_RESOLVER")
public static final String PARAM_RESOURCE_RESOLVER
Class implementing ResourceResolver interface used to locate facelet resources.

See Also:
Constant Field Values

PARAM_SKIP_COMMENTS

@JSFWebConfigParam(since="2.0",
                   alias="facelets.SKIP_COMMENTS")
public static final String PARAM_SKIP_COMMENTS
Skip comments found on a facelet file.

See Also:
Constant Field Values

FILLED_VIEW

public static final String FILLED_VIEW
See Also:
Constant Field Values

BUILDING_VIEW_METADATA

public static final String BUILDING_VIEW_METADATA
See Also:
Constant Field Values

REFRESHING_TRANSIENT_BUILD

public static final String REFRESHING_TRANSIENT_BUILD
See Also:
Constant Field Values

REFRESH_TRANSIENT_BUILD_ON_PSS

public static final String REFRESH_TRANSIENT_BUILD_ON_PSS
See Also:
Constant Field Values

USING_PSS_ON_THIS_VIEW

public static final String USING_PSS_ON_THIS_VIEW
See Also:
Constant Field Values

REMOVING_COMPONENTS_BUILD

public static final String REMOVING_COMPONENTS_BUILD
See Also:
Constant Field Values

MARK_INITIAL_STATE_KEY

public static final 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

IS_BUILDING_INITIAL_STATE_KEY_ALIAS

public static final String IS_BUILDING_INITIAL_STATE_KEY_ALIAS
See Also:
Constant Field Values

CLEAN_TRANSIENT_BUILD_ON_RESTORE

public static final String CLEAN_TRANSIENT_BUILD_ON_RESTORE
See Also:
Constant Field Values

CACHED_COMPONENT_IDS

public static final String CACHED_COMPONENT_IDS
Key used to cache component ids for the counter

See Also:
Constant Field Values
Constructor Detail

FaceletViewDeclarationLanguage

public FaceletViewDeclarationLanguage(FacesContext context)

FaceletViewDeclarationLanguage

public FaceletViewDeclarationLanguage(FacesContext context,
                                      ViewDeclarationLanguageStrategy strategy)
Method Detail

getId

public String getId()
Overrides:
getId in class ViewDeclarationLanguage

viewExists

public boolean viewExists(FacesContext facesContext,
                          String viewId)
Overrides:
viewExists in class ViewDeclarationLanguage

buildView

public void buildView(FacesContext context,
                      UIViewRoot view)
               throws IOException

Specified by:
buildView in class ViewDeclarationLanguage
Throws:
IOException

_publishPostBuildComponentTreeOnRestoreViewEvent

public static void _publishPostBuildComponentTreeOnRestoreViewEvent(FacesContext context,
                                                                    UIComponent component)

getComponentMetadata

public BeanInfo getComponentMetadata(FacesContext context,
                                     Resource componentResource)
retargetMethodExpressions(FacesContext, UIComponent) has some clues about the behavior of this method

Specified by:
getComponentMetadata in class ViewDeclarationLanguage

isBuildingViewMetadata

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

Parameters:
context -
Returns:

isRefreshingTransientBuild

public static boolean isRefreshingTransientBuild(FacesContext context)

isRemovingComponentBuild

public static boolean isRemovingComponentBuild(FacesContext context)

isMarkInitialState

public static boolean isMarkInitialState(FacesContext context)

isRefreshTransientBuildOnPSS

public static boolean isRefreshTransientBuildOnPSS(FacesContext context)

isRefreshTransientBuildOnPSSAuto

public static boolean isRefreshTransientBuildOnPSSAuto(FacesContext context)

isCleanTransientBuildOnRestore

public static boolean isCleanTransientBuildOnRestore(FacesContext context)

cleanTransientBuildOnRestore

public static void cleanTransientBuildOnRestore(FacesContext context)

isUsingPSSOnThisView

public static boolean isUsingPSSOnThisView(FacesContext context)

retargetAttachedObjects

public void retargetAttachedObjects(FacesContext context,
                                    UIComponent topLevelComponent,
                                    List<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 ViewDeclarationLanguage

retargetMethodExpressions

public void retargetMethodExpressions(FacesContext context,
                                      UIComponent topLevelComponent)
Overrides:
retargetMethodExpressions in class ViewDeclarationLanguage

_javaTypeToClass

public static Class _javaTypeToClass(String type)
                              throws 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:
ClassNotFoundException

getScriptComponentResource

public Resource getScriptComponentResource(FacesContext context,
                                           Resource componentResource)

Specified by:
getScriptComponentResource in class ViewDeclarationLanguage

getStateManagementStrategy

public StateManagementStrategy getStateManagementStrategy(FacesContext context,
                                                          String viewId)

Specified by:
getStateManagementStrategy in class ViewDeclarationLanguage

getViewMetadata

public ViewMetadata getViewMetadata(FacesContext context,
                                    String viewId)

Specified by:
getViewMetadata in class ViewDeclarationLanguage

renderView

public void renderView(FacesContext context,
                       UIViewRoot view)
                throws IOException

Specified by:
renderView in class ViewDeclarationLanguage
Throws:
IOException

createView

public UIViewRoot createView(FacesContext context,
                             String viewId)

Overrides:
createView in class ViewDeclarationLanguageBase

restoreView

public UIViewRoot restoreView(FacesContext context,
                              String viewId)

Overrides:
restoreView in class ViewDeclarationLanguageBase

calculateViewId

protected String calculateViewId(FacesContext context,
                                 String viewId)

Specified by:
calculateViewId in class ViewDeclarationLanguageBase

createCompiler

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

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

createFaceletFactory

protected FaceletFactory createFaceletFactory(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 ResponseWriter createResponseWriter(FacesContext context)
                                       throws IOException,
                                              FacesException
Throws:
IOException
FacesException

getDefaultSuffix

@Deprecated
protected String getDefaultSuffix(FacesContext context)
                           throws FacesException
Deprecated. this code is not used anymore

Throws:
FacesException

getRenderedViewId

@Deprecated
protected String getRenderedViewId(FacesContext context,
                                              String actionId)
Deprecated. 


getResponseContentType

protected String getResponseContentType(FacesContext context,
                                        String orig)
Generate the content type

Parameters:
context -
orig -
Returns:

getResponseEncoding

protected String getResponseEncoding(FacesContext context,
                                     String orig)
Generate the encoding

Parameters:
context -
orig -
Returns:

handleFaceletNotFound

protected void handleFaceletNotFound(FacesContext context,
                                     String viewId)
                              throws FacesException,
                                     IOException
Throws:
FacesException
IOException

handleRenderException

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

initialize

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


loadDecorators

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

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

loadLibraries

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

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

loadOptions

protected void loadOptions(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(FacesContext context,
                                  String message)

Specified by:
sendSourceNotFound in class ViewDeclarationLanguageBase


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