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

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

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

Element.getScrollHeight介绍

[英]The height of the scroll view of an element.
[中]元素滚动视图的高度。

代码示例

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

  1. /**
  2. * The height of the scrollable area of the document.
  3. *
  4. * @return the height of the document's scrollable area
  5. */
  6. public final int getScrollHeight() {
  7. // TODO(dramaix): Use document.scrollingElement when its available. See getScrollLeft().
  8. return getViewportElement().getScrollHeight();
  9. }

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

  1. @Override
  2. protected void onStart() {
  3. scrollHeight = 0;
  4. // If the TreeItem is already open, we can get its scrollHeight
  5. // immediately.
  6. if (!opening) {
  7. scrollHeight = curItem.childSpanElem.getScrollHeight();
  8. }
  9. curItem.childSpanElem.getStyle().setProperty("overflow", "hidden");
  10. // If the TreeItem is already open, onStart will set its height to its
  11. // natural height. If the TreeItem is currently closed, onStart will set
  12. // its height to 1px (see onUpdate below), and then we make the TreeItem
  13. // visible so we can get its correct scrollHeight.
  14. super.onStart();
  15. // If the TreeItem is currently closed, we need to make it visible before
  16. // we can get its height.
  17. if (opening) {
  18. UIObject.setVisible(curItem.childSpanElem, true);
  19. scrollHeight = curItem.childSpanElem.getScrollHeight();
  20. }
  21. }

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

  1. public int getMaximumVerticalScrollPosition() {
  2. return getScrollableElement().getScrollHeight() - getElement().getClientHeight();
  3. }

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

  1. @Override
  2. protected void onStart() {
  3. if (opening) {
  4. animFrame.getStyle().setHeight(1.0, Unit.PX);
  5. animFrame.getStyle().setPosition(Position.RELATIVE);
  6. animFrame.getStyle().clearDisplay();
  7. height = contentContainer.getScrollHeight();
  8. } else {
  9. height = contentContainer.getOffsetHeight();
  10. }
  11. }

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

  1. @Override
  2. public int getScrollHeight() {
  3. return element.getScrollHeight();
  4. }

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

  1. collapsible.setScrollTop(collapsible.getScrollHeight() + 100);
  2. collapsible.setScrollLeft(collapsible.getScrollWidth() + 100);

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

  1. /**
  2. * The height of the scrollable area of the document.
  3. *
  4. * @return the height of the document's scrollable area
  5. */
  6. public final int getScrollHeight() {
  7. return getViewportElement().getScrollHeight();
  8. }

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

  1. /**
  2. * The height of the scrollable area of the document.
  3. *
  4. * @return the height of the document's scrollable area
  5. */
  6. public final int getScrollHeight() {
  7. // TODO(dramaix): Use document.scrollingElement when its available. See getScrollLeft().
  8. return getViewportElement().getScrollHeight();
  9. }

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

  1. /**
  2. * Uses scrollHeight to detect vertical overflow.
  3. */
  4. public static boolean detectVerticalOverflow(Element element) {
  5. int scrollHeight = element.getScrollHeight();
  6. int clientHeight = element.getClientHeight();
  7. return scrollHeight > clientHeight;
  8. }

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

  1. @Override
  2. protected void onStart() {
  3. scrollHeight = 0;
  4. // If the TreeItem is already open, we can get its scrollHeight
  5. // immediately.
  6. if (!opening) {
  7. scrollHeight = curItem.childSpanElem.getScrollHeight();
  8. }
  9. curItem.childSpanElem.getStyle().setProperty("overflow", "hidden");
  10. // If the TreeItem is already open, onStart will set its height to its
  11. // natural height. If the TreeItem is currently closed, onStart will set
  12. // its height to 1px (see onUpdate below), and then we make the TreeItem
  13. // visible so we can get its correct scrollHeight.
  14. super.onStart();
  15. // If the TreeItem is currently closed, we need to make it visible before
  16. // we can get its height.
  17. if (opening) {
  18. UIObject.setVisible(curItem.childSpanElem, true);
  19. scrollHeight = curItem.childSpanElem.getScrollHeight();
  20. }
  21. }

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

  1. @Override
  2. protected void onStart() {
  3. scrollHeight = 0;
  4. // If the TreeItem is already open, we can get its scrollHeight
  5. // immediately.
  6. if (!opening) {
  7. scrollHeight = curItem.childSpanElem.getScrollHeight();
  8. }
  9. curItem.childSpanElem.getStyle().setProperty("overflow", "hidden");
  10. // If the TreeItem is already open, onStart will set its height to its
  11. // natural height. If the TreeItem is currently closed, onStart will set
  12. // its height to 1px (see onUpdate below), and then we make the TreeItem
  13. // visible so we can get its correct scrollHeight.
  14. super.onStart();
  15. // If the TreeItem is currently closed, we need to make it visible before
  16. // we can get its height.
  17. if (opening) {
  18. UIObject.setVisible(curItem.childSpanElem, true);
  19. scrollHeight = curItem.childSpanElem.getScrollHeight();
  20. }
  21. }

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

  1. public int getMaximumVerticalScrollPosition() {
  2. return getScrollableElement().getScrollHeight() - getElement().getClientHeight();
  3. }

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

  1. public int getMaximumVerticalScrollPosition() {
  2. return getScrollableElement().getScrollHeight() - getElement().getClientHeight();
  3. }

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

  1. /**
  2. * Determine if scroll bar is present in the scroll panel
  3. */
  4. public boolean hasScrollBar() {
  5. return $(getElement()).get(0).getScrollHeight() > $(getElement()).outerHeight();
  6. }

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

  1. @Override
  2. protected void onStart() {
  3. if (opening) {
  4. animFrame.getStyle().setHeight(1.0, Unit.PX);
  5. animFrame.getStyle().setPosition(Position.RELATIVE);
  6. animFrame.getStyle().clearDisplay();
  7. height = contentContainer.getScrollHeight();
  8. } else {
  9. height = contentContainer.getOffsetHeight();
  10. }
  11. }

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

  1. @Override
  2. protected void onStart() {
  3. if (opening) {
  4. animFrame.getStyle().setHeight(1.0, Unit.PX);
  5. animFrame.getStyle().setPosition(Position.RELATIVE);
  6. animFrame.getStyle().clearDisplay();
  7. height = contentContainer.getScrollHeight();
  8. } else {
  9. height = contentContainer.getOffsetHeight();
  10. }
  11. }

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

  1. private void scrollToWidget() {
  2. try {
  3. com.google.gwt.dom.client.Element e;
  4. if (element == null) {
  5. e = w.getElement().getParentElement();
  6. while (e != null && !isScrollable(e)) {
  7. e = e.getParentElement();
  8. }
  9. } else {
  10. e = element;
  11. }
  12. e.setScrollTop(e.getScrollHeight());
  13. } catch (Exception e) {
  14. }
  15. // Sanity check
  16. w.getElement().scrollIntoView();
  17. }
  18. }

