BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs.

com.bea.wlw.netui.tags.databinding.cellrepeater
Class CellRepeater

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by javax.servlet.jsp.tagext.BodyTagSupport
          extended by com.bea.wlw.netui.tags.AbstractBaseTag
              extended by com.bea.wlw.netui.tags.DataSourceTag
                  extended by com.bea.wlw.netui.tags.databinding.cellrepeater.CellRepeater
All Implemented Interfaces:
DataAccessProvider, HtmlConstants, Serializable, javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag

public class CellRepeater
extends DataSourceTag
implements DataAccessProvider

The CellRepeater tag is a repeating, databound tag that renders its body each cell of a table of the specified dimensions. The tag is bound to a dataset that is specified in the dataSource attribute. For each item in the data set, the body of this tag is rendered, and NetUI tags in the body that are databound can use the container.item syntax to access the "current" data item in the iteration. Properties on this data item can be accessed using expressions.

The tag will automatically insert the open and close table, row, and cell tags which will comprise the table that is rendered. Style attributes may be set using attributes on this tag in order to cusotmize the tag's final appearance. The dimensions of the table are specified by using at least one of the attributes columns and rows. If only one is specified, the other will be inferred by using the size of the given data set. As a result, the entire dataset will be rendered. For example, if a table should be four columns wide and the data set has twenty items, the resulting table will have five rows. If the data set is fewer items than the number of cells that should be rendered, the cells are padded with HTML table cells:

     <td>&nbsp;</td>
 

This will prevent rendering a malformed HTML table. If the number of cells to render is smaller than the fully specified dimensions of the table, only this number of cells will be rendered. For example, if the data set is size fifty but the rows and the columns attributes are both seven, only the first forty-nine items in the dataset will be rendered and the fiftieth will not be shown. The values of the rows and the columns can be databound with an expression; in this case, each value will be converted into an integer. An error will be reported on the page if this conversion fails.

This tag implements the DataAccessProvider interface which provides tags access to the "current" data item. Properties on the DataAccessProvider interface are available through the "container" binding context, which can be used inside of the body of the CellRepeater. Properties of the DataAccessProvider interface that are available include:

NameDescription
indexthe current index in the iteration; this index is absolute to the dataset
parentany DataAccessProvider parent of this tag
itemthe current data item

Note: the metadata property of the container binding context is not supported on the CellRepeater.

Attribute Descriptions
AttributeRequiredRuntime Expression EvaluationData Bindable
alternatingCellClassNoNoNo
The CSS style class to render on every other generated table cell; the cell class is used if this attribute is not set. The starting cell is alternated for each row, which results in a checkerboard colored table being displayed. For example, if the alteranting cell class value is \"alternatingCellClass\", every other table cell tag in the rendered JSP is:
    <td class="alternatingCellClass">
 
cellClassNoNoNo
The CSS style class to render on generated table cells.
columnsNoNoYes
A data bindable attribute that specifies how many columns should appear in the generated table; the value should either be a String which can be converted into an expression that references an int or Integer. If the columns attribute was specified but the rows attribute was not, the rows attribute is inferred using the size of the dataset.
dataSourceNoNoYes
An expression that references a dataset that should be rendered by the cellRepeater. If there was no data in the dataset but the rows and columns attributes were specified, an empty table of the given dimensions is rendered.
rowClassNoNoNo
The CSS style class to render on every generated table row.
rowsNoNoYes
A data bindable attribute that specifies how many rows should appear in the generated table; the value should either be a String which can be converted into an integer or an expression that references an int or Integer. If the rows attribute was specified but the columns attribute was not, the columns attribute is inferred using the size of the dataset.
tableClassNoNoNo
The CSS style class to render on the generated table.
verticalRepeatNoNoNo
The boolean that specifies in which direction to repeat the cells, horizontally or vertically. If the rows are rendered horizontally, the items in the dataset are rendered across each row from top to bottom. Otherwise, they are rendered down each column from left to right. The default is to render the items horizontally.

See Also:
Serialized Form
Example:
In the following sample, the <netui-data:cellRepeater> tag creates a table with a certain number of columns, as given in {pageFlow.numColumns} and as many rows as necessary to display all the items in the data set.
    <netui-data:cellRepeater dataSource="{pageFlow.itemArray}" columns="{pageFlow.numColumns}" >
        Item: <netui:label value="{container.item}"/>
    </netui-data:cellRepeater> 
 

