T - the type of beans produced by the dataProviderF - the type of the filter objects accepted by the dataProvider.public class DefaultFilterFieldFactory<T,F> implements FilterFieldFactory<T,F>
Provides default implementation for interface FilterFieldFactory.
Supports filter fields for dates, numbers and strings.
interface FilterFieldFactory| Constructor and Description |
|---|
DefaultFilterFieldFactory(eu.vaadinonkotlin.FilterFactory<F> filterFactory)
Provides default implementation for
interface FilterFieldFactory.
Supports filter fields for dates, numbers and strings. |
| Modifier and Type | Method and Description |
|---|---|
com.vaadin.data.HasValue<java.lang.Boolean> |
createBooleanField(com.vaadin.data.PropertyDefinition<T,java.lang.Boolean> property)
Don't forget that the returned field must be tri-state - true, false, null (to disable filtering).
|
DateFilterPopup |
createDateField(com.vaadin.data.PropertyDefinition<T,?> property) |
<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.
|
NumberFilterPopup |
createNumericField(java.lang.Class<?> type,
com.vaadin.data.PropertyDefinition<T,?> property) |
com.vaadin.data.HasValue<?> |
createTextField(com.vaadin.data.PropertyDefinition<T,?> property) |
<V extends Serializable> |
generateGenericFilter(com.vaadin.data.HasValue<V> field,
com.vaadin.data.PropertyDefinition<T,V> property,
V value) |
java.lang.String |
getBooleanFilterDisplayName(com.vaadin.data.PropertyDefinition<T,java.lang.Boolean> property,
boolean value) |
com.vaadin.server.Resource |
getBooleanFilterIcon(com.vaadin.data.PropertyDefinition<T,java.lang.Boolean> property,
boolean value) |
java.lang.String |
getEnumFilterDisplayName(com.vaadin.data.PropertyDefinition<T,?> property,
java.lang.Enum<?> constant) |
com.vaadin.server.Resource |
getEnumFilterIcon(com.vaadin.data.PropertyDefinition<T,?> property,
java.lang.Enum<?> constant) |
eu.vaadinonkotlin.FilterFactory<F> |
getFilterFactory()
allows filter components to produce filters accepted by the
|
boolean |
isUsePopupForNumericProperty(com.vaadin.data.PropertyDefinition<T,?> property)
If true, number filters will be shown as a popup, which allows the user to set eq, less-than and greater-than fields.
If false, a simple in-place editor will be shown, which only allows to enter the eq number.
|
createField, createFilterpublic DefaultFilterFieldFactory(eu.vaadinonkotlin.FilterFactory<F> filterFactory)
Provides default implementation for interface FilterFieldFactory.
Supports filter fields for dates, numbers and strings.
filterFactory - allows filter components to produce filters accepted by the dataProvider.filterFactory - allows filter components to produce filters accepted by the dataProvider.interface FilterFieldFactorypublic boolean isUsePopupForNumericProperty(com.vaadin.data.PropertyDefinition<T,?> property)
If true, number filters will be shown as a popup, which allows the user to set eq, less-than and greater-than fields. If false, a simple in-place editor will be shown, which only allows to enter the eq number.
Default implementation always returns true.
property - the bean propertypublic <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.createFilterpublic java.lang.String getEnumFilterDisplayName(com.vaadin.data.PropertyDefinition<T,?> property,
java.lang.Enum<?> constant)
public com.vaadin.server.Resource getEnumFilterIcon(com.vaadin.data.PropertyDefinition<T,?> property,
java.lang.Enum<?> constant)
public com.vaadin.data.HasValue<?> createTextField(com.vaadin.data.PropertyDefinition<T,?> property)
public DateFilterPopup createDateField(com.vaadin.data.PropertyDefinition<T,?> property)
public NumberFilterPopup createNumericField(java.lang.Class<?> type, com.vaadin.data.PropertyDefinition<T,?> property)
public com.vaadin.data.HasValue<java.lang.Boolean> createBooleanField(com.vaadin.data.PropertyDefinition<T,java.lang.Boolean> property)
Don't forget that the returned field must be tri-state - true, false, null (to disable filtering).
public com.vaadin.server.Resource getBooleanFilterIcon(com.vaadin.data.PropertyDefinition<T,java.lang.Boolean> property,
boolean value)
public java.lang.String getBooleanFilterDisplayName(com.vaadin.data.PropertyDefinition<T,java.lang.Boolean> property,
boolean value)
public <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 propertypublic <V extends Serializable> F generateGenericFilter(com.vaadin.data.HasValue<V> field, com.vaadin.data.PropertyDefinition<T,V> property, V value)
public eu.vaadinonkotlin.FilterFactory<F> getFilterFactory()
allows filter components to produce filters accepted by the