Package javax.faces.view.facelets

Examples of javax.faces.view.facelets.Tag


        if (log.isLoggable(Level.FINE))
        {
            log.fine("Tag Pushed: " + orig);
        }

        Tag t = this.tagDecorator.decorate(orig);
        String[] qname = this.determineQName(t);
        t = this.trimAttributes(t);

        if (isTrimmed(qname[0], qname[1]))
        {
            log.fine("Composition Found, Popping Parent Tags");
            this.units.clear();
            NamespaceUnit nsUnit = this.namespaceManager.toNamespaceUnit(this.tagLibrary);
            this.units.push(nsUnit);
            this.startUnit(new TrimmedTagUnit(this.tagLibrary, qname[0], qname[1], t, this.nextTagId()));
            log.fine("New Namespace and [Trimmed] TagUnit pushed");
        }
        else if (isRemove(qname[0], qname[1]))
        {
            this.units.push(new RemoveUnit());
        }
        else if (isCompositeComponentInterface(qname[0], qname[1]))
        {
            // Here we have two cases when we found a <composite:interface> tag:
            //
            // -  If a page has a <composite:interface> tag and a <composite:implementation> tag.
            //   In this case, we need to trim all tags outside this two tags, otherwise these
            //   unwanted tags will be added when the composite component is applied.
            //   Unfortunately, this is the only point we can do it, because after the compiler,
            //   html tags are wrapped on facelets UIInstruction or UIText components as "list",
            //   losing the original structure required to trim.
            //
            // -  If a page has a <composite:interface> tag and not a <composite:implementation> tag.
            //   In this case, it is not necessary to trim, because we use the facelet only to create
            //   metadata and the component tree created is not used (see
            //   ViewDeclarationLanguage.getComponentMetadata() ). On InterfaceHandler, instead
            //   there is some code that found the right component in the temporal tree to add the
            //   generated BeanInfo, which it is retrieved later.
            //
            // After use Template Client API for composite components, it was found the need to
            // gather metadata information from
            log.fine("Composite Component Interface Found, saving unit");
            CompositeComponentUnit compositeRootCompilationUnit = new CompositeComponentUnit();
            this.startUnit(compositeRootCompilationUnit);
            interfaceCompilationUnit = new TagUnit(this.tagLibrary, qname[0], qname[1], t, this.nextTagId());
            this.startUnit(interfaceCompilationUnit);
        }       
        else if (isCompositeComponentImplementation(qname[0], qname[1]))
        {
            log.fine("Composite component Found, Popping Parent Tags");
            this.units.clear();
            NamespaceUnit nsUnit = this.namespaceManager.toNamespaceUnit(this.tagLibrary);
            this.units.push(nsUnit);
            CompositeComponentUnit compositeRootCompilationUnit = new CompositeComponentUnit();
            this.startUnit(compositeRootCompilationUnit);
            if (interfaceCompilationUnit != null)
            {
                this.currentUnit().addChild(interfaceCompilationUnit);
                interfaceCompilationUnit = null;
            }
            this.startUnit(new TrimmedTagUnit(this.tagLibrary, qname[0], qname[1], t, this.nextTagId()));
            log.fine("New Namespace and TagUnit pushed");
        }       
        else if (this.tagLibrary.containsTagHandler(qname[0], qname[1]))
        {
            this.startUnit(new TagUnit(this.tagLibrary, qname[0], qname[1], t, this.nextTagId()));
        }
        else if (this.tagLibrary.containsNamespace(qname[0]))
        {
            throw new TagException(orig, "Tag Library supports namespace: " + qname[0]
                    + ", but no tag was defined for name: " + qname[1]);
        }
        else
        {
            TextUnit unit;
            if (this.currentUnit() instanceof TextUnit)
            {
                unit = (TextUnit) this.currentUnit();
            }
            else
            {
                unit = new TextUnit(this.alias, this.nextTagId(), faceletsProcessingInstructions.isEscapeInlineText());
                this.startUnit(unit);
            }
           
            if (this.compiler.isDevelopmentProjectStage())
            {
                String qName = null;
                boolean isPrefixed = false;
                TagAttribute jsfc = t.getAttributes().get("jsfc");
                if (jsfc != null)
                {
                    qName = jsfc.getValue();
                    if (jsfc.getValue().indexOf(':') > 0)
                    {
                        isPrefixed = true;
                    }
                }
                else if (t.getQName().indexOf(':') > 0 )
                {
                    qName = t.getQName();
                    isPrefixed = true;
                }
                if (isPrefixed)
                {
                    unit.addMessage(FacesMessage.SEVERITY_WARN,
View Full Code Here


        this.units.push(unit);
    }

    private Tag trimAttributes(Tag tag)
    {
        Tag t = this.trimJSFCAttribute(tag);
        t = this.trimNSAttributes(t);
        return t;
    }
View Full Code Here

                if (!"jsfc".equals(oa[i].getLocalName()))
                {
                    na[p++] = oa[i];
                }
            }
            return new Tag(tag, new TagAttributesImpl(na));
        }
        return tag;
    }
