Class SimpleList

java.lang.Object
org.patternfly.component.BaseComponent<elemental2.dom.HTMLElement, SimpleList>
org.patternfly.component.list.SimpleList
All Implemented Interfaces:
Iterable<SimpleListItem>, ElementAttributeMethods<elemental2.dom.HTMLElement, SimpleList>, ElementClassListMethods<elemental2.dom.HTMLElement, SimpleList>, ElementConsumerMethods<elemental2.dom.HTMLElement, SimpleList>, ElementContainerMethods<elemental2.dom.HTMLElement, SimpleList>, ElementEventMethods<elemental2.dom.HTMLElement, SimpleList>, ElementIdMethods<elemental2.dom.HTMLElement, SimpleList>, ElementQueryMethods<elemental2.dom.HTMLElement>, HTMLElementAttributeMethods<elemental2.dom.HTMLElement, SimpleList>, HTMLElementDataMethods<elemental2.dom.HTMLElement, SimpleList>, HTMLElementStyleMethods<elemental2.dom.HTMLElement, SimpleList>, HTMLElementVisibilityMethods<elemental2.dom.HTMLElement, SimpleList>, IsElement<elemental2.dom.HTMLElement>, TypedBuilder<elemental2.dom.HTMLElement, SimpleList>, Component, HasItems<elemental2.dom.HTMLElement, SimpleList, SimpleListItem>, Ordered<elemental2.dom.HTMLElement, SimpleList, SimpleListItem>, OuiaSupport<elemental2.dom.HTMLElement, SimpleList>

public class SimpleList extends BaseComponent<elemental2.dom.HTMLElement, SimpleList> implements Ordered<elemental2.dom.HTMLElement, SimpleList, SimpleListItem>
A simple list provides a list of selectable items that can be shown within a page. Each item is described by a text label. The list may be divided into logical sections by introducing group headers.
See Also:
  • Method Details

    • simpleList

      public static SimpleList simpleList()
    • addGroup

      public SimpleList addGroup(SimpleListGroup group)
    • add

      public SimpleList add(SimpleListGroup group)
    • add

      public SimpleList add(SimpleListItem item)
      Description copied from interface: HasItems
      Adds an item to the component.
      Specified by:
      add in interface HasItems<elemental2.dom.HTMLElement, SimpleList, SimpleListItem>
      Parameters:
      item - the item to be added to the component
      Returns:
      the builder instance after the item has been added
    • ordered

      public SimpleList ordered(Comparator<SimpleListItem> comparator)
      Description copied from interface: Ordered
      Orders the elements contained in the component using the specified comparator. The comparator determines the order in which the elements are arranged.
      Specified by:
      ordered in interface Ordered<elemental2.dom.HTMLElement, SimpleList, SimpleListItem>
      Parameters:
      comparator - the comparator used to define the ordering of the elements
      Returns:
      the builder instance with the elements ordered
    • that

      public SimpleList that()
      Specified by:
      that in interface TypedBuilder<elemental2.dom.HTMLElement, SimpleList>
    • ariaLabel

      public SimpleList ariaLabel(String label)
    • onAdd

      Description copied from interface: HasItems
      Registers a callback to be invoked whenever a new item is added to the component.
      Specified by:
      onAdd in interface HasItems<elemental2.dom.HTMLElement, SimpleList, SimpleListItem>
      Parameters:
      onAdd - a AddItemHandler that takes the builder instance and the item being added as arguments
      Returns:
      the builder instance after adding the callback
    • onUpdate

      public SimpleList onUpdate(UpdateItemHandler<SimpleList, SimpleListItem> onUpdate)
      Description copied from interface: HasItems
      Registers a callback to be invoked whenever an item is updated in the component.
      Specified by:
      onUpdate in interface HasItems<elemental2.dom.HTMLElement, SimpleList, SimpleListItem>
      Parameters:
      onUpdate - a UpdateItemHandler that takes the component, the previous state of the item, and the updated state of the item as arguments
      Returns:
      the builder instance after adding the callback
    • onRemove

      public SimpleList onRemove(RemoveItemHandler<SimpleList, SimpleListItem> onRemove)
      Description copied from interface: HasItems
      Registers a callback to be invoked whenever an item is removed from the component.
      Specified by:
      onRemove in interface HasItems<elemental2.dom.HTMLElement, SimpleList, SimpleListItem>
      Parameters:
      onRemove - a RemoveItemHandler that takes the component and the item being removed as arguments
      Returns:
      the builder instance after adding the callback
    • onSelect

      public SimpleList onSelect(SelectHandler<SimpleListItem> selectHandler)
    • comparator

      public Comparator<SimpleListItem> comparator()
      Description copied from interface: Ordered
      Retrieves the comparator used for ordering elements in a component.
      Specified by:
      comparator in interface Ordered<elemental2.dom.HTMLElement, SimpleList, SimpleListItem>
      Returns:
      the comparator that determines the order of elements
    • select

      public void select(String identifier)
    • select

      public void select(String identifier, boolean selected)
    • select

      public void select(String identifier, boolean selected, boolean fireEvent)
    • select

      public void select(SimpleListItem item)
    • select

      public void select(SimpleListItem item, boolean selected)
    • select

      public void select(SimpleListItem item, boolean selected, boolean fireEvent)
    • iterator

      public Iterator<SimpleListItem> iterator()
      Specified by:
      iterator in interface Iterable<SimpleListItem>
    • size

      public int size()
      Description copied from interface: HasItems
      Retrieves the total number of items currently contained in the component.
      Specified by:
      size in interface HasItems<elemental2.dom.HTMLElement, SimpleList, SimpleListItem>
      Returns:
      the number of items contained in the component
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: HasItems
      Checks whether the collection of items in the component is empty.
      Specified by:
      isEmpty in interface HasItems<elemental2.dom.HTMLElement, SimpleList, SimpleListItem>
      Returns:
      true if the component contains no items; false otherwise
    • contains

      public boolean contains(String identifier)
      Description copied from interface: HasItems
      Checks whether the component contains an item associated with the given identifier.
      Specified by:
      contains in interface HasItems<elemental2.dom.HTMLElement, SimpleList, SimpleListItem>
      Parameters:
      identifier - the identifier of the item to be checked
      Returns:
      true if the component contains an item associated with the provided identifier, false otherwise
    • item

      public SimpleListItem item(String identifier)
      Description copied from interface: HasItems
      Retrieves the item associated with the specified identifier from the component.
      Specified by:
      item in interface HasItems<elemental2.dom.HTMLElement, SimpleList, SimpleListItem>
      Parameters:
      identifier - the identifier of the item to be retrieved
      Returns:
      the item associated with the given identifier, or null if no item is found
    • updateItem

      public void updateItem(SimpleListItem item)
      Description copied from interface: HasItems
      Updates an existing item in the component.
      Specified by:
      updateItem in interface HasItems<elemental2.dom.HTMLElement, SimpleList, SimpleListItem>
      Parameters:
      item - the item to be updated
    • removeItem

      public void removeItem(String identifier)
      Description copied from interface: HasItems
      Removes an item from the component based on the provided identifier.
      Specified by:
      removeItem in interface HasItems<elemental2.dom.HTMLElement, SimpleList, SimpleListItem>
      Parameters:
      identifier - the identifier of the item to be removed
    • clear

      public void clear()
      Description copied from interface: HasItems
      Clears all items from the component. This method removes any existing items within the component, leaving it empty. Any associated or registered callbacks related to the removal of items may be invoked as part of this operation.
      Specified by:
      clear in interface HasItems<elemental2.dom.HTMLElement, SimpleList, SimpleListItem>