org.gswing.gui.resource
Class MenuLoader

java.lang.Object
  extended by org.gswing.gui.resource.MenuLoader
All Implemented Interfaces:
MenuLoaderFace

public class MenuLoader
extends Object
implements MenuLoaderFace

Populates a JMenuBar with menu read from an xml style file. The menu xml file should have the following as root element

as menu element inside or another for submenus; see the example menus.xml file (dont miss out the name="xxx" in this tag anywhere even in submenus, it may result in an exception) as menu item containing the following tags (inside menuitem) the name of the menuitem fully qualified class name of the action listener class that receives the actionPerformed event from this the mnemonic to be set for this menuitem the accelerator key for this item. see java doc on KeyStroke.getKeyStroke(String s) for further information specifying false will result in disabled menu item. else enabled. implements MenuLoaderFace. (just for satisfying any later requirement for loose coupling)

Version:
0.1, 09/06/2005
Author:
Prajeesh Kumar P

Constructor Summary
MenuLoader(IFramework framework, IDesktopManagement desktop)
          Constructor.
 
Method Summary
 XNode getXNode()
          Get the XNode (root XNode) of the file Not required to be used from outside this file.
 void populateMenuBar(JMenuBar jmb, String fileName)
          This can start and finish the work Just call this with the JMenuBar and the menu file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MenuLoader

public MenuLoader(IFramework framework,
                  IDesktopManagement desktop)
Constructor.

Method Detail

getXNode

public XNode getXNode()
Get the XNode (root XNode) of the file Not required to be used from outside this file.

Returns:
The root node of the XML file as XNode (see class XNode).

populateMenuBar

public void populateMenuBar(JMenuBar jmb,
                            String fileName)
This can start and finish the work Just call this with the JMenuBar and the menu file.

Specified by:
populateMenuBar in interface MenuLoaderFace
Parameters:
jmb - The JMenuBar which is to be populated
fileName - The name of the xml style file containing menu descriptions


Copyright © 2008. All Rights Reserved.