Type Parameters:
T -
All Implemented Interfaces:
Serializable, Iterable<Component>, IEventSink, IEventSource, IFeedbackContributor, IConverterLocator, IMetadataContext<Serializable,Component>, IHeaderContributor, IPageable, IPageableItems, IRequestableComponent, IHierarchical<Component>, IClusterable

public abstract class GridView<T> extends DataViewBase<T>
A pageable DataView which breaks the data in the IDataProvider into a number of data-rows, depending on the column size. A typical use case is to show items in a table with ie 3 columns where the table is filled left to right top-down so that for each third item a new row is created.

Example

   <tbody>
     <tr wicket:id="rows" class"even">
       <td wicket:id="cols">
         <span wicket:id="id">Test ID</span>
       </td>
     </tr>
   </tbody>
 
and in java:
 add(new GridView("rows", dataProvider).setColumns(3));
 
Author:
Igor Vaynberg, Christian Essl
See Also:
  • Constructor Details

  • Method Details

    • getColumns

      public int getColumns()
      Returns:
      number of columns
    • setColumns

      public GridView<T> setColumns(int cols)
      Sets number of columns
      Parameters:
      cols - number of columns
      Returns:
      this for chaining
    • getRows

      public int getRows()
      Returns:
      number of rows per page
    • setRows

      public GridView<T> setRows(int rows)
      Sets number of rows per page
      Parameters:
      rows - number of rows
      Returns:
      this for chaining
    • addItems

      protected void addItems(Iterator<Item<T>> items)
      Description copied from class: RefreshingView
      Add items to the view. Prior to this all items were removed so every request this function starts from a clean slate.
      Overrides:
      addItems in class RefreshingView<T>
      Parameters:
      items - item instances to be added to this view
    • getDataProvider

      Returns:
      data provider
    • getItems

      public Iterator<Item<T>> getItems()
      Overrides:
      getItems in class RefreshingView<T>
      Returns:
      iterator over item instances that exist as children of this view
      See Also:
    • populateEmptyItem

      protected abstract void populateEmptyItem(Item<T> item)
      Add component to an Item for which there is no model anymore and is shown in a cell
      Parameters:
      item - Item object
    • newEmptyItem

      protected Item<T> newEmptyItem(String id, int index)
      Create a Item which represents an empty cell (there is no model for it in the DataProvider)
      Parameters:
      id -
      index -
      Returns:
      created item
    • newRowItem

      protected Item<?> newRowItem(String id, int index)
      Create a new Item which will hold a row.
      Parameters:
      id -
      index -
      Returns:
      created Item