gumbo.interact.button
Class AbstractButtonGesture

java.lang.Object
  |
  +--gumbo.interact.button.AbstractButtonGesture
All Implemented Interfaces:
ButtonGesture, ButtonTrigger

public class AbstractButtonGesture
extends java.lang.Object
implements ButtonGesture

Base class for button gestures. Wraps a button trigger as a private delegate. As such, the trigger should not be accessed externally, except for outputs that are not handled by this wrapper.

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

Constructor Summary
AbstractButtonGesture(ButtonTrigger trigger)
          Creates an instance that recognizes all targets, including no target.
AbstractButtonGesture(ButtonTrigger trigger, java.util.Collection targets)
          Creates an instance that can recognize multiple live targets.
AbstractButtonGesture(ButtonTrigger trigger, Interactor target)
          Creates an instance that recognizes a single static target.
 
Method Summary
 ControlAdapter addControlAdapter(ControlAdapter adapter)
          TODO: This breaks conventions??? Convenience method for connecting a control feedback adapter to this gesture.
 BooleanField.EventIn getActiveIn()
          Default implementation: True.
 BooleanField.EventOut getArmedOut()
          Sends true while this trigger is armed for firing.
 StateSetField.EventIn getButtonsIn()
          The input button states.
 BooleanField.EventIn getCancelIn()
          If true, cancels trigger capture and blocks trigger inputs; and, resets the trigger when it goes false again.
 BooleanField.EventOut getCancelOut()
          Sends true if cancel in goes true while this trigger is captured, and goes false after cancel in goes false.
 BooleanField.EventOut getCaptureOut()
          Sends true while this trigger is captured for rearming, firing, or cancellation.
 java.util.Collection getChordButtons()
          Gets an immutable view of the recognized chord buttons (Object, specifically MouseSensors.BUTTON_???, KeyboardSensors.KEY_???).
 java.util.Collection getDomainButtons()
          Gets an immutable view of the recognized domain buttons (Object, specifically MouseSensors.BUTTON_???, KeyboardSensors.KEY_???).
 BooleanField.EventIn getEnableIn()
          Default implementation: True.
 BooleanField.EventIn getFireableIn()
          Default implementation: True.
 NotifyNode.EventOut getFireNotifyOut()
          Convenience event that fires after fire out goes true.
 BooleanField.EventOut getFireOut()
          Sends true when an armed button fires.
 java.util.Collection getGestureTargets()
          Gets an immutable view of the recognized pick targets (Interactor).
 InteractorField.EventIn getPickIn()
          The input pick, which may be NO_PICK_TARGET or null.
 InteractorField.EventOut getPickOut()
          The output pick, which is the value of the gesture target when the trigger fires.
 NotifyNode.EventIn getResetIn()
          Resets this trigger if fired.
 InteractorField.EventOut getTargetOut()
          The gesture target.
 java.util.Collection getTriggerButtons()
          Gets an immutable view of the recognized trigger buttons (Object, specifically MouseSensors.BUTTON_???, KeyboardSensors.KEY_???).
protected  void processCaptureOut()
          Called by the system to process the corresponding output event.
protected  void processPickIn()
          Called by the system to process the corresponding input event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractButtonGesture

public AbstractButtonGesture(ButtonTrigger trigger)
Creates an instance that recognizes all targets, including no target. As such, the trigger will be cleared whenever target out changes.

Parameters:
trigger - A new button trigger. Never null.

AbstractButtonGesture

public AbstractButtonGesture(ButtonTrigger trigger,
                             Interactor target)
Creates an instance that recognizes a single static target. As such, trigger state is never automatically cleared.

Parameters:
trigger - A new button trigger. Never null.
target - The gesture target. NO_PICK_TARGET for no target. Never null.

AbstractButtonGesture

public AbstractButtonGesture(ButtonTrigger trigger,
                             java.util.Collection targets)
Creates an instance that can recognize multiple live targets. As such, the trigger will be cleared whenever target out changes.

Parameters:
trigger - A new button trigger. Never null.
targets - The gesture targets (Interactor). Live reference. If null, all targets, including no target. Null targets are ignored. Target changes take affect on the next pick in event.
Method Detail

addControlAdapter

public ControlAdapter addControlAdapter(ControlAdapter adapter)
TODO: This breaks conventions??? Convenience method for connecting a control feedback adapter to this gesture. The adapter and this gesture are assumed to have compatible targets.

Parameters:
adapter - The adapter to be connected. If null, a singleton default control adapter will be created using this gesture's targets.
Returns:
The control adapter that was connected. Never null.

processPickIn

protected void processPickIn()
Called by the system to process the corresponding input event. Default implementation: If active in is true, sets fireable in according to whether or not target in is a recognized target. If not captured, sets trigger active in and gesture target out.


processCaptureOut

protected void processCaptureOut()
Called by the system to process the corresponding output event. Default implementation: If capture is going false, sets trigger active in and gesture target out according to whether or not target in is a valid target.


getGestureTargets

