Class AbstractContainerGridDataProvider<T>

java.lang.Object
com.vaadin.flow.data.provider.AbstractDataProvider<T,Void>
io.jmix.flowui.component.grid.AbstractContainerGridDataProvider<T>
All Implemented Interfaces:
com.vaadin.flow.data.provider.DataProvider<T,Void>, JmixBinding, ContainerDataUnit<T>, DataUnit, EntityDataUnit, EntityGridDataItems<T>, GridDataItems<T>, HasType<T>, Serializable
Direct Known Subclasses:
JmixGridDataProvider

public abstract class AbstractContainerGridDataProvider<T> extends com.vaadin.flow.data.provider.AbstractDataProvider<T,Void> implements ContainerDataUnit<T>, EntityGridDataItems<T>, JmixBinding
See Also:
  • Field Details

  • Constructor Details

    • AbstractContainerGridDataProvider

      public AbstractContainerGridDataProvider(CollectionContainer<T> container)
  • Method Details

    • onContainerItemChanged

      protected void onContainerItemChanged(InstanceContainer.ItemChangeEvent<T> itemChangeEvent)
    • onContainerCollectionChanged

      protected void onContainerCollectionChanged(CollectionContainer.CollectionChangeEvent<T> collectionChangeEvent)
    • containerItemPropertyChanged

      protected void containerItemPropertyChanged(InstanceContainer.ItemPropertyChangeEvent<T> event)
    • bind

      public void bind()
      Specified by:
      bind in interface JmixBinding
    • unbind

      public void unbind()
      Specified by:
      unbind in interface JmixBinding
    • addItemSetChangeListener

      public com.vaadin.flow.shared.Registration addItemSetChangeListener(Consumer<GridDataItems.ItemSetChangeEvent<T>> listener)
      Description copied from interface: GridDataItems
      Registers a new item set change listener.
      Specified by:
      addItemSetChangeListener in interface GridDataItems<T>
      Parameters:
      listener - the listener to be added
      Returns:
      a registration object for removing an event listener added to a source
    • addValueChangeListener

      public com.vaadin.flow.shared.Registration addValueChangeListener(Consumer<GridDataItems.ValueChangeEvent<T>> listener)
      Description copied from interface: GridDataItems
      Registers a new value change listener.
      Specified by:
      addValueChangeListener in interface GridDataItems<T>
      Parameters:
      listener - the listener to be added
      Returns:
      a registration object for removing an event listener added to a source
    • addSelectedItemChangeListener

      public com.vaadin.flow.shared.Registration addSelectedItemChangeListener(Consumer<GridDataItems.SelectedItemChangeEvent<T>> listener)
      Description copied from interface: GridDataItems
      Registers a new selected item change listener.
      Specified by:
      addSelectedItemChangeListener in interface GridDataItems<T>
      Parameters:
      listener - the listener to be added
      Returns:
      a registration object for removing an event listener added to a source
    • isInMemory

      public boolean isInMemory()
      Specified by:
      isInMemory in interface com.vaadin.flow.data.provider.DataProvider<T,Void>
    • size

      public int size(com.vaadin.flow.data.provider.Query<T,Void> query)
      Specified by:
      size in interface com.vaadin.flow.data.provider.DataProvider<T,Void>
    • fetch

      public Stream<T> fetch(com.vaadin.flow.data.provider.Query<T,Void> query)
      Specified by:
      fetch in interface com.vaadin.flow.data.provider.DataProvider<T,Void>
    • getState

      public BindingState getState()
      Specified by:
      getState in interface DataUnit
      Returns:
      a state of this source
    • setState

      protected void setState(BindingState state)
    • addStateChangeListener

      public com.vaadin.flow.shared.Registration addStateChangeListener(Consumer<DataUnit.StateChangeEvent> listener)
      Description copied from interface: DataUnit
      Registers a new state change listener.
      Specified by:
      addStateChangeListener in interface DataUnit
      Parameters:
      listener - the listener to be added
      Returns:
      a registration object for removing an event listener added to a source
    • getEntityMetaClass

      public MetaClass getEntityMetaClass()
      Specified by:
      getEntityMetaClass in interface EntityDataUnit
      Returns:
      MetaClass of an entity contained in the source
    • getContainer

      public CollectionContainer<T> getContainer()
      Specified by:
      getContainer in interface ContainerDataUnit<T>
    • getItemId

      @Nullable public Object getItemId(T item)
      Specified by:
      getItemId in interface GridDataItems<T>
      Parameters:
      item - the item for obtaining the id
      Returns:
      the id on the given item
    • getItem

      @Nullable public T getItem(@Nullable Object itemId)
      Specified by:
      getItem in interface GridDataItems<T>
      Parameters:
      itemId - the item id
      Returns:
      the item by the given id
    • getItemValue

      @Nullable public Object getItemValue(Object itemId, MetaPropertyPath propertyId)
      Specified by:
      getItemValue in interface GridDataItems<T>
      Parameters:
      itemId - the item id
      propertyId - the property id
      Returns:
      the item value
    • indexOfItem

      public int indexOfItem(T item)
      Specified by:
      indexOfItem in interface GridDataItems<T>
      Parameters:
      item - the item for obtaining the index
      Returns:
      the index of the given item
    • getItemByIndex

      @Nullable public T getItemByIndex(int index)
      Specified by:
      getItemByIndex in interface GridDataItems<T>
      Parameters:
      index - the item index
      Returns:
      the item by the given index
    • getItems

      public Stream<T> getItems()
      Specified by:
      getItems in interface GridDataItems<T>
      Returns:
      the stream of all items
    • getItems

      public List<T> getItems(int startIndex, int numberOfItems)
      Specified by:
      getItems in interface GridDataItems<T>
      Parameters:
      startIndex - the start index
      numberOfItems - the number of items
      Returns:
      items from the startIndex and size not exceeding the specified number
    • containsItem

      public boolean containsItem(T item)
      Specified by:
      containsItem in interface GridDataItems<T>
      Parameters:
      item - an item to check
      Returns:
      true if the underlying collection contains an item, false otherwise
    • size

      public int size()
      Specified by:
      size in interface GridDataItems<T>
      Returns:
      size of the underlying collection
    • getSelectedItem

      @Nullable public T getSelectedItem()
      Specified by:
      getSelectedItem in interface GridDataItems<T>
      Returns:
      the current item contained in the source
    • setSelectedItem

      public void setSelectedItem(@Nullable T item)
      Description copied from interface: GridDataItems
      Set current item in the source.
      Specified by:
      setSelectedItem in interface GridDataItems<T>
      Parameters:
      item - the item to set
    • getType

      public Class<T> getType()
      Specified by:
      getType in interface HasType<T>
      Returns:
      type of value