Class ComboBoxListDataView<T>
- Type Parameters:
T- the type of the items in ComboBox
- All Implemented Interfaces:
com.vaadin.flow.data.provider.DataView<T>,com.vaadin.flow.data.provider.ListDataView<T,,com.vaadin.flow.data.provider.AbstractListDataView<T>> Serializable
- See Also:
-
Field Summary
Fields inherited from class com.vaadin.flow.data.provider.AbstractDataView
component, dataProviderSupplier, NULL_IDENTIFIER_ERROR_MESSAGE, NULL_ITEM_ERROR_MESSAGE -
Constructor Summary
ConstructorsConstructorDescriptionComboBoxListDataView(com.vaadin.flow.data.provider.DataCommunicator<T> dataCommunicator, ComboBoxBase<?, 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. -
Method Summary
Modifier and TypeMethodDescriptionAdds a filter to be applied to all queries.com.vaadin.flow.shared.RegistrationaddItemCountChangeListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.data.provider.ItemCountChangeEvent<?>> listener) intgetItems()Gets the items available on the ComboBox's server-side.Removes all in-memory filters set or added.Sets a filter to be applied to the data.voidsetIdentifierProvider(com.vaadin.flow.data.provider.IdentifierProvider<T> identifierProvider) Methods inherited from class com.vaadin.flow.data.provider.AbstractListDataView
addItem, addItemAfter, addItemBefore, addItems, addItemsAfter, addItemsBefore, addSortComparator, addSortOrder, contains, getDataProvider, getItem, getNextItem, getPreviousItem, getSupportedDataProviderType, removeItem, removeItems, removeSorting, setSortComparator, setSortOrder, validateItemIndexMethods inherited from class com.vaadin.flow.data.provider.AbstractDataView
addIdentifierProviderChangeListener, equals, getIdentifierProvider, getItemIndex, getItemIndex, refreshAll, refreshItem, verifyDataProviderType, verifyDataProviderTypeMethods 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.DataView
getItemIndex, refreshAll, refreshItem
-
Constructor Details
-
ComboBoxListDataView
public ComboBoxListDataView(com.vaadin.flow.data.provider.DataCommunicator<T> dataCommunicator, ComboBoxBase<?, 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.- Parameters:
dataCommunicator- the data communicator of the ComboBox, notnullcomboBox- the ComboBox component, notnullfilterOrSortingChangedCallback- callback, which is being invoked when the ComboBox's filtering or sorting changes, notnull
-
-
Method Details
-
getItems
Gets the items available on the ComboBox's server-side.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)oraddFilter(SerializablePredicate). -
getItemCount
public int getItemCount()This method takes into account only the server-side filtering, which is set by:
setFilter(SerializablePredicate)oraddFilter(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. -
setIdentifierProvider
public void setIdentifierProvider(com.vaadin.flow.data.provider.IdentifierProvider<T> identifierProvider) -
addItemCountChangeListener
public com.vaadin.flow.shared.Registration addItemCountChangeListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.data.provider.ItemCountChangeEvent<?>> listener) Combo box fires
ItemCountChangeEventand 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 withsetFilter(SerializablePredicate)oraddFilter(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. -
addFilter
Adds a filter to be applied to all queries. The filter will be used in addition to any filter that has been set or added previously throughsetFilter(com.vaadin.flow.function.SerializablePredicate<T>)oraddFilter(com.vaadin.flow.function.SerializablePredicate<T>). This filter is applied to data set permanently until it's changed throughsetFilter(com.vaadin.flow.function.SerializablePredicate<T>)orremoveFilters(), 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
DataProviderobject 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 newDataProvideris set to the component.- Specified by:
addFilterin interfacecom.vaadin.flow.data.provider.ListDataView<T,com.vaadin.flow.data.provider.AbstractListDataView<T>> - Overrides:
addFilterin classcom.vaadin.flow.data.provider.AbstractListDataView<T>- Parameters:
filter- the filter to add, notnull- Returns:
- ComboBoxListDataView instance
- See Also:
-
removeFilters
Removes all in-memory filters set or added. -
setFilter
Sets a filter to be applied to the data. The filter replaces any filter that has been set or added previously.nullwill clear all filters. This filter is applied to data set permanently until it's changed throughsetFilter(com.vaadin.flow.function.SerializablePredicate<T>)orremoveFilters(), 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
DataProviderobject 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 newDataProvideris set to the component.- Specified by:
setFilterin interfacecom.vaadin.flow.data.provider.ListDataView<T,com.vaadin.flow.data.provider.AbstractListDataView<T>> - Overrides:
setFilterin classcom.vaadin.flow.data.provider.AbstractListDataView<T>- Parameters:
filter- filter to be set, ornullto clear any previously set filters- Returns:
- ComboBoxListDataView instance
- See Also:
-