Example usage for com.google.gwt.user.client Window scrollTo

List of usage examples for com.google.gwt.user.client Window scrollTo

Introduction

In this page you can find the example usage for com.google.gwt.user.client Window scrollTo.

Prototype

public static void scrollTo(int left, int top) 

Source Link

Usage

From source file:org.unitime.timetable.gwt.client.solver.SolutionReportsPage.java

License:Apache License

public static void __search() {
    final int left = Window.getScrollLeft();
    final int top = Window.getScrollTop();
    SolutionReportsPage page = (SolutionReportsPage) RootPanel.get("UniTimeGWT:Body").getWidget(0);
    page.init(new AsyncCallback<Boolean>() {
        @Override/*from  www .j  a va2 s. c  o m*/
        public void onFailure(Throwable caught) {
        }

        @Override
        public void onSuccess(Boolean result) {
            if (result)
                Window.scrollTo(left, top);
        }
    });
}

From source file:org.unitime.timetable.gwt.client.solver.TimetablePage.java

License:Apache License

public static void __search() {
    final int left = Window.getScrollLeft();
    final int top = Window.getScrollTop();
    TimetablePage page = (TimetablePage) RootPanel.get("UniTimeGWT:Body").getWidget(0);
    page.search(new AsyncCallback<Boolean>() {
        @Override//from  w  ww . ja v a 2 s  . co m
        public void onFailure(Throwable caught) {
        }

        @Override
        public void onSuccess(Boolean result) {
            if (result)
                Window.scrollTo(left, top);
        }
    });
}

From source file:org.unitime.timetable.gwt.client.widgets.mobile.MobileUniTimeFrameDialogImpl.java

License:Apache License

public MobileUniTimeFrameDialogImpl() {
    iPopup = new PopupPanel(true, true);
    iPopup.addStyleName("unitime-MobileFrameDialog");
    iPopup.setGlassEnabled(true);/*from  w ww . j  ava 2  s.c  o m*/

    iFrame = new Frame();
    iFrame.setStyleName("frame");
    iPopup.add(iFrame);
    hookFrameLoaded((FrameElement) iFrame.getElement().cast());

    iCheckLoadingWidgetIsShowing = new Timer() {
        @Override
        public void run() {
            if (LoadingWidget.getInstance().isShowing()) {
                LoadingWidget.getInstance().hide();
                UniTimeNotifications.error(
                        getText() + " does not seem to load, " + "please check <a href='" + iFrame.getUrl()
                                + "' style='white-space: nowrap;'>" + iFrame.getUrl() + "</a> for yourself.");
            }
        }
    };

    iFrame.addLoadHandler(new LoadHandler() {
        @Override
        public void onLoad(LoadEvent event) {
            LoadingWidget.getInstance().hide();
        }
    });

    History.addValueChangeHandler(new ValueChangeHandler<String>() {
        public void onValueChange(ValueChangeEvent<String> event) {
            if (!event.getValue().equals(getText()))
                hideDialog();
        }
    });

    iPopup.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {
            Window.scrollTo(iScrollLeft, iScrollTop);
            RootPanel.getBodyElement().getStyle().setOverflow(Overflow.AUTO);
        }
    });
}

From source file:org.unitime.timetable.gwt.client.widgets.mobile.MobileUniTimeFrameDialogImpl.java

License:Apache License

@Override
public void openDialog(String title, String source, String width, String height, boolean noCacheTS) {
    if (isShowing())
        hideDialog();/*from  ww w  .java  2s  . c om*/
    GwtHint.hideHint();

    iScrollLeft = Window.getScrollLeft();
    iScrollTop = Window.getScrollTop();
    Window.scrollTo(0, 0);

    LoadingWidget.getInstance().show("Loading " + title + " ...");
    setText(title);
    if (noCacheTS) {
        String hash = null;
        int hashIdx = source.lastIndexOf('#');
        if (hashIdx >= 0) {
            hash = source.substring(hashIdx);
            source = source.substring(0, hashIdx);
        }
        iFrame.setUrl(source + (source.indexOf('?') >= 0 ? "&" : "?") + "noCacheTS=" + new Date().getTime()
                + (hash == null ? "" : hash));
    } else {
        iFrame.setUrl(source);
    }
    iCheckLoadingWidgetIsShowing.schedule(30000);

    History.newItem(title, false);
    iPopup.setPopupPosition(0, 0);
    iPopup.show();
    RootPanel.getBodyElement().getStyle().setOverflow(Overflow.HIDDEN);
}

From source file:org.unitime.timetable.gwt.mobile.client.widgets.MobileUniTimeFrameDialogImpl.java

License:Apache License

@Override
public void openDialog(String title, String source, String width, String height) {
    if (isShowing())
        hideDialog();/*w ww  . j  a  v a 2  s  . co m*/
    GwtHint.hideHint();

    iScrollLeft = Window.getScrollLeft();
    iScrollTop = Window.getScrollTop();
    Window.scrollTo(0, 0);

    LoadingWidget.getInstance().show("Loading " + title + " ...");
    setText(title);
    String hash = null;
    int hashIdx = source.lastIndexOf('#');
    if (hashIdx >= 0) {
        hash = source.substring(hashIdx);
        source = source.substring(0, hashIdx);
    }
    iFrame.setUrl(source + (source.indexOf('?') >= 0 ? "&" : "?") + "noCacheTS=" + new Date().getTime()
            + (hash == null ? "" : hash));
    iCheckLoadingWidgetIsShowing.schedule(30000);

    History.newItem(title, false);
    iPopup.setPopupPosition(0, 0);
    iPopup.show();
    RootPanel.getBodyElement().getStyle().setOverflow(Overflow.HIDDEN);
}

From source file:tv.dyndns.kishibe.qmaclone.client.Controller.java

License:Open Source License

public void scrollToTop() {
    Window.scrollTo(0, 0);
}

From source file:tv.dyndns.kishibe.qmaclone.client.Controller.java

License:Open Source License

public void scrollToChat() {
    Window.scrollTo(0, panelChat.getAbsoluteTop());
}

From source file:tv.dyndns.kishibe.qmaclone.client.Controller.java

License:Open Source License

public void scrollToBottom() {
    Window.scrollTo(0, rootPanel.getOffsetHeight());
}

From source file:virtuozo.interfaces.Component.java

License:Apache License

public C scrollTo() {
    double left = Window.getScrollLeft() + this.left();
    double top = Window.getScrollTop() + this.top();

    Window.scrollTo((int) left, (int) top);
    return (C) this;
}