List of usage examples for com.google.gwt.dom.client Document getScrollTop
public int getScrollTop()
From source file:com.preferanser.client.geom.Point.java
License:Open Source License
public static Point FromMouseEvent(MouseEvent event, Document doc) { return FromMouseEvent(event).plus(new Point(doc.getScrollLeft(), doc.getScrollTop())); }
From source file:org.rstudio.core.client.ScrollUtil.java
License:Open Source License
public static void setScrollPositionOnLoad(final RStudioFrame frame, final int scrollPosition) { Scheduler.get().scheduleFixedDelay(new RepeatingCommand() { @Override// w w w . jav a2 s . c o m public boolean execute() { // don't wait indefinitely for the document to load retries_++; if (retries_ > MAX_SCROLL_RETRIES) return false; // wait for a document to become available in the frame if (frame.getIFrame() == null) return true; if (frame.getIFrame().getContentDocument() == null) return true; // wait for the document to finish loading Document doc = frame.getIFrame().getContentDocument(); String readyState = getDocumentReadyState(doc); if (readyState == null) return true; if (!readyState.equals("complete")) return true; // wait for a real document to load (about:blank may be intermediate) if (doc.getScrollTop() > 0) return true; if (doc.getURL().equals(ViewerPane.ABOUT_BLANK)) return true; // restore scroll position if (scrollPosition > 0) doc.setScrollTop(scrollPosition); return false; } private int retries_ = 0; }, SCROLL_RETRY_MS); }