if (name != null)
{
report.setName(name);
}
PageFormat format = report.getPageDefinition().getPageFormat(0);
float defTopMargin = (float) format.getImageableY();
float defBottomMargin = (float) (format.getHeight() - format.getImageableHeight()
- format.getImageableY());
float defLeftMargin = (float) format.getImageableX();
float defRightMargin = (float) (format.getWidth() - format.getImageableWidth()
- format.getImageableX());
format = createPageFormat(format, attrs);
defTopMargin = ParserUtil.parseFloat(attrs.getValue(getUri(), JFreeReportReadHandler.TOPMARGIN_ATT),
defTopMargin);
defBottomMargin = ParserUtil.parseFloat(attrs.getValue(getUri(), JFreeReportReadHandler.BOTTOMMARGIN_ATT),
defBottomMargin);
defLeftMargin = ParserUtil.parseFloat(attrs.getValue(getUri(), JFreeReportReadHandler.LEFTMARGIN_ATT),
defLeftMargin);
defRightMargin = ParserUtil.parseFloat(attrs.getValue(getUri(), JFreeReportReadHandler.RIGHTMARGIN_ATT),
defRightMargin);
final Paper p = format.getPaper();
switch (format.getOrientation())
{
case PageFormat.PORTRAIT:
PageFormatFactory.getInstance().setBorders(p, defTopMargin, defLeftMargin,
defBottomMargin, defRightMargin);
break;
case PageFormat.LANDSCAPE:
// right, top, left, bottom
PageFormatFactory.getInstance().setBorders(p, defRightMargin, defTopMargin,
defLeftMargin, defBottomMargin);
break;
case PageFormat.REVERSE_LANDSCAPE:
PageFormatFactory.getInstance().setBorders(p, defLeftMargin, defBottomMargin,
defRightMargin, defTopMargin);
break;
default:
throw new IllegalStateException("Unexpected paper orientation.");
}
final int pageSpan = ParserUtil.parseInt(attrs.getValue(getUri(), JFreeReportReadHandler.PAGESPAN_ATT), 1);
format.setPaper(p);
report.setPageDefinition(new SimplePageDefinition(format, pageSpan, 1));
}
getRootHandler().setHelperObject(ReportParserUtil.HELPER_OBJ_REPORT_NAME, report);
final String useMinChunkWidth = attrs.getValue(getUri(), "use-min-chunkwidth");