com.bbn.openmap.event
Class CoordMouseMode

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

public abstract class CoordMouseMode
extends AbstractMouseMode
implements java.beans.PropertyChangeListener

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.

The CoordMouseMode has been updated to use CoordInfoFormatters to allow more flexibility in how coordinates are displayed in the InformationDelegator. You can use the 'coordFormatter' property to set a particular CoordInfoFormatter for this mouse mode. If you add a CoordInfoFormatterHandler to the MapHandler, the mouse mode will use whatever formatter is active in that CoordInfoFormatterHandler instead of what's specified in the properties.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.bbn.openmap.event.AbstractMouseMode
AbstractMouseMode.MouseWheelTimerListener
 
Field Summary
protected  CoordInfoFormatter coordFormatter
           
protected  CoordInfoFormatterHandler coordFormatterHandler
           
static java.lang.String CoordFormatterProperty
          'coordFormatter' property for setting the class of the coordinate formatter.
 InformationDelegator infoDelegator
          The info delegator that will display the distance information
 
Fields inherited from class com.bbn.openmap.event.AbstractMouseMode
cursor, CursorIDProperty, guiIcon, iconName, IconProperty, ID, IDProperty, logger, mouseSupport, mouseTimer, mouseWheelListener, MouseWheelListenerProperty, mouseWheelTimerInterval, MouseWheelTimerIntervalProperty, mouseWheelTimerListener, MouseWheelZoomProperty, noMouseWheelListenerTimer, NoMouseWheelListenerTimerProperty, prettyName, PrettyNameProperty, propertyChangeSupport, 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, isolated
 
Fields inherited from interface com.bbn.openmap.PropertyConsumer
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty
 
Constructor Summary
CoordMouseMode()
           
CoordMouseMode(java.lang.String modeID, boolean shouldConsumeEvents)
           
 
Method Summary
 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.
 CoordInfoFormatter getCoordFormatter()
           
 CoordInfoFormatterHandler getCoordFormatterHandler()
           
 InformationDelegator getInfoDelegator()
          Return the information delegator.
 java.util.Properties getProperties(java.util.Properties props)
          PropertyConsumer method, to fill in a Properties object, reflecting the current values of the OMComponent.
 java.util.Properties getPropertyInfo(java.util.Properties props)
          Method to fill in a Properties object with values reflecting the properties able to be set on this PropertyConsumer.
 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 propertyChange(java.beans.PropertyChangeEvent evt)
           
 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 setCoordFormatter(CoordInfoFormatter coordFormatter)
           
 void setCoordFormatterHandler(CoordInfoFormatterHandler coordFormatterHandler)
           
 void setInfoDelegator(InformationDelegator id)
          Set the information delegator.
 void setProperties(java.lang.String prefix, java.util.Properties props)
          Sets the properties for the OMComponent.
 
Methods inherited from class com.bbn.openmap.event.AbstractMouseMode
actAsProxyFor, actAsProxyFor, addMapMouseListener, addPropertyChangeListener, getClassToUseForIconRetrieval, getGUIIcon, getIconName, getID, getModeCursor, getMouseSupport, getMouseWheelTimerInterval, getNoMouseWheelListener, getPrettyName, getProxied, getProxyDistributionMask, isConsumeEvents, isMouseWheelListener, isNoMouseWheelListenerTimer, isProxyFor, isVisible, isZoomWhenMouseWheelUp, listenerPaint, mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased, mouseWheelMoved, releaseProxy, removeAllMapMouseListeners, removeMapMouseListener, removePropertyChangeListener, setConsumeEvents, setGUIIcon, setIconName, setID, setModeCursor, setModeCursor, setMouseSupport, setMouseWheelListener, setMouseWheelTimerInterval, setNoMouseWheelListener, setNoMouseWheelListenerTimer, setPrettyName, setProxyDistributionMask, setVisible, setZoomWhenMouseWheelUp, updateMouseWheelMoved
 
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, isIsolated, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext, setIsolated
 
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


CoordFormatterProperty

public static final java.lang.String CoordFormatterProperty
'coordFormatter' property for setting the class of the coordinate formatter.

See Also:
Constant Field Values

coordFormatter

protected CoordInfoFormatter coordFormatter

coordFormatterHandler

protected CoordInfoFormatterHandler coordFormatterHandler
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.


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.

setProperties

public void setProperties(java.lang.String prefix,
                          java.util.Properties props)
Description copied from class: OMComponent
Sets the properties for the OMComponent.

Specified by:
setProperties in interface PropertyConsumer
Overrides:
setProperties in class AbstractMouseMode
Parameters:
prefix - the token to prefix the property names
props - the Properties object

getProperties

public java.util.Properties getProperties(java.util.Properties props)
Description copied from class: OMComponent
PropertyConsumer method, to fill in a Properties object, reflecting the current values of the OMComponent. If the component 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 AbstractMouseMode
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 props)
Description copied from class: OMComponent
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 AbstractMouseMode
Parameters:
props - 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.

getCoordFormatter

public CoordInfoFormatter getCoordFormatter()

setCoordFormatter

public void setCoordFormatter(CoordInfoFormatter coordFormatter)

getCoordFormatterHandler

public CoordInfoFormatterHandler getCoordFormatterHandler()

setCoordFormatterHandler

public void setCoordFormatterHandler(CoordInfoFormatterHandler coordFormatterHandler)

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener


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