Package javax.faces.view

Examples of javax.faces.view.Location


    }
   
    @Test
    public void testDefaultTagDecorator2() throws Exception
    {
        Location location = new Location("/test.xhtml", 20, 5);
        Tag tag = new Tag(location, DefaultTagDecorator.XHTML_NAMESPACE, "a", "a",
            new TagAttributesImpl(new TagAttribute[]
                {
                    new TagAttributeImpl(location, DefaultTagDecorator.JSF_NAMESPACE, "action", "jsf:action", "#{test.testAction}")
                }
View Full Code Here


    }
   
    @Test
    public void testDefaultTagDecorator3() throws Exception
    {
        Location location = new Location("/test.xhtml", 20, 5);
        Tag tag = new Tag(location, DefaultTagDecorator.XHTML_NAMESPACE, "body", "body",
            new TagAttributesImpl(new TagAttribute[]
                {
                    new TagAttributeImpl(location, DefaultTagDecorator.JSF_ALIAS_NAMESPACE, "id", "jsf:id", "idBody")
                }
View Full Code Here

    }
   
    @Test
    public void testDefaultTagDecorator4() throws Exception
    {
        Location location = new Location("/test.xhtml", 20, 5);
        Tag tag = new Tag(location, DefaultTagDecorator.XHTML_NAMESPACE, "a", "a",
            new TagAttributesImpl(new TagAttribute[]
                {
                    new TagAttributeImpl(location, DefaultTagDecorator.JSF_ALIAS_NAMESPACE, "action", "jsf:action", "#{test.testAction}")
                }
View Full Code Here

        UIComponent currentCompositeComponent = UIComponent.getCurrentCompositeComponent(facesContext);
       
        //1.1 Use getCurrentCompositeComponent first!
        if (currentCompositeComponent != null)
        {
            Location componentLocation = (Location) currentCompositeComponent.getAttributes().get(LOCATION_KEY);
            if (componentLocation != null
                    && componentLocation.getPath().equals(location.getPath()))
            {
                return currentCompositeComponent;
            }
        }

        UIComponent currentComponent = UIComponent.getCurrentComponent(facesContext);
       
        if (currentComponent == null)
        {
            // Cannot found any component, because we don't have any reference!
            return null;
        }

        //2. Look on the stack using a recursive algorithm.
        UIComponent matchingCompositeComponent
                = lookForCompositeComponentOnStack(facesContext, location, currentComponent);
       
        if (matchingCompositeComponent != null)
        {
            return matchingCompositeComponent;
        }
       
        //2. Try to find it using UIComponent.getCurrentCompositeComponent().
        // This one will look the direct parent hierarchy of the component,
        // to see if the composite component can be found.
        if (currentCompositeComponent != null)
        {
            currentComponent = currentCompositeComponent;
        }
        else
        {
            //Try to find the composite component looking directly the parent
            //ancestor of the current component
            //currentComponent = UIComponent.getCurrentComponent(facesContext);
            boolean found = false;
            while (currentComponent != null && !found)
            {
                String findComponentExpr = (String) currentComponent.getAttributes().get(CC_FIND_COMPONENT_EXPRESSION);
                if (findComponentExpr != null)
                {
                    UIComponent foundComponent = facesContext.getViewRoot().findComponent(findComponentExpr);
                    if (foundComponent != null)
                    {
                        Location foundComponentLocation = (Location) currentComponent.getAttributes().get(LOCATION_KEY);
                        if (foundComponentLocation != null
                                && foundComponentLocation.getPath().equals(location.getPath()))
                        {
                            return foundComponent;
                        }
                        else
                        {
                            while (foundComponent != null)
                            {
                                Location componentLocation
                                        = (Location) foundComponent.getAttributes().get(LOCATION_KEY);
                                if (componentLocation != null
                                        && componentLocation.getPath().equals(location.getPath()))
                                {
                                    return foundComponent;
                                }
                                // get the composite component's parent
                                foundComponent = UIComponent.getCompositeComponentParent(foundComponent);
                            }
                        }
                    }
                }

                if (UIComponent.isCompositeComponent(currentComponent))
                {
                    found = true;
                }
                else
                {
                    currentComponent = currentComponent.getParent();
                }
            }
        }
       
        //if currentComponent != null means we have a composite component that we can check
        //Use UIComponent.getCompositeComponentParent() to traverse here.
        while (currentComponent != null)
        {
            Location componentLocation = (Location) currentComponent.getAttributes().get(LOCATION_KEY);
            if (componentLocation != null
                    && componentLocation.getPath().equals(location.getPath()))
            {
                return currentComponent;
            }
            // get the composite component's parent
            currentComponent = UIComponent.getCompositeComponentParent(currentComponent);
View Full Code Here

                                                                final Location location,
                                                                UIComponent currentComponent)
    {
        if (UIComponent.isCompositeComponent(currentComponent))
        {
            Location componentLocation = (Location) currentComponent.getAttributes().get(LOCATION_KEY);
            if (componentLocation != null
                    && componentLocation.getPath().equals(location.getPath()))
            {
                return currentComponent;
            }
        }
        currentComponent.popComponentFromEL(facesContext);
View Full Code Here

            UIComponent baseComponent, final Location location)
    {
        UIComponent currentComponent = baseComponent;
        while (currentComponent != null)
        {
            Location componentLocation = (Location) currentComponent.getAttributes().get(
                LOCATION_KEY);
            if (componentLocation != null
                    && componentLocation.getPath().equals(location.getPath()))
            {
                return currentComponent;
            }
            // get the composite component's parent
            currentComponent = UIComponent.getCompositeComponentParent(currentComponent);
View Full Code Here

        UIComponent currentCompositeComponent = UIComponent.getCurrentCompositeComponent(facesContext);
       
        //1.1 Use getCurrentCompositeComponent first!
        if (currentCompositeComponent != null)
        {
            Location componentLocation = (Location) currentCompositeComponent.getAttributes().get(LOCATION_KEY);
            if (componentLocation != null
                    && componentLocation.getPath().equals(location.getPath()) &&
                    (ccLevel == getCCLevel(currentCompositeComponent)) )
            {
                return currentCompositeComponent;
            }
        }

        UIComponent currentComponent = UIComponent.getCurrentComponent(facesContext);
       
        if (currentComponent == null)
        {
            // Cannot found any component, because we don't have any reference!
            return null;
        }
       
        //2. Look on the stack using a recursive algorithm.
        UIComponent matchingCompositeComponent
                = lookForCompositeComponentOnStack(facesContext, location, ccLevel, currentComponent);
       
        if (matchingCompositeComponent != null)
        {
            return matchingCompositeComponent;
        }
       
        //2. Try to find it using UIComponent.getCurrentCompositeComponent().
        // This one will look the direct parent hierarchy of the component,
        // to see if the composite component can be found.
        if (currentCompositeComponent != null)
        {
            currentComponent = currentCompositeComponent;
        }
        else
        {
            //Try to find the composite component looking directly the parent
            //ancestor of the current component
            //currentComponent = UIComponent.getCurrentComponent(facesContext);
            boolean found = false;
            while (currentComponent != null && !found)
            {
                String findComponentExpr = (String) currentComponent.getAttributes().get(CC_FIND_COMPONENT_EXPRESSION);
                if (findComponentExpr != null)
                {
                    UIComponent foundComponent = facesContext.getViewRoot().findComponent(findComponentExpr);
                    if (foundComponent != null)
                    {
                        Location foundComponentLocation = (Location) currentComponent.getAttributes().get(LOCATION_KEY);
                        if (foundComponentLocation != null
                                && foundComponentLocation.getPath().equals(location.getPath()) &&
                                ccLevel == getCCLevel(foundComponent))
                        {
                            return foundComponent;
                        }
                        else
                        {
                            while (foundComponent != null)
                            {
                                Location componentLocation
                                        = (Location) foundComponent.getAttributes().get(LOCATION_KEY);
                                if (componentLocation != null
                                        && componentLocation.getPath().equals(location.getPath()) &&
                                        ccLevel == getCCLevel(foundComponent))
                                {
                                    return foundComponent;
                                }
                                // get the composite component's parent
                                foundComponent = UIComponent.getCompositeComponentParent(foundComponent);
                            }
                        }
                    }
                }

                if (UIComponent.isCompositeComponent(currentComponent))
                {
                    found = true;
                }
                else
                {
                    currentComponent = currentComponent.getParent();
                }
            }
        }
       
        //if currentComponent != null means we have a composite component that we can check
        //Use UIComponent.getCompositeComponentParent() to traverse here.
        while (currentComponent != null)
        {
            Location componentLocation = (Location) currentComponent.getAttributes().get(LOCATION_KEY);
            if (componentLocation != null
                    && componentLocation.getPath().equals(location.getPath()) &&
                    ccLevel == getCCLevel(currentComponent))
            {
                return currentComponent;
            }
            // get the composite component's parent
View Full Code Here

                                                                final Location location, int ccLevel,
                                                                UIComponent currentComponent)
    {
        if (UIComponent.isCompositeComponent(currentComponent))
        {
            Location componentLocation = (Location) currentComponent.getAttributes().get(LOCATION_KEY);
            if (componentLocation != null
                    && componentLocation.getPath().equals(location.getPath()) &&
                    (ccLevel == getCCLevel(currentComponent)) )
            {
                return currentComponent;
            }
        }
View Full Code Here

                if ((this.capabilities & EL_CC) != 0)
                {
                    UIComponent cc = actx.getFaceletCompositionContext().getCompositeComponentFromStack();
                    if (cc != null)
                    {
                        Location location = (Location) cc.getAttributes().get(CompositeComponentELUtils.LOCATION_KEY);
                        if (location != null)
                        {
                            if (ExternalSpecifications.isUnifiedELAvailable())
                            {
                                valueExpression = new LocationValueExpressionUEL(location, valueExpression,
                                        actx.getFaceletCompositionContext().getCompositeComponentLevel());
                            }
                            else
                            {
                                valueExpression = new LocationValueExpression(location, valueExpression,
                                        actx.getFaceletCompositionContext().getCompositeComponentLevel());
                            }
                        }
                    }
                }
                else if ((this.capabilities & EL_RESOURCE) != 0)
                {
                    UIComponent cc = actx.getFaceletCompositionContext().getCompositeComponentFromStack();
                    if (cc != null)
                    {
                        Location location = (Location) cc.getAttributes().get(CompositeComponentELUtils.LOCATION_KEY);
                        if (location != null)
                        {
                            if (ExternalSpecifications.isUnifiedELAvailable())
                            {
                                valueExpression = new ResourceLocationValueExpressionUEL(location, valueExpression);
View Full Code Here

        String alias = tagName;
        CompilationManager mngr = new CompilationManager(alias, this, getDefaultFaceletsProcessingInstructions());
        String prefix = "oamf"; // The prefix is only a logical name.
        mngr.pushNamespace(prefix, taglibURI);
       
        Location location = new Location(alias, 0, 0);
        int len = attributes.size();
        TagAttribute[] ta = new TagAttribute[len];
        int i = 0;
        for (Map.Entry<String, Object> entry : attributes.entrySet())
        {
View Full Code Here

TOP

Related Classes of javax.faces.view.Location

Copyright © 2018 www.massapicom. 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.