org.apache.myfaces.view.facelets
Class FaceletCompositionContext

java.lang.Object
  extended by org.apache.myfaces.view.facelets.FaceletCompositionContext
Direct Known Subclasses:
FaceletCompositionContextImpl

public abstract class FaceletCompositionContext
extends Object

Since:
2.0.1
Version:
$Revision: 1424976 $ $Date: 2012-12-21 10:41:52 -0500 (Fri, 21 Dec 2012) $
Author:
Leonardo Uribe (latest modification by $Author: lu4242 $)

Field Summary
protected static String FACELET_COMPOSITION_CONTEXT_KEY
           
 
Constructor Summary
protected FaceletCompositionContext()
           
 
Method Summary
abstract  void addAttachedObjectHandler(UIComponent compositeComponentParent, AttachedObjectHandler handler)
          Add to the composite component parent this handler, so it will be processed later when ViewDeclarationLanguage.retargetAttachedObjects is called.
abstract  void addMethodExpressionTargeted(UIComponent targetedComponent, String attributeName, Object backingValue)
          Add a method expression as targeted for the provided composite component
 void addUniqueId(String uniqueId)
          Add an unique id to the list if recording is enabled, if recording is not enabled it has no effect.
abstract  void clearMethodExpressionAttribute(UIComponent compositeComponentParent, String attributeName)
          Clear the MethodExpression attribute to call vdl.retargetMethodExpression again
abstract  boolean containsEnclosingValidatorId(String id)
           
 void endComponentUniqueIdSection()
          Ends the current unique id section, so the previous counter will be used to generate unique ids to components.
 void endMetadataSection()
          Call this method to indicate f:metadata section has been already processed since 2.1.7, 2.0.13
abstract  void finalizeForDeletion(UIComponent component)
          Used in conjunction with markForDeletion where any UIComponent marked will be removed.
 void finalizeRelocatableResourcesForDeletion(UIViewRoot root)
          Used to clean up all unused relocatable components on the root component.
 String generateUniqueComponentId()
          Generate a unique id for component instances.
 String generateUniqueId()
          Generate a unique id that will be used later to derive a unique id per tag by FaceletContext.generateUniqueId().
 void generateUniqueId(StringBuilder builderToAdd)
           
abstract  List<AttachedObjectHandler> getAttachedObjectHandlers(UIComponent compositeComponentParent)
          Retrieve the list of object handlers attached to a composite component parent.
abstract  UIComponent getCompositeComponentFromStack()
          Return the composite component being applied on the current facelet.
 int getCompositeComponentLevel()
          Returns the current nesting level of composite components found.
static FaceletCompositionContext getCurrentInstance()
           
static FaceletCompositionContext getCurrentInstance(FaceletContext ctx)
           
static FaceletCompositionContext getCurrentInstance(FacesContext ctx)
           
 ELExpressionCacheMode getELExpressionCacheMode()
          Indicates if a EL Expression can be or not cached by facelets vdl.
abstract  Iterator<String> getEnclosingValidatorIds()
          Deprecated. 
abstract  Iterator<Map.Entry<String,EditableValueHolderAttachedObjectHandler>> getEnclosingValidatorIdsAndHandlers()
          Gets all validationIds with its associated EditableValueHolderAttachedObjectHandler from the stack.
abstract  Iterator<String> getExcludedValidatorIds()
          Deprecated. 
abstract  FaceletFactory getFaceletFactory()
           
abstract  String getFirstValidationGroupFromStack()
          Deprecated. 
 StringBuilder getSharedStringBuilder()
           
 String getUniqueIdFromIterator()
          Return the unique id from the iterator if applies since 2.1.7, 2.0.13
 List<String> getUniqueIdList()
          Return the list of unique ids since 2.1.7, 2.0.13
abstract  UniqueIdVendor getUniqueIdVendorFromStack()
          Return the latest UniqueIdVendor created from stack.
 void incrementUniqueComponentId()
           
 void incrementUniqueId()
          Increment the unique id without construct it.
 void init(FacesContext facesContext)
           
 void initUniqueIdRecording()
          Activater record unique id mode, so an structure will be used to hold those values.
 boolean isBuildingViewMetadata()
          Check if the facelet is building view metadata since 2.1.7, 2.0.13
 boolean isInMetadataSection()
          Check if the component is created inside f:metadata section since 2.1.7, 2.0.13
