Class TreeDataProvider<T>
java.lang.Object
com.vaadin.flow.data.provider.AbstractDataProvider<T,F>
com.vaadin.flow.data.provider.hierarchy.AbstractHierarchicalDataProvider<T,SerializablePredicate<T>>
com.vaadin.flow.data.provider.hierarchy.TreeDataProvider<T>
- Type Parameters:
T- data type
- All Implemented Interfaces:
ConfigurableFilterDataProvider<T,,SerializablePredicate<T>, SerializablePredicate<T>> DataProvider<T,,SerializablePredicate<T>> HierarchicalDataProvider<T,,SerializablePredicate<T>> InMemoryDataProvider<T>,Serializable
public class TreeDataProvider<T>
extends AbstractHierarchicalDataProvider<T,SerializablePredicate<T>>
implements InMemoryDataProvider<T>
An in-memory data provider for listing components that display hierarchical
data. Uses an instance of
TreeData as its source of data.- Since:
- 1.2
- Author:
- Vaadin Ltd
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionFetches data from this HierarchicalDataProvider using givenquery.intGet the number of immediate child data items for the parent item returned by a given query.Gets the current filter of this data provider.Gets the current sort comparator of this data provider.Return the underlying hierarchical data of this provider.booleanhasChildren(T item) Check whether a given item has any children associated with it.voidsetFilter(SerializablePredicate<T> filter) Sets a filter to be applied to all queries.voidsetSortComparator(SerializableComparator<T> comparator) Sets the comparator to use as the default sorting for this data provider.Methods inherited from class com.vaadin.flow.data.provider.hierarchy.AbstractHierarchicalDataProvider
withConfigurableFilter, withConfigurableFilter, withConvertedFilterMethods inherited from class com.vaadin.flow.data.provider.AbstractDataProvider
addDataProviderListener, addListener, fireEvent, refreshAll, refreshItem, refreshItemMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.data.provider.DataProvider
addDataProviderListener, getId, refreshAll, refreshItem, refreshItemMethods inherited from interface com.vaadin.flow.data.provider.hierarchy.HierarchicalDataProvider
fetch, sizeMethods inherited from interface com.vaadin.flow.data.provider.InMemoryDataProvider
addFilter, addFilter, addFilterByValue, addSortComparator, addSortOrder, clearFilters, filteringBy, filteringBy, filteringByEquals, filteringByPrefix, filteringByPrefix, filteringBySubstring, filteringBySubstring, isInMemory, setFilter, setFilterByValue, setSortOrder
-
Constructor Details
-
Method Details
-
getTreeData
Return the underlying hierarchical data of this provider.- Returns:
- the underlying data of this provider
-
hasChildren
Description copied from interface:HierarchicalDataProviderCheck whether a given item has any children associated with it.- Specified by:
hasChildrenin interfaceHierarchicalDataProvider<T,SerializablePredicate<T>> - Parameters:
item- the item to check for children- Returns:
- whether the given item has children
-
getChildCount
Description copied from interface:HierarchicalDataProviderGet the number of immediate child data items for the parent item returned by a given query.- Specified by:
getChildCountin interfaceHierarchicalDataProvider<T,SerializablePredicate<T>> - Parameters:
query- given query to request the count for- Returns:
- the count of child data items for the data item
HierarchicalQuery.getParent()
-
fetchChildren
Description copied from interface:HierarchicalDataProviderFetches data from this HierarchicalDataProvider using givenquery. Only the immediate children ofHierarchicalQuery.getParent()will be returned.- Specified by:
fetchChildrenin interfaceHierarchicalDataProvider<T,SerializablePredicate<T>> - Parameters:
query- given query to request data with- Returns:
- a stream of data objects resulting from the query
-
getFilter
Description copied from interface:InMemoryDataProviderGets the current filter of this data provider.- Specified by:
getFilterin interfaceInMemoryDataProvider<T>- Returns:
- the filter of this data provider
-
setFilter
Description copied from interface:InMemoryDataProviderSets a filter to be applied to all queries. The filter replaces any filter that has been set or added previously.- Specified by:
setFilterin interfaceConfigurableFilterDataProvider<T,SerializablePredicate<T>, SerializablePredicate<T>> - Specified by:
setFilterin interfaceInMemoryDataProvider<T>- Parameters:
filter- the filter to set, ornullto remove any set filters- See Also:
-
getSortComparator
Description copied from interface:InMemoryDataProviderGets the current sort comparator of this data provider.- Specified by:
getSortComparatorin interfaceInMemoryDataProvider<T>- Returns:
- the sort comparator of this data provider
-
setSortComparator
Description copied from interface:InMemoryDataProviderSets the comparator to use as the default sorting for this data provider. This overrides the sorting set by any other method that manipulates the default sorting of this data provider.The default sorting is used if the query defines no sorting. The default sorting is also used to determine the ordering of items that are considered equal by the sorting defined in the query.
- Specified by:
setSortComparatorin interfaceInMemoryDataProvider<T>- Parameters:
comparator- a comparator to use, ornullto clear any previously set sort order- See Also:
-