CellRepeater Class
- 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> </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:
Name | Description |
index | the current index in the iteration; this index is absolute to the dataset |
parent | any DataAccessProvider parent of this tag |
item | the current data item |
Note: the metadata property of the container
binding context is not supported
on the CellRepeater.
Attribute Descriptions |
Attribute | Required | Runtime Expression Evaluation | Data Bindable |
alternatingCellClass | No | No | No |
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">
|
cellClass | No | No | No |
The CSS style class to render on generated table cells. |
columns | No | No | Yes |
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. |
dataSource | No | No | Yes |
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. |
rowClass | No | No | No |
The CSS style class to render on every generated table row. |
rows | No | No | Yes |
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. |
tableClass | No | No | No |
The CSS style class to render on the generated table. |
verticalRepeat | No | No | No |
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. |
Related Topics
<netui-data:cellRepeater> Tag Sample
-
Hierarchy
-
Object
TagSupport
BodyTagSupport
AbstractBaseTag
DataSourceTag
CellRepeater
-
All Implemented Interfaces
-
BodyTag
, DataAccessProvider
, IterationTag
, Serializable
, Tag
Fields from com.bea.wlw.netui.tags.AbstractBaseTag |
ATTR_GENERAL , ATTR_GENERAL_EXPRESSION , ATTR_JAVASCRIPT , ATTR_STYLE , CLASS , ID , JAVASCRIPT_STATUS , NAME , NETUI_UNIQUE_CNT , ONCLICK , ONDBLCLICK , ONKEYDOWN , ONKEYPRESS , ONKEYUP , ONMOUSEDOWN , ONMOUSEMOVE , ONMOUSEOUT , ONMOUSEOVER , ONMOUSEUP , STYLE , TABINDEX
|
public void |
-
addContent (String content)
- Add content to the content that is being buffered by this tag.
|
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.
|
public int |
-
doEndTag ()
- Complete rendering the tag.
|
public int |
-
doStartTag ()
- Prepare to render the dataset that was specified in the dataSource attribute.
|
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.
|
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.
|
public String |
-
getColumns ()
- Get the number of columns that should be rendered in the table
generated by this tag.
|
public String |
-
getContent ()
- Get the content which should be rendered by this tag.
|
public int |
-
getCurrentIndex ()
- Get the index of the current iteration through the body of this tag.
|
public Object |
-
getCurrentItem ()
- Get the item that is currently being rendered by this repeating tag.
|
public Object |
-
getCurrentMetadata ()
- Get the metadata for the current item.
|
public DataAccessProvider |
-
getProviderParent ()
- Get the parent DataAccessProvider for this tag.
|
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.
|
public String |
-
getRows ()
- Get the number of rows that should be rendered in the table generated
by this tag.
|
public String |
-
getTableClass ()
- Get the HTML style class for the table that is rendered in the
HTML table that is opened by this tag.
|
public String |
-
getTagName ()
- Get the name of this tag.
|
public boolean |
-
getVerticalRepeat ()
- Get the repeat direction.
|
protected void |
-
localRelease ()
- Reset all of the fields of this tag.
|
public void |
-
setAlternatingCellClass (String alternatingCellClass)
- Set the HTML style class that is rendered on each HTML table cell that
is opened by this tag.
|
public void |
-
setCellClass (String cellClass)
- Set the HTML style class that is rendered on each HTML table cell.
|
public void |
-
setColumns (String columnsString)
- Set the number of columns that should be rendered in the table
generated by the tag.
|
public void |
-
setRowClass (String rowClass)
- Set the HTML style class that is rendered on each HTML table row that
is opened by this tag.
|
public void |
-
setRows (String rowsString)
- Set the number of rows that should be rendered in the table
generated by the tag.
|
public void |
-
setTableClass (String tableClass)
- Set the HTML style class that is rendered on the HTML table that
is opened by this tag.
|
public void |
-
setVerticalRepeat (boolean verticalRepeat)
- This tag can render the items in its dataset horizontally or vertically.
|
Methods from com.bea.wlw.netui.tags.AbstractBaseTag |
addTagIdMapping , evaluateAttributeToString , filter , filter , getJavaScriptUtils , getNearestForm , getScriptReporter , getUserLocale , localRelease , registerTagError , release , renderAttribute , rewriteName , write
|
Methods from javax.servlet.jsp.tagext.TagSupport |
doAfterBody, doEndTag, doStartTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue |
Methods from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CellRepeater
public CellRepeater()
addContent(String) Method
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.
doAfterBody() Method
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.
-
Overrides
-
BodyTagSupport.doAfterBody()
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() Method
public int doEndTag()
throws JspException
Complete rendering the tag. If no errors have occurred, the content that
the tag buffered is rendered.
-
Overrides
-
BodyTagSupport.doEndTag()
Returns
- EVAL_PAGE to continue evaluating the page
Exceptions
-
JspException
- if an error occurs that can not be reported on the page
doStartTag() Method
public int doStartTag()
throws 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.
-
Overrides
-
BodyTagSupport.doStartTag()
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
Exceptions
-
JspException
- if errors occurred that could not be reported in the page
getAlternatingCellClass() Method
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
getCellClass() Method
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
getColumns() Method
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.
getContent() Method
public String
getContent()
Get the content which should be rendered by this tag.
Returns
- the content String if there is content; null otherwise
getCurrentIndex() Method
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.
Returns
- the integer index of the current data item in the data set
Related Topics
DataAccessProvider
getCurrentItem() Method
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.
Returns
- the current item in the data set
Related Topics
DataAccessProvider
getCurrentMetadata() Method
public Object
getCurrentMetadata()
Get the metadata for the current item. This method is not supported by
this tag.
Returns
- the current metadata or
null
if no metadata can be
found or metadata is not supported by a DataAccessProvider implementation
Related Topics
DataAccessProvider
getProviderParent() Method
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
Returns
- a containing DataAccessProvider if one exists, null otherwise.
Related Topics
DataAccessProvider
getRowClass() Method
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
getRows() Method
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
getTableClass() Method
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
getTagName() Method
public String
getTagName()
Get the name of this tag. This is used to identify the type of this tag
for reporting tag errors.
-
Overrides
-
AbstractBaseTag.getTagName()
Returns
- a constant String representing the name of this tag.
getVerticalRepeat() Method
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
.
localRelease() Method
protected void localRelease()
Reset all of the fields of this tag.
-
Overrides
-
DataSourceTag.localRelease()
setAlternatingCellClass(String) Method
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
setCellClass(String) Method
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
setColumns(String) Method
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
setRowClass(String) Method
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
setRows(String) Method
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.
setTableClass(String) Method
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
setVerticalRepeat(boolean) Method
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.