Package com.vaadin.flow.data.provider
Class ListDataProvider<T>
java.lang.Object
com.vaadin.flow.data.provider.AbstractDataProvider<T,SerializablePredicate<T>>
com.vaadin.flow.data.provider.ListDataProvider<T>
- Type Parameters:
T- data type
- All Implemented Interfaces:
ConfigurableFilterDataProvider<T,,SerializablePredicate<T>, SerializablePredicate<T>> DataProvider<T,,SerializablePredicate<T>> InMemoryDataProvider<T>,Serializable
- Direct Known Subclasses:
DataCommunicator.EmptyDataProvider
public class ListDataProvider<T>
extends AbstractDataProvider<T,SerializablePredicate<T>>
implements InMemoryDataProvider<T>
DataProvider wrapper for Collections.- Since:
- 1.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfetch(Query<T, SerializablePredicate<T>> query) Fetches data from this DataProvider using givenquery.Gets the current filter of this data provider.getItems()Returns the underlying data items.Gets the current sort comparator of this data provider.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.intsize(Query<T, SerializablePredicate<T>> query) Gets the amount of data in this DataProvider.Methods 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, refreshItem, withConfigurableFilter, withConfigurableFilter, withConvertedFilterMethods 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
-
ListDataProvider
Constructs a new ListDataProvider.No protective copy is made of the list, and changes in the provided backing Collection will be visible via this data provider. The caller should copy the list if necessary.
- Parameters:
items- the initial data, not null
-
-
Method Details
-
getItems
Returns the underlying data items.- Returns:
- the underlying data items
-
fetch
Description copied from interface:DataProviderFetches data from this DataProvider using givenquery.- Specified by:
fetchin interfaceDataProvider<T,SerializablePredicate<T>> - Parameters:
query- given query to request data- Returns:
- the result of the query request: a stream of data objects, not
null
-
size
Description copied from interface:DataProviderGets the amount of data in this DataProvider.- Specified by:
sizein interfaceDataProvider<T,SerializablePredicate<T>> - Parameters:
query- query with sorting and filtering- Returns:
- the size of the data provider
-
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:
-
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:
-