Package javax.faces.view.facelets

Examples of javax.faces.view.facelets.TagAttributes


        }
    }
   
    private TagAttributes convertTagAttributes(Tag tag)
    {
        TagAttributes tagAttributes = tag.getAttributes();
        TagAttribute elementNameTagAttribute = new TagAttributeImpl(
            tag.getLocation(), PASS_THROUGH_NAMESPACE , Renderer.PASSTHROUGH_RENDERER_LOCALNAME_KEY,
            P_ELEMENTNAME, tag.getLocalName() );
        TagAttribute[] sourceTagAttributes = tag.getAttributes().getAll();
        TagAttribute[] convertedTagAttributes = new TagAttribute[sourceTagAttributes.length+1];
        boolean elementNameTagAttributeSet = false;
           
        for (int i = 0; i < sourceTagAttributes.length; i++)
        {
            TagAttribute tagAttribute = sourceTagAttributes[i];
            String convertedNamespace;
            String qname;
            String namespace = tagAttribute.getNamespace();
            if (JSF_NAMESPACE.equals(namespace) || JSF_ALIAS_NAMESPACE.equals(namespace))
            {
                // "... If the current attribute's namespace is http://xmlns.jcp.org/jsf, convertedTagAttribute's
                //  qualified name must be the current attribute's local name and convertedTagAttribute's
                // namespace must be the empty string. This will have the effect of setting the current
                // attribute as a proper property on the UIComponent instance represented by this markup.
                convertedNamespace = "";
                qname = tagAttribute.getLocalName();
               
                convertedTagAttributes[i] = new TagAttributeImpl(tagAttribute.getLocation(),
                    convertedNamespace, tagAttribute.getLocalName(), qname, tagAttribute.getValue());
               
                if (Renderer.PASSTHROUGH_RENDERER_LOCALNAME_KEY.equals(tagAttribute.getLocalName()))
                {
                    elementNameTagAttributeSet = true;
                }
            }
            else if (namespace == null)
            {
                // should not happen, but let it because org.xml.sax.Attributes considers it
                convertedTagAttributes[i] = tagAttribute;
            }
            else if (tagAttribute.getNamespace().length() == 0)
            {
                // "... If the current attribute's namespace is empty
                // let the current attribute be convertedTagAttribute. ..."
                convertedTagAttributes[i] = tagAttribute;
            }
            else if (!tag.getNamespace().equals(tagAttribute.getNamespace()))
            {
                // "... or different from the argument tag's namespace,
                // let the current attribute be convertedTagAttribute. ..."
                convertedTagAttributes[i] = tagAttribute;
            }
            else
            {
                // "... Otherwise, assume the current attribute's namespace is http://xmlns.jcp.org/jsf/passthrough.
                // ConvertedTagAttribute's qualified name is the current attribute's local name prefixed by
                // p:". convertedTagAttribute's namespace must be http://xmlns.jcp.org/jsf/passthrough.
                convertedNamespace = PASS_THROUGH_NAMESPACE;
                qname = "p:"+tagAttribute.getLocalName();
               
                convertedTagAttributes[i] = new TagAttributeImpl(tagAttribute.getLocation(),
                    convertedNamespace, tagAttribute.getLocalName(), qname, tagAttribute.getValue());
            }
        }
       
        if (elementNameTagAttributeSet)
        {
            // This is unlikely, but theorically possible.
            return new TagAttributesImpl(Arrays.copyOf(convertedTagAttributes, sourceTagAttributes.length));
        }
        else
        {
            convertedTagAttributes[tagAttributes.getAll().length] = elementNameTagAttribute;
            return new TagAttributesImpl(convertedTagAttributes);
        }
    }
View Full Code Here


            {
                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))
View Full Code Here

            {
                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))
View Full Code Here

            {
                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))
View Full Code Here

            }
            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);
                    }
View Full Code Here

    String localName = "decorateAll";
    String qName = "decorateAll";
    given(this.templateTag.getNamespace()).willReturn(namespace);
    given(this.templateTag.getLocalName()).willReturn("template");
    given(this.templateTag.getValue(this.ctx)).willReturn(TEMPLATE);
    TagAttributes attributes = new TagAttributesImpl(new TagAttribute[] { this.templateTag });
    Tag tag = new Tag(location, namespace, localName, qName, attributes);
    given(this.tagConfig.getTag()).willReturn(tag);
    given(this.delegate.getType(this.component1)).willReturn(Type.COMPONENT);
    given(this.delegate.createdDecoratedChild(eq(this.component1), this.variableDeclarationHandlers1.capture()))
        .willReturn(this.decoratedComponent1);
View Full Code Here

    TagAttribute nameAttribute = mock(TagAttribute.class);
    given(nameAttribute.getLocalName()).willReturn("name");
    given(nameAttribute.getNamespace()).willReturn("");
    given(nameAttribute.isLiteral()).willReturn(true);
    given(nameAttribute.getValue()).willReturn("defineName");
    TagAttributes attributes = new TagAttributesImpl(new TagAttribute[] { nameAttribute });
    Tag tag = new Tag(new Location("", 0, 0), "", "", "", attributes);
    given(tagConfig.getTag()).willReturn(tag);
    given(tagConfig.getNextHandler()).willReturn(this.innerDefineHandler);
    DefineHandler defineHandler = new DefineHandler(tagConfig);
    return defineHandler;
View Full Code Here

    TagAttribute nameAttribute = mock(TagAttribute.class);
    given(nameAttribute.getLocalName()).willReturn("name");
    given(nameAttribute.getNamespace()).willReturn("");
    given(nameAttribute.isLiteral()).willReturn(true);
    given(nameAttribute.getValue()).willReturn("defineName");
    TagAttributes attributes = new TagAttributesImpl(new TagAttribute[] { nameAttribute });
    Tag tag = new Tag(new Location("", 0, 0), "", "", "", attributes);
    given(tagConfig.getTag()).willReturn(tag);
    given(tagConfig.getNextHandler()).willReturn(this.innerDefineHandler);
    DefineHandler defineHandler = new DefineHandler(tagConfig);
    return defineHandler;
View Full Code Here

            }
            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);
                    }
View Full Code Here

            }
            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);
                    }
View Full Code Here

TOP

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

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.