Java Code Examples for com.google.gwt.dom.client.Element#setScrollTop()
The following examples show how to use
com.google.gwt.dom.client.Element#setScrollTop() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CourseFinderCourses.java From unitime with Apache License 2.0 | 6 votes |
protected void scrollToSelectedRow() { if (iCourses.getSelectedRow() < 0) return; Element scroll = iCoursesPanel.getElement(); com.google.gwt.dom.client.Element item = iCourses.getRowFormatter().getElement(iCourses.getSelectedRow()); if (item==null) return; int realOffset = 0; while (item !=null && !item.equals(scroll)) { realOffset += item.getOffsetTop(); item = item.getOffsetParent(); } scroll.setScrollTop(realOffset - scroll.getOffsetHeight() / 2); }
Example 2
Source File: Lookup.java From unitime with Apache License 2.0 | 6 votes |
private void scrollToSelectedRow() { int row = iTable.getSelectedRow(); if (row < 0) return; Element scroll = iScroll.getElement(); Element item = iTable.getRowFormatter().getElement(iTable.getSelectedRow()); if (item==null) return; int realOffset = 0; while (item !=null && !item.equals(scroll)) { realOffset += item.getOffsetTop(); item = item.getOffsetParent(); } scroll.setScrollTop(realOffset - scroll.getOffsetHeight() / 2); }
Example 3
Source File: DegreePlanDialog.java From unitime with Apache License 2.0 | 6 votes |
protected void scrollToSelectedRow() { if (iDegreePlanTable.getSelectedRow() < 0) return; Element scroll = iDegreePlanPanel.getElement(); com.google.gwt.dom.client.Element item = iDegreePlanTable.getRowFormatter().getElement(iDegreePlanTable.getSelectedRow()); if (item == null) return; int realOffset = 0; while (item !=null && !item.equals(scroll)) { realOffset += item.getOffsetTop(); item = item.getOffsetParent(); } scroll.setScrollTop(realOffset - scroll.getOffsetHeight() / 2); }
Example 4
Source File: TextLayer.java From djvu-html5 with GNU General Public License v2.0 | 6 votes |
/** * @param left position of page's left edge on the canvas * @param top position of page's top edge on the canvas */ public void setViewPosition(int pageNum, int left, int top, double zoom) { boolean pageChanged = currentPage != pageNum; TextPage page = getPage(pageNum); if (pageChanged) { getPage(currentPage).removeStyleName(PAGE_STYLE_VISIBLE); page.addStyleName(PAGE_STYLE_VISIBLE); } page.resize(zoom, pageChanged); currentPage = pageNum; Element layerElement = getElement(); Element pageElement = page.getElement(); pageElement.getStyle().setMarginLeft(Math.max(left, 0) + EXTRA_PAGE_MARGIN, Unit.PX); int targetScrollLeft = Math.max(-left, 0) + EXTRA_PAGE_MARGIN; if (layerElement.getScrollLeft() != targetScrollLeft) layerElement.setScrollLeft(targetScrollLeft); int targetScrollTop = pageElement.getOffsetTop() - top; if (layerElement.getScrollTop() != targetScrollTop) layerElement.setScrollTop(targetScrollTop); }
Example 5
Source File: TeachingRequestDetailPage.java From unitime with Apache License 2.0 | 5 votes |
protected void scrollToRow(Integer row) { if (row != null) { Element scroll = iScroll.getElement(); Element item = iForm.getRowFormatter().getElement(row); int realOffset = 0; while (item !=null && !item.equals(scroll)) { realOffset += item.getOffsetTop(); item = item.getOffsetParent(); } scroll.setScrollTop(realOffset - scroll.getOffsetHeight() / 2); } }
Example 6
Source File: AutoSizingTextArea.java From gwt-traction with Apache License 2.0 | 5 votes |
/** * Returns the size of the shadow element */ @Override public int getShadowSize() { Element shadowElement = shadow.getElement(); shadowElement.setScrollTop(10000); return shadowElement.getScrollTop(); }
Example 7
Source File: Scrolling.java From jetpad-projectional-open-source with Apache License 2.0 | 5 votes |
private static void adjustScrollers(Rectangle rect, Element element) { int left = element.getAbsoluteLeft() + rect.origin.x; int top = element.getAbsoluteTop() + rect.origin.y; int width = rect.dimension.x; int height = rect.dimension.y; while (element.getParentElement() != null) { Element parent = element.getParentElement(); String overflow = $(parent).css("overflow"); if ("scroll".equals(overflow) || "auto".equals(overflow)) { int scrollTop = parent.getScrollTop(); int parentTop = parent.getAbsoluteTop(); int parentHeight = parent.getClientHeight(); int scrollLeft = parent.getScrollLeft(); int parentLeft = parent.getAbsoluteLeft(); int parentWidth = parent.getClientWidth(); int deltaX = getScrollAdjustment(new Interval(parentLeft, parentLeft + parentWidth), new Interval(left, left + width), scrollLeft); if (deltaX != 0) { parent.setScrollLeft(scrollLeft + deltaX); left -= deltaX; } int deltaY = getDelta(new Interval(parentTop, parentTop + parentHeight), new Interval(top, top + height)); if (deltaY != 0) { parent.setScrollTop(scrollTop + deltaY); top -= deltaY; } } element = parent; } }