private static final Log log = LogFactory.getLog(DJJRDesignHelper.class);
public static DynamicJasperDesign getNewDesign(DynamicReport dr) {
log.info("obtaining DynamicJasperDesign instance");
DynamicJasperDesign des = new DynamicJasperDesign();
DynamicReportOptions options = dr.getOptions();
Page page = options.getPage();
des.setColumnCount(options.getColumnsPerPage().intValue());
des.setPrintOrder(JasperDesign.PRINT_ORDER_VERTICAL);
byte orientation = page.isOrientationPortrait() ? JasperReport.ORIENTATION_PORTRAIT : JasperReport.ORIENTATION_LANDSCAPE;
des.setOrientation(orientation);
des.setPageWidth(page.getWidth());
des.setPageHeight(page.getHeight());
des.setColumnWidth(options.getColumnWidth());
des.setColumnSpacing(options.getColumnSpace().intValue());
des.setLeftMargin(options.getLeftMargin().intValue());
des.setRightMargin(options.getRightMargin().intValue());
des.setTopMargin(options.getTopMargin().intValue());
des.setBottomMargin(options.getBottomMargin().intValue());
des.setWhenNoDataType(dr.getWhenNoDataType());
des.setWhenResourceMissingType(dr.getWhenResourceMissing());
des.setTitleNewPage(false);
des.setSummaryNewPage(false);
des.setDetail(new JRDesignBand());
des.getDetail().setSplitAllowed(dr.isAllowDetailSplit());
des.setPageHeader(new JRDesignBand());
des.setPageFooter(new JRDesignBand());
des.setSummary(new JRDesignBand());
des.setTitleNewPage(options.isTitleNewPage());
des.setIgnorePagination(options.isIgnorePagination());
if (dr.getQuery() != null){
JRDesignQuery query = getJRDesignQuery(dr);
des.setQuery(query);
}