Package diva.canvas.interactor
Interface Interactor
-
- All Superinterfaces:
java.util.EventListener
,LayerListener
,LayerMotionListener
- All Known Implementing Classes:
AbstractInteractor
,ActionInteractor
,ActorEditorGraphController.LinkCreator
,ActorEditorGraphController.RelationCreator
,ArcInteractor
,BasicGraphController.NodeCreator
,BoundedDragInteractor
,CompositeInteractor
,ConnectorInteractor
,DragInteractor
,EdgeCreator
,EdgeInteractor
,FigureInteractor
,FSMGraphController.LinkCreator
,LocatableNodeDragInteractor
,MenuCreator
,NodeDragInteractor
,NodeInteractor
,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$
- Author:
- John Reekie
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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.- Parameters:
event
- The event
-
getMouseFilter
MouseFilter getMouseFilter()
Get the mouse filter used by this interactor to decide whether to accept an event. The result may be null.- Returns:
- The mouse filter
-
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.- Returns:
- true if it is consuming
-
isEnabled
boolean isEnabled()
Test the enabled flag of this interactor. If true, the interactor is prepared to handle layer events of all kinds.- Returns:
- true if the interactor is enabled
-
isMotionEnabled
boolean isMotionEnabled()
Test the motion enabled flag of this interactor. If true, the interactor is prepared to handle layer motion events.- Returns:
- true if the interactor is motion enabled
-
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.- Parameters:
flag
- the enabled flag
-
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.- Parameters:
filter
- the mouse filter.
-
-