final DefaultFlowController fc = next.getFlowController();
final boolean advanceRequested = fc.isAdvanceRequested();
final boolean advanceable = fc.getMasterRow().isAdvanceable();
if (isRootGroup(next))
{
throw new ReportProcessingException("This report is invalid. A CR-Row-Group cannot be a root group.");
}
final Group parentGroup = next.getReport().getGroup(next.getCurrentGroupIndex());
if (advanceRequested == false || advanceable == false)
{
// This happens for empty - reports. Empty-Reports are never advanceable, therefore we can
// reach an non-advance state where inner group-footers are printed.
if (parentGroup instanceof CrosstabRowGroup)
{
next.setAdvanceHandler(EndCrosstabRowAxisHandler.HANDLER);
}
else if (parentGroup instanceof CrosstabGroup)
{
next.setAdvanceHandler(EndCrosstabHandler.HANDLER);
}
else if (parentGroup instanceof CrosstabOtherGroup)
{
next.setAdvanceHandler(EndCrosstabOtherAxisHandler.HANDLER);
}
else
{
throw new ReportProcessingException("This report is invalid.");
}
return next;
}
// This group is not the outer-most group ..
final DefaultFlowController cfc = fc.performCommit();
if (ProcessState.isLastItemInGroup(parentGroup, fc.getMasterRow(), cfc.getMasterRow()))
{
// continue with an other EndGroup-State ...
if (parentGroup instanceof CrosstabRowGroup)
{
next.setAdvanceHandler(EndCrosstabRowAxisHandler.HANDLER);
}
else if (parentGroup instanceof CrosstabGroup)
{
next.setAdvanceHandler(EndCrosstabHandler.HANDLER);
}
else if (parentGroup instanceof CrosstabOtherGroup)
{
next.setAdvanceHandler(EndCrosstabOtherAxisHandler.HANDLER);
}
else
{
throw new ReportProcessingException("This report is invalid.");
}
return next;
}
else
{