com.vividsolutions.jump.workbench.ui.cursortool
Class AbstractCursorTool

java.lang.Object
  extended by com.vividsolutions.jump.workbench.ui.cursortool.AbstractCursorTool
All Implemented Interfaces:
CursorTool, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener
Direct Known Subclasses:
DragTool, MultiClickTool, SnapIndicatorTool

public abstract class AbstractCursorTool
extends java.lang.Object
implements CursorTool

A tool that draws an XOR visual indicator. Subclasses need not keep track of the XOR state of the indicator -- that logic is all handled by this class. Even if the LayerViewPanel is repainted while the XOR indicator is on-screen.


Nested Class Summary
static interface AbstractCursorTool.Listener
           
 
Constructor Summary
AbstractCursorTool()
           
 
Method Summary
 void activate(LayerViewPanel layerViewPanel)
           
 void add(AbstractCursorTool.Listener listener)
           
 void allowSnapping()
          Makes this CursorTool obey the snapping settings in the Options dialog.
 void cancelGesture()
          Notifies the CursorTool that a party is requesting that the gesture currently in progress be aborted.
static java.awt.Cursor createCursor(java.awt.Image image)
          The cursor will look best if the image is a 32 x 32 transparent GIF.
static java.awt.Cursor createCursor(java.awt.Image image, java.awt.Point hotSpot)
           
static java.util.List createStandardSnappingPolicies(Blackboard blackboard)
           
 void deactivate()
           
 java.awt.Color getColor()
           
 java.awt.Cursor getCursor()
           
 java.lang.String getName()
          Returns a very brief description of this CursorTool.
 SnapManager getSnapManager()
           
 JUMPWorkbench getWorkbench()
           
 boolean isGestureInProgress()
          Used by OrCompositeTool to determine whether a CursorTool is busy interacting with the user.
 boolean isRightMouseButtonUsed()
           
 boolean isShapeOnScreen()
          Important for XOR drawing.
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
static java.lang.String name(CursorTool tool)
           
 void setColor(java.awt.Color color)
           
 java.lang.String toString()
           
static JUMPWorkbench workbench(LayerViewPanel panel)
           
static WorkbenchFrame workbenchFrame(LayerViewPanel layerViewPanel)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.vividsolutions.jump.workbench.ui.cursortool.CursorTool
getIcon
 

Constructor Detail

AbstractCursorTool

public AbstractCursorTool()
Method Detail

allowSnapping

public void allowSnapping()
Makes this CursorTool obey the snapping settings in the Options dialog.


createCursor

public static java.awt.Cursor createCursor(java.awt.Image image)
The cursor will look best if the image is a 32 x 32 transparent GIF.


createCursor

public static java.awt.Cursor createCursor(java.awt.Image image,
                                           java.awt.Point hotSpot)

getCursor

public java.awt.Cursor getCursor()
Specified by:
getCursor in interface CursorTool

isGestureInProgress

public boolean isGestureInProgress()
Used by OrCompositeTool to determine whether a CursorTool is busy interacting with the user.

Specified by:
isGestureInProgress in interface CursorTool

isRightMouseButtonUsed

public boolean isRightMouseButtonUsed()
Specified by:
isRightMouseButtonUsed in interface CursorTool
Returns:
true if this CursorTool uses the right mouse button; false to allow the panel to show a popup-menu on right-clicks

isShapeOnScreen

public boolean isShapeOnScreen()
Important for XOR drawing. Even if #getShape returns null, this method will return true between calls of #redrawShape and #clearShape.


activate

public void activate(LayerViewPanel layerViewPanel)
Specified by:
activate in interface CursorTool

workbenchFrame

public static WorkbenchFrame workbenchFrame(LayerViewPanel layerViewPanel)

createStandardSnappingPolicies

public static java.util.List createStandardSnappingPolicies(Blackboard blackboard)

deactivate

public void deactivate()
Specified by:
deactivate in interface CursorTool

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseEntered

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

mouseExited

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

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

setColor

public void setColor(java.awt.Color color)

cancelGesture

public void cancelGesture()
Description copied from interface: CursorTool
Notifies the CursorTool that a party is requesting that the gesture currently in progress be aborted.

Specified by:
cancelGesture in interface CursorTool

getWorkbench

public JUMPWorkbench getWorkbench()

workbench

public static JUMPWorkbench workbench(LayerViewPanel panel)

add

public void add(AbstractCursorTool.Listener listener)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getName

public java.lang.String getName()
Description copied from interface: CursorTool
Returns a very brief description of this CursorTool.

Specified by:
getName in interface CursorTool
Returns:
the name of this CursorTool

name

public static java.lang.String name(CursorTool tool)

getSnapManager

public SnapManager getSnapManager()

getColor

public java.awt.Color getColor()