gumbo.interact.button
Class FancyButtonTrigger

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

public abstract class FancyButtonTrigger
extends AbstractButtonTrigger

An abstract "fancy" button trigger, which is stateful (must be armed before firing), button edge (not level) sensing, and can perform trigger capture. Buttons control start and stop of a "critical" state, which is the armed state for a latch button, and the fire state for a push button. Being edge sensing and stateful, firing conditions must be met after, not before, fireable in goes true.

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

Constructor Summary
FancyButtonTrigger(java.util.Collection triggerButtons, java.util.Collection chordButtons, java.util.Collection domainButtons, boolean onPress, boolean capturing)
          Creates an instance.
 
Method Summary
protected  boolean checkStartCritical()
          Called by the system to check for start of the critical state.
protected  boolean checkStopCritical()
          Returns true if the last call to checkStopCritical() stopped the critical state and was the result of a trigger button.
 boolean isCapturing()
           
 boolean isOnPress()
           
protected  boolean isStartCriticalTriggered()
          Returns true if the last call to checkStartCritical() started the critical state and was the result of a trigger button.
protected  boolean isStopCriticalTriggered()
          ??? Called by the system to check for cancellation of the critical state.
protected  void processCancelIn()
          The default implementation: If the trigger is cancelled and cancel in goes false, starts the reset state; else, if the trigger is captured and cancel in is true, starts the cancel state.
 
Methods inherited from class gumbo.interact.button.AbstractButtonTrigger
getActiveIn, getArmedOut, getButtonsIn, getCancelIn, getCancelOut, getCaptureOut, getChordButtons, getDomainButtons, getEnableIn, getFireableIn, getFireNotifyOut, getFireOut, getResetIn, getTriggerButtons, processButtonsIn, processFireableIn, processResetIn, startArmed, startCancel, startFire, startReset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FancyButtonTrigger

public FancyButtonTrigger(java.util.Collection triggerButtons,
                          java.util.Collection chordButtons,
                          java.util.Collection domainButtons,
                          boolean onPress,
                          boolean capturing)
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, buttons are active when/while pressed; otherwise, when/while released. Note that buttons control the critical state, which may not be the firing state.
capturing - If true, trigger is captured during the critical state; otherwise, capture is always false.
Method Detail

isOnPress

public boolean isOnPress()

isCapturing

public boolean isCapturing()

checkStartCritical

protected boolean checkStartCritical()
Called by the system to check for start of the critical state. Default implementation: Checks buttons in. Returns false if trigger buttons and chord buttons are empty; false if no trigger or chord button edges; false if trigger buttons is not empty but none are active; false if chord buttons is not empty but none are active; false if domain buttons is not empty and any except trigger and domain buttons are active; otherwise, critical start buttons are saved and returns true.


isStartCriticalTriggered

protected boolean isStartCriticalTriggered()
Returns true if the last call to checkStartCritical() started the critical state and was the result of a trigger button. If no trigger buttons are specified for this trigger, returns true if critical was started regardless of button type.


checkStopCritical

protected boolean checkStopCritical()
Returns true if the last call to checkStopCritical() stopped the critical state and was the result of a trigger button. If no trigger buttons are specified for this trigger, returns true if critical was stopped regardless of button type.


isStopCriticalTriggered

protected boolean isStopCriticalTriggered()
??? Called by the system to check for cancellation of the critical state. Default implementation: Returns true if checkStopCritical() is true, trigger buttons is not empty, and no critical trigger buttons changed; otherwise, returns false.


processCancelIn

protected void processCancelIn()
The default implementation: If the trigger is cancelled and cancel in goes false, starts the reset state; else, if the trigger is captured and cancel in is true, starts the cancel state.

Overrides:
processCancelIn in class AbstractButtonTrigger