T - the item typepublic class ComboBoxDataView<T> extends AbstractDataView<T>
ListDataProvider or BackEndDataProvider.component, dataProviderSupplier, NULL_IDENTIFIER_ERROR_MESSAGE, NULL_ITEM_ERROR_MESSAGE| Constructor and Description |
|---|
ComboBoxDataView(DataCommunicator<T> dataCommunicator,
ComboBox<T> comboBox)
Creates a new generic data view for ComboBox and verifies the passed data
provider is compatible with this data view implementation.
|
| Modifier and Type | Method and Description |
|---|---|
Registration |
addItemCountChangeListener(ComponentEventListener<ItemCountChangeEvent<?>> listener)
Add an item count change listener that is fired when the item count
changes.
|
T |
getItem(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()
Returns supported
DataProvider type for this DataView. |
void |
setIdentifierProvider(IdentifierProvider<T> identifierProvider)
Sets an identifier provider, which returns an identifier for the given
item.
|
equals, getIdentifierProvider, refreshAll, refreshItem, verifyDataProviderTypepublic ComboBoxDataView(DataCommunicator<T> dataCommunicator, ComboBox<T> comboBox)
dataCommunicator - the data communicator of the componentcomboBox - the ComboBoxpublic T getItem(int index)
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.
index - item index numberIndexOutOfBoundsException - requested index is outside of the data setprotected Class<?> getSupportedDataProviderType()
AbstractDataViewDataProvider type for this DataView.getSupportedDataProviderType in class AbstractDataView<T>public Stream<T> getItems()
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.
public void setIdentifierProvider(IdentifierProvider<T> identifierProvider)
DataViewdataView.setIdentifiedProvider(Item::getId);.setIdentifierProvider in interface DataView<T>setIdentifierProvider in class AbstractDataView<T>identifierProvider - function that returns the non-null identifier for a given itempublic Registration addItemCountChangeListener(ComponentEventListener<ItemCountChangeEvent<?>> listener)
Item count change listener is bound to the component and will be retained
even if the data changes by setting of a new items or
DataProvider to component.
NOTE: when the component supports lazy loading (implements
HasLazyDataView) and a count callback has not been provided, an
estimate of the item count is used and increased until the actual count
has been reached. When the estimate is used, the event is fired with the
ItemCountChangeEvent.isItemCountEstimated() returning
true.
Combo box fires ItemCountChangeEvent and 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.
addItemCountChangeListener in interface DataView<T>addItemCountChangeListener in class AbstractDataView<T>listener - item count change listener to registerCopyright © 2022. All rights reserved.