Class BasicMenuBuilder
java.lang.Object
com.levigo.jadice.web.client.ui.menu.BasicMenuBuilder
- All Implemented Interfaces:
MenuBuilder
Default implementation of the MenuBuilder. It can be used to configure toolbar content and
ContextMenus at the same time.
Usage: Create a new instance of the class using the constructor. Install all actions and
sub menus which should be contained in resulting menu via installAction(Action),
installAction(String, Action) and installSubMenu(String, String, Action). If
all actions and sub menus are installed call createContextMenu() to create a
ContextMenu out of the installed content or call createContentToolbarItems(Bar)
to fill a toolbar with the installed content.
-
Field Summary
Fields inherited from interface com.levigo.jadice.web.client.ui.menu.MenuBuilder
GROUP_DEFAULT -
Constructor Summary
ConstructorsConstructorDescriptionBasicMenuBuilder(Collection<Object> context) Creates a newBasicMenuBuilderwith the given context. -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateContentToolbarItems(Bar toolbar) Fills the toolbar with the installed actions and submenus.Creates aContextMenucontaining the installed actions and submenus.voidfillContextMenu(ContextMenu contextMenu) Fills theContextMenuwith the installed actions and submenus.findSubMenu(String id) Find aMenuBuilderfor an existing sub-menu.Return the (read-only) list of group names already defined.Return the (read-only) list of sub-menu ids already defined.voidinstallAction(Action action) Install the given action into the default menu groupMenuBuilder.GROUP_DEFAULT.voidinstallAction(String group, Action action) Install the given action into the given menu group.installSubMenu(String group, String id, Action action) Install a sub-menu and return aMenuBuilderfor it.
-
Constructor Details
-
BasicMenuBuilder
Creates a newBasicMenuBuilderwith the given context.- Parameters:
context- the context
-
-
Method Details
-
installAction
Description copied from interface:MenuBuilderInstall the given action into the default menu groupMenuBuilder.GROUP_DEFAULT.- Specified by:
installActionin interfaceMenuBuilder- Parameters:
action- theActionto install.
-
installAction
Description copied from interface:MenuBuilderInstall the given action into the given menu group. If the group does not exist, it will be created on the fly.- Specified by:
installActionin interfaceMenuBuilder- Parameters:
group- the group into which to install itaction- theActionto install- See Also:
-
installSubMenu
Description copied from interface:MenuBuilderInstall a sub-menu and return aMenuBuilderfor it. If the sub-menu already exists, this method will throw anIllegalArgumentException.- Specified by:
installSubMenuin interfaceMenuBuilder- Parameters:
group- the group into which to install itid- the sub-menu's idaction- the action describing the sub-menu.- Returns:
- a
MenuBuilderfor the sub-menu
-
findSubMenu
Description copied from interface:MenuBuilderFind aMenuBuilderfor an existing sub-menu. If the sub-menu does not exist, this will returnnull.- Specified by:
findSubMenuin interfaceMenuBuilder- Parameters:
id- the sub-menu's id- Returns:
- the
MenuBuilderornull, if there is no sub-menu with the given id.
-
getGroups
Description copied from interface:MenuBuilderReturn the (read-only) list of group names already defined.- Specified by:
getGroupsin interfaceMenuBuilder- Returns:
- a list of Strings.
-
getSubMenuIDs
Description copied from interface:MenuBuilderReturn the (read-only) list of sub-menu ids already defined.- Specified by:
getSubMenuIDsin interfaceMenuBuilder- Returns:
- a list of Strings.
-
createContentToolbarItems
Description copied from interface:MenuBuilderFills the toolbar with the installed actions and submenus. Adds separators between different groups.- Specified by:
createContentToolbarItemsin interfaceMenuBuilder- Parameters:
toolbar- the toolbar which should be filled
-
createContextMenu
Description copied from interface:MenuBuilderCreates aContextMenucontaining the installed actions and submenus. Adds a separator between different groups.- Specified by:
createContextMenuin interfaceMenuBuilder- Returns:
- the created context menu
-