com.bbn.openmap.layer.location
Class LocationLayer

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.location.LocationLayer
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
Direct Known Subclasses:
TimerLocationLayer

public class LocationLayer
extends OMGraphicHandlerLayer

The LocationLayer is a layer that displays graphics supplied by LocationHandlers. When the layer receives a new projection, it goes to each LocationHandler and asks it for additions to the layer's graphic list. The LocationHandlers maintain the graphics, and the layer maintains the overall list. The whole idea behind locations is that there are geographic places that are to be marked with a graphic, and/or a text label. The location handler handles the interface with the source and type of location to be displayed, and the LocationLayer deals with all the locations in a generic way. The LocationLayer is capable of using more than one LocationHandler.

As a side note, a Link is nothing more than a connection between Locations, and is an extension of the Location Class. They have a graphic representing the link, an optional label, and an extra set of location coordinates.

The layer responds to gestures with pop-up menus. Which menu appears depends if the gesture affects a graphic.

The properties for this layer are:

 
   ####################################
   # Properties for LocationLayer
   # Use the DeclutterMatrix to declutter the labels.
   locationlayer.useDeclutter=false
   # Which declutter matrix class to use.
   locationlayer.declutterMatrix=com.bbn.openmap.layer.DeclutterMatrix
   # Let the DeclutterMatrix have labels that run off the edge of the map.
   locationlayer.allowPartials=true
   # The list of location handler prefixes - each prefix should then
   # be used to further define the location handler properties.
   locationlayer.locationHandlers=handler1 handler2
   # Then come the handler properties...
   # At the least, each handler should have a .class property
   handler1.class=<handler classname>
   # plus any other properties handler1 needs - check the handler1 documentation.
   ####################################
 
 

See Also:
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  boolean allowPartials
          Flag to let objects appear partially off the edges of the map, when decluttering through the declutter matrix.
static java.lang.String AllowPartialsProperty
           
protected  javax.swing.Box box
           
static java.lang.String cancel
           
protected  java.util.concurrent.CopyOnWriteArrayList<LocationHandler> dataHandlers
          Handlers load the data, and manage it for the layer.
protected  javax.swing.JCheckBox declutterButton
           
protected  DeclutterMatrix declutterMatrix
          The declutter matrix to use, if desired.
static java.lang.String DeclutterMatrixClassProperty
           
static java.lang.String LocationHandlerListProperty
           
static java.lang.String recenter
           
protected  boolean useDeclutterMatrix
          Flag to use declutter matrix or not.
static java.lang.String UseDeclutterMatrixProperty
           
 
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
LocationLayer()
          The default constructor for the Layer.
 
Method Summary
protected  WindowSupport createWindowSupport()
          Overridden from Layer because we are placing our own scroll pane around the LocationHandler GUIs.
 DeclutterMatrix getDeclutterMatrix()
           
 java.awt.Component getGUI()
          Provides the palette widgets to control the options of showing maps, or attribute text.
 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.
 LocationHandler[] getLocationHandlers()
          Get the LocationHandlers for this layer.
 java.util.Properties getProperties(java.util.Properties props)
          PropertyConsumer method, to fill in a Properties object, reflecting the current values of the layer.
 java.util.Properties getPropertyInfo(java.util.Properties list)
          Method to fill in a Properties object with values reflecting the properties able to be set on this PropertyConsumer.
 java.lang.String getToolTipTextFor(OMGraphic omg)
          If applicable, should return a tool tip for the OMGraphic.
 boolean getUseDeclutterMatrix()
           
 void paint(java.awt.Graphics g)
          Paints the layer.
 OMGraphicList prepare()
          Prepares the graphics for the layer.
 void reloadData()
          Tell the location handlers to reload their data from their sources.
 void removed(java.awt.Container cont)
          Let the LocationHandlers know that the layer has been removed.
