public abstract class ALspEditHandle extends ALspHandle
ILspEditor
is responsible
for providing the appropriate handles for a particular object. A handle should be able to
capture user input from the handleAWTEvent
method (mouse, keyboard, ...)
and convert it into an edit handle result, containing zero
or more edit operations.
An edit handle can have focus. The edit controller can respond to this
by forwarding event objects to this handle by calling handleAWTEvent
. At the
same time, the handle can be visualized differently, and the handle's cursor can be shown to indicate that the handle can be used to interact with.
Each handle generally corresponds to the geometry of an object for which the handle will generate
edit operations. As an example, an editor might edit a four-sided polygon with five
handles: four to move each of the individual vertices of the polygon, and a fifth one to move
the polygon as a whole. A handle is not allowed to modify its corresponding object geometry directly -- that
responsibility lies with the ILspEditor
.ILspEditor
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 |
ALspEditHandle(Object aGeometry)
Creates a new edit handle, given the geometry that it is going to edit.
|
Modifier and Type | Method and Description |
---|---|
Object |
getGeometry()
Returns the geometry that is being edited with this edit handle
|
abstract TLspEditHandleResult |
handleAWTEvent(AWTEvent aEvent,
TLspEditContext aEditContext)
Handle the given input event for the given edit context.
|
TLspEditHandleResultFX |
handleFXEvent(javafx.event.Event aEvent,
TLspEditContext aEditContext)
JavaFX equivalent of
handleAWTEvent(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) . |
getCursor, getCursorFX, getPriority, getProperties, getStyleTargetProviders, isActive, setCursor, setCursorFX, setPriority
protected ALspEditHandle(Object aGeometry)
aGeometry
- the geometry that is edited by this handle. Null is allowed, for instance
if editing doesn't involve geometry directly.public Object getGeometry()
public abstract TLspEditHandleResult handleAWTEvent(AWTEvent aEvent, TLspEditContext aEditContext)
null
event to indicate that the event has been consumed. Note that sometimes an event might be
partially consumed (which is often the case with touch events), in which case this method
will return an edit handle result with an altered version of the given input event.
If incoming event should be ignored, this method should return a TLspEditHandleResult
without any edit operations, and an unconsumed AWTEvent
. An unconsumed AWTEvent
means that it should contain the original, unmodified aEvent
parameter passed to this
method. This result indicates that the event was not consumed, and that some other object needs to
consume the event instead.
As a side effect, a handle is allowed to activate or deactivate itself as a result
of processing an input event.aEvent
- the input eventaEditContext
- 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 handlednull
.ALspHandle.isActive()
public TLspEditHandleResultFX handleFXEvent(javafx.event.Event aEvent, TLspEditContext aEditContext)
handleAWTEvent(AWTEvent, TLspEditContext)
.aEvent
- the input eventaEditContext
- 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 handlednull
.public 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.
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()
,
handleAWTEvent(java.awt.AWTEvent, com.luciad.view.lightspeed.editor.TLspEditContext)
public boolean requestsFocus(javafx.event.Event aEvent, TLspEditContext aEditContext)
requestsFocus(AWTEvent, TLspEditContext)
.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.