com.taggercat.template.tags
Class ForEachTableRowTag

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

public class ForEachTableRowTag
extends javax.servlet.jsp.tagext.TagSupport

This tag is used to create a nicely wrapped HTML table from a list of fields. This is accomplished in two steps:

1) It takes a list of fields, and wraps it into n columns by m rows needed to form an HTML table. The number of columns is determined by the "breakFields" attribute. When one of the breakFields is found in the selected fields list a new column is added.

2) Once the number of rows and columns in the table are determined, the tag enumerates the field names in each tcEntity.

If there are cells in the last column that have no corresponding fields, those cells are padded out with fieldNames set to an empty string.

This tag is the parent tag of the ForEachTableRowField tag. The ForEachTableRowField tag iterates over each field in the current tcEntity or an explicit field list.

See Also:
Serialized Form
 

Field Summary
 
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
ForEachTableRowTag()
           
 
Method Summary
 int doAfterBody()
           
 int doEndTag()
           
 int doStartTag()
           
 java.util.List getCurrentRowFieldList()
           
 int getNumHTMLTableRows(java.util.List selcetedFields, java.util.List breakFields)
          Determines the number of rows in the table by finding the index of the first selected field name that matches one of the break field names.
 void setBreakFields(java.lang.String breakAfter)
           
 void setSelectedFields(java.lang.String selectedFields)
           
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ForEachTableRowTag

public ForEachTableRowTag()
Method Detail

doEndTag

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

doStartTag

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

doAfterBody

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

setSelectedFields

public void setSelectedFields(java.lang.String selectedFields)

setBreakFields

public void setBreakFields(java.lang.String breakAfter)

getCurrentRowFieldList

public java.util.List getCurrentRowFieldList()

getNumHTMLTableRows

public int getNumHTMLTableRows(java.util.List selcetedFields,
                               java.util.List breakFields)
Determines the number of rows in the table by finding the index of the first selected field name that matches one of the break field names.

Parameters:
selcetedFields - the list of selected fields
breakFields - the list of fields to potentially break on
Returns:
the rows the table is going to have