|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider<U,Object>
org.ujorm.wicket.component.grid.AbstractDataProvider<U>
org.ujorm.wicket.component.grid.ListDataProvider<U>
public class ListDataProvider<U extends Ujo>
This class called ListDataProvider is a List based DataProvider.
For a customization you can use a your own IColumn implementations
or you can overwrite selected methods of this provider.
The implementation generates two database requests per a one rendering,
the first one get size and the second one get paged data. You can overwrite the two data methods:
iterator() and the size()
for more optimization.
The current class uses a WicketApplication implementation, which must
implement the interface OrmHandlerProvider for an ORM support. See the example:
Criterion<Hotel> allActiveHotels = Hotel.ACTIVE.whereEq(true);
UjoDataProvider<Hotel> dataProvider = UjoDataProvider.of(allActiveHotels);
dataProvider.addColumn(Hotel.NAME);
dataProvider.addColumn(Hotel.CITY.add(City.NAME)); // An example of relations
dataProvider.addColumn(Hotel.STREET);
dataProvider.addColumn(Hotel.PRICE);
dataProvider.addColumn(KeyColumn.of(Hotel.CURRENCY, SORTING_OFF));
dataProvider.addColumn(Hotel.STARS);
dataProvider.addColumn(Hotel.PHONE);
dataProvider.setSort(Hotel.NAME);
panel.add(dataProvider.createDataTable("datatable", 10));
| Field Summary |
|---|
| Fields inherited from class org.ujorm.wicket.component.grid.AbstractDataProvider |
|---|
DEFAULT_CSS_ACTION, DEFAULT_CSS_SELECTED, DEFAULT_DATATABLE_ID, filter, highlighting, size |
| Constructor Summary | |
|---|---|
ListDataProvider(org.apache.wicket.model.IModel<org.ujorm.criterion.Criterion<U>> criterion)
Constructor |
|
ListDataProvider(org.apache.wicket.model.IModel<org.ujorm.criterion.Criterion<U>> filter,
Key<? super U,?> defaultSort)
Constructor |
|
| Method Summary | ||
|---|---|---|
protected void |
clearBuffer()
Clear a filterd rows and size |
|
long |
deleteRow(org.ujorm.criterion.Criterion<? super U> deleteCondition)
Delete rows from the data source |
|
void |
detach()
Detaches model after use. |
|
protected List<U> |
getFileredRows()
Returns a filtered rows and cach the result |
|
List<U> |
getRows()
Returns original data rows |
|
boolean |
insertRow(U row)
Insert row to the data source |
|
Iterator<U> |
iterator(long first,
long count)
Build a JDBC ResultSet allways. |
|
static
|
of(org.ujorm.criterion.Criterion<? super T> criterion)
Factory for the class |
|
static
|
of(org.ujorm.criterion.Criterion<T> criterion,
Key<? super T,?> defaultSort)
Factory for the class |
|
static
|
of(org.apache.wicket.model.IModel<org.ujorm.criterion.Criterion<T>> criterion)
Factory for the class |
|
static
|
of(org.apache.wicket.model.IModel<org.ujorm.criterion.Criterion<T>> criterion,
Key<? super T,?> defaultSort)
Factory for the class |
|
void |
setRows(List<? super U> dataRows)
Assign data resource |
|
long |
size()
Method calculate the size of filtered rows |
|
long |
updateRow(org.ujorm.criterion.Criterion<? super U> updateCondition,
U updatedRow)
Update all rows with a codition using the row |
|
| Methods inherited from class org.ujorm.wicket.component.grid.AbstractDataProvider |
|---|
add, add, add, add, add, add, createBottomToolbars, createDataTable, createDataTable, createDataTable, createDataTable, createTopToolbars, getColumns, getCssSelected, getDomainClass, getFirstTableRow, getHighlighting, getSortKey, isDefaultColumnSorting, isSortingEnabled, model, setCssClass, setDefaultColumnSorting, setHighlighting, setHighlighting, setSelected, setSelected, setSort |
| Methods inherited from class org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider |
|---|
getSort, getSortState, setSort, setSort |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ListDataProvider(org.apache.wicket.model.IModel<org.ujorm.criterion.Criterion<U>> criterion)
criterion - Condition to a database query
public ListDataProvider(org.apache.wicket.model.IModel<org.ujorm.criterion.Criterion<U>> filter,
Key<? super U,?> defaultSort)
filter - Model of a condition to a database querydefaultSort - Default sorting can be assigned optionally| Method Detail |
|---|
public void setRows(List<? super U> dataRows)
@Nonnull public List<U> getRows()
@Nonnull protected List<U> getFileredRows()
public Iterator<U> iterator(long first,
long count)
iterator in interface org.apache.wicket.markup.repeater.data.IDataProvider<U extends Ujo>iterator in class AbstractDataProvider<U extends Ujo>public long size()
size in interface org.apache.wicket.markup.repeater.data.IDataProvider<U extends Ujo>size in class AbstractDataProvider<U extends Ujo>public void detach()
detach in interface org.apache.wicket.model.IDetachabledetach in class AbstractDataProvider<U extends Ujo>protected void clearBuffer()
public boolean insertRow(@Nonnull
U row)
insertRow in class AbstractDataProvider<U extends Ujo>row - Insert the one table row
public long deleteRow(@Nonnull
org.ujorm.criterion.Criterion<? super U> deleteCondition)
deleteRow in class AbstractDataProvider<U extends Ujo>deleteCondition - Remove all row with a condition.
public long updateRow(@Nonnull
org.ujorm.criterion.Criterion<? super U> updateCondition,
@Nonnull
U updatedRow)
updateRow in class AbstractDataProvider<U extends Ujo>updateCondition - Update conditionrow - Updated row
public static <T extends Ujo> ListDataProvider<T> of(org.apache.wicket.model.IModel<org.ujorm.criterion.Criterion<T>> criterion,
Key<? super T,?> defaultSort)
public static <T extends Ujo> ListDataProvider<T> of(org.apache.wicket.model.IModel<org.ujorm.criterion.Criterion<T>> criterion)
public static <T extends Ujo> ListDataProvider<T> of(org.ujorm.criterion.Criterion<T> criterion,
Key<? super T,?> defaultSort)
public static <T extends Ujo> ListDataProvider<T> of(org.ujorm.criterion.Criterion<? super T> criterion)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||