com.bbn.openmap.gui.menu
Class MenuList

java.lang.Object
  extended by com.bbn.openmap.MapHandlerChild
      extended by com.bbn.openmap.OMComponent
          extended by com.bbn.openmap.gui.menu.MenuList
All Implemented Interfaces:
LightMapHandlerChild, PropertyConsumer, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.util.EventListener

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  java.util.List<javax.swing.JMenu> menuList
           
static java.lang.String MenuNameProperty
           
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, isolated
 
Fields inherited from interface com.bbn.openmap.PropertyConsumer
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty
 
Constructor Summary
MenuList()
          Create an empty MenuList.
 
Method Summary
 void add(javax.swing.JMenu menu)
           
 void findAndInit(java.lang.Object obj)
          The findAndInit method has been made non-abstract, because it now calls this method for every object that is in the iterator it receives.
 void findAndUndo(java.lang.Object obj)
          The childrenRemoved has been changed to go through its iterator to call this method with every object.
 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.lang.String getName()
           
 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 setName(java.lang.String name)
           
 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, firePropertyChange, fireVetoableChange, getBeanContext, isIsolated, removePropertyChangeListener, removeVetoableChangeListener, setIsolated
 
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

menuList

protected java.util.List<javax.swing.JMenu> menuList

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

findAndInit

public void findAndInit(java.lang.Object obj)
Description copied from class: MapHandlerChild
The findAndInit method has been made non-abstract, because it now calls this method for every object that is in the iterator it receives. This lets subclasses call a method on super classes so they can handle their needs as well.

Specified by:
findAndInit in interface LightMapHandlerChild
Overrides:
findAndInit in class MapHandlerChild

findAndUndo

public void findAndUndo(java.lang.Object obj)
Description copied from class: MapHandlerChild
The childrenRemoved has been changed to go through its iterator to call this method with every object. This lets subclasses call this method on their super class, so it can handle what it needs to with objects it may be interested in.

Specified by:
findAndUndo in interface LightMapHandlerChild
Overrides:
findAndUndo in class MapHandlerChild

add

public void add(javax.swing.JMenu menu)

getName

public java.lang.String getName()
Returns:
the name

setName

public void setName(java.lang.String name)
Parameters:
name - the name to set


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