Package org.apache.commons.jelly.impl

Examples of org.apache.commons.jelly.impl.TagScript


        return null;
    }

    @Override
    public TagScript createTagScript(final String tagName, Attributes attributes) throws JellyException {
        return new TagScript() {
            private Object evalAttribute(String name, JellyContext context) {
                ExpressionAttribute e = attributes.get(name);
                if (e==null)    return null;
                return e.exp.evaluate(context);
            }
View Full Code Here


        throws JellyException
    {

        if ( name.equals( "tagdef" ) )
        {
            return new TagScript( new TagFactory()
            {
                public Tag createTag( String name, Attributes attributes )
                {
                    return new TagDefTag( JeezTagLibrary.this );
                }
            } );
        }
        if ( name.equals( "target" ) )
        {
            return new TagScript( new TagFactory()
            {
                public Tag createTag( String name, Attributes attributes )
                {
                    return new TargetTag();
                }
            } );
        }

        TagScript script = werkzTagLib.createTagScript( name, attrs );
        if ( script == null )
        {
            script = antTagLib.createCustomTagScript( name, attrs );
            if ( script == null )
            {
                return new TagScript( new TagFactory()
                {
                    public Tag createTag( String name, Attributes attributes )
                        throws JellyException
                    {
                        // lets try create a dynamic tag first
View Full Code Here

     * Tests that the Tag in the TagScript has the given parent and then
     * recurse to check its children has the correct parent and so forth.
     */
    protected void assertTagsHaveParent(Script script, Tag parent) throws Exception {
        if ( script instanceof TagScript ) {
            TagScript tagScript = (TagScript) script;       
            Tag tag = tagScript.getTag();
           
            assertEquals( "Tag: " + tag + " has the incorrect parent", parent, tag.getParent() );
           
            assertTagsHaveParent( tag.getBody(), tag );
        }
View Full Code Here

        registerTag( "windowListener", WindowListenerTag.class );
    }

    /** Creates a new script to execute the given tag name and attributes */
    public TagScript createTagScript(String name, Attributes attributes) throws Exception {
        TagScript answer = super.createTagScript(name, attributes);
        if ( answer == null ) {
            final Factory factory = getFactory( name );
            if ( factory != null ) {
                return new DynaTagScript(
                    new TagFactory() {
View Full Code Here

                        return new TargetTag();
                    }
                }
            );
        }
        TagScript script = this.werkzTagLib.createTagScript( name, attrs );
        if ( script == null ) {
            script = antTagLib.createCustomTagScript( name, attrs );
            if ( script == null ) {
                return new DynaTagScript(
                    new TagFactory() {
View Full Code Here


    /** Creates a new script to execute the given tag name and attributes */
    public TagScript createTagScript(final String name, Attributes attributes) throws Exception {

        TagScript answer = createCustomTagScript(name, attributes);
        if ( answer == null ) {
            answer = new DynaTagScript(
                new TagFactory() {
                    public Tag createTag() throws Exception {
                        return AntTagLibrary.this.createTag(name);
View Full Code Here

                namespaceURI = "";
            }
           
            // if this is a tag then create a script to run it
            // otherwise pass the text to the current body
            TagScript parentTagScript = tagScript;
            tagScript = createTag(namespaceURI, localName, list);
            if (tagScript == null) {
                tagScript = createStaticTag(namespaceURI, localName, qName, list);
            }
            tagScriptStack.add(tagScript);
View Full Code Here

                        log.warn("Could not load class: " + uri + " so disabling the taglib");
                    }
                }
            }
            if (taglib != null) {
                TagScript script = taglib.createTagScript(localName, list);
                if ( script != null ) {
                    // now iterate through through the expressions
                    int size = list.getLength();
                    for (int i = 0; i < size; i++) {
                        String attributeName = list.getLocalName(i);
                        String attributeValue = list.getValue(i);
                        Expression expression =
                            taglib.createExpression(
                                getExpressionFactory(),
                                localName,
                                attributeName,
                                attributeValue);
                        if (expression == null) {
                            expression = createConstantExpression(localName, attributeName, attributeValue);
                        }
                        script.addAttribute(attributeName, expression);
                    }
                }
                return script;
            }
            return null;
View Full Code Here

                namespaceURI = "";
            }

            // if this is a tag then create a script to run it
            // otherwise pass the text to the current body
            TagScript newTagScript = createTag(namespaceURI, localName, list);
            if (newTagScript == null) {
                newTagScript = createStaticTag(namespaceURI, localName, qName, list);
            }
            tagScript = newTagScript;
            tagScriptStack.add(tagScript);
View Full Code Here

                        throw createSAXException("Class is not a TagLibrary: " + uri + " so taglib instantiation failed",e);
                    }
                }
            }
            if (taglib != null) {
                TagScript script = taglib.createTagScript(localName, list);
                if ( script != null ) {
                    configureTagScript(script);

                    // clone the attributes to keep them around after this parse
                    script.setSaxAttributes(new AttributesImpl(list));

                    // now iterate through through the expressions
                    int size = list.getLength();
                    for (int i = 0; i < size; i++) {
                        String attributeName = list.getLocalName(i);
                        String attributeValue = list.getValue(i);
                        Expression expression =
                            taglib.createExpression(
                                getExpressionFactory(),
                                script,
                                attributeName,
                                attributeValue);
                        if (expression == null) {
                            expression = createConstantExpression(localName, attributeName, attributeValue);
                        }
                        script.addAttribute(attributeName, expression);
                    }
                }
                return script;
            }
            return null;
View Full Code Here

TOP

Related Classes of org.apache.commons.jelly.impl.TagScript

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.