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

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

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

Element.scrollIntoView介绍

[英]Scrolls this element into view.

This method crawls up the DOM hierarchy, adjusting the scrollLeft and scrollTop properties of each scrollable element to ensure that the specified element is completely in view. It adjusts each scroll position by the minimum amount necessary.
[中]

代码示例

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

/**
 * Scrolls the given element into view.
 * 
 * <p>
 * This method crawls up the DOM hierarchy, adjusting the scrollLeft and
 * scrollTop properties of each scrollable element to ensure that the
 * specified element is completely in view. It adjusts each scroll position by
 * the minimum amount necessary.
 * </p>
 * 
 * @param elem the element to be made visible
 * @deprecated Use {@link Element#scrollIntoView()} instead.
 */
@Deprecated
public static void scrollIntoView(Element elem) {
 elem.scrollIntoView();
}

代码示例来源:origin: stephenh/tessell

@Override
public void scrollIntoView() {
 element.scrollIntoView();
}

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

/**
 * Scrolls the given element into view.
 * 
 * <p>
 * This method crawls up the DOM hierarchy, adjusting the scrollLeft and
 * scrollTop properties of each scrollable element to ensure that the
 * specified element is completely in view. It adjusts each scroll position by
 * the minimum amount necessary.
 * </p>
 * 
 * @param elem the element to be made visible
 * @deprecated Use {@link Element#scrollIntoView()} instead.
 */
@Deprecated
public static void scrollIntoView(Element elem) {
 elem.scrollIntoView();
}

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

/**
 * Scrolls the given element into view.
 * 
 * <p>
 * This method crawls up the DOM hierarchy, adjusting the scrollLeft and
 * scrollTop properties of each scrollable element to ensure that the
 * specified element is completely in view. It adjusts each scroll position by
 * the minimum amount necessary.
 * </p>
 * 
 * @param elem the element to be made visible
 * @deprecated Use {@link Element#scrollIntoView()} instead.
 */
@Deprecated
public static void scrollIntoView(Element elem) {
 elem.scrollIntoView();
}

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

focusable.scrollIntoView();

代码示例来源:origin: bedatadriven/activityinfo

private void scrollColumnIntoView(int selectedColumnIndex) {
  Element td = this.getRowElement(0).getChild(selectedColumnIndex).cast();
  td.scrollIntoView();
}

代码示例来源:origin: oVirt/ovirt-engine

protected void scrollSelectedItemIntoView() {
  MenuBar menuBar = getSuggestionMenu();
  if (menuBar == null) {
    return;
  }
  MenuItem item = getSelectedItem(menuBar);
  if (item != null) {
    Element toSelect = item.getElement().getParentElement();
    toSelect.scrollIntoView();
  }
}

代码示例来源:origin: org.jboss.ballroom/widgets

private void scrollSelectedItemIntoView() {
    NodeList<Node> items = getSuggestionMenu().getElement().getChild(1).getChild(0).getChildNodes();
    for (int i = 0; i < items.getLength(); i++) {
      Element element = (Element) items.getItem(i);
      if (((Element) element.getChild(0)).getClassName().equals("item item-selected")) {
        element.scrollIntoView();
        break;
      }
    }
  }
}

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

@Override
 public void onKeyDown(KeyDownEvent keyDownEvent) {
  if (selectedElement == null) {
   return;
  }
  Element element = null;
  if (keyDownEvent.isDownArrow()) {
   element = selectedElement.getNextSiblingElement();
   if (element == null) {
    return;
   }
  }
  if (keyDownEvent.isUpArrow()) {
   element = selectedElement.getPreviousSiblingElement();
   if (element.getClassName().equals("")) {
    return;
   }
  }
  if (keyDownEvent.isUpArrow() || keyDownEvent.isDownArrow()) {
   keyDownEvent.preventDefault();
   element.scrollIntoView();
   selectElement(element);
  }
 }
},

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

/**
 * Scroll focus element into specific node. Set focus on the tree when {@code isFocusRequired} is
 * {@code true}. Does not perform any operations with focus when {@code isFocusRequired} is {@code
 * false}
 *
 * @param node node to scroll
 * @param isFocusRequired whether tree should take focus after scroll
 */
public void scrollIntoView(Node node, boolean isFocusRequired) {
 checkNotNull(node, NULL_NODE_MSG);
 NodeDescriptor descriptor = getNodeDescriptor(node);
 if (descriptor == null) {
  return;
 }
 Element container = descriptor.getNodeContainerElement();
 if (container == null) {
  return;
 }
 int scrollLeft = getElement().getScrollLeft();
 container.scrollIntoView();
 getElement().setScrollLeft(scrollLeft);
 focusEl.getStyle().setLeft((nodeStorage.getDepth(node) - 1) * 16, Style.Unit.PX);
 focusEl.getStyle().setTop(container.getOffsetTop(), Style.Unit.PX);
 if (isFocusRequired) {
  setFocus(true);
 }
}

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

focusable.scrollIntoView();

代码示例来源:origin: com.github.gwtmaterialdesign/gwt-material-addins

throw new IllegalStateException("The target element should be set before calling open().");
targetElement.scrollIntoView();

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

focusable.scrollIntoView();

相关文章

微信公众号

最新文章

更多

Element类方法