## com.bbn.openmap.layer.learn
Class InteractionLayer

    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.learn.BasicLayer
                              com.bbn.openmap.layer.learn.InteractionLayer

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

public class InteractionLayer
extends BasicLayer

This layer demonstrates how to interact with your OMGraphics on the map, getting them to change appearance with mouse events and provide additional information about themselves. This layer builds on the example demonstrated in the BasicDisplayLayer, which involved creating OMGraphics for the map. For any of the methods listed below that are designed to assist with responding to mouse events, simply return null from them if you want a no-op, which is the default implementation in the OMGraphicHandlerLayer (so don't even override them).

See Also:
  `OMGraphicHandlerLayer.isHighlightable(com.bbn.openmap.omGraphics.OMGraphic)`, `OMGraphicHandlerLayer.highlight(com.bbn.openmap.omGraphics.OMGraphic)`, `OMGraphicHandlerLayer.unhighlight(com.bbn.openmap.omGraphics.OMGraphic)`, `OMGraphicHandlerLayer.getInfoText(com.bbn.openmap.omGraphics.OMGraphic)`, `JComponent.getToolTipText()`, `OMGraphicHandlerLayer.isSelectable(com.bbn.openmap.omGraphics.OMGraphic)`, `OMGraphicHandlerLayer.select(com.bbn.openmap.omGraphics.OMGraphicList)`, `OMGraphicHandlerLayer.deselect(com.bbn.openmap.omGraphics.OMGraphicList)`, `OMGraphicHandlerLayer.getItemsForMapMenu(com.bbn.openmap.event.MapMouseEvent)`, `OMGraphicHandlerLayer.getItemsForOMGraphicMenu(com.bbn.openmap.omGraphics.OMGraphic)`, `OMGraphicHandlerLayer.receivesMapEvents()`, `OMGraphicHandlerLayer.mouseOver(MapMouseEvent)`, `OMGraphicHandlerLayer.leftClick(com.bbn.openmap.event.MapMouseEvent)`, 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

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
`InteractionLayer()`

Method Summary
`void` `deselect(OMGraphicList list)` Designate a list of OMGraphics as deselected.
`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)` This method is called when a right mouse click is detected over the map and not over an OMGraphic.
`java.util.List` `getItemsForOMGraphicMenu(OMGraphic omg)` This method is called when a right mouse click is detected over an OMGraphic.
`java.lang.String` `getToolTipTextFor(OMGraphic omg)` Query for what tooltip to display for an OMGraphic when the mouse is over it.
`OMGraphicList` `init()` Called from the prepare() method if the layer discovers that its OMGraphicList is null.
`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` `select(OMGraphicList list)` Designate a list of OMGraphics as selected.

Methods inherited from class com.bbn.openmap.layer.learn.BasicLayer
`prepare`

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

`canSetList, copy, createLayerWorker, cut, 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, paint, paste, projectionChanged, receivesMapEvents, renderDataForProjection, resetFiltering, setCancelled, setConsumeEvents, setFilter, setInterruptable, setLayerWorker, setList, setMouseEventInterpreter, setMouseModeIDsForEvents, setProjectionChangePolicy, setProperties, 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, findAndInit, findAndUndo, fireHideToolTip, firePaletteEvent, fireRequestBrowserContent, fireRequestBrowserContent, fireRequestCursor, fireRequestInfoLine, fireRequestInfoLine, fireRequestInfoLine, fireRequestMessage, fireRequestMessage, fireRequestToolTip, fireRequestToolTip, fireRequestURL, fireRequestURL, fireStatusUpdate, fireStatusUpdate, fireVetoableChange, getAddAsBackground, getAddToBeanContext, getAttribute, getBeanContext, getGUI, 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 java.beans.beancontext.BeanContextChild
`addPropertyChangeListener, removePropertyChangeListener`

Constructor Detail

### InteractionLayer

    public InteractionLayer()

Method Detail

### init

    public OMGraphicList init()

  Called from the prepare() method if the layer discovers that its OMGraphicList is null. This method is being overridden so that TOOLTIPS can be set as attributes on the OMGraphics, and retrieved later in the gesturing queries.

  Overrides:
    `init` in class `BasicLayer`
  Returns:
    new OMGraphicList with OMGraphics that you always want to display and reproject as necessary.
  See Also:
    `BasicLayer.prepare()`

### 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, and unhighlight will be called with the mouse is moved off of it.

  Specified by:
    `isHighlightable` in interface `GestureResponsePolicy`
  Overrides:
    `isHighlightable` in class `OMGraphicHandlerLayer`
  See Also:
    `OMGraphicHandlerLayer.highlight(com.bbn.openmap.omGraphics.OMGraphic)`, `OMGraphicHandlerLayer.unhighlight(com.bbn.openmap.omGraphics.OMGraphic)`

### isSelectable

    public boolean isSelectable(OMGraphic omg)

  Query that an OMGraphic is selectable. Examples of handing selection are in the EditingLayer. The default OMGraphicHandlerLayer behavior is to add the OMGraphic to an OMGraphicList called selectedList. If you aren't going to be doing anything in particular with the selection, then return false here to reduce the workload of the layer.

  Specified by:
    `isSelectable` in interface `GestureResponsePolicy`
  Overrides:
    `isSelectable` in class `OMGraphicHandlerLayer`
  See Also:
    `OMGraphicHandlerLayer.select(com.bbn.openmap.omGraphics.OMGraphicList)`, `OMGraphicHandlerLayer.deselect(com.bbn.openmap.omGraphics.OMGraphicList)`

### select

    public void select(OMGraphicList list)

  Designate a list of OMGraphics as selected.

  Specified by:
    `select` in interface `GestureResponsePolicy`
  Overrides:
    `select` in class `OMGraphicHandlerLayer`
  See Also:
    `OMGraphicHandlerLayer.select(com.bbn.openmap.omGraphics.OMGraphicList)`

### deselect

    public void deselect(OMGraphicList list)

  Designate a list of OMGraphics as deselected.

  Specified by:
    `deselect` in interface `GestureResponsePolicy`
  Overrides:
    `deselect` in class `OMGraphicHandlerLayer`
  See Also:
    `OMGraphicHandlerLayer.deselect(com.bbn.openmap.omGraphics.OMGraphicList)`

### 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`

### getItemsForMapMenu

    public java.util.List getItemsForMapMenu(MapMouseEvent me)

  This method is called when a right mouse click is detected over the map and not over an OMGraphic. You can provide a List of components to be displayed in a popup menu. You have to do the wiring for making the list components do something, though.

  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)

  This method is called when a right mouse click is detected over an OMGraphic. You can provide a List of components to be displayed in a popup menu. You have to do the wiring for making the list components do something, though.

  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