gumbo.graphic.input
Class AbstractMouseSensor

java.lang.Object
  |
  +--gumbo.util.AbstractDisposable
        |
        +--gumbo.graphic.input.AbstractMouseSensor
All Implemented Interfaces:
Disposable, MouseSensor
Direct Known Subclasses:
SwingMouseSensor

public abstract class AbstractMouseSensor
extends AbstractDisposable
implements MouseSensor

Provides objects for maintaining mouse button and position state, and event out nodes initialized with immutable views of the state objects. Upon receiving a mouse input this sensor should update the corresponding state object and then invoke send() on the corresponding event out node to send an immutable state snapshot.

Version:
$Revision: 1.3 $
Author:
Jon Barrilleaux (jonb@jmbaai.com) of JMB and Associates Inc.

Constructor Summary
AbstractMouseSensor()
          Creates an instance.
 
Method Summary
protected abstract  void addedSensorTarget(SpaceNode target)
          Called by the system when a non-duplicate target is added, after updating the graphic map.
 void addMouseTarget(SpaceNode target)
          Updates the graphic-to-target map, then calls addTargetSpace().
protected  StateSet getButtonState()
          Returns a reference to the object maintaining button state.
protected  java.util.Map getGraphicMap()
          Returns an immutable view of the graphic (Object) to target (SpaceNode) map.
 StateSetField.EventOut getMouseButtonsOut()
          Sends an immutable view of getButtonState().
 Point3Field.EventOut getMouseMoveOut()
          Sends an immutable view of getMovePoint().
protected  Point3 getMovePoint()
          Returns a reference to the object maintaining movement position.
protected abstract  void removedSensorTarget(SpaceNode target)
          Called by the system when a non-missing target is removed, after updating the graphic map.
 void removeMouseTarget(SpaceNode target)
          Updates the graphic-to-target map, then calls removeTargetSpace().
 
Methods inherited from class gumbo.util.AbstractDisposable
dispose, implDispose, isDisposed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gumbo.graphic.input.MouseSensor
getMouseActiveOut, getMouseCaptureOut, getMouseEnableIn, getMouseOverOut, getMouseSpaceOut
 
Methods inherited from interface gumbo.util.Disposable
dispose, isDisposed
 

Constructor Detail

AbstractMouseSensor

public AbstractMouseSensor()
Creates an instance.

Method Detail

getButtonState

protected StateSet getButtonState()
Returns a reference to the object maintaining button state.

Returns:
The object. Never null.

getMovePoint

protected Point3 getMovePoint()
Returns a reference to the object maintaining movement position.

Returns:
The object. Never null.

getGraphicMap

protected java.util.Map getGraphicMap()
Returns an immutable view of the graphic (Object) to target (SpaceNode) map.

Returns:
The map. Never null.

addedSensorTarget

protected abstract void addedSensorTarget(SpaceNode target)
Called by the system when a non-duplicate target is added, after updating the graphic map.

Parameters:
target - Reference to the target. Never null.

removedSensorTarget

protected abstract void removedSensorTarget(SpaceNode target)
Called by the system when a non-missing target is removed, after updating the graphic map.

Parameters:
target - Reference to the target. Never null.

addMouseTarget

public final void addMouseTarget(SpaceNode target)
Updates the graphic-to-target map, then calls addTargetSpace(). Does nothing if the target is duplicate. Throws an exception if the graphic is duplicate.

Specified by:
addMouseTarget in interface MouseSensor
Parameters:
target - Reference to the target. Never null. Duplicates are ignored.

removeMouseTarget

public final void removeMouseTarget(SpaceNode target)
Updates the graphic-to-target map, then calls removeTargetSpace(). Does nothing if the target is missing. Throws an exception if the graphic is missing.

Specified by:
removeMouseTarget in interface MouseSensor
Parameters:
target - Reference to the target. Never null. Missing are ignored.

getMouseButtonsOut

public final StateSetField.EventOut getMouseButtonsOut()
Sends an immutable view of getButtonState().

Specified by:
getMouseButtonsOut in interface MouseSensor

getMouseMoveOut

public final Point3Field.EventOut getMouseMoveOut()
Sends an immutable view of getMovePoint().

Specified by:
getMouseMoveOut in interface MouseSensor