/** * Resets all filters. * * <p>Note: Recreates the filter fields also! */ public void resetFilters() { if (initDone) { disableContentRefreshing(); for (Component c : columnIdToFilterMap.values()) { c.setParent(null); } collapsedColumnIds.clear(); columnIdToFilterMap.clear(); generator.clearFilterData(); generator.initializeFilterFields(); reRenderFilterFields = true; enableContentRefreshing(true); } }
@Override public void setColumnCollapsed(Object propertyId, boolean collapsed) throws IllegalStateException { super.setColumnCollapsed(propertyId, collapsed); Component c = getColumnIdToFilterMap().get(propertyId); if (collapsed) { collapsedColumnIds.add(propertyId); if (c != null) { c.setParent(null); if (c instanceof TextField) { ((TextField) c).setValue(""); } else if (c instanceof AbstractField<?>) { ((AbstractField<?>) c).setValue(null); } } } else { if (c != null) { c.setParent(this); } collapsedColumnIds.remove(propertyId); } reRenderFilterFields = true; markAsDirty(); }
@Override public void setVisibleColumns(Object... visibleColumns) { reRenderFilterFields = true; if (visibleColumns != null && columnIdToFilterMap != null) { /* First clear all parent references */ for (Object key : columnIdToFilterMap.keySet()) { columnIdToFilterMap.get(key).setParent(null); } /* Set this as parent to visible columns */ for (Object key : visibleColumns) { Component filter = columnIdToFilterMap.get(key); if (filter != null) { filter.setParent(this); } } } super.setVisibleColumns(visibleColumns); resetFilters(); }
private void addFilterColumn(Object propertyId, Component filter) { owner.getColumnIdToFilterMap().put(propertyId, filter); filter.setParent(owner); owner.requestRepaint(); }