Class ComboBoxDataView<T>
- java.lang.Object
-
- com.vaadin.flow.data.provider.AbstractDataView<T>
-
- com.vaadin.flow.component.combobox.dataview.ComboBoxDataView<T>
-
- Type Parameters:
T- the item type
- All Implemented Interfaces:
com.vaadin.flow.data.provider.DataView<T>,Serializable
public class ComboBoxDataView<T> extends com.vaadin.flow.data.provider.AbstractDataView<T>Implementation of generic data view for ComboBox. This implementation does not depend on a certain type of data provider, i.e. whether is it of in-memory or backend type. It can be used if the type of data provider is not eitherListDataProviderorBackEndDataProvider.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ComboBoxDataView(com.vaadin.flow.data.provider.DataCommunicator<T> dataCommunicator, ComboBoxBase<?,T,?> comboBox)Creates a new generic data view for ComboBox and verifies the passed data provider is compatible with this data view implementation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.vaadin.flow.shared.RegistrationaddItemCountChangeListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.data.provider.ItemCountChangeEvent<?>> listener)TgetItem(int index)Gets the item at the given index from the data available in the ComboBox's server-side.Stream<T>getItems()Gets the items available on the ComboBox's server-side.protected Class<?>getSupportedDataProviderType()voidsetIdentifierProvider(com.vaadin.flow.data.provider.IdentifierProvider<T> identifierProvider)
-
-
-
Constructor Detail
-
ComboBoxDataView
public ComboBoxDataView(com.vaadin.flow.data.provider.DataCommunicator<T> dataCommunicator, ComboBoxBase<?,T,?> comboBox)
Creates a new generic data view for ComboBox and verifies the passed data provider is compatible with this data view implementation.- Parameters:
dataCommunicator- the data communicator of the componentcomboBox- the ComboBox
-
-
Method Detail
-
getItem
public T getItem(int index)
Gets the item at the given index from the data available in the ComboBox's server-side.This method 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.
- Parameters:
index- item index number- Returns:
- item on index
- Throws:
IndexOutOfBoundsException- requested index is outside of the data set
-
getSupportedDataProviderType
protected Class<?> getSupportedDataProviderType()
- Specified by:
getSupportedDataProviderTypein classcom.vaadin.flow.data.provider.AbstractDataView<T>
-
getItems
public Stream<T> getItems()
Gets the items available on the ComboBox's server-side.This method 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.
-
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, for instance, due to adding or removing an item(s).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.
-
-