gumbo.interact.button
Class LatchButtonTrigger

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

public class LatchButtonTrigger
extends FancyButtonTrigger

A latching button trigger that is stateful (must be armed before firing), button edge (not level) sensing, and can perform trigger capture. The critical/capturing state for a latch button is the armed state. If trigger buttons are specified then only a trigger button can fire the trigger; otherwise, any chord button will fire it. Being edge sensing and stateful, firing conditions must be met after, not before, fireable in goes true.

If a one-shot trigger, fire out remains true until the trigger is reset; otherwise, it remains true only until the trigger is rearmed.

If a capturing trigger, defines an additional button trigger state, rearmable. If the trigger is armed, it becomes rearmable if fireable in goes false, and it becomes rearmed if fireable in goes true again.

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

Constructor Summary
LatchButtonTrigger(java.util.Collection triggerButtons, java.util.Collection chordButtons, java.util.Collection domainButtons)
          Creates a default trigger (fires on button release, captures during the armed state, multi-shot).
LatchButtonTrigger(java.util.Collection triggerButtons, java.util.Collection chordButtons, java.util.Collection domainButtons, boolean onPress, boolean capturing, boolean oneShot)
          Creates an instance.
 
Method Summary
 boolean isOneShot()
           
protected  void processButtonsIn()
          Called by the system to process the corresponding input event.
protected  void processFireableIn()
          Called by the system to process the corresponding input event.
protected  void startArmed()
          Default implementation: If capturing, starts capturing, then starts armed.
protected  void startFire()
          Default implementation: Starts fire then, if capturing, stops capturing.
protected  void startRearmable()
          Called by the system to transit to the trigger rearmable state.
 
Methods inherited from class gumbo.interact.button.FancyButtonTrigger
checkStartCritical, checkStopCritical, isCapturing, isOnPress, isStartCriticalTriggered, isStopCriticalTriggered, processCancelIn
 
Methods inherited from class gumbo.interact.button.AbstractButtonTrigger
getActiveIn, getArmedOut, getButtonsIn, getCancelIn, getCancelOut, getCaptureOut, getChordButtons, getDomainButtons, getEnableIn, getFireableIn, getFireNotifyOut, getFireOut, getResetIn, getTriggerButtons, processResetIn, startCancel, startReset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LatchButtonTrigger

public LatchButtonTrigger(java.util.Collection triggerButtons,
                          java.util.Collection chordButtons,
                          java.util.Collection domainButtons)
Creates a default trigger (fires on button release, captures during the armed state, multi-shot).

Parameters:
triggerButtons - Value of trigger button flags (Object, specifically MouseSensors.BUTTON_???, KeyboardSensors.KEY_???). None if null. (See ButtonTrigger). If trigger buttons are specified then only a trigger button can fire the trigger.
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).

LatchButtonTrigger

public LatchButtonTrigger(java.util.Collection triggerButtons,
                          java.util.Collection chordButtons,
                          java.util.Collection domainButtons,
                          boolean onPress,
                          boolean capturing,
                          boolean oneShot)
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).
onPress - If true, the trigger fires when buttons are pressed; otherwise, when released.
capturing - If true, trigger is captured during critical states; otherwise, capture is always false.
oneShot - If true, the trigger must be reset before it can fire again; otherwise, it resets each time before rearming.
Method Detail

isOneShot

public boolean isOneShot()

startRearmable

protected void startRearmable()
Called by the system to transit to the trigger rearmable state. Should only be called if capturing is true. Default implementation: Sets armed, fire, and cancel out false, and capture out true.


processButtonsIn

protected void processButtonsIn()
Description copied from class: AbstractButtonTrigger
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.

Specified by:
processButtonsIn in class AbstractButtonTrigger

processFireableIn

protected void processFireableIn()
Description copied from class: AbstractButtonTrigger
Called by the system to process the corresponding input event. Only called if enable in and active in are true.

Specified by:
processFireableIn in class AbstractButtonTrigger

startArmed

protected void startArmed()
Default implementation: If capturing, starts capturing, then starts armed.

Overrides:
startArmed in class AbstractButtonTrigger

startFire

protected void startFire()
Default implementation: Starts fire then, if capturing, stops capturing.

Overrides:
startFire in class AbstractButtonTrigger