KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > jasperreports > engine > JRExporterParameter


1 /*
2  * ============================================================================
3  * GNU Lesser General Public License
4  * ============================================================================
5  *
6  * JasperReports - Free Java report-generating library.
7  * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * 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,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
22  *
23  * JasperSoft Corporation
24  * 303 Second Street, Suite 450 North
25  * San Francisco, CA 94107
26  * http://www.jaspersoft.com
27  */

28 package net.sf.jasperreports.engine;
29
30 import net.sf.jasperreports.engine.export.JRExportProgressMonitor;
31
32
33 /**
34  * Instances of this class are used for defining and setting exporter parameters.
35  * <p>
36  * The {@link JasperPrint} object needed for the export can be specified in many ways: an instance of <tt>JasperPrint</tt>,
37  * an input stream, a file on disk, or an URL. The export engine will search for this object through parameters in the following
38  * order: JASPER_PRINT_LIST, JASPER_PRINT, INPUT_STREAM, INPUT_URL, INPUT_FILE, INPUT_FILE_NAME.
39  * <p>
40  * The output type of the export process can also vary: a string buffer, an output stream / writer of a file on disk. The order of
41  * parameters used by JasperReports when looking for the output depends on the final document format and is explained in detail
42  * for each format (see documentation for the children of this class).
43  * <p>
44  * JasperReports allows users to export only a page range from the entire report or even a single page. The engine first
45  * searches for the PAGE_INDEX parameter. If this is not present, it looks for the START_PAGE_INDEX and END_PAGE_INDEX
46  * parameters. The engine will try to narrow the page range (which is initially the entire report) by using these two
47  * parameters, if present.
48  *
49  * @author Teodor Danciu (teodord@users.sourceforge.net)
50  * @version $Id: JRExporterParameter.java 1404 2006-09-21 16:51:29 +0300 (Thu, 21 Sep 2006) teodord $
51  */

