## com.bbn.openmap.gui
Class BasicMapPanel

    java.lang.Object
      java.awt.Component
          java.awt.Container
              javax.swing.JComponent
                  javax.swing.JPanel
                      com.bbn.openmap.gui.OMComponentPanel
                          com.bbn.openmap.gui.BasicMapPanel

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

Direct Known Subclasses:
  DockMapPanel

public class BasicMapPanel
extends OMComponentPanel
implements MapPanel

The BasicMapPanel is a MapPanel and OMComponentPanel that is the heart of the OpenMap application framework. It can be used in a application or applet. The Panel has a BorderLayout, and creates a MapBean for its center area. It creates a MapHandler to use to hold all of its OpenMap components, and uses the PropertyHandler given to it in its constructor to create and configure all of the application components. The best way to add components to the MapPanel is to get the MapHandler from it and add components to that. The BasicMapPanel also adds itself to its MapHandler, so when the PropertyHandler adds MapPanelChildren components to the MapHandler, the BasicMapPanel is able to find them via the findAndInit method. By default, the BasicMapPanel looks for MapPanelChildren and asks them for where they would prefer to be located (BorderLayout.NORTH, BorderLayout.SOUTH, BorderLayout.EAST, BorderLayout.WEST). If you extend this component, though, other components could be found via that same findAndInit method.

See Also:
  Serialized Form

Nested Class Summary

Nested classes inherited from class javax.swing.JPanel
`javax.swing.JPanel.AccessibleJPanel`

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 MapBean` `mapBean`
`protected MapHandler` `mapHandler`
`protected MenuList` `menuList`
`protected PropertyHandler` `propertyHandler`

Fields inherited from class com.bbn.openmap.gui.OMComponentPanel
`beanContextChildSupport, i18n, propertyPrefix, windowSupport`

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 java.awt.image.ImageObserver
`ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

Constructor Summary
`BasicMapPanel()` Creates an empty MapPanel that creates its own empty PropertyHandler.
`BasicMapPanel(boolean delayCreation)` Create a MapPanel with the option of delaying the search for properties until the `create()` call is made.
`BasicMapPanel(PropertyHandler propertyHandler)` Create a MapPanel that configures itself with the properties contained in the PropertyHandler provided.
`BasicMapPanel(PropertyHandler propertyHandler, boolean delayCreation)` Create a MapPanel that configures itself with properties contained in the PropertyHandler provided, and with the option of delaying the search for properties until the `create()` call is made.

Method Summary
`protected void` `addMapBeanToPanel(MapBean map)` Position the map bean in this panel according to the layout manger.
`void` `addMapComponent(java.lang.Object mapComponent)` Adds a component to the map bean context.
`protected void` `addMapPanelChild(MapPanelChild mpc)` Add a child to the MapPanel.
`void` `addProperties(java.util.Properties p)` Add in the properties from the given Properties object.
`void` `addProperties(java.lang.String propFile)` Add in the properties from the given source, which can be a resorce, file or URL.
`void` `addProperties(java.net.URL urlToProperties)` Add in the properties from the given URL.
`void` `addProperty(java.lang.String property, java.lang.String value)` Add (or overwrite) a property to the current properties
`void` `appendProperty(java.lang.String property, java.util.Properties src)` Append the given property into the current properties
`void` `appendProperty(java.lang.String property, java.lang.String value)` Append the given property into the current properties
`void` `create()` The method that triggers setLayout() and createComponents() to be called.
`protected void` `createComponents()` The constructor calls this method that creates the MapHandler and MapBean, and then tells the PropertyHandler to create the components described in its properties.
`protected java.awt.LayoutManager` `createLayoutManager()` The constructor calls this method that sets the LayoutManager for this MapPanel.
`static MapBean` `createMapBean()` A static method that creates a MapBean with it's projection set to the values set in the Environment.
`static MapBean` `createMapBean(Projection proj, javax.swing.border.Border border)` A static method that creates a MapBean and sets its projection and border to the values given.
`void` `findAndInit(java.lang.Object someObj)` The BasicMapPanel looks for MapPanelChild components, finds out from them where they prefer to be placed, and adds them.
`void` `findAndUndo(java.lang.Object someObj)` The MapPanel looks for MapPanelChild components and removes them from iteself.
`MapBean` `getMapBean()` MapPanel method.
`java.lang.Object` `getMapComponent(java.lang.String prefix)` Find the object with the given prefix by looking it up in the prefix librarian in the MapHandler.
`java.lang.Object` `getMapComponentByType(java.lang.Class c)` Given a Class, find the object in the MapHandler.
`java.util.Collection` `getMapComponentsByType(java.lang.Class c)` Get all of the mapComponents that are of the given class type.
`MapHandler` `getMapHandler()` MapPanel method.
`javax.swing.JMenu` `getMapMenu()` MapPanel method.
`javax.swing.JMenuBar` `getMapMenuBar()` MapPanel method.
`java.util.Properties` `getProperties()` Get the current properties.
`PropertyHandler` `getPropertyHandler()` Get the PropertyHandler containing properties used to configure the panel, creating it if it doesn't exist.
`void` `prependProperty(java.lang.String property, java.util.Properties src)` Prepend the given property into the current properties
`void` `prependProperty(java.lang.String property, java.lang.String value)` Prepend the given property into the current properties
`boolean` `removeMapComponent(java.lang.Object mapComponent)` Remove a component from the map bean context.
`void` `removeMarker(java.lang.String property, java.lang.String marker)` remove a marker from a space delimated set of properties.
`boolean` `removeProperty(java.lang.String property)` Remove an existing property if it exists.
`void` `setMapBean(MapBean bean)` Set the map bean used in this map panel, replace the map bean in the MapHandler if there isn't already one, or if the policy allows replacement.
`void` `setPropertyHandler(PropertyHandler handler)` Set the PropertyHandler containing the properties used to configure this panel.

