Class 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$)
    • Constructor Detail

      • FaceletCompositionContext

        protected FaceletCompositionContext()
    • Method Detail

      • 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
      • 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
      • 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:
        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

        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
      • startComponentUniqueIdSection

        public 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
      • endComponentUniqueIdSection

        public void endComponentUniqueIdSection​(String base)
        Parameters:
        base -
        Since:
        2.2.0
      • 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
      • isDynamicCompositeComponentHandler

        public boolean isDynamicCompositeComponentHandler()
      • setDynamicCompositeComponentHandler

        public void setDynamicCompositeComponentHandler​(boolean value)
      • pushDynamicComponentSection

        public void pushDynamicComponentSection​(String baseKey)
      • 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
      • setViewRoot

        public void setViewRoot​(UIViewRoot root)