|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.Component org.apache.wicket.MarkupContainer org.apache.wicket.markup.html.WebMarkupContainer org.apache.wicket.markup.html.WebMarkupContainerWithAssociatedMarkup org.apache.wicket.markup.html.panel.Panel org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable
public class DataTable
A data table builds on data grid view to introduce toolbars. Toolbars can be used to display sortable column headers, paging information, filter controls, and other information.
Data table also provides its own markup for an html table so the user does not need to provide it himself. This makes it very simple to add a datatable to the markup, however, some flexibility.
Example
<table wicket:id="datatable"></table>And the related Java code: ( the first column will be sortable because its sort property is specified, the second column will not )
IColumn[] columns = new IColumn[2]; columns[0] = new PropertyColumn(new Model("First Name"), "name.first", "name.first"); columns[1] = new PropertyColumn(new Model("Last Name"), "name.last"); DataTable table = new DataTable("datatable", columns, new UserProvider(), 10); table.add(new NavigationToolbar(table)); table.add(new HeadersToolbar(table)); add(table);
DefaultDataTable
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.wicket.Component |
---|
Component.ComponentModelChange, Component.EnabledChange, Component.IVisitor, Component.VisibilityChange |
Field Summary | |
---|---|
static java.lang.String |
TOOLBAR_COMPONENT_ID
The component id that toolbars must be created with in order to be added to the data table |
Fields inherited from class org.apache.wicket.Component |
---|
ENABLE, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED6, FLAG_RESERVED7, FLAG_RESERVED8, PATH_SEPARATOR, RENDER |
Constructor Summary | |
---|---|
DataTable(java.lang.String id,
IColumn[] columns,
IDataProvider dataProvider,
int rowsPerPage)
Constructor |
Method Summary | |
---|---|
void |
addBottomToolbar(AbstractToolbar toolbar)
Adds a toolbar to the datatable that will be displayed after the data |
void |
addTopToolbar(AbstractToolbar toolbar)
Adds a toolbar to the datatable that will be displayed before the data |
IColumn[] |
getColumns()
|
int |
getCurrentPage()
|
int |
getPageCount()
Gets the total number of pages this pageable object has. |
int |
getRowCount()
|
int |
getRowsPerPage()
|
protected Item |
newCellItem(java.lang.String id,
int index,
IModel model)
Factory method for Item container that represents a cell in the underlying DataGridView |
protected Item |
newRowItem(java.lang.String id,
int index,
IModel model)
Factory method for Item container that represents a row in the underlying DataGridView |
protected void |
onDetach()
Called to allow a component to detach resources after use. |
protected void |
onPageChanged()
Event listener for page-changed event |
void |
setCurrentPage(int page)
Sets the a page that should be rendered. |
DataTable |
setItemReuseStrategy(IItemReuseStrategy strategy)
Sets the item reuse strategy. |
void |
setRowsPerPage(int items)
Sets the number of items to be displayed per page |
Methods inherited from class org.apache.wicket.markup.html.panel.Panel |
---|
onComponentTag, onComponentTagBody, renderHead |
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainerWithAssociatedMarkup |
---|
newHeaderPartContainer, renderHeadFromAssociatedMarkupFile |
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer |
---|
getMarkupType, getWebPage |
Methods inherited from class org.apache.wicket.MarkupContainer |
---|
add, addOrReplace, autoAdd, autoAdd, contains, findMarkupStream, get, getAssociatedMarkupStream, getMarkupStream, hasAssociatedMarkup, internalAdd, isTransparentResolver, iterator, iterator, newMarkupResourceStream, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderComponentTagBody, replace, setMarkupStream, setModel, size, toString, toString, visitChildren, visitChildren |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String TOOLBAR_COMPONENT_ID
Constructor Detail |
---|
public DataTable(java.lang.String id, IColumn[] columns, IDataProvider dataProvider, int rowsPerPage)
id
- component idcolumns
- list of IColumn objectsdataProvider
- imodel for data providerrowsPerPage
- number of rows per pageMethod Detail |
---|
public void addBottomToolbar(AbstractToolbar toolbar)
toolbar
- toolbar to be addedAbstractToolbar
public void addTopToolbar(AbstractToolbar toolbar)
toolbar
- toolbar to be addedAbstractToolbar
public final IColumn[] getColumns()
public final int getCurrentPage()
getCurrentPage
in interface IPageable
IPageable.getCurrentPage()
public final int getPageCount()
IPageable
getPageCount
in interface IPageable
IPageable.getPageCount()
public final int getRowCount()
public final int getRowsPerPage()
public final void setCurrentPage(int page)
IPageable
setCurrentPage
in interface IPageable
page
- The page that should be rendered.IPageable.setCurrentPage(int)
public final DataTable setItemReuseStrategy(IItemReuseStrategy strategy)
Item
s.
strategy
- item reuse strategy
RefreshingView.setItemReuseStrategy(IItemReuseStrategy)
,
IItemReuseStrategy
public void setRowsPerPage(int items)
items
- number of items to display per pageprotected Item newCellItem(java.lang.String id, int index, IModel model)
id
- component id for the new data itemindex
- the index of the new data itemmodel
- the model for the new data item
Item
protected Item newRowItem(java.lang.String id, int index, IModel model)
id
- component id for the new data itemindex
- the index of the new data itemmodel
- the model for the new data item.
Item
protected void onDetach()
Component
onDetach
in class Component
Component.onDetach()
protected void onPageChanged()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |