T
- data typeF
- filter typepublic abstract class AbstractHierarchicalDataProvider<T,F> extends AbstractDataProvider<T,F> implements HierarchicalDataProvider<T,F>
Constructor and Description |
---|
AbstractHierarchicalDataProvider() |
Modifier and Type | Method and 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.
|
addDataProviderListener, addListener, fireEvent, refreshAll, refreshItem, refreshItem
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
fetch, fetchChildren, getChildCount, hasChildren, size
addDataProviderListener, fromCallbacks, fromFilteringCallbacks, fromStream, getId, isInMemory, ofCollection, ofItems, refreshAll, refreshItem, refreshItem
public <Q,C> HierarchicalConfigurableFilterDataProvider<T,Q,C> withConfigurableFilter(SerializableBiFunction<Q,C,F> filterCombiner)
DataProvider
withConfigurableFilter
in interface DataProvider<T,F>
withConfigurableFilter
in interface HierarchicalDataProvider<T,F>
Q
- the query filter typeC
- the configurable filter typefilterCombiner
- 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 be null
, but the
callback will not be invoked at all if both would be
null
. Not null
.null
DataProvider.withConfigurableFilter()
,
ConfigurableFilterDataProvider.setFilter(Object)
public <C> HierarchicalDataProvider<T,C> withConvertedFilter(SerializableFunction<C,F> filterConverter)
DataProvider
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);
withConvertedFilter
in interface DataProvider<T,F>
withConvertedFilter
in interface HierarchicalDataProvider<T,F>
C
- the filter type that the wrapped data provider accepts;
typically provided by a ComponentfilterConverter
- 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. Not
null
null
public HierarchicalConfigurableFilterDataProvider<T,Void,F> withConfigurableFilter()
DataProvider
withConfigurableFilter
in interface DataProvider<T,F>
withConfigurableFilter
in interface HierarchicalDataProvider<T,F>
null
DataProvider.withConfigurableFilter(SerializableBiFunction)
,
ConfigurableFilterDataProvider.setFilter(Object)
Copyright © 2020. All rights reserved.