public abstract class SeriesTransition
- Object
- SeriesTransition
ImplementsAnimation
Known subtypesXYMultiSeriesTransition, XYSeriesTransition, XYValueSeriesTransition
A base class for series transitions of ChartComponent. This should be
overridden by concrete classes that implement the update(int) method
to update the chart’s model and renderer appropriately. This class can serve
as a buffer for changes to the model so that they don’t affect the ChartComponent
immediately. Changes can either be eased in using animateChart() or updated
in one shot using updateChart().
Fields
public static final int EASING_LINEAR = 1 | |
public static final int EASING_IN = 2 | |
public static final int EASING_OUT = 3 | |
public static final int EASING_IN_OUT = 4 |
Constructors
public SeriesTransition(ChartComponent chart) | |
public SeriesTransition(ChartComponent chart, int easing) | |
public SeriesTransition(ChartComponent chart, int easing, int duration) |
Methods
protected void initTransition() | Initializes the transition for another iteration. |
protected void cleanup() | Cleans up any settings in the transition. |
protected abstract void update(int progress) | Updates the renderer and model at the specified progress position of the animation. |
public boolean animate() | Allows the animation to reduce “repaint” calls when it returns false. |
public void paint(Graphics g) | Draws the animation, within a component the standard paint method would be invoked since it bares the exact same signature. |
public ChartComponent getChart() | Gets the ChartComponent that is the subject of the transition. |
public void setChart(ChartComponent chart) | Sets the ChartComponent that is the subject of the transition. |
public int getDuration() | Gets the duration of the transition. |
public void setDuration(int duration) | Sets the duration of the transition in milliseconds. |
public int getEasing() | Gets the type of easing used in the transition. |
public void setEasing(int easing) | Sets the type of easing used in the transition. |
public void animateChart() | Applies all pending changes to the chart model and renderer using the current animation settings. |
public void updateChart() | Applies all pending changes to the chart model and renderer and repaints the chart. |
Inherited methods
Field details
EASING_LINEAR
public static final int EASING_LINEAR = 1EASING_IN
public static final int EASING_IN = 2EASING_OUT
public static final int EASING_OUT = 3EASING_IN_OUT
public static final int EASING_IN_OUT = 4Constructor details
SeriesTransition
public SeriesTransition(ChartComponent chart)SeriesTransition
public SeriesTransition(ChartComponent chart, int easing)SeriesTransition
public SeriesTransition(ChartComponent chart, int easing, int duration)Method details
initTransition
protected void initTransition()Initializes the transition for another iteration. This can be overridden
by subclasses to provide their own initialization. This method
will be called just prior to the transition taking place.
IMPORTANT: Subclasses must make sure to call super.initTransition()
so that the animation will be initialized properly.
cleanup
protected void cleanup()Cleans up any settings in the transition. Called after a transition
is complete. This is meant to be overridden by subclasses.
update
protected abstract void update(int progress)Updates the renderer and model at the specified progress position of
the animation. Meant to be overridden by subclasses.
Parameters
progressint- The progress of the animation (between 0 and 100).
animate
public boolean animate()Allows the animation to reduce “repaint” calls when it returns false. It is
called once for every frame. Frames are defined by the
com.codename1.ui.Display class.Returns
true if a repaint is desired or false if no repaint is necessary
paint
public void paint(Graphics g)Draws the animation, within a component the standard paint method would be
invoked since it bares the exact same signature.
Parameters
gGraphics- graphics context
getChart
public ChartComponent getChart()Gets the ChartComponent that is the subject of the transition.
Returns
the chart
setChart
public void setChart(ChartComponent chart)Sets the ChartComponent that is the subject of the transition.
Parameters
chartChartComponent- the chart to set
getDuration
public int getDuration()Gets the duration of the transition. (in milliseconds)
Returns
the duration
setDuration
public void setDuration(int duration)Sets the duration of the transition in milliseconds.
Parameters
durationint- the duration to set
getEasing
public int getEasing()Gets the type of easing used in the transition. Should be one of
EASING_LINEAR, EASING_IN, EASING_OUT, or EASING_IN_OUT.
Returns
the easing
setEasing
public void setEasing(int easing)Sets the type of easing used in the transition. Should be one of
EASING_LINEAR, EASING_IN, EASING_OUT, or EASING_IN_OUT.
Parameters
easingint- the easing to set
animateChart
public void animateChart()Applies all pending changes to the chart model and renderer using the
current animation settings.
updateChart
public void updateChart()Applies all pending changes to the chart model and renderer and repaints
the chart. This is basically like calling animateChart() with a duration
of 0.