DynamicReportBuilder drbContent = new DynamicReportBuilder();
// get the styles
DJReportStyles djrst = getDjReportStyles();
DynamicReport drHeaderSubreport = new DJLetterHead();
drbContent.addSubreportInGroupHeader(1, drHeaderSubreport, new ClassicLayoutManager(), "", DJConstants.DATA_SOURCE_ORIGIN_FIELD, DJConstants.DATA_SOURCE_TYPE_COLLECTION);
// Sets the Report Columns, header, Title, Groups, Etc Formats
// DynamicJasper documentation
drbContent.setTitle(zksample2title);
drbContent.setTitleStyle(djrst.getTitleStyle());
drbContent.setWhenNoDataAllSectionNoDetail();
// drb.setSubtitle("DynamicJasper Sample");
drbContent.setSubtitleStyle(djrst.getSubtitleStyle());
drbContent.setHeaderHeight(20);
drbContent.setDetailHeight(15);
drbContent.setFooterVariablesHeight(10);
drbContent.setMargins(20, 20, 30, 15);
drbContent.setDefaultStyles(djrst.getTitleStyle(), djrst.getSubtitleStyle(), djrst.getHeaderStyleText(), djrst.getColumnStyleText());
drbContent.setPrintBackgroundOnOddRows(true);
/**
* Columns Definitions. A new ColumnBuilder instance for each column.
*/
// Right name
AbstractColumn colRightName = ColumnBuilder.getNew().setColumnProperty("rigName", String.class.getName()).build();
colRightName.setTitle(rigName);
colRightName.setWidth(60);
colRightName.setHeaderStyle(djrst.getHeaderStyleText());
colRightName.setStyle(djrst.getColumnStyleText());
// Right type
AbstractColumn colRightType = ColumnBuilder.getNew().setCustomExpression(getMyRightTypExpression()).build();
colRightType.setTitle(rigType);
colRightType.setWidth(40);
colRightType.setHeaderStyle(djrst.getHeaderStyleText());
colRightType.setStyle(djrst.getColumnStyleText());
// Add the columns to the report in the whished order
drbContent.addColumn(colRightName);
drbContent.addColumn(colRightType);
// // TEST
// Style atStyle = new
// StyleBuilder(true).setFont(Font.COMIC_SANS_SMALL).setTextColor(Color.red).build();
// /**
// * Adding many autotexts in the same position (header/footer and
// * aligment) makes them to be one on top of the other
// */
//
// AutoText created = new AutoText(Labels.getLabel("common.Created") +
// ": " + ZksampleDateFormat.getDateTimeFormater().format(new Date()),
// AutoText.POSITION_HEADER, HorizontalBandAlignment.RIGHT);
// created.setWidth(new Integer(120));
// created.setStyle(atStyle);
// drb.addAutoText(created);
//
// AutoText autoText = new AutoText(AutoText.AUTOTEXT_PAGE_X_SLASH_Y,
// AutoText.POSITION_HEADER, HorizontalBandAlignment.RIGHT);
// autoText.setWidth(new Integer(20));
// autoText.setStyle(atStyle);
// drb.addAutoText(autoText);
//
// AutoText name1 = new AutoText("The Zksample2 Ltd.",
// AutoText.POSITION_HEADER, HorizontalBandAlignment.LEFT);
// name1.setPrintWhenExpression(ExpressionHelper.printInFirstPage());
// AutoText name2 = new AutoText("Software Consulting",
// AutoText.POSITION_HEADER, HorizontalBandAlignment.LEFT);
// name2.setPrintWhenExpression(ExpressionHelper.printInFirstPage());
// AutoText street = new AutoText("256, ZK Direct RIA Street ",
// AutoText.POSITION_HEADER, HorizontalBandAlignment.LEFT);
// street.setPrintWhenExpression(ExpressionHelper.printInFirstPage());
// AutoText city = new AutoText("ZKoss City", AutoText.POSITION_HEADER,
// HorizontalBandAlignment.LEFT);
// city.setPrintWhenExpression(ExpressionHelper.printInFirstPage());
// drb.addAutoText(name1).addAutoText(name2).addAutoText(street).addAutoText(city);
// // Footer
// AutoText footerText = new
// AutoText("Help to prevent the global warming by writing cool software.",
// AutoText.POSITION_FOOTER, HorizontalBandAlignment.CENTER);
// footerText.setStyle(djrst.getFooterStyle());
// drb.addAutoText(footerText);
// ADD ALL USED FIELDS to the report.
drbContent.addField("rigType", Integer.class.getName());
drbContent.setUseFullPageWidth(true); // use full width of the page
DynamicReport drContent;
drContent = drbContent.build(); // build the report
// Get information from database
List<SecRight> resultList = getSecurityService().getAllRights();