diva.canvas.interactor
Interface Interactor

All Superinterfaces:
java.util.EventListener, LayerListener, LayerMotionListener
All Known Implementing Classes:
AbstractInteractor, ActionInteractor, ActorEditorGraphController.LinkCreator, ActorEditorGraphController.RelationCreator, ArcInteractor, AttributeBoundsManipulator.Resizer, BasicGraphController.NodeCreator, BoundedDragInteractor, BoundsManipulator.Resizer, CircleManipulator.Resizer, CompositeInteractor, ConnectorInteractor, DragInteractor, EdgeCreator, EdgeInteractor, FigureInteractor, FSMGraphController.LinkCreator, FSMGraphController.LinkCreator, LocatableNodeDragInteractor, MenuCreator, NodeDragInteractor, NodeInteractor, PathManipulator.Resizer, SelectionDragger, SelectionInteractor

public interface Interactor
extends LayerListener, LayerMotionListener

An object that encapsulate the interaction that a figure plays in an interactive application. Typically, all objects of a certain type (nodes in a graph viewer, for example) all have the same interactor given to them, so that they behave the same. Each interactor is thus attached to one or more figures in a canvas. When a mouse event occurs on the figure canvas, the event dispatch code in the figure canvas searches for the top-most figure underneath the mouse, and then searches up the tree of figures looking for an interactor that can handle that event.

Version:
$Id: Interactor.java 38798 2005-07-08 20:00:01Z cxh $
Author:
John Reekie

Method Summary
 boolean accept(LayerEvent event)
          Test is the interactor is prepared to accept this event.
 MouseFilter getMouseFilter()
          Get the mouse filter used by this interactor to decide whether to accept an event.
 boolean isConsuming()
          Test the consuming flag of this interactor.
 boolean isEnabled()
          Test the enabled flag of this interactor.
 boolean isMotionEnabled()
          Test the motion enabled flag of this interactor.
 void setEnabled(boolean flag)
          Set the enabled flag of this interactor.
 void setMouseFilter(MouseFilter filter)
          Set the mouse filter of this interactor.
 
Methods inherited from interface diva.canvas.event.LayerListener
mouseClicked, mouseDragged, mousePressed, mouseReleased
 
Methods inherited from interface diva.canvas.event.LayerMotionListener
mouseEntered, mouseExited, mouseMoved
 

Method Detail

accept

boolean accept(LayerEvent event)
Test is the interactor is prepared to accept this event. If so, the event is passed to the interactor for handling. This method is called only for the mouse-pressed and mouse-entered events. If that event is accepted, other events of the same series (dragged and released, or moved and exited, respectively) are passed to the interactor without calling this method to check. The mouse-entered event is called only if isMotionEnabled() returns true.


getMouseFilter

MouseFilter getMouseFilter()
Get the mouse filter used by this interactor to decide whether to accept an event. The result may be null.


isConsuming

boolean isConsuming()
Test the consuming flag of this interactor. If this flag is set, the interactor expects is indicating that all events that it will accept should be consumed.


isEnabled

boolean isEnabled()
Test the enabled flag of this interactor. If true, the interactor is prepared to handle layer events of all kinds.


isMotionEnabled

boolean isMotionEnabled()
Test the motion enabled flag of this interactor. If true, the interactor is prepared to handle layer motion events.


setEnabled

void setEnabled(boolean flag)
Set the enabled flag of this interactor. If true, the interactor is prepared to handle layer events. The default setting of this flag should be true.


setMouseFilter

void setMouseFilter(MouseFilter filter)
Set the mouse filter of this interactor. If a filter is set with this method, the interactor is expected to use the filter within its accept() method.