use of org.apache.wicket.extensions.markup.html.repeater.data.table.filter.FilterToolbar in project ocvn by devgateway.
the class AbstractListPage method onInitialize.
@Override
protected void onInitialize() {
super.onInitialize();
if (jpaRepository == null) {
throw new NullJpaRepositoryException();
}
if (editPageClass == null) {
throw new NullEditPageClassException();
}
SortableJpaRepositoryDataProvider<T> dataProvider = getProvider();
dataProvider.setFilterState(newFilterState());
// add the 'Edit' button
columns.add(new AbstractColumn<T, String>(new StringResourceModel("actionsColumn", this, null)) {
private static final long serialVersionUID = -7447601118569862123L;
@Override
public void populateItem(final Item<ICellPopulator<T>> cellItem, final String componentId, final IModel<T> model) {
cellItem.add(getActionPanel(componentId, model));
}
});
dataTable = new AjaxFallbackBootstrapDataTable<>("table", columns, dataProvider, WebConstants.PAGE_SIZE);
ResettingFilterForm<JpaFilterState<T>> filterForm = new ResettingFilterForm<>("filterForm", dataProvider, dataTable);
filterForm.add(dataTable);
add(filterForm);
if (hasFilteredColumns()) {
dataTable.addTopToolbar(new FilterToolbar(dataTable, filterForm));
}
PageParameters pageParameters = new PageParameters();
pageParameters.set(WebConstants.PARAM_ID, null);
editPageLink = new BootstrapBookmarkablePageLink<T>("new", editPageClass, pageParameters, Buttons.Type.Success);
editPageLink.setIconType(FontAwesomeIconType.plus_circle).setSize(Size.Large).setLabel(new StringResourceModel("new", AbstractListPage.this, null));
add(editPageLink);
}
Aggregations