LOG.log(Level.SPAM, "Setting new widget:" + this.toWidget.getUIObject(), null);
this.add((Widget) this.toWidget.getUIObject());
}
//GWT.log( "Setting widget "+ w.toString(), null );
final PositionWrapper nextWidget = new PositionWrapper(w);
nextWidget.setPosition("relative");
String high = "100%";
String low = "0%";
if ((this.currentWidget != null) &&
this.getDirection().equals(SlideTransitionSimplePanel.VERTICAL)) {
high = "0px";
low = "-" + currentWidget.getUIObject().getOffsetHeight() + "px";
}
this.currentAnimator = new PropertyAnimator(nextWidget,
this.getDirection(), high, low, this.getMutationStrategy(),
1000,
new AnimationFinishedCallback() {
public void onFailure(PropertyAnimator animator, Exception e) {
currentAnimator = null;
clear();
add(w);
currentWidget = nextWidget;
toWidget = null;
}
public void onFinish(PropertyAnimator animator) {
currentWidget = nextWidget;
toWidget = null;
nextWidget.setTop("0px");
currentAnimator = null;
}
});
if (currentWidget != null) {
final Widget oldWidget = (Widget) currentWidget.getUIObject();
int totalOffset = this.currentWidget.getUIObject().getOffsetHeight() +
Dimensions.INSTANCE.getTotalVerticalMargin(this.currentWidget.getUIObject()
.getElement());
Logger.getAnonymousLogger().log( Level.SPAM, "Total offset " + totalOffset, null);
if (this.getDirection().equals(SlideTransitionSimplePanel.HORIZONTAL)) {
nextWidget.setTop("-" + totalOffset + "px");
}
PropertyAnimator old = new PropertyAnimator(currentWidget,
this.getDirection(), "0%", "-100%",
this.getMutationStrategy(), 1000,
new AnimationFinishedCallback() {
public void onFailure(PropertyAnimator animator,
Exception e) {
Logger.getAnonymousLogger().log( Level.INFO, "Exception animating transition", e);
}
public void onFinish(PropertyAnimator animator) {
base.remove(oldWidget);
if (getDirection()
.equals(SlideTransitionSimplePanel.HORIZONTAL)) {
nextWidget.setTop("0px");
}
}
});
old.start();
}
this.toWidget = nextWidget;
this.currentAnimator.start();
this.base.add(w);
if (this.getDirection().equals(SlideTransitionSimplePanel.HORIZONTAL)) {
nextWidget.setLeft("101%");
}
}