Methods inherited from class com.bbn.openmap.gui.OMComponentPanel
`addVetoableChangeListener, childrenAdded, childrenRemoved, findAndInit, fireVetoableChange, getBeanContext, getProperties, getPropertyInfo, getPropertyPrefix, getWindowSupport, removeVetoableChangeListener, setBeanContext, setProperties, setProperties, setPropertyPrefix, setWindowSupport`

Methods inherited from class javax.swing.JPanel
`getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI`

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, 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, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, 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, setEnabled, 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, add, add, addContainerListener, addImpl, applyComponentOrientation, 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, remove, remove, removeAll, 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, imageUpdate, 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, setComponentOrientation, 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`

Field Detail

### mapHandler

    protected MapHandler mapHandler

### mapBean

    protected MapBean mapBean

### propertyHandler

    protected PropertyHandler propertyHandler

### menuList

    protected MenuList menuList

Constructor Detail

### BasicMapPanel

    public BasicMapPanel()

  Creates an empty MapPanel that creates its own empty PropertyHandler. The MapPanel will contain a MapBean, a MapHandler, and a PropertyHandler with no properties. The constructor to use to create a blank map framework to add components to.

### BasicMapPanel

    public BasicMapPanel(boolean delayCreation)

  Create a MapPanel with the option of delaying the search for properties until the `create()` call is made.

Parameters:
  `delayCreation` - true to let the MapPanel know that the artful programmer will call `create()`

### BasicMapPanel

    public BasicMapPanel(PropertyHandler propertyHandler)

  Create a MapPanel that configures itself with the properties contained in the PropertyHandler provided. If the PropertyHandler is null, a new one will be created.

### BasicMapPanel

    public BasicMapPanel(PropertyHandler propertyHandler,
                         boolean delayCreation)

  Create a MapPanel that configures itself with properties contained in the PropertyHandler provided, and with the option of delaying the search for properties until the `create()` call is made.

Parameters:
  `delayCreation` - true to let the MapPanel know that the artful programmer will call `create()`

Method Detail

### create

    public void create()

  The method that triggers setLayout() and createComponents() to be called. If you've told the BasicMapPanel to delay creation, you should call this method to trigger the PropertyHandler to create components based on the contents of its properties.

### createLayoutManager

    protected java.awt.LayoutManager createLayoutManager()

  The constructor calls this method that sets the LayoutManager for this MapPanel. It returns a BorderLayout by default, but this method can be overridden to change how the MapPanel places components. If you change what this method returns, you should also change how components are added in the findAndInit() method.

### addMapBeanToPanel

    protected void addMapBeanToPanel(MapBean map)

  Position the map bean in this panel according to the layout manger. Defaults to BorderLayout.CENTER.

### createComponents

    protected void createComponents()

  The constructor calls this method that creates the MapHandler and MapBean, and then tells the PropertyHandler to create the components described in its properties. This method calls getMapHandler() and getMapBean(). If the PropertyHandler is not null, it will be called to created components based on its properties, and those components will be added to the MapHandler in this MapPanel.

### getMapBean

    public MapBean getMapBean()

  MapPanel method. Get the MapBean used for the MapPanel. If the MapBean is null, calls createMapBean() which will create a BufferedLayerMapBean and add it to the MapHandler via a setMapBean call. If you want something different, override this method.

  Specified by:
    `getMapBean` in interface `MapPanel`

### setMapBean

    public void setMapBean(MapBean bean)

  Set the map bean used in this map panel, replace the map bean in the MapHandler if there isn't already one, or if the policy allows replacement. The MapHandler will be created if it doesn't exist via a getMapHandler() method call.

  Throws:
    `MultipleSoloMapComponentException` - if there is already a map bean in the map handler and the policy is to reject duplicates (since the MapBean is a SoloMapComponent).

### getPropertyHandler

    public PropertyHandler getPropertyHandler()

  Get the PropertyHandler containing properties used to configure the panel, creating it if it doesn't exist.

### setPropertyHandler

    public void setPropertyHandler(PropertyHandler handler)

  Set the PropertyHandler containing the properties used to configure this panel. Adds the PropertyHandler to the MapHandler. If the MapHandler isn't set at this point, it will be created via a getMapHandler() call.

### getMapHandler

    public MapHandler getMapHandler()

  MapPanel method. Get the MapHandler used for the MapPanel. Creates a standard MapHandler if it hasn't been created yet.

  Specified by:
    `getMapHandler` in interface `MapPanel`

### getMapMenuBar

    public javax.swing.JMenuBar getMapMenuBar()

  MapPanel method. Get a JMenuBar containing menus created from properties.

  Specified by:
    `getMapMenuBar` in interface `MapPanel`

### getMapMenu

    public javax.swing.JMenu getMapMenu()

  MapPanel method. Get a JMenu containing sub-menus created from properties.

  Specified by:
    `getMapMenu` in interface `MapPanel`

### addMapComponent

    public void addMapComponent(java.lang.Object mapComponent)

  Adds a component to the map bean context. This makes the `mapComponent` available to the map layers and other components.

  Parameters:
    `mapComponent` - a component to be added to the map bean context
  Throws:
    `MultipleSoloMapComponentException` - if mapComponent is a SoloMapComponent and another instance already exists and the policy is a reject policy.

### removeMapComponent

    public boolean removeMapComponent(java.lang.Object mapComponent)

  Remove a component from the map bean context.

  Parameters:
    `mapComponent` - a component to be removed to the map bean context
  Returns:
    true if the mapComponent was removed.

### getMapComponentByType

    public java.lang.Object getMapComponentByType(java.lang.Class c)

  Given a Class, find the object in the MapHandler. If the class is not a SoloMapComponent and there are more than one of them in the MapHandler, you will get the first one found.

### getMapComponentsByType

    public java.util.Collection getMapComponentsByType(java.lang.Class c)

  Get all of the mapComponents that are of the given class type.

### getMapComponent

    public java.lang.Object getMapComponent(java.lang.String prefix)

  Find the object with the given prefix by looking it up in the prefix librarian in the MapHandler.

### findAndInit

    public void findAndInit(java.lang.Object someObj)

  The BasicMapPanel looks for MapPanelChild components, finds out from them where they prefer to be placed, and adds them.

  Specified by:
    `findAndInit` in interface `LightMapHandlerChild`
  Overrides:
    `findAndInit` in class `OMComponentPanel`

### addMapPanelChild

    protected void addMapPanelChild(MapPanelChild mpc)

  Add a child to the MapPanel.

### findAndUndo

    public void findAndUndo(java.lang.Object someObj)

  The MapPanel looks for MapPanelChild components and removes them from iteself.

  Specified by:
    `findAndUndo` in interface `LightMapHandlerChild`
  Overrides:
    `findAndUndo` in class `OMComponentPanel`

### createMapBean

    public static MapBean createMapBean()

  A static method that creates a MapBean with it's projection set to the values set in the Environment. Also creates a BevelBorder.LOWERED border for the MapBean.

### createMapBean

    public static MapBean createMapBean(Projection proj,
                                        javax.swing.border.Border border)

  A static method that creates a MapBean and sets its projection and border to the values given.

### getProperties

    public java.util.Properties getProperties()

  Get the current properties.

### removeProperty

    public boolean removeProperty(java.lang.String property)

  Remove an existing property if it exists.

  Returns:
    true if a property was actually removed.

### addProperty

    public void addProperty(java.lang.String property,
                            java.lang.String value)

  Add (or overwrite) a property to the current properties

### addProperties

    public void addProperties(java.net.URL urlToProperties)

  Add in the properties from the given URL. Any existing properties will be overwritten except for openmap.components, openmap.layers and openmap.startUpLayers which will be appended.

### addProperties

    public void addProperties(java.lang.String propFile)
                       throws java.net.MalformedURLException

  Add in the properties from the given source, which can be a resorce, file or URL. Any existing properties will be overwritten except for openmap.components, openmap.layers and openmap.startUpLayers which will be appended.

  Throws:
    `java.net.MalformedURLException` - if propFile doesn't resolve properly.

### removeMarker

    public void removeMarker(java.lang.String property,
                             java.lang.String marker)

  remove a marker from a space delimated set of properties.

### addProperties

    public void addProperties(java.util.Properties p)

  Add in the properties from the given Properties object. Any existing properties will be overwritten except for openmap.components, openmap.layers and openmap.startUpLayers which will be appended.

### appendProperty

    public void appendProperty(java.lang.String property,
                               java.util.Properties src)

  Append the given property into the current properties

### appendProperty

    public void appendProperty(java.lang.String property,
                               java.lang.String value)

  Append the given property into the current properties

### prependProperty

    public void prependProperty(java.lang.String property,
                                java.util.Properties src)

  Prepend the given property into the current properties

### prependProperty

    public void prependProperty(java.lang.String property,
                                java.lang.String value)

  Prepend the given property into the current properties

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