T - the type of the items in ComboBoxpublic class ComboBoxListDataView<T>
extends com.vaadin.flow.data.provider.AbstractListDataView<T>
| Constructor and Description |
|---|
ComboBoxListDataView(com.vaadin.flow.data.provider.DataCommunicator<T> dataCommunicator,
ComboBox<T> comboBox,
com.vaadin.flow.function.SerializableBiConsumer<com.vaadin.flow.function.SerializablePredicate<T>,com.vaadin.flow.function.SerializableComparator<T>> filterOrSortingChangedCallback)
Creates a new instance of ComboBox in-memory data view and verifies the
passed data provider is compatible with this data view implementation.
|
| Modifier and Type | Method and Description |
|---|---|
ComboBoxListDataView<T> |
addFilter(com.vaadin.flow.function.SerializablePredicate<T> filter)
Adds a filter to be applied to all queries.
|
com.vaadin.flow.shared.Registration |
addItemCountChangeListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.data.provider.ItemCountChangeEvent<?>> listener) |
int |
getItemCount() |
Stream<T> |
getItems()
Gets the items available on the ComboBox's server-side.
|
ComboBoxListDataView<T> |
removeFilters()
Removes all in-memory filters set or added.
|
ComboBoxListDataView<T> |
setFilter(com.vaadin.flow.function.SerializablePredicate<T> filter)
Sets a filter to be applied to the data.
|
void |
setIdentifierProvider(com.vaadin.flow.data.provider.IdentifierProvider<T> identifierProvider) |
addItem, addItemAfter, addItemBefore, addItems, addItemsAfter, addItemsBefore, addSortComparator, addSortOrder, contains, getDataProvider, getItem, getNextItem, getPreviousItem, getSupportedDataProviderType, removeItem, removeItems, removeSorting, setSortComparator, setSortOrder, validateItemIndexequals, getIdentifierProvider, refreshAll, refreshItem, verifyDataProviderTypepublic ComboBoxListDataView(com.vaadin.flow.data.provider.DataCommunicator<T> dataCommunicator, ComboBox<T> comboBox, com.vaadin.flow.function.SerializableBiConsumer<com.vaadin.flow.function.SerializablePredicate<T>,com.vaadin.flow.function.SerializableComparator<T>> filterOrSortingChangedCallback)
dataCommunicator - the data communicator of the ComboBox, not nullcomboBox - the ComboBox component, not nullfilterOrSortingChangedCallback - callback, which is being invoked when the ComboBox's filtering
or sorting changes, not nullpublic Stream<T> getItems()
Data is sorted the same way as in the ComboBox, but it does not take into
account the ComboBox client-side filtering, since it doesn't change the
item count on the server-side, but only makes it easier for users to
search through the items in the UI. Only the server-side filtering
considered, which is set by: setFilter(SerializablePredicate) or
addFilter(SerializablePredicate).
public int getItemCount()
This method takes into account only the server-side filtering, which is
set by: setFilter(SerializablePredicate) or
addFilter(SerializablePredicate). ComboBox's client-side filter
is not considered, since it doesn't change the item count on the
server-side, but only makes it easier for users to search through the
items in the UI.
public void setIdentifierProvider(com.vaadin.flow.data.provider.IdentifierProvider<T> identifierProvider)
public com.vaadin.flow.shared.Registration addItemCountChangeListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.data.provider.ItemCountChangeEvent<?>> listener)
Combo box fires ItemCountChangeEvent and notifies all the
listeners added by this method, if the items count changed due to adding
or removing an item(s), or by changing the server-side filtering with
setFilter(SerializablePredicate) or
addFilter(SerializablePredicate).
ComboBox's client-side filter change won't fire
ItemCountChangeEvent, since it doesn't change the item count on
the server-side, but only makes it easier for users to search through the
items in the UI.
public ComboBoxListDataView<T> addFilter(com.vaadin.flow.function.SerializablePredicate<T> filter)
setFilter(com.vaadin.flow.function.SerializablePredicate<T>) or addFilter(com.vaadin.flow.function.SerializablePredicate<T>). This filter is applied to data
set permanently until it's changed through setFilter(com.vaadin.flow.function.SerializablePredicate<T>) or
removeFilters(), in contrary with the client-side filter that can
be typed in by user and does not modify the data set on server-side, but
only defines which items are shown for a single request and erases on
drop down close.
This filter is bound to the component. Thus, any other component using
the same DataProvider object would not be affected by setting a
filter through data view of another component. A filter set by this
method won't be retained when a new DataProvider is set to the
component.
addFilter in interface com.vaadin.flow.data.provider.ListDataView<T,com.vaadin.flow.data.provider.AbstractListDataView<T>>addFilter in class com.vaadin.flow.data.provider.AbstractListDataView<T>filter - the filter to add, not nullsetFilter(SerializablePredicate),
removeFilters()public ComboBoxListDataView<T> removeFilters()
removeFilters in interface com.vaadin.flow.data.provider.ListDataView<T,com.vaadin.flow.data.provider.AbstractListDataView<T>>removeFilters in class com.vaadin.flow.data.provider.AbstractListDataView<T>addFilter(SerializablePredicate),
setFilter(SerializablePredicate)public ComboBoxListDataView<T> setFilter(com.vaadin.flow.function.SerializablePredicate<T> filter)
null will clear all
filters. This filter is applied to data set permanently until it's
changed through setFilter(com.vaadin.flow.function.SerializablePredicate<T>) or removeFilters(), in contrary
with the client-side filter that can be typed in by user and does not
modify the data set on server-side, but only defines which items are
shown for a single request and erases on drop down close.
This filter is bound to the component. Thus, any other component using
the same DataProvider object would not be affected by setting a
filter through data view of another component. A filter set by this
method won't be retained when a new DataProvider is set to the
component.
setFilter in interface com.vaadin.flow.data.provider.ListDataView<T,com.vaadin.flow.data.provider.AbstractListDataView<T>>setFilter in class com.vaadin.flow.data.provider.AbstractListDataView<T>filter - filter to be set, or null to clear any previously
set filtersaddFilter(SerializablePredicate),
removeFilters()Copyright © 2021. All rights reserved.