Class Animator
- java.lang.Object
-
- ej.mwt.animation.Animator
-
public class Animator extends java.lang.ObjectAn animator executes animations as fast as possible.The animator loops on:
- retrieve the current time with
Util.platformTimeMillis(), - call the
Animation.tick(long)of all the registered animations, - wait for the end of the flush,
- start again while at least one animation is running.
Only one animator can be running at any time.
- retrieve the current time with
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceAnimator.AnimatorListenerListener for animator events.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEBUG_ANIMATOR_ENABLED_CONSTANTBON boolean constantto enable/disable the animator debug.static java.lang.StringDEBUG_ANIMATOR_MONITOR_CONSTANTBON Class constantto set the animator monitor.
-
Constructor Summary
Constructors Constructor Description Animator()Creates an animator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidindicateRenderRequested()Indicates to this animator that a render has been requested.voidstartAnimation(Animation animation)Starts an animation.voidstopAllAnimations()Stops all the animations.voidstopAnimation(Animation animation)Stops an animation.
-
-
-
Field Detail
-
DEBUG_ANIMATOR_ENABLED_CONSTANT
public static final java.lang.String DEBUG_ANIMATOR_ENABLED_CONSTANT
BON boolean constantto enable/disable the animator debug.If enabled, "ej.mwt.debug.animator.monitor" must also be set.
- See Also:
- Constant Field Values
-
DEBUG_ANIMATOR_MONITOR_CONSTANT
public static final java.lang.String DEBUG_ANIMATOR_MONITOR_CONSTANT
BON Class constantto set the animator monitor.Set it to the FQN of an implementation of
Animator.AnimatorListenerto monitor the animator.- See Also:
- Constant Field Values
-
-
Method Detail
-
startAnimation
public void startAnimation(Animation animation)
Starts an animation.The animation tick method is then called every period.
If the animation is already started, nothing is done.
- Parameters:
animation- the animation to start.- See Also:
Animation.tick(long)
-
stopAnimation
public void stopAnimation(Animation animation)
Stops an animation.The tick method of the given animation will not be called anymore by this animator.
This method must be called in the MicroUI thread.
- Parameters:
animation- the animation to stop.- Throws:
java.lang.IllegalStateException- if this method is called in an other thread than the MicroUI thread or during an animation tick.
-
stopAllAnimations
public void stopAllAnimations()
Stops all the animations.The tick method of every animation will not be called anymore by this animator.
This method must be called in the MicroUI thread.
- Throws:
java.lang.IllegalStateException- if this method is called in an other thread than the MicroUI thread or during an animation tick.
-
indicateRenderRequested
public void indicateRenderRequested()
Indicates to this animator that a render has been requested.Calling this method is only useful if the
DEBUG_ANIMATOR_ENABLED_CONSTANTconstant is enabled.This method is called automatically when a render of a widget or of a desktop is requested. This method can be called manually if the animator is used to render something else.
-
-