View Full Code Here

                    continue;
                }
                attrList.add(attr[i]);
            }
            attr = attrList.toArray(new TagAttribute[attrList.size()]);
            return new Tag(tag.getLocation(), tag.getNamespace(), tag.getLocalName(), tag.getQName(),
                           new TagAttributesImpl(attr));
        }
    }
View Full Code Here

            this.inDocument = false;
        }

        public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
        {
            this.unit.pushTag(new Tag(this.createLocation(), uri, localName, qName, this.createAttributes(attributes)));
        }
View Full Code Here

            {
                this.inMetadata=true;
            }
            if (inMetadata)
            {
                this.unit.pushTag(new Tag(createLocation(), uri, localName, qName, createAttributes(attributes)));
            }
        }
View Full Code Here

        }
        return componentToTagMap.put((Integer) System.identityHashCode(c), t);
    }

    public static Tag getTagForComponent(FacesContext context, UIComponent c) {
        Tag result = null;
        Map<Object, Object> contextMap = context.getAttributes();
        Map<Integer, Tag> componentToTagMap;
        componentToTagMap = (Map<Integer, Tag>)
                contextMap.get(COMPONENT_TO_TAG_MAP_NAME);
        if (null != componentToTagMap) {
View Full Code Here

     * the TagDecorators return a value other than null.
     *
     * @see com.sun.faces.facelets.TagDecorator#decorate(com.sun.faces.facelets.Tag)
     */
    public Tag decorate(Tag tag) {
        Tag t = null;
        for (int i = 0; i < this.decorators.length; i++) {
            t = this.decorators[i].decorate(tag);
            if (t != null) {
                return t;
            }
View Full Code Here

     *
     * @see org.apache.myfaces.view.facelets.tag.TagDecorator#decorate(org.apache.myfaces.view.facelets.tag.Tag)
     */
    public Tag decorate(Tag tag)
    {
        Tag t = null;
        for (int i = 0; i < this.decorators.length; i++)
        {
            t = this.decorators[i].decorate(tag);
            if (t != null)
            {
View Full Code Here

        if (XhtmlNamespace.equals(tag.getNamespace()))
        {
            String n = tag.getLocalName();
            if ("a".equals(n))
            {
                return new Tag(tag.getLocation(), HtmlLibrary.Namespace, "commandLink", tag.getQName(), tag
                        .getAttributes());
            }
            if ("form".equals(n))
            {
                return new Tag(tag.getLocation(), HtmlLibrary.Namespace, "form", tag.getQName(), tag.getAttributes());
            }
            if ("input".equals(n))
            {
                TagAttribute attr = tag.getAttributes().get("type");
                if (attr != null)
                {
                    String t = attr.getValue();
                    TagAttributes na = removeType(tag.getAttributes());
                    if ("text".equals(t))
                    {
                        return new Tag(tag.getLocation(), HtmlLibrary.Namespace, "inputText", tag.getQName(), na);
                    }
                    if ("password".equals(t))
                    {
                        return new Tag(tag.getLocation(), HtmlLibrary.Namespace, "inputSecret", tag.getQName(), na);
                    }
                    if ("hidden".equals(t))
                    {
                        return new Tag(tag.getLocation(), HtmlLibrary.Namespace, "inputHidden", tag.getQName(), na);
                    }
                    if ("submit".equals(t))
                    {
                        return new Tag(tag.getLocation(), HtmlLibrary.Namespace, "commandButton", tag.getQName(), na);
                    }
                }
            }
        }
        return null;
View Full Code Here

TOP

Related Classes of javax.faces.view.facelets.Tag

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.