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

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

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

Element.getScrollLeft介绍

暂无

代码示例

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

/**
 * Gets the horizontal scroll position.
 * 
 * @return the horizontal scroll position, in pixels
 */
public int getHorizontalScrollPosition() {
 return getScrollableElement().getScrollLeft();
}

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

/**
 * Adjust the size of the scroll lock element based on the new position of the
 * scroll bar.
 */
private void adjustScrollLock() {
 int scrollLeft = Math.abs(getElement().getScrollLeft());
 if (scrollLeft > 0) {
  int clientWidth = getElement().getClientWidth();
  scrollLock.getStyle().setWidth(scrollLeft + clientWidth, Unit.PX);
 } else {
  scrollLock.getStyle().setWidth(1.0, Unit.PX);
 }
}

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

if (getElement().getScrollLeft() != 0) {
 getElement().setScrollLeft(0);

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

/**
 * Gets the horizontal scroll position.
 * 
 * @return the horizontal scroll position, in pixels
 */
public int getHorizontalScrollPosition() {
 return getScrollableElement().getScrollLeft();
}

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

/**
 * Gets the horizontal scroll position.
 * 
 * @return the horizontal scroll position, in pixels
 */
public int getHorizontalScrollPosition() {
 return getScrollableElement().getScrollLeft();
}

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

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

代码示例来源: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: 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.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: 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: 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: 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: net.wetheinter/gwt-user

/**
 * Adjust the size of the scroll lock element based on the new position of the
 * scroll bar.
 */
private void adjustScrollLock() {
 int scrollLeft = Math.abs(getElement().getScrollLeft());
 if (scrollLeft > 0) {
  int clientWidth = getElement().getClientWidth();
  scrollLock.getStyle().setWidth(scrollLeft + clientWidth, Unit.PX);
 } else {
  scrollLock.getStyle().setWidth(1.0, Unit.PX);
 }
}

代码示例来源:origin: geogebra/geogebra

/**
 * @param latexItem
 *            panel to be scrolled
 * @param margin
 *            minimal distance from cursor to left/right border
 */
public static void scrollParent(FlowPanel latexItem, int margin) {
  if (latexItem.getOffsetWidth() + latexItem.getElement().getScrollLeft()
      - margin < CursorBox.startX) {
    latexItem.getElement().setScrollLeft((int) CursorBox.startX
        - latexItem.getOffsetWidth() + margin);
  } else if (CursorBox.startX < latexItem.getElement().getScrollLeft()
      + margin) {
    latexItem.getElement()
        .setScrollLeft((int) CursorBox.startX - margin);
  }
}

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

/**
 * Adjust the size of the scroll lock element based on the new position of the
 * scroll bar.
 */
private void adjustScrollLock() {
 int scrollLeft = Math.abs(getElement().getScrollLeft());
 if (scrollLeft > 0) {
  int clientWidth = getElement().getClientWidth();
  scrollLock.getStyle().setWidth(scrollLeft + clientWidth, Unit.PX);
 } else {
  scrollLock.getStyle().setWidth(1.0, Unit.PX);
 }
}

代码示例来源: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 x-position relative to the canvas element.
 * @param clientX The event's clientX value.
 * @return the relative x-position
 */
private double getRelativeX(final double clientX) {
  return clientX - getCanvasElement().getAbsoluteLeft() + getCanvasElement().getScrollLeft() +
      getCanvasElement().getOwnerDocument().getScrollLeft();
}

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

Double getHorizontalScrollPosition() {
  final Integer scrollLeft = scrollPanel().getElement().getScrollLeft();
  final Integer scrollWidth = scrollPanel().getElement().getScrollWidth();
  final Integer clientWidth = scrollPanel().getElement().getClientWidth();
  final Integer level = scrollWidth - clientWidth;
  return level == 0 ? 0d : 100d * scrollLeft / level;
}

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

Double getHorizontalScrollPosition() {
  final Integer scrollLeft = scrollPanel().getElement().getScrollLeft();
  final Integer scrollWidth = scrollPanel().getElement().getScrollWidth();
  final Integer clientWidth = scrollPanel().getElement().getClientWidth();
  final Integer level = scrollWidth - clientWidth;
  return level == 0 ? 0d : 100d * scrollLeft / 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);
 }
});

相关文章

Element类方法