List of usage examples for org.apache.wicket.extensions.markup.html.repeater.data.table.filter NoFilter NoFilter
public NoFilter(final String id)
From source file:com.swordlord.gozer.components.wicket.action.button.list.GWListFilterToolbar.java
License:Open Source License
/** * Constructor//from ww w .j av a 2 s. c o m * * @param table * data table this toolbar will be added to * @param form * the filter form * @param stateLocator * locator responsible for finding object used to store filter's state */ public GWListFilterToolbar(final DataTable<?, String> table, final FilterForm form, final IFilterStateLocator stateLocator) { super(table); add(form); if (table == null) { throw new IllegalArgumentException("argument [table] cannot be null"); } if (stateLocator == null) { throw new IllegalArgumentException("argument [stateLocator] cannot be null"); } // populate the toolbar with components provided by filtered columns RepeatingView filters = new RepeatingView("filters"); filters.setRenderBodyOnly(true); form.add(filters); Iterator<?> it = table.getColumns().iterator(); while (it.hasNext()) { WebMarkupContainer item = new WebMarkupContainer(filters.newChildId()); item.setRenderBodyOnly(true); IColumn<?, String> col = (IColumn<?, String>) it.next(); Component filter = null; if (col instanceof IFilteredColumn) { IFilteredColumn<?, String> filteredCol = (IFilteredColumn<?, String>) col; filter = filteredCol.getFilter(FILTER_COMPONENT_ID, form); } if (filter == null) { filter = new NoFilter(FILTER_COMPONENT_ID); } else { if (!filter.getId().equals(FILTER_COMPONENT_ID)) { throw new IllegalStateException( "filter component returned with an invalid component id. invalid component id [" + filter.getId() + "] required component id [" + FILTER_COMPONENT_ID + "] generating column [" + col.toString() + "] "); } } item.add(filter); filters.add(item); } }