| |
|
| org.apache.beehive.netui.tags.databinding.datagrid.AbstractDataGridHtmlTag org.apache.beehive.netui.tags.databinding.datagrid.DataGrid
DataGrid | public class DataGrid extends AbstractDataGridHtmlTag implements IDataAccessProvider,IBehaviorConsumer,IHtmlCore,IHtmlEvents,IHtmlI18n(Code) | |
This tag is the containing tag for all tags and markup used to render a data grid. In its simplest form, a data
grid is an HTML table containing an HTML table row for every item in a data set. The data grid also provides
functionality for rendering the following major regions:
- a header -- a header contains the top-most rows in a data grid's HTML table and is rendered using
the
Header tag
- data rows -- markup rendered in the data grid for each record in the data set must be contained
in a
Rows tag
- a footer -- a footer contains the bottom-most rows in a data grid's HTML table and is rendered using the
Footer tag
- caption -- an HTML table caption appears at the top of the table and is rendered using the
Caption tag.
In addition, a data grid can also configure and render a pager using the
ConfigurePager and
RenderPager tags respectively.
Inside of the
Header and
Rows rendering regions, the data grid renders HTML table cells. The
data grid tag set provides a set of tags that can be used render these cells with varying content including:
- HTML <th> cells -- these are generally used inside the
Header
- anchors -- these can be rendered using the
AnchorCell tag
- images -- these can be rendered using the
ImageCell tag
- image anchors-- these can be rendered using the
ImageAnchorCell tag
- HTML spans -- these can be rendered using the
SpanCell tag
The
TemplateCell tag can be used as a container for arbitrary content that may be included in a cell's
contents. The
Footer tag's content can also use these tags.
When the data grid renders its data set, the container JSP EL implicit object is exposed in the
JSP's
JspContext and can be referenced using the ${contaimer} JSP EL expression. The
current item of data from the data set can be referenced using the ${container.item}
expression. If the item had a name property, it could be referenced as
${container.item.name} . By default, the data grid renders a paged data set which will only
display a portion of the complete data set. The default page size is
PagerModel.DEFAULT_PAGE_SIZE and can be changed by setting the
ConfigurePager.setPageSize(int) attribute.
In addition to rendering a data grid, this tag set cooperates with a set of state management services exposed
via the
org.apache.beehive.netui.databinding.datagrid.api.DataGridStateFactory . These services
help to manage state related to paging, sorting, and filtering. For example, the first row displayed
in the grid's current page and the sorts for a particular column of data are can be read / written using these
state objects. The data grid will use various state information from these classes at reunder time. For example,
when rendering a paged data set, the data grid will use the
org.apache.beehive.netui.databinding.datagrid.api.DataGridStateFactory to obtain a
PagerModel which can be used to determine the current
org.apache.beehive.netui.databinding.datagrid.api.pager.PagerModel.getRow . The grid will then
use this row value to advance the grid to the appropriate page to display.
By default, the data grid uses a configuration JavaBean which provides instances of state containers and services
that are used to maintain state and render grid markup. This config object is a subclass of
DataGridConfig and is obtained via the
DataGridConfigFactory . The default implementation is
org.apache.beehive.netui.databinding.datagrid.runtime.config.DefaultDataGridConfig . Page authors
may provide their own implementations of this object and set an instance via
DataGrid.setDataGridConfig(org.apache.beehive.netui.databinding.datagrid.api.DataGridConfig) . This can be
used to change default behaviors, change the appearance of the pager, and change the messages displayed
during rendering among other things.
A simple, sortable, and pageable data grid that uses a first / previous // next / last pager might be
written as:
<netui-data:dataGrid dataSource="pageScope.zooAnimals">
<netui-data:configurePager disableDefaultPager="true" pageAction="page" pagerFormat="firstPreviousNextLast"/>
<netui-data:caption>
<netui-data:renderPager/>
<netui-data:caption>
<netui-data:header>
<netui-data:heaederCell value="Animal" sortExpression="animal"/>
<netui-data:heaederCell value="Quantity" sortExpression="quantity"/>
<netui-data:heaederCell value="Details"/>
</netui-data:header>
<netui-data:rows>
<netui-data:spanCell value="${container.item.animalName}"/>
<netui-data:spanCell value="${container.item.quantity}"/>
<netui-data:anchorCell action="details" value="Details">
<netui:parameter name="animalId" value="${container.item.animalId}"/>
</netui-data:anchorCell>
</netui-data:rows>
</netui-data:dataGrid>
This data grid would render an HTML table with a <caption> that contains a first / previous // next / last
formated pager. The data grid would display a page with ten data rows and three columns. The header
contains the column titles with clickable sorting links for sorting by the animal name and quantity. The
body of the data grid contains three cells per row containing two HTML <span> tags and an HTML anchor
which will navigate to a Page Flow action caclled details when clicked.
HeaderRowsFooterCaptionConfigurePagerRenderPagerHeaderRowsHeaderAnchorCellImageCellImageAnchorCellSpanCellTemplateCellFooterJspContextPagerModel.DEFAULT_PAGE_SIZEConfigurePager.setPageSize(int)org.apache.beehive.netui.databinding.datagrid.api.DataGridStateFactoryorg.apache.beehive.netui.databinding.datagrid.api.DataGridStateFactoryPagerModelorg.apache.beehive.netui.databinding.datagrid.api.pager.PagerModel.getRowDataGridConfigDataGridConfigFactoryorg.apache.beehive.netui.databinding.datagrid.runtime.config.DefaultDataGridConfigDataGrid.setDataGridConfig(org.apache.beehive.netui.databinding.datagrid.api.DataGridConfig) |
doTag | public void doTag() throws JspException, IOException(Code) | |
Render a data grid. This method implements the logic used to iterate through the data grid's rendering states
defined in
DataGridTagModel .
throws: JspException - when an error occurs evaluating the tag's body throws: IOException - when an error occurs writing to the output strema |
getCurrentIndex | public int getCurrentIndex()(Code) | | Get the index of the current item in the data set. This is a zero-based absolute
index into the entire data set being rendered by the data grid. This value
should only be data bound inside of the
Rows .
the index of the current item |
getCurrentItem | public Object getCurrentItem()(Code) | | Get the current item in the data set. As the data grid iterates over the data set, this
value will change to provide access to the current item in the data set. This value
should only be data bound inside of the
Rows .
the current item |
getCurrentMetadata | public Object getCurrentMetadata()(Code) | | Get metadata for the current item. This operation is unsupported on the data grid.
the metadata for the current item throws: UnsupportedOperationException - as this method is unsupported |
getDataSource | public String getDataSource()(Code) | | Get the data source for the data grid. This value returns a NetUI EL expression which can
be evaluated by the NetUI tag API.
the expression |
getProviderParent | public IDataAccessProvider getProviderParent()(Code) | | Get the parent data access provider. This method requires access to the tag hierarchy and is not
usable across tag file or JSP include rendering boundaries. The result of this method is used for
evaluating expressions of the form ${container.container} where this tag's parent
repeating tag is referenced.
the parent data access provider |
getTagName | public String getTagName()(Code) | | The name of this tag; this value is used for error reporting.
the String name of this tag |
setBehavior | public void setBehavior(String name, Object value, String facet) throws JspException(Code) | |
Implementation of the
IBehaviorConsumer interface that extends the functionality of this
tag beyond that exposed via the JSP tag attributes. This method accepts the following facets:
Facet Name | Operation |
resource | Adds or overrides a data grid resource key with a new value. |
A new resource key is added in order to override a value defined in
org.apache.beehive.netui.databinding.datagrid.api.rendering.IDataGridMessageKeys . When a message
is overridden or added here, the page author is able to override a single string resource such as a
pager mesage or sort href.
Parameters: name - the name of the behavior Parameters: value - the value of the behavior Parameters: facet - th ebehavior's facet throws: JspException - when the behavior's facet isnot recognized |
setBorder | public void setBorder(String border)(Code) | | Sets the border attribute for the HTML table tag.
Parameters: border - |
setCellpadding | public void setCellpadding(String cellpadding)(Code) | | Sets the cellpadding attribute for the HTML table tag.
Parameters: cellpadding - the cell padding |
setCellspacing | public void setCellspacing(String cellspacing)(Code) | | Sets the cellspacing attribute for the HTML table tag.
Parameters: cellspacing - the cell spacing |
setDataSource | public void setDataSource(String dataSource)(Code) | |
Set the data source that references a data set to be rendered by the data grid. The data source should be
a NetUI EL expression and generally looks like a JSP EL expression without the '${' and '}' characters.
For example, to reference an array of Employee objects exposed via a NetUI page input, the expression
might look like:
<netui-data:dataGrid dataSource="pageInput.employeeArray" name="employeeGrid">
This expression will be evaluated the data grid in order to obtain a reference to the data set.
|
setDir | public void setDir(String dir)(Code) | | Sets the dir attribute for the HTML table tag.
Parameters: dir - the dir |
setFrame | public void setFrame(String frame)(Code) | | Sets the frame attribute for the HTML table tag.
Parameters: frame - the frame |
setLang | public void setLang(String lang)(Code) | | Sets the lang attribute for the HTML table tag.
Parameters: lang - the lang |
setName | public void setName(String name)(Code) | | Set the name of this data grid. The name should be a simple String that is used to uniquely identify a data
grid inside of a JSP. This value is also used to namespace state information in the URL that is scoped
to a data grid. Within a given scope in a page, the page author is responsible for ensuring that this
name is unique.
|
setOnClick | public void setOnClick(String onClick)(Code) | | Sets the onClick JavaScript event for the HTML table tag.
Parameters: onClick - the onClick event. |
setOnDblClick | public void setOnDblClick(String onDblClick)(Code) | | Sets the onDblClick JavaScript event for the HTML tag.
Parameters: onDblClick - the onDblClick event. |
setOnKeyDown | public void setOnKeyDown(String onKeyDown)(Code) | | Sets the onKeyDown JavaScript event for the HTML tag.
Parameters: onKeyDown - the onKeyDown event. |
setOnKeyPress | public void setOnKeyPress(String onKeyPress)(Code) | | Sets the onKeyPress JavaScript event for the HTML tag.
Parameters: onKeyPress - the onKeyPress event. |
setOnKeyUp | public void setOnKeyUp(String onKeyUp)(Code) | | Sets the onKeyUp JavaScript event for the HTML tag.
Parameters: onKeyUp - the onKeyUp event. |
setOnMouseDown | public void setOnMouseDown(String onMouseDown)(Code) | | Sets the onMouseDown JavaScript event for the HTML tag.
Parameters: onMouseDown - the onMouseDown event. |
setOnMouseMove | public void setOnMouseMove(String onMouseMove)(Code) | | Sets the onMouseMove JavaScript event for the HTML tag.
Parameters: onMouseMove - the onMouseMove event. |
setOnMouseOut | public void setOnMouseOut(String onMouseOut)(Code) | | Sets the onMouseOut JavaScript event for the HTML tag.
Parameters: onMouseOut - the onMouseOut event. |
setOnMouseOver | public void setOnMouseOver(String onMouseOver)(Code) | | Sets the onMouseOver JavaScript event for the HTML tag.
Parameters: onMouseOver - the onMouseOver event. |
setOnMouseUp | public void setOnMouseUp(String onMouseUp)(Code) | | Sets the onMouseUp JavaScript event for the HTML tag.
Parameters: onMouseUp - the onMouseUp event. |
setRules | public void setRules(String rules)(Code) | | Sets the rules attribute for the HTML table tag.
Parameters: rules - the rules |
setStyle | public void setStyle(String style)(Code) | | Sets the style for the HTML table tag.
Parameters: style - the html style. |
setStyleClass | public void setStyleClass(String styleClass)(Code) | | Sets the style class for the HTML table tag.
Parameters: styleClass - the html style class. |
setStyleClassPrefix | public void setStyleClassPrefix(String styleClassPrefix)(Code) | |
Set the style class prefix used to namespace style class names rendered as attributes on HTML tags
generated by the data grid. For example, when using the default style policy without setting this
attribute, the style rendered for the generated HTML table tag will be:
<table class="datagrid">
With the style class prefix of foo , the rendered HTML style class will be:
<table class="foo">
|
setSummary | public void setSummary(String summary)(Code) | | Sets the summary attribute for the HTML table tag.
Parameters: summary - the summary |
setTagId | public void setTagId(String tagId) throws JspException(Code) | | Set the name of the tagId for the HTML table tag.
Parameters: tagId - the the name of the tagId for the table tag. |
setTitle | public void setTitle(String title)(Code) | | Sets the value of the title attribute for the HTML table tag.
Parameters: title - the title |
setWidth | public void setWidth(String width)(Code) | | Sets the width attribute for the HTML table tag.
Parameters: width - the width |
|
|
|