/**
   * animate to a given widget. If this is called while an animation is running this is a noop.
   *
   * @param w the widget to animate to
   * @param animation the animation to use
   * @param callback a callback that will be called once the animation is finished
   */
  public void goTo(Widget w, Animation animation, final AnimationEndCallback callback) {
    if (isAnimating) {
      return;
    }

    isAnimating = true;

    if (isFirst) {
      display.setFirstWidget(w);
    } else {
      display.setSecondWidget(w);
    }
    display.animate(
        animation,
        isFirst,
        new AnimationEndCallback() {

          @Override
          public void onAnimationEnd() {
            isAnimating = false;
            if (callback != null) {
              callback.onAnimationEnd();
            }
          }
        });
    isFirst = !isFirst;
  }
 /**
  * Construct an animation helper with a given display
  *
  * @param display the display to use
  */
 public AnimationHelper(AnimatableDisplay display) {
   this.display = display;
   isFirst = true;
   isAnimating = false;
   initWidget(display.asWidget());
 }