|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.refractions.udig.tools.edit.EditToolHandler
public class EditToolHandler
This is the class that does all the work. An Edit tool adds Mode objects to the EditToolHandler. Each Mode has attributes that indicate whether it is valid.
Field Summary | |
---|---|
static java.lang.String |
CURRENT_SHAPE
The key for the currently selected/edit shape. |
Cursor |
editCursor
Cursor that should be set when editing can occur. |
static java.lang.String |
EDITSTATE
The key for the currently selected/edit state. |
Cursor |
selectionCursor
Cursor that should be set when a selection can occur. |
static java.lang.String |
STORED_CURRENT_SHAPE
When there is a switch in the currently selected layer the current shape is stored on the old layer so if the layer selected layer the state can be restored. |
static java.lang.String |
STORED_CURRENT_STATE
When there is a switch in the currently selected layer the current state is stored on the old layer so if the layer selected layer the state can be restored. |
protected boolean |
testing
|
protected AbstractEditTool |
tool
|
Constructor Summary | |
---|---|
EditToolHandler(Cursor selectionCursor,
Cursor editCursor)
|
Method Summary | |
---|---|
java.util.List<Behaviour> |
getAcceptBehaviours()
Returns the list of behaviours that are run when the Enter key is pressed. |
java.util.Set<Activator> |
getActivators()
Returns the Activators that are run during activation and deactivation This list is thread safe and may be modified. |
java.util.List<EventBehaviour> |
getBehaviours()
Returns the EventBehaviours that may be run when an event occurs. |
java.util.List<Behaviour> |
getCancelBehaviours()
Returns the list of behaviours that are run when the Esc key is pressed. |
BehaviourCommand |
getCommand(java.util.List<Behaviour> list)
Runs a list of behaviours. |
IToolContext |
getContext()
Gets the tool context object that Modes and Activators may use. |
EditGeom |
getCurrentGeom()
|
PrimitiveShape |
getCurrentShape()
|
EditState |
getCurrentState()
|
java.util.List<IDrawCommand> |
getDrawCommands()
Returns the draw actions that need to be deactivated when the tool is deactivated. |
EditBlackboard |
getEditBlackboard(ILayer layer)
Gets the EditBlackboard of the map. |
ILayer |
getEditLayer()
Returns the currently selected layer, or if the EditManager is locked, it will return the edit layer. |
java.util.List<EnablementBehaviour> |
getEnablementBehaviours()
Returns the behaviours that determine whether the tool is active at the current locations |
MouseTracker |
getMouseTracker()
|
AbstractEditTool |
getTool()
|
protected void |
handleEvent(MapMouseEvent e,
EventType eventType)
Runs through the list of modes and runs all the modes that are valid in the current context. |
boolean |
isLocked()
Returns true if Handler has been locked by lock(LockingBehaviour) |
boolean |
isLockOwner(LockingBehaviour behaviour)
Returns true if the behaviour's LockingBehaviour.getKey(EditToolHandler) returns the
key for the lock. |
void |
lock(LockingBehaviour behaviour)
Locks the handler so only the only behaviours that can run are LockingBehaviour s
who's LockingBehaviour.getKey(EditToolHandler) method returns the same object as the
locking LockingBehaviour 's LockingBehaviour.getKey(EditToolHandler) method. |
void |
repaint()
All behaviours and listeners should call this method so that only one redraw is done per mouse event. |
protected void |
setActive(boolean active)
Called by AbstractEditTool when activated. |
protected void |
setContext(IToolContext context2)
|
void |
setCurrentShape(PrimitiveShape currentShape)
|
void |
setCurrentState(EditState currentState)
|
void |
setCursor(int cursor_id)
Deprecated. |
void |
setCursor(java.lang.String cursorID)
The method gets ID of the cursor as configured by extension or by ModalTool.*_CURSOR value corresponding to SWT.CURSOR_* constants
and delegates the call to ModalTool to find the cursor
in cache and set it. |
void |
setTool(AbstractEditTool tool)
|
java.lang.String |
toString()
|
void |
unlock(LockingBehaviour behaviour)
Unlocks the handler so all behaviours can run. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String EDITSTATE
getContext()
)
public static final java.lang.String CURRENT_SHAPE
getContext()
)
public static final java.lang.String STORED_CURRENT_STATE
Modify with Care this is primarily used by the framework for its workflow but if the workflow is not pleasing then modification is permitted.
public static final java.lang.String STORED_CURRENT_SHAPE
Modify with Care this is primarily used by the framework for its workflow but if the workflow is not pleasing then modification is permitted.
public final Cursor selectionCursor
public final Cursor editCursor
protected boolean testing
protected AbstractEditTool tool
Constructor Detail |
---|
public EditToolHandler(Cursor selectionCursor, Cursor editCursor)
Method Detail |
---|
protected void setActive(boolean active)
active
- public BehaviourCommand getCommand(java.util.List<Behaviour> list)
list
- protected void handleEvent(MapMouseEvent e, EventType eventType)
e
- mouse event that just occurred.eventType
- the type of event that just occurredpublic EditGeom getCurrentGeom()
public void setCurrentShape(PrimitiveShape currentShape)
public PrimitiveShape getCurrentShape()
public EditState getCurrentState()
public void setCurrentState(EditState currentState)
currentState
- The currentState to set.public java.util.List<EventBehaviour> getBehaviours()
public java.util.List<EnablementBehaviour> getEnablementBehaviours()
public EditBlackboard getEditBlackboard(ILayer layer)
public ILayer getEditLayer()
public java.util.Set<Activator> getActivators()
public java.util.List<IDrawCommand> getDrawCommands()
This list is thread safe and may be modified.
public IToolContext getContext()
protected void setContext(IToolContext context2)
context2
- The context to set.public void setCursor(int cursor_id)
cursor_id
- the SWT.CURSOR_XXX id of the cursor to set.public void setCursor(java.lang.String cursorID)
ModalTool.*_CURSOR
value corresponding to SWT.CURSOR_* constants
and delegates the call to ModalTool
to find the cursor
in cache and set it.
cursorID
- public MouseTracker getMouseTracker()
public java.util.List<Behaviour> getAcceptBehaviours()
public java.util.List<Behaviour> getCancelBehaviours()
getCommand(List)
public void lock(LockingBehaviour behaviour)
LockingBehaviour
s
who's LockingBehaviour.getKey(EditToolHandler)
method returns the same object as the
locking LockingBehaviour
's LockingBehaviour.getKey(EditToolHandler)
method.
This is not a reentrant lock so it cannot be locked multiple times. Also the lock cannot be null
behaviour
- the behaviour that is locking the handlerpublic boolean isLocked()
lock(LockingBehaviour)
lock(LockingBehaviour)
public void unlock(LockingBehaviour behaviour)
LockingBehaviour.getKey(EditToolHandler)
method must return the same object as the
locking behaviours LockingBehaviour.getKey(EditToolHandler)
method.
behaviour
- public boolean isLockOwner(LockingBehaviour behaviour)
LockingBehaviour.getKey(EditToolHandler)
returns the
key for the lock.
behaviour
- the behaviour to test
LockingBehaviour.getKey(EditToolHandler)
returns the key for the lock.public java.lang.String toString()
toString
in class java.lang.Object
public void repaint()
public void setTool(AbstractEditTool tool)
public AbstractEditTool getTool()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |