public FilterFieldFactory<T,F>
Produces filter fields and binds them to the dataProvider, to automatically perform the filtering when the field is changed.
Currently, the filter fields have to be attached to the Grid manually: you will have to create a special HeaderRow in a Grid, create a field for each column,
add the field to the HeaderRow, and finally, bind the field to the container. The DataLoaderFilterFactoryKt.generateFilterComponents can do that for you (it's located in other module), just call
grid.appendHeaderRow().generateFilterComponents(grid)
Currently, only Vaadin Grid component is supported. Vaadin does not support attaching of the filter fields to a Vaadin Table. Attaching filters to a Tepi FilteringTable is currently not supported directly, but it may be done manually.
Two of the most important functions you'll need to implement:
FilterFieldFactory.createField which creates the Vaadin component placed in the Grid Header bar.
FilterFieldFactory.createFilter takes the value produced by the Vaadin filter component and produces a filter accepted by the dataProvider.
| Modifier and Type | Method and Description |
|---|---|
<V> com.vaadin.data.HasValue<?> |
createField(com.vaadin.data.PropertyDefinition<T,V> property)
Creates the filtering component for given bean property, or Grid column.
The component may not necessarily produce values of given data types - for example,
if the data type is a Double, the filtering component may produce a
NumberInterval
object which mandates given value to be contained in a numeric range. |
<V> F |
createFilter(V value,
com.vaadin.data.HasValue<V> filterField,
com.vaadin.data.PropertyDefinition<T,V> property)
Creates a new Container Filter based on given value.
|
<V> com.vaadin.data.HasValue<?> createField(com.vaadin.data.PropertyDefinition<T,V> property)
Creates the filtering component for given bean property, or Grid column.
The component may not necessarily produce values of given data types - for example,
if the data type is a Double, the filtering component may produce a NumberInterval
object which mandates given value to be contained in a numeric range.
FilterFieldFactory.createFilter is later used internally when the field's value changes, to construct a filter for given field.
The field component's UI should be as small as possible - it is going to be embedded into the Grid's header bar after all. If you need
more screen space, please consider using the PopupView component. Please consult the class NumberFilterPopup source code for an example
on more details.
As a rule of thumb, the filtering component should produce the following values:
class NumberInterval for any Number-typed field
class DateInterval for any date-typed field
String for String-typed field
Enum for Enum-typed field
Boolean for boolean-typed field
generally, a value of the type of the field itself; anything that the FilterFieldFactory.createFilter function accepts.
V - the type of the value the property holds.property - the itemClass property.FilterFieldFactory.createFilter,
class NumberFilterPopup,
class NumberInterval,
Number,
class DateInterval,
String,
Enum,
Boolean,
FilterFieldFactory.createFilter<V> F createFilter(V value,
com.vaadin.data.HasValue<V> filterField,
com.vaadin.data.PropertyDefinition<T,V> property)
Creates a new Container Filter based on given value.
value - the value, may be null.filterField - the filter field itselfproperty - the property