Package diva.canvas.interactor
Class AbstractInteractor
- java.lang.Object
-
- diva.canvas.interactor.AbstractInteractor
-
- All Implemented Interfaces:
LayerListener
,LayerMotionListener
,Interactor
,java.util.EventListener
- Direct Known Subclasses:
ActionInteractor
,ActorEditorGraphController.LinkCreator
,BasicGraphController.NodeCreator
,CompositeInteractor
,DragInteractor
,EdgeCreator
,FigureInteractor
,FSMGraphController.LinkCreator
,MenuCreator
public abstract class AbstractInteractor extends java.lang.Object implements Interactor
An abstract class that implements Interactor. This class provides simple implementations of most of the required methods of interactors. The listener methods are all implemented, to make it easier to implement interactor subclasses.- Version:
- $Id$
- Author:
- John Reekie
-
-
Constructor Summary
Constructors Constructor Description AbstractInteractor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accept(LayerEvent event)
Test if the interactor accepts the given 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
mouseClicked(LayerEvent layerEvent)
Do nothing.void
mouseDragged(LayerEvent layerEvent)
Do nothing.void
mouseEntered(LayerEvent layerEvent)
Do nothing.void
mouseExited(LayerEvent layerEvent)
Do nothing.void
mouseMoved(LayerEvent layerEvent)
Do nothing.void
mousePressed(LayerEvent layerEvent)
Do nothing.void
mouseReleased(LayerEvent layerEvent)
Do nothing.void
setConsuming(boolean flag)
Set the consuming flag of this layer.void
setEnabled(boolean flag)
Set the enabled flag of this interactor.protected void
setMotionEnabled(boolean flag)
Set the motion enabled flag of this interactor.void
setMouseFilter(MouseFilter filter)
Set the mouse filter of this interactor.
-
-
-
Method Detail
-
accept
public boolean accept(LayerEvent event)
Test if the interactor accepts the given event. This default implementation returns true if the interactor is enabled and the mouse filter accepts the event.- Specified by:
accept
in interfaceInteractor
- Parameters:
event
- The event
-
getMouseFilter
public MouseFilter getMouseFilter()
Get the mouse filter used by this interactor to decide whether to accept an event. The result may be null.- Specified by:
getMouseFilter
in interfaceInteractor
- Returns:
- The mouse filter
-
isConsuming
public boolean isConsuming()
Test the consuming flag of this interactor. If this flag is set, the interactor consumes all input events that get past its mouse filter.- Specified by:
isConsuming
in interfaceInteractor
- Returns:
- true if it is consuming
-
isEnabled
public boolean isEnabled()
Test the enabled flag of this interactor. If true, the interactor is prepared to handle layer events.- Specified by:
isEnabled
in interfaceInteractor
- Returns:
- true if the interactor is enabled
-
isMotionEnabled
public boolean isMotionEnabled()
Test the motion enabled flag of this interactor. If true, the interactor is prepared to handle layer motion events.- Specified by:
isMotionEnabled
in interfaceInteractor
- Returns:
- true if the interactor is motion enabled
-
mouseDragged
public void mouseDragged(LayerEvent layerEvent)
Do nothing.- Specified by:
mouseDragged
in interfaceLayerListener
- Parameters:
layerEvent
- The event
-
mouseEntered
public void mouseEntered(LayerEvent layerEvent)
Do nothing.- Specified by:
mouseEntered
in interfaceLayerMotionListener
- Parameters:
layerEvent
- The event
-
mouseExited
public void mouseExited(LayerEvent layerEvent)
Do nothing.- Specified by:
mouseExited
in interfaceLayerMotionListener
- Parameters:
layerEvent
- The event
-
mouseMoved
public void mouseMoved(LayerEvent layerEvent)
Do nothing.- Specified by:
mouseMoved
in interfaceLayerMotionListener
- Parameters:
layerEvent
- The event
-
mousePressed
public void mousePressed(LayerEvent layerEvent)
Do nothing.- Specified by:
mousePressed
in interfaceLayerListener
- Parameters:
layerEvent
- The event
-
mouseReleased
public void mouseReleased(LayerEvent layerEvent)
Do nothing.- Specified by:
mouseReleased
in interfaceLayerListener
- Parameters:
layerEvent
- The event
-
mouseClicked
public void mouseClicked(LayerEvent layerEvent)
Do nothing.- Specified by:
mouseClicked
in interfaceLayerListener
- Parameters:
layerEvent
- The event
-
setConsuming
public void setConsuming(boolean flag)
Set the consuming flag of this layer. If this flag is set, the interactor consumes all events that get past its mouse filter. By default, the flag is true.- Parameters:
flag
- The consuming flag
-
setEnabled
public 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 is true.- Specified by:
setEnabled
in interfaceInteractor
- Parameters:
flag
- the enabled flag
-
setMotionEnabled
protected void setMotionEnabled(boolean flag)
Set the motion enabled flag of this interactor. If true, the interactor is prepared to handle layer motion events. The default setting of this flag is false.- Parameters:
flag
- the motion flag
-
setMouseFilter
public void setMouseFilter(MouseFilter filter)
Set the mouse filter of this interactor.- Specified by:
setMouseFilter
in interfaceInteractor
- Parameters:
filter
- The filter
-
-