///////////////////////////////////////////////////////////////////////////////////////// // METHODS ///////////////////////////////////////////////////////////////////////////////////////// public void fade(final int duration, final double targetOpacity) { double theTargetOpacity = 0.0; if (targetOpacity > 1.0) { theTargetOpacity = 1.0; } else if (targetOpacity < 0.0) { theTargetOpacity = 0.0; } else { theTargetOpacity = targetOpacity; } _targetOpacity = theTargetOpacity; String opacityStr = _element.getStyle().getOpacity(); try { _baseOpacity = new BigDecimal(opacityStr).doubleValue(); _opacityIncrement = targetOpacity - _baseOpacity; super.run(duration); } catch (NumberFormatException nfEx) { this.onComplete(); // set opacity directly } }
// Fade out the "Loading application" pop-up private void hideLoadingPopup() { final Element e = RootPanel.get("loading").getElement(); Animation r = new Animation() { @Override protected void onUpdate(double progress) { e.getStyle().setOpacity(1.0 - progress); } @Override protected void onComplete() { e.getStyle().setVisibility(Visibility.HIDDEN); } }; r.run(500); }