Package it.tidalwave.role.ui.spi
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 binderMB
- the type of the menubarM
- the type of the menuMI
- the type of the menu item
- All Implemented Interfaces:
MenuBarModel
A support implementation for
MenuBarModel
.- Since:
- 1.1-ALPHA-6
- Author:
- Fabrizio Giudici
-
Nested Class Summary
Nested classes/interfaces inherited from interface it.tidalwave.role.ui.MenuBarModel
MenuBarModel.MenuIndex, MenuBarModel.MenuPlacement
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Supplier
<Collection<? extends it.tidalwave.role.ui.UserAction>> The default supplier ofUserAction
s, can be injected for testing. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
addMenuItemToMenu
(M menu, B binder, it.tidalwave.role.ui.UserAction action) Adds to the given menu a new item bound to the givenUserAction
.protected abstract void
addMenuToMenuBar
(MB menuBar, M menu) Adds a menu to the menu bar.protected abstract M
createMenu
(String label) Returns a new menu with the given label.final void
Populates the menu bar with menus.protected void
populateImpl
(B binder, MB menuBar) Populates the menu bar.
-
Field Details
-
userActionsSupplier
@Nonnull protected final Supplier<Collection<? extends it.tidalwave.role.ui.UserAction>> userActionsSupplierThe default supplier ofUserAction
s, can be injected for testing.
-
-
Constructor Details
-
MenuBarModelSupport
protected MenuBarModelSupport()Default constructor.
-
-
Method Details
-
populate
Populates the menu bar with menus.- Specified by:
populate
in interfaceMenuBarModel
- Parameters:
binder
- the bindermenuBar
- the menu bar
-
populateImpl
Populates the menu bar.- Parameters:
binder
- the bindermenuBar
- the menu bar to populate
-
createMenu
Returns a new menu with the given label..- Parameters:
label
- the label- Returns:
- a new menu with the given label
-
addMenuToMenuBar
Adds a menu to the menu bar.- Parameters:
menuBar
- the menu barmenu
- 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 givenUserAction
.- Parameters:
menu
- the menubinder
- the binderaction
- the user action
-