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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.vaadin.flow.data.provider.hierarchy.HierarchicalDataProvider
HierarchicalDataProvider.HierarchyFormat -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionFetches children based on the given hierarchical query.intGets the number of children based on the given hierarchical 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
refreshItem, withConfigurableFilter, withConfigurableFilter, withConvertedFilterMethods inherited from class com.vaadin.flow.data.provider.AbstractDataProvider
addDataProviderListener, addListener, fireEvent, refreshAll, 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, getDepth, getHierarchyFormat, 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:HierarchicalDataProviderGets the number of children based on the given hierarchical query.This method must be implemented in accordance with the selected hierarchy type, see
HierarchicalDataProvider.getHierarchyFormat()andHierarchicalDataProvider.HierarchyFormat.- Specified by:
getChildCountin interfaceHierarchicalDataProvider<T,SerializablePredicate<T>> - Parameters:
query- given query to request the count for- Returns:
- the count of children for the parent item or the root level if
the parent is
null
-
fetchChildren
Description copied from interface:HierarchicalDataProviderFetches children based on the given hierarchical query.This method must be implemented in accordance with the selected hierarchy type, see
HierarchicalDataProvider.getHierarchyFormat()andHierarchicalDataProvider.HierarchyFormat.- Specified by:
fetchChildrenin interfaceHierarchicalDataProvider<T,SerializablePredicate<T>> - Parameters:
query- given query to request data with- Returns:
- a stream of data objects for the
parent itemor the root level if the parent isnull, must not contain null values
-
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:
-