DemoLayer (OpenMap API)
Date: 2016-12-09

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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:
  ProjectionListener, GestureResponsePolicy, OMGraphicHandler, ProjectionPainter, PropertyConsumer, DrawingToolRequestor, java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.io.Serializable, java.util.EventListener

    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/interfaces inherited from class javax.swing.JComponent
`javax.swing.JComponent.AccessibleJComponent`

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

Nested classes/interfaces inherited from class java.awt.Component
`java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, 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 OMGraphicList` | `objects` This is a list to hold the non-changing OMGraphics to display on the layer.
`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, layerWorkerQueue, logger, 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, coordTransform, DataPathPrefixProperty, DisplayPaletteCmd, DisplayPropertiesCmd, doHack, HidePaletteCmd, i18n, localHackList, maxScale, MaxScaleProperty, minScale, MinScaleProperty, palette, paletteListener, PrettyNameProperty, propertyPrefix, readyToPaint, RedrawCmd, removable, RemovableProperty, SWING_PACKAGE, TransformProperty, 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 iterator 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<java.awt.Component>` | `getItemsForMapMenu(MapMouseEvent me)` Return a JMenu with contents applicable to a pop-up menu for a location over the map.
`java.util.List<java.awt.Component>` | `getItemsForOMGraphicMenu(OMGraphic omg)` Return a java.util.List containing input for a JMenu with contents applicable to a pop-up 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
`actionPerformed, canSetList, copy, createLayerWorker, cut, deselect, dispose, doAction, doPrepare, filter, filter, filter, getConsumeEvents, getDefaultSettingsPanel, getFilter, getLayerWorker, getList, getMapMouseListener, getMouseEventInterpreter, getMouseModeIDsForEvents, getProjectionChangePolicy, getProperties, getPropertyInfo, getRedrawButton, getRenderPolicy, getSelected, getSettingsButton, getTransparency, getTransparencyAdjustmentPanel, highlight, isCancelled, isInterruptable, isWorking, leftClick, mouseOver, paste, projectionChanged, receivesMapEvents, renderDataForProjection, resetFiltering, setConsumeEvents, setFilter, setInterruptable, setLayerWorker, setList, setMouseEventInterpreter, setMouseModeIDsForEvents, setProjectionChangePolicy, setRenderPolicy, setTransparency, supportsSQL, unhighlight, workerComplete`

Methods inherited from class com.bbn.openmap.Layer
`addComponentListener, added, addInfoDisplayListener, addLayerStatusListener, addMouseListener, addVetoableChangeListener, childrenAdded, childrenRemoved, clearListeners, connectToBeanContext, createWindowSupport, disconnectFromBeanContext, finalize, findAndInit, fireHideToolTip, firePaletteEvent, fireRequestBrowserContent, fireRequestBrowserContent, fireRequestCursor, fireRequestInfoLine, fireRequestInfoLine, fireRequestInfoLine, fireRequestMessage, fireRequestMessage, fireRequestToolTip, fireRequestToolTip, fireRequestURL, fireRequestURL, fireStatusUpdate, fireStatusUpdate, fireVetoableChange, getAddAsBackground, getAddToBeanContext, getAttribute, getBeanContext, getCoordTransform, getIcon, getMaxScale, getMinScale, getPackage, getPalette, getProjection, getPropertyPrefix, getWindowSupport, hasGUI, hidePalette, isAutoPalette, isProjectionOK, isReadyToPaint, isRemovable, notifyHideHack, prependDataPathPrefix, putAttribute, removeComponentListener, removeConfirmed, removed, removeInfoDisplayListener, removeLayerStatusListener, removeVetoableChangeListener, repaint, resetPalette, setAddAsBackground, setAddToBeanContext, setAutoPalette, setBeanContext, setCoordTransform, setIcon, setLayerProperties, setMaxScale, setMinScale, setName, setPaletteVisible, setProjection, setProjection, setProperties, setPropertyPrefix, setReadyToPaint, setRemovable, setVisible, setWindowSupport, showPalette`

Methods inherited from class javax.swing.JComponent
`addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, 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, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, 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

### objects

    protected OMGraphicList objects

  This is a list to hold the non-changing OMGraphics to display on the layer. It is used to load the OMGraphicList that the layer actually paints.

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, are PropertyConsumers and the .class property is not set, 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. If the .class property is set, then a new policy object will be created and replace the one set before this method is called.

  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, null by default.

### 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 iterator 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<java.awt.Component> getItemsForMapMenu(MapMouseEvent me)

  Description copied from class: `OMGraphicHandlerLayer`
  Return a JMenu with contents applicable to a pop-up menu for a location over the map. The pop-up 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<java.awt.Component> getItemsForOMGraphicMenu(OMGraphic omg)

  Description copied from class: `OMGraphicHandlerLayer`
  Return a java.util.List containing input for a JMenu with contents applicable to a pop-up 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.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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