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

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

public class SelectionBoxBehaviour
extends java.lang.Object
implements LockingBehaviour

Requirements:

Action:

Since:
1.1.0
Author:
jones

Constructor Summary
SelectionBoxBehaviour()
           
 
Method Summary
 UndoableMapCommand getCommand(EditToolHandler handler, MapMouseEvent e, EventType eventType)
          The action to be performed by this EventBehaviour.
 java.lang.Object getKey(EditToolHandler handler)
          If the object returned by getKey() is the same as the object that the EditToolHandler has as its lock this object may unlock the EditToolHandler and is also permitted to run.
 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

SelectionBoxBehaviour

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

getKey

public java.lang.Object getKey(EditToolHandler handler)
Description copied from interface: LockingBehaviour
If the object returned by getKey() is the same as the object that the EditToolHandler has as its lock this object may unlock the EditToolHandler and is also permitted to run.

Specified by:
getKey in interface LockingBehaviour
Parameters:
handler - handler that is calling getKey.
Returns:
the object that this behaviour uses as a key.