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 Collection
s.- Since:
- 1.0
- See Also:
-
Constructor Summary
-
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.void
setFilter
(SerializablePredicate<T> filter) Sets a filter to be applied to all queries.void
setSortComparator
(SerializableComparator<T> comparator) Sets the comparator to use as the default sorting for this data provider.int
size
(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, refreshItem
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.vaadin.flow.data.provider.DataProvider
addDataProviderListener, getId, refreshAll, refreshItem, refreshItem, withConfigurableFilter, withConfigurableFilter, withConvertedFilter
Methods 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:DataProvider
Fetches data from this DataProvider using givenquery
.- Specified by:
fetch
in 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:DataProvider
Gets the amount of data in this DataProvider.- Specified by:
size
in interfaceDataProvider<T,
SerializablePredicate<T>> - Parameters:
query
- query with sorting and filtering- Returns:
- the size of the data provider
-
getSortComparator
Description copied from interface:InMemoryDataProvider
Gets the current sort comparator of this data provider.- Specified by:
getSortComparator
in interfaceInMemoryDataProvider<T>
- Returns:
- the sort comparator of this data provider
-
setSortComparator
Description copied from interface:InMemoryDataProvider
Sets 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:
setSortComparator
in interfaceInMemoryDataProvider<T>
- Parameters:
comparator
- a comparator to use, ornull
to clear any previously set sort order- See Also:
-
getFilter
Description copied from interface:InMemoryDataProvider
Gets the current filter of this data provider.- Specified by:
getFilter
in interfaceInMemoryDataProvider<T>
- Returns:
- the filter of this data provider
-
setFilter
Description copied from interface:InMemoryDataProvider
Sets a filter to be applied to all queries. The filter replaces any filter that has been set or added previously.- Specified by:
setFilter
in interfaceConfigurableFilterDataProvider<T,
SerializablePredicate<T>, SerializablePredicate<T>> - Specified by:
setFilter
in interfaceInMemoryDataProvider<T>
- Parameters:
filter
- the filter to set, ornull
to remove any set filters- See Also:
-