Code Sample

[BEA_HOME]/weblogic81/samples/workshop/SamplesApp/WebApp/tagSamples/netui_databinding/cellRepeater/

Beadoc.see:
<netui-data:cellRepeater> Tag Sample
Beadoc.tagdescription:

The <netui-data:cellRepeater> tag renders individual cells of an HTML table. The tag is data bound to a data set specified in the dataSource attribute. Other <netui...> tags in the body of <netui-data:cellRepeater> can use the expression {container.item} to access the current data item in the data set.

The tag will automatically generate the open and close table, row, and cell tags. Style attributes may be set using attributes on this tag in order to customize the rendered table's final appearance. The dimensions of the table are specified with the attributes columns and rows. If only one dimension is specified, the other will be inferred by using the size of the given data set. As a result, the entire dataset will be rendered. For example, if the columns attribute is set to 4 and the data set has 20 items, the resulting table will have 5 rows. If the data set has fewer items than the number of cells that should be rendered, the cells are padded with HTML table cells:

     <td>&nbsp;</td>

This will prevent rendering a malformed HTML table. If the number of cells to render is smaller than the fully specified dimensions of the table, only this number of cells will be rendered. For example, if the data set 50 items but the rows and the columns attributes are both 7, only the first 49 items in the dataset will be rendered and the 50th will not be shown. The values of the rows and the columns can take a data binding expression; in this case, each value will be converted into an integer. An error will be reported on the page if this conversion fails.

Note: the metadata property of the {container...} binding context is not supported in the <netui-data:cellRepeater> tag.


Field Summary
 
Fields inherited from class com.bea.wlw.netui.tags.AbstractBaseTag
ATTR_GENERAL, ATTR_GENERAL_EXPRESSION, ATTR_JAVASCRIPT, ATTR_STYLE, JAVASCRIPT_STATUS, NETUI_UNIQUE_CNT
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface com.bea.wlw.netui.tags.html.HtmlConstants
ACCEPT, ACCESSKEY, ACTION, ALIGN, ALINK, ALT, ANCHOR, BACKGROUND, BASE, BGCOLOR, BODY, BORDER, BR, CAPTION, CELLPADDING, CELLSPACING, CHAR, CHAROFF, CHARSET, CHECKED, CLASS, COLS, COORDS, DIR, DISABLED, DIV, ENCTYPE, FOR, FORM, FORM_GET, FORM_POST, FRAME, HEIGHT, HREF, HREFLANG, HSPACE, HTML, ID, IMAGE, INPUT, INPUT_BUTTON, INPUT_CHECKBOX, INPUT_FILE, INPUT_HIDDEN, INPUT_IMAGE, INPUT_PASSWORD, INPUT_RADIO, INPUT_RESET, INPUT_SUBMIT, INPUT_TEXT, ISMAP, LABEL, LANG, LINK, LONGDESC, MAXLENGTH, METHOD, NAME, ONBLUR, ONCHANGE, ONCLICK, ONDBLCLICK, ONFOCUS, ONKEYDOWN, ONKEYPRESS, ONKEYUP, ONLOAD, ONMOUSEDOWN, ONMOUSEMOVE, ONMOUSEOUT, ONMOUSEOVER, ONMOUSEUP, ONRESET, ONSELECT, ONSUBMIT, ONUNLOAD, OPTION, READONLY, REL, REV, ROWS, RULES, SELECT, SHAPE, SIZE, SPAN, SRC, STYLE, SUMMARY, TABINDEX, TABLE, TARGET, TD, TEXT, TEXTAREA, TITLE, TR, TYPE, USEMAP, VALIGN, VALUE, VLINK, VSPACE, WIDTH
 
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
CellRepeater()
           
 
Method Summary
 void addContent(String content)
          Add content to the content that is being buffered by this tag.
 int doAfterBody()
          Continue rendering the body of this tag until the dimensions of the table have been reached or the entire dataset has been rendered.
 int doEndTag()
          Complete rendering the tag.
 int doStartTag()
          Prepare to render the dataset that was specified in the dataSource attribute.
 String getAlternatingCellClass()
          Get the HTML style class for every other table cell that is rendered in the HTML table that is rendered by this tag.
 String getCellClass()
          Get the HTML style class for a table cell that is rendered in the HTML table that is rendered by this tag.
 String getColumns()
          Get the number of columns that should be rendered in the table generated by this tag.
 String getContent()
          Get the content which should be rendered by this tag.
 int getCurrentIndex()
          Get the index of the current iteration through the body of this tag.
 Object getCurrentItem()
          Get the item that is currently being rendered by this repeating tag.
 Object getCurrentMetadata()
          Get the metadata for the current item.
 DataAccessProvider getProviderParent()
          Get the parent DataAccessProvider for this tag.
 String getRowClass()
          Get the HTML style class for a table row that is rendered in the HTML table that is rendered by this tag.
 String getRows()
          Get the number of rows that should be rendered in the table generated by this tag.
 String getTableClass()
          Get the HTML style class for the table that is rendered in the HTML table that is opened by this tag.
 String getTagName()
          Get the name of this tag.
 boolean getVerticalRepeat()
          Get the repeat direction.
