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());
                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

        }
    }

    public void endTag()
    {
        Tag tag = (Tag) this.tags.pop();

        if (HTML.BODY_ELEM.equalsIgnoreCase(tag.getQName()))
        {
            this.addInstruction(new BodyEndElementInstruction(tag.getQName()));
        }
        else
        {
            this.addInstruction(new EndElementInstruction(tag.getQName()));           
        }

        if (this.startTagOpen)
        {
            this.buffer.append("/>");
            this.startTagOpen = false;
        }
        else
        {
            this.buffer.append("</").append(tag.getQName()).append('>');
        }
    }
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(this.createLocation(), uri, localName, qName, this.createAttributes(attributes)));
            }
        }
View Full Code Here

                }
            }
           
            if (inCompositeInterface)
            {
                this.unit.pushTag(new Tag(this.createLocation(), uri, localName, qName, this.createAttributes(attributes)));
            }
            else if (inCompositeImplementation && CompositeLibrary.NAMESPACE.equals(uri))
            {
                if ("insertFacet".equals(localName)    ||
                    "renderFacet".equals(localName)    ||
                    "insertChildren".equals(localName) ||
                    ImplementationHandler.NAME.equals(localName)   )
                {
                    this.unit.pushTag(new Tag(this.createLocation(), uri, localName, qName, this.createAttributes(attributes)));
                }
            }
        }
View Full Code Here

        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

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.