com.vaadin.flow.data.provider.hierarchy.
Class AbstractHierarchicalDataProvider<T,F>
- java.lang.Object
-
- com.vaadin.flow.data.provider.AbstractDataProvider<T,F>
-
- com.vaadin.flow.data.provider.hierarchy.AbstractHierarchicalDataProvider<T,F>
-
Type Parameters:
T
- data typeF
- filter typeAll Implemented Interfaces:
DataProvider<T,F>
,HierarchicalDataProvider<T,F>
,Serializable
Direct Known Subclasses:
public abstract class AbstractHierarchicalDataProvider<T,F> extends AbstractDataProvider<T,F> implements HierarchicalDataProvider<T,F>
Abstract hierarchical data provider implementation which takes care of item refreshes and associated events.
Since:
1.2
Author:
Vaadin Ltd
See Also:
-
-
Constructor Summary
Constructors Constructor Description AbstractHierarchicalDataProvider()
-
Method Summary
All Methods Modifier and Type Method Description HierarchicalConfigurableFilterDataProvider<T,Void,F>
withConfigurableFilter()
Wraps this data provider to create a data provider that supports programmatically setting a filter but no filtering through the query.
<Q,C>
HierarchicalConfigurableFilterDataProvider<T,Q,C>withConfigurableFilter(SerializableBiFunction<Q,C,F> filterCombiner)
Wraps this data provider to create a data provider that supports programmatically setting a filter that will be combined with a filter provided through the query.
<C> HierarchicalDataProvider<T,C>
withConvertedFilter(SerializableFunction<C,F> filterConverter)
Wraps this data provider to create a data provider that uses a different filter type.
-
Methods inherited from class com.vaadin.flow.data.provider.AbstractDataProvider
addDataProviderListener, addListener, fireEvent, refreshAll, refreshItem, refreshItem
-
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, getId, isInMemory, refreshAll, refreshItem, refreshItem
-
Methods inherited from interface com.vaadin.flow.data.provider.hierarchy.HierarchicalDataProvider
fetch, fetchChildren, getChildCount, hasChildren, size
-
-
-
-
Method Detail
-
withConfigurableFilter
public <Q,C> HierarchicalConfigurableFilterDataProvider<T,Q,C> withConfigurableFilter(SerializableBiFunction<Q,C,F> filterCombiner)
Description copied from interface:
DataProvider
Wraps this data provider to create a data provider that supports programmatically setting a filter that will be combined with a filter provided through the query.
Specified by:
withConfigurableFilter
in interfaceDataProvider<T,F>
Specified by:
withConfigurableFilter
in interfaceHierarchicalDataProvider<T,F>
Type Parameters:
Q
- the query filter typeC
- the configurable filter typeParameters:
filterCombiner
- a callback for combining and the configured filter with the filter from the query to get a filter to pass to the wrapped provider. Either parameter might benull
, but the callback will not be invoked at all if both would benull
. Notnull
.Returns:
a data provider with a configurable filter, not
null
See Also:
DataProvider.withConfigurableFilter()
,ConfigurableFilterDataProvider.setFilter(Object)
-
withConvertedFilter
public <C> HierarchicalDataProvider<T,C> withConvertedFilter(SerializableFunction<C,F> filterConverter)
Description copied from interface:
DataProvider
Wraps this data provider to create a data provider that uses a different filter type. This can be used for adapting this data provider to a filter type provided by a Component such as ComboBox.
For example receiving a String from ComboBox and making a Predicate based on it:
DataProvider<Person, Predicate<Person>> dataProvider; // ComboBox uses String as the filter type DataProvider<Person, String> wrappedProvider = dataProvider .withConvertedFilter(filterText -> { Predicate<Person> predicate = person -> person.getName() .startsWith(filterText); return predicate; }); comboBox.setDataProvider(wrappedProvider);
Specified by:
withConvertedFilter
in interfaceDataProvider<T,F>
Specified by:
withConvertedFilter
in interfaceHierarchicalDataProvider<T,F>
Type Parameters:
C
- the filter type that the wrapped data provider accepts; typically provided by a ComponentParameters:
filterConverter
- callback that converts the filter in the query of the wrapped data provider into a filter supported by this data provider. Will only be called if the query contains a filter. Notnull
Returns:
wrapped data provider, not
null
-
withConfigurableFilter
public HierarchicalConfigurableFilterDataProvider<T,Void,F> withConfigurableFilter()
Description copied from interface:
DataProvider
Wraps this data provider to create a data provider that supports programmatically setting a filter but no filtering through the query.
Specified by:
withConfigurableFilter
in interfaceDataProvider<T,F>
Specified by:
withConfigurableFilter
in interfaceHierarchicalDataProvider<T,F>
Returns:
a data provider with a configurable filter, not
null
See Also:
DataProvider.withConfigurableFilter(SerializableBiFunction)
,ConfigurableFilterDataProvider.setFilter(Object)
-
-