protected  void localRelease()
          Reset all of the fields of this tag.
 void setAlternatingCellClass(String alternatingCellClass)
          Set the HTML style class that is rendered on each HTML table cell that is opened by this tag.
 void setCellClass(String cellClass)
          Set the HTML style class that is rendered on each HTML table cell.
 void setColumns(String columnsString)
          Set the number of columns that should be rendered in the table generated by the tag.
 void setRowClass(String rowClass)
          Set the HTML style class that is rendered on each HTML table row that is opened by this tag.
 void setRows(String rowsString)
          Set the number of rows that should be rendered in the table generated by the tag.
 void setTableClass(String tableClass)
          Set the HTML style class that is rendered on the HTML table that is opened by this tag.
 void setVerticalRepeat(boolean verticalRepeat)
          This tag can render the items in its dataset horizontally or vertically.
 
Methods inherited from class com.bea.wlw.netui.tags.DataSourceTag
addNamingInterceptor, doNaming, evaluateDataSource, getDataSource, qualifyAttribute, removeNamingInterceptor, setDataSource
 
Methods inherited from class com.bea.wlw.netui.tags.AbstractBaseTag
addTagIdMapping, containsExpression, evaluateAttributeToString, evaluateExpression, filter, filter, formatErrorString, formatString, getAttribute, getErrorsReport, getExpressionEvaluator, getJavaScriptUtils, getNearestForm, getNextId, getQualifiedBundleName, getScriptReporter, getUserLocale, hasErrors, isExpression, prepForRendering, registerAttribute, registerError, registerTagError, release, removeAttribute, renderAttribute, renderAttributes, reportErrors, rewriteName, setPageContext, updateExpression, write
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doInitBody, getBodyContent, getPreviousOut, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.bea.wlw.netui.tags.DataAccessProvider
getDataSource, setDataSource
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setParent
 

Constructor Detail

CellRepeater

public CellRepeater()
Method Detail

getTagName

public String getTagName()
Get the name of this tag. This is used to identify the type of this tag for reporting tag errors.

Specified by:
getTagName in class AbstractBaseTag
Returns:
a constant String representing the name of this tag.

addContent

public void addContent(String content)
Add content to the content that is being buffered by this tag. All content written by the body of this tag is added to this buffer. The buffer is rendered at the end of the tag's lifecycle if no fatal errors have occurred during this tag's lifecycle.

Parameters:
content - content that this tag should render.

getContent

public String getContent()
Get the content which should be rendered by this tag.

Returns:
the content String if there is content; null otherwise

setTableClass

public void setTableClass(String tableClass)
Set the HTML style class that is rendered on the HTML table that is opened by this tag. For example, if the row class is "tableClass", each opening table tag is:
     <table class="tableClass">
 

Parameters:
tableClass - the name of a style class in a CSS
Beadoc.attributedescription:
The HTML style class that is rendered on the HTML table. For example, if the row class is "tableClass", each opening table tag is:
     <table class="tableClass">
Beadoc.attributesyntaxvalue:
string_class
Beadoc.databindable:
false

getTableClass

