SwatTileView - silverorange/swat GitHub Wiki

Background

A cell-render is an object that is used to render a small piece of XHTML content. A cell-renderer is used by setting its public properties and then calling its render() method.

A table-view is a widget that displays data in a tabular format using an XHTML table. The view uses cell-renders to display the data within the cells of the table.

The data for table-view can be supplied by any object that implements the table-view-model interface. In practice this is most commonly a table-store object.

A table-view is used by first populating the view with table-view-column objects which define the columns of the table. These columns in turn are populated with cell-renderers. This is typically done in a UI XML file. Finally a data model is provided containing the data to be displayed. Each row in the data model becomes one row the table.

Class names and ancestry:

  • SwatTableView extends SwatControl
  • SwatTableViewColumn extends SwatCellRendererContainer
  • SwatCellRenderer extends SwatUIObject
  • SwatTableStore implements SwatTableModel

Two of these classes, SwatTableView and SwatTableViewColumn, are tied to XHTML tables. That is, they always output using XHTML tables. The cell-renderers and the many cell-renderer sub-classes are not at all tied to XHTML tables. They simply output using the data in their pubic properties. As a result it is possible to use the cell-renderers in alternative widgets that are not XHTML tables.

Proposal

The proposed tile-view widget would take advantage of the cell-renderers but output using XHTML <div> elements instead of XHTML tables. The name tile refers to a layout consisting of a series of XHTML <div> elements each containing similar content and structure. Using style-sheets these divs can flow naturally down a page.

Proposed class names and ancestry:

  • SwatTileView extends SwatControl
  • SwatTile extends SwatCellRendererContainer

The data for a tile-view can be supplied in the same way as the table view. The table-view-model and table-store can be thought of as a sequence of data rows. Just as the table-view displays each column for every data row, the tile-view will display the tile for every data row.

Unlike the table-view which contains multiple columns, a tile-view will only need to contain a single tile. This tile will be displayed once for each data row. While it is theoretically possible to combine tile-view and tile into a single class, it is preferable to have them separate to inherit from different class. By extending the tile from SwatCellRendererContainer it will automatically have all the functionality to manage a set of cell-renderers. The tile-view class however needs to be a widget by extending SwatControl which in turn extends SwatWidget. Secondly, having two class will allow the future addition of groupings implemented in a similar way as table-view-group.

A tile-view would used by first populating the view with a tile object. The tile object is then populated with cell-renderers. This would typically be done in a UI XML file (SwatML). Finally a data model is provided containing the data to be displayed. Each row in the data model becomes one displayed instance of the tile.

⚠️ **GitHub.com Fallback** ⚠️