// also rendered)
EndlessStringArray rowStyleClasses = spatial.getRowStyleClasses();
EndlessStringArray columnStyleClasses = spatial.getColumnStyleClasses();
NDimensionalIndex childIndex =
formatInstance.getIndex().addDimension();
// Retrieve the number of rows and columns.
int rows = converter.getRows();
// assert rows > 0;
int columns = converter.getColumns();
// assert columns > 0;
// Open the spatial format iterator.
module.writeOpenSpatialFormatIterator(spatialAttributes);
// Get the styles for the spatial iterator columns. Do these up front
// as they will be merged into the styles for the cells later on.
// Style the group of columns. This simply groups the spatial 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 groupStyles = formatStylingEngine.startStyleable(
SyntheticStyleableFormat.SPATIAL_COLUMNS,
null);
setDisplayStyle(groupStyles, DisplayKeywords.TABLE_ROW_GROUP);
spatialLayers.setLayer(TableLayers.COLUMN_GROUP, groupStyles);
Styles[] columnStyles = getColumnStyles(
formatStylingEngine, columns, requiredSlices,
columnStyleClasses);
formatStylingEngine.endStyleable(
SyntheticStyleableFormat.SPATIAL_COLUMNS);
// Style the group of rows. See the comment in getColumnStyles().
Styles spatialBodyStyles = formatStylingEngine.startStyleable(
SyntheticStyleableFormat.SPATIAL_BODY,
null);
setDisplayStyle(spatialBodyStyles, DisplayKeywords.TABLE_ROW_GROUP);
spatialLayers.setLayer(TableLayers.ROW_GROUP, spatialBodyStyles);
for (int row = 0; row < rows; row++) {
if (!requiredSlices.isSpatialRowRequired(row)) {
continue;
}
Styles rowStyles = formatStylingEngine.startStyleable(
SyntheticStyleableFormat.SPATIAL_ROW,
rowStyleClasses.get(row));
// Make sure that the row has the correct display.
setDisplayStyle(rowStyles, DisplayKeywords.TABLE_ROW);
spatialLayers.setLayer(TableLayers.ROW, rowStyles);
openSpatialRow(rowStyles);
for (int column = 0; column < columns; column++) {
if (!requiredSlices.isSpatialColumnRequired(column)) {
if (logger.isDebugEnabled()) {
logger.debug("No spatial cell required at [" +
column + "," + row + "]");
}
continue;
}
spatialLayers.setLayer(TableLayers.COLUMN,
columnStyles[column]);
Styles cellStyles = formatStylingEngine.startStyleable(
SyntheticStyleableFormat.SPATIAL_CELL, null);
// Make sure that the cell has the correct display.
setDisplayStyle(cellStyles, DisplayKeywords.TABLE_CELL);
spatialLayers.setLayer(TableLayers.CELL, cellStyles);
openSpatialCell(cellStyles, row, column);
// Map the 2D (row, col) coordinates down onto the
// 1D sequence of instances.
int position = converter.getPosition(column, row);
// Set and store the new child index.
childIndex = childIndex.setCurrentFormatIndex(position);
context.setCurrentFormatIndex(childIndex);
writeChild(childIndex, row, column);
closeSpatialCell();