Package org.apache.myfaces.view.facelets
Class FaceletCompositionContext
- java.lang.Object
- 
- org.apache.myfaces.view.facelets.FaceletCompositionContext
 
- 
- Direct Known Subclasses:
- FaceletCompositionContextImpl
 
 public abstract class FaceletCompositionContext extends Object - Since:
- 2.0.1
- Version:
- $Revision$ $Date$
- Author:
- Leonardo Uribe (latest modification by $Author$)
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected static StringFACELET_COMPOSITION_CONTEXT_KEY
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedFaceletCompositionContext()
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidaddAttachedObjectHandler(UIComponent compositeComponentParent, AttachedObjectHandler handler)Add to the composite component parent this handler, so it will be processed later when ViewDeclarationLanguage.retargetAttachedObjects is called.abstract voidaddMethodExpressionTargeted(UIComponent targetedComponent, String attributeName, Object backingValue)Add a method expression as targeted for the provided composite componentvoidaddUniqueId(String uniqueId)Add an unique id to the list if recording is enabled, if recording is not enabled it has no effect.abstract voidclearMethodExpressionAttribute(UIComponent compositeComponentParent, String attributeName)Clear the MethodExpression attribute to call vdl.retargetMethodExpression againabstract booleancontainsEnclosingValidatorId(String id)voidendComponentUniqueIdSection()Ends the current unique id section, so the previous counter will be used to generate unique ids to components.voidendComponentUniqueIdSection(String base)voidendMetadataSection()Call this method to indicate f:metadata section has been already processed since 2.1.7, 2.0.13abstract voidfinalizeForDeletion(UIComponent component)Used in conjunction with markForDeletion where any UIComponent marked will be removed.voidfinalizeRelocatableResourcesForDeletion(UIViewRoot root)Used to clean up all unused relocatable components on the root component.StringgenerateUniqueComponentId()Generate a unique id for component instances.StringgenerateUniqueId()Generate a unique id that will be used later to derive a unique id per tag by FaceletContext.generateUniqueId().voidgenerateUniqueId(StringBuilder builderToAdd)abstract List<AttachedObjectHandler>getAttachedObjectHandlers(UIComponent compositeComponentParent)Retrieve the list of object handlers attached to a composite component parent.abstract UIComponentgetCompositeComponentFromStack()Return the composite component being applied on the current facelet.intgetCompositeComponentLevel()Returns the current nesting level of composite components found.static FaceletCompositionContextgetCurrentInstance()static FaceletCompositionContextgetCurrentInstance(FacesContext ctx)static FaceletCompositionContextgetCurrentInstance(FaceletContext ctx)ELExpressionCacheModegetELExpressionCacheMode()Indicates if a EL Expression can be or not cached by facelets vdl.abstract Iterator<Map.Entry<String,EditableValueHolderAttachedObjectHandler>>getEnclosingValidatorIdsAndHandlers()Gets all validationIds with its associated EditableValueHolderAttachedObjectHandler from the stack.abstract FaceletFactorygetFaceletFactory()StringBuildergetSharedStringBuilder()StringgetUniqueIdFromIterator()Return the unique id from the iterator if applies since 2.1.7, 2.0.13List<String>getUniqueIdList()Return the list of unique ids since 2.1.7, 2.0.13abstract UniqueIdVendorgetUniqueIdVendorFromStack()Return the latest UniqueIdVendor created from stack.UIViewRootgetViewRoot(FacesContext facesContext)VisitContextFactorygetVisitContextFactory()voidincrementUniqueComponentId()voidincrementUniqueId()Increment the unique id without construct it.voidinit(FacesContext facesContext)voidinitUniqueIdRecording()Activater record unique id mode, so an structure will be used to hold those values.booleanisBuildingViewMetadata()Check if the facelet is building view metadata since 2.1.7, 2.0.13booleanisDynamicComponentSection()Indicate if the current facelet section is a dynamic component section, which means it was added to the component tree using vdl.createComponent(...);booleanisDynamicComponentTopLevel()Check if the algorithm is applying a dynamic component and the current component is the top level one.booleanisDynamicCompositeComponentHandler()booleanisInMetadataSection()Check if the component is created inside f:metadata section since 2.1.7, 2.0.13abstract booleanisMarkInitialState()Check if this build should be marked as initial state.abstract booleanisMarkInitialStateAndIsRefreshTransientBuildOnPSS()abstract booleanisMethodExpressionAttributeApplied(UIComponent compositeComponentParent, String attributeName)Check if the MethodExpression attribute has been applied using vdl.retargetMethodExpressionbooleanisRefreshingSection()Check if the section to be processed is being refreshed.abstract booleanisRefreshingTransientBuild()Check if this build is being refreshed, adding transient components and adding/removing components under c:if or c:forEach or not.abstract booleanisRefreshTransientBuildOnPSS()Check if the current view will be refreshed with partial state saving.booleanisRefreshTransientBuildOnPSSPreserveState()abstract booleanisUsingPSSOnThisView()Check if we are using partial state saving on this viewbooleanisWrapTagExceptionsAsContextAware()abstract voidmarkForDeletion(UIComponent component)Marks all direct children and Facets with an attribute for deletion.abstract voidmarkMethodExpressionAttribute(UIComponent compositeComponentParent, String attributeName)Mark the MethodExpression attribute as applied using vdl.retargetMethodExpressionvoidmarkRelocatableResourceForDeletion(UIComponent component)Marks the given resource for deletion.abstract voidpopCompositeComponentToStack()voidpopDynamicComponentSection()abstract voidpopEnclosingValidatorIdToStack()Removes top of stack.abstract voidpopUniqueIdVendorToStack()abstract voidpushCompositeComponentToStack(UIComponent parent)voidpushDynamicComponentSection(String baseKey)abstract voidpushEnclosingValidatorIdToStack(String validatorId, EditableValueHolderAttachedObjectHandler attachedObjectHandler)Pushes validatorId to the stack of all enclosing validatorIds.abstract voidpushUniqueIdVendorToStack(UniqueIdVendor parent)voidrelease(FacesContext facesContext)Releases the MyFaceletContext object.abstract voidremoveAttachedObjectHandlers(UIComponent compositeComponentParent)Remove from the composite component parent the list of attached handlers.voidremoveComponentForDeletion(UIComponent component)abstract ObjectremoveMethodExpressionTargeted(UIComponent targetedComponent, String attributeName)Remove a method expression as targeted for the provided composite componentvoidsetDynamicComponentTopLevel(boolean value)voidsetDynamicCompositeComponentHandler(boolean value)voidsetMarkInitialState(boolean value)voidsetUniqueIdsIterator(Iterator<String> uniqueIdsIterator)Set the iterator used to retrieve unique ids.voidsetViewRoot(UIViewRoot root)StringstartComponentUniqueIdSection()Start a new unique id section, which means a new counter is used to generate unique ids to componentsStringstartComponentUniqueIdSection(String base)Start a new unique id section, which means a new counter is used to generate unique ids to components, but appending a base to the new counter.voidstartMetadataSection()Call this method to indicate a f:metadata section is about to be processed since 2.1.7, 2.0.13
 
