ca.sqlpower.wabit.swingui.chart.effect
Class AbstractChartAnimator

java.lang.Object
  extended by ca.sqlpower.wabit.swingui.chart.effect.AbstractChartAnimator
All Implemented Interfaces:
ChartAnimator
Direct Known Subclasses:
BarChartAnimator, PieChartAnimator, ScatterChartAnimator

public abstract class AbstractChartAnimator
extends java.lang.Object
implements ChartAnimator

Base class that takes care of all the boilerplate code required for a typical implementation of ChartAnimator.


Constructor Summary
AbstractChartAnimator(int frameCount, int frameDelay)
          Sets up the support infrastructure for a chart animator.
 
Method Summary
protected abstract  void doFrame(int frame, double pct)
          Subclasses define their actual animation behaviour by overriding this method.
 int getFrameCount()
           
protected  void setup()
          Subclasses that wish to perform some setup action whenever the animation starts or restarts may override this method.
 void startAnimation()
          Resets all bars to 0 then starts the animation timer.
 void stopAnimation()
          Stops the animation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractChartAnimator

public AbstractChartAnimator(int frameCount,
                             int frameDelay)
Sets up the support infrastructure for a chart animator.

Parameters:
frameCount - Total number of frames before the animation completes
frameDelay - Amount of time (milliseconds) between each frame.
Method Detail

doFrame

protected abstract void doFrame(int frame,
                                double pct)
Subclasses define their actual animation behaviour by overriding this method.

Parameters:
frame - The current frame number (of getFrameCount())
pct - The percentage (between 0.0 and 1.0 inclusive) of the way that the current frame is.

startAnimation

public final void startAnimation()
Description copied from interface: ChartAnimator
Resets all bars to 0 then starts the animation timer. If the animation is already running, this method causes it to restart from the beginning.

Specified by:
startAnimation in interface ChartAnimator

setup

protected void setup()
Subclasses that wish to perform some setup action whenever the animation starts or restarts may override this method. It is called from startAnimation() before the invocation of doFrame(int, double) with a frame number of 0.


stopAnimation

public final void stopAnimation()
Description copied from interface: ChartAnimator
Stops the animation. The animation does stop on its own eventually, but this method can be invoked to stop the animation early. If the animation is already stopped, this method has no effect.

Specified by:
stopAnimation in interface ChartAnimator

getFrameCount

public int getFrameCount()


Copyright © 2009. All Rights Reserved.