All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----com.ibm.as400.ui.framework.java.MenuManager
MenuManager
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, MenuManager
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 TestPanels.pdml
,
and that a properties file TestPanels.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 menu and adds it to the
menu bar for an application's dialog window:
import com.ibm.as400.ui.framework.java.*; // Create the menu manager. Parameters: // 1. Resource name of the menu definition // 2. Name of menu // 3. Pane manager not needed MenuManager mm = null; try { mm = new MenuManager("com.ourCompany.ourPackage.TestPanels", "Mymenu", null); } catch (DisplayManagerException e) { e.displayUserMessage(null); System.exit(-1); } // Add the menu to a menu bar JMenuBar jmb = new JMenuBar(); jmb.add(mm.getMenu());
java com.ibm.as400.ui.framework.java.MenuManager [-serialize] [-locale <language code>_<country code>_<variant>] <resource name> <menu name>Options:
.pdml.ser
.
If this option is specified the menu will not be displayed on the screen.
menu
tag in the PDML document.
Examples:
java com.ibm.as400.ui.framework.java.MenuManager com.ourCompany.ourPackage.TestPanels MyMenu
java com.ibm.as400.ui.framework.java.MenuManager -serialize com.ourCompany.ourPackage.TestPanels MyMenu
java com.ibm.as400.ui.framework.java.MenuManager -locale en_UK com.ourCompany.ourPackage.TestPanels MyMenu
java com.ibm.as400.ui.framework.java.MenuManager -serialize -locale en_UK com.ourCompany.ourPackage.TestPanels MyMenu
MenuManager
object for the specified menu,
and then serializes the menu definition.
MenuManager
for the specified menu.
MenuManager
for the specified menu.
Action
s for the items in this menu.
JMenu
for this menu.
PaneManager
with which this menu is associated.
MenuManager
.
public MenuManager(String baseName, String menuName, PaneManager pm) throws DisplayManagerException
MenuManager
for the specified menu.
The default locale will be used to load the menu definition.
MENU
tag in the PDML
PaneManager
with which this menu is associated (may be null)
public MenuManager(String baseName, Locale locale, String menuName, PaneManager pm) throws DisplayManagerException
MenuManager
for the specified menu.
MENU
tag in the PDML
PaneManager
with which this menu is associated (may be null)
public MenuManager(String baseName, Locale locale, String menuName) throws DisplayManagerException
MenuManager
object for the specified menu,
and then serializes the menu definition.
This constructor cannot be used to display the menu.
If a null locale is specified, the default locale will be used to load the menu definition. If resources for the default locale cannot be found, an attempt will be made to use the base resources for the menu.
MENU
tag in the PDML
public static void main(String args[])
MenuManager
. See the class description.
public void serialize() throws IOException
<menu name>_<locale string>.pdml.serwhere
<menu name>
is the name of the menu as specified on the MENU
tag in the PDML, and <locale string>
consists of the ISO Language Code,
ISO Country Code, and optional variant codes, each delimited by an underscore ("_") character.
public JMenu getMenu()
JMenu
for this menu.
JMenu
for this menu
public JMenuItem getMenuItem(String name)
JMenuItem
corresponding to the specified menu item
public Action[] getActions()
Action
s for the items in this menu.
Action
s for the menu items
public PaneManager getPaneManager()
PaneManager
with which this menu is associated.
PaneManager
with which this menu is associated (may be null)
public String getName()
All Packages Class Hierarchy This Package Previous Next Index