abstract  boolean isMarkInitialState()
          Check if this build should be marked as initial state.
abstract  boolean isMarkInitialStateAndIsRefreshTransientBuildOnPSS()
           
abstract  boolean isMethodExpressionAttributeApplied(UIComponent compositeComponentParent, String attributeName)
          Check if the MethodExpression attribute has been applied using vdl.retargetMethodExpression
 boolean isRefreshingSection()
          Check if the section to be processed is being refreshed.
abstract  boolean isRefreshingTransientBuild()
          Check if this build is being refreshed, adding transient components and adding/removing components under c:if or c:forEach or not.
abstract  boolean isRefreshTransientBuildOnPSS()
          Check if the current view will be refreshed with partial state saving.
 boolean isRefreshTransientBuildOnPSSPreserveState()
           
abstract  boolean isUsingPSSOnThisView()
          Check if we are using partial state saving on this view
 boolean isWrapTagExceptionsAsContextAware()
           
abstract  void markForDeletion(UIComponent component)
          Marks all direct children and Facets with an attribute for deletion.
abstract  void markMethodExpressionAttribute(UIComponent compositeComponentParent, String attributeName)
          Mark the MethodExpression attribute as applied using vdl.retargetMethodExpression
 void markRelocatableResourceForDeletion(UIComponent component)
          Marks the given resource for deletion.
abstract  void popCompositeComponentToStack()
           
abstract  void popEnclosingValidatorIdToStack()
          Removes top of stack.
abstract  void popExcludedValidatorIdToStack()
          Deprecated. 
abstract  void popUniqueIdVendorToStack()
           
abstract  void popValidationGroupsToStack()
          Deprecated. 
abstract  void pushCompositeComponentToStack(UIComponent parent)
           
abstract  void pushEnclosingValidatorIdToStack(String validatorId)
          Deprecated. 
abstract  void pushEnclosingValidatorIdToStack(String validatorId, EditableValueHolderAttachedObjectHandler attachedObjectHandler)
          Pushes validatorId to the stack of all enclosing validatorIds.
abstract  void pushExcludedValidatorIdToStack(String validatorId)
          Deprecated. 
abstract  void pushUniqueIdVendorToStack(UniqueIdVendor parent)
           
abstract  void pushValidationGroupsToStack(String validationGroups)
          Deprecated. 
 void release(FacesContext facesContext)
          Releases the MyFaceletContext object.
abstract  void removeAttachedObjectHandlers(UIComponent compositeComponentParent)
          Remove from the composite component parent the list of attached handlers.
 void removeComponentForDeletion(UIComponent component)
           
abstract  Object removeMethodExpressionTargeted(UIComponent targetedComponent, String attributeName)
          Remove a method expression as targeted for the provided composite component
 void setMarkInitialState(boolean value)
           
 void setUniqueIdsIterator(Iterator<String> uniqueIdsIterator)
          Set the iterator used to retrieve unique ids.
 String startComponentUniqueIdSection()
          Start a new unique id section, which means a new counter is used to generate unique ids to components
 void startMetadataSection()
          Call this method to indicate a f:metadata section is about to be processed since 2.1.7, 2.0.13
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FACELET_COMPOSITION_CONTEXT_KEY

protected static final String FACELET_COMPOSITION_CONTEXT_KEY
See Also:
Constant Field Values
Constructor Detail

FaceletCompositionContext

protected FaceletCompositionContext()
Method Detail

getCurrentInstance

public static FaceletCompositionContext getCurrentInstance()

getCurrentInstance

public static FaceletCompositionContext getCurrentInstance(FaceletContext ctx)

getCurrentInstance

public static FaceletCompositionContext getCurrentInstance(FacesContext ctx)

init

public void init(FacesContext facesContext)

release

public void release(FacesContext facesContext)
Releases the MyFaceletContext object. This method must only be called by the code that created the MyFaceletContext.


getFaceletFactory

public abstract FaceletFactory getFaceletFactory()

getCompositeComponentFromStack

public abstract UIComponent getCompositeComponentFromStack()
Return the composite component being applied on the current facelet. Note this is different to UIComponent.getCurrentCompositeComponent, because a composite component is added to the stack each time a composite:implementation tag handler is applied. This could be used by InsertChildrenHandler and InsertFacetHandler to retrieve the current composite component to be applied.

Returns:
Since:
2.0.1

pushCompositeComponentToStack

public abstract void pushCompositeComponentToStack(UIComponent parent)
Parameters:
parent -
Since:
2.0.1

popCompositeComponentToStack

public abstract void popCompositeComponentToStack()
Since:
2.0.1

getUniqueIdVendorFromStack

public abstract UniqueIdVendor getUniqueIdVendorFromStack()
Return the latest UniqueIdVendor created from stack. The reason why we need to keep a UniqueIdVendor stack is because we need to look the closest one in ComponentTagHandlerDelegate. Note that facelets tree is built from leafs to root, that means use UIComponent.getParent() does not always return parent components.

Returns:
Since:
2.0.1

pushUniqueIdVendorToStack

public abstract void pushUniqueIdVendorToStack(UniqueIdVendor parent)
Parameters:
parent -
Since:
2.0.1

popUniqueIdVendorToStack

public abstract void popUniqueIdVendorToStack()
Since:
2.0.1

getFirstValidationGroupFromStack

@Deprecated
public abstract String getFirstValidationGroupFromStack()
Deprecated. 

Gets the top of the validationGroups stack.

Returns:
Since:
2.0.1

popValidationGroupsToStack

@Deprecated
public abstract void popValidationGroupsToStack()
Deprecated. 

Removes top of stack.

Since:
2.0.1

pushValidationGroupsToStack

@Deprecated
public abstract void pushValidationGroupsToStack(String validationGroups)
Deprecated. 

Pushes validationGroups to the stack.

Parameters:
validationGroups -
Since:
2.0.1

getExcludedValidatorIds

@Deprecated
public abstract Iterator<String> getExcludedValidatorIds()
Deprecated. 

Gets all validationIds on the stack.

Returns:
Since:
2.0.1

popExcludedValidatorIdToStack

@Deprecated
public abstract void popExcludedValidatorIdToStack()
Deprecated. 

Removes top of stack.

Since:
2.0.1

pushExcludedValidatorIdToStack

@Deprecated
public abstract void pushExcludedValidatorIdToStack(String validatorId)
Deprecated. 

Pushes validatorId to the stack of excluded validatorIds.

Parameters:
validatorId -
Since:
2.0.1

getEnclosingValidatorIds

@Deprecated
public abstract Iterator<String> getEnclosingValidatorIds()
Deprecated. 

Gets all validationIds on the stack.

Returns:
Since:
2.0.1

popEnclosingValidatorIdToStack

public abstract void popEnclosingValidatorIdToStack()
Removes top of stack.

Since:
2.0.1

pushEnclosingValidatorIdToStack

@Deprecated
public abstract void pushEnclosingValidatorIdToStack(String validatorId)
Deprecated. 

Pushes validatorId to the stack of all enclosing validatorIds.

Parameters:
validatorId -
Since:
2.0.1

pushEnclosingValidatorIdToStack

public abstract void pushEnclosingValidatorIdToStack(String validatorId,
                                                     EditableValueHolderAttachedObjectHandler attachedObjectHandler)
Pushes validatorId to the stack of all enclosing validatorIds.

Parameters:
validatorId -
attachedObjectHandler -
Since:
2.0.10

getEnclosingValidatorIdsAndHandlers

public abstract Iterator<Map.Entry<String,EditableValueHolderAttachedObjectHandler>> getEnclosingValidatorIdsAndHandlers()
Gets all validationIds with its associated EditableValueHolderAttachedObjectHandler from the stack.

Returns:
Since:
2.0.10

containsEnclosingValidatorId

public abstract boolean containsEnclosingValidatorId(String id)
Parameters:
id -
Returns:
Since:
2.0.10

isRefreshingTransientBuild

