Class AutoScroller


  • public class AutoScroller
    extends Object
    A class for handling automatic scrolling vertically / horizontally in the Grid when the cursor is close enough the edge of the body of the grid, depending on the scroll direction chosen.
    Since:
    7.5.0
    Author:
    Vaadin Ltd
    • Constructor Detail

      • AutoScroller

        public AutoScroller​(Grid<?> grid)
        Creates a new instance for scrolling the given grid.
        Parameters:
        grid - the grid to auto scroll
    • Method Detail

      • start

        public void start​(com.google.gwt.dom.client.NativeEvent startEvent,
                          AutoScroller.ScrollAxis scrollAxis,
                          AutoScroller.AutoScrollerCallback callback)
        Starts the automatic scrolling detection.
        Parameters:
        startEvent - the event that starts the automatic scroll
        scrollAxis - the axis along which the scrolling should happen
        callback - the callback for getting info about the automatic scrolling
      • stop

        public void stop()
        Stops the automatic scrolling.
      • setScrollArea

        public void setScrollArea​(int px)
        Set the auto scroll area height or width depending on the scrolling axis. This is the amount of pixels from the edge of the grid that the scroll is triggered.

        Defaults to 100px.

        Parameters:
        px - the pixel height/width for the auto scroll area depending on direction
      • getScrollArea

        public int getScrollArea()
        Returns the size of the auto scroll area in pixels.

        Defaults to 100px.

        Returns:
        size in pixels
      • getFrozenColumnsWidth

        public double getFrozenColumnsWidth()