Search in sources :

Example 1 with NullEditPageClassException

use of org.devgateway.toolkit.forms.exceptions.NullEditPageClassException 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);
}
Also used : ResettingFilterForm(org.devgateway.toolkit.forms.wicket.components.table.ResettingFilterForm) NullEditPageClassException(org.devgateway.toolkit.forms.exceptions.NullEditPageClassException) NullJpaRepositoryException(org.devgateway.toolkit.forms.exceptions.NullJpaRepositoryException) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) JpaFilterState(org.devgateway.toolkit.forms.wicket.components.table.JpaFilterState) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) StringResourceModel(org.apache.wicket.model.StringResourceModel) FilterToolbar(org.apache.wicket.extensions.markup.html.repeater.data.table.filter.FilterToolbar)

Aggregations

ICellPopulator (org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator)1 FilterToolbar (org.apache.wicket.extensions.markup.html.repeater.data.table.filter.FilterToolbar)1 StringResourceModel (org.apache.wicket.model.StringResourceModel)1 PageParameters (org.apache.wicket.request.mapper.parameter.PageParameters)1 NullEditPageClassException (org.devgateway.toolkit.forms.exceptions.NullEditPageClassException)1 NullJpaRepositoryException (org.devgateway.toolkit.forms.exceptions.NullJpaRepositoryException)1 JpaFilterState (org.devgateway.toolkit.forms.wicket.components.table.JpaFilterState)1 ResettingFilterForm (org.devgateway.toolkit.forms.wicket.components.table.ResettingFilterForm)1