gumbo.interact.button
Class AbstractButtonTrigger

java.lang.Object
  |
  +--gumbo.interact.button.AbstractButtonTrigger
All Implemented Interfaces:
ButtonTrigger
Direct Known Subclasses:
FancyButtonTrigger, SimpleButtonTrigger

public abstract class AbstractButtonTrigger
extends java.lang.Object
implements ButtonTrigger

Abstract base class for button triggers. The trigger states are reset, armed, fire, and cancel, which are mutually exclusive. Subclasses may define additional states.

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

Constructor Summary
AbstractButtonTrigger(java.util.Collection triggerButtons, java.util.Collection chordButtons, java.util.Collection domainButtons)
          Creates an instance.
 
Method Summary
 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.
 NotifyNode.EventIn getResetIn()
          Resets this trigger if fired.
 java.util.Collection getTriggerButtons()
          Gets an immutable view of the recognized trigger buttons (Object, specifically MouseSensors.BUTTON_???, KeyboardSensors.KEY_???).
protected abstract  void processButtonsIn()
          Called by the system to process the corresponding input event.
protected  void processCancelIn()
          Called by the system to process the corresponding input event.
protected abstract  void processFireableIn()
          Called by the system to process the corresponding input event.
protected  void processResetIn()
          Called by the system to process the corresponding input event.
protected  void startArmed()
          Called by the system to transit to the trigger armed state.
protected  void startCancel()
          Called by the system to transit to the trigger cancel state.
protected  void startFire()
          Called by the system to transit to the trigger fire state.
protected  void startReset()
          Called by the system to transit to the trigger clear state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractButtonTrigger

public AbstractButtonTrigger(java.util.Collection triggerButtons,
                             java.util.Collection chordButtons,
                             java.util.Collection domainButtons)
Creates an instance. Master constructor.

Parameters:
triggerButtons - Value of trigger button flags (Object, specifically MouseSensors.BUTTON_???, KeyboardSensors.KEY_???). None if null. (See ButtonTrigger).
chordButtons - Value of chord button flags (Object, specifically MouseSensors.BUTTON_???, KeyboardSensors.KEY_???). None if null. (See ButtonTrigger).
domainButtons - Value of domain button flags (Object, specifically MouseSensors.BUTTON_???, KeyboardSensors.KEY_???). None if null. (See ButtonTrigger).
Method Detail

processButtonsIn

protected abstract void processButtonsIn()
Called by the system to process the corresponding input event. Only called if enable in and active in are true, and cancel out is false.


processFireableIn

protected abstract void processFireableIn()
Called by the system to process the corresponding input event. Only called if enable in and active in are true.


processResetIn

protected void processResetIn()
Called by the system to process the corresponding input event. Only called if enable in and active in are true. Default implementation: If fired, starts the reset state. Non-latching triggers should override to do nothing.


processCancelIn

protected void processCancelIn()
Called by the system to process the corresponding input event. Only called if enable in and active in are true. The default implementation: Does nothing.


startArmed

protected void startArmed()
Called by the system to transit to the trigger armed state. Default implementation: Sets armed out true, fire and cancel out false. Capturing triggers must override to set capture.


startFire

protected void startFire()
Called by the system to transit to the trigger fire state. Default implementation: Sets fire out true, armed and cancel out false. Capturing triggers must override to set capture.


startCancel

protected void startCancel()
Called by the system to transit to the trigger cancel state. Default implementation: Sets armed and fire out false, and capture and cancel out true.


startReset

protected void startReset()
Called by the system to transit to the trigger clear state. Default implementation: Sets capture, armed, fire, and cancel out false.


getTriggerButtons

public 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 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 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