Package javax.faces.view

Examples of javax.faces.view.Location


                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


     * @param component
     * @return
     */
    private String getComponentLocation(UIComponent component)
    {
        Location location = (Location) component.getAttributes()
                .get(UIComponent.VIEW_LOCATION_KEY);
        if (location != null)
        {
            return location.toString();
        }
        return null;
    }
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 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

            String target = (String) component.getAttributes().get(JSFAttr.TARGET_ATTR);
            if (target != null)
            {
                FacesContext facesContext = FacesContext.getCurrentInstance();

                Location location = (Location) component.getAttributes().get(CompositeComponentELUtils.LOCATION_KEY);
                if (location != null)
                {
                    UIComponent ccParent
                            = CompositeComponentELUtils.getCompositeComponentBasedOnLocation(facesContext, location);
                    if (ccParent != null)
View Full Code Here

        if (event instanceof PostAddToViewEvent)
        {
            UIComponent component = event.getComponent();
            FacesContext facesContext = FacesContext.getCurrentInstance();
           
            Location location = (Location) component.getAttributes().get(CompositeComponentELUtils.LOCATION_KEY);
            if (location != null)
            {
                UIComponent ccParent
                        = CompositeComponentELUtils.getCompositeComponentBasedOnLocation(facesContext, location);
                if (ccParent != null)
View Full Code Here

     * @param component
     * @return
     */
    private String getComponentLocation(UIComponent component)
    {
        Location location = (Location) component.getAttributes()
                .get(UIComponent.VIEW_LOCATION_KEY);
        if (location != null)
        {
            return location.toString();
        }
        return null;
    }
View Full Code Here

        return COMPONENT_FAMILY;
    }

    private String getComponentLocation(UIComponent component)
    {
        Location location = (Location) component.getAttributes()
                .get(UIComponent.VIEW_LOCATION_KEY);
        if (location != null)
        {
            return location.toString();
        }
        return null;
    }
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.