net.refractions.udig.tools.edit
Class AbstractEditTool

java.lang.Object
  extended by SimpleTool
      extended by net.refractions.udig.tools.edit.AbstractEditTool

public abstract class AbstractEditTool
extends SimpleTool

Super class for edit tools. This class delegates to the EditToolHandler which must be initialized by the subclass during construction.

Since:
1.1.0
Author:
jones

Field Summary
protected  EditToolHandler handler
           
 
Constructor Summary
AbstractEditTool()
           
 
Method Summary
protected abstract  java.lang.String getExtensionID()
          Returns the ID of the tool as declared in the plugin.xml.
 EditToolHandler getHandler()
           
protected abstract  void initAcceptBehaviours(java.util.List<Behaviour> acceptBehaviours)
          Initializes the list of Behaviours to run when the current edit has been accepted.
protected abstract  void initActivators(java.util.Set<Activator> activators)
          Initializes the list of Activators that are ran when the tool is activated and deactivated.
protected abstract  void initCancelBehaviours(java.util.List<Behaviour> cancelBehaviours)
          Initializes the behaviours that are ran when a cancel signal is received (the ESC key).
protected abstract  void initEnablementBehaviours(java.util.List<EnablementBehaviour> enablementBehaviours)
          Initializes the list of EnablementBehaviours that are ran to determine if the tool is enabled given an event.
protected abstract  void initEventBehaviours(EditToolConfigurationHelper helper)
          Initializes the Event Behaviours that are run when an event occurs.
protected  void onMouseDoubleClicked(MapMouseEvent e)
           
protected  void onMouseDragged(MapMouseEvent e)
           
protected  void onMouseEntered(MapMouseEvent e)
           
protected  void onMouseExited(MapMouseEvent e)
           
protected  void onMouseHovered(MapMouseEvent e)
           
protected  void onMouseMoved(MapMouseEvent e)
           
protected  void onMousePressed(MapMouseEvent e)
           
protected  void onMouseReleased(MapMouseEvent e)
           
protected  void onMouseWheelMoved(MapMouseWheelEvent e)
           
 void setActive(boolean active)
           
 void setContext(IToolContext context)
           
 void setHandler(EditToolHandler handler)
           
 void testinitAcceptBehaviours(java.util.List<Behaviour> acceptBehaviours)
          Called only by unit tests.
 void testinitActivators(java.util.Set<Activator> activators)
          Called only by unit tests.
 void testinitCancelBehaviours(java.util.List<Behaviour> cancelBehaviours)
          Called only by unit tests.
 void testinitEventBehaviours(EditToolConfigurationHelper helper)
          Called only by unit tests.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

handler

protected EditToolHandler handler
Constructor Detail

AbstractEditTool

public AbstractEditTool()
Method Detail

initActivators

protected abstract void initActivators(java.util.Set<Activator> activators)
Initializes the list of Activators that are ran when the tool is activated and deactivated.

Parameters:
activators - an empty list.

initAcceptBehaviours

protected abstract void initAcceptBehaviours(java.util.List<Behaviour> acceptBehaviours)
Initializes the list of Behaviours to run when the current edit has been accepted. Acceptance is signalled by a double click or the Enter key

Parameters:
acceptBehaviours - an empty list

initCancelBehaviours

protected abstract void initCancelBehaviours(java.util.List<Behaviour> cancelBehaviours)
Initializes the behaviours that are ran when a cancel signal is received (the ESC key).

Parameters:
cancelBehaviours - an empty list

initEventBehaviours

protected abstract void initEventBehaviours(EditToolConfigurationHelper helper)
Initializes the Event Behaviours that are run when an event occurs. Since this can be complex a helper class is provided to build the complex datastructure of Behaviours.

Parameters:
helper - a helper for constructing the complicated structure of EventBehaviours.
See Also:
EditToolConfigurationHelper

initEnablementBehaviours

protected abstract void initEnablementBehaviours(java.util.List<EnablementBehaviour> enablementBehaviours)
Initializes the list of EnablementBehaviours that are ran to determine if the tool is enabled given an event. For example if the mouse cursor is outside the valid bounds of a CRS for a layer an EnablementBehaviour might signal that editing is illegal and provide a message for the user indicating why.

Parameters:
enablementBehaviours - an empty list

testinitActivators

public void testinitActivators(java.util.Set<Activator> activators)
Called only by unit tests. Has no effect on state of tool.


testinitAcceptBehaviours

public void testinitAcceptBehaviours(java.util.List<Behaviour> acceptBehaviours)
Called only by unit tests. Has no effect on state of tool.


testinitCancelBehaviours

public void testinitCancelBehaviours(java.util.List<Behaviour> cancelBehaviours)
Called only by unit tests. Has no effect on state of tool.


testinitEventBehaviours

public void testinitEventBehaviours(EditToolConfigurationHelper helper)
Called only by unit tests. Has no effect on state of tool.


getExtensionID

protected abstract java.lang.String getExtensionID()
Returns the ID of the tool as declared in the plugin.xml. The plugin's id must be appended to the id. For example if the id of the tool is "polygon" and the id of the containing plugin is "net.refractions.udig.tool" then the id this method will return is "net.refractions.udig.tool.polygon"

Returns:
the ID of the tool as declared in the plugin.xml

setContext

public void setContext(IToolContext context)

setActive

public void setActive(boolean active)

onMouseDoubleClicked

protected void onMouseDoubleClicked(MapMouseEvent e)

onMouseDragged

protected void onMouseDragged(MapMouseEvent e)

onMouseEntered

protected void onMouseEntered(MapMouseEvent e)

onMouseExited

protected void onMouseExited(MapMouseEvent e)

onMouseMoved

protected void onMouseMoved(MapMouseEvent e)

onMousePressed

protected void onMousePressed(MapMouseEvent e)

onMouseReleased

protected void onMouseReleased(MapMouseEvent e)

onMouseWheelMoved

protected void onMouseWheelMoved(MapMouseWheelEvent e)

onMouseHovered

protected void onMouseHovered(MapMouseEvent e)

getHandler

public EditToolHandler getHandler()
Returns:
Returns the handler.

setHandler

public void setHandler(EditToolHandler handler)
Parameters:
handler - The handler to set.