com.hdcookbook.grin.animator
Interface AnimationContext

All Known Implementing Classes:
GenericMain, GrinView

public interface AnimationContext

Interface to be implemented by an xlet or other app that uses the animation framework. This interface provides state change hooks, including initialization.

See Also:
AnimationEngine

Method Summary
 void animationFinishInitialization()
          Run the last part of initialization.
 void animationInitialize()
          Run the first part of initialization.
 

Method Detail

animationInitialize

void animationInitialize()
                         throws java.lang.InterruptedException
Run the first part of initialization. By the time this is done, all of the initXXX methods of the animation framework that need to be called should be. Notably, the animation framework should be provided with a component. This method is called as the first step in the animation thread.

If this initialization is time-consuming, it should poll AnimationEngine.destroyRequested() from time to time, and bail out if needed. A good way to do this is by calling checkDestroy().

Throws:
java.lang.InterruptedException
See Also:
AnimationEngine.destroyRequested(), AnimationEngine.checkDestroy()

animationFinishInitialization

void animationFinishInitialization()
                                   throws java.lang.InterruptedException
Run the last part of initialization. This is called by the animation thread after all of the animation clients are initialized. This is the last initialization step before running the actual animation loop. It's a good place to set the state of the UI, e.g. by calling a GRIN Show object's activateSegment() command. It might also be a reasonable place to call System.gc(), since initialization normally creates a lot of garbage, and the normal running of an xlet hopefully doesn't.

If this initialization is time-consuming, it should poll AnimationEngine.destroyRequested() from time to time, and bail out if needed. A good way to do this is by calling checkDestroy().

Throws:
java.lang.InterruptedException
See Also:
AnimationEngine.destroyRequested(), Show.activateSegment(com.hdcookbook.grin.Segment)