1 /* 2 * Copyright (c) 2012, FDV Solutions S.A. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * * Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * * Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * * Neither the name of the FDV Solutions S.A. nor the 13 * names of its contributors may be used to endorse or promote products 14 * derived from this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 * DISCLAIMED. IN NO EVENT SHALL FDV Solutions S.A. BE LIABLE FOR ANY 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28 package ar.com.fdvs.dj.test; 29 30 31 import ar.com.fdvs.dj.domain.DynamicReport; 32 import ar.com.fdvs.dj.domain.builders.FastReportBuilder; 33 import net.sf.jasperreports.view.JasperDesignViewer; 34 import net.sf.jasperreports.view.JasperViewer; 35 36 import java.util.Date; 37 38 public class ColumnMarkupFastReportTest extends BaseDjReportTest { 39 40 public DynamicReport buildReport() throws Exception { 41 42 43 /** 44 * Creates the DynamicReportBuilder and sets the basic options for 45 * the report 46 */ 47 FastReportBuilder drb = new FastReportBuilder(); 48 drb.addColumn("3<br>lines<br><u>title</u>", "state", String.class.getName(),30) 49 .addColumn("Branch", "branch", String.class.getName(),30) 50 .addColumn("Product Line", "productLine", String.class.getName(),50) 51 .addColumn("Item", "item", String.class.getName(),50) 52 .addColumn("Item Code", "id", Long.class.getName(),30,true) 53 .addColumn("Quantity", "quantity", Long.class.getName(),60,true) 54 .addColumn("Amount", "amount", Float.class.getName(),70,true) 55 .addGroups(2) 56 .setTitle("November " + getYear() + " sales report") 57 .setSubtitle("This report was generated at " + new Date()) 58 .setPrintBackgroundOnOddRows(true) 59 .setUseFullPageWidth(true); 60 61 drb.getColumn(0).setHeaderMarkup("html"); 62 63 DynamicReport dr = drb.build(); 64 65 return dr; 66 } 67 68 public static void main(String[] args) throws Exception { 69 ColumnMarkupFastReportTest test = new ColumnMarkupFastReportTest(); 70 test.testReport(); 71 test.exportToJRXML(); 72 JasperViewer.viewReport(test.jp); //finally display the report report 73 JasperDesignViewer.viewReportDesign(test.jr); 74 } 75 76 }