01: /**
02: * ===========================================
03: * JFreeReport : a free Java reporting library
04: * ===========================================
05: *
06: * Project Info: http://reporting.pentaho.org/
07: *
08: * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
09: *
10: * This library is free software; you can redistribute it and/or modify it under the terms
11: * of the GNU Lesser General Public License as published by the Free Software Foundation;
12: * either version 2.1 of the License, or (at your option) any later version.
13: *
14: * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
15: * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16: * See the GNU Lesser General Public License for more details.
17: *
18: * You should have received a copy of the GNU Lesser General Public License along with this
19: * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20: * Boston, MA 02111-1307, USA.
21: *
22: * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
23: * in the United States and other countries.]
24: *
25: * ------------
26: * CSVOutputProcessorMetaData.java
27: * ------------
28: * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
29: */package org.jfree.report.modules.output.table.csv.helper;
30:
31: import org.jfree.report.layout.output.AbstractOutputProcessorMetaData;
32: import org.jfree.report.layout.output.OutputProcessorFeature;
33: import org.jfree.report.modules.output.table.base.AbstractTableOutputProcessor;
34: import org.jfree.util.Configuration;
35:
36: /**
37: * Creation-Date: 09.05.2007, 14:39:13
38: *
39: * @author Thomas Morgner
40: */
41: public class CSVOutputProcessorMetaData extends
42: AbstractOutputProcessorMetaData {
43: public static final int PAGINATION_NONE = 0;
44: public static final int PAGINATION_MANUAL = 1;
45: public static final int PAGINATION_FULL = 2;
46:
47: public CSVOutputProcessorMetaData(
48: final Configuration configuration, final int paginationMode) {
49: super (configuration);
50: final String localStrict = configuration
51: .getConfigProperty("org.jfree.report.modules.output.table.csv.StrictLayout");
52: if (localStrict != null) {
53: if ("true".equals(localStrict)) {
54: addFeature(AbstractTableOutputProcessor.STRICT_LAYOUT);
55: }
56: } else {
57: final String globalStrict = configuration
58: .getConfigProperty("org.jfree.report.modules.output.table.base.StrictLayout");
59: if ("true".equals(globalStrict)) {
60: addFeature(AbstractTableOutputProcessor.STRICT_LAYOUT);
61: }
62: }
63:
64: if ("true"
65: .equals(configuration
66: .getConfigProperty("org.jfree.report.modules.output.table.base.UsePageBands"))) {
67: addFeature(OutputProcessorFeature.PAGE_SECTIONS);
68: }
69: if ("true"
70: .equals(configuration
71: .getConfigProperty("org.jfree.report.modules.output.table.csv.UsePageBands"))) {
72: addFeature(OutputProcessorFeature.PAGE_SECTIONS);
73: }
74:
75: if (paginationMode == PAGINATION_FULL) {
76: addFeature(OutputProcessorFeature.PAGEBREAKS);
77: } else if (paginationMode == PAGINATION_MANUAL) {
78: addFeature(OutputProcessorFeature.PAGEBREAKS);
79: addFeature(OutputProcessorFeature.ITERATIVE_RENDERING);
80: addFeature(OutputProcessorFeature.UNALIGNED_PAGEBANDS);
81: } else {
82: addFeature(OutputProcessorFeature.ITERATIVE_RENDERING);
83: addFeature(OutputProcessorFeature.UNALIGNED_PAGEBANDS);
84: }
85: }
86:
87: /**
88: * The export descriptor is a string that describes the output characteristics. For libLayout outputs, it should start
89: * with the output class (one of 'pageable', 'flow' or 'stream'), followed by '/liblayout/' and finally followed by
90: * the output type (ie. PDF, Print, etc).
91: *
92: * @return the export descriptor.
93: */
94: public String getExportDescriptor() {
95: return "table/csv";
96: }
97: }
|