## com.bbn.openmap.gui
Class AbstractOpenMapMenu

    java.lang.Object
      java.awt.Component
          java.awt.Container
              javax.swing.JComponent
                  javax.swing.AbstractButton
                      javax.swing.JMenuItem
                          javax.swing.JMenu
                              com.bbn.openmap.gui.AbstractOpenMapMenu

All Implemented Interfaces:
  javax.accessibility.Accessible, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.ItemSelectable, LightMapHandlerChild, MenuBarMenu, java.awt.MenuContainer, javax.swing.MenuElement, PropertyConsumer, java.io.Serializable, javax.swing.SwingConstants

Direct Known Subclasses:
  ControlMenu, DefaultHelpMenu, FileMenu, GoToMenu, LayersMenu, MouseModeMenu, NavigateMenu, OMBasicMenu, ProjectionMenu, SaveAsMenu

public abstract class AbstractOpenMapMenu
extends javax.swing.JMenu
implements java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, PropertyConsumer, MenuBarMenu, LightMapHandlerChild

Abstract Menu Object that takes care of common bean context-related functionality. Components on this Menu that implement the LightMapHandlerChild interface, that also are created via the constructor, or created when the properties are evaluated, will be given the MapHandler through the findAndInit(Object) method. These components will also receive findAndInit() and findAndUndo() calls when other components are added to the MapHandler (BeanContext). This makes the LightMapHandlerChild menu components invisible to MapHandler components, but able to connect to them.

If you have a component that needs to be added to the menu that should in the MapHandler, you should *NOT* make it a LightMapHandlerChild, but implement the same methods as the MapHandlerChild and add it to the MapHandler before adding it to this menu. If the component is a LightMapHandlerChild, added to this menu, and also added to the MapHandler, it will receive double membership notifications which may be confusing.

AbstractOpenMapMenus can be configure via properties. You can set, with 'menu' as a property prefix:

       # Title used in the Menu Bar.
       menu.prettyName=Menu Title
       # The letter to use as Mnemonic
       menu.mnemonic=M
       # A marker name list of items to use in the menu. 'sep' inserts a
       # separator, property classname definition not needed.
       menu.items=first second sep third
       first.class=Classname of first menu item
       # You can add properties for Menu Item, if it is a PropertyConsumer.
       #first.property1=prop1
       second.class=classname
       third.class=classname

If no properties are set, the name, mnemonic and any items added in the constructor will be in the menu. Any items in the properties will be added to items created and added in the constructor - this really applies to any subclasses to this class.

See Also:
  Serialized Form

Nested Class Summary

Nested classes inherited from class javax.swing.JMenu
`javax.swing.JMenu.AccessibleJMenu, javax.swing.JMenu.WinListener`

Nested classes inherited from class javax.swing.JMenuItem
`javax.swing.JMenuItem.AccessibleJMenuItem`

Nested classes inherited from class javax.swing.AbstractButton
`javax.swing.AbstractButton.AccessibleAbstractButton, javax.swing.AbstractButton.ButtonChangeListener`

Nested classes inherited from class javax.swing.JComponent
`javax.swing.JComponent.AccessibleJComponent`

Nested classes inherited from class java.awt.Container
`java.awt.Container.AccessibleAWTContainer`

Nested classes inherited from class java.awt.Component
`java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy`

Field Summary
`protected java.beans.beancontext.BeanContextChildSupport` `beanContextChildSupport`
`protected I18n` `i18n` All AbstractOpenMapMenus have access to an I18n object, which is provided by the Environment.
`protected java.util.Hashtable` `items` A hashtable to keep track of item prefixes and their components, for restructuring properties later.
`protected java.util.Hashtable` `itemsProperties`
`static java.lang.String` `ItemsProperty`
`protected java.lang.String` `itemsPropertyContents`
`static java.lang.String` `MnemonicProperty`
`static java.lang.String` `PrettyNameProperty`
`protected java.lang.String` `propertyPrefix` Token uniquely identifying this component in the application properties.
`static java.lang.String` `SeparatorProperty`

Fields inherited from class javax.swing.JMenu
`popupListener`

Fields inherited from class javax.swing.AbstractButton

`actionListener, BORDER_PAINTED_CHANGED_PROPERTY, changeEvent, changeListener, CONTENT_AREA_FILLED_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, itemListener, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, model, MODEL_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY`

Fields inherited from class javax.swing.JComponent
`accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW`

Fields inherited from class java.awt.Component
`BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT`

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

Fields inherited from interface javax.swing.SwingConstants
`BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST`