- 
- 
- 
Field Detail- 
FACELET_COMPOSITION_CONTEXT_KEYprotected static final String FACELET_COMPOSITION_CONTEXT_KEY - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
getCurrentInstancepublic static FaceletCompositionContext getCurrentInstance() 
 - 
getCurrentInstancepublic static FaceletCompositionContext getCurrentInstance(FaceletContext ctx) 
 - 
getCurrentInstancepublic static FaceletCompositionContext getCurrentInstance(FacesContext ctx) 
 - 
initpublic void init(FacesContext facesContext) 
 - 
releasepublic void release(FacesContext facesContext) Releases the MyFaceletContext object. This method must only be called by the code that created the MyFaceletContext.
 - 
getFaceletFactorypublic abstract FaceletFactory getFaceletFactory() 
 - 
getCompositeComponentFromStackpublic 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
 
 - 
pushCompositeComponentToStackpublic abstract void pushCompositeComponentToStack(UIComponent parent) - Parameters:
- parent-
- Since:
- 2.0.1
 
 - 
popCompositeComponentToStackpublic abstract void popCompositeComponentToStack() - Since:
- 2.0.1
 
 - 
getUniqueIdVendorFromStackpublic 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
 
 - 
pushUniqueIdVendorToStackpublic abstract void pushUniqueIdVendorToStack(UniqueIdVendor parent) - Parameters:
- parent-
- Since:
- 2.0.1
 
 - 
popUniqueIdVendorToStackpublic abstract void popUniqueIdVendorToStack() - Since:
- 2.0.1
 
 - 
popEnclosingValidatorIdToStackpublic abstract void popEnclosingValidatorIdToStack() Removes top of stack.- Since:
- 2.0.1
 
 - 
