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

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

public class WriteChangesBehaviour
extends java.lang.Object
implements Behaviour

Creates a geometry from the currentGeom in the EditToolHandler.

Requirements:

Action:

Since:
1.1.0
Author:
jones

Constructor Summary
WriteChangesBehaviour(java.lang.Class<? extends Geometry> geomToCreate)
           
 
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.
 void setUpdateBlackboard(boolean updateBlackboard)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WriteChangesBehaviour

public WriteChangesBehaviour(java.lang.Class<? extends Geometry> geomToCreate)
Parameters:
geomToCreate - must be polygon, point, multipoint, linestring or linearring
Method Detail

isValid

public boolean isValid(EditToolHandler handler)
Description copied from interface: Behaviour
Called to determine whether this Behaviour is applicable and should be run.

Specified by:
isValid in interface Behaviour
Parameters:
handler - handler that calls this Behaviour
Returns:
true if this mode is applicable and should be run.

getCommand

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

Specified by:
getCommand in interface Behaviour
Parameters:
handler - handler that calls this Behaviour
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: Behaviour
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 Behaviour
error - Error that occurred
command - Command retrieved from getCommandMethod. May be null if exception occurred while executing getCommand();

setUpdateBlackboard

public void setUpdateBlackboard(boolean updateBlackboard)
Parameters:
updateBlackboard - The updateBlackboard to set.