public abstract class ALspObjectTranslationHandle extends ALsp3StepEditHandle
point drag handle
, except that it works on objects instead
of points.
This handle has two translate modes: either by dragging the mouse, or by moving it in between
two clicks. See setTranslateOnDrag
. When true
,
the handle is activated/deactivated using mouse press and release events and changed using mouse
dragged events. Otherwise, the handle is activated/deactivated using mouse clicks and changed
by moving the mouse when active.
When using touch events, this handle is activated on DOWN
events, processes
MOVED
events, and is deactivated on UP
events.
This handle can be used for all kinds of purposes, like moving a whole object, or adjusting the
height of an object.PRIORITY_2D_CONTOUR, PRIORITY_2D_POINT, PRIORITY_2D_SHAPE, PRIORITY_3D_CONTOUR, PRIORITY_3D_POINT, PRIORITY_3D_SHAPE, PRIORITY_MULTIPLE_SHAPES
Modifier | Constructor and Description |
---|---|
protected |
ALspObjectTranslationHandle(Object aDomainObject)
Creates a new touch handle for the given editor.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
canActivate(AWTEvent aEvent,
TLspEditContext aEditContext)
Checks whether the handle can be activated.
|
protected boolean |
canActivate(javafx.event.Event aEvent,
TLspEditContext aEditContext)
JavaFX equivalent of
canActivate(AWTEvent, TLspEditContext) . |
protected boolean |
canDeactivate(AWTEvent aEvent,
TLspEditContext aEditContext)
Checks whether the handle can be deactivated.
|
protected boolean |
canDeactivate(javafx.event.Event aEvent,
TLspEditContext aEditContext)
JavaFX equivalent of
canDeactivate(AWTEvent, TLspEditContext) . |
protected boolean |
canProcess(AWTEvent aEvent,
TLspEditContext aEditContext)
Checks whether the given event should be processed.
|
protected boolean |
canProcess(javafx.event.Event aEvent,
TLspEditContext aEditContext)
JavaFX equivalent of
canProcess(AWTEvent, TLspEditContext) . |
protected boolean |
isObjectTouched(int aX,
int aY,
TLspEditContext aEditContext)
Returns whether the edited object is touched.
|
boolean |
isTranslateOnDrag()
Returns if this handle is translated when dragging the mouse, or when moving it.
|
protected TLspEditHandleResult |
onActivate(AWTEvent aEvent,
TLspEditContext aEditContext)
Called when this handle is activated (after
canActivate has returned
true . |
protected TLspEditHandleResultFX |
onActivate(javafx.event.Event aEvent,
TLspEditContext aEditContext)
JavaFX equivalent of
onActivate(AWTEvent, TLspEditContext) . |
protected TLspEditHandleResult |
onDeactivate(AWTEvent aEvent,
TLspEditContext aEditContext)
Performs some action with the event after the handle is deactivated.
|
protected TLspEditHandleResultFX |
onDeactivate(javafx.event.Event aEvent,
TLspEditContext aEditContext)
JavaFX equivalent of
onDeactivate(AWTEvent, TLspEditContext) . |
boolean |
requestsFocus(AWTEvent aEvent,
TLspEditContext aEditContext)
Indicates whether this handle requests focus for the given event.
|
boolean |
requestsFocus(javafx.event.Event aEvent,
TLspEditContext aEditContext)
JavaFX equivalent of
requestsFocus(AWTEvent, TLspEditContext) . |
void |
setTranslateOnDrag(boolean aIsTranslateOnDrag)
Sets if this handle is translated when dragging the mouse, or when moving it.
|
handleAWTEvent, handleFXEvent, isActive, process, process
getGeometry
getCursor, getCursorFX, getPriority, getProperties, getStyleTargetProviders, setCursor, setCursorFX, setPriority
protected ALspObjectTranslationHandle(Object aDomainObject)
aDomainObject
- the object this handle was created forpublic boolean isTranslateOnDrag()
setTranslateOnDrag(boolean)
public void setTranslateOnDrag(boolean aIsTranslateOnDrag)
true
,
the handle is activated using a MOUSE_PRESSED
event, translated using a
MOUSE_DRAGGED
event, and deactivated using a MOUSE_RELEASED
event.
If false
, this handle is activate using a MOUSE_RELEASED
event,
translated using a MOUSE_MOVED
event, and deactivated using a MOUSE_RELEASED
event.
When using touch events, the only difference is that when this setting is set to false
,
this handle doesn't need a DOWN
event to be activated.
This setting is typically set to true
during editing, and to false
during creation.
By default, isTranslateOnDrag
returns true
aIsTranslateOnDrag
- if this handle is translated when dragging the mouse, or when moving it.protected boolean isObjectTouched(int aX, int aY, TLspEditContext aEditContext)
aX
- the x coordinate in the viewaY
- the y coordinate in the viewaEditContext
- the edit contexttrue
if the object is touchedpublic boolean requestsFocus(AWTEvent aEvent, TLspEditContext aEditContext)
handleAWTEvent
. However, this is not ensured, because another handle may have precedence
over this handle and also request focus. Precedence is primarily determined by the
handle priority
.
The default implementation returns true
if the handle is active. Subclasses can override
this method for custom behavior. An example would be to request focus when the mouse hovers over
a visual handle component.
true
when this handle is active, or if the
edited object is touched.requestsFocus
in class ALspEditHandle
aEvent
- the AWTEvent that might result in a focus requestaEditContext
- the edit context, containing, amongst others, information about
the layer for which this handle is operating, the view, the object
for which this handle was created, the geometry that this
handle was created for, the paint representation in which geometry exists,
and the sensitivity with which the event should be handledtrue
if this handle requests focus for the given event, false
otherwise.ALspHandle.isActive()
,
ALspEditHandle.handleAWTEvent(java.awt.AWTEvent, com.luciad.view.lightspeed.editor.TLspEditContext)
public boolean requestsFocus(javafx.event.Event aEvent, TLspEditContext aEditContext)
requestsFocus(AWTEvent, TLspEditContext)
.requestsFocus
in class ALspEditHandle
aEvent
- the AWTEvent that might result in a focus requestaEditContext
- the edit context, containing, amongst others, information about
the layer for which this handle is operating, the view, the object
for which this handle was created, the geometry that this
handle was created for, the paint representation in which geometry exists,
and the sensitivity with which the event should be handledtrue
if this handle requests focus for the given event, false
otherwise.protected boolean canActivate(AWTEvent aEvent, TLspEditContext aEditContext)
true
, isActive
will return true
and onActivate
is called next.
By default, this method returns true
when the input event is a mouse pressed/click
event (depending on the translation mode, and when the object is touched
as indicated by isObjectTouched
.canActivate
in class ALsp3StepEditHandle
aEvent
- the event that should be handledaEditContext
- the edit contexttrue
if the handle should be activated as a result of the given event,
false
otherwiseALspEditHandle.handleAWTEvent(java.awt.AWTEvent, com.luciad.view.lightspeed.editor.TLspEditContext)
,
ALsp3StepEditHandle.onActivate(java.awt.AWTEvent, com.luciad.view.lightspeed.editor.TLspEditContext)
protected boolean canActivate(javafx.event.Event aEvent, TLspEditContext aEditContext)
canActivate(AWTEvent, TLspEditContext)
.canActivate
in class ALsp3StepEditHandle
aEvent
- the event that should be handledaEditContext
- the edit contexttrue
if the handle should be activated as a result of the given event,
false
otherwiseprotected boolean canDeactivate(AWTEvent aEvent, TLspEditContext aEditContext)
true
,
isActive
will return false
and onDeactivate
is called next.
By default, this method returns true
when the input event is a mouse release/click
event (depending on the translation mode).canDeactivate
in class ALsp3StepEditHandle
aEvent
- the event that should be handledaEditContext
- the edit contexttrue
if the handle should be deactivated as a result of the given event,
false
otherwiseALspEditHandle.handleAWTEvent(java.awt.AWTEvent, com.luciad.view.lightspeed.editor.TLspEditContext)
,
ALsp3StepEditHandle.onDeactivate(java.awt.AWTEvent, com.luciad.view.lightspeed.editor.TLspEditContext)
protected boolean canDeactivate(javafx.event.Event aEvent, TLspEditContext aEditContext)
canDeactivate(AWTEvent, TLspEditContext)
.canDeactivate
in class ALsp3StepEditHandle
aEvent
- the event that should be handledaEditContext
- the edit contexttrue
if the handle should be deactivated as a result of the given event,
false
otherwiseprotected boolean canProcess(AWTEvent aEvent, TLspEditContext aEditContext)
true
,
process
is called next.
By default, this method returns true
if a mouse drag/move happened
(depending on the translation mode).canProcess
in class ALsp3StepEditHandle
aEvent
- the event that should be handledaEditContext
- the edit contexttrue
if the handle should process this event, false
otherwise.ALspEditHandle.handleAWTEvent(java.awt.AWTEvent, com.luciad.view.lightspeed.editor.TLspEditContext)
,
ALsp3StepEditHandle.process(java.awt.AWTEvent, com.luciad.view.lightspeed.editor.TLspEditContext)
protected boolean canProcess(javafx.event.Event aEvent, TLspEditContext aEditContext)
canProcess(AWTEvent, TLspEditContext)
.canProcess
in class ALsp3StepEditHandle
aEvent
- the event that should be handledaEditContext
- the edit contexttrue
if the handle should process this event, false
otherwise.protected TLspEditHandleResult onActivate(AWTEvent aEvent, TLspEditContext aEditContext)
canActivate
has returned
true
.
By default, this method returns a edit handle result without operations and interaction status
IN_PROGRESS
.
Override this method to provide custom behavior. In that case, also make sure to call the
super method.onActivate
in class ALsp3StepEditHandle
aEvent
- the event that caused the handle to be activatedaEditContext
- the edit contextnull
.ALspEditHandle.handleAWTEvent(java.awt.AWTEvent, com.luciad.view.lightspeed.editor.TLspEditContext)
,
ALsp3StepEditHandle.canActivate(java.awt.AWTEvent, com.luciad.view.lightspeed.editor.TLspEditContext)
protected TLspEditHandleResultFX onActivate(javafx.event.Event aEvent, TLspEditContext aEditContext)
onActivate(AWTEvent, TLspEditContext)
.onActivate
in class ALsp3StepEditHandle
aEvent
- the event that caused the handle to be activatedaEditContext
- the edit contextnull
.protected TLspEditHandleResult onDeactivate(AWTEvent aEvent, TLspEditContext aEditContext)
FINISHED
.
Override this method to provide custom behavior. In that case, also make sure to call the
super method.onDeactivate
in class ALsp3StepEditHandle
aEvent
- the event that caused the handle to be deactivatedaEditContext
- the edit contextnull
.ALspEditHandle.handleAWTEvent(java.awt.AWTEvent, com.luciad.view.lightspeed.editor.TLspEditContext)
,
ALsp3StepEditHandle.canDeactivate(java.awt.AWTEvent, com.luciad.view.lightspeed.editor.TLspEditContext)
protected TLspEditHandleResultFX onDeactivate(javafx.event.Event aEvent, TLspEditContext aEditContext)
onDeactivate(AWTEvent, TLspEditContext)
.onDeactivate
in class ALsp3StepEditHandle
aEvent
- the event that caused the handle to be deactivatedaEditContext
- the edit contextnull
.