List of usage examples for com.google.gwt.user.client Window.ScrollEvent getScrollTop
public static int getScrollTop()
From source file:org.ednovo.gooru.client.mvp.gshelf.ShelfMainView.java
License:Open Source License
/** * class constructor//from w ww . j a v a 2 s . co m */ public ShelfMainView() { setWidget(uiBinder.createAndBindUi(this)); setIdForFields(); setTreeStucture(); setCreateCourse(true); organizeRootPnl.setVisible(false); //setDefaultOrganizePanel(); //organizelbl.setText(i18n.GL3285()); lnkMyCourses.addClickHandler(new DropDownClickEvent(0)); lnkMyFoldersAndCollecctions.addClickHandler(new DropDownClickEvent(1)); Window.addWindowScrollHandler(new com.google.gwt.user.client.Window.ScrollHandler() { @Override public void onWindowScroll(com.google.gwt.user.client.Window.ScrollEvent event) { //This will check the placetoken,o1 and id values for pagination purpose String placeToken = AppClientFactory.getPlaceManager().getCurrentPlaceRequest().getNameToken(); String o1 = AppClientFactory.getPlaceManager().getRequestParameter("o1", null); String id = AppClientFactory.getPlaceManager().getRequestParameter("id", null); int limit = 20; if (getViewType().equalsIgnoreCase(COURSE)) { limit = 50; } if (placeToken.equals(PlaceTokens.MYCONTENT) && o1 == null && id == null && shelfFolderTree.getItemCount() >= limit) { if ((event.getScrollTop() + Window.getClientHeight()) == Document.get().getBody() .getClientHeight()) { executeScroll(false); } } } }); AppClientFactory.getEventBus().addHandler(RemoveMovedCollectionFolderEvent.TYPE, deleteCollaborator); }
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 w w w . j a v a 2 s .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); } }; }