net.refractions.udig.project.ui.tool
Class AbstractModalTool

java.lang.Object
  extended by net.refractions.udig.project.ui.tool.AbstractTool
      extended by net.refractions.udig.project.ui.tool.AbstractModalTool
All Implemented Interfaces:
java.util.EventListener, MapMouseListener, MapMouseMotionListener, MapMouseWheelListener, ModalTool, Tool
Direct Known Subclasses:
SimpleTool

public abstract class AbstractModalTool
extends AbstractTool
implements ModalTool

An abstract super class that modal tools can extend.

The editor will only maintain one modal tool in the "enabled" state at one time.

Since:
0.3
Author:
Vitalus, jeichar
See Also:
AbstractTool, ModalTool

Field Summary
 
Fields inherited from class net.refractions.udig.project.ui.tool.AbstractTool
context, DRAG_DROP, enabled, MOTION, MOUSE, NONE, WHEEL
 
Fields inherited from interface net.refractions.udig.project.ui.tool.ModalTool
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NO_CURSOR, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from interface net.refractions.udig.project.ui.tool.Tool
EDIT, EXTENSION_ID, VIEW
 
Constructor Summary
AbstractModalTool()
          By default SimpleTool will simply respond to MOUSE.
AbstractModalTool(int targets)
          Creates an new instance of AbstractModalTool
 
Method Summary
 java.lang.String getCursorID()
          (non-Javadoc)
 boolean isActive()
          Returns true if the current tool is active.
 void setActive(boolean active)
          Called when tool button is pressed.
 void setContext(IToolContext context)
          Called each time an eclipse editor is activated.
 void setCursorID(java.lang.String id)
          (non-Javadoc)
 void setEnabled(boolean enabled)
          (non-Javadoc)
 
Methods inherited from class net.refractions.udig.project.ui.tool.AbstractTool
addListener, deregisterMouseListeners, dispose, fireEvent, getContext, getProperty, getSelectionProvider, init, isEnabled, isNotifyListeners, mouseDoubleClicked, mouseDragged, mouseEntered, mouseExited, mouseHovered, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved, registerMouseListeners, removeListener, setNotifyListeners, setProperty, setSelectionProvider
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.refractions.udig.project.ui.tool.ModalTool
getSelectionProvider, setSelectionProvider
 
Methods inherited from interface net.refractions.udig.project.ui.tool.Tool
addListener, dispose, getContext, getProperty, isEnabled, removeListener, setProperty
 

Constructor Detail

AbstractModalTool

public AbstractModalTool()
By default SimpleTool will simply respond to MOUSE.

To respond to additional stimulus please override your constuctor to call AbstractModalTool( targets ):


 public class MyTool extends AbstractModalTool {
      public MyTool(){ // default consturctor called by extention point
          super( MOUSE | WHEEL );
      }
      ...
 }
 


AbstractModalTool

public AbstractModalTool(int targets)
Creates an new instance of AbstractModalTool

See Also:
AbstractTool.AbstractTool(int)
Method Detail

setActive

public void setActive(boolean active)
Description copied from interface: ModalTool
Called when tool button is pressed. If active is set to true the tool is Registered with the source Component so that it receives events and will begin operating If active is set to false the tool is set as inactive and deregistered with the component.

Specified by:
setActive in interface ModalTool
Parameters:
active - if true the tool is Registered with the source Component so that it receives events and will begin operating. if false the tool is set as inactive and deregistered with the component.

isActive

public boolean isActive()
Description copied from interface: ModalTool
Returns true if the current tool is active.

Specified by:
isActive in interface ModalTool
Returns:

setContext

public void setContext(IToolContext context)
Description copied from class: AbstractTool
Called each time an eclipse editor is activated. The RenderManager and ViewportPane are those that are associated with the newly actived Eclipse view. Intended to be used if something other just changing the current state happens. if false the tool is set as inactive and deregistered with the component. This method does not need to be overridden by subclasses normally.

Specified by:
setContext in interface Tool
Overrides:
setContext in class AbstractTool
Parameters:
context - The tools that the tool can use in its operations
See Also:
AbstractTool.setContext(net.refractions.udig.project.ui.tool.IToolContext)

getCursorID

public final java.lang.String getCursorID()
(non-Javadoc)

Specified by:
getCursorID in interface ModalTool
Returns:
See Also:
ModalTool.getCursorID()

setCursorID

public final void setCursorID(java.lang.String id)
(non-Javadoc)

Specified by:
setCursorID in interface ModalTool
Parameters:
id - the cursor ID from net.refractions.udig.project.ui.tool.toolCursor extension or the constant from ModalTool interface.
See Also:
ModalTool.setCursorID(java.lang.String)

setEnabled

public void setEnabled(boolean enabled)
(non-Javadoc)

Specified by:
setEnabled in interface Tool
Overrides:
setEnabled in class AbstractTool
See Also:
Tool.setEnabled(boolean)