es.prodevelop.gvsig.mobile.gui.tool.maplistener
Class MapToolListener

java.lang.Object
  extended byes.prodevelop.gvsig.mobile.gui.tool.maplistener.MapToolListener
All Implemented Interfaces:
java.util.EventListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener

public class MapToolListener
extends java.lang.Object
implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener

This is the mouse listener used by the MapControl to perform actions depending on the tool that is active in each moment. It keeps a changing reference to the current behavior which in turn is linked to the current tool listener.

Author:
jldominguez
See Also:
ToolListener, Behavior, MapControl, TBButton

Constructor Summary
MapToolListener(MapControl _mc)
          Constructor.
 
Method Summary
 TBButton getCurrentTool()
          Returns the active tool.
 void mouseClicked(java.awt.event.MouseEvent arg0)
          All mouse events are delivered to the behavior, who will process it depending on the functionality of the current tool.
 void mouseDragged(java.awt.event.MouseEvent arg0)
          All mouse events are delivered to the behavior, who will process it depending on the functionality of the current tool.
 void mouseEntered(java.awt.event.MouseEvent arg0)
           
 void mouseExited(java.awt.event.MouseEvent arg0)
           
 void mouseMoved(java.awt.event.MouseEvent arg0)
          All mouse events are delivered to the behavior, who will process it depending on the functionality of the current tool.
 void mousePressed(java.awt.event.MouseEvent arg0)
          All mouse events are delivered to the behavior, who will process it depending on the functionality of the current tool.
 void mouseReleased(java.awt.event.MouseEvent arg0)
          All mouse events are delivered to the behavior, who will process it depending on the functionality of the current tool.
 void setTool(TBButton tb, boolean clearStatusBar)
          Sets the current tool.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapToolListener

public MapToolListener(MapControl _mc)
Constructor.

Parameters:
_mc - the MapControl object associated with this listener.
Method Detail

getCurrentTool

public TBButton getCurrentTool()
Returns the active tool.

Only tools of type TBSelectableTool (subclass of TBButton) registers listeners, so only this objects will be real active tools

Returns:
the current tool (must be of type TBButton)

setTool

public void setTool(TBButton tb,
                    boolean clearStatusBar)
Sets the current tool.

Parameters:
tb - the new tool to be set as current tool
clearStatusBar - whether the status bar has to be cleared when this tool becomes the active tool.

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent arg0)
All mouse events are delivered to the behavior, who will process it depending on the functionality of the current tool.

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
arg0 - the mouose event that has to be managed by the behavir current

mousePressed

public void mousePressed(java.awt.event.MouseEvent arg0)
All mouse events are delivered to the behavior, who will process it depending on the functionality of the current tool.

Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
arg0 - the mouose event that has to be managed by the behavir current

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent arg0)
All mouse events are delivered to the behavior, who will process it depending on the functionality of the current tool.

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
arg0 - the mouose event that has to be managed by the behavir current

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent arg0)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent arg0)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent arg0)
All mouse events are delivered to the behavior, who will process it depending on the functionality of the current tool.

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Parameters:
arg0 - the mouose event that has to be managed by the behavir current

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent arg0)
All mouse events are delivered to the behavior, who will process it depending on the functionality of the current tool.

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
Parameters:
arg0 - the mouose event that has to be managed by the behavir current