|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.as400.ui.framework.java.MenuManager
com.ibm.as400.ui.framework.java.ContextMenuManager
public class ContextMenuManager extends MenuManager
Creates a context menu defined using the Panel Definition Markup Language (PDML).
ContextMenuManager
performs the following processing on behalf
of the application:
ActionHandler
s
specified in the PDML with the appropriate menu items.
To locate a menu definition, ContextMenuManager
needs three pieces of information:
MENU
tag in the PDML.
The framework first searches the specified location for a file with a name matching
the menu name, and an extension of .pdml.ser
. If the serialized
menu definition is not found, an attempt will be made to load a ResourceBundle
and a PDML file which correspond to the specified resource name. If the resources cannot
be located a DisplayManagerException
will be thrown.
MyMenu
is defined in the file TestMenus.pdml
,
and that a properties file TestMenus.properties
is associated with the menu
definition. Both files reside in the directory com/ourCompany/ourPackage
,
which is accessible from a directory defined in the classpath, or from a ZIP or JAR file
defined in the classpath. The following code creates the context menu and displays it:
import com.ibm.as400.ui.framework.java.*; // Create the context menu manager. Parameters: // 1. Resource name of the menu definition // 2. Name of menu // 3. PaneManager managing the window currently displayed (may be null) MenuManager mm = null; try { mm = new MenuManager("com.ourCompany.ourPackage.TestMenus", "Mymenu", null); } catch (DisplayManagerException e) { e.displayUserMessage(null); System.exit(-1); } ... // Display the context menu (normally done when handling a mouse event). MouseEvent e; mm.show(e.getComponent(), e.getX(), e.getY());
java com.ibm.as400.ui.framework.java.MenuManager [-locale <language code>_<country or region code>_<variant>] <resource name> <context menu name>Options:
menu
tag in the PDML document.
Examples:
java com.ibm.as400.ui.framework.java.MenuManager com.ourCompany.ourPackage.Testmenus Mymenu
java com.ibm.as400.ui.framework.java.MenuManager -locale en_UK com.ourCompany.ourPackage.Testmenus Mymenu
DisplayManagerException
Constructor and Description |
---|
ContextMenuManager(String baseName,
Locale locale,
String menuName,
PaneManager pm)
Constructs a ContextMenuManager for the specified menu. |
ContextMenuManager(String baseName,
String menuName,
PaneManager pm)
Constructs a ContextMenuManager for the specified menu. |
Modifier and Type | Method and Description |
---|---|
Point |
getLocation()
Returns the location of this context menu. |
boolean |
isVisible()
Determines whether this context menu is visible. |
static void |
main(String[] args)
Provides a command line interface to ContextMenuManager . |
void |
setLocation(Point pt)
Sets the location of this context menu. |
void |
setVisible(boolean visible)
Shows or hides this context menu based on the value of parameter visible . |
void |
show(Component invoker,
int x,
int y)
Displays this context menu at the position x,y in the coordinate space of the specified invoker. |
Methods inherited from class com.ibm.as400.ui.framework.java.MenuManager |
---|
addMenuItem, addSeparator, enableAllMenuItems, enableMenuItem, getActions, getMenu, getMenuItem, getName, getPaneManager, removeMenuItem, serialize |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ContextMenuManager(String baseName, String menuName, PaneManager pm) throws DisplayManagerException
ContextMenuManager
for the specified menu.
The default locale will be used to load the menu definition.
baseName
- the resource name of the PDML document/resource bundle combination which defines the menu specificationmenuName
- the name of the menu, as specified on the MENU
tag in the PDMLpm
- the PaneManager
managing the window on which the context menu will be displayed (may be null)DisplayManagerException
- if an error was encountered accessing the menu definitionPaneManager
,
DisplayManagerException
public ContextMenuManager(String baseName, Locale locale, String menuName, PaneManager pm) throws DisplayManagerException
ContextMenuManager
for the specified menu.
baseName
- the resource name of the PDML document/resource bundle combination which defines the menu specificationlocale
- the desired locale to be used to load the menu definitionmenuName
- the name of the menu, as specified on the MENU
tag in the PDMLpm
- the PaneManager
managing the window on which the context menu will be displayed (may be null)DisplayManagerException
- if an error was encountered accessing the menu definitionPaneManager
,
DisplayManagerException
Method Detail |
---|
public static void main(String[] args)
ContextMenuManager
. See the class description.
public void setLocation(Point pt)
pt
- a Point
identifying the location of the top left corner
of the context menupublic Point getLocation()
Point
identifying the location of the top left corner
of the context menupublic void setVisible(boolean visible)
visible
.
visible
- If true, shows this context menu; otherwise, hides this context menu.public boolean isVisible()
true
if the context menu is visible; false
otherwise.public void show(Component invoker, int x, int y)
invoker
- The component in whose space the context menu is to appear.x
- The x coordinate in the invoker's coordinate space at which the context menu is to be displayed.y
- The y coordinate in the invoker's coordinate space at which the context menu is to be displayed.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |