KickJava   Java API By Example, From Geeks To Geeks.

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


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 java.awt.Color JavaDoc;
31
32
33 /**
34  * An abstract representation of a report element. All report elements implement this interface. The interface contains
35  * constants and methods that apply to all report elements.
36  *
37  * @author Teodor Danciu (teodord@users.sourceforge.net)
38  * @version $Id: JRElement.java 1229 2006-04-19 13:27:35 +0300 (Wed, 19 Apr 2006) teodord $
39  */

40 public interface JRElement extends JRChild, JRStyleContainer
41 {
42
43
44     /**
45      * The element will float in its parent section if it is pushed downwards by other elements fount above it.
46      * It will try to conserve the distance between it and the neighboring elements placed immediately above.
47      */

48     public static final byte POSITION_TYPE_FLOAT = 1;
49
50
51     /**
52      * The element will simply ignore what happens to the other section elements and tries to
53      * conserve the y offset measured from the top of its parent report section.
54      */

55     public static final byte POSITION_TYPE_FIX_RELATIVE_TO_TOP = 2;
56
57
58     /**
59      * If the height of the parent report section is affected by elements that stretch, the current element will try to
60      * conserve the original distance between its bottom margin and the bottom of the band.
61      */

62     public static final byte POSITION_TYPE_FIX_RELATIVE_TO_BOTTOM = 3;
63
64     /**
65      * Specifies that the element is opaque.
66      */

67     public static final byte MODE_OPAQUE = 1;
68
69
70     /**
71      * Specifies that the element is transparent.
72      */

73     public static final byte MODE_TRANSPARENT = 2;
74
75     /**
76      * The element preserves its original specified height.
77      */

78     public static final byte STRETCH_TYPE_NO_STRETCH = 0;
79
80     /**
81      * Users have the possibility to group the elements of a report section in multiple imbricate groups. The only
82      * reason one might have for grouping your report elements is to be able to stretch them to fit the tallest object.
83      */

84     public static final byte STRETCH_TYPE_RELATIVE_TO_TALLEST_OBJECT = 1;
85
86     /**
87      * The graphic element will adapt its height to match the new height of the report section it placed on, which
88      * has been affected by stretch.
89      */

90     public static final byte STRETCH_TYPE_RELATIVE_TO_BAND_HEIGHT = 2;
91
92
93     /**
94      * Returns the string value that uniquely identifies the element.
95      */

96     public String JavaDoc getKey();
97
98     /**
99      * Returns the position type for the element
100      * @return a byte value representing one of the position type constants in this class
101      */

102     public byte getPositionType();
103
104     /**
105      * Sets the position type for the element.
106      * @param positionType a byte value that must be one of the position type constants in this class
107      */

108     public void setPositionType(byte positionType);
109
110     /**
111      * Returns the stretch type for the element
112      * @return a byte value representing one of the strech type constants in this class
113      */

114     public byte getStretchType();
115
116     /**
117      * Sets the stretch type for the element.
118      * @param stretchType a byte value that must be one of the stretch type constants in this class
119      */

120     public void setStretchType(byte stretchType);
121         
122     /**
123      * Specifies if the element value will be printed for every iteration, even if its value has not changed.
124      * @see JRElement#isRemoveLineWhenBlank()
125      * @see JRElement#isPrintInFirstWholeBand()
126      */

127     public boolean isPrintRepeatedValues();
128     
129     /**
130      *
131      */

132     public void setPrintRepeatedValues(boolean isPrintRepeatedValues);
133
134
135     /**
136      * Returns the element transparency mode.
137      * The default value depends on the type of the report element. Graphic elements like rectangles and lines are
138      * opaque by default, but the images are transparent. Both static texts and text fields are transparent
139      * by default, and so are the subreport elements.
140      * @return MODE_OPAQUE or MODE_TRANSPARENT
141      */

142     public byte getMode();
143     
144     public Byte JavaDoc getOwnMode();
145
146     /**
147      * Returns the element transparency mode.
148      * The default value depends on the type of the report element. Graphic elements like rectangles and lines are
149      * opaque by default, but the images are transparent. Both static texts and text fields are transparent
150      * by default, and so are the subreport elements.
151      */

152     public void setMode(byte mode);
153     
154     public void setMode(Byte JavaDoc mode);
155     
156     /**
157      * Gets the the section relative horizontal offset of the element top left corner.
158      */

159     public int getX();
160     
161     /**
162      * Sets the the section relative horizontal offset of the element top left corner.
163      */

164     public void setX(int x);
165     
166     /**
167      * Gets the the section relative vertical offset of the element top left corner.
168      */

169     public int getY();
170     
171     /**
172      *
173      */

174     public int getWidth();
175     
176     /**
177      *
178      */

179     public void setWidth(int width);
180     
181     /**
182      *
183      */

184     public int getHeight();
185     
186     /**
187      * Returns true if the remaining blank space appearing when the value is not printed will be removed. Under certain
188      * circumstances (the element has an empty string as its value or contains a repeated value that is supressed) the
189      * space reserved for the current element remains empty. If this method returns true, it means the engine will try
190      * to suppress the blank line, but will only succeed if no other elements occupy the same vertical space.
191      */

192     public boolean isRemoveLineWhenBlank();
193     
194     /**
195      * Specifies whether the remaining blank space appearing when the value is not printed will be removed. Under certain
196      * circumstances (the element has an empty string as its value or contains a repeated value that is supressed) the
197      * space reserved for the current element remains empty. If the parameter is set to true, it means the engine will try
198      * to suppress the blank line, but will only succeed if no other elements occupy the same vertical space.
199      */

200     public void setRemoveLineWhenBlank(boolean isRemoveLineWhenBlank);
201     
202     /**
203      * Returns true if an element with a <i>printRepeatedValues</i> attribute set to true will be redisplayed for every
204      * new page or column that is not an overflow from a previous page or column.
205      * @see JRElement#isPrintRepeatedValues()
206      */

207     public boolean isPrintInFirstWholeBand();
208     
209     /**
210      * Specifies whether an element with a <i>printRepeatedValues</i> attribute set to true should be redisplayed for every
211      * new page or column that is not an overflow from a previous page or column.
212      * @see JRElement#isPrintRepeatedValues()
213      */

214     public void setPrintInFirstWholeBand(boolean isPrintInFirstWholeBand);
215     
216     /**
217      * If this is set to true, the element will be reprinted on the next page if the band does not fit in the current page.
218      * Actually if there is at least one element with this attribute, the band is redisplayed from the beginning, except
219      * those elements that fitted in the current page and have <i>isPrintWhenDetailOverflow</i> set to false.
220      */

221     public boolean isPrintWhenDetailOverflows();
222     
223     /**
224      * If this is set to true, the element will be reprinted on the next page if the band does not fit in the current page.
225      * Actually if there is at least one element with this attribute, the band is redisplayed from the beginning, except
226      * those elements that fitted in the current page and have <i>isPrintWhenDetailOverflow</i> set to false.
227      */

228     public void setPrintWhenDetailOverflows(boolean isPrintWhenDetailOverflows);
229     
230     /**
231      *
232      */

233     public Color JavaDoc getForecolor();
234     
235     /**
236      *
237      */

238     public Color JavaDoc getOwnForecolor();
239
240     /**
241      *
242      */

243     public void setForecolor(Color JavaDoc forecolor);
244     
245     /**
246      *
247      */

248     public Color JavaDoc getBackcolor();
249     
250     /**
251      *
252      */

253     public Color JavaDoc getOwnBackcolor();
254
255     /**
256      *
257      */

258     public void setBackcolor(Color JavaDoc backcolor);
259     
260     /**
261      * Gets the the expression that is evaluated in order to decide if the element should be displayed. The print
262      * expression always returns a boolean value.
263      */

264     public JRExpression getPrintWhenExpression();
265     
266     /**
267      * Returns the group for which an element with a <i>printRepeatedValues</i> attribute set to true will be redisplayed
268      * even if the value has not changed.
269      * @see JRElement#isPrintRepeatedValues()
270      */

271     public JRGroup getPrintWhenGroupChanges();
272     
273     /**
274      * Indicates the logical group that the element belongs to. More elements can be grouped in order to get the height
275      * of the tallest one.
276      * @see JRElement#STRETCH_TYPE_RELATIVE_TO_TALLEST_OBJECT
277      */

278     public JRElementGroup getElementGroup();
279
280     /**
281      *
282      */

283     public void collectExpressions(JRExpressionCollector collector);
284
285
286 }
287
Popular Tags