com.google.gwt.user.client.Element.getScrollTop()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(171)

本文整理了Java中com.google.gwt.user.client.Element.getScrollTop()方法的一些代码示例,展示了Element.getScrollTop()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getScrollTop()方法的具体详情如下:
包路径:com.google.gwt.user.client.Element
类名称:Element
方法名:getScrollTop

Element.getScrollTop介绍

暂无

代码示例

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Gets the vertical scroll position.
 * 
 * @return the vertical scroll position, in pixels
 * @deprecated as of GWT 2.3, replaced by {@link #getVerticalScrollPosition()}
 */
@Deprecated
public int getScrollPosition() {
 return getScrollableElement().getScrollTop();
}

代码示例来源:origin: com.vaadin.addon/vaadin-touchkit-agpl

public int getScrollTop() {
  return wrapper.getScrollTop();
}

代码示例来源:origin: com.vaadin.addon/vaadin-touchkit-agpl

public int getScrollTop() {
  return scrollElement.getScrollTop();
}

代码示例来源:origin: com.google.gwt/gwt-servlet

getElement().setScrollLeft(0);
if (getElement().getScrollTop() != 0) {
 getElement().setScrollTop(0);

代码示例来源:origin: net.wetheinter/gwt-user

/**
 * Gets the vertical scroll position.
 * 
 * @return the vertical scroll position, in pixels
 * @deprecated as of GWT 2.3, replaced by {@link #getVerticalScrollPosition()}
 */
@Deprecated
public int getScrollPosition() {
 return getScrollableElement().getScrollTop();
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

/**
 * Gets the vertical scroll position.
 * 
 * @return the vertical scroll position, in pixels
 * @deprecated as of GWT 2.3, replaced by {@link #getVerticalScrollPosition()}
 */
@Deprecated
public int getScrollPosition() {
 return getScrollableElement().getScrollTop();
}

代码示例来源:origin: com.ebmwebsourcing.geasytools/geasy-ui

@Override
public int getScrollTop() {
  return this.getElement().getScrollTop();
}

代码示例来源:origin: org.eclipse.che.core/che-core-ide-ui

private int[] getVisibleRows(List<Node> visible, int count) {
 int sc = getElement().getScrollTop();
 int start = (int) (sc == 0 ? 0 : Math.floor(sc / view.getCalculatedRowHeight()) - 1);
 int first = Math.max(start, 0);
 int last = Math.min(start + count + 2, visible.size() - 1);
 return new int[] {first, last};
}

代码示例来源:origin: com.extjs/gxt

private void constrainFocusElement() {
 int scrollLeft = scroller.dom.getScrollLeft();
 int scrollTop = scroller.dom.getScrollTop();
 int left = scroller.getWidth(true) / 2 + scrollLeft;
 int top = scroller.getHeight(true) / 2 + scrollTop;
 focusEl.setLeftTop(left, top);
}

代码示例来源:origin: org.uberfire/uberfire-wires-core-grids

private Panel scrollPanel() {
  final Panel panel = mock(AbsolutePanel.class);
  final Element element = mock(Element.class);
  doReturn(SCROLL_LEFT).when(element).getScrollLeft();
  doReturn(SCROLL_TOP).when(element).getScrollTop();
  doReturn(SCROLL_WIDTH).when(element).getScrollWidth();
  doReturn(SCROLL_HEIGHT).when(element).getScrollHeight();
  doReturn(CLIENT_WIDTH).when(element).getClientWidth();
  doReturn(CLIENT_HEIGHT).when(element).getClientHeight();
  doReturn(element).when(panel).getElement();
  return panel;
}

代码示例来源:origin: kiegroup/appformer

private Panel scrollPanel() {
  final Panel panel = mock(AbsolutePanel.class);
  final Element element = mock(Element.class);
  doReturn(SCROLL_LEFT).when(element).getScrollLeft();
  doReturn(SCROLL_TOP).when(element).getScrollTop();
  doReturn(SCROLL_WIDTH).when(element).getScrollWidth();
  doReturn(SCROLL_HEIGHT).when(element).getScrollHeight();
  doReturn(CLIENT_WIDTH).when(element).getClientWidth();
  doReturn(CLIENT_HEIGHT).when(element).getClientHeight();
  doReturn(element).when(panel).getElement();
  return panel;
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-widgets

@Override
public void onResize() {
  palettePanel.getElement().getStyle().setTop(paletteInitialTop + sessionContainer.getElement().getScrollTop(),
                        Style.Unit.PX);
  palettePanel.getElement().getStyle().setLeft(paletteInitialLeft + sessionContainer.getElement().getScrollLeft(),
                         Style.Unit.PX);
  canvasPanel.onResize();
}

代码示例来源:origin: kiegroup/appformer

private Panel emptyPanel() {

    final Panel panel = mock(AbsolutePanel.class);
    final Element element = mock(Element.class);

    doReturn(0).when(element).getScrollLeft();
    doReturn(0).when(element).getScrollTop();
    doReturn(0).when(element).getScrollWidth();
    doReturn(0).when(element).getScrollHeight();
    doReturn(0).when(element).getClientWidth();
    doReturn(0).when(element).getClientHeight();

    doReturn(element).when(panel).getElement();

    return panel;
  }
}

代码示例来源:origin: org.uberfire/uberfire-wires-core-grids

private Panel emptyPanel() {

    final Panel panel = mock(AbsolutePanel.class);
    final Element element = mock(Element.class);

    doReturn(0).when(element).getScrollLeft();
    doReturn(0).when(element).getScrollTop();
    doReturn(0).when(element).getScrollWidth();
    doReturn(0).when(element).getScrollHeight();
    doReturn(0).when(element).getClientWidth();
    doReturn(0).when(element).getClientHeight();

    doReturn(element).when(panel).getElement();

    return panel;
  }
}

代码示例来源:origin: com.allen-sauer.gwt.dnd/gwt-dnd

private void internalSetWidget(Widget widget) {
 // this.widget = widget;
 if (widget == null || widget == RootPanel.get()) {
  widgetLeft = 0;
  widgetTop = 0;
 } else {
  widgetLeft = widget.getAbsoluteLeft() - widget.getElement().getScrollLeft();
  widgetTop = widget.getAbsoluteTop() - widget.getElement().getScrollTop();
 }
}

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-client-common

/**
 * Gets the mouse y-position relative to the canvas element.
 * @param clientY The event's clienty value.
 * @return the relative y-position
 */
private double getRelativeY(final double clientY) {
  return clientY - getCanvasElement().getAbsoluteTop() + getCanvasElement().getScrollTop() +
      getCanvasElement().getOwnerDocument().getScrollTop();
}

代码示例来源:origin: kiegroup/appformer

Double getVerticalScrollPosition() {
  final Integer scrollTop = scrollPanel().getElement().getScrollTop();
  final Integer scrollHeight = scrollPanel().getElement().getScrollHeight();
  final Integer clientHeight = scrollPanel().getElement().getClientHeight();
  final Integer level = scrollHeight - clientHeight;
  return level == 0 ? 0d : 100d * scrollTop / level;
}

代码示例来源:origin: org.uberfire/uberfire-wires-core-grids

Double getVerticalScrollPosition() {
  final Integer scrollTop = scrollPanel().getElement().getScrollTop();
  final Integer scrollHeight = scrollPanel().getElement().getScrollHeight();
  final Integer clientHeight = scrollPanel().getElement().getClientHeight();
  final Integer level = scrollHeight - clientHeight;
  return level == 0 ? 0d : 100d * scrollTop / level;
}

代码示例来源:origin: org.eclipse.che.core/che-core-ide-ui

@Override
 public void execute() {
  focusConstrainScheduled = false;
  int scrollLeft = getElement().getScrollLeft();
  int scrollTop = getElement().getScrollTop();
  int left = getElement().getOffsetWidth() / 2 + scrollLeft;
  int top = getElement().getOffsetHeight() / 2 + scrollTop;
  focusEl.getStyle().setTop(top, Style.Unit.PX);
  focusEl.getStyle().setLeft(left, Style.Unit.PX);
 }
});

代码示例来源:origin: org.eclipse.che.core/che-core-ide-app

@Override
public void onScroll(ScrollEvent event) {
 // Do nothing if content height less scroll area height
 if (scrollPanel.getElement().getScrollHeight() < scrollPanel.getElement().getOffsetHeight()) {
  followOutput = true;
  if (delegate != null) {
   delegate.onOutputScrolled(followOutput);
  }
  return;
 }
 // Follow output if scroll area is scrolled to the end
 if (scrollPanel.getElement().getScrollTop() + scrollPanel.getElement().getOffsetHeight()
   >= scrollPanel.getElement().getScrollHeight()) {
  followOutput = true;
 } else {
  followOutput = false;
 }
 if (delegate != null) {
  delegate.onOutputScrolled(followOutput);
 }
}

相关文章

Element类方法