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 booleanaccept(LayerEvent event)Test if the interactor accepts the given event.MouseFiltergetMouseFilter()Get the mouse filter used by this interactor to decide whether to accept an event.booleanisConsuming()Test the consuming flag of this interactor.booleanisEnabled()Test the enabled flag of this interactor.booleanisMotionEnabled()Test the motion enabled flag of this interactor.voidmouseClicked(LayerEvent layerEvent)Do nothing.voidmouseDragged(LayerEvent layerEvent)Do nothing.voidmouseEntered(LayerEvent layerEvent)Do nothing.voidmouseExited(LayerEvent layerEvent)Do nothing.voidmouseMoved(LayerEvent layerEvent)Do nothing.voidmousePressed(LayerEvent layerEvent)Do nothing.voidmouseReleased(LayerEvent layerEvent)Do nothing.voidsetConsuming(boolean flag)Set the consuming flag of this layer.voidsetEnabled(boolean flag)Set the enabled flag of this interactor.protected voidsetMotionEnabled(boolean flag)Set the motion enabled flag of this interactor.voidsetMouseFilter(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:
acceptin 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:
getMouseFilterin 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:
isConsumingin 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:
isEnabledin 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:
isMotionEnabledin interfaceInteractor- Returns:
- true if the interactor is motion enabled
-
mouseDragged
public void mouseDragged(LayerEvent layerEvent)
Do nothing.- Specified by:
mouseDraggedin interfaceLayerListener- Parameters:
layerEvent- The event
-
mouseEntered
public void mouseEntered(LayerEvent layerEvent)
Do nothing.- Specified by:
mouseEnteredin interfaceLayerMotionListener- Parameters:
layerEvent- The event
-
mouseExited
public void mouseExited(LayerEvent layerEvent)
Do nothing.- Specified by:
mouseExitedin interfaceLayerMotionListener- Parameters:
layerEvent- The event
-
mouseMoved
public void mouseMoved(LayerEvent layerEvent)
Do nothing.- Specified by:
mouseMovedin interfaceLayerMotionListener- Parameters:
layerEvent- The event
-
mousePressed
public void mousePressed(LayerEvent layerEvent)
Do nothing.- Specified by:
mousePressedin interfaceLayerListener- Parameters:
layerEvent- The event
-
mouseReleased
public void mouseReleased(LayerEvent layerEvent)
Do nothing.- Specified by:
mouseReleasedin interfaceLayerListener- Parameters:
layerEvent- The event
-
mouseClicked
public void mouseClicked(LayerEvent layerEvent)
Do nothing.- Specified by:
mouseClickedin 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:
setEnabledin 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:
setMouseFilterin interfaceInteractor- Parameters:
filter- The filter
-
-