org.apache.tapestry5.corelib.components
Class Grid

java.lang.Object
  extended by org.apache.tapestry5.corelib.components.Grid
All Implemented Interfaces:
GridModel

@SupportsInformalParameters
public class Grid
extends Object
implements GridModel

A grid presents tabular data. It is a composite component, created in terms of several sub-components. The sub-components are statically wired to the Grid, as it provides access to the data and other models that they need.

A Grid may operate inside a Form. By overriding the cell renderers of properties, the default output-only behavior can be changed to produce a complex form with individual control for editing properties of each row. This is currently workable but less than ideal -- if the order of rows provided by the GridDataSource changes between render and form submission, then there's the possibility that data will be applied to the wrong server-side objects. In general, when using Grid and Form together, you want to provide the Grid with a ValueEncoder (via the encoder parameter).

See Also:
BeanModel, BeanModelSource, GridDataSource

Constructor Summary
Grid()
           
 
Method Summary
protected  Binding defaultModel()
          Returns a Binding instance that attempts to identify the model from the source parameter (via GridDataSource.getRowType().
 int getCurrentPage()
           
 BeanModel getDataModel()
          Returns the data model, which defines the columns (in terms of properties of the row type), and provides access to actual values for a given row instance.
 GridDataSource getDataSource()
          Returns the source for the data to be presented in the Grid.
 Object getPagerBottom()
           
 Object getPagerTop()
           
 Object getRow()
           
 int getRowsPerPage()
           
 GridSortModel getSortModel()
          Returns the object used to track sorting behavior of the Grid.
 void reset()
          Resets the Grid to inital settings; this sets the current page to one, and clears the sort model.
 void setCurrentPage(int currentPage)
           
 void setRow(Object row)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Grid

public Grid()
Method Detail

defaultModel

protected Binding defaultModel()
Returns a Binding instance that attempts to identify the model from the source parameter (via GridDataSource.getRowType(). Subclasses may override to provide a different mechanism. The returning binding is variant (not invariant).

See Also:
BeanModelSource.createDisplayModel(Class, org.apache.tapestry5.ioc.Messages)

getDataModel

public BeanModel getDataModel()
Description copied from interface: GridModel
Returns the data model, which defines the columns (in terms of properties of the row type), and provides access to actual values for a given row instance.

Specified by:
getDataModel in interface GridModel

getDataSource

public GridDataSource getDataSource()
Description copied from interface: GridModel
Returns the source for the data to be presented in the Grid.

Specified by:
getDataSource in interface GridModel

getSortModel

public GridSortModel getSortModel()
Description copied from interface: GridModel
Returns the object used to track sorting behavior of the Grid.

Specified by:
getSortModel in interface GridModel

getPagerTop

public Object getPagerTop()

getPagerBottom

public Object getPagerBottom()

getCurrentPage

public int getCurrentPage()

setCurrentPage

public void setCurrentPage(int currentPage)

getRowsPerPage

public int getRowsPerPage()

getRow

public Object getRow()

setRow

public void setRow(Object row)

reset

public void reset()
Resets the Grid to inital settings; this sets the current page to one, and clears the sort model.



Copyright © 2006-2009 Apache Software Foundation. All Rights Reserved.