FreeHEP API
Version v1.1

org.freehep.xml.menus
Class XMLMenuBuilder

java.lang.Object
  |
  +--org.freehep.xml.menus.XMLMenuBuilder

public class XMLMenuBuilder
extends Object

Create a set of menus by reading an XML file.

Version:
$Id: XMLMenuBuilder.java,v 1.13 2002/10/02 00:27:20 tonyj Exp $
Author:
Tony Johnson (tonyj@slac.stanford.edu), Peter Armstrong

Nested Class Summary
static class XMLMenuBuilder.IllegalDefaultClassException
           
 
Field Summary
static String LOCATION_PROPERTY
           
 
Constructor Summary
XMLMenuBuilder()
          Create an (empty) XMLMenuBuilder
 
Method Summary
 void build(URL xml)
          Build an XMLMenuSystem using the default SAX parser.
 void build(URL xml, org.xml.sax.XMLReader reader)
          Build an XMLMenuSystem
protected  Icon createIcon(String name)
          Override this method for customized icon creation.
protected  JMenu createMenu(String className)
          Override this method to create your own subclass of JMenu
protected  JMenuBar createMenuBar(String className)
          Override this method to create your own subclass of JMenuBar
protected  JMenuItem createMenuItem(String className, String name, String type, String command)
          Override this method to create your own subclass of JMenuItem
protected  JPopupMenu createPopupMenu(String className)
          Override this method to create your own subclass of JPopupMenu
protected  JToolBar createToolBar(String className)
          Override this method to create your own subclass of JToolBar
protected  AbstractButton createToolBarItem(String className, String name, String type, String command)
          Override this method to create your own subclass of JButton
 JMenuBar getMenuBar(String id)
          Get the menu bar with ID id
 JPopupMenu getPopupMenu(String id)
          Get the popup menu with ID id
 JToolBar getToolBar(String id)
          Get the tool bar with ID id
 JPopupMenu mergePopupMenu(String id, JPopupMenu menu)
          Merge the popup menu with ID id onto the end of an existing menu
 void setDefaultCheckBoxMenuItemClass(Class klass)
          sets the default class of checkbox menu items to be klass
 void setDefaultMenuBarClass(Class klass)
           
 void setDefaultMenuClass(Class klass)
          sets the default class of menus to be klass
 void setDefaultMenuItemClass(Class klass)
          sets the default class of menu items to be klass
 void setDefaultPopupMenuClass(Class klass)
          sets the default class of popup menus to be klass
 void setDefaultRadioMenuItemClass(Class klass)
          sets the default class of radio menu items to be klass
 void setDefaultToolBarClass(Class klass)
          sets the default class of toolbars to be klass
 void setDefaultToolBarItemClass(Class klass)
          sets the default class of menu items to be klass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCATION_PROPERTY

public static final String LOCATION_PROPERTY
See Also:
Constant Field Values
Constructor Detail

XMLMenuBuilder

public XMLMenuBuilder()
Create an (empty) XMLMenuBuilder

Method Detail

build

public void build(URL xml)
           throws org.xml.sax.SAXException,
                  IOException
Build an XMLMenuSystem using the default SAX parser.

Parameters:
xml - The URL from which to read the XML
org.xml.sax.SAXException
IOException

build

public void build(URL xml,
                  org.xml.sax.XMLReader reader)
           throws org.xml.sax.SAXException,
                  IOException
Build an XMLMenuSystem

Parameters:
xml - The URL from which to read the XML
reader - The XMLReader to use to parse the XML
org.xml.sax.SAXException
IOException

setDefaultMenuBarClass

public void setDefaultMenuBarClass(Class klass)
                            throws XMLMenuBuilder.IllegalDefaultClassException
XMLMenuBuilder.IllegalDefaultClassException

setDefaultMenuClass

public void setDefaultMenuClass(Class klass)
                         throws XMLMenuBuilder.IllegalDefaultClassException
sets the default class of menus to be klass

Parameters:
klass - the new default class, must be a subclass of JMenu
XMLMenuBuilder.IllegalDefaultClassException

setDefaultMenuItemClass

