diva.canvas.interactor
Class AbstractInteractor

java.lang.Object
  extended by 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, 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: AbstractInteractor.java 38798 2005-07-08 20:00:01Z cxh $
Author:
John Reekie

Field Summary
private  boolean _consuming
          The consuming flag.
private  boolean _enabled
          The flag that says that layer events are enabled
private  boolean _motionEnabled
          The flag that says that layer motion events are enabled
private  MouseFilter _mouseFilter
          The mouse filter
 
Constructor Summary
AbstractInteractor()
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_consuming

private boolean _consuming
The consuming flag.


_enabled

private boolean _enabled
The flag that says that layer events are enabled


_motionEnabled

private boolean _motionEnabled
The flag that says that layer motion events are enabled


_mouseFilter

private MouseFilter _mouseFilter
The mouse filter

Constructor Detail

AbstractInteractor

public AbstractInteractor()
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 interface Interactor

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 interface Interactor

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 interface Interactor

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 interface Interactor

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 interface Interactor

mouseDragged

public void mouseDragged(LayerEvent layerEvent)
Do nothing.

Specified by:
mouseDragged in interface LayerListener

mouseEntered

public void mouseEntered(LayerEvent layerEvent)
Do nothing.

Specified by:
mouseEntered in interface LayerMotionListener

mouseExited

public void mouseExited(LayerEvent layerEvent)
Do nothing.

Specified by:
mouseExited in interface LayerMotionListener

mouseMoved

public void mouseMoved(LayerEvent layerEvent)
Do nothing.

Specified by:
mouseMoved in interface LayerMotionListener

mousePressed

public void mousePressed(LayerEvent layerEvent)
Do nothing.

Specified by:
mousePressed in interface LayerListener

mouseReleased

public void mouseReleased(LayerEvent layerEvent)
Do nothing.

Specified by:
mouseReleased in interface LayerListener

mouseClicked

public void mouseClicked(LayerEvent layerEvent)
Do nothing.

Specified by:
mouseClicked in interface LayerListener

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.


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 interface Interactor

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.


setMouseFilter

public void setMouseFilter(MouseFilter filter)
Set the mouse filter of this interactor.

Specified by:
setMouseFilter in interface Interactor