## com.bbn.openmap.layer
Class DemoLayer

    java.lang.Object
      java.awt.Component
          java.awt.Container
              javax.swing.JComponent
                  com.bbn.openmap.Layer
                      com.bbn.openmap.layer.OMGraphicHandlerLayer
                          com.bbn.openmap.layer.DemoLayer

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

public class DemoLayer
extends OMGraphicHandlerLayer
implements DrawingToolRequestor

This layer demonstrates interactive capabilities of OpenMap. Instantiating this layer should show an icon loaded using HTTP Protocol, which represents Boston, MA in USA. Above Boston it should show a square that would change color when mouse is moved over it in 'Gesture' mode. Also clicking once brings up a message box and more than once brings up browser.

The DemoLayer has also been modified to demonstrate the first uses of the OMDrawingTool. The Palette has buttons that can be used to start the tool in several different ways.

See Also:
  `Just added some decorated splines to test them. EL`, Serialized Form

Nested Class Summary

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 DrawingTool` `drawingTool` Found in the findAndInit() method, in the MapHandler.
`protected static java.lang.String` `externalKey` Used by geometries created in GUI for specify if the spatial filter is for objects outside the drawn shape.
`protected GraphicAttributes` `filterGA`
`protected static java.lang.String` `internalKey` Used by geometries created in GUI for specify if the spatial filter is for objects inside the drawn shape.
`protected DrawingToolRequestor` `layer` Used by the internal ActionListeners for a callback, see getGUI().
`protected javax.swing.JPanel` `legend`
`protected SymbolReferenceLibrary` `srl` Found in the findAndInit() method, in the MapHandler.

Fields inherited from class com.bbn.openmap.layer.OMGraphicHandlerLayer
`consumeEvents, ConsumeEventsProperty, filter, interruptable, InterruptableProperty, layerWorker, LAYERWORKER_LOCK, mouseEventInterpreter, mouseModeIDs, MouseModesProperty, projectionChangePolicy, ProjectionChangePolicyProperty, renderPolicy, RenderPolicyProperty, selectedList, TransparencyProperty`

Fields inherited from class com.bbn.openmap.Layer

`addAsBackground, AddAsBackgroundProperty, addToBeanContext, AddToBeanContextProperty, attributes, autoPalette, AutoPaletteProperty, beanContextChildSupport, DisplayPaletteCmd, DisplayPropertiesCmd, doHack, HidePaletteCmd, i18n, IDListeners, localHackList, lsListeners, maxScale, MaxScaleProperty, minScale, MinScaleProperty, palette, paletteListener, PrettyNameProperty, propertyPrefix, RedrawCmd, removable, RemovableProperty, 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
`DemoLayer()`

Method Summary
`void` `drawingComplete(OMGraphic omg, OMAction action)` Called when the DrawingTool is complete, providing the layer with the modified OMGraphic.
`void` `findAndInit(java.lang.Object someObj)` Called when a component that is needed, and not available with an appropriate interator from the BeanContext.
`void` `findAndUndo(java.lang.Object someObj)` BeanContextMembershipListener method.
`DrawingTool` `getDrawingTool()`
`protected GraphicAttributes` `getFilterGA()`
`java.awt.Component` `getGUI()` Gets the gui controls associated with the layer.
`java.lang.String` `getInfoText(OMGraphic omg)` Query for what text should be placed over the information bar when the mouse is over a particular OMGraphic.
`java.util.List` `getItemsForMapMenu(MapMouseEvent me)` Return a JMenu with contents applicable to a popup menu for a location over the map.
`java.util.List` `getItemsForOMGraphicMenu(OMGraphic omg)` Return a java.util.List containing input for a JMenu with contents applicable to a popup menu for a location over an OMGraphic.
`SymbolReferenceLibrary` `getSymbolReferenceLibrary()`
`java.lang.String` `getToolTipTextFor(OMGraphic omg)` Query for what tooltip to display for an OMGraphic when the mouse is over it.
`OMGraphicList` `init()`
`boolean` `isHighlightable(OMGraphic omg)` Query that an OMGraphic can be highlighted when the mouse moves over it.
`boolean` `isSelectable(OMGraphic omg)` Query that an OMGraphic is selectable.
`void` `paint(java.awt.Graphics g)` The default action is to get the OMGraphicList and render it.
`OMGraphicList` `prepare()` This is an important Layer method to override.
`void` `select(OMGraphicList list)` Called if isSelectable(OMGraphic) was true, so the list has the OMGraphic.
`void` `setDrawingTool(DrawingTool dt)`
`void` `setProperties(java.lang.String prefix, java.util.Properties props)` Overrides the Layer setProperties method.
`void` `setSymbolReferenceLibrary(SymbolReferenceLibrary library)` Set the MilStd2525 SymbolReferenceLibrary object used to create symbols.

