net.refractions.udig.tools.edit
Interface Behaviour

All Known Implementing Classes:
DefaultCancelBehaviour, DeselectEditShapeAcceptBehaviour, DifferenceFeatureAcceptor, MutualExclusiveBehavior, RefreshLayersBehaviour, SplitGeometryBehaviour, WriteChangesBehaviour

public interface Behaviour

This is a Stategy object for the (@link net.refractions.udig.tools.edit.latest.EditToolHandler} behaviour. Each Behaviour is valid in a particular context and will be run by the (@link net.refractions.udig.tools.edit.latest.EditToolHandler} if the isValid method returns true.

Since:
1.1.0
Author:
jones

Method Summary
 UndoableMapCommand getCommand(EditToolHandler handler)
          The action to be performed by this Behaviour.
 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)
          Called to determine whether this Behaviour is applicable and should be run.
 

Method Detail

isValid

boolean isValid(EditToolHandler handler)
Called to determine whether this Behaviour is applicable and should be run.

Parameters:
handler - handler that calls this Behaviour
Returns:
true if this mode is applicable and should be run.

getCommand

UndoableMapCommand getCommand(EditToolHandler handler)
The action to be performed by this Behaviour. This action takes place in the event thread so it must perform quickly.

Parameters:
handler - handler that calls this Behaviour
Returns:
Command that will be executed in order to perform the behaviour

handleError

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.

This method should:

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

Parameters:
error - Error that occurred
command - Command retrieved from getCommandMethod. May be null if exception occurred while executing getCommand();