public class

SeriesAnimator

extends Object
java.lang.Object
   ↳ com.shinobicontrols.charts.SeriesAnimator

Class Overview

Helper class for showing, hiding, adding and removing Series to and from the ShinobiChart with time-based animations. It handles creating the necessary animations as well as performing the required operation on the Series and/or ShinobiChart, for example, addSeries(Series) to actually add the Series.

Where a Series is stacked, all Series in the relevant stacking group will perform the exit Animation created by the given SeriesAnimationCreator before the series is shown, hidden, added or removed. Afterwards the remaining Series, minus any hidden or removed ones, will perform the entry Animation as created by the given SeriesAnimationCreator.

While a Series is animating, any further requested operations on it or any other Series in the same stacking group will be ignored. The animating status of a Series can be queried using the isAnimating(Series) method.

Summary

Nested Classes
interface SeriesAnimator.Listener Provides an opportunity to be notified at the beginning and end of the Animation that is run as a result of any operation performed by the SeriesAnimator, such as the adding, removing, hiding and showing of a Series
Constants
long DEFAULT_SERIES_ANIMATION_DURATION The default duration for a Series animation, in milliseconds.
Public Methods
void addListener(SeriesAnimator.Listener listener)
Adds a SeriesAnimator.Listener to this SeriesAnimator's list of listeners to inform of the start and end of any animated show, hide, add or remove operation.
void addSeries(Series<?> series)
Adds the specified Series to the ShinobiChart, applying the entry animation from the default SeriesAnimationCreator for the Series type.
void addSeries(SeriesAnimationCreator<?, ?> seriesAnimationCreator, long duration, Series<?> series, Axis<? extends Comparable<?>, ?> xAxis, Axis<? extends Comparable<?>, ?> yAxis)
Adds the specified Series to the ShinobiChart, applying the entry animation defined by the given SeriesAnimationCreator.
boolean isAnimating(Series<?> series)
Whether this SeriesAnimator is currently animating the given Series.
void removeListener(SeriesAnimator.Listener listener)
Removes the given SeriesAnimator.Listener from this SeriesAnimator's list of listeners to inform of the start and end of any animated show, hide, add or remove operation.
void removeSeries(Series<?> series)
Removes the specified Series from the ShinobiChart, applying the exit animation from the default SeriesAnimationCreator for the Series type.
void removeSeries(SeriesAnimationCreator<?, ?> seriesAnimationCreator, long duration, Series<?> series)
Removes the specified Series from the ShinobiChart, applying the exit animation defined by the given SeriesAnimationCreator.
void setVisibility(int intendedVisibility, SeriesAnimationCreator<?, ?> seriesAnimationCreator, long duration, Series<?> series, Series...<?> otherSeries)
Sets the visibility of the specified Series, applying the entry or exit animation defined by the given SeriesAnimationCreator.
void setVisibility(int intendedVisibility, Series<?> series, Series...<?> otherSeries)
Sets the visibility of the specified Series, applying the entry or exit animation from the default SeriesAnimationCreator for the Series type.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final long DEFAULT_SERIES_ANIMATION_DURATION

The default duration for a Series animation, in milliseconds.

Constant Value: 2400 (0x0000000000000960)

Public Methods

public void addListener (SeriesAnimator.Listener listener)

Adds a SeriesAnimator.Listener to this SeriesAnimator's list of listeners to inform of the start and end of any animated show, hide, add or remove operation. Passing in a null listener will result in an IllegalArgumentException.

Parameters
listener the SeriesAnimator.Listener to add, must not be null

public void addSeries (Series<?> series)

Adds the specified Series to the ShinobiChart, applying the entry animation from the default SeriesAnimationCreator for the Series type. The Series will be associated with the primary x and primary y axes of the ShinobiChart.

Where any of the Series are stacked, all Series in the same stacking group first perform the exit animation defined by the default SeriesAnimationCreator for the Series type before performing the entry animation with the relevant Series now visible.

The DEFAULT_SERIES_ANIMATION_DURATION will be applied to both the entry and exit animations.

Passing in a null Series will cause an IllegalArgumentException to be thrown.

If you wish to be informed of the animation beginning and ending, add a SeriesAnimator.Listener via the addListener(Listener) method.

Note that isHidden() will return true as soon as the Series begins animating into view.

Parameters
series the Series to add, must not be null

public void addSeries (SeriesAnimationCreator<?, ?> seriesAnimationCreator, long duration, Series<?> series, Axis<? extends Comparable<?>, ?> xAxis, Axis<? extends Comparable<?>, ?> yAxis)

Adds the specified Series to the ShinobiChart, applying the entry animation defined by the given SeriesAnimationCreator. The Series will be associated with the given x and y axes.

Where any of the Series are stacked, all Series in the same stacking group first perform the exit animation defined by the SeriesAnimationCreator before performing the entry animation with the relevant Series now visible.

It is assumed that the createEntryAnimation(Series) will animate a Series from being completely hidden to fully visible and that createExitAnimation(Series) will animate a Series from being fully visible to completely hidden. While a custom SeriesAnimationCreator may be created that does not conform to the above, it may create undesirable visual effects when the Series is added, such as suddenly appearing instead of gradually animating in.

The specified duration will be applied to both the entry and exit animations and should be greater than zero; negative values will be coerced to zero.

All other arguments to this method must not be null otherwise an IllegalArgumentException will be thrown.

If you wish to be informed of the animation beginning and ending, add a SeriesAnimator.Listener via the addListener(Listener) method.

Note that isHidden() will return true as soon as the Series begins animating into view.

