Package org.apache.myfaces.view.facelets
Class FaceletCompositionContext
java.lang.Object
org.apache.myfaces.view.facelets.FaceletCompositionContext
- Direct Known Subclasses:
- FaceletCompositionContextImpl
- Since:
- 2.0.1
- Version:
- $Revision$ $Date$
- Author:
- Leonardo Uribe (latest modification by $Author$)
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionabstract 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 booleanvoidEnds the current unique id section, so the previous counter will be used to generate unique ids to components.voidvoidCall 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.voidUsed to clean up all unused relocatable components on the root component.Generate a unique id for component instances.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 UIComponentReturn the composite component being applied on the current facelet.intReturns the current nesting level of composite components found.static FaceletCompositionContextstatic FaceletCompositionContextstatic FaceletCompositionContextIndicates if a EL Expression can be or not cached by facelets vdl.Gets all validationIds with its associated EditableValueHolderAttachedObjectHandler from the stack.abstract FaceletFactoryReturn the unique id from the iterator if applies since 2.1.7, 2.0.13Return the list of unique ids since 2.1.7, 2.0.13abstract UniqueIdVendorReturn the latest UniqueIdVendor created from stack.getViewRoot(FacesContext facesContext) voidvoidIncrement the unique id without construct it.voidinit(FacesContext facesContext) voidActivater record unique id mode, so an structure will be used to hold those values.booleanCheck if the facelet is building view metadata since 2.1.7, 2.0.13booleanIndicate if the current facelet section is a dynamic component section, which means it was added to the component tree using vdl.createComponent(...);booleanCheck if the algorithm is applying a dynamic component and the current component is the top level one.booleanbooleanCheck if the component is created inside f:metadata section since 2.1.7, 2.0.13abstract booleanCheck if this build should be marked as initial state.abstract booleanabstract booleanisMethodExpressionAttributeApplied(UIComponent compositeComponentParent, String attributeName) Check if the MethodExpression attribute has been applied using vdl.retargetMethodExpressionbooleanCheck if the section to be processed is being refreshed.abstract booleanCheck if this build is being refreshed, adding transient components and adding/removing components under c:if or c:forEach or not.abstract booleanCheck if the current view will be refreshed with partial state saving.booleanabstract booleanCheck if we are using partial state saving on this viewbooleanabstract 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 voidvoidabstract voidRemoves top of stack.abstract voidabstract voidvoidpushDynamicComponentSection(String baseKey) abstract voidpushEnclosingValidatorIdToStack(String validatorId, EditableValueHolderAttachedObjectHandler attachedObjectHandler) Pushes validatorId to the stack of all enclosing validatorIds.abstract voidvoidrelease(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) Start a new unique id section, which means a new counter is used to generate unique ids to componentsStart 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.voidCall this method to indicate a f:metadata section is about to be processed since 2.1.7, 2.0.13
- 
Field Details- 
FACELET_COMPOSITION_CONTEXT_KEY- See Also:
 
 
- 
- 
Constructor Details- 
FaceletCompositionContextprotected FaceletCompositionContext()
 
- 
- 
Method Details- 
getCurrentInstance
- 
getCurrentInstance
- 
getCurrentInstance
- 
init
- 
releaseReleases the MyFaceletContext object. This method must only be called by the code that created the MyFaceletContext.
- 
getFaceletFactory
- 
getCompositeComponentFromStackReturn 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- Parameters:
- parent-
- Since:
- 2.0.1
 
- 
popCompositeComponentToStackpublic abstract void popCompositeComponentToStack()- Since:
- 2.0.1
 
- 
getUniqueIdVendorFromStackReturn 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- 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
 
- 
containsEnclosingValidatorId- 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
 
- 
removeAttachedObjectHandlersRemove 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
 
- 
markForDeletionMarks all direct children and Facets with an attribute for deletion.- Parameters:
- component- UIComponent to mark
- Since:
- 2.0.2
- See Also:
 
- 
finalizeForDeletionUsed in conjunction with markForDeletion where any UIComponent marked will be removed.- Parameters:
- component- UIComponent to finalize
- Since:
- 2.0.2
 
- 
removeComponentForDeletion
- 
markRelocatableResourceForDeletionMarks 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
 
- 
finalizeRelocatableResourcesForDeletionUsed 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
 
- 
getELExpressionCacheModeIndicates 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
 
- 
startComponentUniqueIdSectionStart 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
 
- 
startComponentUniqueIdSectionStart 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
 
- 
endComponentUniqueIdSection- Parameters:
- base-
- Since:
- 2.2.0
 
- 
generateUniqueIdGenerate 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
- 
generateUniqueComponentIdGenerate 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.
- 
setUniqueIdsIteratorSet 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
- 
addUniqueIdAdd 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-
 
- 
getUniqueIdFromIteratorReturn the unique id from the iterator if applies since 2.1.7, 2.0.13- Returns:
 
- 
getUniqueIdListReturn 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
 
- 
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) 
- 
pushDynamicComponentSection
- 
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
 
- 
getViewRoot
- 
setViewRoot
- 
getVisitContextFactory
 
-