Class MenuList

java.lang.Object
org.patternfly.component.SubComponent<elemental2.dom.HTMLUListElement, MenuList>
org.patternfly.component.menu.MenuList
All Implemented Interfaces:
Iterable<MenuItem>, Attachable, ElementAttributeMethods<elemental2.dom.HTMLUListElement, MenuList>, ElementClassListMethods<elemental2.dom.HTMLUListElement, MenuList>, ElementConsumerMethods<elemental2.dom.HTMLUListElement, MenuList>, ElementContainerMethods<elemental2.dom.HTMLUListElement, MenuList>, ElementEventMethods<elemental2.dom.HTMLUListElement, MenuList>, ElementIdMethods<elemental2.dom.HTMLUListElement, MenuList>, ElementQueryMethods<elemental2.dom.HTMLUListElement>, HTMLElementAttributeMethods<elemental2.dom.HTMLUListElement, MenuList>, HTMLElementDataMethods<elemental2.dom.HTMLUListElement, MenuList>, HTMLElementStyleMethods<elemental2.dom.HTMLUListElement, MenuList>, HTMLElementVisibilityMethods<elemental2.dom.HTMLUListElement, MenuList>, IsElement<elemental2.dom.HTMLUListElement>, TypedBuilder<elemental2.dom.HTMLUListElement, MenuList>, HasAsyncItems<MenuList,MenuItem>, HasItems<elemental2.dom.HTMLUListElement, MenuList, MenuItem>, Ordered<elemental2.dom.HTMLUListElement, MenuList, MenuItem>, OuiaSupport<elemental2.dom.HTMLUListElement, MenuList>

public class MenuList extends SubComponent<elemental2.dom.HTMLUListElement, MenuList> implements HasAsyncItems<MenuList,MenuItem>, Ordered<elemental2.dom.HTMLUListElement, MenuList, MenuItem>, Attachable
A menu list within a Menu component.
  • Field Details

  • Method Details

    • attach

      public void attach(elemental2.dom.MutationRecord mutationRecord)
      Specified by:
      attach in interface Attachable
    • add

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

      public MenuList add(AsyncItems<MenuList,MenuItem> items)
      Specified by:
      add in interface HasAsyncItems<MenuList,MenuItem>
    • addDivider

      public MenuList addDivider()
    • loading

      public MenuList loading(Supplier<MenuItem> loading)
      Sets a custom supplier for the loading indicator shown while async items are being loaded. Pass null to disable the loading indicator.
    • noItems

      public MenuList noItems(Supplier<MenuItem> noItems)
      Sets a custom supplier for the "no items" indicator shown when async items return an empty result. Pass null to disable the indicator and leave the menu empty (which typically causes it to collapse).
    • error

      public MenuList error(Supplier<MenuItem> error)
      Sets a custom supplier for the error indicator shown when async items fail to load. Pass null to disable the error indicator.
    • ordered

      public MenuList ordered(Comparator<MenuItem> 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.HTMLUListElement, MenuList, MenuItem>
      Parameters:
      comparator - the comparator used to define the ordering of the elements
      Returns:
      the builder instance with the elements ordered
    • that

      public MenuList that()
      Specified by:
      that in interface TypedBuilder<elemental2.dom.HTMLUListElement, MenuList>
    • onAdd

      public MenuList onAdd(AddItemHandler<MenuList,MenuItem> 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.HTMLUListElement, MenuList, MenuItem>
      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 MenuList onUpdate(UpdateItemHandler<MenuList,MenuItem> 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.HTMLUListElement, MenuList, MenuItem>
      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 MenuList onRemove(RemoveItemHandler<MenuList,MenuItem> 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.HTMLUListElement, MenuList, MenuItem>
      Parameters:
      onRemove - a RemoveItemHandler that takes the component and the item being removed as arguments
      Returns:
      the builder instance after adding the callback
    • comparator

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

      public elemental2.promise.Promise<Iterable<MenuItem>> load()
      Description copied from interface: HasAsyncItems
      Fetches items for the first time. Only runs when status is AsyncStatus.pending. Idempotent.
      Specified by:
      load in interface HasAsyncItems<MenuList,MenuItem>
    • refresh

      public elemental2.promise.Promise<Iterable<MenuItem>> refresh()
      Description copied from interface: HasAsyncItems
      Re-fetches items while keeping old items visible, then swaps them after the new items arrive.
      Specified by:
      refresh in interface HasAsyncItems<MenuList,MenuItem>
    • reset

      public void reset()
      Description copied from interface: HasAsyncItems
      Clears all items and sets status back to AsyncStatus.pending. Does not fetch.
      Specified by:
      reset in interface HasAsyncItems<MenuList,MenuItem>
    • status

      public AsyncStatus status()
      Specified by:
      status in interface HasAsyncItems<MenuList,MenuItem>
    • iterator

      public Iterator<MenuItem> iterator()
      Specified by:
      iterator in interface Iterable<MenuItem>
    • 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.HTMLUListElement, MenuList, MenuItem>
      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.HTMLUListElement, MenuList, MenuItem>
      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.HTMLUListElement, MenuList, MenuItem>
      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 MenuItem 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.HTMLUListElement, MenuList, MenuItem>
      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(MenuItem item)
      Description copied from interface: HasItems
      Updates an existing item in the component.
      Specified by:
      updateItem in interface HasItems<elemental2.dom.HTMLUListElement, MenuList, MenuItem>
      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.HTMLUListElement, MenuList, MenuItem>
      Parameters:
      identifier - the identifier of the item to be removed
    • clear

      public void clear()
      Removes all items from the DOM and the internal map. Does not affect async state.
      Specified by:
      clear in interface HasItems<elemental2.dom.HTMLUListElement, MenuList, MenuItem>