protected  void resetPalette()
          Called when the LocationHandlers are reset, or their names are reset, to refresh the palette with the new information.
 void setDeclutterMatrix(DeclutterMatrix dm)
           
 void setLocationHandlers(LocationHandler[] handlers)
          Set the LocationHandlers for the layer.
protected  void setLocationHandlers(java.lang.String prefix, java.util.Properties p)
          Parse the properties and set up the location handlers.
 void setProperties(java.lang.String prefix, java.util.Properties properties)
          The properties and prefix are managed and decoded here, for the standard uses of the LocationLayer.
 void setUseDeclutterMatrix(boolean set)
           
 
Methods inherited from class com.bbn.openmap.layer.OMGraphicHandlerLayer
actionPerformed, canSetList, copy, createLayerWorker, cut, deselect, dispose, doAction, doPrepare, filter, filter, filter, getConsumeEvents, getDefaultSettingsPanel, getFilter, getInfoText, getItemsForMapMenu, getLayerWorker, getList, getMapMouseListener, getMouseEventInterpreter, getMouseModeIDsForEvents, getProjectionChangePolicy, getRedrawButton, getRenderPolicy, getSelected, getSettingsButton, getTransparency, getTransparencyAdjustmentPanel, highlight, isCancelled, isHighlightable, isInterruptable, isSelectable, isWorking, leftClick, mouseOver, paste, projectionChanged, receivesMapEvents, renderDataForProjection, resetFiltering, select, 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, 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, getIcon, getMaxScale, getMinScale, getPackage, getPalette, getProjection, getPropertyPrefix, getWindowSupport, hasGUI, hidePalette, isAutoPalette, isProjectionOK, isReadyToPaint, isRemovable, notifyHideHack, prependDataPathPrefix, putAttribute, removeComponentListener, removeConfirmed, removeInfoDisplayListener, removeLayerStatusListener, removeVetoableChangeListener, repaint, 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
 

Field Detail

declutterMatrix

protected DeclutterMatrix declutterMatrix
The declutter matrix to use, if desired.


useDeclutterMatrix

protected boolean useDeclutterMatrix
Flag to use declutter matrix or not.


allowPartials

protected boolean allowPartials
Flag to let objects appear partially off the edges of the map, when decluttering through the declutter matrix.


dataHandlers

protected final java.util.concurrent.CopyOnWriteArrayList<LocationHandler> dataHandlers
Handlers load the data, and manage it for the layer.


recenter

public static final java.lang.String recenter
See Also:
Constant Field Values

cancel

public static final java.lang.String cancel
See Also:
Constant Field Values

UseDeclutterMatrixProperty

public static final java.lang.String UseDeclutterMatrixProperty
See Also:
Constant Field Values

DeclutterMatrixClassProperty

public static final java.lang.String DeclutterMatrixClassProperty
See Also:
Constant Field Values

AllowPartialsProperty

public static final java.lang.String AllowPartialsProperty
See Also:
Constant Field Values

LocationHandlerListProperty

public static final java.lang.String LocationHandlerListProperty
See Also:
Constant Field Values

box

protected javax.swing.Box box

declutterButton

protected javax.swing.JCheckBox declutterButton
Constructor Detail

LocationLayer

public LocationLayer()
The default constructor for the Layer. All of the attributes are set to their default values.

Method Detail

setProperties

public void setProperties(java.lang.String prefix,
                          java.util.Properties properties)
The properties and prefix are managed and decoded here, for the standard uses of the LocationLayer.

Specified by:
setProperties in interface PropertyConsumer
Overrides:
setProperties in class OMGraphicHandlerLayer
Parameters:
prefix - string prefix used in the properties file for this layer.
properties - the properties set in the properties file.

setDeclutterMatrix

public void setDeclutterMatrix(DeclutterMatrix dm)

getDeclutterMatrix

public DeclutterMatrix getDeclutterMatrix()

setUseDeclutterMatrix

public void setUseDeclutterMatrix(boolean set)

