KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > jasperreports > engine > design > JRSourceCompileTask


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.design;
29
30 import java.util.List JavaDoc;
31 import java.util.Map JavaDoc;
32
33 import net.sf.jasperreports.crosstabs.design.JRDesignCrosstab;
34 import net.sf.jasperreports.engine.JRExpression;
35 import net.sf.jasperreports.engine.JRExpressionCollector;
36 import net.sf.jasperreports.engine.JRVariable;
37
38 /**
39  * Expression evaluator source code generation information.
40  *
41  * @author Lucian Chirita (lucianc@users.sourceforge.net)
42  * @version $Id: JRSourceCompileTask.java 1229 2006-04-19 13:27:35 +0300 (Wed, 19 Apr 2006) teodord $
43  */

44 public class JRSourceCompileTask
45 {
46     private JasperDesign jasperDesign;
47     private String JavaDoc unitName;
48     private JRExpressionCollector expressionCollector;
49     private Map JavaDoc parametersMap;
50     private Map JavaDoc fieldsMap;
51     private Map JavaDoc variablesMap;
52     private JRVariable[] variables;
53     private List JavaDoc expressions;
54     private boolean onlyDefaultEvaluation;
55     
56     
57     protected JRSourceCompileTask(JasperDesign jasperDesign, String JavaDoc unitName, JRExpressionCollector expressionCollector, Map JavaDoc parametersMap, Map JavaDoc fieldsMap, Map JavaDoc variablesMap, JRVariable[] variables, List JavaDoc expressions, boolean onlyDefaultEvaluation)
58     {
59         this.jasperDesign = jasperDesign;
60         this.unitName = unitName;
61         this.expressionCollector = expressionCollector;
62         this.parametersMap = parametersMap;
63         this.fieldsMap = fieldsMap;
64         this.variablesMap = variablesMap;
65         this.variables = variables;
66         this.expressions = expressions;
67         this.onlyDefaultEvaluation = onlyDefaultEvaluation;
68     }
69     
70     
71     /**
72      * Creates source code generation information for a dataset of a report.
73      *
74      * @param jasperDesign the report
75      * @param dataset the dataset
76      * @param expressionCollector the expression collector used for the report
77      * @param unitName the unit name of the code to be generated
78      */

79     public JRSourceCompileTask(JasperDesign jasperDesign, JRDesignDataset dataset, JRExpressionCollector expressionCollector, String JavaDoc unitName)
80     {
81         this(jasperDesign, unitName, expressionCollector,
82                 dataset.getParametersMap(), dataset.getFieldsMap(), dataset.getVariablesMap(), dataset.getVariables(),
83                 expressionCollector.getExpressions(dataset), false);
84     }
85     
86     
87     /**
88      * Creates source code generation information for a crosstab of a report.
89      *
90      * @param jasperDesign the report
91      * @param crosstab the crosstab
92      * @param expressionCollector the expression collector used for the report
93      * @param unitName the unit name of the code to be generated
94      */

95     public JRSourceCompileTask(JasperDesign jasperDesign, JRDesignCrosstab crosstab, JRExpressionCollector expressionCollector, String JavaDoc unitName)
96     {
97         this(jasperDesign, unitName, expressionCollector,
98                 crosstab.getParametersMap(), null, crosstab.getVariablesMap(), crosstab.getVariables(),
99                 expressionCollector.getExpressions(crosstab), true);
100     }
101
102
103     public List JavaDoc getExpressions()
104     {
105         return expressions;
106     }
107
108
109     public Map JavaDoc getFieldsMap()
110     {
111         return fieldsMap;
112     }
113
114
115     public JasperDesign getJasperDesign()
116     {
117         return jasperDesign;
118     }
119
120     
121     public String JavaDoc[] getImports()
122     {
123         return jasperDesign.getImports();
124     }
125     
126     
127     public boolean isOnlyDefaultEvaluation()
128     {
129         return onlyDefaultEvaluation;
130     }
131
132
133     public Map JavaDoc getParametersMap()
134     {
135         return parametersMap;
136     }
137
138
139     public String JavaDoc getUnitName()
140     {
141         return unitName;
142     }
143
144
145     public JRVariable[] getVariables()
146     {
147         return variables;
148     }
149
150
151     public Map JavaDoc getVariablesMap()
152     {
153         return variablesMap;
154     }
155     
156     
157     public Integer JavaDoc getExpressionId(JRExpression expression)
158     {
159         return expressionCollector.getExpressionId(expression);
160     }
161 }
162
Popular Tags