org.codehaus.groovy.grails.web.taglib
Class GroovySyntaxTag

java.lang.Object
  extended by org.codehaus.groovy.grails.web.taglib.GroovySyntaxTag
All Implemented Interfaces:
GrailsTag
Direct Known Subclasses:
GroovyCollectTag, GroovyDefTag, GroovyEachTag, GroovyElseIfTag, GroovyElseTag, GroovyFindAllTag, GroovyGrepTag, GroovyIfTag, GroovyWhileTag

public abstract class GroovySyntaxTag
extends Object
implements GrailsTag

A tag type that gets translated directly into Groovy syntax by the GSP parser.

This is used for Java-implemented internal tags that the Parse class uses to directly inject code into the generated GSP source. These tags can do more than custom taglibs as the operate at the code level, rather than at the runtime view rendering level

Since:
11-Jan-2006
Author:
Graeme Rocher

Field Summary
protected static String ATTRIBUTE_IN
           
protected static String ATTRIBUTE_VAR
           
protected  Map attributes
           
protected static String ATTRIBUTES_STATUS
           
protected  PrintWriter out
           
protected  GroovyPageParser parser
           
protected  Map tagContext
           
 
Constructor Summary
GroovySyntaxTag()
           
 
Method Summary
protected  String calculateExpression(String expr)
           
protected  void doEachMethod(String in)
           
 void init(Map tagContext)
           
abstract  boolean isAllowPrecedingContent()
          Tags must return the correct value to indicate whether or not non-whitespace content is permitted before this tag.
abstract  boolean isKeepPrecedingWhiteSpace()
          Tags must return the correct value to indicate whether or not whitespace before this tag should be kept in the output.
 void setAttribute(String name, Object value)
          Sets an attribute of the tag
 void setAttributes(Map attributes)
          Sets the attributes of the tag
 void setWriter(Writer w)
          Sets the writer that processes the tag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.codehaus.groovy.grails.web.taglib.GrailsTag
doEndTag, doStartTag, getName
 

Field Detail

ATTRIBUTE_IN

protected static final String ATTRIBUTE_IN
See Also:
Constant Field Values

ATTRIBUTE_VAR

protected static final String ATTRIBUTE_VAR
See Also:
Constant Field Values

ATTRIBUTES_STATUS

protected static final String ATTRIBUTES_STATUS
See Also:
Constant Field Values

tagContext

protected Map tagContext

out

protected PrintWriter out

attributes

protected Map attributes

parser

protected GroovyPageParser parser
Constructor Detail

GroovySyntaxTag

public GroovySyntaxTag()
Method Detail

init

public void init(Map tagContext)
Specified by:
init in interface GrailsTag

setWriter

public void setWriter(Writer w)
Description copied from interface: GrailsTag
Sets the writer that processes the tag

Specified by:
setWriter in interface GrailsTag

setAttributes

public void setAttributes(Map attributes)
Description copied from interface: GrailsTag
Sets the attributes of the tag

Specified by:
setAttributes in interface GrailsTag

setAttribute

public void setAttribute(String name,
                         Object value)
Description copied from interface: GrailsTag
Sets an attribute of the tag

Specified by:
setAttribute in interface GrailsTag

isKeepPrecedingWhiteSpace

public abstract boolean isKeepPrecedingWhiteSpace()

Tags must return the correct value to indicate whether or not whitespace before this tag should be kept in the output.

This is for tags that must follow other tags, such as g:else or g:elseif that do not allow content between them and the previous tag, and need to swallow the whitespace between them.

Returns:
True if any whitespace immediately before the tag should be kept in the output - false if it is to be discarded

isAllowPrecedingContent

public abstract boolean isAllowPrecedingContent()

Tags must return the correct value to indicate whether or not non-whitespace content is permitted before this tag.

This is for tags that must follow other tags, such as g:else or g:elseif that do not allow content between them and the previous tag. It is simply used as a safety mechanism to trap incorrect usage of tags.

Returns:
True if any content is allowed immediately before the tag - false if it is an error to have such content before it
To do:
rework this and combine with isKeepPrecedingWhiteSpace as really they are used in the same situations

calculateExpression

protected String calculateExpression(String expr)

doEachMethod

protected void doEachMethod(String in)
Parameters:
in -


Copyright (c) 2005-2009 The Grails project