getUseDeclutterMatrix

public boolean getUseDeclutterMatrix()

reloadData

public void reloadData()
Tell the location handlers to reload their data from their sources. If you want these changes to appear on the map, you should call doPrepare() after this call.


prepare

public OMGraphicList prepare()
Prepares the graphics for the layer. This is where the getRectangle() method call is made on the location.

Occasionally it is necessary to abort a prepare call. When this happens, the map will set the cancel bit in the LayerThread, (the thread that is running the prepare). If this Layer needs to do any cleanups during the abort, it should do so, but return out of the prepare asap.

Overrides:
prepare in class OMGraphicHandlerLayer

paint

public void paint(java.awt.Graphics g)
Paints the layer.

Overrides:
paint in class OMGraphicHandlerLayer
Parameters:
g - the Graphics context for painting

setLocationHandlers

protected void setLocationHandlers(java.lang.String prefix,
                                   java.util.Properties p)
Parse the properties and set up the location handlers. The prefix will should be null, or a prefix string with a period at the end, for scoping purposes.


removed

public void removed(java.awt.Container cont)
Let the LocationHandlers know that the layer has been removed.

Overrides:
removed in class Layer
Parameters:
cont - Container

setLocationHandlers

public void setLocationHandlers(LocationHandler[] handlers)
Set the LocationHandlers for the layer. Make sure you update the LocationHandler names, too, so the names correspond to these.

Parameters:
handlers - an array of LocationHandlers.

getLocationHandlers

public LocationHandler[] getLocationHandlers()
Get the LocationHandlers for this layer.


resetPalette

protected void resetPalette()
Called when the LocationHandlers are reset, or their names are reset, to refresh the palette with the new information.

Overrides:
resetPalette in class Layer

createWindowSupport

protected WindowSupport createWindowSupport()
Overridden from Layer because we are placing our own scroll pane around the LocationHandler GUIs.

Overrides:
createWindowSupport in class Layer
Returns:
WindowSupport object for layer palette.

getGUI

public java.awt.Component getGUI()
Provides the palette widgets to control the options of showing maps, or attribute text.

Overrides:
getGUI in class Layer
Returns:
Component object representing the palette widgets.

getToolTipTextFor

public java.lang.String getToolTipTextFor(OMGraphic omg)
Description copied from class: OMGraphicHandlerLayer
If applicable, should return a tool tip for the OMGraphic. Return null if nothing should be shown.

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

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.

getProperties

public java.util.Properties getProperties(java.util.Properties props)
PropertyConsumer method, to fill in a Properties object, reflecting the current values of the layer. If the layer has a propertyPrefix set, the property keys should have that prefix plus a separating '.' prepended to each property key it uses for configuration.

Specified by:
getProperties in interface PropertyConsumer
Overrides:
getProperties in class OMGraphicHandlerLayer
Parameters:
props - a Properties object to load the PropertyConsumer properties into. If props equals null, then a new Properties object should be created.
Returns:
Properties object containing PropertyConsumer property values. If getList was not null, this should equal getList. Otherwise, it should be the Properties object created by the PropertyConsumer.

getPropertyInfo

public java.util.Properties getPropertyInfo(java.util.Properties list)
Method to fill in a Properties object with values reflecting the properties able to be set on this PropertyConsumer. The key for each property should be the raw property name (without a prefix) with a value that is a String that describes what the property key represents, along with any other information about the property that would be helpful (range, default value, etc.). For Layer, this method should at least return the 'prettyName' property.

Specified by:
getPropertyInfo in interface PropertyConsumer
Overrides:
getPropertyInfo in class OMGraphicHandlerLayer
Parameters:
list - a Properties object to load the PropertyConsumer properties into. If getList equals null, then a new Properties object should be created.
Returns:
Properties object containing PropertyConsumer property values. If getList was not null, this should equal getList. Otherwise, it should be the Properties object created by the PropertyConsumer.


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