public interface MenuBuilder
Caveat: levigo reserves the right to amend this interface in future releases. Therefore we strongly discourage independent implementations of it.
Modifier and Type | Interface and Description |
---|---|
static class |
MenuBuilder.ItemType |
Modifier and Type | Field and Description |
---|---|
static String |
GROUP_DEFAULT
The name of the default menu group.
|
static String |
GROUP_EDIT
The name of the "edit" menu group.
|
static String |
GROUP_KEY
The item type key queried on actions to determine the group name, if no explicit name has been
specified upon installation.
|
static String |
GROUP_SETTINGS
The name of the "settings" menu group.
|
static String |
ITEM_TYPE_KEY
The item type key queried on actions to determine the type of menu item to create.
|
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
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. |
static final String GROUP_DEFAULT
static final String GROUP_EDIT
static final String GROUP_SETTINGS
static final String GROUP_KEY
static final String ITEM_TYPE_KEY
MenuBuilder.ItemType
.void installAction(Action action)
GROUP_DEFAULT
.action
- the Action
to install.void installAction(String group, Action action)
group
- the group into which to install itaction
- the Action
to installGROUP_DEFAULT
,
GROUP_EDIT
,
GROUP_SETTINGS
List<String> getGroups()
MenuBuilder findSubMenu(String id)
MenuBuilder
for an existing sub-menu. If the sub-menu does not exist, this will
return null
.id
- the sub-menu's idMenuBuilder
or null
, if there is no sub-menu with the given
id.MenuBuilder installSubMenu(String group, String id, Action action)
MenuBuilder
for it. If the sub-menu already exists,
this method will throw an IllegalArgumentException
.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-menuIllegalArgumentException
- if a sub-menu for the given id already exists or any of the
parameters is null
.Copyright © 2024 levigo holding gmbh. All rights reserved.