org.codehaus.waffle.taglib.internal
Class BasicTag

java.lang.Object
  extended by org.codehaus.waffle.taglib.internal.BasicTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag
Direct Known Subclasses:
FormElement, FormTag, HiddenTag

public abstract class BasicTag
extends java.lang.Object
implements javax.servlet.jsp.tagext.BodyTag

A basic tag. This class has been created in order to be extended.

Author:
Guilherme Silveira, Nico Steppat

Field Summary
protected  javax.servlet.jsp.PageContext pageContext
           
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
BasicTag()
           
 
Method Summary
protected  IterationResult afterBody(javax.servlet.jsp.JspWriter out)
          To be implemented by child classes that want to do something after the body.
protected  void beforeBody(java.io.Writer out)
          Executes something before body evaluation.
 int doAfterBody()
           
 int doEndTag()
           
 void doInitBody()
           
 int doStartTag()
           
protected  void end(java.io.Writer out)
          Ends this tag.
protected  java.lang.String evaluate(java.lang.String expression)
          Evaluates some expression.
protected  java.lang.String evaluateEl(java.lang.String expression)
          Evaluates this expression in EL.
protected
<T> T
findAncestor(java.lang.Class<T> type)
          Searchs a parent tag that implements the selected type.
 java.lang.String getAbsoluteUrl(java.lang.String url)
          Fixes the absolute urls appending the context name.
 java.lang.String getI18NMessage(java.lang.String key)
          Returns the i18n message for some key
 javax.servlet.jsp.tagext.Tag getParent()
           
 boolean isRendered()
           
 void release()
           
 void setBodyContent(javax.servlet.jsp.tagext.BodyContent bodyContent)
           
 void setPageContext(javax.servlet.jsp.PageContext pageContext)
           
 void setParent(javax.servlet.jsp.tagext.Tag parent)
           
 void setRendered(boolean rendered)
           
protected abstract  IterationResult start(java.io.Writer out)
          Starts this tag once.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pageContext

protected javax.servlet.jsp.PageContext pageContext
Constructor Detail

BasicTag

public BasicTag()
Method Detail

findAncestor

protected <T> T findAncestor(java.lang.Class<T> type)
Searchs a parent tag that implements the selected type.

Type Parameters:
T - the type to search
Parameters:
type - the class type to search
Returns:
the tag found or null if not found

getParent

public javax.servlet.jsp.tagext.Tag getParent()
Specified by:
getParent in interface javax.servlet.jsp.tagext.Tag

setRendered

public void setRendered(boolean rendered)

release

public void release()
Specified by:
release in interface javax.servlet.jsp.tagext.Tag

setPageContext

public void setPageContext(javax.servlet.jsp.PageContext pageContext)
Specified by:
setPageContext in interface javax.servlet.jsp.tagext.Tag

setParent

public void setParent(javax.servlet.jsp.tagext.Tag parent)
Specified by:
setParent in interface javax.servlet.jsp.tagext.Tag

getI18NMessage

public java.lang.String getI18NMessage(java.lang.String key)
Returns the i18n message for some key

Parameters:
key - the key to search for
Returns:
the i18n message

getAbsoluteUrl

public java.lang.String getAbsoluteUrl(java.lang.String url)
Fixes the absolute urls appending the context name.

Parameters:
url - the original url
Returns:
the fixed url

evaluate

protected java.lang.String evaluate(java.lang.String expression)
                             throws javax.servlet.jsp.JspException
Evaluates some expression.

Throws:
javax.servlet.jsp.JspException

evaluateEl

protected java.lang.String evaluateEl(java.lang.String expression)
                               throws javax.servlet.jsp.JspException
Evaluates this expression in EL. Returns the same as evaluate("${" + expression + "}");

Parameters:
expression - expression in EL.
Throws:
javax.servlet.jsp.JspException

setBodyContent

public void setBodyContent(javax.servlet.jsp.tagext.BodyContent bodyContent)
Specified by:
setBodyContent in interface javax.servlet.jsp.tagext.BodyTag

doInitBody

public void doInitBody()
                throws javax.servlet.jsp.JspException
Specified by:
doInitBody in interface javax.servlet.jsp.tagext.BodyTag
Throws:
javax.servlet.jsp.JspException

doAfterBody

public int doAfterBody()
                throws javax.servlet.jsp.JspException
Specified by:
doAfterBody in interface javax.servlet.jsp.tagext.IterationTag
Throws:
javax.servlet.jsp.JspException

afterBody

protected IterationResult afterBody(javax.servlet.jsp.JspWriter out)
                             throws java.io.IOException
To be implemented by child classes that want to do something after the body.

Parameters:
out - the writer
Throws:
java.io.IOException

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Throws:
javax.servlet.jsp.JspException

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Throws:
javax.servlet.jsp.JspException

start

protected abstract IterationResult start(java.io.Writer out)
                                  throws javax.servlet.jsp.JspException,
                                         java.io.IOException
Starts this tag once.

Throws:
javax.servlet.jsp.JspException
java.io.IOException

beforeBody

protected void beforeBody(java.io.Writer out)
                   throws javax.servlet.jsp.JspException,
                          java.io.IOException
Executes something before body evaluation.

Throws:
javax.servlet.jsp.JspException
java.io.IOException

end

protected void end(java.io.Writer out)
            throws javax.servlet.jsp.JspException,
                   java.io.IOException
Ends this tag.

Throws:
javax.servlet.jsp.JspException
java.io.IOException

isRendered

public boolean isRendered()


Copyright © 2008. All Rights Reserved.