|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.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,S>
T - The model object typeS - the type of the sorting parameterpublic class DataTable<T,S>
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 Form| Field 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(String id,
List<? extends IColumn<T,S>> columns,
IDataProvider<T> dataProvider,
long 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 |
WebMarkupContainer |
getBody()
|
org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable.ToolbarsContainer |
getBottomToolbars()
|
org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable.Caption |
getCaption()
|
protected IModel<String> |
getCaptionModel()
Returns the model for table's caption. |
List<? extends IColumn<T,S>> |
getColumns()
|
long |
getCurrentPage()
|
IDataProvider<T> |
getDataProvider()
|
long |
getItemCount()
|
long |
getItemsPerPage()
|
long |
getPageCount()
|
long |
getRowCount()
|
org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable.ToolbarsContainer |
getTopToolbars()
|
protected WebMarkupContainer |
newBodyContainer(String id)
Create the MarkupContainer for the |
protected Item<IColumn<T,S>> |
newCellItem(String id,
int index,
IModel<IColumn<T,S>> model)
Factory method for Item container that represents a cell in the underlying DataGridView |
protected Item<T> |
newRowItem(String id,
int index,
IModel<T> model)
Factory method for Item container that represents a row in the underlying DataGridView |
protected void |
onDetach()
|
protected void |
onPageChanged()
Event listener for page-changed event |
void |
setCurrentPage(long page)
|
DataTable<T,S> |
setItemReuseStrategy(IItemReuseStrategy strategy)
Sets the item reuse strategy. |
void |
setItemsPerPage(long items)
Sets the number of items to be displayed per page |
void |
setTableBodyCss(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, getWebResponse, getWebSession |
| Methods inherited from class org.apache.wicket.MarkupContainer |
|---|
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onComponentTagBody, 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(String id,
List<? extends IColumn<T,S>> columns,
IDataProvider<T> dataProvider,
long rowsPerPage)
id - component idcolumns - list of IColumn objectsdataProvider - imodel for data providerrowsPerPage - number of rows per page| Method Detail |
|---|
protected IModel<String> getCaptionModel()
protected WebMarkupContainer newBodyContainer(String id)
id -
public final void setTableBodyCss(String cssStyle)
cssStyle - public void addBottomToolbar(AbstractToolbar toolbar)
toolbar - toolbar to be addedAbstractToolbarpublic void addTopToolbar(AbstractToolbar toolbar)
toolbar - toolbar to be addedAbstractToolbarpublic final org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable.ToolbarsContainer getTopToolbars()
public final org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable.ToolbarsContainer getBottomToolbars()
public final WebMarkupContainer getBody()
public final org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable.Caption getCaption()
public final IDataProvider<T> getDataProvider()
public final List<? extends IColumn<T,S>> getColumns()
public final long getCurrentPage()
getCurrentPage in interface IPageableIPageable.getCurrentPage()public final long getPageCount()
getPageCount in interface IPageableIPageable.getPageCount()public final long getRowCount()
public final long getItemsPerPage()
getItemsPerPage in interface IPageableItemspublic final void setCurrentPage(long page)
setCurrentPage in interface IPageableIPageable.setCurrentPage(long)public final DataTable<T,S> setItemReuseStrategy(IItemReuseStrategy strategy)
Items.
strategy - item reuse strategy
RefreshingView.setItemReuseStrategy(IItemReuseStrategy),
IItemReuseStrategypublic void setItemsPerPage(long items)
setItemsPerPage in interface IPageableItemsitems - number of items to display per pagepublic long getItemCount()
getItemCount in interface IPageableItemsIPageableItems.getItemCount()
protected Item<IColumn<T,S>> newCellItem(String id,
int index,
IModel<IColumn<T,S>> 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(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.
Itemprotected void onDetach()
onDetach in class ComponentComponent.onDetach()protected void onPageChanged()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||