public String getTableClass()
Get the HTML style class for the table that is rendered in the HTML table that is opened by this tag.

Returns:
the name of a style class in a CSS or null if none is set

setRowClass

public void setRowClass(String rowClass)
Set the HTML style class that is rendered on each HTML table row that is opened by this tag. For example, if the row class is "rowClass", each opening table row tag is:
     <tr class="rowClass">

Parameters:
rowClass - the name of a style class in the CSS
Beadoc.attributedescription:
The HTML style class that is rendered on each HTML table row. For example, if the row class is "rowClass", each opening table row tag is:
     <tr class="rowClass">
Beadoc.attributesyntaxvalue:
string_class
Beadoc.databindable:
false

getRowClass

public String getRowClass()
Get the HTML style class for a table row that is rendered in the HTML table that is rendered by this tag.

Returns:
the name of a style class in a CSS or null if none is set

setCellClass

public void setCellClass(String cellClass)
Set the HTML style class that is rendered on each HTML table cell. For example, if the cell class is "cellClass", each opening table cell tag is:
     <td class="cellClass">

Parameters:
cellClass - the name of a style class in a CSS
Beadoc.attributedescription:
The HTML style class that is rendered on each table cell. For example, if the cell class is "cellClass", each opening table cell tag is:
     <td class="cellClass">
Beadoc.attributesyntaxvalue:
string_class
Beadoc.databindable:
false

getCellClass

public String getCellClass()
Get the HTML style class for a table cell that is rendered in the HTML table that is rendered by this tag.

Returns:
the name of the style class in a CSS or null if none is set

setAlternatingCellClass

public void setAlternatingCellClass(String alternatingCellClass)
Set the HTML style class that is rendered on each HTML table cell that is opened by this tag. The starting cell is alternated for each row, which results in a checkerboard colored table being displayed. For example, if the alteranting cell class is \"alternatingCellClass\", every other table cell tag is:
     <td cell="alternatingCellClass">

Parameters:
alternatingCellClass - the name of a style class in a CSS
Beadoc.attributedescription:
The HTML style class that is rendered on alternating table cells. The starting cell is alternated for each row, which results in a checkerboard colored table being displayed. For example, if the alteranting cell class is "alternatingCellClass", every other table cell tag is:
     <td cell="alternatingCellClass">
Beadoc.attributesyntaxvalue:
string_class
Beadoc.databindable:
false

getAlternatingCellClass

public String getAlternatingCellClass()
Get the HTML style class for every other table cell that is rendered in the HTML table that is rendered by this tag.

Returns:
the name of the style class in a CSS or null if none is set

setVerticalRepeat

public void setVerticalRepeat(boolean verticalRepeat)
This tag can render the items in its dataset horizontally or vertically. If the rows are rendered horizontally, the items in the dataset are rendered across each row from top to bottom. Otherwise, they are rendered down each column from left to right. The default is to render the items horizontally.

Parameters:
verticalRepeat - if set to true, the dataset is rendered down each column; otherwise it is rendered across each row, the default.
Beadoc.attributedescription:
Boolean. If true the data set is rendered vertically, otherwise it is rendered horizontally. If the rows are rendered horizontally, the items in the data set are rendered across each row from top to bottom. Otherwise, they are rendered down each column from left to right. The default is to render the items horizontally.
Beadoc.attributesyntaxvalue:
boolean_verticalRepeat
Beadoc.databindable:
false

getVerticalRepeat

public boolean getVerticalRepeat()
Get the repeat direction. If the verticalRepeat attribute is set to true, the dataset is rendered down each column. Otherwise, it is rendered across each row.

Returns:
true if the dataset should be rendered down each column. The default is false.

setColumns

public void setColumns(String columnsString)
Set the number of columns that should be rendered in the table generated by the tag. If the columns attribute is specified but the rows attribute is not, the rows attribute will be inferred using the size of the dataset.

Parameters:
columnsString - an integer or an expression
Beadoc.attributedescription:
Integer. The number of columns that should be rendered in the HTML table. If the columns attribute is specified but the rows attribute is not, the rows attribute will be inferred using the size of the data set.
Beadoc.attributesyntaxvalue:
integer_columns
Beadoc.databindable:
true

getColumns

