com.google.gwt.view.client

## Interface HasData<T>

- Type Parameters:
    `T` - the data type of each row
  All Superinterfaces:
    HasCellPreviewHandlers<T>, HasHandlers, HasRows
  All Known Implementing Classes:
    AbstractCellTable, AbstractHasData, CellBrowser.BrowserCellList, CellList, CellTable, CellTreeNodeView.NodeCellList, DataGrid, HasDataPresenter

      public interface HasData<T>
      extends HasRows, HasCellPreviewHandlers<T>

  A view that can display a range of data.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `SelectionModel<? super T>` | `getSelectionModel()` Get the `SelectionModel` used by this `HasData`.
    `T` | `getVisibleItem(int indexOnPage)` Get the row value at the specified visible index.
    `int` | `getVisibleItemCount()` Get the number of visible items being displayed.
    `java.lang.Iterable<T>` | `getVisibleItems()` Get an `Iterable` composed of all of the visible items.
    `void` | `setRowData(int start, java.util.List<? extends T> values)` Set a values associated with the rows in the visible range.
    `void` | `setSelectionModel(SelectionModel<? super T> selectionModel)` Set the `SelectionModel` used by this `HasData`.
    `void` | `setVisibleRangeAndClearData(Range range, boolean forceRangeChangeEvent)` Set the visible range and clear the current visible data.

    - ### Methods inherited from interface com.google.gwt.view.client.HasRows

      `addRangeChangeHandler, addRowCountChangeHandler, getRowCount, getVisibleRange, isRowCountExact, setRowCount, setRowCount, setVisibleRange, setVisibleRange`

    - ### Methods inherited from interface com.google.gwt.view.client.HasCellPreviewHandlers

      `addCellPreviewHandler`

    - ### Methods inherited from interface com.google.gwt.event.shared.HasHandlers

      `fireEvent`

- - ### Method Detail

    - #### getSelectionModel

          SelectionModel<? super T> getSelectionModel()

      Get the `SelectionModel` used by this `HasData`.
      Returns:
        the `SelectionModel`
      See Also:
        `setSelectionModel(SelectionModel)`

    - #### getVisibleItem

          T getVisibleItem(int indexOnPage)

      Get the row value at the specified visible index. Index 0 corresponds to the first item on the page.
      Parameters:
        `indexOnPage` - the index on the page
      Returns:
        the row value

    - #### getVisibleItemCount

          int getVisibleItemCount()

      Get the number of visible items being displayed. Note that this value might be less than the page size if there is not enough data to fill the page.
      Returns:
        the number of visible items on the page

    - #### getVisibleItems

          java.lang.Iterable<T> getVisibleItems()

      Get an `Iterable` composed of all of the visible items.
      Returns:
        an `Iterable` instance

    - #### setRowData

          void setRowData(int start,
                        java.util.List<? extends T> values)

      Set a values associated with the rows in the visible range.

      This method does not replace all rows in the display; it replaces the row values starting at the specified start index through the length of the the specified values. You must call `HasRows.setRowCount(int)` to set the total number of rows in the display. You should also use `HasRows.setRowCount(int)` to remove rows when the total number of rows decreases.

      Parameters:
        `start` - the start index of the data
        `values` - the values within the range

    - #### setSelectionModel

          void setSelectionModel(SelectionModel<? super T> selectionModel)

      Set the `SelectionModel` used by this `HasData`.
      Parameters:
        `selectionModel` - the `SelectionModel`
      See Also:
        `getSelectionModel()`

    - #### setVisibleRangeAndClearData

          void setVisibleRangeAndClearData(Range range,
                                         boolean forceRangeChangeEvent)

      Set the visible range and clear the current visible data.

      If the second argument `forceRangeChangeEvent` is true, a `RangeChangeEvent` will be fired even if the range does not change. If false, a `RangeChangeEvent` will only be fired if the range changes.

      Parameters:
        `range` - the new `Range`
        `forceRangeChangeEvent` - true to fire a `RangeChangeEvent` even if the `Range` doesn't change