## com.bbn.openmap.gui.menu
Class MenuList

    java.lang.Object
      com.bbn.openmap.MapHandlerChild
          com.bbn.openmap.OMComponent
              com.bbn.openmap.gui.menu.MenuList

All Implemented Interfaces:
  java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.util.EventListener, LightMapHandlerChild, PropertyConsumer

public class MenuList
extends OMComponent

The MenuList is a component that creates a set of JMenus from Properties, and can provide a JMenuBar or JMenu with those JMenus. Used by the MapPanel.

The MenuList can be used in lieu of defining the OpenMap MenuBar and each Menu in the openmap.components property. The MenuList can be defined instead, with the menus it should create. It has one property:

        menulist.menus=menu1 menu2 menu3
        menu1.class=classname of menu1
        menu2.class=classname of menu2
        menu3.class=classname of menu3

When the MenuList.setBeanContext() method gets called, the MenuList will add its menus to that MapHandler/BeanContext. By default, the MenuList will provide an OpenMap MenuBar when asked for a JMenuBar, which will figure out if one of the child menus is a HelpMenu and place it at the end of the MenuBar menus.

Field Summary
`protected javax.swing.JMenu` `menu`
`protected MenuBar` `menuBar`
`static java.lang.String` `MenuNameProperty`
`protected java.util.LinkedList` `menus`
`static java.lang.String` `MenusProperty`
`protected java.lang.String` `name`

Fields inherited from class com.bbn.openmap.OMComponent
`i18n, propertyPrefix`

Fields inherited from class com.bbn.openmap.MapHandlerChild
`beanContextChildSupport`

Fields inherited from interface com.bbn.openmap.PropertyConsumer
`EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty`

Constructor Summary
`MenuList()` Create an empty MenuList.

Method Summary
`javax.swing.JMenu` `getMenu()` Get a JMenu with JMenus on it as sub-menus.
`javax.swing.JMenuBar` `getMenuBar()` Get a MenuBar with JMenus on it.
`java.util.Properties` `getProperties(java.util.Properties props)` PropertyConsumer interface method.
`java.util.Properties` `getPropertyInfo(java.util.Properties props)` PropertyConsumer interface method.
`void` `setBeanContext(java.beans.beancontext.BeanContext bc)` Called when the MenuList is added to the MapHandler/BeanContext.
`void` `setProperties(java.lang.String prefix, java.util.Properties props)` The MenuList will look for the "menus" property and build its menus.

Methods inherited from class com.bbn.openmap.OMComponent
`getPropertyPrefix, setProperties, setPropertyPrefix`

Methods inherited from class com.bbn.openmap.MapHandlerChild
`addPropertyChangeListener, addVetoableChangeListener, childrenAdded, childrenRemoved, findAndInit, findAndInit, findAndUndo, firePropertyChange, fireVetoableChange, getBeanContext, removePropertyChangeListener, removeVetoableChangeListener`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### MenusProperty

    public static final java.lang.String MenusProperty

See Also:
  Constant Field Values

### MenuNameProperty

    public static final java.lang.String MenuNameProperty

See Also:
  Constant Field Values

### menus

    protected java.util.LinkedList menus

### menuBar

    protected MenuBar menuBar

### menu

    protected javax.swing.JMenu menu

### name

    protected java.lang.String name

Constructor Detail

### MenuList

    public MenuList()

  Create an empty MenuList.

Method Detail

### getMenuBar

    public javax.swing.JMenuBar getMenuBar()

  Get a MenuBar with JMenus on it. If the MenuList has been given a MapHandler, the Menus will have been added to it, and therefore will be connected to OpenMap components. The MenuBar is not added to the MapHandler and probably shouldn't be, since it will find and re-add the Menus it finds there in some random order.

### getMenu

    public javax.swing.JMenu getMenu()

  Get a JMenu with JMenus on it as sub-menus. If the MenuList has been given a MapHandler, the Menus will have been added to it, and therefore will be connected to OpenMap components. This menu will be named "Map", but you can rename it if you want.

### setProperties

    public void setProperties(java.lang.String prefix,
                              java.util.Properties props)

  The MenuList will look for the "menus" property and build its menus.

  Specified by:
    `setProperties` in interface `PropertyConsumer`
  Overrides:
    `setProperties` in class `OMComponent`
  Parameters:
    `prefix` - the token to prefix the property names
    `props` - the `Properties` object

### getProperties

    public java.util.Properties getProperties(java.util.Properties props)

  PropertyConsumer interface method.

  Specified by:
    `getProperties` in interface `PropertyConsumer`
  Overrides:
    `getProperties` in class `OMComponent`
  Parameters:
    `props` - a Properties object to load the PropertyConsumer properties into. If props equals null, then a new Properties object should be created.
  Returns:
    Properties object containing PropertyConsumer property values. If getList was not null, this should equal getList. Otherwise, it should be the Properties object created by the PropertyConsumer.

### getPropertyInfo

    public java.util.Properties getPropertyInfo(java.util.Properties props)

  PropertyConsumer interface method.

  Specified by:
    `getPropertyInfo` in interface `PropertyConsumer`
  Overrides:
    `getPropertyInfo` in class `OMComponent`
  Parameters:
    `props` - a Properties object to load the PropertyConsumer properties into. If getList equals null, then a new Properties object should be created.
  Returns:
    Properties object containing PropertyConsumer property values. If getList was not null, this should equal getList. Otherwise, it should be the Properties object created by the PropertyConsumer.

### setBeanContext

    public void setBeanContext(java.beans.beancontext.BeanContext bc)
                        throws java.beans.PropertyVetoException

  Called when the MenuList is added to the MapHandler/BeanContext. The MenuList will add its menus to the BeanContext.

  Specified by:
    `setBeanContext` in interface `java.beans.beancontext.BeanContextChild`
  Overrides:
    `setBeanContext` in class `MapHandlerChild`
  Throws:
    `java.beans.PropertyVetoException`

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details