org.pushingpixels.trident
Class Timeline

java.lang.Object
  extended by org.pushingpixels.trident.Timeline
All Implemented Interfaces:
TimelineScenario.TimelineScenarioActor
Direct Known Subclasses:
SwingRepaintTimeline, SWTRepaintTimeline

public class Timeline
extends Object
implements TimelineScenario.TimelineScenarioActor


Nested Class Summary
static class Timeline.RepeatBehavior
           
static class Timeline.TimelineState
           
 
Field Summary
protected  long id
          Unique ID.
 
Constructor Summary
Timeline()
           
Timeline(Object mainTimelineObject)
           
 
Method Summary
 void abort()
          Aborts this timeline.
 void addCallback(TimelineCallback callback)
           
<T> void
addPropertyToInterpolate(String propName, KeyFrames<T> keyFrames)
           
<T> void
addPropertyToInterpolate(String propName, T from, T to)
           
<T> void
addPropertyToInterpolate(TimelinePropertyBuilder<T> propertyBuilder)
           
 void cancel()
          Cancels this timeline.
 void cancelAtCycleBreak()
          Requests that the specified timeline should stop at the end of the cycle.
 void end()
          Ends this timeline.
 long getDuration()
           
 float getDurationFraction()
           
protected static long getId()
          Returns a unique ID.
 Object getMainObject()
           
 String getName()
           
 Timeline.TimelineState getState()
           
 float getTimelinePosition()
           
 boolean isDone()
           
 void play()
           
 void playLoop(int loopCount, Timeline.RepeatBehavior repeatBehavior)
           
 void playLoop(Timeline.RepeatBehavior repeatBehavior)
           
 void playLoopSkipping(int loopCount, Timeline.RepeatBehavior repeatBehavior, long msToSkip)
           
 void playLoopSkipping(Timeline.RepeatBehavior repeatBehavior, long msToSkip)
           
 void playReverse()
           
 void playReverseSkipping(long msToSkip)
           
 void playSkipping(long msToSkip)
           
static
<T> TimelinePropertyBuilder<T>
property(String propertyName)
           
 void removeCallback(TimelineCallback callback)
           
 void replay()
           
 void replayReverse()
           
 void resetDoneFlag()
           
 void resume()
           
 void setCycleDelay(long cycleDelay)
           
 void setDuration(long durationMs)
           
 void setEase(TimelineEase ease)
           
 void setInitialDelay(long initialDelay)
           
 void setName(String name)
           
 void setSecondaryID(Comparable<?> secondaryId)
           
 boolean supportsReplay()
           
 void suspend()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

protected long id
Unique ID.

Constructor Detail

Timeline

public Timeline()

Timeline

public Timeline(Object mainTimelineObject)
Method Detail

setSecondaryID

public final void setSecondaryID(Comparable<?> secondaryId)

setDuration

public final void setDuration(long durationMs)

setInitialDelay

public final void setInitialDelay(long initialDelay)

setCycleDelay

public final void setCycleDelay(long cycleDelay)

addCallback

public final void addCallback(TimelineCallback callback)

removeCallback

public final void removeCallback(TimelineCallback callback)

property

public static <T> TimelinePropertyBuilder<T> property(String propertyName)

addPropertyToInterpolate

public final <T> void addPropertyToInterpolate(TimelinePropertyBuilder<T> propertyBuilder)

addPropertyToInterpolate

public final <T> void addPropertyToInterpolate(String propName,
                                               KeyFrames<T> keyFrames)

addPropertyToInterpolate

public final <T> void addPropertyToInterpolate(String propName,
                                               T from,
                                               T to)

play

public void play()
Specified by:
play in interface TimelineScenario.TimelineScenarioActor

playSkipping

public void playSkipping(long msToSkip)

playReverse

public void playReverse()

playReverseSkipping

public void playReverseSkipping(long msToSkip)

replay

public void replay()

replayReverse

public void replayReverse()

playLoop

public void playLoop(Timeline.RepeatBehavior repeatBehavior)

playLoopSkipping

public void playLoopSkipping(Timeline.RepeatBehavior repeatBehavior,
                             long msToSkip)

playLoop

public void playLoop(int loopCount,
                     Timeline.RepeatBehavior repeatBehavior)

playLoopSkipping

public void playLoopSkipping(int loopCount,
                             Timeline.RepeatBehavior repeatBehavior,
                             long msToSkip)

cancel

public void cancel()
Cancels this timeline. The timeline transitions to the Timeline.TimelineState.CANCELLED state, preserving its current timeline position. After application callbacks and field interpolations are done on the Timeline.TimelineState.CANCELLED state, the timeline transitions to the Timeline.TimelineState.IDLE state. Application callbacks and field interpolations are done on this state as well.

See Also:
end(), abort()

end

public void end()
Ends this timeline. The timeline transitions to the Timeline.TimelineState.DONE state, with the timeline position set to 0.0 or 1.0 - based on the direction of the timeline. After application callbacks and field interpolations are done on the Timeline.TimelineState.DONE state, the timeline transitions to the Timeline.TimelineState.IDLE state. Application callbacks and field interpolations are done on this state as well.

See Also:
cancel(), abort()

abort

public void abort()
Aborts this timeline. The timeline transitions to the Timeline.TimelineState.IDLE state. No application callbacks or field interpolations are done.

See Also:
cancel(), end()

suspend

public void suspend()

resume

public void resume()

cancelAtCycleBreak

public void cancelAtCycleBreak()
Requests that the specified timeline should stop at the end of the cycle. This method should be called only on looping timelines.


getId

protected static long getId()
Returns a unique ID.

Returns:
Unique ID.

getTimelinePosition

public final float getTimelinePosition()

getDurationFraction

public final float getDurationFraction()

getState

public final Timeline.TimelineState getState()

setEase

public final void setEase(TimelineEase ease)

isDone

public boolean isDone()
Specified by:
isDone in interface TimelineScenario.TimelineScenarioActor

supportsReplay

public boolean supportsReplay()
Specified by:
supportsReplay in interface TimelineScenario.TimelineScenarioActor

resetDoneFlag

public void resetDoneFlag()
Specified by:
resetDoneFlag in interface TimelineScenario.TimelineScenarioActor

toString

public String toString()
Overrides:
toString in class Object

getDuration

public final long getDuration()

getName

public String getName()

setName

public void setName(String name)

getMainObject

public Object getMainObject()