T - data typeF - filter typepublic interface HierarchicalDataProvider<T,F> extends DataProvider<T,F>
| Modifier and Type | Method and Description |
|---|---|
default Stream<T> |
fetch(Query<T,F> query)
Fetches data from this HierarchicalDataProvider using given
query. |
Stream<T> |
fetchChildren(HierarchicalQuery<T,F> query)
Fetches data from this HierarchicalDataProvider using given
query. |
int |
getChildCount(HierarchicalQuery<T,F> query)
Get the number of immediate child data items for the parent item returned
by a given query.
|
boolean |
hasChildren(T item)
Check whether a given item has any children associated with it.
|
default int |
size(Query<T,F> query)
Get the number of immediate child data items for the parent item returned
by a given query.
|
default 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.
|
default <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.
|
default <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, fromCallbacks, fromFilteringCallbacks, fromStream, getId, isInMemory, ofCollection, ofItems, refreshAll, refreshItem, refreshItemdefault int size(Query<T,F> query)
size in interface DataProvider<T,F>query - given query to request the count forHierarchicalQuery.getParent()IllegalArgumentException - if the query is not of type HierarchicalQuerydefault Stream<T> fetch(Query<T,F> query)
query. Only the immediate children of
HierarchicalQuery.getParent() will be returned.fetch in interface DataProvider<T,F>query - given query to request data withIllegalArgumentException - if the query is not of type HierarchicalQueryint getChildCount(HierarchicalQuery<T,F> query)
query - given query to request the count forHierarchicalQuery.getParent()Stream<T> fetchChildren(HierarchicalQuery<T,F> query)
query. Only the immediate children of
HierarchicalQuery.getParent() will be returned.query - given query to request data withboolean hasChildren(T item)
item - the item to check for childrendefault <Q,C> HierarchicalConfigurableFilterDataProvider<T,Q,C> withConfigurableFilter(SerializableBiFunction<Q,C,F> filterCombiner)
DataProviderwithConfigurableFilter in interface DataProvider<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.nullDataProvider.withConfigurableFilter(),
ConfigurableFilterDataProvider.setFilter(Object)default <C> HierarchicalDataProvider<T,C> withConvertedFilter(SerializableFunction<C,F> filterConverter)
DataProviderFor 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>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
nullnulldefault HierarchicalConfigurableFilterDataProvider<T,Void,F> withConfigurableFilter()
DataProviderwithConfigurableFilter in interface DataProvider<T,F>nullDataProvider.withConfigurableFilter(SerializableBiFunction),
ConfigurableFilterDataProvider.setFilter(Object)Copyright © 2025. All rights reserved.