public java.util.Collection getGestureTargets()
Description copied from interface: ButtonGesture
Gets an immutable view of the recognized pick targets (Interactor). May include NO_PICK_TARGET for no target; null entries are ignored. Null if all input targets, including no target, are recognized.

Specified by:
getGestureTargets in interface ButtonGesture

getPickIn

public InteractorField.EventIn getPickIn()
Description copied from interface: ButtonGesture
The input pick, which may be NO_PICK_TARGET or null. Typically the mouse over, keyboard focus, or selected interactor.

Specified by:
getPickIn in interface ButtonGesture

getTargetOut

public InteractorField.EventOut getTargetOut()
Description copied from interface: ButtonGesture
The gesture target. Null if none recognized. May be NO_PICK_TARGET (see getGestureTargets()). Valid during any output events. Trigger inputs are blocked while the target is null. If this gesture is monitoring more than one target the state of the old target is cleared (button trigger cancelled and reset) before target out changes.

Specified by:
getTargetOut in interface ButtonGesture

getPickOut

public InteractorField.EventOut getPickOut()
Description copied from interface: ButtonGesture
The output pick, which is the value of the gesture target when the trigger fires.

Specified by:
getPickOut in interface ButtonGesture

getTriggerButtons

public final java.util.Collection getTriggerButtons()
Description copied from interface: ButtonTrigger
Gets an immutable view of the recognized trigger buttons (Object, specifically MouseSensors.BUTTON_???, KeyboardSensors.KEY_???). The trigger can fire if one or more trigger buttons are active. If empty, only chord buttons are needed to fire the trigger.

Specified by:
getTriggerButtons in interface ButtonTrigger

getChordButtons

public final java.util.Collection getChordButtons()
Description copied from interface: ButtonTrigger
Gets an immutable view of the recognized chord buttons (Object, specifically MouseSensors.BUTTON_???, KeyboardSensors.KEY_???). The trigger can fire if all chord buttons are active. If empty, only trigger buttons are needed to fire the trigger.

Specified by:
getChordButtons in interface ButtonTrigger

getDomainButtons

public final java.util.Collection getDomainButtons()
Description copied from interface: ButtonTrigger
Gets an immutable view of the recognized domain buttons (Object, specifically MouseSensors.BUTTON_???, KeyboardSensors.KEY_???). The trigger cannot fire if any buttons in the domain other than the trigger and chord buttons are active. By default, the button domain includes the trigger and chord buttons (even if domain buttons is empty or incomplete).

Specified by:
getDomainButtons in interface ButtonTrigger

getEnableIn

public BooleanField.EventIn getEnableIn()
Default implementation: True.

Specified by:
getEnableIn in interface ButtonTrigger

getActiveIn

public BooleanField.EventIn getActiveIn()
Default implementation: True.

Specified by:
getActiveIn in interface ButtonTrigger

getButtonsIn

public StateSetField.EventIn getButtonsIn()
Description copied from interface: ButtonTrigger
The input button states. Never null.

Specified by:
getButtonsIn in interface ButtonTrigger

getFireableIn

public BooleanField.EventIn getFireableIn()
Default implementation: True.

Specified by:
getFireableIn in interface ButtonTrigger

getResetIn

public NotifyNode.EventIn getResetIn()
Description copied from interface: ButtonTrigger
Resets this trigger if fired. Ignored if the trigger has not fired or does not latch.

Specified by:
getResetIn in interface ButtonTrigger

getCancelIn

public BooleanField.EventIn getCancelIn()
Description copied from interface: ButtonTrigger
If true, cancels trigger capture and blocks trigger inputs; and, resets the trigger when it goes false again. Ignored if the trigger is not captured or does not capture.

Specified by:
getCancelIn in interface ButtonTrigger

getCaptureOut

public BooleanField.EventOut getCaptureOut()
Description copied from interface: ButtonTrigger
Sends true while this trigger is captured for rearming, firing, or cancellation. Sends false after the trigger is reset or cancelled. Stays false if the trigger does not capture.

Specified by:
getCaptureOut in interface ButtonTrigger

getArmedOut

public BooleanField.EventOut getArmedOut()
Description copied from interface: ButtonTrigger
Sends true while this trigger is armed for firing. Sends false before fire out goes true, and after the trigger is reset.

Specified by:
getArmedOut in interface ButtonTrigger

getFireOut

public BooleanField.EventOut getFireOut()
Description copied from interface: ButtonTrigger
Sends true when an armed button fires. Goes false before being rearmed, and after being reset.

Specified by:
getFireOut in interface ButtonTrigger

getFireNotifyOut

public NotifyNode.EventOut getFireNotifyOut()
Description copied from interface: ButtonTrigger
Convenience event that fires after fire out goes true.

Specified by:
getFireNotifyOut in interface ButtonTrigger

getCancelOut

public BooleanField.EventOut getCancelOut()
Description copied from interface: ButtonTrigger
Sends true if cancel in goes true while this trigger is captured, and goes false after cancel in goes false.

Specified by:
getCancelOut in interface ButtonTrigger