Class ListKanbanItems<T>

java.lang.Object
io.jmix.kanbanflowui.component.data.ListKanbanItems<T>
All Implemented Interfaces:
DataUnit, HasType<T>, KanbanItems<T>, JmixKanbanItems<T>, Serializable

public class ListKanbanItems<T> extends Object implements KanbanItems<T>
Data provider for a Kanban 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

    • ListKanbanItems

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

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

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

    • addItemsChangeListener

      public com.vaadin.flow.shared.Registration addItemsChangeListener(Consumer<JmixKanbanItems.ItemsChangeEvent<T>> listener)
      Description copied from interface: JmixKanbanItems
      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 JmixKanbanItems<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 JmixKanbanItems<T>
      Returns:
      unmodifiable collection of items
    • getItemValue

      @Nullable public <V> V getItemValue(T item, String propertyPath)
      Specified by:
      getItemValue in interface JmixKanbanItems<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: JmixKanbanItems
      Sets the value to the item.
      Specified by:
      setItemValue in interface JmixKanbanItems<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 JmixKanbanItems<T>
      Parameters:
      item - the item
      Returns:
      the id of the item
    • getItem

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

      public T getItem(String stringId)
      Description copied from interface: JmixKanbanItems
      Finds an item by its string id.
      Specified by:
      getItem in interface JmixKanbanItems<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: JmixKanbanItems
      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 JmixKanbanItems<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 JmixKanbanItems<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(JmixKanbanItems.ItemsChangeType operationType, Collection<T> items)
    • getEventBus

      protected EventBus getEventBus()