org.geotools.gui.tools
Interface Tool

All Known Subinterfaces:
ClickPanTool, ClickZoomTool, PanTool, ZoomTool
All Known Implementing Classes:
AbstractTool, ClickPanToolImpl, ClickZoomToolImpl, PanToolImpl, ZoomToolImpl

public interface Tool

Base class for all the geotools Tools, like PanTool, ZoomTool, etc. Tools process mouse events on behalf of widgets like MapPane and change data in the Context (like the AreaOfInterest).

Version:
$Id: Tool.java 17672 2006-01-19 00:25:55Z desruisseaux $
Author:
Cameron Shorter

Method Summary
 void addMouseListener(java.awt.Component component, MapContext context)
          Register this tool to receive Mouse Events from component.
 void addMouseMotionListener(java.awt.Component component, MapContext context)
           
 void destroy()
          Clean up this class.
 MapContext getContext()
          Get the context.
 java.awt.Cursor getCursor()
          Return the prefered cursor for this tool.
 java.lang.String getName()
          Get the name of the tool.
 void paint(java.awt.Graphics g)
           
 void removeMouseListeners()
          Remove all Mouse Listeners from this tool.
 void setCursor(java.awt.Cursor cursor)
          Set the cursor for this Tool.
 void setName(java.lang.String name)
          Set the name for the tool, eg "Zoom In", "Zoom Out", "Pan".
 

Method Detail

addMouseListener

public void addMouseListener(java.awt.Component component,
                             MapContext context)
                      throws java.lang.IllegalArgumentException
Register this tool to receive Mouse Events from component. The events may be MouseEvents or MouseMotionEvents or both depending on the Tool which implements this interface.

Parameters:
component - The tool will process mouseEvents from this component.
context - The Context that will be changed by this Tool.
Throws:
java.lang.IllegalArgumentException - if an argument is null or the tool is being assigned a different context to before.

addMouseMotionListener

public void addMouseMotionListener(java.awt.Component component,
                                   MapContext context)
                            throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

removeMouseListeners

public void removeMouseListeners()
Remove all Mouse Listeners from this tool. This method should be called when this tool is deselected from a MapPane.


getContext

public MapContext getContext()
Get the context. If context has not been set yet, then null is returned.

Returns:
The context of this tool.

setName

public void setName(java.lang.String name)
Set the name for the tool, eg "Zoom In", "Zoom Out", "Pan".

Parameters:
name - what to call this tool.

getName

public java.lang.String getName()
Get the name of the tool.

Returns:
The name of this tool.

getCursor

public java.awt.Cursor getCursor()
Return the prefered cursor for this tool.

Returns:
cursor The prefered cursor for this tool.

setCursor

public void setCursor(java.awt.Cursor cursor)
Set the cursor for this Tool.

Parameters:
cursor - The cursor to associate with this tool.

destroy

public void destroy()
Clean up this class.


paint

public void paint(java.awt.Graphics g)


Copyright © GeoTools. All Rights Reserved.