Class ListPivotTableItems<T>

java.lang.Object
io.jmix.pivottableflowui.data.ListPivotTableItems<T>
All Implemented Interfaces:
DataUnit, HasType<T>, PivotTableItems<T>, JmixPivotTableItems<T>, Serializable

public class ListPivotTableItems<T> extends Object implements PivotTableItems<T>
Data provider for a PivotTable component in which all items are stored in List
See Also:
  • Field Details

    • items

      protected final List<T> items
    • idAttribute

      protected final String idAttribute
    • idType

      protected final Class<?> idType
  • Constructor Details

    • ListPivotTableItems

      public ListPivotTableItems(String idAttribute, Class<?> idType)
    • ListPivotTableItems

      public ListPivotTableItems(String idAttribute, Class<?> idType, Collection<T> items)
    • ListPivotTableItems

      @SafeVarargs public ListPivotTableItems(String idAttribute, Class<?> idType, T... items)
  • Method Details

    • addItemsChangeListener

      public com.vaadin.flow.shared.Registration addItemsChangeListener(Consumer<JmixPivotTableItems.ItemsChangeEvent<T>> listener)
      Description copied from interface: JmixPivotTableItems
      Adds a listener that will be called when the associated collection or the property of an item of this collection changes.
      Specified by:
      addItemsChangeListener in interface JmixPivotTableItems<T>
      Parameters:
      listener - a listener to add
      Returns:
      a handle that can be used for removing the listener
    • getItems

      public Collection<T> getItems()
      Specified by:
      getItems in interface JmixPivotTableItems<T>
      Returns:
      unmodifiable collection of items
    • getItemValue

      @Nullable public <V> V getItemValue(T item, String propertyPath)
      Specified by:
      getItemValue in interface JmixPivotTableItems<T>
      Parameters:
      item - the item
      propertyPath - the property path
      Returns:
      the item value
    • setItemValue

      public void setItemValue(T item, String propertyPath, @Nullable Object value)
      Description copied from interface: JmixPivotTableItems
      Sets the value to the item.
      Specified by:
      setItemValue in interface JmixPivotTableItems<T>
      Parameters:
      item - the item
      propertyPath - the property path
      value - the value to set
    • getItemId

      @Nullable public Object getItemId(T item)
      Specified by:
      getItemId in interface JmixPivotTableItems<T>
      Parameters:
      item - the item
      Returns:
      the id of the item
    • getItem

      public T getItem(Object itemId)
      Description copied from interface: JmixPivotTableItems
      Finds an item by its id.
      Specified by:
      getItem in interface JmixPivotTableItems<T>
      Parameters:
      itemId - the item id
      Returns:
      the item by the given id
    • getItem

      public T getItem(String stringId)
      Description copied from interface: JmixPivotTableItems
      Finds an item by its string id.
      Specified by:
      getItem in interface JmixPivotTableItems<T>
      Parameters:
      stringId - the item string id
      Returns:
      the item by the given id
    • addItem

      public void addItem(T item)
      Adds passed item to the list.
      Parameters:
      item - item to add
    • addItems

      @SafeVarargs public final void addItems(T... items)
      Adds passed items to the list.
      Parameters:
      items - items to add
    • addItems

      public void addItems(Collection<T> items)
      Adds passed items to the list.
      Parameters:
      items - items to add
    • updateItem

      public void updateItem(T item)
      Description copied from interface: JmixPivotTableItems
      If the item with the same id exists, it is replaced with the given instance. If not, the given instance is added to the items list.
      Specified by:
      updateItem in interface JmixPivotTableItems<T>
      Parameters:
      item - item to update
    • removeItem

      public void removeItem(T item)
      Removes the passed item from the list.
      Parameters:
      item - item to remove
    • removeAll

      public void removeAll()
      Removes all items.
    • containsItem

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

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

      public BindingState getState()
      Specified by:
      getState in interface DataUnit
      Returns:
      a state of this source
    • 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
    • getValueInternal

      @Nullable protected Object getValueInternal(@Nullable T item, String path)
    • setValueInternal

      protected void setValueInternal(T item, String path, @Nullable Object value)
    • deserializeId

      protected Object deserializeId(String stringValue)
    • getMethodsCache

      protected MethodsCache getMethodsCache(Object object)
    • fireChangeEvent

      protected void fireChangeEvent(JmixPivotTableItems.ItemsChangeType operationType, Collection<T> items)
    • getEventBus

      protected EventBus getEventBus()