Package org.apache.commons.jelly

Examples of org.apache.commons.jelly.Tag


    protected Tag findDynamicTag(JellyContext context, StaticTag tag) throws Exception {
        // lets see if there's a tag library for this URI...
        TagLibrary taglib = context.getTagLibrary( tag.getUri() );
        if ( taglib instanceof DynamicTagLibrary ) {
            DynamicTagLibrary dynaLib = (DynamicTagLibrary) taglib;
            Tag newTag = dynaLib.createTag( tag.getLocalName() );
            if ( newTag != null ) {
                newTag.setParent( tag.getParent() );
                newTag.setBody( tag.getBody() );
                return newTag;
            }
        }
        return tag;
    }
View Full Code Here


                tagScript = createStaticTag(namespaceURI, localName, qName, list);
            }
            tagScriptStack.add(tagScript);
            if (tagScript != null) {
                // set parent relationship...
                Tag tag = tagScript.getTag();
                tag.setParent(parentTag);

                // set the namespace Map
                if ( elementNamespaces != null ) {
                    tagScript.setNamespacesMap( elementNamespaces );
                    elementNamespaces = null;
                }               
               
                // set the line number details
                if ( locator != null ) {
                    tagScript.setLocator(locator);
                }
                // sets the file name element names
                tagScript.setFileName(fileName);
                tagScript.setElementName(qName);
               
                // pop another tag onto the stack
                if ( parentTag != null ) {
                    tagStack.add( parentTag );               
                }
                parentTag = tag;               
               
                if (textBuffer.length() > 0) {
                    addTextScript(textBuffer.toString());
                    textBuffer.setLength(0);
                }
                script.addScript(tagScript);
                // start a new body
                scriptStack.push(script);
                script = new ScriptBlock();
                tag.setBody(script);
            }
            else {
                // XXXX: might wanna handle empty elements later...
                textBuffer.append("<");
                textBuffer.append(qName);
View Full Code Here

            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

            script.run(context, output);
        }
        else {
            // note this mechanism does not work properly for arbitrarily
            // nested dynamic tags. A better way is required.
            Tag tag = findAncestorWithClass(this, DynamicTag.class);
            if (tag == null) {
                throw new JellyException("Cannot invoke body, no dynamic tag is defined in this block");
            }
            else {
                tag.invokeBody(output);
            }
        }
    }
View Full Code Here

        Project project = getProject();
       
        // custom Ant tags
        if ( name.equals("fileScanner") ) {           
            Tag tag = new FileScannerTag(new FileScanner(project));
            return TagScript.newInstance(tag);
        }

        AntTag tag = new AntTag( getProject(), name );
        if ( name.equals( "echo" ) ) {
            tag.setTrim(false);
        }
        return TagScript.newInstance(tag);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.jelly.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.