com.bbn.openmap.layer.learn
Class InteractionLayer

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by com.bbn.openmap.Layer
                  extended by com.bbn.openmap.layer.OMGraphicHandlerLayer
                      extended by com.bbn.openmap.layer.learn.BasicLayer
                          extended by com.bbn.openmap.layer.learn.InteractionLayer
All Implemented Interfaces:
ProjectionListener, GestureResponsePolicy, OMGraphicHandler, ProjectionPainter, PropertyConsumer, 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 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/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
 
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
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<java.awt.Component> 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<java.awt.Component> 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
actionPerformed, canSetList, copy, createLayerWorker, cut, 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, paint, paste, projectionChanged, receivesMapEvents, renderDataForProjection, resetFiltering, setConsumeEvents, setFilter, setInterruptable, setLayerWorker, setList, setMouseEventInterpreter, setMouseModeIDsForEvents, setProjectionChangePolicy, setProperties, 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, findAndInit, findAndUndo, fireHideToolTip, firePaletteEvent, fireRequestBrowserContent, fireRequestBrowserContent, fireRequestCursor, fireRequestInfoLine, fireRequestInfoLine, fireRequestInfoLine, fireRequestMessage, fireRequestMessage, fireRequestToolTip, fireRequestToolTip, fireRequestURL, fireRequestURL, fireStatusUpdate, fireStatusUpdate, fireVetoableChange, getAddAsBackground, getAddToBeanContext, getAttribute, getBeanContext, getCoordTransform, getGUI, 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 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<java.awt.Component> 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<java.awt.Component> 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