## com.bbn.openmap.examples.beanbox
Class SimpleBeanLayer

    java.lang.Object
      |
      +--java.awt.Component
            |
            +--java.awt.Container
                  |
                  +--javax.swing.JComponent
                        |
                        +--com.bbn.openmap.Layer
                              |
                              +--com.bbn.openmap.examples.beanbox.SimpleBeanLayer

All Implemented Interfaces:
  java.awt.event.ActionListener, BeanBoxHandler, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, ProjectionListener, ProjectionPainter, PropertyConsumer, java.io.Serializable

public class SimpleBeanLayer
extends Layer
implements BeanBoxHandler

An OpenMap Layer for displaying `SimpleBeanObject`beans. This class an example of an openmap layer that contains an instance of the `BeanBox`class. This layer maintains a reference to an instance of `SimpleBeanBox`class which is a sample implementation of the `BeanBox`class. The `SimpleBeanBox`class manages the set of `SimpleBeanObject`beans that are displayed by this layer.

See Also:
  Serialized Form

Field Summary
`protected SimpleBeanBox` `beanBox`
`protected java.util.HashMap` `beans`
`protected java.util.HashMap` `graphics`
`protected Projection` `projection`

Fields inherited from class com.bbn.openmap.Layer

`addAsBackground, AddAsBackgroundProperty, addToBeanContext, AddToBeanContextProperty, autoPalette, AutoPaletteProperty, beanContextChildSupport, DisplayPaletteCmd, DisplayPropertiesCmd, doHack, HidePaletteCmd, i18n, IDListeners, localHackList, lsListeners, palette, paletteListener, PrettyNameProperty, propertyPrefix, RedrawCmd, removable, RemovableProperty, RemoveableProperty, SWING_PACKAGE, 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
`SimpleBeanLayer()`

Method Summary
`void` `addObject(SimpleBeanObject object)` Adds a bean to this layer.
`BeanBox` `getBeanBox()` returns a layer specific implementation of the `BeanBox`class instance.
`OMGraphic` `getGraphic(long id)`
`OMGraphic` `getGraphic(java.lang.Long id)` return the OMGraphic object associated with the SimpleBeanObject with the specified id.
`static SimpleBeanLayer` `getLayer()` Gets a reference to this layer object.
`MapMouseListener` `getMapMouseListener()` Returns the MapMouseListener object that handles the mouse events.
`SimpleBeanObject` `getObject(long id)`
`SimpleBeanObject` `getObject(java.lang.Long id)` returns a bean with the specified id.
`java.util.Vector` `getObjects()` return all SimpleBeanObject beans maintained by this layer.
`Projection` `getProjection()` Gets the current projection
`void` `paint(java.awt.Graphics g)` override Component method
`void` `projectionChanged(ProjectionEvent event)` Implement ProjectionListener method inherited from Layer.
`void` `removeObject(long id)`
`void` `removeObject(java.lang.Long id)` Removes a bean from this layer.
`void` `updateGraphics()` Update all OMGraphic objects maintained by this layer using the information stored in corresponding SimpleBeanObject beans.
`void` `updateObject(SimpleBeanObject object)` Update the specified SimpleBeanObject object that may be maintained by this layer.

Methods inherited from class com.bbn.openmap.Layer

`actionPerformed, addComponentListener, added, addInfoDisplayListener, addLayerStatusListener, addMouseListener, addVetoableChangeListener, childrenAdded, childrenRemoved, clearListeners, connectToBeanContext, createWindowSupport, finalize, findAndInit, findAndInit, findAndUndo, fireHideToolTip, fireHideToolTip, firePaletteEvent, fireRequestBrowserContent, fireRequestBrowserContent, fireRequestCursor, fireRequestInfoLine, fireRequestInfoLine, fireRequestInfoLine, fireRequestMessage, fireRequestMessage, fireRequestToolTip, fireRequestToolTip, fireRequestToolTip, fireRequestToolTip, fireRequestURL, fireRequestURL, fireStatusUpdate, fireStatusUpdate, fireVetoableChange, getAddAsBackground, getAddToBeanContext, getBeanContext, getGUI, getPackage, getPalette, getProperties, getPropertyInfo, getPropertyPrefix, getWindowSupport, hidePalette, isRemovable, isRemoveable, notifyHideHack, removeComponentListener, removeConfirmed, removed, removeInfoDisplayListener, removeLayerStatusListener, removeVetoableChangeListener, renderDataForProjection, repaint, resetPalette, setAddAsBackground, setAddToBeanContext, setBeanContext, setName, setPaletteVisible, setProjection, setProjection, setProperties, setProperties, setPropertyPrefix, setRemovable, setRemoveable, setVisible, setWindowSupport, showPalette`

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, getAccessibleContext, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, 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, unregisterKeyboardAction, update, updateUI`

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, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, 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, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle`

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

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

Field Detail

### beans

    protected java.util.HashMap beans

### graphics

    protected java.util.HashMap graphics

### projection

    protected Projection projection

### beanBox

    protected SimpleBeanBox beanBox

Constructor Detail

### SimpleBeanLayer

    public SimpleBeanLayer()

Method Detail

### getLayer

    public static SimpleBeanLayer getLayer()

  Gets a reference to this layer object.

### getBeanBox

    public BeanBox getBeanBox()

  Description copied from interface: `BeanBoxHandler`
  returns a layer specific implementation of the `BeanBox`class instance.

  Specified by:
    `getBeanBox` in interface `BeanBoxHandler`
  Returns:
    the instance of `SimpleBeanBox` that is maintained by this layer.

### getProjection

    public Projection getProjection()

  Gets the current projection

  Overrides:
    `getProjection` in class `Layer`

### getMapMouseListener

    public MapMouseListener getMapMouseListener()

  Description copied from class: `Layer`
  Returns the MapMouseListener object that handles the mouse events. This method is IGNORED in this class: it returns null. Derived Layers should return the appropriate object if they desire to receive MouseEvents. The easiest thing for a Layer to do in order to receive MouseEvents is to implement the MapMouseListener interface and return itself. A code snippet: `

       public MapMouseListener getMapMouseListener() {
           return this;
       }

       public String[] getMouseModeServiceList() {
           return new String[] { SelectMouseMode.modeID };
       }

  `

  Overrides:
    `getMapMouseListener` in class `Layer`
  Returns:
    an instance of `SimpleBeanBox`, which implements the MapMouseListener interface.

### projectionChanged

    public void projectionChanged(ProjectionEvent event)

  Implement ProjectionListener method inherited from Layer.

  Specified by:
    `projectionChanged` in interface `ProjectionListener`
  Parameters:
    `event` - ProjectionEvent

### paint

    public void paint(java.awt.Graphics g)

  override Component method

  Overrides:
    `paint` in class `javax.swing.JComponent`

### updateGraphics

    public void updateGraphics()

  Update all OMGraphic objects maintained by this layer using the information stored in corresponding SimpleBeanObject beans.

### addObject

    public void addObject(SimpleBeanObject object)

  Adds a bean to this layer.

### removeObject

    public void removeObject(java.lang.Long id)

  Removes a bean from this layer.

### removeObject

    public void removeObject(long id)

### getObject

    public SimpleBeanObject getObject(java.lang.Long id)

  returns a bean with the specified id.

### getObject

    public SimpleBeanObject getObject(long id)

### getObjects

    public java.util.Vector getObjects()

  return all SimpleBeanObject beans maintained by this layer.

### getGraphic

    public OMGraphic getGraphic(java.lang.Long id)

  return the OMGraphic object associated with the SimpleBeanObject with the specified id.

### getGraphic

    public OMGraphic getGraphic(long id)

### updateObject

    public void updateObject(SimpleBeanObject object)

  Update the specified SimpleBeanObject object that may be maintained by this layer.

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