|
||||||||||
| 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
com.inmethod.grid.common.AbstractGrid<D,T>
com.inmethod.grid.datagrid.DataGrid<D,T>
D - datasource model object type = grid typeT - row/item model object typepublic class DataGrid<D extends IDataSource<T>,T>
Advanced grid component. Supports resizable and reorderable columns.
| Field Summary |
|---|
| Fields inherited from class com.inmethod.grid.common.AbstractGrid |
|---|
INTERNAL_TOOLBAR_ITEM_ID, THEME_VISTA |
| 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 | |
|---|---|
DataGrid(String id,
D dataSource,
List<IGridColumn<D,T>> columns)
Crates a new DataGrid instance. |
|
DataGrid(String id,
IModel<D> model,
List<IGridColumn<D,T>> columns)
Crates a new DataGrid instance. |
|
| Method Summary | |
|---|---|
WebMarkupContainer |
findParentRow(Component child)
Returns the row in DataTable that contains the child component |
protected WebMarkupContainer |
findRowComponent(IModel<T> rowModel)
Returns the row component for specified item. |
int |
getCurrentPage()
|
int |
getCurrentPageItemCount()
|
D |
getDataSource()
Returns the IDataSource instance this data grid uses to fetch the data. |
int |
getPageCount()
Gets the total number of pages this pageable object has. |
int |
getRowsPerPage()
Returns the maximal amount of rows shown on one page. |
Collection<IModel<T>> |
getSelectedItems()
Returns the collection of models of all currently selected items. |
int |
getTotalRowCount()
Returns the total count of items (sum of count of items on all pages) or AbstractPageableView.UNKOWN_COUNT in case the count can't be determined. |
Item |
insertRow(T rowData)
Insert the rowData into the grid |
boolean |
isAllowSelectMultiple()
Returns whether user will be able to select more than one item at a time. |
boolean |
isCleanSelectionOnPageChange()
|
boolean |
isItemSelected(IModel<T> itemModel)
Queries whether the item specified by itemModel is currently selected. |
void |
markAllItemsDirty()
Makes the next call to update() refresh the entire grid. |
void |
markItemDirty(IModel<T> itemModel)
Marks the item from the given model as dirty. |
protected void |
onBeforeRender()
|
void |
onItemSelectionChanged(IModel<T> item,
boolean newValue)
Invoked when an item selection state has been changed. |
void |
resetSelectedItems()
Deselects all items. |
void |
selectAllVisibleItems()
Marks all currently displayed items as selected. |
void |
selectItem(IModel<T> itemModel,
boolean selected)
Alters the selection state of item specified by the item model. |
void |
setAllowSelectMultiple(boolean value)
Sets whether user will be able to select more than one item. |
DataGrid<D,T> |
setCleanSelectionOnPageChange(boolean cleanSelectionOnPageChange)
Sets whether the change of current page should clear all selected items. |
void |
setCurrentPage(int page)
Sets the a page that should be rendered. |
DataGrid<D,T> |
setRowsPerPage(int rowsPerPage)
Sets the desired amount rows per page. |
void |
update()
During an Ajax request this method updates the changed grid rows. |
| 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 DataGrid(String id,
IModel<D> model,
List<IGridColumn<D,T>> columns)
DataGrid instance.
id - component idmodel - model to access the IDataSource instance used to fetch the datacolumns - list of grid columns
public DataGrid(String id,
D dataSource,
List<IGridColumn<D,T>> columns)
DataGrid instance.
id - component iddataSource - data source used to fetch the datacolumns - list of grid columns| Method Detail |
|---|
public D getDataSource()
IDataSource instance this data grid uses to fetch the data.
IDataSource instancepublic DataGrid<D,T> setRowsPerPage(int rowsPerPage)
rowsPerPage - how many rows (max) should be displayed on one page
this (useful for method chaining)public int getRowsPerPage()
public int getTotalRowCount()
AbstractPageableView.UNKOWN_COUNT in case the count can't be determined.
public int getCurrentPage()
getCurrentPage in interface IPageablepublic int getPageCount()
getPageCount in interface IPageablepublic void setCurrentPage(int page)
setCurrentPage in interface IPageablepage - The page that should be rendered.public int getCurrentPageItemCount()
public Collection<IModel<T>> getSelectedItems()
getSelectedItems in class AbstractGrid<D extends IDataSource<T>,T>public boolean isAllowSelectMultiple()
isAllowSelectMultiple in class AbstractGrid<D extends IDataSource<T>,T>true if multiple items can be selected at a time, false
otherwise.public void setAllowSelectMultiple(boolean value)
setAllowSelectMultiple in class AbstractGrid<D extends IDataSource<T>,T>value - true if the user will be able to select more than one item at a time,
false otherwise (single selection mode).public DataGrid<D,T> setCleanSelectionOnPageChange(boolean cleanSelectionOnPageChange)
cleanSelectionOnPageChange - whether the current page change should deselect all selected items
this (useful for method chaining)public boolean isCleanSelectionOnPageChange()
public boolean isItemSelected(IModel<T> itemModel)
isItemSelected in class AbstractGrid<D extends IDataSource<T>,T>itemModel - item model
true if the item is selected, false otherwisepublic void resetSelectedItems()
resetSelectedItems in class AbstractGrid<D extends IDataSource<T>,T>public void selectAllVisibleItems()
DataGrid this selects all items
on current page, for TreeGrid this selects all currently visible nodes.
selectAllVisibleItems in class AbstractGrid<D extends IDataSource<T>,T>protected WebMarkupContainer findRowComponent(IModel<T> rowModel)
findRowComponent in class AbstractGrid<D extends IDataSource<T>,T>protected void onBeforeRender()
onBeforeRender in class AbstractGrid<D extends IDataSource<T>,T>public void markItemDirty(IModel<T> itemModel)
AbstractGrid.update() method is called.
markItemDirty in class AbstractGrid<D extends IDataSource<T>,T>itemModel - model used to access the itempublic void markAllItemsDirty()
update() refresh the entire grid.
public void onItemSelectionChanged(IModel<T> item,
boolean newValue)
onItemSelectionChanged in class AbstractGrid<D extends IDataSource<T>,T>item - item modelnewValue - true if the item became selected, false otherwise.public void update()
The definition of "changed" varies in DataGrid and TreeGrid.
TreeGrid the changes to TreeModel itself are being tracked (assuming
the proper listeners are fired) and all rows that need to be updated are also considered
changed.
DataGrid the items that need to be updated can be marked by
markItemDirty(IModel) or markAllItemsDirty(). The grid
itself doesn't track changes to specific items (apart from the selection state).
update in class AbstractGrid<D extends IDataSource<T>,T>public Item insertRow(T rowData)
rowData - data to insert into the new row
public void selectItem(IModel<T> itemModel,
boolean selected)
selectItem in class AbstractGrid<D extends IDataSource<T>,T>itemModel - item modelselected - true if the item should be selected, false otherwise.public WebMarkupContainer findParentRow(Component child)
findParentRow in class AbstractGrid<D extends IDataSource<T>,T>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||