com.bbn.openmap.event
Class CoordMouseMode

java.lang.Object
  extended bycom.bbn.openmap.MapHandlerChild
      extended bycom.bbn.openmap.OMComponent
          extended bycom.bbn.openmap.event.AbstractMouseMode
              extended bycom.bbn.openmap.event.CoordMouseMode
All Implemented Interfaces:
java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.util.EventListener, LightMapHandlerChild, MapMouseMode, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, PaintListener, PropertyConsumer, java.io.Serializable
Direct Known Subclasses:
DistanceMouseMode, EditorLayerMouseMode, NavMouseMode, OMDrawingToolMouseMode, PanMouseMode, SelectMouseMode, ZoomMouseMode

public abstract class CoordMouseMode
extends AbstractMouseMode

The CoordMouseMode is an abstract MouseMode extension to AbstractMouseMode that can be used for Modes that want to use the BeanContext to hook up with the InformationDelegator, and to send coordinate updates to be displayed in the infoline.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class com.bbn.openmap.event.AbstractMouseMode
AbstractMouseMode.MouseWheelZoomEditor
 
Field Summary
 InformationDelegator infoDelegator
          The info delegator that will display the distance information
 
Fields inherited from class com.bbn.openmap.event.AbstractMouseMode
cursor, CursorIDProperty, df, guiIcon, iconName, IconProperty, ID, IDProperty, mouseSupport, MouseWheelZoomProperty, prettyName, PrettyNameProperty, visible, ZOOM_IN, ZOOM_OUT, zoomWhenMouseWheelUp
 
Fields inherited from class com.bbn.openmap.OMComponent
i18n, propertyPrefix
 
Fields inherited from class com.bbn.openmap.MapHandlerChild
beanContextChildSupport
 
Fields inherited from interface com.bbn.openmap.PropertyConsumer
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty
 
Constructor Summary
CoordMouseMode()
           
CoordMouseMode(java.lang.String modeID, boolean shouldConsumeEvents)
           
 
Method Summary
protected  java.lang.String createCoordinateInformationLine(int x, int y, LatLonPoint llp)
          Method to create the information string reflecting information at the LatLonPoint provided.
 void findAndInit(java.lang.Object someObj)
          Called when a CoordMouseMode is added to a BeanContext, or when another object is added to the BeanContext after that.
 void findAndUndo(java.lang.Object someObj)
          BeanContextMembershipListener method.
 void fireMouseLocation(java.awt.event.MouseEvent e)
          Sends the mouse event location, x/y and lat/lon, to the InformationDelegator.
 InformationDelegator getInfoDelegator()
          Return the information delegator.
 void mouseDragged(java.awt.event.MouseEvent e)
          Fires a mouse location to the InformationDelegator, and then calls the super class method which calls the MouseSupport method.
 void mouseMoved(java.awt.event.MouseEvent e)
          Fires a mouse location to the InformationDelegator, and then calls the super class method which calls the MouseSupport method.
 void setActive(boolean active)
          If the MouseMode has been made inactive, clean out any input that might have been made to the info line.
 void setInfoDelegator(InformationDelegator id)
          Set the information delegator.
 
Methods inherited from class com.bbn.openmap.event.AbstractMouseMode
actAsProxyFor, actAsProxyFor, addMapMouseListener, getClassToUseForIconRetrieval, getGUIIcon, getIconName, getID, getModeCursor, getMouseSupport, getPrettyName, getProperties, getPropertyInfo, getProxyDistributionMask, isConsumeEvents, isProxyFor, isVisible, isZoomWhenMouseWheelUp, listenerPaint, mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased, mouseWheelMoved, releaseProxy, removeAllMapMouseListeners, removeMapMouseListener, setConsumeEvents, setGUIIcon, setIconName, setID, setModeCursor, setModeCursor, setMouseSupport, setPrettyName, setProperties, setProxyDistributionMask, setVisible, setZoomWhenMouseWheelUp
 
Methods inherited from class com.bbn.openmap.OMComponent
getPropertyPrefix, setProperties, setPropertyPrefix
 
Methods inherited from class com.bbn.openmap.MapHandlerChild
addPropertyChangeListener, addVetoableChangeListener, childrenAdded, childrenRemoved, findAndInit, firePropertyChange, fireVetoableChange, getBeanContext, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

infoDelegator

public InformationDelegator infoDelegator
The info delegator that will display the distance information

Constructor Detail

CoordMouseMode

public CoordMouseMode()

CoordMouseMode

public CoordMouseMode(java.lang.String modeID,
                      boolean shouldConsumeEvents)
Parameters:
modeID - the id for the mouse mode.
shouldConsumeEvents - the mode setting, where the mousemode should pass the events on to other listeners or not, depending if one of the listeners used it or not.
Method Detail

setInfoDelegator

public void setInfoDelegator(InformationDelegator id)
Set the information delegator.

Parameters:
id - the information delegator that displays the distance values.

getInfoDelegator

public InformationDelegator getInfoDelegator()
Return the information delegator.


mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Fires a mouse location to the InformationDelegator, and then calls the super class method which calls the MouseSupport method.

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
Overrides:
mouseMoved in class AbstractMouseMode
Parameters:
e - MouseEvent to be handled

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Fires a mouse location to the InformationDelegator, and then calls the super class method which calls the MouseSupport method.

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Overrides:
mouseDragged in class AbstractMouseMode
Parameters:
e - mouse event.

setActive

public void setActive(boolean active)
If the MouseMode has been made inactive, clean out any input that might have been made to the info line.

Specified by:
setActive in interface MapMouseMode
Overrides:
setActive in class AbstractMouseMode
Parameters:
active - true if the mode has been made active, false if it has been made inactive.

fireMouseLocation

public void fireMouseLocation(java.awt.event.MouseEvent e)
Sends the mouse event location, x/y and lat/lon, to the InformationDelegator.


createCoordinateInformationLine

protected java.lang.String createCoordinateInformationLine(int x,
                                                           int y,
                                                           LatLonPoint llp)
Method to create the information string reflecting information at the LatLonPoint provided. By default, will return a string for the x and y, and the lat/lon. If llp is null, just the x, y will be returned. This method can be changed, or overridden to change what kind of coordinates (UTM, DMS, MGRS) are reflected here.


findAndInit

public void findAndInit(java.lang.Object someObj)
Called when a CoordMouseMode is added to a BeanContext, or when another object is added to the BeanContext after that. The CoordMouseMode looks for an InformationDelegator to use to fire the coordinate updates. If another InforationDelegator is added when one is already set, the later one will replace the current one.

Specified by:
findAndInit in interface LightMapHandlerChild
Overrides:
findAndInit in class MapHandlerChild
Parameters:
someObj - an object being added to the BeanContext.

findAndUndo

public void findAndUndo(java.lang.Object someObj)
BeanContextMembershipListener method. Called when objects have been removed from the parent BeanContext. If an InformationDelegator is removed from the BeanContext, and it's the same one that is currently held, it will be removed.

Specified by:
findAndUndo in interface LightMapHandlerChild
Overrides:
findAndUndo in class MapHandlerChild
Parameters:
someObj - an object being removed from the BeanContext.


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