Interface HasItemComponents<T>

Type Parameters:
T - the type of the displayed items
All Superinterfaces:
com.vaadin.flow.component.HasComponents, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, Serializable
All Known Subinterfaces:
HasItemsAndComponents<T>

public interface HasItemComponents<T> extends com.vaadin.flow.component.HasComponents
Represents a component that can have additional components between the items.

The items should be represented by components that implement HasItemComponents.ItemComponent. Additionally any type of components can be added at any position with addComponents(Object, Component...) or prependComponents(Object, Component...).

Author:
Vaadin Ltd
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Represents a single item component that is used inside a HasItemComponents.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    addComponents(T afterItem, com.vaadin.flow.component.Component... components)
    Adds the components after the given item.
    default int
    Gets the index of the child element that represents the given item.
    default void
    prependComponents(T beforeItem, com.vaadin.flow.component.Component... components)
    Adds the components before the given item.

    Methods inherited from interface com.vaadin.flow.component.HasComponents

    add, add, add, addComponentAsFirst, addComponentAtIndex, remove, remove, removeAll

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods inherited from interface com.vaadin.flow.component.HasEnabled

    bindEnabled, isEnabled, setEnabled
  • Method Details

    • addComponents

      default void addComponents(T afterItem, com.vaadin.flow.component.Component... components)
      Adds the components after the given item.
      Parameters:
      afterItem - item to add components after
      components - components to add after item
      Throws:
      IllegalArgumentException - if this component doesn't contain the item
    • prependComponents

      default void prependComponents(T beforeItem, com.vaadin.flow.component.Component... components)
      Adds the components before the given item.
      Parameters:
      beforeItem - item to add components in front of
      components - components to add before item
      Throws:
      IllegalArgumentException - if this component doesn't contain the item
    • getItemPosition

      default int getItemPosition(T item)
      Gets the index of the child element that represents the given item.
      Parameters:
      item - the item to look for
      Returns:
      the index of the child element that represents the item, or -1 if the item is not found