pushEnclosingValidatorIdToStackpublic abstract void pushEnclosingValidatorIdToStack(String validatorId, EditableValueHolderAttachedObjectHandler attachedObjectHandler) Pushes validatorId to the stack of all enclosing validatorIds.- Parameters:
- validatorId-
- attachedObjectHandler-
- Since:
- 2.0.10
 
 - 
getEnclosingValidatorIdsAndHandlerspublic abstract Iterator<Map.Entry<String,EditableValueHolderAttachedObjectHandler>> getEnclosingValidatorIdsAndHandlers() Gets all validationIds with its associated EditableValueHolderAttachedObjectHandler from the stack.- Returns:
- Since:
- 2.0.10
 
 - 
containsEnclosingValidatorIdpublic abstract boolean containsEnclosingValidatorId(String id) - Parameters:
- id-
- Returns:
- Since:
- 2.0.10
 
 - 
isRefreshingTransientBuildpublic 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
 
 - 
isMarkInitialStatepublic 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
 
 - 
setMarkInitialStatepublic void setMarkInitialState(boolean value) 
 - 
isRefreshTransientBuildOnPSSpublic 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
 
 - 
isRefreshTransientBuildOnPSSPreserveStatepublic boolean isRefreshTransientBuildOnPSSPreserveState() - Returns:
- Since:
- 2.0.12, 2.1.6
 
 - 
isUsingPSSOnThisViewpublic abstract boolean isUsingPSSOnThisView() Check if we are using partial state saving on this view- Returns:
- Since:
- 2.0.1
 
 - 
isMarkInitialStateAndIsRefreshTransientBuildOnPSSpublic abstract boolean isMarkInitialStateAndIsRefreshTransientBuildOnPSS() - Returns:
- Since:
- 2.0.1
 
 - 
addAttachedObjectHandlerpublic 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
 
 - 
removeAttachedObjectHandlerspublic abstract void removeAttachedObjectHandlers(UIComponent compositeComponentParent) Remove from the composite component parent the list of attached handlers.- Parameters:
- compositeComponentParent-
- Since:
- 2.0.2
 
 - 
getAttachedObjectHandlerspublic abstract List<AttachedObjectHandler> getAttachedObjectHandlers(UIComponent compositeComponentParent) Retrieve the list of object handlers attached to a composite component parent.- Parameters:
- compositeComponentParent-
- Since:
- 2.0.2
 
 - 
markForDeletionpublic 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)
 
 - 
finalizeForDeletionpublic 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
 
 - 
removeComponentForDeletionpublic void removeComponentForDeletion(UIComponent component) 
 - 
markRelocatableResourceForDeletionpublic void markRelocatableResourceForDeletion(UIComponent component) Marks the given resource for deletion. Is to be used for relocatable components instead ofmarkForDeletion(UIComponent).- Parameters:
- component- UIComponent to finalize
- Since:
- 2.0.17 2.1.11
 
 - 
finalizeRelocatableResourcesForDeletionpublic void finalizeRelocatableResourcesForDeletion(UIViewRoot root) Used to clean up all unused relocatable components on the root component.- Parameters:
- root- UIComponent to finalize (root component)
- Since:
- 2.0.17 2.1.11
 
 - 
addMethodExpressionTargetedpublic 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
 
 - 
isMethodExpressionAttributeAppliedpublic 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
 
 - 
markMethodExpressionAttributepublic abstract void markMethodExpressionAttribute(UIComponent compositeComponentParent, String attributeName) Mark the MethodExpression attribute as applied using vdl.retargetMethodExpression- Parameters:
- compositeComponentParent-
- attributeName-
- Since:
- 2.0.3
 
 - 
clearMethodExpressionAttributepublic abstract void clearMethodExpressionAttribute(UIComponent compositeComponentParent, String attributeName) Clear the MethodExpression attribute to call vdl.retargetMethodExpression again- Parameters:
- compositeComponentParent-
- attributeName-
- Since:
- 2.0.3
 
 - 
removeMethodExpressionTargetedpublic 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
 
 - 
getELExpressionCacheModepublic ELExpressionCacheMode getELExpressionCacheMode() Indicates if a EL Expression can be or not cached by facelets vdl.- Returns:
- Since:
- 2.0.8
 
 - 
isWrapTagExceptionsAsContextAwarepublic boolean isWrapTagExceptionsAsContextAware() - Returns:
- Since:
- 2.0.9
 
 - 
startComponentUniqueIdSectionpublic 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
 
 - 