public String getColumns()
Get the number of columns that should be rendered in the table generated by this tag.

Returns:
a String of the integer or an expression that references an integer.

setRows

public void setRows(String rowsString)
Set the number of rows that should be rendered in the table generated by the tag. If the rows attribute is specified but the columns attribute is not, the columns attribute will be inferred using the size of the dataset.

Parameters:
rowsString - an integer or an expression whose value can be converted into an integer.
Beadoc.attributedescription:
Integer. The number of rows that should be rendered in the HTML table. If the rows attribute is specified but the columns attribute is not, the columns attribute will be inferred using the size of the data set.
Beadoc.attributesyntaxvalue:
integer_rows
Beadoc.databindable:
true

getRows

public String getRows()
Get the number of rows that should be rendered in the table generated by this tag.

Returns:
a String of the integer or an expression

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Prepare to render the dataset that was specified in the dataSource attribute. The dataSource expression is evaluated and the table's dimensions are computed. If there is no data in the dataset but the rows and columns attributes were specified, an empty table of the given dimensions is rendered.

Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class javax.servlet.jsp.tagext.BodyTagSupport
Returns:
EVAL_BODY_BUFFERED or SKIP_BODY if errors are reported, the data set is null, or there is no data in the data set
Throws:
javax.servlet.jsp.JspException - if errors occurred that could not be reported in the page

doAfterBody

public int doAfterBody()
Continue rendering the body of this tag until the dimensions of the table have been reached or the entire dataset has been rendered. The buffered body content from the previous iteration of the body is added to the content this tag will render, @see addContent(java.lang.String). Pad the table if the dimensions have not been met but the dataset is empty.

Specified by:
doAfterBody in interface javax.servlet.jsp.tagext.IterationTag
Overrides:
doAfterBody in class javax.servlet.jsp.tagext.BodyTagSupport
Returns:
EVAL_BODY_BUFFERED if there is more data to render in the dataset or SKIP_BODY if the end of the dataset is reached or an error occurs

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Complete rendering the tag. If no errors have occurred, the content that the tag buffered is rendered.

Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class javax.servlet.jsp.tagext.BodyTagSupport
Returns:
EVAL_PAGE to continue evaluating the page
Throws:
javax.servlet.jsp.JspException - if an error occurs that can not be reported on the page

getCurrentIndex

public int getCurrentIndex()
Get the index of the current iteration through the body of this tag. This data can be accessed using the expression container.index on an attribute of a databindable NetUI tag that is contained within the repeating body of this tag. This expression is only valid when the dataset is being rendered.

Specified by:
getCurrentIndex in interface DataAccessProvider
Returns:
the integer index of the current data item in the data set
See Also:
DataAccessProvider

getCurrentItem

public Object getCurrentItem()
Get the item that is currently being rendered by this repeating tag. This can be accessed using the expression expression.item on an attribute of a databindable netUI tag that is contained within the repeating body of this tag. The expression is only valid when the dataset is being rendered.

Specified by:
getCurrentItem in interface DataAccessProvider
Returns:
the current item in the data set
See Also:
DataAccessProvider

getCurrentMetadata

public Object getCurrentMetadata()
Get the metadata for the current item. This method is not supported by this tag.

Specified by:
getCurrentMetadata in interface DataAccessProvider
Returns:
the current metadata or null if no metadata can be found or metadata is not supported by a DataAccessProvider implementation
Throws:
UnsupportedOperationException - this tag does not support this method from the DataAccessProvider interface
See Also:
DataAccessProvider

getProviderParent

public DataAccessProvider getProviderParent()
Get the parent DataAccessProvider for this tag. If this tag is contained within a DataAccessProvider, the containing DataAccessProvider is available through the expression container.container. Any valid properties of the parent DataAccessProvider can be accessed through this expression. This method will return null if there is no parent DataAccessProvider

Specified by:
getProviderParent in interface DataAccessProvider
Returns:
a containing DataAccessProvider if one exists, null otherwise.
See Also:
DataAccessProvider

localRelease

protected void localRelease()
Reset all of the fields of this tag.

Overrides:
localRelease in class DataSourceTag

BEA NetUI tags and APIs are included for backward compatibility only. For new applications, use the Beehive tags and APIs.