public PageState processPage(final PageState previousState)
throws StateException, ReportProcessingException,
ReportDataFactoryException, DataSourceException
{
final ReportTargetState targetState = previousState.getTargetState();
final LibLayoutReportTarget target =
(LibLayoutReportTarget) targetState.restore(outputProcessor);
outputProcessor.setPageCursor(previousState.getPageCursor());
LayoutController position = previousState.getLayoutController();
// we have the data and we have our position inside the report.
// lets generate something ...
while (position.isAdvanceable())
{
position = position.advance(target);
target.commit();
// else check whether this state is finished, and try to join the subflow
// with the parent.
while (position.isAdvanceable() == false &&
position.getParent() != null)
{
final LayoutController parent = position.getParent();
position = parent.join(position.getFlowController());
}
// check whether a pagebreak has been encountered.
if (target.isPagebreakEncountered())
{
// So we hit a pagebreak. Store the state for later reuse.
// A single state can refer to more than one physical page.
final PageState state = new PageState
(target.saveState(), position, outputProcessor.getPageCursor());
target.resetPagebreakFlag();
return state;
}
}