gumbo.interact
Class InputFacade

java.lang.Object
  |
  +--gumbo.interact.InputFacade

public class InputFacade
extends java.lang.Object

A facade providing common interactive input support. Includes mouse and keyboard sensors, picking, and action single over feedback. The default implementation uses a Swing mouse and keyboard sensor, which requires targets with a Component graphic. Also includes a "capture cancel" button trigger for button trigger and drag cancel, and a "multi-select" button trigger for target multi-select. Pick support includes a pick sensor and adapter, but not a mapper. The pick target output reflects sensor mouse over, not mouse capture.

Due to the nature of picking, the specific mouse target is usually significant. Due to the nature of keyboard focus, however, usually any target will due. As such, pick output activation requires both the mouse and keyboard to be active, which means that the mouse must be over a target and the keyboard must be focused on a target, but not necessarily the same target. Button output activation, however, only requires that the keybaord be active.

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

Constructor Summary
InputFacade(PickSensor picker)
           
 
Method Summary
 void addSensorTarget(SpaceNode target)
          Convenience method for registering sensor targets.
protected  void connectSensors(MouseSensor mouse, KeyboardSensor keyboard, BooleanField.EventIn pickerActiveIn)
          Called by the system after input sensors have been created to establish connections between the sensors and to the picker's active input, such as for focus-follows-mouse).
 StateSetField.EventOut getButtonsOut()
          Mouse and keyboard buttons.
 BooleanField.EventOut getCancelOut()
          True while the escape key is down.
 KeyboardSensor getKeyboardSensor()
          Gets the keyboard sensor.
 MouseSensor getMouseSensor()
          Gets the mouse sensor.
 BooleanField.EventOut getMultiOut()
          True while the control key is down.
 InteractorField.EventOut getPickOut()
          Mouse pick out.
protected  KeyboardSensor newKeyboardSensor()
          Called by the system during initialization to get the keyboard sensor.
protected  MouseSensor newMouseSensor()
          Called by the system during initialization to get the mouse sensor.
 void removeSensorTarget(SpaceNode target)
          Convenience method for unregistering sensor targets.
 void setNoPickTarget(Interactor target)
          Sets the action feedback target corresponding to NO_PICK_TARGET target in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputFacade

public InputFacade(PickSensor picker)
Method Detail

newMouseSensor

protected MouseSensor newMouseSensor()
Called by the system during initialization to get the mouse sensor.

Returns:
Reference to a new sensor. Never null.

newKeyboardSensor

protected KeyboardSensor newKeyboardSensor()
Called by the system during initialization to get the keyboard sensor. Default implementation: Returns a new SwingKeyboardSensor.

Returns:
Reference to a new sensor. Never null.

connectSensors

protected void connectSensors(MouseSensor mouse,
                              KeyboardSensor keyboard,
                              BooleanField.EventIn pickerActiveIn)
Called by the system after input sensors have been created to establish connections between the sensors and to the picker's active input, such as for focus-follows-mouse). A pick occurs when picker active in is true, the mouse is active (valid target), and the mouse moves. Default implementation: Assumes the sensors are Swing sensors. The sensors are connected for focus-follows-mouse, with mouse keys out to keyboard keys in, and mouse space out to keyboard focus in. The picker is active while the mouse and keyboard are active. For mouse click through, the picker active in is relayed to the mouse and keyboard sensor. Note that the keyboard sensor is activated first to allow establishment of the key state (typically used for chording) before the button state (typically used for triggering).


getMouseSensor

public MouseSensor getMouseSensor()
Gets the mouse sensor.

Returns:
Reference to the sensor. Never null (after init).

getKeyboardSensor

public KeyboardSensor getKeyboardSensor()
Gets the keyboard sensor.

Returns:
Reference to the sensor. Never null (after init).

addSensorTarget

public void addSensorTarget(SpaceNode target)
Convenience method for registering sensor targets.


removeSensorTarget

public void removeSensorTarget(SpaceNode target)
Convenience method for unregistering sensor targets. Throws an exception if space is not a Component.


setNoPickTarget

public void setNoPickTarget(Interactor target)
Sets the action feedback target corresponding to NO_PICK_TARGET target in.

Parameters:
target - The feedback target. None if null, which is the default.

getPickOut

public InteractorField.EventOut getPickOut()
Mouse pick out. NO_TARGET_PICK for no pick; null if mouse not over a sensor target space.


getButtonsOut

public StateSetField.EventOut getButtonsOut()
Mouse and keyboard buttons.


getCancelOut

public BooleanField.EventOut getCancelOut()
True while the escape key is down.


getMultiOut

public BooleanField.EventOut getMultiOut()
True while the control key is down.