/** * 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(); }
@Override public void scrollIntoView() { element.scrollIntoView(); }
/** * 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(); }
/** * 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(); }
focusable.scrollIntoView();
private void scrollColumnIntoView(int selectedColumnIndex) { Element td = this.getRowElement(0).getChild(selectedColumnIndex).cast(); td.scrollIntoView(); }
protected void scrollSelectedItemIntoView() { MenuBar menuBar = getSuggestionMenu(); if (menuBar == null) { return; } MenuItem item = getSelectedItem(menuBar); if (item != null) { Element toSelect = item.getElement().getParentElement(); toSelect.scrollIntoView(); } }
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; } } } }
@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); } } },
/** * 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); } }
focusable.scrollIntoView();
throw new IllegalStateException("The target element should be set before calling open()."); targetElement.scrollIntoView();