com.bbn.openmap.event
Interface MapMouseListener

All Known Subinterfaces:
EditorTool, MapMouseInterpreter
All Known Implementing Classes:
AbstractEditorTool, AbstractPlugIn, AmpLinkLayer, BeanContextAbstractPlugIn, BufferedLinkLayer, CacheLayer, CircleSelectedState, CircleSetOffsetState, CircleUndefinedState, ClckOrDrgUndefinedState, CSVTiledImagePlugIn, DateLayer, DBLClickSelectMapMouseInterpreter, DrawingEditorTool, DrawLinkLayer, EarthImagePlugIn, EarthquakeLayer, EditableLabeledOMPoly, EditableLabeledOMSpline, EditableOMAbstractLine, EditableOMCircle, EditableOMDecoratedSpline, EditableOMDistance, EditableOMGraphic, EditableOMGraphicList, EditableOMLine, EditableOMPoint, EditableOMPoly, EditableOMRangeRings, EditableOMRect, EditableOMScalingRaster, EditableOMSpline, EditableOMText, EsriPlugIn, GraphicEditState, GraphicLoaderPlugIn, GraphicSelectedState, GraphicSetOffsetState, GraphicUndefinedEditState, GraphicUndefinedState, GraphicUnselectedState, LabelLayer, LineSetOffsetState, LineUndefinedState, LinkLayer, ListSelectedState, ListUnselectedState, LOSGraphicLoader, MapMouseAdapter, MMLGraphicLoader, NetMapGraphicLoader, OMGraphicHandlerPlugIn, PlotLayer, PointEditState, PointSetOffsetState, PointUndefinedState, PolyAddNodeState, PolyAddPointState, PolyDeleteNodeState, PolySetOffsetState, PolyUndefinedState, RectSelectedState, RectSetOffsetState, RectUndefinedState, ScaleFilterLayer, ScalingRasterSelectedState, ScalingRasterSetOffsetState, ScalingRasterUndefinedState, SHISPlugIn, SimpleBeanBox, StandardMapMouseInterpreter, State, TerrainLayer, TestLayer, TextEditState, TextSetOffsetState, TextUndefinedState, TimelineLayer, TimeSliderLayer, UTMGridPlugIn, WebImagePlugIn, WMSPlugIn

public interface MapMouseListener

The MapMouseListener interface is for use by a layer interested in getting mouse events when the mouse cursor is over the MapBean. These events will be coming from an event delegate object, that distributes events based on the current "mouse mode" of the map.

NOTE: It is very important that if a MapMouseListener is being implemented for a Layer object, the Layer.getMapMouseListener() method be modified for the layer to return the MapMouseListener. The layer returns null by default, and this will result in the MapMouseListener NEVER receiving events.

See Also:
SelectMouseMode, NavMouseMode

Method Summary
 java.lang.String[] getMouseModeServiceList()
          Return a list of the modes that are interesting to the MapMouseListener.
 boolean mouseClicked(java.awt.event.MouseEvent e)
          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 e)
          Invoked when the mouse button has been moved on a component (with no buttons down).
 boolean mousePressed(java.awt.event.MouseEvent e)
          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.
 

Method Detail

getMouseModeServiceList

java.lang.String[] getMouseModeServiceList()
Return a list of the modes that are interesting to the MapMouseListener. The source MouseEvents will only get sent to the MapMouseListener if the mode is set to one that the listener is interested in. Layers interested in receiving events should register for receiving events in "select" mode:
 return new String[] { SelectMouseMode.modeID };
 

Returns:
String[] of modeID's
See Also:
NavMouseMode.modeID, SelectMouseMode.modeID, NullMouseMode.modeID

mousePressed

boolean mousePressed(java.awt.event.MouseEvent e)
Invoked when a mouse button has been pressed on a component.

Parameters:
e - MouseEvent
Returns:
true if the listener was able to process the event.

mouseReleased

boolean mouseReleased(java.awt.event.MouseEvent e)
Invoked when a mouse button has been released on a component.

Parameters:
e - MouseEvent
Returns:
true if the listener was able to process the event.

mouseClicked

boolean mouseClicked(java.awt.event.MouseEvent e)
Invoked when the mouse has been clicked on a component. The listener will receive this event if it successfully processed 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.

Parameters:
e - MouseEvent
Returns:
true if the listener was able to process the event.

mouseEntered

void mouseEntered(java.awt.event.MouseEvent e)
Invoked when the mouse enters a component.

Parameters:
e - MouseEvent

mouseExited

void mouseExited(java.awt.event.MouseEvent e)
Invoked when the mouse exits a component.

Parameters:
e - MouseEvent

mouseDragged

boolean mouseDragged(java.awt.event.MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged. The listener will receive these events if it successfully processes mousePressed(), or if no other listener processes the event.

Parameters:
e - MouseEvent
Returns:
true if the listener was able to process the event.

mouseMoved

boolean mouseMoved(java.awt.event.MouseEvent e)
Invoked when the mouse button has been moved on a component (with no buttons down).

Parameters:
e - MouseEvent
Returns:
true if the listener was able to process the event.

mouseMoved

void mouseMoved()
Handle a mouse cursor moving without the button being pressed. This event is intended to tell the listener that there was a mouse movement, but that the event was consumed by another layer. This will allow a mouse listener to clean up actions that might have happened because of another motion event response.



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