List of usage examples for com.google.gwt.user.client Window scrollTo
public static void scrollTo(int left, int top)
From source file:cz.filmtit.client.PageHandler.java
License:Open Source License
/** * Loads the pageToLoad. Sets pageLoaded. Uses * * @param evenIfAlreadyLoaded reload the page if already loaded *//*from w ww. j a va2 s.c o m*/ private void loadPageToLoad(boolean evenIfAlreadyLoaded) { if ((pageToLoad != pageLoaded) || evenIfAlreadyLoaded) { // unloading TranslationWorkspace if (pageLoaded == Page.TranslationWorkspace && TranslationWorkspace.getCurrentWorkspace() != null) { TranslationWorkspace.getCurrentWorkspace().setStopLoading(true); } // scroll to top if not prevented if (grabScrollToTop()) { Window.scrollTo(Window.getScrollLeft(), 0); } switch (pageToLoad) { case Blank: new Blank(); break; case ChangePassword: new ChangePassword(); break; case AuthenticationValidationWindow: new AuthenticationValidationWindow(); break; case TranslationWorkspace: if (documentId == -1) { loadPage(Page.UserPage); Gui.log("failure on loading document: documentId -1 is not valid!"); } else { new LoadDocumentFromDB(documentId); } break; case DocumentCreator: reshowCurrentDocumentCreator(); break; case UserPage: new UserPage(); break; case WelcomeScreen: new WelcomeScreen(); break; case Settings: new Settings(); break; case Help: new Help(); break; // no other situation should happen default: Gui.log("ERROR: Cannot load the page " + pageToLoad); return; } Gui.log("Loaded page " + pageToLoad); pageLoaded = pageToLoad; if (isFullPage(pageLoaded)) { // set the correct menu item Gui.getGuiStructure().activateMenuItem(pageLoaded); } } else { Gui.log("Not loading page " + pageToLoad + " because it is already loaded."); } }
From source file:cz.filmtit.client.pages.Settings.java
License:Open Source License
private void reactivate() { Window.scrollTo(Window.getScrollLeft(), 0); setUsername.setEnabled(true);/*from ww w . ja v a 2 s .c o m*/ setPassword.setEnabled(true); setPasswordRepeat.setEnabled(true); setEmail.setEnabled(true); setPermalogin.setEnabled(true); setMaxSuggestions.setEnabled(true); setUseMT.setEnabled(true); btnSave.setEnabled(true); btnReset.setEnabled(true); }
From source file:cz.filmtit.client.pages.TranslationWorkspace.java
License:Open Source License
/** * Scrolls the page so that the subgestbox isvisible to the user. *///from w w w .ja va2 s.c o m public void ensureVisible(SubgestBox subbox) { Window.scrollTo(Window.getScrollLeft(), getScrollOffsetY(subbox.getElement()) - getVideoHeight() - (Window.getClientHeight() - getVideoHeight()) * 2 / 5); }
From source file:cz.filmtit.client.pages.TranslationWorkspace.java
License:Open Source License
/** * Scrolls the page so that the subgestbox isvisible to the user. *//* w w w .j a va2s . c o m*/ public void ensureVisible(PosteditBox posteditBox) { Window.scrollTo(Window.getScrollLeft(), getScrollOffsetY(posteditBox.getElement()) - getVideoHeight() - (Window.getClientHeight() - getVideoHeight()) * 2 / 5); }
From source file:fr.putnami.pwt.doc.client.application.DocumentationDisplay.java
License:Open Source License
private void redraw(boolean autoScroll) { if (autoScroll) { String historyToken = History.getToken(); if (!Strings.isNullOrEmpty(historyToken)) { int top = this.affixMenu.getPinnedOffset(); Window.scrollTo(Window.getScrollLeft(), top); } else {/* w w w . j av a2 s . c o m*/ Window.scrollTo(Window.getScrollLeft(), 0); } } }
From source file:gov.wa.wsdot.apps.analytics.client.activities.twitter.view.search.SearchView.java
License:Open Source License
@UiHandler("backToSearchTopBtn") public void onBackToTop(ClickEvent e) { Window.scrollTo(0, 0); }
From source file:gov.wa.wsdot.apps.analytics.client.activities.twitter.view.tweets.TweetsView.java
License:Open Source License
@UiHandler("backToTweetTopBtn") protected void onBackToTop(ClickEvent e) { Window.scrollTo(0, 0); }
From source file:ilarkesto.gwt.client.desktop.Desktop.java
License:Open Source License
public static void showWorkspace(Workspace workspace) { if (sidebar != null) sidebar.hide();/*from w w w .j a v a 2 s . co m*/ RootPanel workspaceContainer = RootPanel.get("workspaceContainer"); workspaceContainer.clear(); RootPanel titleContainer = RootPanel.get("titleContainer"); titleContainer.clear(); RootPanel actionbarContainer = RootPanel.get("actionbarContainer"); actionbarContainer.clear(); Window.scrollTo(0, 0); titleContainer.add(workspace.getTitleWidget()); workspaceContainer.add(workspace.getContentWrapper()); actionbarContainer.add(workspace.getActionbar()); Window.setTitle(workspace.getTitleText() + " - GOON28"); }
From source file:ilarkesto.gwt.client.SwitcherWidget.java
License:Open Source License
public <W extends Widget> W show(W widget) { if (currentWidget == widget) return widget; currentWidget = widget;/*from w w w. j av a 2s . c o m*/ replaceContent(currentWidget); update(); Window.scrollTo(0, 0); return widget; }
From source file:jetbrains.jetpad.projectional.domUtil.Scrolling.java
License:Apache License
public static void scrollTo(Rectangle rect, Element element) { rect = rect.intersect(new Rectangle(0, 0, element.getScrollWidth(), element.getScrollHeight())); adjustScrollers(rect, element);//w w w.j a v a2 s.com Rectangle visibleArea = new Rectangle(getScrollX(), getScrollY(), getScrollWidth(), getScrollHeight()); Rectangle elementBounds = getBounds(element); Rectangle bounds = new Rectangle(elementBounds.origin.add(rect.origin), rect.dimension); if (!visibleArea.contains(bounds)) { // are we sure about this? int top = element.getAbsoluteTop() + rect.origin.y; int left = element.getAbsoluteLeft() + rect.origin.x; int width = rect.dimension.x; int height = rect.dimension.y; int winTop = getScrollY(); int winLeft = getScrollX(); int winWidth = getScrollWidth(); int winHeigh = getScrollHeight(); int deltaX = getScrollAdjustment(new Interval(winLeft, winLeft + winWidth), new Interval(left, left + width), winLeft); int deltaY = getScrollAdjustment(new Interval(winTop, winTop + winHeigh), new Interval(top, top + height), winTop); if (deltaX != 0 || deltaY != 0) { Window.scrollTo(winLeft + deltaX, winTop + deltaY); } } }