Examples of AbstractFaceletContext


Examples of org.apache.myfaces.view.facelets.AbstractFaceletContext

                }

                c = new UIInstructions(txt, applied);
                // mark it owned by a facelet instance
                //c.setId(ComponentSupport.getViewRoot(ctx, parent).createUniqueId());
                AbstractFaceletContext actx = (AbstractFaceletContext) ctx;
                UniqueIdVendor uniqueIdVendor = actx.getUniqueIdVendorFromStack();
                if (uniqueIdVendor == null)
                {
                    uniqueIdVendor = ComponentSupport.getViewRoot(ctx, parent);
                }
                if (uniqueIdVendor != null)
View Full Code Here

Examples of org.apache.myfaces.view.facelets.AbstractFaceletContext

    {
        if (parent != null)
        {
            UIComponent c = new UILiteralText(this.txtString);
            //c.setId(ComponentSupport.getViewRoot(ctx, parent).createUniqueId());
            AbstractFaceletContext actx = (AbstractFaceletContext) ctx;
            UniqueIdVendor uniqueIdVendor = actx.getUniqueIdVendorFromStack();
            if (uniqueIdVendor == null)
            {
                uniqueIdVendor = ComponentSupport.getViewRoot(ctx, parent);
            }
            if (uniqueIdVendor != null)
View Full Code Here

Examples of org.apache.myfaces.view.facelets.AbstractFaceletContext

            try
            {
                ELText nt = this.txt.apply(ctx.getExpressionFactory(), ctx);
                UIComponent c = new UIText(this.alias, nt);
                //c.setId(ComponentSupport.getViewRoot(ctx, parent).createUniqueId());
                AbstractFaceletContext actx = (AbstractFaceletContext) ctx;
                UniqueIdVendor uniqueIdVendor = actx.getUniqueIdVendorFromStack();
                if (uniqueIdVendor == null)
                {
                    uniqueIdVendor = ComponentSupport.getViewRoot(ctx, parent);
                }
                if (uniqueIdVendor != null)
View Full Code Here

Examples of org.apache.myfaces.view.facelets.AbstractFaceletContext

        {
            return;
        }
        if (_wrapMode)
        {
            AbstractFaceletContext actx = (AbstractFaceletContext) ctx;
            // Push and pop this ajax handler to the stack, to delegate the
            // call to applyAttachedObject to ComponentTagHandlerDelegate
            // TODO: The spec is not clear about how to deal with
            // composite component instances. The default one proposed here is
            // use a different stack on DefaultFaceletContext.applyCompositeComponent,
            // so components inside composite:implementation tag will not be
            // affected by f:ajax outsider handlers.
            actx.pushAjaxHandlerToStack(this);
            nextHandler.apply(ctx, parent);
            actx.popAjaxHandlerToStack();
        }
        else
        {
            if (parent instanceof ClientBehaviorHolder)
            {
View Full Code Here

Examples of org.apache.myfaces.view.facelets.AbstractFaceletContext

    }

    public void apply(FaceletContext ctx, UIComponent parent)
            throws IOException
    {
        AbstractFaceletContext actx = ((AbstractFaceletContext)ctx);
        if (!actx.isBuildingCompositeComponentMetadata())
        {
            // If this tag is found in a facelet, the compiler has trimmed all
            // tags outside this one excluding composite:interface, so "parent"
            // is a component used as value for the facet key
            // UIComponent.COMPOSITE_FACET_NAME in a composite component.
           
            actx.pushCompositeComponentToStack(parent.getParent());
           
            nextHandler.apply(ctx, parent);
           
            actx.popCompositeComponentToStack();
        }
        else
        {
            // Register the facet UIComponent.COMPOSITE_FACET_NAME
            CompositeComponentBeanInfo beanInfo =
View Full Code Here

Examples of org.apache.myfaces.view.facelets.AbstractFaceletContext

        }
        finally
        {
            ctx.setVariableMapper(orig);
        }
        AbstractFaceletContext actx = (AbstractFaceletContext) ctx;
        if ( !src.isLiteral() && actx.isMarkInitialState() &&
              actx.isRefreshTransientBuildOnPSS())
        {
            //Mark the parent component to be saved and restored fully.
            ComponentSupport.markComponentToRestoreFully(ctx.getFacesContext(), parent);
        }
    }
View Full Code Here

Examples of org.apache.myfaces.view.facelets.AbstractFaceletContext

            // which it should not, on my opinion. In addition, mojarra also does not
            // attach the validator to the second h:inputText in this scenario (blackbox test).
            // So I use the same way as f:ajax for this problem. -=Jakob Korherr=-
           
            // we need methods from AbstractFaceletContext
            AbstractFaceletContext abstractCtx = (AbstractFaceletContext) ctx;
            
            String validatorId = _delegate.getValidatorConfig().getValidatorId();
           
            boolean disabled = _delegate.isDisabled(ctx);
            if (disabled)
            {
                // the validator is disabled --> add its id to the exclusion stack
                boolean validatorIdAvailable = validatorId != null && !"".equals(validatorId);
                if (validatorIdAvailable)
                {
                    abstractCtx.pushExcludedValidatorIdToStack(validatorId);
                }
                _delegate.getValidatorConfig().getNextHandler().apply(ctx, parent);
                if (validatorIdAvailable)
                {
                    abstractCtx.popExcludedValidatorIdToStack();
                }
            }
            else
            {
                // the validator is enabled
                // --> add the validation groups and the validatorId to the stack
                String groups = getValidationGroups(ctx);
                // spec: don't save the validation groups string if it is null or empty string
                boolean groupsAvailable = groups != null
                        && !groups.matches(BeanValidator.EMPTY_VALIDATION_GROUPS_PATTERN);
                if (groupsAvailable)
                {
                    abstractCtx.pushValidationGroupsToStack(groups);
                }
                abstractCtx.pushEnclosingValidatorIdToStack(validatorId);
                _delegate.getValidatorConfig().getNextHandler().apply(ctx, parent);
                abstractCtx.popEnclosingValidatorIdToStack();
                if (groupsAvailable)
                {
                    abstractCtx.popValidationGroupsToStack();
                }
            }
        }
        else
        {
View Full Code Here

Examples of org.apache.myfaces.view.facelets.AbstractFaceletContext

                for (int i = 0; i < _params.length; i++)
                {
                    _params[i].apply(ctx, parent);
                }
            }
            AbstractFaceletContext actx = (AbstractFaceletContext) ctx;
            actx.extendClient(this);
            try
            {
                ctx.includeFacelet(parent, _template.getValue(ctx));
            }
            finally
            {
                actx.popClient(this);
                ctx.setVariableMapper(orig);
            }
        }
        else
        {
View Full Code Here

Examples of org.apache.myfaces.view.facelets.AbstractFaceletContext

     * @see javax.faces.view.facelets.FaceletHandler#apply(javax.faces.view.facelets.FaceletContext, javax.faces.component.UIComponent)
     */
    public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException,
            ELException
    {
        AbstractFaceletContext actx = (AbstractFaceletContext) ctx;
        actx.extendClient(this);
        boolean found = false;
        try
        {
            found = actx.includeDefinition(parent, this.name);
        }
        finally
        {
            actx.popClient(this);
        }
        if (!found)
        {
            this.nextHandler.apply(ctx, parent);
        }
View Full Code Here

Examples of org.apache.myfaces.view.facelets.AbstractFaceletContext

        // our id
        String id = ctx.generateUniqueId(_delegate.getTagId());

        // Cast to use UniqueIdVendor stuff
        AbstractFaceletContext actx = (AbstractFaceletContext) ctx;
               
        // grab our component
        UIComponent c = ComponentSupport.findChildByTagId(parent, id);

        // Check if the component was relocated using
        // composite:insertChildren or composite:insertFacet
        boolean componentFoundInserted = false;

        if (c == null && actx.isRefreshingTransientBuild() && UIComponent.isCompositeComponent(parent))
        {
            if (facetName == null)
            {
                String targetClientId = (String) parent.getAttributes().get(InsertChildrenHandler.INSERT_CHILDREN_TARGET_ID);
                if (targetClientId != null)
                {
                    UIComponent targetComponent = parent.findComponent(targetClientId.substring(parent.getClientId().length()+1));
                    if (targetComponent != null)
                    {
                        c = ComponentSupport.findChildByTagId(targetComponent, id);
                    }
                }
                if (c != null)
                {
                    c.getAttributes().put(InsertChildrenHandler.USES_INSERT_CHILDREN, Boolean.TRUE);
                    componentFoundInserted = true;
                }
            }
            else
            {
                String targetClientId = (String) parent.getAttributes().get(InsertFacetHandler.INSERT_FACET_TARGET_ID+facetName);
                if (targetClientId != null)
                {
                    UIComponent targetComponent = parent.findComponent(targetClientId.substring(parent.getClientId().length()+1));
                    if (targetComponent != null)
                    {
                        c = ComponentSupport.findChildByTagId(targetComponent, id);
                        if (c != null)
                        {
                            c.getAttributes().put(InsertFacetHandler.USES_INSERT_FACET, Boolean.TRUE);
                            componentFoundInserted = true;
                        }
                    }
                }
            }
        }
        boolean componentFound = false;
        if (c != null)
        {
            componentFound = true;
            // mark all children for cleaning
            if (log.isLoggable(Level.FINE))
            {
                log.fine(_delegate.getTag() + " Component[" + id + "] Found, marking children for cleanup");
            }
            ComponentSupport.markForDeletion(c);
        }
        else
        {
            c = this.createComponent(ctx);
            if (log.isLoggable(Level.FINE))
            {
                log.fine(_delegate.getTag() + " Component[" + id + "] Created: " + c.getClass().getName());
            }
           
            _delegate.setAttributes(ctx, c);

            // mark it owned by a facelet instance
            c.getAttributes().put(ComponentSupport.MARK_CREATED, id);

            if (facesContext.isProjectStage(ProjectStage.Development))
            {
                c.getAttributes().put(UIComponent.VIEW_LOCATION_KEY,
                        _delegate.getTag().getLocation());
            }

            // assign our unique id
            if (this._id != null)
            {
                c.setId(this._id.getValue(ctx));
            }
            else
            {
                UniqueIdVendor uniqueIdVendor = actx.getUniqueIdVendorFromStack();
                if (uniqueIdVendor == null)
                {
                    uniqueIdVendor = facesContext.getViewRoot();
                   
                    if (uniqueIdVendor == null)
                    {
                        // facesContext.getViewRoot() returns null here if we are in
                        // phase restore view, so we have to try to get the view root
                        // via the method in ComponentSupport and our parent
                        uniqueIdVendor = ComponentSupport.getViewRoot(ctx, parent);
                    }
                }
                if (uniqueIdVendor != null)
                {
                    // UIViewRoot implements UniqueIdVendor, so there is no need to cast to UIViewRoot
                    // and call createUniqueId()
                    String uid = uniqueIdVendor.createUniqueId(facesContext, id);
                    c.setId(uid);
                }
            }

            if (this._rendererType != null)
            {
                c.setRendererType(this._rendererType);
            }

            // hook method
            _delegate.onComponentCreated(ctx, c, parent);
        }
        c.pushComponentToEL(facesContext, c);

        if (c instanceof UniqueIdVendor)
        {
            actx.pushUniqueIdVendorToStack((UniqueIdVendor)c);
        }
        // first allow c to get populated
        _delegate.applyNextHandler(ctx, c);

        // finish cleaning up orphaned children
        if (componentFound)
        {
            ComponentSupport.finalizeForDeletion(c);

            if (!componentFoundInserted)
            {
                if (facetName == null)
                {
                    parent.getChildren().remove(c);
                }
                else
                {
                    ComponentSupport.removeFacet(ctx, parent, c, facetName);
                }
            }
        }
       
        if (actx.isRefreshingTransientBuild() &&
                UIComponent.isCompositeComponent(parent))
        {
            // Save the child structure behind this component, so it can be
            // used later by InsertChildrenHandler and InsertFacetHandler
            // to update components correctly.
            if (facetName != null)
            {
                if (parent.getAttributes().containsKey(InsertFacetHandler.INSERT_FACET_TARGET_ID+facetName))
                {
                    List<String> ordering = (List<String>) parent.getAttributes().get(
                            InsertFacetHandler.INSERT_FACET_ORDERING+facetName);
                    if (ordering == null)
                    {
                        ordering = new ArrayList<String>();
                        parent.getAttributes().put(InsertFacetHandler.INSERT_FACET_ORDERING+facetName, ordering);
                    }
                    ordering.remove(id);
                    ordering.add(id);
                }
            }
            else
            {
                if (parent.getAttributes().containsKey(InsertChildrenHandler.INSERT_CHILDREN_TARGET_ID))
                {
                    List<String> ordering = (List<String>) parent.getAttributes().get(
                            InsertChildrenHandler.INSERT_CHILDREN_ORDERING);
                    if (ordering == null)
                    {
                        ordering = new ArrayList<String>();
                        parent.getAttributes().put(InsertChildrenHandler.INSERT_CHILDREN_ORDERING, ordering);
                    }
                    ordering.remove(id);
                    ordering.add(id);
                }
            }
        }

        if (c instanceof ClientBehaviorHolder && !UIComponent.isCompositeComponent(c))
        {
            Iterator<AjaxHandler> it = actx.getAjaxHandlers();
            if (it != null)
            {
                while(it.hasNext())
                {
                    it.next().applyAttachedObject(facesContext, c);
                }
            }
        }
       
        if (c instanceof EditableValueHolder)
        {
            // add default validators here, because this feature
            // is only available in facelets (see MYFACES-2362 for details)
            addDefaultValidators(facesContext, actx, (EditableValueHolder) c);
        }
       
        _delegate.onComponentPopulated(ctx, c, parent);

        if (!componentFoundInserted)
        {
            // add to the tree afterwards
            // this allows children to determine if it's
            // been part of the tree or not yet
            if (facetName == null)
            {
                parent.getChildren().add(c);
            }
            else
            {
                ComponentSupport.addFacet(ctx, parent, c, facetName);
            }
        }
        /*
        else
        {
            if (facetName != null)
            {
                if (UIComponent.isCompositeComponent(parent))
                {
                    UIComponent facet = parent.getFacet(facetName);
                    if (Boolean.TRUE.equals(facet.getAttributes().get(ComponentSupport.FACET_CREATED_UIPANEL_MARKER)))
                    {
                        facet.getAttributes().put(InsertFacetHandler.USES_INSERT_FACET, Boolean.TRUE);
                    }
                }
            }
        }*/
       
        if (c instanceof UniqueIdVendor)
        {
            actx.popUniqueIdVendorToStack();
        }

        c.popComponentFromEL(facesContext);
       
        if (actx.isMarkInitialState())
        {
            //Call it only if we are using partial state saving
            c.markInitialState();
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.