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

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

Introduction

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

Prototype

public static int getScrollLeft() 

Source Link

Usage

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

License:Apache License

public static void __search() {
    final int left = Window.getScrollLeft();
    final int top = Window.getScrollTop();
    AssignedClassesPage page = (AssignedClassesPage) RootPanel.get("UniTimeGWT:Body").getWidget(0);
    page.search(new AsyncCallback<Boolean>() {
        @Override//from   w w w  . j a va2  s  . com
        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.AssignmentHistoryPage.java

License:Apache License

public static void __search() {
    final int left = Window.getScrollLeft();
    final int top = Window.getScrollTop();
    AssignmentHistoryPage page = (AssignmentHistoryPage) RootPanel.get("UniTimeGWT:Body").getWidget(0);
    page.search(new AsyncCallback<Boolean>() {
        @Override/*  w  ww. j a  v a2  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.solver.NotAssignedClassesPage.java

License:Apache License

public static void __search() {
    final int left = Window.getScrollLeft();
    final int top = Window.getScrollTop();
    NotAssignedClassesPage page = (NotAssignedClassesPage) RootPanel.get("UniTimeGWT:Body").getWidget(0);
    page.search(new AsyncCallback<Boolean>() {
        @Override//from ww  w  . j a  v  a  2s .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.solver.SolutionChangesPage.java

License:Apache License

public static void __search() {
    final int left = Window.getScrollLeft();
    final int top = Window.getScrollTop();
    SolutionChangesPage page = (SolutionChangesPage) RootPanel.get("UniTimeGWT:Body").getWidget(0);
    page.search(new AsyncCallback<Boolean>() {
        @Override/*w w w. j  av  a2  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.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   w  w w  .  j a v  a2  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.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  ww w.  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.widgets.LoadingWidget.java

License:Apache License

public LoadingWidget() {
    iPanel = new AbsolutePanel();
    iPanel.setStyleName("unitime-LoadingPanel");
    iImage = new Image(RESOURCES.loading());
    iImage.setStyleName("unitime-LoadingIcon");
    initWidget(iPanel);//from ww  w  . j  av  a2s.  c  o  m
    Window.addWindowScrollHandler(new Window.ScrollHandler() {
        @Override
        public void onWindowScroll(Window.ScrollEvent event) {
            if (iCount > 0) {
                iPanel.getElement().getStyle().setProperty("left", String.valueOf(event.getScrollLeft()));
                iPanel.getElement().getStyle().setProperty("top", String.valueOf(event.getScrollTop()));
                iImage.getElement().getStyle().setProperty("left",
                        String.valueOf(event.getScrollLeft() + Window.getClientWidth() / 2));
                iImage.getElement().getStyle().setProperty("top",
                        String.valueOf(event.getScrollTop() + Window.getClientHeight() / 2));
                iWarning.getElement().getStyle().setProperty("left",
                        String.valueOf(event.getScrollLeft() + Window.getClientWidth() / 2 - 225));
                iWarning.getElement().getStyle().setProperty("top",
                        String.valueOf(event.getScrollTop() + 5 * Window.getClientHeight() / 12));
                iMessage.getElement().getStyle().setProperty("left",
                        String.valueOf(event.getScrollLeft() + Window.getClientWidth() / 2 - 225));
                iMessage.getElement().getStyle().setProperty("top",
                        String.valueOf(event.getScrollTop() + Window.getClientHeight() / 3));
                iCancel.getElement().getStyle().setProperty("left",
                        String.valueOf(event.getScrollLeft() + Window.getClientWidth() / 2 - 225));
                iCancel.getElement().getStyle().setProperty("top",
                        String.valueOf(event.getScrollTop() + 5 * Window.getClientHeight() / 12));
            }
        }
    });
    iWarning = new HTML(MESSAGES.warnLoadingTooLong(), true);
    iWarning.setStyleName("unitime-Notification");
    iWarning.addStyleName("unitime-NotificationError");
    iCancel = new HTML(MESSAGES.warnLoadingTooLongCanCancel());
    iCancel.setStyleName("unitime-Notification");
    iCancel.addStyleName("unitime-NotificationWarning");
    iCancel.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (iExecutionId != null)
                GwtRpc.cancel(iExecutionId);
        }
    });
    iMessage = new HTML("", true);
    iMessage.setStyleName("unitime-Notification");
    iMessage.addStyleName("unitime-NotificationInfo");
    iWarningTimer = new Timer() {
        @Override
        public void run() {
            RootPanel.get().add(iWarning, Window.getScrollLeft() + Window.getClientWidth() / 2 - 225,
                    Window.getScrollTop() + 5 * Window.getClientHeight() / 12);
        }
    };
    iCancelTimer = new Timer() {
        @Override
        public void run() {
            RootPanel.get().add(iCancel, Window.getScrollLeft() + Window.getClientWidth() / 2 - 225,
                    Window.getScrollTop() + 5 * Window.getClientHeight() / 12);
        }
    };
}

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

License:Apache License

public void show(String message, int warningDelayInMillis) {
    if (iCount == 0) {
        RootPanel.get().add(this, Window.getScrollLeft(), Window.getScrollTop());
        RootPanel.get().add(iImage, Window.getScrollLeft() + Window.getClientWidth() / 2,
                Window.getScrollTop() + Window.getClientHeight() / 2);
        iWarningTimer.schedule(warningDelayInMillis);
    }//from  w  ww. ja va2 s  . c o m
    if (message != null) {
        boolean showing = (iCount > 0 && !iMessage.getText().isEmpty());
        iMessage.setHTML(message);
        if (!showing && !iMessage.getText().isEmpty()) {
            RootPanel.get().add(iMessage, Window.getScrollLeft() + Window.getClientWidth() / 2 - 225,
                    Window.getScrollTop() + Window.getClientHeight() / 3);
        } else if (showing && iMessage.getText().isEmpty()) {
            RootPanel.get().remove(iMessage);
        }
        AriaStatus.getInstance().setText(message.replace("...", "."));
    }
    iCount++;
}

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();/*  w w w. ja  v a  2s . c  o  m*/
    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.client.widgets.UniTimeFrameDialogImpl.java

License:Apache License

public UniTimeFrameDialogImpl() {
    super(true, true);

    setEscapeToHide(true);/*from w w w .  j  ava 2s  .c  o  m*/
    iFrame = new Frame();
    iFrame.getElement().getStyle().setBorderWidth(0, Unit.PX);
    hookFrameLoaded((FrameElement) iFrame.getElement().cast());
    setWidget(iFrame);

    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.");
            }
        }
    };

    addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {
            if (LoadingWidget.getInstance().isShowing())
                LoadingWidget.getInstance().hide();
            RootPanel.getBodyElement().getStyle().setOverflow(Overflow.AUTO);
        }
    });

    iFrame.addLoadHandler(new LoadHandler() {
        @Override
        public void onLoad(LoadEvent event) {
            LoadingWidget.getInstance().hide();
            try {
                FrameElement frame = (FrameElement) iFrame.getElement().cast();
                BodyElement body = frame.getContentDocument().getBody();
                if (body.getScrollWidth() > body.getClientWidth()) {
                    iFrame.setWidth(
                            Math.min(frame.getClientWidth() + body.getScrollWidth() - body.getClientWidth(),
                                    Window.getClientWidth() * 95 / 100) + "px");
                    setPopupPosition(
                            Math.max(Window.getScrollLeft() + (Window.getClientWidth() - getOffsetWidth()) / 2,
                                    0),
                            Math.max(Window.getScrollTop() + (Window.getClientHeight() - getOffsetHeight()) / 2,
                                    0));
                }
            } catch (Exception e) {
            }
        }
    });
}