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

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

public class AcceptBehaviour
extends java.lang.Object
implements EventBehaviour

Requirements:

Action:

Since:
1.1.0
Author:
jones

Constructor Summary
AcceptBehaviour()
           
 
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

AcceptBehaviour

public AcceptBehaviour()
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();