List of usage examples for com.google.gwt.user.client Window getScrollLeft
public static int getScrollLeft()
From source file:org.ednovo.gooru.client.mvp.play.collection.end.study.CollectionHomeMetadataView.java
License:Open Source License
/** * /* ww w . j av a2s. com*/ * @function oncustomizeCollectionBtnClicked * * @created_date : 11-Dec-2013 * * @description * * * @parm(s) : @param clickEvent * * @return : void * * @throws : <Mentioned if any exceptions> * */ @UiHandler("shareCollectionBtn") public void onshareCollectionBtnClicked(ClickEvent clickEvent) { final Map<String, String> params = StringUtil.splitQuery(Window.Location.getHref()); String collectionId = collectionDo.getGooruOid(); // Window.enableScrolling(false); //final Map<String,String> params = new HashMap<String,String>(); AssignPopupVc successPopupVc = new AssignPopupVc(collectionId, collectionDo.getTitle(), collectionDo.getGoals()) { @Override public void closePoup() { Window.enableScrolling(true); this.hide(); params.remove("assign"); PlaceRequest placeRequest = AppClientFactory.getPlaceManager() .preparePlaceRequest(AppClientFactory.getCurrentPlaceToken(), params); AppClientFactory.getPlaceManager().revealPlace(false, placeRequest, true); } }; //Window.scrollTo(0, 0); int clientHeight = Window.getClientHeight(); //successPopupVc.setWidth("500px"); //successPopupVc.setHeight("658px"); /*if(clientHeight>625){ clientHeight=625; successPopupVc.getAssignContainer().getElement().setAttribute("style", "max-height:"+clientHeight+"px;width:500px;overflow-x:hidden;overflow-y:scroll"); }else{ successPopupVc.getAssignContainer().getElement().setAttribute("style", "max-height:"+clientHeight+"px;width:500px;overflow-x:hidden;overflow-y:scroll"); }*/ successPopupVc.show(); int left = (Window.getClientWidth() - 500) >> 1; int top = (Window.getClientHeight() - clientHeight) >> 1; successPopupVc.setHeight("658px"); successPopupVc.setPopupPosition(Math.max(Window.getScrollLeft() + left, 0), Math.max(Window.getScrollTop() + 5, 0)); //successPopupVc.center(); //successPopupVc.setPopupPosition(successPopupVc.getAbsoluteLeft(), 10); // if(!successPopupVc.isVisible()){ // successPopupVc.show(); // successPopupVc.center(); // } // Window.enableScrolling(false); // if (AppClientFactory.isAnonymous()){ // successPopupVc.setPopupPosition(successPopupVc.getAbsoluteLeft(), 10); // } // else{ //successPopupVc.setPopupPosition(successPopupVc.getAbsoluteLeft(), 10); // } params.put("assign", "yes"); PlaceRequest placeRequest = AppClientFactory.getPlaceManager() .preparePlaceRequest(AppClientFactory.getCurrentPlaceToken(), params); AppClientFactory.getPlaceManager().revealPlace(false, placeRequest, true); // final String collectionId = clickEvent.getRelativeElement().getAttribute("collectionId"); // // if(!isSharePopup){ // isSharePopup=true; // // SharePlayerVc successPopupVc = new SharePlayerVc(collectionId) { // // @Override // public void closePoup() { // Window.enableScrolling(true); // this.hide(); // isSharePopup = false; // } // public void triggerShareEvent(String shareType,boolean confirmStatus){ // getUiHandlers().triggerCollectionShareDataEvent(collectionId,PlayerDataLogEvents.COLLECTION,shareType,confirmStatus); // } // }; // Window.scrollTo(0, 0); // successPopupVc.setWidth("500px"); // successPopupVc.setHeight("350px"); // successPopupVc.show(); // successPopupVc.center(); // } }
From source file:org.freemedsoftware.gwt.client.widget.CustomCanvas.java
License:Open Source License
/** * Calculate relative X coordinate on the Canvas element from a * <HasNativeEvent> event./*from w w w . jav a 2s.c o m*/ * * @param event * @return */ public int getXCoordFromEvent(HasNativeEvent event) { return event.getNativeEvent().getClientX() - getAbsoluteLeft() + Window.getScrollLeft(); }
From source file:org.geomajas.gwt2.plugin.corewidget.example.client.sample.map.MapLegendDropDown.java
License:Open Source License
private int calculateLeft(int offsetWidth) { // Calculate left position for the popup. The computation for // the left position is bidi-sensitive. int textBoxOffsetWidth = this.getOffsetWidth(); // Compute the difference between the popup's width and the // textbox's width int offsetWidthDiff = offsetWidth - textBoxOffsetWidth; int left = this.getAbsoluteLeft(); // If the suggestion popup is not as wide as the text box, always align to // the left edge of the text box. Otherwise, figure out whether to // left-align or right-align the popup. if (offsetWidthDiff > 0) { // Make sure scrolling is taken into account, since // box.getAbsoluteLeft() takes scrolling into account. int windowRight = Window.getClientWidth() + Window.getScrollLeft(); int windowLeft = Window.getScrollLeft(); // Distance from the left edge of the text box to the right edge // of the window int distanceToWindowRight = windowRight - left; // Distance from the left edge of the text box to the left edge of the // window int distanceFromWindowLeft = left - windowLeft; // If there is not enough space for the overflow of the popup's // width to the right of hte text box, and there IS enough space for the // overflow to the left of the text box, then right-align the popup. // However, if there is not enough space on either side, then stick with // left-alignment. if (distanceToWindowRight < offsetWidth && distanceFromWindowLeft >= offsetWidthDiff) { // Align with the right edge of the text box. left -= offsetWidthDiff;// ww w .j a va2 s . com } } return left; }
From source file:org.kaaproject.avro.ui.gwt.client.widget.BusyPopup.java
License:Apache License
public void rollDown() { boolean initiallyShowing = showing; boolean initiallyAnimated = isAnimationEnabled; if (!initiallyShowing) { setVisible(false);// www.jav a2s.c o m setAnimationEnabled(false); show(); } Element elem = getElement(); elem.getStyle().setPropertyPx("left", 0); elem.getStyle().setPropertyPx("top", 0); int left = (Window.getClientWidth() - getOffsetWidth()) >> 1; int top = -getOffsetHeight(); setPopupPosition(Math.max(Window.getScrollLeft() + left, 0), Math.max(Window.getScrollTop() + top, -getOffsetHeight())); if (!initiallyShowing) { setAnimationEnabled(initiallyAnimated); if (initiallyAnimated) { setVisible(true); rollAnimation.run(ANIMATION_DURATION); } else { setVisible(true); } } }
From source file:org.nuxeo.ecm.platform.annotations.gwt.client.view.annotater.ImageAnnotater.java
License:Apache License
@Override public void onMouseDown(Event event) { super.onMouseDown(event); if (writing /* || processing */) { Log.debug("ImageAnnotater] Ignore mouse down event"); return;//from w ww . ja v a 2s . c o m } if (processing) { divElement.getParentElement().removeChild(divElement); } image = getRootImage(event); int[] absoluteTopLeft = Utils.getAbsoluteTopLeft(image, Document.get()); ax = event.getClientX() - absoluteTopLeft[1] + Window.getScrollLeft(); ay = event.getClientY() - absoluteTopLeft[0] + Window.getScrollTop(); bx = ax; by = ay; writing = true; processing = true; controller.disablePopupListeners(); addMap(ax, ay, bx, by, image); }
From source file:org.nuxeo.ecm.platform.annotations.gwt.client.view.annotater.ImageAnnotater.java
License:Apache License
@Override public void onMouseMove(Event event) { super.onMouseMove(event); if (!writing) { return;//from w w w . j a v a 2 s . c o m } String nodeName = event.getTarget().getNodeName(); if (nodeName.equalsIgnoreCase("img")) { ImageElement newImage = ImageElement.as(event.getTarget()); if ((!image.equals(newImage) || ax == -1 || ay == -1) && !controller.isMultiImage()) { refresh(); } } int[] absoluteTopLeft = Utils.getAbsoluteTopLeft(image, Document.get()); bx = event.getClientX() - absoluteTopLeft[1] + Window.getScrollLeft(); by = event.getClientY() - absoluteTopLeft[0] + Window.getScrollTop(); updateMap(ax, ay, bx, by, image); }
From source file:org.nuxeo.ecm.platform.annotations.gwt.client.view.annotater.ImageAnnotater.java
License:Apache License
@Override public void onMouseUp(Event event) { if (!hasMoved() && writing) { Log.debug("cancel mouse up image"); cancelMap();// ww w . jav a 2 s .co m controller.setNewAnnotationPopup(null); if (controller.isAnnotationsVisible()) { controller.enablePopupListeners(); } super.onMouseUp(event); return; } super.onMouseUp(event); if (!writing) { return; } String nodeName = event.getTarget().getNodeName(); if (nodeName.equalsIgnoreCase("img")) { ImageElement newImage = ImageElement.as(event.getTarget()); if ((!image.equals(newImage) || ax == -1 || ay == -1) && !controller.isMultiImage()) { refresh(); } } int[] absoluteTopLeft = Utils.getAbsoluteTopLeft(image, Document.get()); bx = event.getClientX() - absoluteTopLeft[1] + Window.getScrollLeft(); by = event.getClientY() - absoluteTopLeft[0] + Window.getScrollTop(); addMapAndGetAnnot(new int[] { ax, ay, bx, by }, image); if (controller.isAnnotationsVisible()) { controller.enablePopupListeners(); } writing = false; addAnnotationPopup(); controller.enablePopupListeners(); }
From source file:org.nuxeo.ecm.platform.annotations.gwt.client.view.listener.AnnotationPopupEventListener.java
License:Apache License
private void onEvent(Event event) { if (annotation == null || controller == null || !enabled) { AnnotationFrameApplication.getMainEventListener().onBrowserEvent(event); return;/*from w w w. java 2 s. c o m*/ } if (event.getTypeInt() == Event.ONMOUSEOVER) { if (!annotationPopup.isShown()) { annotationPopup.setPopupPosition(event.getClientX() + Window.getScrollLeft(), event.getClientY() + Window.getScrollTop()); annotationPopup.show(); } // reset the timer timer.cancel(); } else if (event.getTypeInt() == Event.ONMOUSEOUT) { timer.schedule(AnnotationConstant.POPUP_PANEL_BLINK_TIMEOUT_MILI); } }
From source file:org.nuxeo.ecm.platform.annotations.gwt.client.view.NewAnnotationPopup.java
License:Apache License
@Override public void show() { Log.debug("popup.show: " + Window.getScrollTop() + 50); setPopupPosition(50 + Window.getScrollLeft(), Window.getScrollTop() + 50); controller.openCreationPopup();//from w w w . j a va2s . c om super.show(); }
From source file:org.opencms.acacia.client.ui.CmsInlineEntityWidget.java
License:Open Source License
/** * Positions the given pop-up relative to the reference element.<p> *///from w w w. ja v a2 s . co m void positionPopup() { if (m_popup != null) { if (m_referenceElement != null) { CmsPositionBean referencePosition = CmsPositionBean.getBoundingClientRect(m_referenceElement); int currentTop = m_popup.getAbsoluteTop(); int windowHeight = Window.getClientHeight(); int scrollTop = Window.getScrollTop(); int contentHeight = m_popup.getOffsetHeight(); int top = referencePosition.getTop(); if (((windowHeight + scrollTop) < (top + referencePosition.getHeight() + contentHeight + 20)) && ((contentHeight + 40) < top)) { top = top - contentHeight - 5; if ((currentTop < top) && ((top - currentTop) < 200)) { // keep the current position top = currentTop; } } else { top = top + referencePosition.getHeight() + 5; if ((currentTop > top) && ((currentTop - top) < 200)) { // keep the current position top = currentTop; } } m_popup.center(); m_popup.setPopupPosition(m_popup.getPopupLeft(), top); if (((contentHeight + top) - scrollTop) > windowHeight) { Window.scrollTo(Window.getScrollLeft(), ((contentHeight + top) - windowHeight) + 20); } } else { m_popup.center(); } } }