Parameters
seriesAnimationCreator the SeriesAnimationCreator that defines how the Series animate into and out of view, must not be null
duration the duration of the entry and exit animations, in milliseconds
series the Series to add, must not be null
xAxis the x Axis to associate the Series to add to, must not be null
yAxis the y Axis to associate the Series to add to, must not be null

public boolean isAnimating (Series<?> series)

Whether this SeriesAnimator is currently animating the given Series.

Parameters
series the Series to check if it is animating
Returns

public void removeListener (SeriesAnimator.Listener listener)

Removes the given SeriesAnimator.Listener from this SeriesAnimator's list of listeners to inform of the start and end of any animated show, hide, add or remove operation.

Parameters
listener the SeriesAnimator.Listener to remove

public void removeSeries (Series<?> series)

Removes the specified Series from the ShinobiChart, applying the exit animation from the default SeriesAnimationCreator for the Series type.

Where any of the Series are stacked, all Series in the same stacking group first perform the exit animation defined by the default SeriesAnimationCreator for the Series type before performing the entry animation with the relevant Series removed.

The DEFAULT_SERIES_ANIMATION_DURATION will be applied to both the entry and exit animations.

If you wish to be informed of the animation beginning and ending, add a SeriesAnimator.Listener via the addListener(Listener) method.

Note that isHidden() will return false only when the Series has animated fully out of view.

Parameters
series the Series to be removed, must not be null

public void removeSeries (SeriesAnimationCreator<?, ?> seriesAnimationCreator, long duration, Series<?> series)

Removes the specified Series from the ShinobiChart, applying the exit animation defined by the given SeriesAnimationCreator.

Where any of the Series are stacked, all Series in the same stacking group first perform the exit animation defined by the SeriesAnimationCreator before performing the entry animation with the relevant Series removed.

It is assumed that the createEntryAnimation(Series) will animate a Series from being completely hidden to fully visible and that createExitAnimation(Series) will animate a Series from being fully visible to completely hidden. While a custom SeriesAnimationCreator may be created that does not conform to the above, it may create undesirable visual effects when the Series is removed, such as suddenly disappearing instead of gradually animating out.

The specified duration will be applied to both the entry and exit animations and should be greater than zero; negative values will be coerced to zero.

Passing in null for any of the arguments to this method will cause an IllegalArgumentException to be thrown.

If you wish to be informed of the animation beginning and ending, add a SeriesAnimator.Listener via the addListener(Listener) method.

Note that isHidden() will return false only when the Series has animated fully out of view.

Parameters
seriesAnimationCreator the SeriesAnimationCreator that defines how the Series animate into and out of view, must not be null
duration the duration of the entry and exit animations, in milliseconds
series the Series to remove, must not be null

public void setVisibility (int intendedVisibility, SeriesAnimationCreator<?, ?> seriesAnimationCreator, long duration, Series<?> series, Series...<?> otherSeries)

Sets the visibility of the specified Series, applying the entry or exit animation defined by the given SeriesAnimationCreator.

Where any of the Series are stacked, all Series in the same stacking group first perform the exit animation defined by the SeriesAnimationCreator before performing the entry animation with the relevant Series now visible, invisible or gone.

It is assumed that the createEntryAnimation(Series) method will animate a Series from being completely hidden to fully visible and that createExitAnimation(Series) will animate a Series from being fully visible to completely hidden. While a custom SeriesAnimationCreator may be created that does not conform to the above, it may create undesirable visual effects when the Series are set to be visible, such as suddenly appearing instead of gradually animating in.

There must be a least one non-null Series specified, though it is possible to set the visibility of multiple Series at the same time. The specified duration will be applied to both the entry and exit animations and should be greater than zero; negative values will be coerced to zero.

Passing in null for any of the reference type arguments to this method will cause an IllegalArgumentException to be thrown.

If you wish to be informed of the animation beginning and ending, add a SeriesAnimator.Listener via the addListener(Listener) method.

Note that when setting a Series to VISIBLE, calling getVisibility() will return VISIBLE as soon as the Series begins animating into view. When setting a to {@link Series#INVISIBLE or GONE, calling getVisibility() will return INVISIBLE or GONE respectively only when the Series has animated fully out of view.

Parameters
intendedVisibility the visibility status to set on the Series, must be VISIBLE, INVISIBLE or GONE
seriesAnimationCreator the SeriesAnimationCreator that defines how the Series animate into and out of view, must not be null
duration the duration of the entry and exit animations, in milliseconds
series the Series to set its visibility, must not be null
otherSeries any additional Series to set their visibility, optional but must not be null

public void setVisibility (int intendedVisibility, Series<?> series, Series...<?> otherSeries)

Sets the visibility of the specified Series, applying the entry or exit animation from the default SeriesAnimationCreator for the Series type.

Where any of the Series are stacked, all Series in the same stacking group first perform the exit animation defined by the default SeriesAnimationCreator for the Series type before performing the entry animation with the relevant Series now visible, invisible or gone.

There must be a least one non-null Series specified, though it is possible to set the visibility of multiple Series at the same time. The DEFAULT_SERIES_ANIMATION_DURATION will be applied to both the entry and exit animations.

If you wish to be informed of the animation beginning and ending, add a SeriesAnimator.Listener via the addListener(Listener) method.

Note that when setting a Series to VISIBLE, calling getVisibility() will return VISIBLE as soon as the Series begins animating into view. When setting a to {@link Series#INVISIBLE or GONE, calling getVisibility() will return INVISIBLE or GONE respectively only when the Series has animated fully out of view.

Parameters
intendedVisibility the visibility status to set on the Series, must be VISIBLE, INVISIBLE or GONE
series the Series to set its visibility, must not be null
otherSeries any additional Series to set their visibility, optional but must not be null