public abstract boolean isRefreshingTransientBuild()
Check if this build is being refreshed, adding transient components and adding/removing components under c:if or c:forEach or not.

Returns:
Since:
2.0.1

isMarkInitialState

public abstract boolean isMarkInitialState()
Check if this build should be marked as initial state. In other words, all components must call UIComponent.markInitialState.

Returns:
Since:
2.0.1

setMarkInitialState

public void setMarkInitialState(boolean value)

isRefreshTransientBuildOnPSS

public abstract boolean isRefreshTransientBuildOnPSS()
Check if the current view will be refreshed with partial state saving. This param is used in two posible events: 1. To notify UIInstruction instances to look for instances moved by cc:insertChildren or cc:insertFacet. 2. To do proper actions when a tag that could change tree structure is applied (c:if, c:forEach...)

Returns:
Since:
2.0.1

isRefreshTransientBuildOnPSSPreserveState

public boolean isRefreshTransientBuildOnPSSPreserveState()
Returns:
Since:
2.0.12, 2.1.6

isUsingPSSOnThisView

public abstract boolean isUsingPSSOnThisView()
Check if we are using partial state saving on this view

Returns:
Since:
2.0.1

isMarkInitialStateAndIsRefreshTransientBuildOnPSS

public abstract boolean isMarkInitialStateAndIsRefreshTransientBuildOnPSS()
Returns:
Since:
2.0.1

addAttachedObjectHandler

public abstract void addAttachedObjectHandler(UIComponent compositeComponentParent,
                                              AttachedObjectHandler handler)
Add to the composite component parent this handler, so it will be processed later when ViewDeclarationLanguage.retargetAttachedObjects is called. Tag Handlers exposing attached objects should call this method to expose them when the parent to be applied is a composite components.

Parameters:
compositeComponentParent -
handler -
Since:
2.0.2

removeAttachedObjectHandlers

public abstract void removeAttachedObjectHandlers(UIComponent compositeComponentParent)
Remove from the composite component parent the list of attached handlers.

Parameters:
compositeComponentParent -
Since:
2.0.2

getAttachedObjectHandlers

public abstract List<AttachedObjectHandler> getAttachedObjectHandlers(UIComponent compositeComponentParent)
Retrieve the list of object handlers attached to a composite component parent.

Parameters:
compositeComponentParent -
Since:
2.0.2

markForDeletion

public abstract void markForDeletion(UIComponent component)
Marks all direct children and Facets with an attribute for deletion.

Parameters:
component - UIComponent to mark
Since:
2.0.2
See Also:
finalizeForDeletion(UIComponent)

finalizeForDeletion

public abstract void finalizeForDeletion(UIComponent component)
Used in conjunction with markForDeletion where any UIComponent marked will be removed.

Parameters:
component - UIComponent to finalize
Since:
2.0.2

removeComponentForDeletion

public void removeComponentForDeletion(UIComponent component)

markRelocatableResourceForDeletion

public void markRelocatableResourceForDeletion(UIComponent component)
Marks the given resource for deletion. Is to be used for relocatable components instead of markForDeletion(UIComponent).

Parameters:
component - UIComponent to finalize
Since:
2.0.17 2.1.11

finalizeRelocatableResourcesForDeletion

public void finalizeRelocatableResourcesForDeletion(UIViewRoot root)
Used to clean up all unused relocatable components on the root component.

Parameters:
component - UIComponent to finalize (root component)
Since:
2.0.17 2.1.11

addMethodExpressionTargeted

public abstract void addMethodExpressionTargeted(UIComponent targetedComponent,
                                                 String attributeName,
                                                 Object backingValue)
Add a method expression as targeted for the provided composite component

Parameters:
targetedComponent -
attributeName -
backingValue - A value that could be useful to revert its effects.
Since:
2.0.3

isMethodExpressionAttributeApplied

public abstract boolean isMethodExpressionAttributeApplied(UIComponent compositeComponentParent,
                                                           String attributeName)
Check if the MethodExpression attribute has been applied using vdl.retargetMethodExpression

Parameters:
compositeComponentParent -
attributeName -
Returns:
Since:
2.0.3

markMethodExpressionAttribute