52 public class JRExporterParameter
53 {
54
55
56     /**
57      *
58      */

59     private String JavaDoc name = null;
60
61
62     /**
63      *
64      */

65     protected JRExporterParameter(String JavaDoc name)
66     {
67         this.name = name;
68     }
69
70
71     /**
72      *
73      */

74     public String JavaDoc toString()
75     {
76         return this.name;
77     }
78
79
80     /**
81      * The {@link JasperPrint} object that will be exported. If you already have a JasperPrint object, you can pass it
82      * to the export engine.
83      */

84     public static final JRExporterParameter JASPER_PRINT = new JRExporterParameter("JasperPrint Object");
85
86
87     /**
88      * A list of {@link JasperPrint} objects to be exported. If you need to concatenate several reports into the same
89      * document, you can use this feature.
90      */

91     public static final JRExporterParameter JASPER_PRINT_LIST = new JRExporterParameter("JasperPrint List");
92
93
94     /**
95      * The input stream that the exported {@link JasperPrint} object will be read from. If you want to read the JasperPrint
96      * object from an input stream (like a web location), you can pass the stream to this parameter.
97      */

98     public static final JRExporterParameter INPUT_STREAM = new JRExporterParameter("InputStream Object");
99
100
101     /**
102      * The URL that the {@link JasperPrint} object will be read from. If the JasperPrint object is available as a web
103      * resource, you can use this parameter, instead of opening a HTTP connection and read from the input stream.
104      */

105     public static final JRExporterParameter INPUT_URL = new JRExporterParameter("URL Object");
106
107
108     /**
109      * A <tt>java.io.File</tt> pointing to a file representing the serialized form of the {@link JasperPrint} object. This is
110      * useful if the JasperPrint object is representing a file on disk.
111      */

112     public static final JRExporterParameter INPUT_FILE = new JRExporterParameter("Input File");
113
114
115     /**
116      * A file representing the serialized form of the {@link JasperPrint} object. You can use this parameter to specify a file
117      * name where the object can be found.
118      */

119     public static final JRExporterParameter INPUT_FILE_NAME = new JRExporterParameter("Input File Name");
120
121
122     /**
123      * The string buffer to send the export output to. Useful for just storing the result in a string for later use.
124      */

125     public static final JRExporterParameter OUTPUT_STRING_BUFFER = new JRExporterParameter("Output StringBuffer Object");
126
127
128     /**
129      * The <tt>java.io.Writer</tt> instance that will be used to send the export output to. This is useful for sending
130      * the export result to a character stream, such as the <tt>PrintWriter</tt> of a servlet.
131      */

132     public static final JRExporterParameter OUTPUT_WRITER = new JRExporterParameter("Output Writer Object");
133
134
135     /**
136      * The <tt>java.io.OutputStream</tt> instance that will be used to send the export output to. This is useful for sending
137      * the export result to an output stream, such as a <tt>ServletOutputStream</tt>.
138      */

139     public static final JRExporterParameter OUTPUT_STREAM = new JRExporterParameter("OutputStream Object");
140
141
142     /**
143      * The <tt>java.io.File</tt> instance that will be used to specify the file name of the exported report. This is useful when
144      * exporting to a file and the <tt>File</tt> instance is already there.
145      */

146     public static final JRExporterParameter OUTPUT_FILE = new JRExporterParameter("Output File");
147
148
149     /**
150      * The file name of the exported report. This is an alternative to the OUTPUT_FILE parameter.
151      */

152     public static final JRExporterParameter OUTPUT_FILE_NAME = new JRExporterParameter("Output File Name");
153
154
155     /**
156      * An integer value representing the index of the page to be exported. This is useful when only one page of the entire
157      * report is needed for export.
158      */

159     public static final JRExporterParameter PAGE_INDEX = new JRExporterParameter("Page Index");
160
161
162     /**
163      * An integer value representing the start index of the page range to be exported. This is useful when only a range of
164      * pages is needed for export.
165      */

166     public static final JRExporterParameter START_PAGE_INDEX = new JRExporterParameter("Start Page Index");
167
168
169     /**
170      * An integer value representing the end index of the page range to be exported. This is useful when only a range of
171      * pages is needed for export.
172      */

173     public static final JRExporterParameter END_PAGE_INDEX = new JRExporterParameter("End Page Index");
174
175
176     /**
177      * The character encoding used for export.
178      */

179     public static final JRExporterParameter CHARACTER_ENCODING = new JRExporterParameter("Character Encoding");
180
181
182     /**
183      * A {@link JRExportProgressMonitor} instance for monitoring export status. This is useful for users who need to be
184      * notified after each page is exported (a GUI tool that shows a progress bar might need this feature).
185      */

186     public static final JRExporterParameter PROGRESS_MONITOR = new JRExporterParameter("Progress Monitor");
187
188
189     /**
190      * A parameter that allows users to move the entire content of each page horizontally. It is mostly useful for printing,
191      * when the report data does not fit inside the page margins.
192      */

193     public static final JRExporterParameter OFFSET_X = new JRExporterParameter("Offset X");
194
195
196     /**
197      * A parameter that allows users to move the entire content of each page vertically. It is mostly useful for printing,
198      * when the report data does not fit inside the page margins.
199      */

200     public static final JRExporterParameter OFFSET_Y = new JRExporterParameter("Offset Y");
201
202
203     /**
204      *
205      */

206     public static final JRExporterParameter FONT_MAP = new JRExporterParameter("Font Map");
207
208
209     /**
210      *
211      */

212     public static final JRExporterParameter CLASS_LOADER = new JRExporterParameter("Class Loader");
213
214     
215     /**
216      * URL stream handler factory to be used while exporting the report.
217      * <p/>
218      * The values should be of type {@link java.net.URLStreamHandlerFactory java.net.URLStreamHandlerFactory}.
219      *
220      * @see net.sf.jasperreports.engine.util.JRResourcesUtil#createURL(String, java.net.URLStreamHandlerFactory)
221      */

222     public static final JRExporterParameter URL_HANDLER_FACTORY = new JRExporterParameter("URL Handler Factory");
223
224 }
225
Popular Tags