|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.gui.tools.AbstractTool
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).
Field Summary | |
protected MapContext |
context
A tool is associated with only one context. |
Constructor Summary | |
AbstractTool()
|
Method Summary | |
protected void |
addMouseListener(java.awt.Component component,
MapContext context,
java.awt.event.MouseListener listener)
Register this tool to receive MouseEvents from component |
protected void |
addMouseMotionListener(java.awt.Component component,
MapContext context,
java.awt.event.MouseMotionListener listener)
Register this tool to receive MouseMotionEvents from component |
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 |
mouseClicked(java.awt.event.MouseEvent e)
Invoked when the mouse button has been clicked (pressed and released) on a component. |
void |
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(java.awt.event.MouseEvent e)
Invoked when the mouse button has been moved on a component (with no buttons down). |
void |
mousePressed(java.awt.event.MouseEvent e)
Invoked when a mouse button has been pressed on a component. |
void |
mouseReleased(java.awt.event.MouseEvent e)
Invoked when a mouse button has been released on a component. |
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". |
java.lang.String |
toString()
Return the name of the tool. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.geotools.gui.tools.Tool |
addMouseListener, addMouseMotionListener |
Field Detail |
protected MapContext context
Constructor Detail |
public AbstractTool()
Method Detail |
protected void addMouseListener(java.awt.Component component, MapContext context, java.awt.event.MouseListener listener)
component.
- Parameters:
component
- The tool will process mouseEvents from this component.context
- The Context that will be changed by this Tool.listener
- The tool to send mouseEvents to, usually the child of
this class.
- Throws:
java.lang.IllegalArgumentException
- if an argument is null
or the tool is being assigned a different context to before.
protected void addMouseMotionListener(java.awt.Component component, MapContext context, java.awt.event.MouseMotionListener listener) throws java.lang.IllegalArgumentException
component.
- Parameters:
component
- The tool will process mouseMotionEvents from this
component.listener
- The tool to send mouseMotionEvents to, usually the child
of his class.
- Throws:
java.lang.IllegalArgumentException
- if an argument is null
or the tool is being assigned a different context to before.
public void removeMouseListeners()
removeMouseListeners
in interface Tool
public MapContext getContext()
getContext
in interface Tool
public java.awt.Cursor getCursor()
getCursor
in interface Tool
public void setCursor(java.awt.Cursor cursor)
setCursor
in interface Tool
cursor
- The cursor to associate with this tool.public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
public void destroy()
destroy
in interface Tool
public void mouseDragged(java.awt.event.MouseEvent e)
MOUSE_DRAGGED
events will continue to be
delivered to the component where the drag originated until the
mouse button is released (regardless of whether the mouse position
is within the bounds of the component).
Due to platform-dependent Drag&Drop implementations,
MOUSE_DRAGGED
events may not be delivered during a native
Drag&Drop operation.
mouseDragged
in interface java.awt.event.MouseMotionListener
public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
public void paint(java.awt.Graphics g)
paint
in interface Tool
public void setName(java.lang.String name)
setName
in interface Tool
name
- what to call this tool.public java.lang.String getName()
getName
in interface Tool
public java.lang.String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |