-
Notifications
You must be signed in to change notification settings - Fork 5
Filter By
pm4j allows filtering table rows by user defined filter-by constraints.
The set of filter-by constraints that can be specified is provided by the interface FilterByDefinitionProvider which is implemented by PmTable and PmTableCol.
A filter-by definition can be applied to an instance of Filterable. PmTable extends this interface.
The PM class PmFilterSetDefaultImpl provides a sample UI logic for editing filter definitions.
Applications are free to provide their specific filter UI's by extending the predefined PmFilter... definitions or by writing something diffent.
pm4j provides some standard FilterByDefinition's for in-memory filtering:
-
FilterByPmAttrValue - May be used for
Comparable
values.
Supports compare operators like 'Greater Than', 'Equals' etc. -
FilterByPmAttrValueLocalized - May be used to filter by the (possibly localized) value string displayed in the UI.
Supports compare operators like 'Starts With', 'Contains' etc.
Filter by defintions my be declared using annotations:
-
@PmTableColCfg(filterBy=@FilterByCfg())
- Defines a simple string filter. -
@PmTableColCfg(filterBy=@FilterByCfg(value=FilterByPmAttrValue.class, valueAttrPm=PmAttrIntegerImpl.class))
- Defines a specific filter and a specific PM to use for entering the compare-to value.
It may also be declared by overriding PmTableColImpl#getFilterByDefinitionImpl()
PmTableFilterTest demonstrates how to use these definitions in methods and annotations.
If the column provides more than one filter definition, these definitions may be provided by defining more than one @FilterByCfg
annotation or by overriding PmTableColImpl#getFilterByDefinitionsImpl()
.