use of com.google.gwt.animation.client.Animation in project rstudio by rstudio.
the class SlideLabel method hide.
public void hide(final Command executeOnComplete) {
stopCurrentAnimation();
final int height = curtain_.getOffsetHeight();
currentAnimation_ = new Animation() {
@Override
protected void onUpdate(double progress) {
setHeight(height * (1 - progress));
}
@Override
protected void onComplete() {
currentAnimation_ = null;
super.onComplete();
setVisible(false);
if (executeOnComplete != null)
executeOnComplete.execute();
}
};
currentAnimation_.run(ANIM_MILLIS);
}
use of com.google.gwt.animation.client.Animation in project rstudio by rstudio.
the class PaneManager method horizontalResizeAnimation.
private Animation horizontalResizeAnimation(final double start, final double end, final Command afterComplete) {
return new Animation() {
@Override
protected void onUpdate(double progress) {
double size = (1 - progress) * start + progress * end;
panel_.setWidgetSize(right_, size);
}
@Override
protected void onStart() {
isAnimating_ = true;
super.onStart();
}
@Override
protected void onComplete() {
isAnimating_ = false;
panel_.onSplitterResized(new SplitterResizedEvent());
super.onComplete();
if (afterComplete != null)
afterComplete.execute();
}
};
}
use of com.google.gwt.animation.client.Animation in project kie-wb-common by kiegroup.
the class ShowcaseEntryPoint method hideLoadingPopup.
// Fade out the "Loading application" pop-up
private void hideLoadingPopup() {
final Element e = RootPanel.get("loading").getElement();
new Animation() {
@Override
protected void onUpdate(double progress) {
e.getStyle().setOpacity(1.0 - progress);
}
@Override
protected void onComplete() {
e.getStyle().setVisibility(Style.Visibility.HIDDEN);
}
}.run(500);
}
use of com.google.gwt.animation.client.Animation in project webprotege by protegeproject.
the class DiscussionThreadListViewImpl method hideDiscussionThreadView.
@Override
public void hideDiscussionThreadView(DiscussionThreadView threadView) {
if (threadViews.remove(threadView)) {
Animation animation = new Animation() {
@Override
protected void onUpdate(double progress) {
double opacity = 1 - (progress);
final Element element = threadView.asWidget().getElement();
element.getStyle().setOpacity(opacity);
final double height = element.getClientHeight();
if (progress == 1) {
Animation slideAnimation = new Animation() {
@Override
protected void onUpdate(double progress) {
double slideHeight = height * (1 - progress);
element.getStyle().setHeight((int) slideHeight, Style.Unit.PX);
if (progress == 1) {
threadContainer.remove(threadView);
}
}
};
slideAnimation.run(500);
}
}
};
animation.run(400);
}
}
use of com.google.gwt.animation.client.Animation in project rstudio by rstudio.
the class DocTabLayoutPanel method ensureSelectedTabIsVisible.
public void ensureSelectedTabIsVisible(boolean animate) {
if (currentAnimation_ != null) {
currentAnimation_.cancel();
currentAnimation_ = null;
}
Element selectedTab = (Element) DomUtils.findNode(getElement(), true, false, new NodePredicate() {
public boolean test(Node n) {
if (n.getNodeType() != Node.ELEMENT_NODE)
return false;
return ((Element) n).getClassName().contains("gwt-TabLayoutPanelTab-selected");
}
});
if (selectedTab == null) {
return;
}
selectedTab = selectedTab.getFirstChildElement().getFirstChildElement();
Element tabBar = getTabBarElement();
if (!isVisible() || !isAttached() || tabBar.getOffsetWidth() == 0)
// not yet loaded
return;
final Element tabBarParent = tabBar.getParentElement();
final int start = tabBarParent.getScrollLeft();
int end = DomUtils.ensureVisibleHoriz(tabBarParent, selectedTab, padding_, padding_ + rightMargin_, true);
// When tabs are closed, the overall width shrinks, and this can lead
// to cases where there's too much empty space on the screen
Node lastTab = getLastChildElement(tabBar);
if (lastTab == null || lastTab.getNodeType() != Node.ELEMENT_NODE)
return;
int edge = DomUtils.getRelativePosition(tabBarParent, Element.as(lastTab)).x + Element.as(lastTab).getOffsetWidth();
end = Math.min(end, Math.max(0, edge - (tabBarParent.getOffsetWidth() - rightMargin_)));
if (edge <= tabBarParent.getOffsetWidth() - rightMargin_)
end = 0;
if (start != end) {
if (!animate) {
tabBarParent.setScrollLeft(end);
} else {
final int finalEnd = end;
currentAnimation_ = new Animation() {
@Override
protected void onUpdate(double progress) {
double delta = (finalEnd - start) * progress;
tabBarParent.setScrollLeft((int) (start + delta));
}
@Override
protected void onComplete() {
if (this == currentAnimation_) {
tabBarParent.setScrollLeft(finalEnd);
currentAnimation_ = null;
}
}
};
currentAnimation_.run(Math.max(200, Math.min(1500, Math.abs(end - start) * 2)));
}
}
}
Aggregations