com.taggercat.tags
Class RepeatedRegionTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by com.taggercat.tags.AbstractExpEvalTag
          extended by com.taggercat.tags.RepeatedRegionTag
All Implemented Interfaces:
com.taggercat.el.ELPropertyResolver, java.io.Serializable, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag

public class RepeatedRegionTag
extends AbstractExpEvalTag

This tag bounds a repeated region associated with a DataSource. The contents in the region are repeated the specified size times, or until the end of the data source is reached.

See Also:
Serialized Form
 

Field Summary
static java.lang.Integer RRSTATE_ALL_ROWS
           
static java.lang.Integer RRSTATE_AT_END
           
static java.lang.Integer RRSTATE_AT_START
           
 
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
RepeatedRegionTag()
          Creates a new tag instance.
 
Method Summary
 int doAfterBody()
          Process the body of the tag, if the data source cursor is not past the last tcEntity and the max size has not been exceeded.
 int doEndTag()
          The iteration has completed, and saves the iteration count as a page context variable.
 int doStartTag()
          Process the start tag for this instance.
 TCEntity getCurrentRow()
           
 DataSource getDataSource()
          Returns the data source instance used in the repeated region.
 java.lang.String getDsn()
          Gets the data source name for the repeated region.
 int getRowsDisplayed()
          Get the number of rows currently displayed in the repeated region
 boolean isClearResultSet()
           
 void release()
           
 void setClearResultSet(boolean clearResultSet)
           
 void setCondition(java.lang.String condition)
          Sets the condition attribute.
 void setCurrentEntity(TCEntity currentRow)
           
 void setDsn(java.lang.String dsn)
          Sets the name of the data source.
 void setReset(java.lang.String reset)
          Sets the reset attribute.
 void setRowVar(java.lang.String rowVar)
          Sets the rowVar attribute.
 void setSize(java.lang.String size)
          Sets the max size ( number of iterations) the RepeatedRegionTag will process the contents.
 java.lang.String toString()
          Returns a description of the tags values.
 
Methods inherited from class com.taggercat.tags.AbstractExpEvalTag
getModel, resolveProperty, setScope, setValue, setVar
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RRSTATE_AT_START

public static final java.lang.Integer RRSTATE_AT_START

RRSTATE_AT_END

public static final java.lang.Integer RRSTATE_AT_END

RRSTATE_ALL_ROWS

public static final java.lang.Integer RRSTATE_ALL_ROWS
Constructor Detail

RepeatedRegionTag

public RepeatedRegionTag()
Creates a new tag instance.

Method Detail

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Process the start tag for this instance.

The doStartTag() method assumes that all setter methods have been invoked before.

When this method is invoked, the body has not yet been invoked.

Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class AbstractExpEvalTag
Throws:
javax.servlet.jsp.JspException
Returns:
EVAL_BODY_INCLUDE if the tag wants to process body, SKIP_BODY if it does not want to process it.

doAfterBody

public int doAfterBody()
                throws javax.servlet.jsp.JspException
Process the body of the tag, if the data source cursor is not past the last tcEntity and the max size has not been exceeded. The data source is set the next tcEntity on each iteration.

Specified by:
doAfterBody in interface javax.servlet.jsp.tagext.IterationTag
Overrides:
doAfterBody in class javax.servlet.jsp.tagext.TagSupport
Throws:
javax.servlet.jsp.JspException
Returns:
EVAL_BODY_TAG if the region should be evaluated again

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
The iteration has completed, and saves the iteration count as a page context variable.
The result set cleared if the corresponding clearResultSet attribute has been set.

Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class AbstractExpEvalTag
Throws:
javax.servlet.jsp.JspException - Thrown if writing to page fails.
Returns:
always returns EVAL_PAGE.

getDataSource

public DataSource getDataSource()
Returns the data source instance used in the repeated region. The data source is only valid while the repeated region is being processed.
Therefore this method should only be called from nested sub tags.

Returns:
returns the data source instance used in the repeated region

getDsn

public java.lang.String getDsn()
Gets the data source name for the repeated region.

Returns:
The data source name for the repeated region.

getRowsDisplayed

public int getRowsDisplayed()
Get the number of rows currently displayed in the repeated region

Returns:
the number of rows currently displayed

release

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

setDsn

public void setDsn(java.lang.String dsn)
Sets the name of the data source.

Parameters:
dsn - the new dsn value

setReset

public void setReset(java.lang.String reset)
Sets the reset attribute. If reset is "true" then the repeated region sets its data source cursor to the first tcEntity. Otherwise, the repeated region starts processing at the top of the page corresponding to the current tcEntity.

Parameters:
reset - the new reset value

setRowVar

public void setRowVar(java.lang.String rowVar)
Sets the rowVar attribute. This is the name of the instance variable of the current TCEntity within the repeated region. The scope of the variable is that of the repeated region.

Parameters:
rowVar - the new rowVar value

setSize

public void setSize(java.lang.String size)
Sets the max size ( number of iterations) the RepeatedRegionTag will process the contents.

Parameters:
size - the new size value

setCondition

public void setCondition(java.lang.String condition)
Sets the condition attribute.

Parameters:
condition - the new condition expression value

toString

public java.lang.String toString()
Returns a description of the tags values.

Overrides:
toString in class java.lang.Object
Returns:
a description of the tags values

getCurrentRow

public TCEntity getCurrentRow()

setCurrentEntity

public void setCurrentEntity(TCEntity currentRow)

isClearResultSet

public boolean isClearResultSet()

setClearResultSet

public void setClearResultSet(boolean clearResultSet)