代码示例来源:origin: org.vaadin.addons/dragdroplayouts

  1. private boolean isEventOnScrollBar(NativeEvent event) {
  2. Element element = Element.as(event.getEventTarget());
  3. ;
  4. if (WidgetUtil.mayHaveScrollBars(element)) {
  5. final int nativeScrollbarSize = WidgetUtil.getNativeScrollbarSize();
  6. int x = WidgetUtil.getTouchOrMouseClientX(event)
  7. - element.getAbsoluteLeft();
  8. int y = WidgetUtil.getTouchOrMouseClientY(event)
  9. - element.getAbsoluteTop();
  10. // Hopefully we have horizontal scroll.
  11. final int scrollWidth = element.getScrollWidth();
  12. final int clientWidth = element.getClientWidth();
  13. if (scrollWidth > clientWidth
  14. && clientWidth - nativeScrollbarSize < x) {
  15. return true;
  16. }
  17. // Hopefully we have vertical scroll.
  18. final int scrollHeight = element.getScrollHeight();
  19. final int clientHeight = element.getClientHeight();
  20. if (scrollHeight > clientHeight
  21. && clientHeight - nativeScrollbarSize < y) {
  22. return true;
  23. }
  24. }
  25. return false;
  26. }

代码示例来源:origin: com.haulmont.cuba/cuba-web-toolkit

  1. private boolean isEventOnScrollBar(NativeEvent event) {
  2. Element element = Element.as(event.getEventTarget());
  3. ;
  4. if (WidgetUtil.mayHaveScrollBars(element)) {
  5. final int nativeScrollbarSize = WidgetUtil.getNativeScrollbarSize();
  6. int x = WidgetUtil.getTouchOrMouseClientX(event)
  7. - element.getAbsoluteLeft();
  8. int y = WidgetUtil.getTouchOrMouseClientY(event)
  9. - element.getAbsoluteTop();
  10. // Hopefully we have horizontal scroll.
  11. final int scrollWidth = element.getScrollWidth();
  12. final int clientWidth = element.getClientWidth();
  13. if (scrollWidth > clientWidth
  14. && clientWidth - nativeScrollbarSize < x) {
  15. return true;
  16. }
  17. // Hopefully we have vertical scroll.
  18. final int scrollHeight = element.getScrollHeight();
  19. final int clientHeight = element.getClientHeight();
  20. if (scrollHeight > clientHeight
  21. && clientHeight - nativeScrollbarSize < y) {
  22. return true;
  23. }
  24. }
  25. return false;
  26. }

代码示例来源:origin: Putnami/putnami-web-toolkit

  1. public void doCollapse(final boolean collapse) {
  2. if (collapse != this.collapsed) {
  3. EventBus.get().fireEventFromSource(new CollapseEvent(CollapseHelper.this, collapse), CollapseHelper.this);
  4. this.collapsableElement.getStyle().setHeight(this.collapsableElement.getOffsetHeight(), Unit.PX);
  5. StyleUtils.removeStyle(this.collapsableElement, CollapseHelper.STYLE_COLLAPSE);
  6. StyleUtils.removeStyle(this.collapsableElement, CollapseHelper.STYLE_VISIBLE);
  7. StyleUtils.addStyle(this.collapsableElement, CollapseHelper.STYLE_COLLAPSING);
  8. final int endHeight = collapse ? 0 : this.collapsableElement.getScrollHeight();
  9. Scheduler.get().scheduleDeferred(new ScheduledCommand() {
  10. @Override
  11. public void execute() {
  12. CollapseHelper.this.collapsableElement.getStyle().setHeight(endHeight, Unit.PX);
  13. }
  14. });
  15. Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {
  16. @Override
  17. public boolean execute() {
  18. CollapseHelper.this.collapsableElement.getStyle().clearHeight();
  19. StyleUtils.removeStyle(CollapseHelper.this.collapsableElement, CollapseHelper.STYLE_COLLAPSING);
  20. StyleUtils.addStyle(CollapseHelper.this.collapsableElement, CollapseHelper.STYLE_COLLAPSE);
  21. StyleUtils.toggleStyle(CollapseHelper.this.collapsableElement, CollapseHelper.STYLE_VISIBLE, !collapse);
  22. return false;
  23. }
  24. }, 350);
  25. this.collapsed = collapse;
  26. }
  27. }

相关文章

Element类方法