Class ComboBoxLazyDataView<T>

java.lang.Object
com.vaadin.flow.data.provider.AbstractDataView<T>
com.vaadin.flow.data.provider.AbstractLazyDataView<T>
com.vaadin.flow.component.combobox.dataview.ComboBoxLazyDataView<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.LazyDataView<T>, Serializable

public class ComboBoxLazyDataView<T> extends com.vaadin.flow.data.provider.AbstractLazyDataView<T>
Data view implementation for ComboBox with lazy data fetching. Provides information on the data and allows operations on it.
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

    Constructors
    Constructor
    Description
    ComboBoxLazyDataView(com.vaadin.flow.data.provider.DataCommunicator<T> dataCommunicator, com.vaadin.flow.component.Component component)
    Creates a new lazy data view for ComboBox and verifies the passed data provider is compatible with this data view implementation.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.vaadin.flow.shared.Registration
    addItemCountChangeListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.data.provider.ItemCountChangeEvent<?>> listener)
    getItem(int index)
    Gets the item at the given index from the data available in the ComboBox's server-side.
    Gets the items available on the ComboBox's server-side.
    void
    setIdentifierProvider(com.vaadin.flow.data.provider.IdentifierProvider<T> identifierProvider)
     
    void
    setItemCountCallback(com.vaadin.flow.data.provider.CallbackDataProvider.CountCallback<T,String> callback)
    Sets a callback that the combo box uses to get the exact item count in the backend.
    void
    setItemCountEstimate(int itemCountEstimate)
    void
    void

    Methods inherited from class com.vaadin.flow.data.provider.AbstractLazyDataView

    getDataCommunicator, getItemCountEstimate, getItemCountEstimateIncrease, getItemIndex, getItemIndexProvider, getSupportedDataProviderType, setItemCountEstimateIncrease, setItemIndexProvider

    Methods inherited from class com.vaadin.flow.data.provider.AbstractDataView

    addIdentifierProviderChangeListener, equals, getIdentifierProvider, getItemIndex, refreshAll, refreshItem, verifyDataProviderType, verifyDataProviderType

    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.DataView

    refreshAll, refreshItem
  • Constructor Details

    • ComboBoxLazyDataView

      public ComboBoxLazyDataView(com.vaadin.flow.data.provider.DataCommunicator<T> dataCommunicator, com.vaadin.flow.component.Component component)
      Creates a new lazy data view for ComboBox and verifies the passed data provider is compatible with this data view implementation.
      Parameters:
      dataCommunicator - the data communicator of the component
      component - the ComboBox
  • Method Details

    • setItemCountCallback

      public void setItemCountCallback(com.vaadin.flow.data.provider.CallbackDataProvider.CountCallback<T,String> callback)
      Sets a callback that the combo box uses to get the exact item count in the backend. Use this when it is cheap to get the exact item count and it is desired that the user sees the "full scrollbar size".

      The given callback will be queried for the count instead of the data provider DataProvider.size(Query) method when the component has a distinct data provider set with HasLazyDataView.setItems(BackEndDataProvider).

      Parameters:
      callback - the callback to use for determining item count in the backend, not null
      See Also:
    • setIdentifierProvider

      public void setIdentifierProvider(com.vaadin.flow.data.provider.IdentifierProvider<T> identifierProvider)
      Specified by:
      setIdentifierProvider in interface com.vaadin.flow.data.provider.DataView<T>
      Overrides:
      setIdentifierProvider in class com.vaadin.flow.data.provider.AbstractDataView<T>
    • setItemCountFromDataProvider

      public void setItemCountFromDataProvider()

      Calling this method will clear any previously set count callback with the setItemCountCallback(CallbackDataProvider.CountCallback) method.

      Specified by:
      setItemCountFromDataProvider in interface com.vaadin.flow.data.provider.LazyDataView<T>
      Overrides:
      setItemCountFromDataProvider in class com.vaadin.flow.data.provider.AbstractLazyDataView<T>
    • setItemCountEstimate

      public void setItemCountEstimate(int itemCountEstimate)

      Calling this method will clear any previously set count callback setItemCountCallback(CallbackDataProvider.CountCallback).

      Specified by:
      setItemCountEstimate in interface com.vaadin.flow.data.provider.LazyDataView<T>
      Overrides:
      setItemCountEstimate in class com.vaadin.flow.data.provider.AbstractLazyDataView<T>
    • setItemCountUnknown

      public void setItemCountUnknown()

      Calling this method will clear any previously set count callback setItemCountCallback(CallbackDataProvider.CountCallback).

      Specified by:
      setItemCountUnknown in interface com.vaadin.flow.data.provider.LazyDataView<T>
      Overrides:
      setItemCountUnknown in class com.vaadin.flow.data.provider.AbstractLazyDataView<T>
    • addItemCountChangeListener

      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, for instance, due to fetching more items while scrolling with unknown item count.

      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.

      Specified by:
      addItemCountChangeListener in interface com.vaadin.flow.data.provider.DataView<T>
      Overrides:
      addItemCountChangeListener in class com.vaadin.flow.data.provider.AbstractDataView<T>
    • 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.

      Specified by:
      getItem in interface com.vaadin.flow.data.provider.DataView<T>
      Overrides:
      getItem in class com.vaadin.flow.data.provider.AbstractLazyDataView<T>
      Parameters:
      index - item index number
      Returns:
      item on index
      Throws:
      IndexOutOfBoundsException - requested index is outside of the data set
    • 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-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.

      Specified by:
      getItems in interface com.vaadin.flow.data.provider.DataView<T>
      Overrides:
      getItems in class com.vaadin.flow.data.provider.AbstractLazyDataView<T>
      Returns:
      items available on the server-side