Code: Select all
<p:commandButton action="#{bean.variable}">
Code: Select all
<p:commandButton action="#{bean.method()}">
Code: Select all
public class SimpleReport_Step01 {
public SimpleReport_Step01() {
build();
}
private void build() {
try {
report()//create new report design
.columns(//add columns
// title, field name data type
col.column("Item", "item", type.stringType()),
col.column("Quantity", "quantity", type.integerType()),
col.column("Unit price", "unitprice", type.bigDecimalType()))
.title(cmp.text("Getting started"),cmp.horizontalList().add(
cmp.hListCell(projectOverview()),
cmp.hListCell(projectStatus())
))//shows report title
.pageFooter(cmp.pageXofY())//shows number of page at page footer
.setDataSource(createDataSource())//set datasource
.show();//create and show report
} catch (DRException e) {
e.printStackTrace();
}
}
private ComponentBuilder<?, ?> projectOverview(){
HorizontalListBuilder hlb = cmp.horizontalList();
hlb.add(cmp.text("max")).newRow();
hlb.add(cmp.text("con")).newRow();
hlb.add(cmp.text("fex")).newRow();
return cmp.verticalList(cmp.text("PROJECT OVERVIEW"),hlb);}
private ComponentBuilder<?, ?> projectStatus(){
HorizontalListBuilder hlb = cmp.horizontalList();
hlb.add(cmp.text("")).newRow();
hlb.add(cmp.text("")).newRow();
hlb.add(cmp.text("")).newRow();
return cmp.verticalList(cmp.text("PROJECT STATUS"),hlb);}
private JRDataSource createDataSource() {
DRDataSource dataSource = new DRDataSource("item", "quantity", "unitprice");
dataSource.add("Notebook", 1, new BigDecimal(500));
dataSource.add("DVD", 5, new BigDecimal(30));
dataSource.add("DVD", 1, new BigDecimal(28));
dataSource.add("DVD", 5, new BigDecimal(32));
dataSource.add("Book", 3, new BigDecimal(11));
dataSource.add("Book", 1, new BigDecimal(15));
dataSource.add("Book", 5, new BigDecimal(10));
dataSource.add("Book", 8, new BigDecimal(9));
return dataSource;
}
}