startComponentUniqueIdSectionpublic String startComponentUniqueIdSection(String base) Start a new unique id section, which means a new counter is used to generate unique ids to components, but appending a base to the new counter.- Returns:
- Since:
- 2.2.0
 
 - 
endComponentUniqueIdSectionpublic void endComponentUniqueIdSection(String base) - Parameters:
- base-
- Since:
- 2.2.0
 
 - 
generateUniqueIdpublic 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:
 
 - 
generateUniqueIdpublic void generateUniqueId(StringBuilder builderToAdd) 
 - 
generateUniqueComponentIdpublic String generateUniqueComponentId() Generate a unique id for component instances.- Returns:
 
 - 
endComponentUniqueIdSectionpublic void endComponentUniqueIdSection() Ends the current unique id section, so the previous counter will be used to generate unique ids to components.
 - 
setUniqueIdsIteratorpublic void setUniqueIdsIterator(Iterator<String> uniqueIdsIterator) Set the iterator used to retrieve unique ids. since 2.1.7, 2.0.13- Parameters:
- uniqueIdsIterator-
 
 - 
initUniqueIdRecordingpublic void initUniqueIdRecording() Activater record unique id mode, so an structure will be used to hold those values. since 2.1.7, 2.0.13
 - 
addUniqueIdpublic 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-
 
 - 
getUniqueIdFromIteratorpublic String getUniqueIdFromIterator() Return the unique id from the iterator if applies since 2.1.7, 2.0.13- Returns:
 
 - 
getUniqueIdListpublic List<String> getUniqueIdList() Return the list of unique ids since 2.1.7, 2.0.13- Returns:
 
 - 
incrementUniqueIdpublic void incrementUniqueId() Increment the unique id without construct it. since 2.1.7, 2.0.13
 - 
isBuildingViewMetadatapublic boolean isBuildingViewMetadata() Check if the facelet is building view metadata since 2.1.7, 2.0.13- Returns:
 
 - 
startMetadataSectionpublic void startMetadataSection() Call this method to indicate a f:metadata section is about to be processed since 2.1.7, 2.0.13
 - 
endMetadataSectionpublic void endMetadataSection() Call this method to indicate f:metadata section has been already processed since 2.1.7, 2.0.13
 - 
isInMetadataSectionpublic boolean isInMetadataSection() Check if the component is created inside f:metadata section since 2.1.7, 2.0.13- Returns:
 
 - 
isRefreshingSectionpublic boolean isRefreshingSection() Check if the section to be processed is being refreshed. since 2.1.7, 2.0.13- Returns:
 
 - 
incrementUniqueComponentIdpublic void incrementUniqueComponentId() - Since:
- 2.1.8, 2.0.14
 
 - 
getSharedStringBuilderpublic StringBuilder getSharedStringBuilder() 
 - 
getCompositeComponentLevelpublic 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
 
 - 
isDynamicCompositeComponentHandlerpublic boolean isDynamicCompositeComponentHandler() 
 - 
setDynamicCompositeComponentHandlerpublic void setDynamicCompositeComponentHandler(boolean value) 
 - 
pushDynamicComponentSectionpublic void pushDynamicComponentSection(String baseKey) 
 - 
popDynamicComponentSectionpublic void popDynamicComponentSection() 
 - 
isDynamicComponentTopLevelpublic boolean isDynamicComponentTopLevel() Check if the algorithm is applying a dynamic component and the current component is the top level one. This is necessary to avoid remove/add the component under a refresh and in that way change the position of the component in the tree. Remember facelets algorithm removes/add components to sort the components under a refresh, but in this case, it is up to the user to put the component in the tree, so the idea is do not make interference with the user's code. Note if the dynamic content is wrapped by a generated panel, the top level component is the wrapper itself, which has no attached tag handler.- Returns:
- Since:
- 2.2
 
 - 
setDynamicComponentTopLevelpublic void setDynamicComponentTopLevel(boolean value) 
 - 
isDynamicComponentSectionpublic boolean isDynamicComponentSection() Indicate if the current facelet section is a dynamic component section, which means it was added to the component tree using vdl.createComponent(...);- Returns:
- Since:
- 2.2
 
 - 
getViewRootpublic UIViewRoot getViewRoot(FacesContext facesContext) 
 - 
setViewRootpublic void setViewRoot(UIViewRoot root) 
 - 
getVisitContextFactorypublic VisitContextFactory getVisitContextFactory() 
 
- 
 
-