Class MenuBarModelSupport<B,MB,M,MI>

java.lang.Object
it.tidalwave.role.ui.spi.MenuBarModelSupport<B,MB,M,MI>
Type Parameters:
B - the type of the binder
MB - the type of the menubar
M - the type of the menu
MI - the type of the menu item
All Implemented Interfaces:
MenuBarModel

public abstract class MenuBarModelSupport<B,MB,M,MI> extends Object implements MenuBarModel
A support implementation for MenuBarModel.
Since:
1.1-ALPHA-6
Author:
Fabrizio Giudici
  • Field Details

    • userActionsSupplier

      @Nonnull protected final Supplier<Collection<? extends it.tidalwave.role.ui.UserAction>> userActionsSupplier
      The default supplier of UserActions, can be injected for testing.
  • Constructor Details

    • MenuBarModelSupport

      protected MenuBarModelSupport()
      Default constructor.
  • Method Details

    • populate

      public final void populate(@Nonnull Object binder, @Nonnull Object menuBar)
      Populates the menu bar with menus.
      Specified by:
      populate in interface MenuBarModel
      Parameters:
      binder - the binder
      menuBar - the menu bar
    • populateImpl

      protected void populateImpl(@Nonnull B binder, @Nonnull MB menuBar)
      Populates the menu bar.
      Parameters:
      binder - the binder
      menuBar - the menu bar to populate
    • createMenu

      @Nonnull protected abstract M createMenu(@Nonnull String label)
      Returns a new menu with the given label..
      Parameters:
      label - the label
      Returns:
      a new menu with the given label
    • addMenuToMenuBar

      protected abstract void addMenuToMenuBar(@Nonnull MB menuBar, @Nonnull M menu)
      Adds a menu to the menu bar.
      Parameters:
      menuBar - the menu bar
      menu - the menu
    • addMenuItemToMenu

      protected abstract void addMenuItemToMenu(@Nonnull M menu, @Nonnull B binder, @Nonnull it.tidalwave.role.ui.UserAction action)
      Adds to the given menu a new item bound to the given UserAction.
      Parameters:
      menu - the menu
      binder - the binder
      action - the user action