org.jdesktop.animation.timing.triggers
public abstract class Trigger extends Object
fire()
or fire(TriggerEvent)
to start the
animator based on an event that occurred.
Subclasses should call one of the constructors in Trigger, according to whether they want Trigger to discern between different TriggerEvents and whether they want Trigger to auto-reverse the animation based on opposite TriggerEvents.
Subclasses should call one of the fire
methods based on
whether they want Trigger to perform any event logic or simply start
the animation.
Modifier | Constructor and Description |
---|---|
protected |
Trigger(Animator animator)
Creates a Trigger that will start the animator when
fire()
is called. |
protected |
Trigger(Animator animator,
TriggerEvent triggerEvent)
Creates a Trigger that will start the animator when
fire(TriggerEvent) is called with an event that equals
triggerEvent. |
protected |
Trigger(Animator animator,
TriggerEvent triggerEvent,
boolean autoReverse)
Creates a Trigger that will start the animator when
fire(TriggerEvent) is called with an event that equals
triggerEvent. |
Modifier and Type | Method and Description |
---|---|
void |
disarm()
This method disables this Trigger and effectively noop's any actions
that would otherwise occur
|
protected void |
fire()
Utility method called by subclasses to start the animator.
|
protected void |
fire(TriggerEvent currentEvent)
Called by subclasses to start the animator if currentEvent equals
the event that the Trigger is based upon.
|
protected Trigger(Animator animator)
fire()
is called. Subclasses call this method to set up a simple Trigger
that will be started by calling fire()
, and will have
no dependency upon the specific TriggerEvent
that must have
occurred to start the animator.animator
- the Animator that will start when the Trigger
is firedprotected Trigger(Animator animator, TriggerEvent triggerEvent)
fire(TriggerEvent)
is called with an event that equals
triggerEvent.animator
- the Animator that will start when the Trigger
is firedtriggerEvent
- the TriggerEvent that must occur for this
Trigger to fireprotected Trigger(Animator animator, TriggerEvent triggerEvent, boolean autoReverse)
fire(TriggerEvent)
is called with an event that equals
triggerEvent. Also, automatically stops and reverses animator when
opposite event occurs, and stops reversing animator likewise
when triggerEvent occurs.animator
- the Animator that will start when the Trigger
is firedtriggerEvent
- the TriggerEvent that must occur for this
Trigger to fireautoReverse
- flag to determine whether the animator should
stop and reverse based on opposite triggerEvents.TriggerEvent.getOppositeEvent()
public void disarm()
protected void fire(TriggerEvent currentEvent)
currentEvent
- the TriggerEvent
that just occurred, which
will be compared with the TriggerEvent used to construct this Trigger
and determine whether the animator should be started or reversedprotected void fire()