org.apache.tapestry5.grid

## Interface GridDataSource

- All Known Implementing Classes:
    CollectionGridDataSource, HibernateGridDataSource, JpaGridDataSource, NullDataSource

      public interface GridDataSource

  Defines how a `Grid` component (and its sub-components) gain access to the row data that is displayed on the page. In many cases, this is just a wrapper around a simple List, but the abstractions exist to support access to a large data set that is accessible in sections.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getAvailableRows()` Returns the number of rows available in the data source.
    `java.lang.Class` | `getRowType()` Returns the type of value in the rows, or null if not known.
    `java.lang.Object` | `getRowValue(int index)` Returns the row value at the provided index.
    `void` | `prepare(int startIndex, int endIndex, java.util.List<SortConstraint> sortConstraints)` Invoked to allow the source to prepare to present values.

- - ### Method Detail

    - #### getAvailableRows

          int getAvailableRows()

      Returns the number of rows available in the data source.

    - #### prepare

          void prepare(int startIndex,
                       int endIndex,
                       java.util.List<SortConstraint> sortConstraints)

      Invoked to allow the source to prepare to present values. This gives the source a chance to pre-fetch data (when appropriate) and informs the source of the desired sort order. Sorting comes first, then extraction by range.
      Parameters:
        `startIndex` - the starting index to be retrieved
        `endIndex` - the ending index to be retrieved
        `sortConstraints` - identify how data is to be sorted

    - #### getRowValue

          java.lang.Object getRowValue(int index)

      Returns the row value at the provided index. This method will be invoked in sequential order. In rare instances, `getAvailableRows()` may return a different number of rows than are actually available (i.e., the database was changed between calls to `getAvailableRows()` and the call to `prepare(int, int, java.util.List)`). In that case, this method should return null for any out-of-range indexes.

    - #### getRowType

          java.lang.Class getRowType()

      Returns the type of value in the rows, or null if not known. This value is used to create a default `BeanModel` when no such model is explicitly provided.
      Returns:
        the row type, or null

${project.version} - Copyright © 2003-2015 The Apache Software Foundation.