Examples of TagScript


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

        if (value instanceof Class) {
            Class type = (Class) value;
            return TagScript.newInstance(type);
        }
        else if (value instanceof TagFactory) {
            return new TagScript( (TagFactory) value );
        }
        return null;

    }
View Full Code Here

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

        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

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

                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

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

                        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

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

        if (value instanceof Class) {
            Class type = (Class) value;
            return TagScript.newInstance(type);
        }
        else if (value instanceof TagFactory) {
            return new TagScript( (TagFactory) value );
        }
        return null;

    }
View Full Code Here

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

                        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

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

        if (body instanceof ScriptBlock) {
            ScriptBlock block = (ScriptBlock) body;
            for (Iterator iter = block.getScriptList().iterator(); iter.hasNext();) {
                Script script = (Script) iter.next();
                if (script instanceof TagScript) {
                    TagScript tagScript = (TagScript) script;
                    Tag tag = tagScript.getTag();
                    if (tag instanceof WhenTag) {
                        whenTagList.add(tagScript);
                    }
                    else if (tag instanceof OtherwiseTag) {
                        otherwiseTag = tagScript;
                        break;
                    }
                }
            }
        }
        else if (body instanceof TagScript) {
            // if only one child tag
            TagScript tagScript = (TagScript) body;
            Tag tag = tagScript.getTag();
            if (tag instanceof WhenTag) {
                whenTagList.add(tagScript);
            }
            else if (tag instanceof OtherwiseTag) {
                otherwiseTag = tagScript;
View Full Code Here

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

   
    // Tag interface
    //-------------------------------------------------------------------------
    public void doTag(XMLOutput output) throws Exception {
        for (int i = 0, size = whenTags.length; i < size; i++) {
            TagScript script = whenTags[i];
            script.run(context, output);
            WhenTag tag = (WhenTag) script.getTag();
            if (tag.getValue()) {
                return;
            }
        }
        if (otherwiseTag != null) {
View Full Code Here

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

    }

    public TagScript createTagScript(String name,
                                     Attributes attrs) throws Exception
    {
        TagScript script = super.createTagScript( name, attrs );

        if ( script == null ) {

            // script = this.coreTagLib.createTagScript( name, attrs );
View Full Code Here

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
TOP
Copyright © 2018 www.massapi.com. 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.