KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > jasperreports > crosstabs > JRCrosstabMeasure


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.crosstabs;
29
30 import net.sf.jasperreports.engine.JRExpression;
31 import net.sf.jasperreports.engine.JRVariable;
32
33 /**
34  * Crosstab measure interface.
35  * <p>
36  * A measure is a value that is accumulated by the crosstab and is displayed
37  * in the crosstab cells.
38  *
39  * @author Lucian Chirita (lucianc@users.sourceforge.net)
40  * @version $Id: JRCrosstabMeasure.java 1229 2006-04-19 13:27:35 +0300 (Wed, 19 Apr 2006) teodord $
41  */

42 public interface JRCrosstabMeasure
43 {
44     /**
45      * Percentage type indicating that the value will not be calculated
46      * as a percentage.
47      */

48     public static final byte PERCENTAGE_TYPE_NONE = 0;
49     
50     /**
51      * Percentage type indicating that the value will be calculated as percentage
52      * of the grand total value.
53      */

54     public static final byte PERCENTAGE_TYPE_GRAND_TOTAL = 1;
55
56     
57     /**
58      * Returns the name of the measure.
59      *
60      * @return the name of the measure
61      * @see #getVariable()
62      */

63     public String JavaDoc getName();
64     
65     
66     /**
67      * Returns the name of the value class for this measure.
68      *
69      * @return the name of the value class for this measure
70      */

71     public String JavaDoc getValueClassName();
72     
73     
74     /**
75      * Returns the value class of this measure.
76      *
77      * @return the value class of this measure
78      */

79     public Class JavaDoc getValueClass();
80     
81     
82     /**
83      * Returns the measure expression.
84      *
85      * @return the measure expression
86      */

87     public JRExpression getValueExpression();
88     
89     
90     /**
91      * Returns the calculation type which will be performed on the measure values.
92      * <p>
93      * The incrementer factory associated with this measure will create
94      * an incrementer which will sum the measure values.
95      * <p>
96      * The possible calculation type are the same as the ones used for variables
97      * (see {@link JRVariable#getCalculation() JRVariable.getCalculation()} with
98      * the exception of {@link JRVariable#CALCULATION_SYSTEM JRVariable.CALCULATION_SYSTEM}.
99      *
100      * @return the calculation type which will be performed on the measure values
101      * @see #getIncrementerFactoryClassName()
102      * @see net.sf.jasperreports.engine.fill.JRExtendedIncrementerFactory
103      * @see net.sf.jasperreports.engine.fill.JRExtendedIncrementer
104      */

105     public byte getCalculation();
106     
107     
108     /**
109      * Returns the incrementer factory class name.
110      * <p>
111      * Crosstab measures require extended incrementers, therefore
112      * the incrementer class should implement
113      * {@link net.sf.jasperreports.engine.fill.JRExtendedIncrementerFactory JRExtendedIncrementerFactory}.
114      *
115      * @return the incrementer factory class name
116      */

117     public String JavaDoc getIncrementerFactoryClassName();
118     
119     
120     /**
121      * Returns the incrementer factory class.
122      *
123      * @return the incrementer factory class
124      * @see #getIncrementerFactoryClassName()
125      */

126     public Class JavaDoc getIncrementerFactoryClass();
127
128     
129     /**
130      * Returns the percentage calculation type performed on this measure.
131      * <p>
132      * Currently, only percentage out of grand total is supported.
133      * <p>
134      * The possible values are:
135      * <ul>
136      * <li>{@link #PERCENTAGE_TYPE_NONE PERCENTAGE_TYPE_NONE}</li>
137      * <li>{@link #PERCENTAGE_TYPE_GRAND_TOTAL PERCENTAGE_TYPE_GRAND_TOTAL}</li>
138      * </ul>
139      * <p>
140      * If percentage calculation is required, the value class should be one of the built-in supported
141      * percentage types or the percentage calculator class should be specified.
142      *
143      * @return the percentage calculation type
144      * @see net.sf.jasperreports.crosstabs.fill.JRPercentageCalculatorFactory#hasBuiltInCalculator(Class)
145      * @see #getPercentageCalculatorClassName()
146      */

147     public byte getPercentageOfType();
148     
149     
150     /**
151      * Returns the percentage calculator class name.
152      *
153      * @return the percentage calculator class name
154      */

155     public String JavaDoc getPercentageCalculatorClassName();
156     
157     
158     /**
159      * Returns the percentage calcualtor class.
160      *
161      * @return the percentage calcualtor class
162      */

163     public Class JavaDoc getPercentageCalculatorClass();
164     
165     
166     /**
167      * Returns the variable associated with this measure.
168      * <p>
169      * The variable can be used inside the crosstab data cells as the
170      * measure value. The variable has the same name and value class as
171      * the measure.
172      *
173      * @return the variable associated with this measure
174      */

175     public JRVariable getVariable();
176 }
177
Popular Tags