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

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

public class SelectGeometryBehaviour
extends java.lang.Object
implements EventBehaviour

Requirements:

Action:

Since:
1.1.0
Author:
jones

Constructor Summary
SelectGeometryBehaviour(java.lang.Class[] acceptableClasses, short filterType)
          Create instance
 
Method Summary
 java.lang.Class[] getAcceptableClasses()
           
 UndoableMapCommand getCommand(EditToolHandler handler, MapMouseEvent e, EventType eventType)
          The action to be performed by this EventBehaviour.
 short getFilterType()
           
 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 isOnlyAdd()
           
 boolean isPermitClear()
           
 boolean isTreatUnknownGeomsAsPolygon()
           
 boolean isValid(EditToolHandler handler, MapMouseEvent e, EventType eventType)
          Called to determine whether this EventBehaviour is applicable and should be run.
 void setAcceptableClasses(java.lang.Class[] acceptableClasses)
           
 void setCreateGeomOnNoneSelect(ShapeType toCreate2)
           
 void setFilterType(short filterType)
           
 void setOnlyAdd(boolean onlyAdd)
           
 void setPermitClear(boolean permitClear)
           
 void setTreatUnknownGeomsAsPolygon(boolean treatUnknownGeomsAsPolygon)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectGeometryBehaviour

public SelectGeometryBehaviour(java.lang.Class[] acceptableClasses,
                               short filterType)
Create instance

Parameters:
acceptableClasses - used to determine if a feature can be selected. If point is not in array then point geometries can not be selected.
filterType - one of the constants in FilterType that start with GEOMETRY_
Method Detail

setCreateGeomOnNoneSelect

public void setCreateGeomOnNoneSelect(ShapeType toCreate2)

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

getAcceptableClasses

public java.lang.Class[] getAcceptableClasses()
Returns:
Returns the acceptableClasses.

setAcceptableClasses

public void setAcceptableClasses(java.lang.Class[] acceptableClasses)
Parameters:
acceptableClasses - The acceptableClasses to set.

getFilterType

public short getFilterType()
Returns:
Returns the filterType.

setFilterType

public void setFilterType(short filterType)
Parameters:
filterType - The filterType to set.

isOnlyAdd

public boolean isOnlyAdd()
Returns:
Returns the onlyAdd.

setOnlyAdd

public void setOnlyAdd(boolean onlyAdd)
Parameters:
onlyAdd - The onlyAdd to set.

isPermitClear

public boolean isPermitClear()
Returns:
Returns the permitClear.

setPermitClear

public void setPermitClear(boolean permitClear)
Parameters:
permitClear - The permitClear to set.

isTreatUnknownGeomsAsPolygon

public boolean isTreatUnknownGeomsAsPolygon()
Returns:
Returns the treatUnkownGeomsAsPolygon.

setTreatUnknownGeomsAsPolygon

public void setTreatUnknownGeomsAsPolygon(boolean treatUnknownGeomsAsPolygon)
Parameters:
treatUnknownGeomsAsPolygon - The treatUnknownGeomsAsPolygon to set.