Package org.jdesktop.animation.timing.triggers

# Class TimingTrigger

java.lang.Object
org.jdesktop.animation.timing.triggers.Trigger
org.jdesktop.animation.timing.triggers.TimingTrigger

All Implemented Interfaces:
  `TimingTarget`

public class TimingTrigger extends Trigger implements TimingTarget
TimingTrigger handles timing events and starts the animator when those events occur. This class can be useful in sequencing different Animators. For example, one Animator can be set to start when another ends using this Trigger. For example, to have anim2 start when anim1 ends, one might write the following:

         TimingTrigger trigger =
             TimingTrigger.addTrigger(anim1, anim2, TimingTriggerEvent.STOP);

## Constructor Summary

Constructors
Constructor
Description
`TimingTrigger(Animator animator, TimingTriggerEvent event)`
Creates a non-auto-reversing TimingTrigger, which should be added to an Animator which will generate the events sent to the trigger.
`TimingTrigger(Animator animator, TimingTriggerEvent event, boolean autoReverse)`
Creates a TimingTrigger, which should be added to an Animator which will generate the events sent to the trigger.

## Method Summary

Modifier and Type
Method
Description
`static TimingTrigger`
`addTrigger(Animator source, Animator target, TimingTriggerEvent event)`
Creates a non-auto-reversing TimingTrigger and adds it as a target to the source Animator.
`static TimingTrigger`
`addTrigger(Animator source, Animator target, TimingTriggerEvent event, boolean autoReverse)`
Creates a TimingTrigger and adds it as a target to the source Animator.
`void`
`begin()`
Called by Animator when starting.
`void`
`end()`
Called by Animator when ending.
`void`
`repeat()`
Called by Animator when repeating.
`void`
`timingEvent(float fraction)`
Implementation of TimingTarget method; this method does nothing in this implementation since the events of TimingTrigger are limited to START, STOP, and REPEAT

### Methods inherited from class org.jdesktop.animation.timing.triggers.Trigger

`disarm, fire, fire`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### TimingTrigger

public TimingTrigger(Animator animator, TimingTriggerEvent event)
Creates a non-auto-reversing TimingTrigger, which should be added to an Animator which will generate the events sent to the trigger.

### TimingTrigger

public TimingTrigger(Animator animator, TimingTriggerEvent event, boolean autoReverse)
Creates a TimingTrigger, which should be added to an Animator which will generate the events sent to the trigger.

## Method Details

### addTrigger

public static TimingTrigger addTrigger(Animator source, Animator target, TimingTriggerEvent event)
Creates a non-auto-reversing TimingTrigger and adds it as a target to the source Animator.

Parameters:
  `source` - the Animator that will be listened to for events to start the target Animator
  `target` - the Animator that will start when the event occurs
  `event` - the TimingTriggerEvent that will cause targetAnimator to start
Returns:
  TimingTrigger the resulting trigger
See Also:
  - `Animator.addTarget(TimingTarget)`

### addTrigger

public static TimingTrigger addTrigger(Animator source, Animator target, TimingTriggerEvent event, boolean autoReverse)
Creates a TimingTrigger and adds it as a target to the source Animator.

Parameters:
  `source` - the Animator that will be listened to for events to start the target Animator
  `target` - the Animator that will start when the event occurs
  `event` - the TimingTriggerEvent that will cause targetAnimator to start
  `autoReverse` - flag to determine whether the animator should stop and reverse based on opposite triggerEvents.
Returns:
  TimingTrigger the resulting trigger
See Also:
  - `Animator.addTarget(TimingTarget)`

### timingEvent

public void timingEvent(float fraction)
Implementation of TimingTarget method; this method does nothing in this implementation since the events of TimingTrigger are limited to START, STOP, and REPEAT

Specified by:
  `timingEvent` in interface `TimingTarget`
Parameters:
  `fraction` - the fraction of completion between the start and end of the current cycle. Note that on reversing cycles (`Animator.Direction.BACKWARD`) the fraction decreases from 1.0 to 0 on backwards-running cycles. Note also that animations with a duration of `INFINITE` will call timingEvent with an undefined value for fraction, since there is no fraction that makes sense if the animation has no defined length.
See Also:
  - `Animator.Direction`

### begin

public void begin()
Called by Animator when starting. Sends the TimingTriggerEvent.START event to the Trigger.

Specified by:
  `begin` in interface `TimingTarget`

### end

public void end()
Called by Animator when ending. Sends the TimingTriggerEvent.STOP event to the Trigger.

Specified by:
  `end` in interface `TimingTarget`

### repeat

public void repeat()
Called by Animator when repeating. Sends the TimingTriggerEvent.REPEAT event to the Trigger.

Specified by:
  `repeat` in interface `TimingTarget`