net.refractions.udig.tools.edit
Interface LockingBehaviour

All Superinterfaces:
EventBehaviour
All Known Implementing Classes:
AdvancedFeaturesEventBehavior, FreeHandPolygonDrawBehaviour, MoveGeometryBehaviour, MoveVertexBehaviour, MoveVertexBehaviour.PositionTracker, MutualExclusiveEventBehavior, OrderedCompositeEventBehavior, SelectionBoxBehaviour, ShapeCreationBehaviour

public interface LockingBehaviour
extends EventBehaviour

An extension interface allowing an EventBehaviour to Lock the tool handler.

Certain types of events need to be able to "lock" the tool handler so that it is the only event getting events until it "unlocks" the tool handler.

Example:

The Polygon tool has a BoxSelection behaviour that accepts drag events and draws a rectangle until the mouse is released (at that point it selects the vertices that are with the box).

The Polygon tool also has a move geometry behaviour that moves the geometry when the mouse is dragged over an EditGeom.

Given these two behaviours the following case can occur: The mouse is pressed (not over a geometry) and the BoxSelection behaviour starts drawing the selection box. The mouse drags over a Geometry and the MoveGeometry behaviour starts as well.

One solution is to put both behaviours in a MutualExclusiveEventBehavior so that if the BoxSelection behaviour is running then the MoveGeometryBehaviour won't. However if the MoveGeometryBehaviour starts then the BoxSelection behaviour may as well.

Since:
1.1.0
Author:
jones

Method Summary
 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.
 
Methods inherited from interface net.refractions.udig.tools.edit.EventBehaviour
getCommand, handleError, isValid
 

Method Detail

getKey

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.

Parameters:
handler - handler that is calling getKey.
Returns:
the object that this behaviour uses as a key.