public class IlvMoveObjectInteractor extends IlvObjectInteractor
IlvMoveObjectInteractor
is a local object interactor class that
is used to let the user move a graphic object in a manager view.
Notice that the graphic objects can also be moved interactively using the
selection view interactor
IlvSelectInteractor
.
Therefore, the IlvMoveObjectInteractor
is mainly useful for
allowing to interactively move graphic objects without a selection
interactor being installed.
The following code example shows how to set
IlvMoveObjectInteractor
for a graphic object:
IlvManager mgr = new IlvManager(); // Create and add 2 graphic objects. IlvGraphic obj1 = new IlvRectangle(new IlvRect(60, 30, 50, 50)); mgr.addObject(obj1, false); IlvGraphic obj2 = new IlvRectangle(new IlvRect(140, 50, 10, 10)); mgr.addObject(obj2, false); // Set the move interactor on obj2 only. obj2.setObjectInteractor(new IlvMoveObjectInteractor());
IlvMoveObjectInteractor
is a custom local interactor, that
is, a subclass of IlvObjectInteractor
. A local interactor is a
class that listens to a special event in a graphic object. All input events
are handled by means of interactors or accelerators. For information about
how to treat events in a manager, see
Handling Events. The following code
examples show how to handle user events:
Constructor and Description |
---|
IlvMoveObjectInteractor()
Creates the interactor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
drawGhost(IlvGraphic obj,
IlvObjectInteractorContext context)
Draws a preview image of the user action (ghost image).
|
protected void |
performMove(IlvGraphic object,
IlvPoint position,
IlvObjectInteractorContext context)
This method is called to move the graphic object to it's new
position.
|
protected boolean |
processButtonDown(IlvGraphic obj,
MouseEvent event,
IlvObjectInteractorContext context)
Processes the button down events.
|
protected boolean |
processButtonDragged(IlvGraphic obj,
MouseEvent event,
IlvObjectInteractorContext context)
Processes the button dragged events.
|
protected boolean |
processButtonUp(IlvGraphic obj,
MouseEvent event,
IlvObjectInteractorContext context)
Processes the button up events.
|
boolean |
processEvent(IlvGraphic obj,
AWTEvent event,
IlvObjectInteractorContext context)
Processes the events.
|
protected void |
validate(IlvGraphic object,
IlvPoint position,
IlvObjectInteractorContext context)
This method is called on each mouse movement.
|
Get, handleExpose, onEnter, onExit, Put
public IlvMoveObjectInteractor()
IlvObjectInteractor.Get
method.protected void performMove(IlvGraphic object, IlvPoint position, IlvObjectInteractorContext context)
object
- the moved graphic object.position
- the new desired position of
the object in manager's coordinate system.context
- the context of execution of the interactor.protected void validate(IlvGraphic object, IlvPoint position, IlvObjectInteractorContext context)
object
- the moved graphic object.position
- the current desired position of the object in the
manager's coordinate system.context
- the context of execution of the interactor.protected boolean processButtonDown(IlvGraphic obj, MouseEvent event, IlvObjectInteractorContext context)
protected boolean processButtonDragged(IlvGraphic obj, MouseEvent event, IlvObjectInteractorContext context)
protected boolean processButtonUp(IlvGraphic obj, MouseEvent event, IlvObjectInteractorContext context)
public boolean processEvent(IlvGraphic obj, AWTEvent event, IlvObjectInteractorContext context)
processEvent
in class IlvObjectInteractor
obj
- The graphic object.event
- The event to process.context
- The context in which the event occurred.true
if the event was handled
by this processEvent
invocation,
false
otherwise.protected void drawGhost(IlvGraphic obj, IlvObjectInteractorContext context)
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.