|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
com.bbn.openmap.Layer
com.bbn.openmap.layer.location.LocationLayer
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. ####################################
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 boolean |
allowPartials
Flag to let objects appear partially off the edges of the map, when decluttering through the decluterr matrix. |
static java.lang.String |
AllowPartialsProperty
|
protected LocationPopupMenu |
backgroundMenu
What pops up if someone clicks on the background. |
protected javax.swing.Box |
box
|
static java.lang.String |
cancel
|
protected boolean |
cancelled
Set when the projection has changed while a swing worker is gathering graphics, and we want him to stop early. |
protected com.bbn.openmap.layer.location.LocationLayer.LocationWorker |
currentWorker
The swing worker that goes off in it's own thread to get graphics. |
protected java.lang.String[] |
dataHandlerNames
Pretty names for the handlers, for GUIs and such. |
protected LocationHandler[] |
dataHandlers
Handlers load the data, and manage it for the layer. |
protected DeclutterMatrix |
declutterMatrix
The declutter matrix to use, if desired. |
static java.lang.String |
DeclutterMatrixClassProperty
|
static java.lang.String |
LocationHandlerListProperty
|
protected LocationPopupMenu |
locMenu
What pops up if someone clicks on a location. |
protected MapBean |
map
Used for recentering commands off the pop-up menu. |
protected java.util.Vector |
omGraphics
The graphic list of objects to draw. |
static java.lang.String |
recenter
|
protected boolean |
useDeclutterMatrix
Flag to use declutter matrix or not. |
static java.lang.String |
UseDeclutterMatrixProperty
|
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. |
void |
doPrepare()
A method that will launch a Worker to fetch the data. |
Location |
findClosestLocation(java.awt.event.MouseEvent evt)
Given a mouse event, find the closest location on the screen. |
DeclutterMatrix |
getDeclutterMatrix()
|
java.util.Vector |
getGraphicList()
Retrieves a vector of the current graphics list. |
java.awt.Component |
getGUI()
Provides the palette widgets to control the options of showing maps, or attribute text. |
java.lang.String[] |
getLocationHandlerNames()
Get the LocationHandlers for this layer. |
LocationHandler[] |
getLocationHandlers()
Get the LocationHandlers for this layer. |
MapMouseListener |
getMapMouseListener()
Returns the MapMouseListener object that handles the mouse events. |
java.lang.String[] |
getMouseModeServiceList()
Return a list of the modes that are interesting to the MapMouseListener. |
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. |
boolean |
getUseDeclutterMatrix()
|
boolean |
isCancelled()
Check to see if the cancelled flag has been set. |
boolean |
mouseClicked(java.awt.event.MouseEvent evt)
Invoked when the mouse has been clicked on a component. |
boolean |
mouseDragged(java.awt.event.MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged. |
void |
mouseEntered(java.awt.event.MouseEvent e)
Invoked when the mouse enters a component. |
void |
mouseExited(java.awt.event.MouseEvent e)
Invoked when the mouse exits a component. |
void |
mouseMoved()
Handle a mouse cursor moving without the button being pressed. |
boolean |
mouseMoved(java.awt.event.MouseEvent evt)
Invoked when the mouse button has been moved on a component (with no buttons down). |
boolean |
mousePressed(java.awt.event.MouseEvent evt)
Invoked when a mouse button has been pressed on a component. |
boolean |
mouseReleased(java.awt.event.MouseEvent e)
Invoked when a mouse button has been released on a component. |
void |
paint(java.awt.Graphics g)
Paints the layer. |
java.util.Vector |
prepare()
Prepares the graphics for the layer. |
void |
projectionChanged(ProjectionEvent e)
The projectionListener interface method that lets the Layer know when the projection has changes, and therefore new graphics have to created /supplied for the screen. |
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. |
void |
renderDataForProjection(Projection proj,
java.awt.Graphics g)
Implementing the ProjectionPainter interface. |
protected void |
resetPalette()
Called when the LocationHandlers are reset, or their names are reset, to refresh the palette with the new information. |
void |
setCancelled(boolean set)
Used to set the cancelled flag in the layer. |
void |
setDeclutterMatrix(DeclutterMatrix dm)
|
void |
setGraphicList(java.util.Vector aList)
Sets the current graphics list to the given list. |
void |
setLocationHandlerNames(java.lang.String[] handlerNames)
Set the LocationHandler names suitable for a GUI. |
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)
|
protected void |
showLocationPopup(java.awt.event.MouseEvent evt,
Location loc,
MapBean map)
|
protected void |
showMapPopup(java.awt.event.MouseEvent evt,
MapBean map)
|
protected void |
workerComplete(com.bbn.openmap.layer.location.LocationLayer.LocationWorker worker)
The LocationWorker calls this method on the layer when it is done working. |
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 |
Field Detail |
protected DeclutterMatrix declutterMatrix
protected boolean useDeclutterMatrix
protected boolean allowPartials
protected java.util.Vector omGraphics
protected LocationHandler[] dataHandlers
protected java.lang.String[] dataHandlerNames
protected MapBean map
protected LocationPopupMenu backgroundMenu
protected LocationPopupMenu locMenu
public static final java.lang.String recenter
public static final java.lang.String cancel
public static final java.lang.String UseDeclutterMatrixProperty
public static final java.lang.String DeclutterMatrixClassProperty
public static final java.lang.String AllowPartialsProperty
public static final java.lang.String LocationHandlerListProperty
protected com.bbn.openmap.layer.location.LocationLayer.LocationWorker currentWorker
protected boolean cancelled
protected javax.swing.Box box
Constructor Detail |
public LocationLayer()
Method Detail |
public void setProperties(java.lang.String prefix, java.util.Properties properties)
setProperties
in interface PropertyConsumer
setProperties
in class Layer
prefix
- string prefix used in the properties file for this layer.properties
- the properties set in the properties file.public void setGraphicList(java.util.Vector aList)
aList
- a vector of OMGraphicspublic java.util.Vector getGraphicList()
public void setDeclutterMatrix(DeclutterMatrix dm)
public DeclutterMatrix getDeclutterMatrix()
public void setUseDeclutterMatrix(boolean set)
public boolean getUseDeclutterMatrix()
public void setCancelled(boolean set)
public boolean isCancelled()
public MapMouseListener getMapMouseListener()
Layer
public MapMouseListener getMapMouseListener() {
return this;
}
public String[] getMouseModeServiceList() {
return new String[] { SelectMouseMode.modeID };
}
getMapMouseListener
in class Layer
public void reloadData()
public void renderDataForProjection(Projection proj, java.awt.Graphics g)
renderDataForProjection
in interface ProjectionPainter
renderDataForProjection
in class Layer
proj
- Projection of the map.g
- java.awt.Graphics to draw into.public void projectionChanged(ProjectionEvent e)
projectionChanged
in interface ProjectionListener
e
- The projection event, most likely fired from a map bean.protected void workerComplete(com.bbn.openmap.layer.location.LocationLayer.LocationWorker worker)
worker
- the worker that has the graphics.public void doPrepare()
public java.util.Vector prepare()
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.
public void paint(java.awt.Graphics g)
g
- the Graphics context for paintingprotected void setLocationHandlers(java.lang.String prefix, java.util.Properties p)
public void removed(java.awt.Container cont)
removed
in class Layer
cont
- Containerpublic void setLocationHandlers(LocationHandler[] handlers)
handlers
- an array of LocationHandlers.public LocationHandler[] getLocationHandlers()
public void setLocationHandlerNames(java.lang.String[] handlerNames)
handlerNames
- an array of Strings.public java.lang.String[] getLocationHandlerNames()
protected void resetPalette()
resetPalette
in class Layer
protected WindowSupport createWindowSupport()
createWindowSupport
in class Layer
public java.awt.Component getGUI()
getGUI
in class Layer
public Location findClosestLocation(java.awt.event.MouseEvent evt)
public java.lang.String[] getMouseModeServiceList()
MapMouseListener
return new String[] { SelectMouseMode.modeID };
- Specified by:
getMouseModeServiceList
in interface MapMouseListener
- Returns:
- String[] of modeID's
- See Also:
NavMouseMode.modeID
,
SelectMouseMode.modeID
,
NullMouseMode.modeID
protected void showMapPopup(java.awt.event.MouseEvent evt, MapBean map)
protected void showLocationPopup(java.awt.event.MouseEvent evt, Location loc, MapBean map)
public boolean mousePressed(java.awt.event.MouseEvent evt)
MapMouseListener
mousePressed
in interface MapMouseListener
evt
- MouseEvent
public boolean mouseReleased(java.awt.event.MouseEvent e)
MapMouseListener
mouseReleased
in interface MapMouseListener
e
- MouseEvent
public boolean mouseClicked(java.awt.event.MouseEvent evt)
MapMouseListener
mousePressed()
, or if no other listener
processes the event. If the listener successfully processes
mouseClicked()
, then it will receive the next
mouseClicked()
notifications that have a click
count greater than one.
NOTE: We have noticed that this method can sometimes be
erroneously invoked. It seems to occur when a light-weight AWT
component (like an internal window or menu) closes (removes
itself from the window hierarchy). A specific OpenMap example
is when you make a menu selection when the MenuItem you select
is above the MapBean canvas. After making the selection, the
mouseClicked() gets invoked on the MouseDelegator, which passes
it to the appropriate listeners depending on the MouseMode. The
best way to avoid this problem is to not implement anything
crucial in this method. Use a combination of
mousePressed()
and mouseReleased()
instead.
mouseClicked
in interface MapMouseListener
evt
- MouseEvent
public void mouseEntered(java.awt.event.MouseEvent e)
MapMouseListener
mouseEntered
in interface MapMouseListener
e
- MouseEventpublic void mouseExited(java.awt.event.MouseEvent e)
MapMouseListener
mouseExited
in interface MapMouseListener
e
- MouseEventpublic boolean mouseDragged(java.awt.event.MouseEvent e)
MapMouseListener
mouseDragged
in interface MapMouseListener
e
- MouseEvent
public boolean mouseMoved(java.awt.event.MouseEvent evt)
MapMouseListener
mouseMoved
in interface MapMouseListener
evt
- MouseEvent
public void mouseMoved()
MapMouseListener
mouseMoved
in interface MapMouseListener
public java.util.Properties getProperties(java.util.Properties props)
getProperties
in interface PropertyConsumer
getProperties
in class Layer
props
- a Properties object to load the PropertyConsumer properties
into. If props equals null, then a new Properties object should be
created.
public java.util.Properties getPropertyInfo(java.util.Properties list)
getPropertyInfo
in interface PropertyConsumer
getPropertyInfo
in class Layer
list
- a Properties object to load the PropertyConsumer properties
into. If getList equals null, then a new Properties object should
be created.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |