01: /*
02: * Copyright 2006-2007 Pentaho Corporation. All rights reserved.
03: * This software was developed by Pentaho Corporation and is provided under the terms
04: * of the Mozilla Public License, Version 1.1, or any later version. You may not use
05: * this file except in compliance with the license. If you need a copy of the license,
06: * please go to http://www.mozilla.org/MPL/MPL-1.1.txt.
07: *
08: * Software distributed under the Mozilla Public License is distributed on an "AS IS"
09: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
10: * the license for the specific language governing your rights and limitations.
11: *
12: * Additional Contributor(s): Martin Schmid gridvision engineering GmbH
13: */
14: package org.pentaho.reportdesigner.crm.report.tests;
15:
16: import org.jfree.report.ElementAlignment;
17: import org.jfree.report.Group;
18: import org.jfree.report.JFreeReport;
19: import org.jfree.report.JFreeReportBoot;
20: import org.jfree.report.TableDataFactory;
21: import org.jfree.report.elementfactory.TextFieldElementFactory;
22: import org.jfree.report.modules.gui.base.PreviewFrame;
23: import org.jfree.report.style.FontDefinition;
24: import org.pentaho.reportdesigner.crm.report.ReportDialogConstants;
25:
26: import javax.swing.table.DefaultTableModel;
27: import java.awt.*;
28: import java.awt.geom.Rectangle2D;
29:
30: /**
31: * User: Martin
32: * Date: 06.10.2005
33: * Time: 15:55:11
34: */
35: @SuppressWarnings({"ALL"})
36: public class GroupTest {
37: public static void main(String[] args) {
38: JFreeReport report = new JFreeReport();
39:
40: report.setName("GroupTest");
41:
42: report.addGroup(new Group());
43: report.getGroup(0).addField("column");
44: report.getGroup(0).getHeader().addElement(
45: TextFieldElementFactory
46: .createStringElement("tf1",
47: new Rectangle2D.Double(0, 0, 100, 30),
48: Color.BLUE, ElementAlignment.LEFT,
49: new FontDefinition("dialog", 12), "-",
50: "column"));
51:
52: report.getItemBand().addElement(
53: TextFieldElementFactory
54: .createStringElement("tf2",
55: new Rectangle2D.Double(0, 0, 100, 30),
56: Color.RED, ElementAlignment.LEFT,
57: new FontDefinition("dialog", 12), "-",
58: "column"));
59:
60: report.setDataFactory(new TableDataFactory(
61: ReportDialogConstants.DEFAULT_DATA_FACTORY,
62: new DefaultTableModel(new Object[][] { { "1" },
63: { "1" }, { "1" }, { "2" }, { "2" }, { "2" },
64: { "3" }, { "3" }, { "3" } },
65: new Object[] { "column" })));
66:
67: JFreeReportBoot.getInstance().start();
68:
69: PreviewFrame preview = new PreviewFrame(report);
70: preview.pack();
71: preview.setVisible(true);
72: }
73: }
|