onUpdate(interpolate(progress)); return isRunning(curRunId); // Check if this run was canceled. onStart(); if (!isRunning(curRunId)) { onComplete(); return false;
/** * Immediately run this animation. If the animation is already running, it * will be canceled first. * <p> * This is equivalent to <code>run(duration, null)</code>. * * @param duration the duration of the animation in milliseconds * @see #run(int, Element) */ public void run(int duration) { run(duration, null); }
/** * Run this animation at the given startTime. If the startTime has already * passed, the animation will run synchronously as if it started at the * specified start time. If the animation is already running, it will be * canceled first. * <p> * If the element is not <code>null</code>, the {@link #onUpdate(double)} * method might be called only if the element may be visible (generally left * at the appreciation of the browser). Otherwise, it will be called * unconditionally. * * @param duration the duration of the animation in milliseconds * @param startTime the synchronized start time in milliseconds * @param element the element that visually bounds the entire animation */ public void run(int duration, double startTime, Element element) { // Cancel the animation if it is running cancel(); // Save the duration and startTime isRunning = true; isStarted = false; this.duration = duration; this.startTime = startTime; this.element = element; ++runId; // Execute the first callback. callback.execute(Duration.currentTimeMillis()); }
/** * Called immediately before the animation starts. */ protected void onStart() { onUpdate(interpolate(0.0)); }
@Override protected void onStart() { super.onStart(); if (opening) { curPanel.contentWrapper.setVisible(true); // Special treatment on the visible case to ensure LazyPanel works curPanel.getContent().setVisible(true); } }
/** * Called immediately after the animation is canceled. The default * implementation of this method calls {@link #onComplete()} only if the * animation has actually started running. */ protected void onCancel() { if (wasStarted) { onComplete(); } }
/** * Immediately cancel this animation. If the animation is running or is * scheduled to run, {@link #onCancel()} will be called. */ public void cancel() { // Ignore if the animation is not currently running. if (!isRunning) { return; } // Reset the state. wasStarted = isStarted; // Used by onCancel. element = null; isRunning = false; isStarted = false; // Cancel the animation request. if (requestHandle != null) { requestHandle.cancel(); requestHandle = null; } onCancel(); }
@Override public double interpolate(double progress) { return super.interpolate(progress); }
@Override protected void onStart() { offsetHeight = curPanel.getOffsetHeight(); offsetWidth = curPanel.getOffsetWidth(); curPanel.getElement().getStyle().setProperty("overflow", "hidden"); super.onStart(); }
/** * Called immediately after the animation is canceled. The default * implementation of this method calls {@link #onComplete()} only if the * animation has actually started running. */ protected void onCancel() { if (wasStarted) { onComplete(); } }
/** Fades in the element after the glass is already showing; call when the content is ready. */ public void fadeInElement() { if (a != null) { a.cancel(); } a = new Animation() { protected void onUpdate(final double progress) { getElement().getStyle().setOpacity(progress); } }; a.run(200); // ANIMATION_DURATION is private }
/** * Called immediately after the animation completes. */ protected void onComplete() { onUpdate(interpolate(1.0)); }
@Override public void onCancel() { super.onCancel(); }
@Override public double interpolate(double progress) { return super.interpolate(progress); }
onUpdate(interpolate(progress)); return isRunning(curRunId); // Check if this run was canceled. onStart(); if (!isRunning(curRunId)) { onComplete(); return false;
@Override protected void onStart() { scrollHeight = 0; // If the TreeItem is already open, we can get its scrollHeight // immediately. if (!opening) { scrollHeight = curItem.childSpanElem.getScrollHeight(); } curItem.childSpanElem.getStyle().setProperty("overflow", "hidden"); // If the TreeItem is already open, onStart will set its height to its // natural height. If the TreeItem is currently closed, onStart will set // its height to 1px (see onUpdate below), and then we make the TreeItem // visible so we can get its correct scrollHeight. super.onStart(); // If the TreeItem is currently closed, we need to make it visible before // we can get its height. if (opening) { UIObject.setVisible(curItem.childSpanElem, true); scrollHeight = curItem.childSpanElem.getScrollHeight(); } }
/** * Called immediately after the animation is canceled. The default * implementation of this method calls {@link #onComplete()} only if the * animation has actually started running. */ protected void onCancel() { if (wasStarted) { onComplete(); } }
/** * Run this animation at the given startTime. If the startTime has already * passed, the animation will run synchronously as if it started at the * specified start time. If the animation is already running, it will be * canceled first. * <p> * This is equivalent to <code>run(duration, startTime, null)</code>. * * @param duration the duration of the animation in milliseconds * @param startTime the synchronized start time in milliseconds * @see #run(int, double, Element) */ public void run(int duration, double startTime) { run(duration, startTime, null); }