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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract 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 componentvoid
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 againabstract boolean
void
Ends the current unique id section, so the previous counter will be used to generate unique ids to components.void
void
Call this method to indicate f:metadata section has been already processed since 2.1.7, 2.0.13abstract void
finalizeForDeletion
(UIComponent component) Used in conjunction with markForDeletion where any UIComponent marked will be removed.void
Used 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().void
generateUniqueId
(StringBuilder builderToAdd) abstract List<AttachedObjectHandler>
getAttachedObjectHandlers
(UIComponent compositeComponentParent) Retrieve the list of object handlers attached to a composite component parent.abstract UIComponent
Return the composite component being applied on the current facelet.int
Returns the current nesting level of composite components found.static FaceletCompositionContext
static FaceletCompositionContext
static FaceletCompositionContext
Indicates if a EL Expression can be or not cached by facelets vdl.Gets all validationIds with its associated EditableValueHolderAttachedObjectHandler from the stack.abstract FaceletFactory
Return 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 UniqueIdVendor
Return the latest UniqueIdVendor created from stack.getViewRoot
(FacesContext facesContext) void
void
Increment the unique id without construct it.void
init
(FacesContext facesContext) void
Activater record unique id mode, so an structure will be used to hold those values.boolean
Check if the facelet is building view metadata since 2.1.7, 2.0.13boolean
Indicate if the current facelet section is a dynamic component section, which means it was added to the component tree using vdl.createComponent(...);boolean
Check if the algorithm is applying a dynamic component and the current component is the top level one.boolean
boolean
Check if the component is created inside f:metadata section since 2.1.7, 2.0.13abstract boolean
Check if this build should be marked as initial state.abstract boolean
abstract boolean
isMethodExpressionAttributeApplied
(UIComponent compositeComponentParent, String attributeName) Check if the MethodExpression attribute has been applied using vdl.retargetMethodExpressionboolean
Check if the section to be processed is being refreshed.abstract boolean
Check if this build is being refreshed, adding transient components and adding/removing components under c:if or c:forEach or not.abstract boolean
Check if the current view will be refreshed with partial state saving.boolean
abstract boolean
Check if we are using partial state saving on this viewboolean
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.retargetMethodExpressionvoid
markRelocatableResourceForDeletion
(UIComponent component) Marks the given resource for deletion.abstract void
void
abstract void
Removes top of stack.abstract void
abstract void
void
pushDynamicComponentSection
(String baseKey) abstract void
pushEnclosingValidatorIdToStack
(String validatorId, EditableValueHolderAttachedObjectHandler attachedObjectHandler) Pushes validatorId to the stack of all enclosing validatorIds.abstract void
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 componentvoid
setDynamicComponentTopLevel
(boolean value) void
setDynamicCompositeComponentHandler
(boolean value) void
setMarkInitialState
(boolean value) void
setUniqueIdsIterator
(Iterator<String> uniqueIdsIterator) Set the iterator used to retrieve unique ids.void
setViewRoot
(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.void
Call 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
-
FaceletCompositionContext
protected FaceletCompositionContext()
-
-
Method Details
-
getCurrentInstance
-
getCurrentInstance
-
getCurrentInstance
-
init
-
release
Releases the MyFaceletContext object. This method must only be called by the code that created the MyFaceletContext. -
getFaceletFactory
-
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
- Parameters:
parent
-- Since:
- 2.0.1
-
popCompositeComponentToStack
public abstract void popCompositeComponentToStack()- Since:
- 2.0.1
-
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
- Parameters:
parent
-- Since:
- 2.0.1
-
popUniqueIdVendorToStack
public abstract void popUniqueIdVendorToStack()- Since:
- 2.0.1
-
popEnclosingValidatorIdToStack
public abstract void popEnclosingValidatorIdToStack()Removes top of stack.- 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
- 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
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
Marks all direct children and Facets with an attribute for deletion.- Parameters:
component
- UIComponent to mark- Since:
- 2.0.2
- See Also:
-
finalizeForDeletion
Used in conjunction with markForDeletion where any UIComponent marked will be removed.- Parameters:
component
- UIComponent to finalize- Since:
- 2.0.2
-
removeComponentForDeletion
-
markRelocatableResourceForDeletion
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
-
finalizeRelocatableResourcesForDeletion
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
-
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
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
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
-
startComponentUniqueIdSection
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
-
endComponentUniqueIdSection
- Parameters:
base
-- Since:
- 2.2.0
-
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
-
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
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
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
Return the unique id from the iterator if applies since 2.1.7, 2.0.13- Returns:
-
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
-
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
-
isDynamicCompositeComponentHandler
public boolean isDynamicCompositeComponentHandler() -
setDynamicCompositeComponentHandler
public void setDynamicCompositeComponentHandler(boolean value) -
pushDynamicComponentSection
-
popDynamicComponentSection
public void popDynamicComponentSection() -
isDynamicComponentTopLevel
public 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
-
setDynamicComponentTopLevel
public void setDynamicComponentTopLevel(boolean value) -
isDynamicComponentSection
public 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
-