public abstract void markMethodExpressionAttribute(UIComponent compositeComponentParent,
                                                   String attributeName)
Mark the MethodExpression attribute as applied using vdl.retargetMethodExpression

Parameters:
compositeComponentParent -
attributeName -
Since:
2.0.3

clearMethodExpressionAttribute

public abstract void clearMethodExpressionAttribute(UIComponent compositeComponentParent,
                                                    String attributeName)
Clear the MethodExpression attribute to call vdl.retargetMethodExpression again

Parameters:
compositeComponentParent -
attributeName -
Since:
2.0.3

removeMethodExpressionTargeted

public abstract Object removeMethodExpressionTargeted(UIComponent targetedComponent,
                                                      String attributeName)
Remove a method expression as targeted for the provided composite component

Parameters:
targetedComponent -
attributeName -
Returns:
A value that could be useful to revert its effects.
Since:
2.0.3

getELExpressionCacheMode

public ELExpressionCacheMode getELExpressionCacheMode()
Indicates if a EL Expression can be or not cached by facelets vdl.

Returns:
Since:
2.0.8

isWrapTagExceptionsAsContextAware

public boolean isWrapTagExceptionsAsContextAware()
Returns:
Since:
2.0.9

startComponentUniqueIdSection

public String startComponentUniqueIdSection()
Start a new unique id section, which means a new counter is used to generate unique ids to components

Returns:
Since:
2.0.10, 2.1.4

generateUniqueId

public String generateUniqueId()
Generate a unique id that will be used later to derive a unique id per tag by FaceletContext.generateUniqueId(). This generator ensures uniqueness per view but FaceletContext.generateUniqueId() ensures uniqueness per view and per facelet hierarchy, so different included facelets will generate different ids.

Returns:

generateUniqueId

public void generateUniqueId(StringBuilder builderToAdd)

generateUniqueComponentId

public String generateUniqueComponentId()
Generate a unique id for component instances.

Returns:

endComponentUniqueIdSection

public void endComponentUniqueIdSection()
Ends the current unique id section, so the previous counter will be used to generate unique ids to components.


setUniqueIdsIterator

public void setUniqueIdsIterator(Iterator<String> uniqueIdsIterator)
Set the iterator used to retrieve unique ids. since 2.1.7, 2.0.13

Parameters:
uniqueIdsIterator -

initUniqueIdRecording

public void initUniqueIdRecording()
Activater record unique id mode, so an structure will be used to hold those values. since 2.1.7, 2.0.13


addUniqueId

public void addUniqueId(String uniqueId)
Add an unique id to the list if recording is enabled, if recording is not enabled it has no effect. since 2.1.7, 2.0.13

Parameters:
uniqueId -

getUniqueIdFromIterator

public String getUniqueIdFromIterator()
Return the unique id from the iterator if applies since 2.1.7, 2.0.13

Returns:

getUniqueIdList

public List<String> getUniqueIdList()
Return the list of unique ids since 2.1.7, 2.0.13

Returns:

incrementUniqueId

public void incrementUniqueId()
Increment the unique id without construct it. since 2.1.7, 2.0.13


isBuildingViewMetadata

public boolean isBuildingViewMetadata()
Check if the facelet is building view metadata since 2.1.7, 2.0.13

Returns:

startMetadataSection

public void startMetadataSection()
Call this method to indicate a f:metadata section is about to be processed since 2.1.7, 2.0.13


endMetadataSection

public void endMetadataSection()
Call this method to indicate f:metadata section has been already processed since 2.1.7, 2.0.13


isInMetadataSection

public boolean isInMetadataSection()
Check if the component is created inside f:metadata section since 2.1.7, 2.0.13

Returns:

isRefreshingSection

public boolean isRefreshingSection()
Check if the section to be processed is being refreshed. since 2.1.7, 2.0.13

Returns:

incrementUniqueComponentId

public void incrementUniqueComponentId()
Since:
2.1.8, 2.0.14

getSharedStringBuilder

public StringBuilder getSharedStringBuilder()

getCompositeComponentLevel

public int getCompositeComponentLevel()
Returns the current nesting level of composite components found. If no composite component has been used returns 0.

Since:
2.1.9, 2.0.15


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