Interface DataChangeHandler


  • public interface DataChangeHandler
    Callback interface used by DataSource to inform its user about updates to the data.
    Since:
    7.4
    Author:
    Vaadin Ltd
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void dataAdded​(int firstRowIndex, int numberOfRows)
      Called when the new rows have been added to the container.
      void dataAvailable​(int firstRowIndex, int numberOfRows)
      Called when rows requested with DataSource.ensureAvailability(int, int) rows are available.
      void dataRemoved​(int firstRowIndex, int numberOfRows)
      Called when rows have been removed from the data source.
      void dataUpdated​(int firstRowIndex, int numberOfRows)
      Called when the contents of the data source has changed.
      void resetDataAndSize​(int estimatedNewDataSize)
      Resets all data and defines a new size for the data.
    • Method Detail

      • dataUpdated

        void dataUpdated​(int firstRowIndex,
                         int numberOfRows)
        Called when the contents of the data source has changed. If the number of rows has changed or if rows have been moved around, dataAdded(int, int) or dataRemoved(int, int) should ideally be used instead.
        Parameters:
        firstRowIndex - the index of the first changed row
        numberOfRows - the number of changed rows
      • dataRemoved

        void dataRemoved​(int firstRowIndex,
                         int numberOfRows)
        Called when rows have been removed from the data source.
        Parameters:
        firstRowIndex - the index that the first removed row had prior to removal
        numberOfRows - the number of removed rows
      • dataAdded

        void dataAdded​(int firstRowIndex,
                       int numberOfRows)
        Called when the new rows have been added to the container.
        Parameters:
        firstRowIndex - the index of the first added row
        numberOfRows - the number of added rows
      • dataAvailable

        void dataAvailable​(int firstRowIndex,
                           int numberOfRows)
        Called when rows requested with DataSource.ensureAvailability(int, int) rows are available.
        Parameters:
        firstRowIndex - the index of the first available row
        numberOfRows - the number of available rows
      • resetDataAndSize

        void resetDataAndSize​(int estimatedNewDataSize)
        Resets all data and defines a new size for the data.

        This should be used in the cases where the data has changed in some unverifiable way. I.e. "something happened". This will lead to a re-rendering of the current Grid viewport

        Parameters:
        estimatedNewDataSize - the estimated size of the new data set