public void setDefaultMenuItemClass(Class klass)
                             throws XMLMenuBuilder.IllegalDefaultClassException
sets the default class of menu items to be klass

Parameters:
klass - the new default class, must be a subclass of JMenuItem
XMLMenuBuilder.IllegalDefaultClassException

setDefaultRadioMenuItemClass

public void setDefaultRadioMenuItemClass(Class klass)
                                  throws XMLMenuBuilder.IllegalDefaultClassException
sets the default class of radio menu items to be klass

Parameters:
klass - the new default class, must be a subclass of JMenuItem
XMLMenuBuilder.IllegalDefaultClassException

setDefaultCheckBoxMenuItemClass

public void setDefaultCheckBoxMenuItemClass(Class klass)
                                     throws XMLMenuBuilder.IllegalDefaultClassException
sets the default class of checkbox menu items to be klass

Parameters:
klass - the new default class, must be a subclass of JMenuItem
XMLMenuBuilder.IllegalDefaultClassException

setDefaultPopupMenuClass

public void setDefaultPopupMenuClass(Class klass)
                              throws XMLMenuBuilder.IllegalDefaultClassException
sets the default class of popup menus to be klass

Parameters:
klass - the new default class, must be a subclass of JPopupMenu
XMLMenuBuilder.IllegalDefaultClassException

setDefaultToolBarClass

public void setDefaultToolBarClass(Class klass)
                            throws XMLMenuBuilder.IllegalDefaultClassException
sets the default class of toolbars to be klass

Parameters:
klass - the new default class, must be a subclass of JToolBar
XMLMenuBuilder.IllegalDefaultClassException

setDefaultToolBarItemClass

public void setDefaultToolBarItemClass(Class klass)
                                throws XMLMenuBuilder.IllegalDefaultClassException
sets the default class of menu items to be klass

Parameters:
klass - the new default class, must be a subclass of JButton
XMLMenuBuilder.IllegalDefaultClassException

createMenuBar

protected JMenuBar createMenuBar(String className)
                          throws org.xml.sax.SAXException
Override this method to create your own subclass of JMenuBar

org.xml.sax.SAXException

createMenu

protected JMenu createMenu(String className)
                    throws org.xml.sax.SAXException
Override this method to create your own subclass of JMenu

org.xml.sax.SAXException

createMenuItem

protected JMenuItem createMenuItem(String className,
                                   String name,
                                   String type,
                                   String command)
                            throws org.xml.sax.SAXException
Override this method to create your own subclass of JMenuItem

org.xml.sax.SAXException

createPopupMenu

protected JPopupMenu createPopupMenu(String className)
                              throws org.xml.sax.SAXException
Override this method to create your own subclass of JPopupMenu

org.xml.sax.SAXException

createToolBar

protected JToolBar createToolBar(String className)
                          throws org.xml.sax.SAXException
Override this method to create your own subclass of JToolBar

org.xml.sax.SAXException

createToolBarItem

protected AbstractButton createToolBarItem(String className,
                                           String name,
                                           String type,
                                           String command)
                                    throws org.xml.sax.SAXException
Override this method to create your own subclass of JButton

org.xml.sax.SAXException

createIcon

protected Icon createIcon(String name)
                   throws org.xml.sax.SAXException
Override this method for customized icon creation. The default implementation treats the argument as a relative or absolute URL. If relative it is interpreted relative to the URL of the menu file being read. If the icon cannot be found a "broken" icon is substituted.

org.xml.sax.SAXException

getMenuBar

public JMenuBar getMenuBar(String id)
Get the menu bar with ID id


getToolBar

public JToolBar getToolBar(String id)
Get the tool bar with ID id


getPopupMenu

public JPopupMenu getPopupMenu(String id)
Get the popup menu with ID id


mergePopupMenu

public JPopupMenu mergePopupMenu(String id,
                                 JPopupMenu menu)
Merge the popup menu with ID id onto the end of an existing menu

Parameters:
id - The id of the popup menu
menu - The menu to be merged

FreeHEP API
Version v1.1

Copyright © 2000-2002 FreeHEP, All Rights Reserved.