public class GralMenu
extends java.lang.Object
addMenuItem(String, String, GralUserAction)
.
That event listener invokes the GralUserAction
given as parameter.
GralWindow.addMenuBarItemGThread(String, String, GralUserAction)
.
GralWidget.getContextMenu()
addMenuItem(String, String, GralUserAction)
.
GralWindow.addMenuBarItemGThread(String, String, GralUserAction)
.
You needn't have knowledge about the tree structure of the menu.
The String sMenuPath should consist of the parts of the menu tree,
for example "&File/&Check/rest&Ore". For this example a menu bar entry "File" is created
or the yet existing is used. Then the sub menu entry "Check" is created or the existing is used.
There the entry "restOre" is created with 'O' as hot-key.Modifier and Type | Class and Description |
---|---|
class |
GralMenu._GraphicImpl |
static class |
GralMenu.MenuEntry
This class wraps a menu entry of the implementation.
|
Modifier and Type | Field and Description |
---|---|
protected GralMenu._GraphicImpl |
_impl
The implementation specific menu
|
protected java.util.Map<java.lang.String,GralMenu.MenuEntry> |
menus |
static int |
version
Version, history and license.
|
GralWidget |
widgg |
Constructor and Description |
---|
GralMenu(GralWidget widgg) |
Modifier and Type | Method and Description |
---|---|
void |
addMenuItem(GralWidget widggP,
java.lang.String nameWidgg,
java.lang.String sMenuPath,
GralUserAction action)
Adds with a given widget.
|
void |
addMenuItem(java.lang.String sMenuPath,
GralUserAction gralAction)
Adds any menu item.
|
void |
addMenuItem(java.lang.String name,
java.lang.String sMenuPath,
GralUserAction action)
Adds any menu item
|
java.lang.Object |
getMenuImpl()
Returns the implementation instance for the menu.
|
boolean |
hasImplementation() |
void |
setVisible() |
public static final int version
GralMenu.MenuEntry.widgg
to transport the widget to the implementation widget.
GralMenu._GraphicImpl
is now the base class for the SwtMenu
.
widgg
is stored here. It is used for all sub menus
to refer it for calling GralUserAction.exec(int, org.vishia.gral.ifc.GralWidget_ifc, Object...)
.
The addMenuItem(String, String, GralUserAction)
is now deprecated, the String is not used.
But only that method creates an instance of org.vishia.gral.swt.SwtWidgetMenu
which is deprecated too
and only used to held a reference to the GralWidget.
The addMenuItem(String, GralUserAction)
is the new one to use.
addMenuItem(String, String, GralUserAction)
returns now
a GralWidget
. It is necessary to add some information to the menu-widget, which can be used
if the GralUserAction.userActionGui(int, GralWidget, Object...)
for this menu is called.
The second param of this method is that menu-GralWidget.
public final GralWidget widgg
protected java.util.Map<java.lang.String,GralMenu.MenuEntry> menus
protected GralMenu._GraphicImpl _impl
public GralMenu(GralWidget widgg)
public final void addMenuItem(java.lang.String name, java.lang.String sMenuPath, GralUserAction action)
name
- name of the menu, it is used as widget name.sMenuPath
- Menu position. Use slash as separator, use & for hot key.
For example "&edit/&search/co&ntinue" creates a menu 'edit' or uses the existing one in the top level (menu bar),
then creates the search menu item as pull down in menu bar, and then 'continue' with 'n' as hot key as sub-menu.
It is stored in GralWidget.sDataPath
action
- called on menu activation.public final void addMenuItem(GralWidget widggP, java.lang.String nameWidgg, java.lang.String sMenuPath, GralUserAction action)
widgg
of the constructor.
Check what is happen. Therefore:widggMenu
- the widget can be used to add any GralWidget.setContentInfo(Object)
etc.
It is provided in the action method.name
- sMenuPath
- action
- public final void addMenuItem(java.lang.String sMenuPath, GralUserAction gralAction)
sMenuPath
- Menu position. Use slash as separator, use & for hot key.
For example "&edit/&search/co&ntinue" creates a menu 'edit' or uses the existing one in the top level (menu bar),
then creates the search menu item as pull down in menu bar, and then 'continue' with 'n' as hot key as sub-menu.
It is stored in GralWidget.sDataPath
action
- called on menu activation.public final void setVisible()
public boolean hasImplementation()
public final java.lang.Object getMenuImpl()