net.refractions.udig.tools.edit.behaviour
Class CursorControlBehaviour

java.lang.Object
  extended by net.refractions.udig.tools.edit.behaviour.CursorControlBehaviour
All Implemented Interfaces:
EventBehaviour

public class CursorControlBehaviour
extends java.lang.Object
implements EventBehaviour

Sets the cursor to indicate what action can be done. Also adds tips to the status bar.

Since:
1.1.0
Author:
Jesse

Nested Class Summary
static class CursorControlBehaviour.DefaultCursorProvider
           
static class CursorControlBehaviour.NullStringProvider
           
static class CursorControlBehaviour.SystemCursorProvider
           
 
Constructor Summary
CursorControlBehaviour(EditToolHandler handler,  defaultMessage,  overVertexCursor,  overVertexMessage,  overEdgeCursor,  overEdgeMessage)
          new instance
 
Method Summary
 UndoableMapCommand getCommand(EditToolHandler handler, MapMouseEvent e, EventType eventType)
          The action to be performed by this EventBehaviour.
 void handleError(EditToolHandler handler, java.lang.Throwable error, UndoableMapCommand command)
          This method is called if an exception occurs during the execution of the run method.
 boolean isValid(EditToolHandler handler, MapMouseEvent e, EventType eventType)
          Called to determine whether this EventBehaviour is applicable and should be run.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CursorControlBehaviour

public CursorControlBehaviour(EditToolHandler handler,
                               defaultMessage,
                               overVertexCursor,
                               overVertexMessage,
                               overEdgeCursor,
                               overEdgeMessage)
new instance

Parameters:
defaultMessage - the message display when not over a vertex or an edge.
overVertexCursor - a provider that provides the cursor to show when over a vertex. This class WILL NOT dispose of the cursor.
overVertexMessage - generates the message to display when over a vertex
overEdgeCursor - a provider that provides the cursor to show when over an edge. This class WILL NOT dispose of the cursor.
overEdgeMessage - generates the message to display when over an edge
Method Detail

isValid

public boolean isValid(EditToolHandler handler,
                       MapMouseEvent e,
                       EventType eventType)
Description copied from interface: EventBehaviour
Called to determine whether this EventBehaviour is applicable and should be run.

Specified by:
isValid in interface EventBehaviour
Parameters:
handler - handler that calls this Behaviour
e - mouse event that just occurred.
eventType - the type of event that just occurred
Returns:
true if this mode is applicable and should be run.

getCommand

public UndoableMapCommand getCommand(EditToolHandler handler,
                                     MapMouseEvent e,
                                     EventType eventType)
Description copied from interface: EventBehaviour
The action to be performed by this EventBehaviour. This action takes place in the event thread so it must perform VERY quickly.

Specified by:
getCommand in interface EventBehaviour
Parameters:
handler - handler that calls this Behaviour
e - Event that occurred.
eventType - The type of event that has occurred
Returns:
Command that will be executed in order to perform the behaviour

handleError

public void handleError(EditToolHandler handler,
                        java.lang.Throwable error,
                        UndoableMapCommand command)
Description copied from interface: EventBehaviour
This method is called if an exception occurs during the execution of the run method.

This method should

  1. Rollback the changes made during the run method
  2. Log the error in the plugin's log

Specified by:
handleError in interface EventBehaviour
Parameters:
handler - handler that calls this Behaviour
error - Error that occurred
command - Command retrieved from getCommandMethod. May be null if exception occurred while executing getCommand();