Package com.vaadin.flow.data.provider
Class ConfigurableFilterDataProviderWrapper<T,Q,C,F>
- java.lang.Object
-
- com.vaadin.flow.data.provider.DataProviderWrapper<T,Q,F>
-
- com.vaadin.flow.data.provider.ConfigurableFilterDataProviderWrapper<T,Q,C,F>
-
- Type Parameters:
T
- the data provider item typeQ
- the query filter typeC
- the configurable filter typeF
- the filter type of the wrapped data provider
- All Implemented Interfaces:
ConfigurableFilterDataProvider<T,Q,C>
,DataProvider<T,Q>
,Serializable
public abstract class ConfigurableFilterDataProviderWrapper<T,Q,C,F> extends DataProviderWrapper<T,Q,F> implements ConfigurableFilterDataProvider<T,Q,C>
A configurable data provider that wraps another data provider by combining any filter from the component with the configured filter and passing that to the wrapped provider through the query.- Since:
- 1.0
- Author:
- Vaadin Ltd
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.vaadin.flow.data.provider.DataProviderWrapper
dataProvider
-
-
Constructor Summary
Constructors Constructor Description ConfigurableFilterDataProviderWrapper(DataProvider<T,F> dataProvider)
Creates a new configurable filter data provider by wrapping an existing data provider.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract F
combineFilters(Q queryFilter, C configuredFilter)
Combines the configured filter and the filter from the query into one filter instance that can be passed to the wrapped data provider.protected F
getFilter(Query<T,Q> query)
Gets the filter that should be used in the modified Query.void
setFilter(C filter)
Sets the filter to use for all queries handled by this data provider.-
Methods inherited from class com.vaadin.flow.data.provider.DataProviderWrapper
addDataProviderListener, fetch, getId, isInMemory, refreshAll, refreshItem, size
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.flow.data.provider.DataProvider
addDataProviderListener, fetch, getId, isInMemory, refreshAll, refreshItem, refreshItem, size, withConfigurableFilter, withConfigurableFilter, withConvertedFilter
-
-
-
-
Constructor Detail
-
ConfigurableFilterDataProviderWrapper
public ConfigurableFilterDataProviderWrapper(DataProvider<T,F> dataProvider)
Creates a new configurable filter data provider by wrapping an existing data provider.- Parameters:
dataProvider
- the data provider to wrap, notnull
-
-
Method Detail
-
getFilter
protected F getFilter(Query<T,Q> query)
Description copied from class:DataProviderWrapper
Gets the filter that should be used in the modified Query.- Specified by:
getFilter
in classDataProviderWrapper<T,Q,F>
- Parameters:
query
- the current query- Returns:
- filter for the modified Query
-
combineFilters
protected abstract F combineFilters(Q queryFilter, C configuredFilter)
Combines the configured filter and the filter from the query into one filter instance that can be passed to the wrapped data provider. Will not be called if the configured filter isnull
and the query has no filter.- Parameters:
queryFilter
- the filter received through the query, ornull
if no filter was provided in the queryconfiguredFilter
- the filter that this data provider is configured to use, ornull
if no filter has been configured- Returns:
- a filter that combines the two provided queries, or
null
to not pass any filter to the wrapped data provider
-
setFilter
public void setFilter(C filter)
Description copied from interface:ConfigurableFilterDataProvider
Sets the filter to use for all queries handled by this data provider.- Specified by:
setFilter
in interfaceConfigurableFilterDataProvider<T,Q,C>
- Parameters:
filter
- the filter to set, ornull
to clear any previously set filter
-
-