final ReportEvent event) throws ReportProcessingException
{
final RenderedCrosstabLayout crosstabLayout = outputFunction.getCurrentRenderedCrosstabLayout();
final LayoutModelBuilder layoutModelBuilder = outputFunction.getRenderer().getNormalFlowLayoutModelBuilder();
final int gidx = event.getState().getCurrentGroupIndex();
final CrosstabRowGroup group = (CrosstabRowGroup) event.getReport().getGroup(gidx);
if (crosstabLayout.isCrosstabTableOpen() == false)
{
buildHeaderPlaceholder(crosstabLayout, layoutModelBuilder);
crosstabLayout.setFirstRowGroupIndex(gidx);
crosstabLayout.setCrosstabTableOpen(true);
}
if (crosstabLayout.isCrosstabHeaderOpen())
{
layoutModelBuilder.startSubFlow(crosstabLayout.getRowTitleHeaderId());
CrosstabOutputHelper.createAutomaticCell(layoutModelBuilder);
outputFunction.getRenderer().add(group.getTitleHeader(), outputFunction.getRuntime());
layoutModelBuilder.finishBox();
layoutModelBuilder.suspendSubFlow();
}
if (crosstabLayout.isCrosstabRowOpen() == false)
{
// start a new row if needed ..
layoutModelBuilder.startBox(CrosstabOutputHelper.createTableRow());
crosstabLayout.setCrosstabRowOpen(true);
// flag not empty is needed to connect the new node with the rest of the layout model.
layoutModelBuilder.legacyFlagNotEmpty();
final TableSectionRenderBox rowRenderNode = CrosstabOutputHelper.findTableSection(layoutModelBuilder.dangerousRawAccess());
for (int i = crosstabLayout.getFirstRowGroupIndex(), count = 0; i < gidx; i += 1, count += 1)
{
final InstanceID rowHeader = crosstabLayout.getRowHeader(i - crosstabLayout.getFirstRowGroupIndex());
final RenderNode cell = CrosstabOutputHelper.findNode(rowRenderNode, rowHeader);
if (cell instanceof TableCellRenderBox)
{
final TableCellRenderBox cellBox = (TableCellRenderBox) cell;
cellBox.update(cellBox.getRowSpan() + 1, cellBox.getColSpan());
}
else
{
throw new IllegalStateException("Unable to find previously defined row header. Aborting report processing.");
}
}
}
final int firstRowGroupIndex = crosstabLayout.getFirstRowGroupIndex();
if (gidx == firstRowGroupIndex)
{
RenderNode renderNode = layoutModelBuilder.dangerousRawAccess();
RenderBox parentNode = (RenderBox) CrosstabOutputHelper.findParentNode(renderNode, crosstabLayout.getCrosstabId());
parentNode.setPreventPagination(true);
}
CrosstabOutputHelper.createAutomaticCell(layoutModelBuilder, 1, 1, group.getHeader());
crosstabLayout.setRowHeader(gidx - crosstabLayout.getFirstRowGroupIndex(), layoutModelBuilder.dangerousRawAccess().getInstanceId());
outputFunction.getRenderer().add(group.getHeader(), outputFunction.getRuntime());
layoutModelBuilder.finishBox();
}