Methods inherited from class com.bbn.openmap.layer.OMGraphicHandlerLayer

`canSetList, copy, createLayerWorker, cut, deselect, doAction, doPrepare, filter, filter, filter, getConsumeEvents, getFilter, getLayerWorker, getList, getMapMouseListener, getMouseEventInterpreter, getMouseModeIDsForEvents, getProjectionChangePolicy, getProperties, getPropertyInfo, getRenderPolicy, getSelected, getTransparency, getTransparencyAdjustmentPanel, highlight, interrupt, isCancelled, isInterruptable, isWorking, leftClick, mouseOver, paste, projectionChanged, receivesMapEvents, renderDataForProjection, resetFiltering, setCancelled, setConsumeEvents, setFilter, setInterruptable, setLayerWorker, setList, setMouseEventInterpreter, setMouseModeIDsForEvents, setProjectionChangePolicy, setRenderPolicy, setTransparency, supportsSQL, unhighlight, workerComplete`

Methods inherited from class com.bbn.openmap.Layer

`actionPerformed, addComponentListener, added, addInfoDisplayListener, addLayerStatusListener, addMouseListener, addVetoableChangeListener, childrenAdded, childrenRemoved, clearListeners, connectToBeanContext, createWindowSupport, finalize, findAndInit, fireHideToolTip, firePaletteEvent, fireRequestBrowserContent, fireRequestBrowserContent, fireRequestCursor, fireRequestInfoLine, fireRequestInfoLine, fireRequestInfoLine, fireRequestMessage, fireRequestMessage, fireRequestToolTip, fireRequestToolTip, fireRequestURL, fireRequestURL, fireStatusUpdate, fireStatusUpdate, fireVetoableChange, getAddAsBackground, getAddToBeanContext, getAttribute, getBeanContext, getIcon, getMaxScale, getMinScale, getPackage, getPalette, getProjection, getPropertyPrefix, getWindowSupport, hasGUI, hidePalette, isAutoPalette, isProjectionOK, isRemovable, notifyHideHack, putAttribute, removeComponentListener, removeConfirmed, removed, removeInfoDisplayListener, removeLayerStatusListener, removeVetoableChangeListener, repaint, resetPalette, setAddAsBackground, setAddToBeanContext, setAutoPalette, setBeanContext, setIcon, setMaxScale, setMinScale, setName, setPaletteVisible, setProjection, setProjection, setProperties, setPropertyPrefix, setRemovable, 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 com.bbn.openmap.tools.drawing.DrawingToolRequestor
`getName`

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

Field Detail

### legend

    protected javax.swing.JPanel legend

### drawingTool

    protected DrawingTool drawingTool

  Found in the findAndInit() method, in the MapHandler.

### srl

    protected SymbolReferenceLibrary srl

  Found in the findAndInit() method, in the MapHandler.

### layer

    protected final DrawingToolRequestor layer

  Used by the internal ActionListeners for a callback, see getGUI().

### internalKey

    protected static final java.lang.String internalKey

  Used by geometries created in GUI for specify if the spatial filter is for objects inside the drawn shape.

  See Also:
    Constant Field Values

### externalKey

    protected static final java.lang.String externalKey

  Used by geometries created in GUI for specify if the spatial filter is for objects outside the drawn shape.

  See Also:
    Constant Field Values

### filterGA

    protected GraphicAttributes filterGA

Constructor Detail

### DemoLayer

    public DemoLayer()

Method Detail

### paint

    public void paint(java.awt.Graphics g)

  Description copied from class: `OMGraphicHandlerLayer`
  The default action is to get the OMGraphicList and render it.

  Overrides:
    `paint` in class `OMGraphicHandlerLayer`
  Parameters:
    `g` - java.awt.Graphics object to render OMGraphics into.

### init

    public OMGraphicList init()

### setProperties

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

  Description copied from class: `OMGraphicHandlerLayer`
  Overrides the Layer setProperties method. Also calls Layer's version. If the ProjectionChangePolicy and RenderPolicy objects are set programmatically and are PropertyConsumers, they will still have access to properties if this method is called. Their property prefix will be scoped as if the OMGraphicHandlerLayer had them created, with their prefix being prefix + . + PropertyChangePolicyProperty and prefix + . + RenderPolicyProperty.

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

### prepare

    public OMGraphicList prepare()

  This is an important Layer method to override. The prepare method gets called when the layer is added to the map, or when the map projection changes. We need to make sure the OMGraphicList returned from this method is what we want painted on the map. The OMGraphics need to be generated with the current projection. We test for a null OMGraphicList in the layer to see if we need to create the OMGraphics. This layer doesn't change it's OMGraphics for different projections, if your layer does, you need to clear out the OMGraphicList and add the OMGraphics you want for the current projection.

  Overrides:
    `prepare` in class `OMGraphicHandlerLayer`

### getFilterGA

    protected GraphicAttributes getFilterGA()

### getGUI

    public java.awt.Component getGUI()

  Description copied from class: `Layer`
  Gets the gui controls associated with the layer. This default implementation returns null indicating that the layer has no gui controls.

  Overrides:
    `getGUI` in class `Layer`
  Returns:
    java.awt.Component or null

### getDrawingTool

    public DrawingTool getDrawingTool()

### setDrawingTool

    public void setDrawingTool(DrawingTool dt)

### drawingComplete

    public void drawingComplete(OMGraphic omg,
                                OMAction action)

  Called when the DrawingTool is complete, providing the layer with the modified OMGraphic.

  Specified by:
    `drawingComplete` in interface `DrawingToolRequestor`

### findAndInit

    public void findAndInit(java.lang.Object someObj)

  Called when a component that is needed, and not available with an appropriate interator from the BeanContext. This lets this object hook up with what it needs. For Layers, this method doesn't do anything by default. If you need your layer to get ahold of another object, then you can use the Iterator to go through the objects to look for the one you need.

  Overrides:
    `findAndInit` in class `Layer`

### setSymbolReferenceLibrary

    public void setSymbolReferenceLibrary(SymbolReferenceLibrary library)

  Set the MilStd2525 SymbolReferenceLibrary object used to create symbols.

  Parameters:
    `library` -

### getSymbolReferenceLibrary

    public SymbolReferenceLibrary getSymbolReferenceLibrary()

### findAndUndo

    public void findAndUndo(java.lang.Object someObj)

  BeanContextMembershipListener method. Called when a new object is removed from the BeanContext of this object. For the Layer, this method doesn't do anything. If your layer does something with the childrenAdded method, or findAndInit, you should take steps in this method to unhook the layer from the object used in those methods.

  Overrides:
    `findAndUndo` in class `Layer`

### isHighlightable

    public boolean isHighlightable(OMGraphic omg)

  Query that an OMGraphic can be highlighted when the mouse moves over it. If the answer is true, then highlight with this OMGraphics will be called.

  Specified by:
    `isHighlightable` in interface `GestureResponsePolicy`
  Overrides:
    `isHighlightable` in class `OMGraphicHandlerLayer`

### isSelectable

    public boolean isSelectable(OMGraphic omg)

  Query that an OMGraphic is selectable.

  Specified by:
    `isSelectable` in interface `GestureResponsePolicy`
  Overrides:
    `isSelectable` in class `OMGraphicHandlerLayer`

### getInfoText

    public java.lang.String getInfoText(OMGraphic omg)

  Query for what text should be placed over the information bar when the mouse is over a particular OMGraphic.

  Specified by:
    `getInfoText` in interface `GestureResponsePolicy`
  Overrides:
    `getInfoText` in class `OMGraphicHandlerLayer`

### getToolTipTextFor

    public java.lang.String getToolTipTextFor(OMGraphic omg)

  Query for what tooltip to display for an OMGraphic when the mouse is over it.

  Specified by:
    `getToolTipTextFor` in interface `GestureResponsePolicy`
  Overrides:
    `getToolTipTextFor` in class `OMGraphicHandlerLayer`

### select

    public void select(OMGraphicList list)

  Called if isSelectable(OMGraphic) was true, so the list has the OMGraphic. A list is used in case underlying code is written to handle more than one OMGraphic being selected at a time.

  Specified by:
    `select` in interface `GestureResponsePolicy`
  Overrides:
    `select` in class `OMGraphicHandlerLayer`

### getItemsForMapMenu

    public java.util.List getItemsForMapMenu(MapMouseEvent me)

  Description copied from class: `OMGraphicHandlerLayer`
  Return a JMenu with contents applicable to a popup menu for a location over the map. The popup doesn't concern any OMGraphics, and should be presented for a click on the map background.

  Specified by:
    `getItemsForMapMenu` in interface `GestureResponsePolicy`
  Overrides:
    `getItemsForMapMenu` in class `OMGraphicHandlerLayer`
  Parameters:
    `me` - a MapMouseEvent describing the location over where the menu items should apply, in case different options are appropriate for different places.
  Returns:
    a JMenu for the map. Return null or empty List if no input required.

### getItemsForOMGraphicMenu

    public java.util.List getItemsForOMGraphicMenu(OMGraphic omg)

  Description copied from class: `OMGraphicHandlerLayer`
  Return a java.util.List containing input for a JMenu with contents applicable to a popup menu for a location over an OMGraphic.

  Specified by:
    `getItemsForOMGraphicMenu` in interface `GestureResponsePolicy`
  Overrides:
    `getItemsForOMGraphicMenu` in class `OMGraphicHandlerLayer`
  Returns:
    a List containing options for the given OMGraphic. Return null or empty list if there are no options.

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