com.vaadin.client.widgets.

Class Escalator

  • java.lang.Object
    • com.google.gwt.user.client.ui.UIObject
      • com.google.gwt.user.client.ui.Widget
        • com.vaadin.client.widgets.Escalator
  • All Implemented Interfaces:

    com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasVisibility, com.google.gwt.user.client.ui.IsWidget, com.google.gwt.user.client.ui.RequiresResize, DeferredWorker, SubPartAware

    public class Escalator
    extends com.google.gwt.user.client.ui.Widget
    implements com.google.gwt.user.client.ui.RequiresResize, DeferredWorker, SubPartAware

    A low-level table-like widget that features a scrolling virtual viewport and lazily generated rows.

    Since:

    7.4

    Author:

    Vaadin Ltd

    • Nested Class Summary

      Nested Classes
      Modifier and Type Class Description
      class  Escalator.AbstractRowContainer

      A representation of the rows within a section (header, body, or footer).

      class  Escalator.AriaGridHelper

      Helper class that helps to implement the WAI-ARIA functionality for the Grid and TreeGrid component.

      static class  Escalator.AriaGridRole

      Holds the currently used aria roles within the grid for rows and cells.

      static class  Escalator.SubPartArguments

      Utility class for parsing and storing SubPart request string attributes for Grid and Escalator.

      • Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject

        com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
    • Field Summary

      • Fields inherited from class com.google.gwt.user.client.ui.UIObject

        DEBUG_ID_PREFIX
    • Constructor Summary

      Constructors
      Constructor Description
      Escalator()

      Creates a new Escalator widget instance.

    • Method Summary

      All Methods
      Modifier and Type Method Description
      com.google.gwt.event.shared.HandlerRegistration addEscalatorSizeChangeHandler​(EscalatorSizeChangeHandler escalatorSizeChangeHandler)

      FOR INTERNAL USE ONLY, MAY GET REMOVED OR MODIFIED AT ANY TIME!

      com.google.gwt.event.shared.HandlerRegistration addRowVisibilityChangeHandler​(RowVisibilityChangeHandler rowVisibilityChangeHandler)

      Adds an event handler that gets notified when the range of visible rows changes e.g.

      com.google.gwt.event.shared.HandlerRegistration addScrollHandler​(ScrollHandler handler)

      Adds a scroll handler to this escalator.

      com.google.gwt.event.shared.HandlerRegistration addVerticalScrollbarVisibilityChangeHandler​(VerticalScrollbarVisibilityChangeHandler verticalScrollbarVisibilityChangeHandler)

      FOR INTERNAL USE ONLY, MAY GET REMOVED OR MODIFIED AT ANY TIME!

      RowContainer findRowContainer​(com.google.gwt.dom.client.Element element)

      Returns the RowContainer which contains the element.

      RowContainer.BodyRowContainer getBody()

      Returns the row container for the body in this Escalator.

      ColumnConfiguration getColumnConfiguration()

      Returns the configuration object for the columns in this Escalator.

      double getDelayToCancelTouchScroll()

      Returns the time after which to not consider a touch event a scroll event if the user has not moved the touch.

      RowContainer getFooter()

      Returns the row container for the footer in this Escalator.

      RowContainer getHeader()

      Returns the row container for the header in this Escalator.

      double getHeightByRows()

      Gets the amount of rows in Escalator's body that are shown, while getHeightMode() is HeightMode.ROW.

      HeightMode getHeightMode()

      Returns the current HeightMode the Escalator is in.

      double getInnerHeight()

      Gets the escalator's inner height.

      double getInnerWidth()

      Gets the escalator's inner width.

      int getMaxVisibleRowCount()

      Gets the maximum number of body rows that can be visible on the screen at once.

      double getScrollHeight()

      Returns the scroll height for the escalator.

      double getScrollLeft()

      Returns the logical horizontal scroll offset.

      double getScrollTop()

      Returns the vertical scroll offset.

      double getScrollWidth()

      Returns the scroll width for the escalator.

      com.google.gwt.user.client.Element getSubPartElement​(String subPart)

      Locates an element inside a component using the identifier provided in subPart.

      String getSubPartName​(com.google.gwt.user.client.Element subElement)

      Provides an identifier that identifies the element within the component.

      com.google.gwt.dom.client.Element getTable()

      Returns the <table> element of the grid.

      com.google.gwt.dom.client.Element getTableWrapper()

      Returns the <div class="{primary-stylename}-tablewrapper" /> element which has the table inside it.

      Range getVisibleRowRange()

      Gets the logical index range of currently visible rows.

      boolean isScrollLocked​(ScrollbarBundle.Direction direction)

      Checks whether or not an direction is locked for scrolling.

      boolean isTouchScrolling()

      Returns true if the Escalator is currently scrolling by touch, or has not made the decision yet whether to accept touch actions as scrolling or not.

      boolean isWorkPending()

      Checks whether there are operations pending for this widget or connector that must be executed before reaching a steady state.

      protected void onLoad()  
      void onResize()  
      protected void onUnload()  
      void resetSizesFromDom()

      Resets all cached pixel sizes and reads new values from the DOM.

      void scrollToColumn​(int columnIndex, ScrollDestination destination, int padding)

      Scrolls the body horizontally so that the column at the given index is visible and there is at least padding pixels in the direction of the given scroll destination.

      void scrollToRow​(int rowIndex, ScrollDestination destination, int padding)

      Scrolls the body vertically so that the row at the given index is visible and there is at least padding pixels to the given scroll destination.

      void scrollToRowAndSpacer​(int rowIndex, ScrollDestination destination, int padding)

      Scrolls vertically to a row and the spacer below it.

      void scrollToSpacer​(int spacerIndex, ScrollDestination destination, int padding)

      Scrolls the body vertically so that the spacer at the given row index is visible and there is at least padding pixels to the given scroll destination.

      void setDelayToCancelTouchScroll​(double delayToCancelTouchScroll)

      Sets the time after which to not consider a touch event a scroll event if the user has not moved the touch.

      void setHeight​(String height)
      void setHeightByRows​(double rows)

      Sets the number of rows that should be visible in Escalator's body, while getHeightMode() is HeightMode.ROW.

      void setHeightMode​(HeightMode heightMode)

      Defines the mode in which the Escalator widget's height is calculated.

      void setScrollLeft​(double scrollLeft)

      Sets the logical horizontal scroll offset.

      void setScrollLocked​(ScrollbarBundle.Direction direction, boolean locked)

      Sets whether a scroll direction is locked or not.

      void setScrollTop​(double scrollTop)

      Sets the vertical scroll offset.

      void setStylePrimaryName​(String style)  
      void setWidth​(String width)  
      • Methods inherited from class com.google.gwt.user.client.ui.Widget

        addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
      • Methods inherited from class com.google.gwt.user.client.ui.UIObject

        addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setTitle, setVisible, setVisible, sinkBitlessEvent, toString
    • Constructor Detail

      • Escalator

        public Escalator()

        Creates a new Escalator widget instance.

    • Method Detail

      • onLoad

        protected void onLoad()

        Overrides:

        onLoad in class com.google.gwt.user.client.ui.Widget

      • onUnload

        protected void onUnload()

        Overrides:

        onUnload in class com.google.gwt.user.client.ui.Widget

      • getHeader

        public RowContainer getHeader()

        Returns the row container for the header in this Escalator.

        Returns:

        the header. Never null

      • getBody

        public RowContainer.BodyRowContainer getBody()

        Returns the row container for the body in this Escalator.

        Returns:

        the body. Never null

      • getFooter

        public RowContainer getFooter()

        Returns the row container for the footer in this Escalator.

        Returns:

        the footer. Never null

      • getColumnConfiguration

        public ColumnConfiguration getColumnConfiguration()

        Returns the configuration object for the columns in this Escalator.

        Returns:

        the configuration object for the columns in this Escalator. Never null

      • setWidth

        public void setWidth​(String width)

        Overrides:

        setWidth in class com.google.gwt.user.client.ui.UIObject

      • setHeight

        public void setHeight​(String height)

        If Escalator is currently not in HeightMode.CSS, the given value is remembered, and applied once the mode is applied.

        Overrides:

        setHeight in class com.google.gwt.user.client.ui.UIObject

        See Also:

        setHeightMode(HeightMode)

      • getScrollTop

        public double getScrollTop()

        Returns the vertical scroll offset. Note that this is not necessarily the same as the scrollTop attribute in the DOM.

        Returns:

        the logical vertical scroll offset

      • setScrollTop

        public void setScrollTop​(double scrollTop)

        Sets the vertical scroll offset. Note that this will not necessarily become the same as the scrollTop attribute in the DOM.

        Parameters:

        scrollTop - the number of pixels to scroll vertically

      • getScrollLeft

        public double getScrollLeft()

        Returns the logical horizontal scroll offset. Note that this is not necessarily the same as the scrollLeft attribute in the DOM.

        Returns:

        the logical horizontal scroll offset

      • setScrollLeft

        public void setScrollLeft​(double scrollLeft)

        Sets the logical horizontal scroll offset. Note that will not necessarily become the same as the scrollLeft attribute in the DOM.

        Parameters:

        scrollLeft - the number of pixels to scroll horizontally

      • getScrollWidth

        public double getScrollWidth()

        Returns the scroll width for the escalator. Note that this is not necessary the same as Element.scrollWidth in the DOM.

        Returns:

        the scroll width in pixels

        Since:

        7.5.0

      • getScrollHeight

        public double getScrollHeight()

        Returns the scroll height for the escalator. Note that this is not necessary the same as Element.scrollHeight in the DOM.

        Returns:

        the scroll height in pixels

        Since:

        7.5.0

      • scrollToColumn

        public void scrollToColumn​(int columnIndex,
                                   ScrollDestination destination,
                                   int padding)
                            throws IndexOutOfBoundsException,
                                   IllegalArgumentException

        Scrolls the body horizontally so that the column at the given index is visible and there is at least padding pixels in the direction of the given scroll destination.

        Parameters:

        columnIndex - the index of the column to scroll to

        destination - where the column should be aligned visually after scrolling

        padding - the number pixels to place between the scrolled-to column and the viewport edge.

        Throws:

        IndexOutOfBoundsException - if columnIndex is not a valid index for an existing column

        IllegalArgumentException - if destination is ScrollDestination.MIDDLE and padding is nonzero; or if the indicated column is frozen; or if destination == null

      • addVerticalScrollbarVisibilityChangeHandler

        public com.google.gwt.event.shared.HandlerRegistration addVerticalScrollbarVisibilityChangeHandler​(VerticalScrollbarVisibilityChangeHandler verticalScrollbarVisibilityChangeHandler)

        FOR INTERNAL USE ONLY, MAY GET REMOVED OR MODIFIED AT ANY TIME!

        Adds an event handler that gets notified when the visibility of the vertical scrollbar changes.

        Parameters:

        verticalScrollbarVisibilityChangeHandler - the event handler

        Returns:

        a handler registration for the added handler

      • addEscalatorSizeChangeHandler

        public com.google.gwt.event.shared.HandlerRegistration addEscalatorSizeChangeHandler​(EscalatorSizeChangeHandler escalatorSizeChangeHandler)

        FOR INTERNAL USE ONLY, MAY GET REMOVED OR MODIFIED AT ANY TIME!

        Adds an event handler that gets notified when the Escalator size changes.

        Parameters:

        escalatorSizeChangeHandler - the event handler

        Returns:

        a handler registration for the added handler

      • addRowVisibilityChangeHandler

        public com.google.gwt.event.shared.HandlerRegistration addRowVisibilityChangeHandler​(RowVisibilityChangeHandler rowVisibilityChangeHandler)

        Adds an event handler that gets notified when the range of visible rows changes e.g. because of scrolling, row resizing or spacers appearing/disappearing.

        Parameters:

        rowVisibilityChangeHandler - the event handler

        Returns:

        a handler registration for the added handler

      • getVisibleRowRange

        public Range getVisibleRowRange()

        Gets the logical index range of currently visible rows.

        Returns:

        logical index range of visible rows

      • setStylePrimaryName

        public void setStylePrimaryName​(String style)

        Overrides:

        setStylePrimaryName in class com.google.gwt.user.client.ui.UIObject

      • getHeightByRows

        public double getHeightByRows()

        Gets the amount of rows in Escalator's body that are shown, while getHeightMode() is HeightMode.ROW.

        By default, it is 10.

        Returns:

        the amount of rows that are being shown in Escalator's body

        See Also:

        setHeightByRows(double)

      • setHeightMode

        public void setHeightMode​(HeightMode heightMode)

        Defines the mode in which the Escalator widget's height is calculated.

        If HeightMode.CSS is given, Escalator will respect the values given via setHeight(String), and behave as a traditional Widget.

        If HeightMode.ROW is given, Escalator will make sure that the body will display as many rows as getHeightByRows() defines. Note: If headers/footers are inserted or removed, the widget will resize itself to still display the required amount of rows in its body. It also takes the horizontal scrollbar into account.

        Parameters:

        heightMode - the mode in to which Escalator should be set

      • findRowContainer

        public RowContainer findRowContainer​(com.google.gwt.dom.client.Element element)

        Returns the RowContainer which contains the element.

        Parameters:

        element - the element to check for

        Returns:

        the container the element is in or null if element is not present in any container.

      • setScrollLocked

        public void setScrollLocked​(ScrollbarBundle.Direction direction,
                                    boolean locked)

        Sets whether a scroll direction is locked or not.

        If a direction is locked, the escalator will refuse to scroll in that direction.

        Parameters:

        direction - the orientation of the scroll to set the lock status

        locked - true to lock, false to unlock

      • isScrollLocked

        public boolean isScrollLocked​(ScrollbarBundle.Direction direction)

        Checks whether or not an direction is locked for scrolling.

        Parameters:

        direction - the direction of the scroll of which to check the lock status

        Returns:

        true if the direction is locked

      • addScrollHandler

        public com.google.gwt.event.shared.HandlerRegistration addScrollHandler​(ScrollHandler handler)

        Adds a scroll handler to this escalator.

        Parameters:

        handler - the scroll handler to add

        Returns:

        a handler registration for the registered scroll handler

      • isTouchScrolling

        public boolean isTouchScrolling()

        Returns true if the Escalator is currently scrolling by touch, or has not made the decision yet whether to accept touch actions as scrolling or not.

        Returns:

        true when the component is touch scrolling at the moment

        Since:

        8.1

        See Also:

        setDelayToCancelTouchScroll(double)

      • getDelayToCancelTouchScroll

        public double getDelayToCancelTouchScroll()

        Returns the time after which to not consider a touch event a scroll event if the user has not moved the touch. This can be used to differentiate between quick touch move (scrolling) and long tap (e.g. context menu or drag and drop operation).

        Returns:

        delay in milliseconds after which to cancel touch scrolling if there is no movement, -1 means scrolling is always allowed

        Since:

        8.1

      • setDelayToCancelTouchScroll

        public void setDelayToCancelTouchScroll​(double delayToCancelTouchScroll)

        Sets the time after which to not consider a touch event a scroll event if the user has not moved the touch. This can be used to differentiate between quick touch move (scrolling) and long tap (e.g. context menu or drag and drop operation).

        Parameters:

        delayToCancelTouchScroll - delay in milliseconds after which to cancel touch scrolling if there is no movement, -1 to always allow scrolling

        Since:

        8.1

      • isWorkPending

        public boolean isWorkPending()

        Description copied from interface: DeferredWorker

        Checks whether there are operations pending for this widget or connector that must be executed before reaching a steady state.

        Specified by:

        isWorkPending in interface DeferredWorker

      • onResize

        public void onResize()

        Specified by:

        onResize in interface com.google.gwt.user.client.ui.RequiresResize

      • getMaxVisibleRowCount

        public int getMaxVisibleRowCount()

        Gets the maximum number of body rows that can be visible on the screen at once.

        Returns:

        the maximum capacity

      • getInnerWidth

        public double getInnerWidth()

        Gets the escalator's inner width. This is the entire width in pixels, without the vertical scrollbar.

        Returns:

        escalator's inner width

      • getInnerHeight

        public double getInnerHeight()

        Gets the escalator's inner height. This is the entire height in pixels, without the horizontal scrollbar.

        Returns:

        escalator's inner height

      • resetSizesFromDom

        public void resetSizesFromDom()

        Resets all cached pixel sizes and reads new values from the DOM. This methods should be used e.g. when styles affecting the dimensions of elements in this escalator have been changed.

      • getSubPartElement

        public com.google.gwt.user.client.Element getSubPartElement​(String subPart)

        Description copied from interface: SubPartAware

        Locates an element inside a component using the identifier provided in subPart. The subPart identifier is component specific and may be any string of characters, numbers, space characters and brackets.

        Specified by:

        getSubPartElement in interface SubPartAware

        Parameters:

        subPart - The identifier for the element inside the component

        Returns:

        The element identified by subPart or null if the element could not be found.

      • getTableWrapper

        public com.google.gwt.dom.client.Element getTableWrapper()

        Returns the <div class="{primary-stylename}-tablewrapper" /> element which has the table inside it. {primary-stylename} is .e.g v-grid.

        NOTE: you should not do any modifications to the returned element. This API is only available for querying data from the element.

        Returns:

        the table wrapper element

        Since:

        8.1

      • getTable

        public com.google.gwt.dom.client.Element getTable()

        Returns the <table> element of the grid.

        Returns:

        the table element

        Since:

        8.2

      • getSubPartName

        public String getSubPartName​(com.google.gwt.user.client.Element subElement)

        Description copied from interface: SubPartAware

        Provides an identifier that identifies the element within the component. The subElement is a part of the component and must never be null.

        Note! getSubPartElement(getSubPartName(element)) == element is not always true. A component can choose to provide a more generic identifier for any given element if the results of all interactions with subElement are the same as interactions with the element identified by the return value. For example a button can return an identifier for the root element even though a DIV inside the button was passed as subElement because interactions with the DIV and the root button element produce the same result.

        Specified by:

        getSubPartName in interface SubPartAware

        Parameters:

        subElement - The element the identifier string should uniquely identify

        Returns:

        An identifier that uniquely identifies subElement or null if no identifier could be provided.