Class ScrollPanel

    • Constructor Detail

      • ScrollPanel

        public ScrollPanel()
        Creates an empty scroll panel.
      • ScrollPanel

        public ScrollPanel​(Widget child)
        Creates a new scroll panel with the given child widget.
        Parameters:
        child - the widget to be wrapped by the scroll panel
      • ScrollPanel

        protected ScrollPanel​(Element root,
                              Element scrollable,
                              Element container)
        Creates an empty scroll panel using the specified root, scrollable, and container elements.
        Parameters:
        root - the root element of the Widget
        scrollable - the scrollable element, which can be the same as the root element
        container - the container element that holds the child
    • Method Detail

      • ensureVisible

        public void ensureVisible​(UIObject item)
        Ensures that the specified item is visible, by adjusting the panel's scroll position.
        Parameters:
        item - the item whose visibility is to be ensured
      • getMaximumVerticalScrollPosition

        public int getMaximumVerticalScrollPosition()
        Description copied from interface: HasVerticalScrolling
        Get the maximum position of vertical scrolling. This is usually the scrollHeight - clientHeight.
        Specified by:
        getMaximumVerticalScrollPosition in interface HasVerticalScrolling
        Returns:
        the maximum vertical scroll position
      • getScrollPosition

        @Deprecated
        public int getScrollPosition()
        Deprecated.
        as of GWT 2.3, replaced by getVerticalScrollPosition()
        Gets the vertical scroll position.
        Returns:
        the vertical scroll position, in pixels
      • isTouchScrollingDisabled

        public boolean isTouchScrollingDisabled()
        Check whether or not touch based scrolling is disabled. This method always returns false on devices that do not support touch scrolling.
        Returns:
        true if disabled, false if enabled
      • onResize

        public void onResize()
        Description copied from interface: RequiresResize
        This method must be called whenever the implementor's size has been modified.
        Specified by:
        onResize in interface RequiresResize
      • scrollToBottom

        public void scrollToBottom()
        Scroll to the bottom of this panel.
      • scrollToLeft

        public void scrollToLeft()
        Scroll to the far left of this panel.
      • scrollToRight

        public void scrollToRight()
        Scroll to the far right of this panel.
      • scrollToTop

        public void scrollToTop()
        Scroll to the top of this panel.
      • setAlwaysShowScrollBars

        public void setAlwaysShowScrollBars​(boolean alwaysShow)
        Sets whether this panel always shows its scroll bars, or only when necessary.
        Parameters:
        alwaysShow - true to show scroll bars at all times
      • setHeight

        public void setHeight​(java.lang.String height)
        Sets the object's height. This height does not include decorations such as border, margin, and padding.
        Overrides:
        setHeight in class UIObject
        Parameters:
        height - the object's new height, in absolute CSS units (e.g. "10px", "1em" but not "50%")
      • setHorizontalScrollPosition

        public void setHorizontalScrollPosition​(int position)
        Sets the horizontal scroll position.
        Specified by:
        setHorizontalScrollPosition in interface HasHorizontalScrolling
        Parameters:
        position - the new horizontal scroll position, in pixels
      • setScrollPosition

        @Deprecated
        public void setScrollPosition​(int position)
        Deprecated.
        as of GWT 2.3, replaced by setVerticalScrollPosition(int)
        Sets the vertical scroll position.
        Parameters:
        position - the new vertical scroll position, in pixels
      • setSize

        public void setSize​(java.lang.String width,
                            java.lang.String height)
        Sets the object's size. This size does not include decorations such as border, margin, and padding.
        Overrides:
        setSize in class UIObject
        Parameters:
        width - the object's new width, in absolute CSS units (e.g. "10px", "1em", but not "50%")
        height - the object's new height, in absolute CSS units (e.g. "10px", "1em", but not "50%")
      • setTouchScrollingDisabled

        public boolean setTouchScrollingDisabled​(boolean isDisabled)
        Set whether or not touch scrolling is disabled. By default, touch scrolling is enabled on devices that support touch events.
        Parameters:
        isDisabled - true to disable, false to enable
        Returns:
        true if touch scrolling is enabled and supported, false if disabled or not supported
      • setWidth

        public void setWidth​(java.lang.String width)
        Sets the object's width. This width does not include decorations such as border, margin, and padding.
        Overrides:
        setWidth in class UIObject
        Parameters:
        width - the object's new width, in absolute CSS units (e.g. "10px", "1em", but not "50%")
      • getContainerElement

        protected Element getContainerElement()
        Description copied from class: SimplePanel
        Override this method to specify that an element other than the root element be the container for the panel's child widget. This can be useful when you want to create a simple panel that decorates its contents. Note that this method continues to return the Element class defined in the User module to maintain backwards compatibility.
        Overrides:
        getContainerElement in class SimplePanel
        Returns:
        the element to be used as the panel's container
      • getScrollableElement

        protected Element getScrollableElement()
        Get the scrollable element. That is the element with its overflow set to 'auto' or 'scroll'.
        Returns:
        the scrollable element