TableLayers layers = new TableLayers();
// Style the grid, and then style all of its columns.
FormatStylingEngine formatStylingEngine =
context.getFormatStylingEngine();
Styles formatStyles = formatStylingEngine.startStyleable(
grid, grid.getStyleClass());
layers.setLayer(TableLayers.TABLE, formatStyles);
attributes.setStyles(formatStyles);
attributes.setLayers(layers);
// Style the columns so that we can pick up the height and any
// other properties associated with the column's style class
// if any.
// Style the group of columns. This is to simply group the grid columns
// together within a single element to simplify the use of those
// selectors that rely on the position of an element within its parent,
// e.g. nth-child().
Styles columnGroupStyles = formatStylingEngine.startStyleable(
SyntheticStyleableFormat.GRID_COLUMNS,
null);
layers.setLayer(TableLayers.COLUMN_GROUP, columnGroupStyles);
Styles[] columnStyles = getColumnStyles(grid, formatStylingEngine,
requiredColumns);
formatStylingEngine.endStyleable(
SyntheticStyleableFormat.GRID_COLUMNS);
if (logger.isDebugEnabled()) {
logger.debug("Grid.writeOutput()");
}
attributes.setColumns(columns);
// Should the order of the columns be reversed,
// false = 0...n, true = n...0
boolean reversed =
DirectionHelper.isDirectionReversed(grid, formatStyles);
// Open the grid, even if no rows are written
attributes.setFormat(grid);
module.writeOpenGrid(attributes);
// Style the group of rows. See the comment in getColumnStyles().
Styles bodyStyles = formatStylingEngine.startStyleable(
SyntheticStyleableFormat.GRID_BODY, null);
layers.setLayer(TableLayers.ROW_GROUP, bodyStyles);
// Write out children
for (int r = 0; r < grid.getRows(); r++) {