Fields inherited from interface java.awt.image.ImageObserver
`ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

Constructor Summary
`AbstractOpenMapMenu()`
`AbstractOpenMapMenu(java.lang.String title)`

Method Summary
`void` `addVetoableChangeListener(java.lang.String propertyName, java.beans.VetoableChangeListener in_vcl)` Method for BeanContextChild interface.
`void` `childrenAdded(java.beans.beancontext.BeanContextMembershipEvent bcme)` Method for BeanContextMembership interface.
`void` `childrenRemoved(java.beans.beancontext.BeanContextMembershipEvent bcme)` Method for BeanContextMembership interface.
`void` `findAndInit(java.util.Iterator it)` Subclasses should no longer implement this method.
`void` `findAndInit(java.lang.Object someObj)` Method called when an object is added from the MapHandler.
`void` `findAndUndo(java.util.Iterator it)` Subclasses should no longer implement this method.
`void` `findAndUndo(java.lang.Object someObj)` Method called when an object is removed from the MapHandler.
`java.beans.beancontext.BeanContext` `getBeanContext()` Method for BeanContextChild interface.
`MapHandler` `getMapHandler()` Return the MapHandler, if it's been set.
`java.util.Properties` `getProperties(java.util.Properties props)` PropertyConsumer method, to fill in a Properties object, reflecting the current values of the OMComponent.
`java.util.Properties` `getPropertyInfo(java.util.Properties list)` Method to fill in a Properties object with values reflecting the properties able to be set on this PropertyConsumer.
`java.lang.String` `getPropertyPrefix()` Get the property key prefix that is being used to prepend to the property keys for Properties lookups.
`void` `removeVetoableChangeListener(java.lang.String propertyName, java.beans.VetoableChangeListener in_vcl)` Method for BeanContextChild interface.
`void` `setBeanContext(java.beans.beancontext.BeanContext in_bc)` Method for BeanContextChild interface.
`void` `setProperties(java.util.Properties props)` Sets the properties for the OMComponent.
`void` `setProperties(java.lang.String prefix, java.util.Properties props)` Sets the properties for the OMComponent.
`void` `setPropertyPrefix(java.lang.String prefix)` Set the property key prefix that should be used by the PropertyConsumer.

Methods inherited from class javax.swing.JMenu

`add, add, add, add, add, addMenuListener, addSeparator, applyComponentOrientation, configurePropertiesFromAction, createActionChangeListener, createActionComponent, createWinListener, doClick, fireMenuCanceled, fireMenuDeselected, fireMenuSelected, getAccessibleContext, getComponent, getDelay, getItem, getItemCount, getMenuComponent, getMenuComponentCount, getMenuComponents, getMenuListeners, getPopupMenu, getPopupMenuOrigin, getSubElements, getUIClassID, insert, insert, insert, insertSeparator, isMenuComponent, isPopupMenuVisible, isSelected, isTearOff, isTopLevelMenu, menuSelectionChanged, paramString, processKeyEvent, remove, remove, remove, removeAll, removeMenuListener, setAccelerator, setComponentOrientation, setDelay, setMenuLocation, setModel, setPopupMenuVisible, setSelected, updateUI`

Methods inherited from class javax.swing.JMenuItem

`addMenuDragMouseListener, addMenuKeyListener, createActionPropertyChangeListener, fireMenuDragMouseDragged, fireMenuDragMouseEntered, fireMenuDragMouseExited, fireMenuDragMouseReleased, fireMenuKeyPressed, fireMenuKeyReleased, fireMenuKeyTyped, getAccelerator, getMenuDragMouseListeners, getMenuKeyListeners, init, isArmed, processKeyEvent, processMenuDragMouseEvent, processMenuKeyEvent, processMouseEvent, removeMenuDragMouseListener, removeMenuKeyListener, setArmed, setEnabled, setUI`

Methods inherited from class javax.swing.AbstractButton

`addActionListener, addChangeListener, addItemListener, checkHorizontalKey, checkVerticalKey, createActionListener, createChangeListener, createItemListener, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getAction, getActionCommand, getActionListeners, getChangeListeners, getDisabledIcon, getDisabledSelectedIcon, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getItemListeners, getLabel, getMargin, getMnemonic, getModel, getMultiClickThreshhold, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, imageUpdate, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, paintBorder, removeActionListener, removeChangeListener, removeItemListener, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setFocusPainted, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabel, setMargin, setMnemonic, setMnemonic, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelectedIcon, setText, setUI, setVerticalAlignment, setVerticalTextPosition`

Methods inherited from class javax.swing.JComponent

`addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update`

Methods inherited from class java.awt.Container

`add, add, add, addContainerListener, addImpl, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree`

Methods inherited from class java.awt.Component

`action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle`

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

Methods inherited from interface java.beans.beancontext.BeanContextChild
`addPropertyChangeListener, removePropertyChangeListener`

Methods inherited from interface javax.swing.MenuElement
`processKeyEvent, processMouseEvent`

Field Detail

### i18n

    protected I18n i18n

  All AbstractOpenMapMenus have access to an I18n object, which is provided by the Environment.

### beanContextChildSupport

    protected java.beans.beancontext.BeanContextChildSupport beanContextChildSupport

### propertyPrefix

    protected java.lang.String propertyPrefix

  Token uniquely identifying this component in the application properties.

### items

    protected java.util.Hashtable items

  A hashtable to keep track of item prefixes and their components, for restructuring properties later. Only created if menu uses properties to create items.

### ItemsProperty

    public static final java.lang.String ItemsProperty

See Also:
  Constant Field Values

### SeparatorProperty

    public static final java.lang.String SeparatorProperty

See Also:
  Constant Field Values

### PrettyNameProperty

    public static final java.lang.String PrettyNameProperty

See Also:
  Constant Field Values

### MnemonicProperty

    public static final java.lang.String MnemonicProperty

See Also:
  Constant Field Values

### itemsPropertyContents

    protected java.lang.String itemsPropertyContents

### itemsProperties

    protected java.util.Hashtable itemsProperties

Constructor Detail

### AbstractOpenMapMenu

    public AbstractOpenMapMenu()

### AbstractOpenMapMenu

    public AbstractOpenMapMenu(java.lang.String title)

Method Detail

### getBeanContext

    public java.beans.beancontext.BeanContext getBeanContext()

  Method for BeanContextChild interface.

  Specified by:
    `getBeanContext` in interface `java.beans.beancontext.BeanContextChild`

### setBeanContext

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

  Method for BeanContextChild interface.

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

### childrenAdded

    public void childrenAdded(java.beans.beancontext.BeanContextMembershipEvent bcme)

  Method for BeanContextMembership interface.

  Specified by:
    `childrenAdded` in interface `java.beans.beancontext.BeanContextMembershipListener`

### childrenRemoved

    public void childrenRemoved(java.beans.beancontext.BeanContextMembershipEvent bcme)

  Method for BeanContextMembership interface.

  Specified by:
    `childrenRemoved` in interface `java.beans.beancontext.BeanContextMembershipListener`

### findAndUndo

    public void findAndUndo(java.util.Iterator it)

  Subclasses should no longer implement this method. Use the findAndUndo(Object) instead, so subclasses and superclasses can be given the opportunity to use the object, too.

### findAndUndo

    public void findAndUndo(java.lang.Object someObj)

  Method called when an object is removed from the MapHandler. Called to let menu objects disconnect from it.

  Specified by:
    `findAndUndo` in interface `LightMapHandlerChild`

### findAndInit

    public void findAndInit(java.util.Iterator it)

  Subclasses should no longer implement this method. Use the findAndInit(Object) instead, so subclasses and superclasses can be given the opportunity to use the object, too.

### findAndInit

    public void findAndInit(java.lang.Object someObj)

  Method called when an object is added from the MapHandler. Called to let menu objects connect to it.

  Specified by:
    `findAndInit` in interface `LightMapHandlerChild`

### addVetoableChangeListener

    public void addVetoableChangeListener(java.lang.String propertyName,
                                          java.beans.VetoableChangeListener in_vcl)

  Method for BeanContextChild interface.

  Specified by:
    `addVetoableChangeListener` in interface `java.beans.beancontext.BeanContextChild`

### removeVetoableChangeListener

    public void removeVetoableChangeListener(java.lang.String propertyName,
                                             java.beans.VetoableChangeListener in_vcl)

  Method for BeanContextChild interface.

  Specified by:
    `removeVetoableChangeListener` in interface `java.beans.beancontext.BeanContextChild`

### getMapHandler

    public MapHandler getMapHandler()

  Return the MapHandler, if it's been set. May be null if the Menu hasn't been added to the MapHandler.

### setProperties

    public void setProperties(java.util.Properties props)

  Sets the properties for the OMComponent.

  Specified by:
    `setProperties` in interface `PropertyConsumer`
  Parameters:
    `props` - the `Properties` object.

### setProperties

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

  Sets the properties for the OMComponent.

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

### getProperties

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

  PropertyConsumer method, to fill in a Properties object, reflecting the current values of the OMComponent. If the component has a propertyPrefix set, the property keys should have that prefix plus a separating '.' prepended to each propery key it uses for configuration.

  Specified by:
    `getProperties` in interface `PropertyConsumer`
  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 list)

  Method to fill in a Properties object with values reflecting the properties able to be set on this PropertyConsumer. The key for each property should be the raw property name (without a prefix) with a value that is a String that describes what the property key represents, along with any other information about the property that would be helpful (range, default value, etc.). For Layer, this method should at least return the 'prettyName' property.

  Specified by:
    `getPropertyInfo` in interface `PropertyConsumer`
  Parameters:
    `list` - 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.

### setPropertyPrefix

    public void setPropertyPrefix(java.lang.String prefix)

  Set the property key prefix that should be used by the PropertyConsumer. The prefix, along with a '.', should be prepended to the property keys known by the PropertyConsumer.

  Specified by:
    `setPropertyPrefix` in interface `PropertyConsumer`
  Parameters:
    `prefix` - the prefix String.

### getPropertyPrefix

    public java.lang.String getPropertyPrefix()

  Get the property key prefix that is being used to prepend to the property keys for Properties lookups.

  Specified by:
    `getPropertyPrefix` in interface `PropertyConsumer`
  Returns:
    the property prefix for the menu

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