List of usage examples for com.google.gwt.user.client.ui ScrollPanel setVerticalScrollPosition
@Override public void setVerticalScrollPosition(int position)
From source file:cl.uai.client.page.MarkingPage.java
License:Open Source License
/** * Highlight a particular mark within the page * /*from ww w . j a v a 2 s. co m*/ * @param markId the mark's id */ public void highlightRubricMark(int markId) { if (!(marks.get(markId) instanceof RubricMark)) { return; } RubricMark mark = (RubricMark) marks.get(markId); ScrollPanel scrollPanel = EMarkingWeb.markingInterface.getMarkingPagesInterface().getScrollPanel(); int top = scrollPanel.getVerticalScrollPosition() + (mark.getAbsoluteTop() - scrollPanel.getAbsoluteTop()); scrollPanel.setVerticalScrollPosition(top); }
From source file:cl.uai.client.rubric.RubricPanel.java
License:Open Source License
/** * Highlights a criterion within the rubric panel * // www .jav a 2s.co m * @param criterionid id of the criterion to highlight */ public void highlightRubricCriterion(int criterionid) { // Find the row in the hash map FlowPanel hpanel = rubricRows.get(criterionid); if (hpanel == null) return; // Remove style in case it already has it hpanel.removeStyleName(Resources.INSTANCE.css().rubricmarkhover()); hpanel.addStyleName(Resources.INSTANCE.css().rubricmarkhover()); Criterion criterion = MarkingInterface.submissionData.getRubricfillings().get(criterionid); // If the marked criteria is shown, scroll to it if (isCriterionVisible(criterion)) { ScrollPanel scrollPanel = (ScrollPanel) this.getParent(); int top = scrollPanel.getVerticalScrollPosition() + (hpanel.getAbsoluteTop() - scrollPanel.getAbsoluteTop()); scrollPanel.setVerticalScrollPosition(top); } }
From source file:com.alkacon.geranium.client.util.ScrollToBottomHandler.java
License:Open Source License
/** * @see com.google.gwt.event.dom.client.ScrollHandler#onScroll(com.google.gwt.event.dom.client.ScrollEvent) *//*from w w w. j a va 2 s. co m*/ public void onScroll(ScrollEvent event) { if (!m_enabled) { return; } final ScrollPanel scrollPanel = (ScrollPanel) event.getSource(); final int scrollPos = scrollPanel.getVerticalScrollPosition(); Widget child = scrollPanel.getWidget(); int childHeight = child.getOffsetHeight(); int ownHeight = scrollPanel.getOffsetHeight(); boolean isBottom = (scrollPos + ownHeight) >= (childHeight - m_scrollThreshold); if (isBottom) { m_callback.run(); m_enabled = false; scrollPanel.setVerticalScrollPosition(scrollPos); Scheduler.get().scheduleDeferred(new ScheduledCommand() { /** * @see com.google.gwt.core.client.Scheduler.ScheduledCommand#execute() */ public void execute() { scrollPanel.setVerticalScrollPosition(scrollPos); m_enabled = true; } }); } }
From source file:org.opencms.ade.galleries.client.ui.CmsResultsTab.java
License:Open Source License
/** * Scrolls to the result which corresponds to a preset value in the editor.<p> *//*from w w w . j a v a 2 s. c om*/ protected void scrollToPreset() { final ScrollPanel scrollPanel = getList(); if (m_preset != null) { Widget child = scrollPanel.getWidget(); if (child instanceof CmsList<?>) { @SuppressWarnings("unchecked") CmsList<I_CmsListItem> list = (CmsList<I_CmsListItem>) child; if (list.getWidgetCount() > 0) { final Widget first = (Widget) list.getItem(0); Timer timer = new Timer() { @Override public void run() { int firstTop = first.getElement().getAbsoluteTop(); int presetTop = m_preset.getElement().getAbsoluteTop(); final int offset = presetTop - firstTop; if (offset >= 0) { scrollPanel.setVerticalScrollPosition(offset); } else { // something is seriously wrong with the positioning if this case occurs scrollPanel.scrollToBottom(); } } }; timer.schedule(10); } } } }
From source file:org.opencms.gwt.client.util.CmsScrollToBottomHandler.java
License:Open Source License
/** * @see com.google.gwt.event.dom.client.ScrollHandler#onScroll(com.google.gwt.event.dom.client.ScrollEvent) *//*from w ww .jav a2 s . c o m*/ public void onScroll(ScrollEvent event) { if (!m_enabled) { return; } final ScrollPanel scrollPanel = (ScrollPanel) event.getSource(); final int scrollPos = scrollPanel.getVerticalScrollPosition(); Widget child = scrollPanel.getWidget(); int childHeight = child.getOffsetHeight(); int ownHeight = scrollPanel.getOffsetHeight(); boolean isBottom = scrollPos + ownHeight >= childHeight - m_scrollThreshold; if (isBottom) { m_callback.run(); m_enabled = false; scrollPanel.setVerticalScrollPosition(scrollPos); Scheduler.get().scheduleDeferred(new ScheduledCommand() { /** * @see com.google.gwt.core.client.Scheduler.ScheduledCommand#execute() */ public void execute() { scrollPanel.setVerticalScrollPosition(scrollPos); m_enabled = true; } }); } }
From source file:org.rstudio.core.client.widget.VirtualizedDataGrid.java
License:Open Source License
public final void setVerticalScrollPosition(int position) { ScrollPanel panel = getScrollPanel(); panel.setVerticalScrollPosition(position); }
From source file:org.rstudio.studio.client.workbench.views.vcs.git.dialog.GitReviewPanel.java
License:Open Source License
private void scrollBy(ScrollPanel scrollPanel, int vscroll, int hscroll) { if (vscroll != 0) { scrollPanel.setVerticalScrollPosition(Math.max(0, scrollPanel.getVerticalScrollPosition() + vscroll)); }// w w w.j av a 2 s . c o m if (hscroll != 0) { scrollPanel .setHorizontalScrollPosition(Math.max(0, scrollPanel.getHorizontalScrollPosition() + hscroll)); } }