public class BasicMenuBuilder extends Object implements MenuBuilder
Modifier and Type | Class and Description |
---|---|
static class |
BasicMenuBuilder.Entry |
static class |
BasicMenuBuilder.Group |
static class |
BasicMenuBuilder.Menu |
MenuBuilder.ItemType
GROUP_DEFAULT, GROUP_EDIT, GROUP_KEY, GROUP_SETTINGS, ITEM_TYPE_KEY
Constructor and Description |
---|
BasicMenuBuilder(MenuContributor contributor,
BasicMenuBuilder.Menu menu) |
Modifier and Type | Method and Description |
---|---|
MenuBuilder |
findSubMenu(String id)
Find a
MenuBuilder for an existing sub-menu. |
List<String> |
getGroups()
Return the (read-only) list of group names already defined.
|
Set<String> |
getSubMenuIDs()
Return the (read-only) list of sub-menu ids already defined.
|
void |
installAction(Action action)
Install the given action into the default menu group
MenuBuilder.GROUP_DEFAULT . |
void |
installAction(String group,
Action action)
Install the given action into the given menu group.
|
MenuBuilder |
installSubMenu(String group,
String id,
Action action)
Install a sub-menu and return a
MenuBuilder for it. |
public BasicMenuBuilder(MenuContributor contributor, BasicMenuBuilder.Menu menu)
public void installAction(Action action)
MenuBuilder
MenuBuilder.GROUP_DEFAULT
.installAction
in interface MenuBuilder
action
- the Action
to install.public void installAction(String group, Action action)
MenuBuilder
installAction
in interface MenuBuilder
group
- the group into which to install itaction
- the Action
to installMenuBuilder.GROUP_DEFAULT
,
MenuBuilder.GROUP_EDIT
,
MenuBuilder.GROUP_SETTINGS
public List<String> getGroups()
MenuBuilder
getGroups
in interface MenuBuilder
public MenuBuilder findSubMenu(String id)
MenuBuilder
MenuBuilder
for an existing sub-menu. If the sub-menu does not exist, this will
return null
.findSubMenu
in interface MenuBuilder
id
- the sub-menu's idMenuBuilder
or null
, if there is no sub-menu with the given
id.public MenuBuilder installSubMenu(String group, String id, Action action)
MenuBuilder
MenuBuilder
for it. If the sub-menu already exists,
this method will throw an IllegalArgumentException
.installSubMenu
in interface MenuBuilder
group
- the group into which to install itid
- the sub-menu's idaction
- the action describing the sub-menu. Please note that the action's
ActionListener.actionPerformed(java.awt.event.ActionEvent)
is never actually called.MenuBuilder
for the sub-menupublic Set<String> getSubMenuIDs()
MenuBuilder
getSubMenuIDs
in interface MenuBuilder
Copyright © 2024 levigo holding gmbh. All rights reserved.