Klasse UiNavMenu<T>

java.lang.Object
org.obrel.core.RelatedObject
de.esoco.process.param.ParameterWrapper<List<org.obrel.core.RelationType<?>>,UiNavMenu<T>>
de.esoco.process.ui.UiComponent<List<org.obrel.core.RelationType<?>>,UiNavMenu<T>>
Alle implementierten Schnittstellen:
org.obrel.core.Relatable
Bekannte direkte Unterklassen:
UiSideMenu, UiTopMenu

public abstract class UiNavMenu<T> extends UiComposite<UiNavMenu<T>>
A composite that contains a navigation menu for an application.
  • Konstruktordetails

    • UiNavMenu

      protected UiNavMenu(UiContainer<?> parent)
      Creates a new instance without preset menu items.
      Parameter:
      parent - The parent container
    • UiNavMenu

      protected UiNavMenu(UiContainer<?> parent, Collection<T> menuItems)
      Creates a new instance with preset menu items.
      Parameter:
      parent - The parent container
      menuItems - The initial menu items
  • Methodendetails

    • getMenuItems

      public final Collection<T> getMenuItems()
      Returns the menu items of this instance.
      Gibt zurück:
      The collection of menu item enum values
    • getMenuLinks

      public final UiPushButtons<?> getMenuLinks()
      Returns the component containing the menu link buttons.
      Gibt zurück:
      The menu links parameter
    • onMenuSelection

      public void onMenuSelection(Consumer<T> handler)
      Sets the handler for menu actions. This will override any previously set menu selection handler.
      Parameter:
      handler - The handler to be invoked on menu selection
    • setActive

      public void setActive(T menuItem)
      Marks a certain menu item as active.
      Parameter:
      menuItem - The new active item or NULL for none
    • setMenuItems

      public void setMenuItems(Collection<T> menuItems)
      Sets the menu items to be displayed.
      Parameter:
      menuItems - The new menu items (NULL or empty for none)
    • setSearchText

      public void setSearchText(String text)
      Sets the text to be displayed in the search field (if such exists) or hides the field if the text is NULL.
      Parameter:
      text - The search text to show (NULL to hide the search field)
    • addMenuComponents

      protected void addMenuComponents(UiBuilder<?> builder)
      Adds components to this menu that should appear before the the menu items which are added later with addMenuItems(UiBuilder). Can be overridden by subclasses to add additional components like a logo image and/or a search field.
      Parameter:
      builder - The builder to add the menu components with
    • addMenuItems

      protected <E extends Enum<E>> void addMenuItems(UiBuilder<?> builder)
      Adds the menu item components of this menu. May be overridden by subclasses to modify or extend the menu presentation. The default implementation adds menu buttons for each menu item value.
      Parameter:
      builder - The builder to add the menu items with
    • addSearchField

      protected UiTextField addSearchField(UiBuilder<?> builder, String placeholder, Consumer<String> searchHandler)
      Adds a search input field with the given builder (which should be a builder from this menu).
      Parameter:
      builder - The builder to add the field with
      placeholder - The text to be displayed if the field is empty
      searchHandler - handler The handler to be invoked with the input value if a search is to be performed
      Gibt zurück:
      The search input field component
    • buildContent

      protected void buildContent(UiBuilder<?> builder)
      Builds this menu by first invoking addMenuComponents(UiBuilder) and then adds the menu items if such are available.
      Setzt außer Kraft:
      buildContent in Klasse UiContainer<UiNavMenu<T>>
      Parameter:
      builder - The builder to create the container UI with
      Siehe auch:
    • handleItemSelection

      protected void handleItemSelection(Object item)
      Handles the selection of a menu item by forwarding it to an event handler registered through onMenuSelection(Consumer).
      Parameter:
      item - The selected menu item