|
||||||||||
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.panel.Panel org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable<T>
T
- The model object typepublic class DataTable<T>
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 )
List<IColumn<T>> columns = new ArrayList<IColumn<T>>(); columns.add(new PropertyColumn(new Model<String>("First Name"), "name.first", "name.first")); columns.add(new PropertyColumn(new Model<String>("Last Name"), "name.last")); DataTable table = new DataTable("datatable", columns, new UserProvider(), 10); table.addBottomToolbar(new NavigationToolbar(table)); table.addTopToolbar(new HeadersToolbar(table, null)); add(table);
DefaultDataTable
,
Serialized FormField Summary |
---|
Fields inherited from class org.apache.wicket.markup.html.panel.Panel |
---|
PANEL |
Fields inherited from class org.apache.wicket.Component |
---|
ENABLE, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER |
Constructor Summary | |
---|---|
DataTable(java.lang.String id,
java.util.List<IColumn<T>> columns,
IDataProvider<T> 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 |
protected IModel<java.lang.String> |
getCaptionModel()
Returns the model for table's caption. |
java.util.List<IColumn<T>> |
getColumns()
|
int |
getCurrentPage()
|
IDataProvider<T> |
getDataProvider()
|
int |
getItemCount()
Gets the total number of items this object has. |
int |
getItemsPerPage()
maximum number of visible items per page |
int |
getPageCount()
Gets the total number of pages this pageable object has. |
int |
getRowCount()
|
protected WebMarkupContainer |
newBodyContainer(java.lang.String id)
Create the MarkupContainer for the |
protected Item<IColumn<T>> |
newCellItem(java.lang.String id,
int index,
IModel<IColumn<T>> model)
Factory method for Item container that represents a cell in the underlying DataGridView |
protected Item<T> |
newRowItem(java.lang.String id,
int index,
IModel<T> 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 (page number is zero-based) |
DataTable<T> |
setItemReuseStrategy(IItemReuseStrategy strategy)
Sets the item reuse strategy. |
void |
setItemsPerPage(int items)
Sets the number of items to be displayed per page |
void |
setTableBodyCss(java.lang.String cssStyle)
Set the 'class' attribute for the tbody tag. |
Methods inherited from class org.apache.wicket.markup.html.panel.Panel |
---|
newMarkupSourcingStrategy |
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer |
---|
getWebPage, getWebRequest |
Methods inherited from class org.apache.wicket.MarkupContainer |
---|
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, hasAssociatedMarkup, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onComponentTagBody, onMarkupAttached, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DataTable(java.lang.String id, java.util.List<IColumn<T>> columns, IDataProvider<T> dataProvider, int rowsPerPage)
id
- component idcolumns
- list of IColumn objectsdataProvider
- imodel for data providerrowsPerPage
- number of rows per pageMethod Detail |
---|
protected IModel<java.lang.String> getCaptionModel()
protected WebMarkupContainer newBodyContainer(java.lang.String id)
id
-
public final void setTableBodyCss(java.lang.String cssStyle)
cssStyle
- public void addBottomToolbar(AbstractToolbar toolbar)
toolbar
- toolbar to be addedAbstractToolbar
public void addTopToolbar(AbstractToolbar toolbar)
toolbar
- toolbar to be addedAbstractToolbar
public final IDataProvider<T> getDataProvider()
public final java.util.List<IColumn<T>> 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 getItemsPerPage()
IPageableItems
getItemsPerPage
in interface IPageableItems
public final void setCurrentPage(int page)
IPageable
setCurrentPage
in interface IPageable
page
- The page that should be rendered.IPageable.setCurrentPage(int)
public final DataTable<T> setItemReuseStrategy(IItemReuseStrategy strategy)
Item
s.
strategy
- item reuse strategy
RefreshingView.setItemReuseStrategy(IItemReuseStrategy)
,
IItemReuseStrategy
public void setItemsPerPage(int items)
items
- number of items to display per pagepublic int getItemCount()
IPageableItems
getItemCount
in interface IPageableItems
IPageableItems.getItemCount()
protected Item<IColumn<T>> newCellItem(java.lang.String id, int index, IModel<IColumn<T>> 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<T> newRowItem(java.lang.String id, int index, IModel<T> 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 |