wicket.extensions.markup.html.repeater.data
Class GridView

java.lang.Object
  extended by wicket.Component
      extended by wicket.MarkupContainer
          extended by wicket.markup.html.WebMarkupContainer
              extended by wicket.extensions.markup.html.repeater.RepeatingView
                  extended by wicket.extensions.markup.html.repeater.refreshing.RefreshingView
                      extended by wicket.extensions.markup.html.repeater.pageable.AbstractPageableView
                          extended by wicket.extensions.markup.html.repeater.data.DataViewBase
                              extended by wicket.extensions.markup.html.repeater.data.GridView
All Implemented Interfaces:
java.io.Serializable, wicket.markup.html.navigation.paging.IPageable

public abstract class GridView
extends DataViewBase

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:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class wicket.Component
wicket.Component.ComponentModelChange, wicket.Component.EnabledChange, wicket.Component.IVisitor, wicket.Component.VisibilityChange
 
Field Summary
 
Fields inherited from class wicket.Component
ENABLE, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED6, FLAG_RESERVED7, FLAG_RESERVED8, PATH_SEPARATOR, RENDER
 
Constructor Summary
GridView(java.lang.String id, IDataProvider dataProvider)
           
 
Method Summary
protected  void addItems(java.util.Iterator items)
          Add items to the view.
 int getColumns()
           
 IDataProvider getDataProvider()
           
 java.util.Iterator getItems()
           
 int getRows()
           
protected  Item newEmptyItem(java.lang.String id, int index)
          Create a Item which represents an empty cell (there is no model for it in the DataProvider)
protected  Item newRowItem(java.lang.String id, int index)
          Create a new Item which will hold a row.
protected abstract  void populateEmptyItem(Item item)
          Add component to an Item for which there is no model anymore and is shown in a cell
 GridView setColumns(int cols)
          Sets number of columns
 GridView setRows(int rows)
          Sets number of rows per page
 
Methods inherited from class wicket.extensions.markup.html.repeater.data.DataViewBase
getItemModels, internalGetDataProvider, internalGetItemCount, onDetach
 
Methods inherited from class wicket.extensions.markup.html.repeater.pageable.AbstractPageableView
getCurrentPage, getItemModels, getPageCount, getRowCount, getViewOffset, getViewSize, internalGetRowsPerPage, internalOnDetach, internalSetRowsPerPage, setCurrentPage
 
Methods inherited from class wicket.extensions.markup.html.repeater.refreshing.RefreshingView
getItemReuseStrategy, internalOnAttach, newItem, populateItem, setItemReuseStrategy
 
Methods inherited from class wicket.extensions.markup.html.repeater.RepeatingView
newChildId, onRender, renderChild, renderIterator
 
Methods inherited from class wicket.markup.html.WebMarkupContainer
getMarkupType, getWebPage
 
Methods inherited from class wicket.MarkupContainer
add, autoAdd, contains, findMarkupStream, get, getAssociatedMarkupStream, getMarkupStream, internalAdd, internalAttach, internalDetach, isTransparentResolver, iterator, iterator, newMarkupResourceStream, onComponentTagBody, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderComponentTagBody, replace, setMarkupStream, setModel, size, toString, toString, visitChildren, visitChildren
 
Methods inherited from class wicket.Component
add, addStateChange, checkComponentTag, checkComponentTagAttribute, continueToOriginalDestination, debug, detachBehaviors, detachModel, detachModels, error, exceptionMessage, fatal, findPage, findParent, findParentWithAssociatedMarkup, getApplication, getApplicationPages, getApplicationSettings, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getEscapeModelStrings, getFeedbackMessage, getFlag, getFlag, getId, getLocale, getLocalizer, getMarkupAttributes, getMarkupId, getMetaData, getModel, getModelComparator, getModelObject, getModelObjectAsString, getOutputMarkupId, getPage, getPageFactory, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getResponse, getSession, getSizeInBytes, getString, getString, getString, getStyle, getVariation, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnModelChanged, isActionAuthorized, isAncestorOf, isBehaviorAccepted, isEnableAllowed, isEnabled, isHeadRendered, isIgnoreAttributeModifier, isRenderAllowed, isVersioned, isVisible, isVisibleInHierarchy, modelChanged, modelChanging, newPage, newPage, onAfterRender, onAttach, onBeforeRender, onBeginRequest, onComponentTag, onEndRequest, onModelChanged, onModelChanging, onRender, redirectToInterceptPage, remove, render, render, renderComponent, renderComponent, renderComponentTag, rendered, renderedBehaviors, renderHead, replaceComponentTagBody, replaceWith, resetHeadRendered, sameRootModel, sameRootModel, setAuto, setEnabled, setEscapeModelStrings, setFlag, setFlag, setIgnoreAttributeModifier, setMetaData, setModelObject, setOutputMarkupId, setRedirect, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisible, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GridView

public GridView(java.lang.String id,
                IDataProvider dataProvider)
Parameters:
id - component id
dataProvider - data provider
Method Detail

getColumns

public int getColumns()
Returns:
number of columns

setColumns

public GridView setColumns(int cols)
Sets number of columns

Parameters:
cols - number of colums
Returns:
this for chaining

getRows

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

setRows

public GridView setRows(int rows)
Sets number of rows per page

Parameters:
rows - number of rows
Returns:
this for chaining

addItems

protected void addItems(java.util.Iterator 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
Parameters:
items - item instances to be added to this view

getDataProvider

public IDataProvider getDataProvider()
Returns:
data provider

getItems

public java.util.Iterator getItems()
Overrides:
getItems in class RefreshingView
Returns:
iterator over item instances that exist as children of this view
See Also:
RefreshingView.getItems()

populateEmptyItem

protected abstract void populateEmptyItem(Item 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 newEmptyItem(java.lang.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(java.lang.String id,
                          int index)
Create a new Item which will hold a row.

Parameters:
id -
index -
Returns:
created Item


Copyright © 2004-2008 Wicket developers. All Rights Reserved.