001: /*
002: * ============================================================================
003: * GNU Lesser General Public License
004: * ============================================================================
005: *
006: * JasperReports - Free Java report-generating library.
007: * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com
008: *
009: * This library is free software; you can redistribute it and/or
010: * modify it under the terms of the GNU Lesser General Public
011: * License as published by the Free Software Foundation; either
012: * version 2.1 of the License, or (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017: * Lesser General Public License for more details.
018: *
019: * You should have received a copy of the GNU Lesser General Public
020: * License along with this library; if not, write to the Free Software
021: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
022: *
023: * JasperSoft Corporation
024: * 303 Second Street, Suite 450 North
025: * San Francisco, CA 94107
026: * http://www.jaspersoft.com
027: */
028: package net.sf.jasperreports.engine;
029:
030: import java.awt.Color;
031:
032: /**
033: * An abstract representation of a report element. All report elements implement this interface. The interface contains
034: * constants and methods that apply to all report elements.
035: *
036: * @author Teodor Danciu (teodord@users.sourceforge.net)
037: * @version $Id: JRElement.java 1229 2006-04-19 10:27:35Z teodord $
038: */
039: public interface JRElement extends JRChild, JRStyleContainer {
040:
041: /**
042: * The element will float in its parent section if it is pushed downwards by other elements fount above it.
043: * It will try to conserve the distance between it and the neighboring elements placed immediately above.
044: */
045: public static final byte POSITION_TYPE_FLOAT = 1;
046:
047: /**
048: * The element will simply ignore what happens to the other section elements and tries to
049: * conserve the y offset measured from the top of its parent report section.
050: */
051: public static final byte POSITION_TYPE_FIX_RELATIVE_TO_TOP = 2;
052:
053: /**
054: * If the height of the parent report section is affected by elements that stretch, the current element will try to
055: * conserve the original distance between its bottom margin and the bottom of the band.
056: */
057: public static final byte POSITION_TYPE_FIX_RELATIVE_TO_BOTTOM = 3;
058:
059: /**
060: * Specifies that the element is opaque.
061: */
062: public static final byte MODE_OPAQUE = 1;
063:
064: /**
065: * Specifies that the element is transparent.
066: */
067: public static final byte MODE_TRANSPARENT = 2;
068:
069: /**
070: * The element preserves its original specified height.
071: */
072: public static final byte STRETCH_TYPE_NO_STRETCH = 0;
073:
074: /**
075: * Users have the possibility to group the elements of a report section in multiple imbricate groups. The only
076: * reason one might have for grouping your report elements is to be able to stretch them to fit the tallest object.
077: */
078: public static final byte STRETCH_TYPE_RELATIVE_TO_TALLEST_OBJECT = 1;
079:
080: /**
081: * The graphic element will adapt its height to match the new height of the report section it placed on, which
082: * has been affected by stretch.
083: */
084: public static final byte STRETCH_TYPE_RELATIVE_TO_BAND_HEIGHT = 2;
085:
086: /**
087: * Returns the string value that uniquely identifies the element.
088: */
089: public String getKey();
090:
091: /**
092: * Returns the position type for the element
093: * @return a byte value representing one of the position type constants in this class
094: */
095: public byte getPositionType();
096:
097: /**
098: * Sets the position type for the element.
099: * @param positionType a byte value that must be one of the position type constants in this class
100: */
101: public void setPositionType(byte positionType);
102:
103: /**
104: * Returns the stretch type for the element
105: * @return a byte value representing one of the strech type constants in this class
106: */
107: public byte getStretchType();
108:
109: /**
110: * Sets the stretch type for the element.
111: * @param stretchType a byte value that must be one of the stretch type constants in this class
112: */
113: public void setStretchType(byte stretchType);
114:
115: /**
116: * Specifies if the element value will be printed for every iteration, even if its value has not changed.
117: * @see JRElement#isRemoveLineWhenBlank()
118: * @see JRElement#isPrintInFirstWholeBand()
119: */
120: public boolean isPrintRepeatedValues();
121:
122: /**
123: *
124: */
125: public void setPrintRepeatedValues(boolean isPrintRepeatedValues);
126:
127: /**
128: * Returns the element transparency mode.
129: * The default value depends on the type of the report element. Graphic elements like rectangles and lines are
130: * opaque by default, but the images are transparent. Both static texts and text fields are transparent
131: * by default, and so are the subreport elements.
132: * @return MODE_OPAQUE or MODE_TRANSPARENT
133: */
134: public byte getMode();
135:
136: public Byte getOwnMode();
137:
138: /**
139: * Returns the element transparency mode.
140: * The default value depends on the type of the report element. Graphic elements like rectangles and lines are
141: * opaque by default, but the images are transparent. Both static texts and text fields are transparent
142: * by default, and so are the subreport elements.
143: */
144: public void setMode(byte mode);
145:
146: public void setMode(Byte mode);
147:
148: /**
149: * Gets the the section relative horizontal offset of the element top left corner.
150: */
151: public int getX();
152:
153: /**
154: * Sets the the section relative horizontal offset of the element top left corner.
155: */
156: public void setX(int x);
157:
158: /**
159: * Gets the the section relative vertical offset of the element top left corner.
160: */
161: public int getY();
162:
163: /**
164: *
165: */
166: public int getWidth();
167:
168: /**
169: *
170: */
171: public void setWidth(int width);
172:
173: /**
174: *
175: */
176: public int getHeight();
177:
178: /**
179: * Returns true if the remaining blank space appearing when the value is not printed will be removed. Under certain
180: * circumstances (the element has an empty string as its value or contains a repeated value that is supressed) the
181: * space reserved for the current element remains empty. If this method returns true, it means the engine will try
182: * to suppress the blank line, but will only succeed if no other elements occupy the same vertical space.
183: */
184: public boolean isRemoveLineWhenBlank();
185:
186: /**
187: * Specifies whether 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 the parameter is set to 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 void setRemoveLineWhenBlank(boolean isRemoveLineWhenBlank);
193:
194: /**
195: * Returns true if an element with a <i>printRepeatedValues</i> attribute set to true will be redisplayed for every
196: * new page or column that is not an overflow from a previous page or column.
197: * @see JRElement#isPrintRepeatedValues()
198: */
199: public boolean isPrintInFirstWholeBand();
200:
201: /**
202: * Specifies whether an element with a <i>printRepeatedValues</i> attribute set to true should be redisplayed for every
203: * new page or column that is not an overflow from a previous page or column.
204: * @see JRElement#isPrintRepeatedValues()
205: */
206: public void setPrintInFirstWholeBand(boolean isPrintInFirstWholeBand);
207:
208: /**
209: * 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.
210: * Actually if there is at least one element with this attribute, the band is redisplayed from the beginning, except
211: * those elements that fitted in the current page and have <i>isPrintWhenDetailOverflow</i> set to false.
212: */
213: public boolean isPrintWhenDetailOverflows();
214:
215: /**
216: * 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.
217: * Actually if there is at least one element with this attribute, the band is redisplayed from the beginning, except
218: * those elements that fitted in the current page and have <i>isPrintWhenDetailOverflow</i> set to false.
219: */
220: public void setPrintWhenDetailOverflows(
221: boolean isPrintWhenDetailOverflows);
222:
223: /**
224: *
225: */
226: public Color getForecolor();
227:
228: /**
229: *
230: */
231: public Color getOwnForecolor();
232:
233: /**
234: *
235: */
236: public void setForecolor(Color forecolor);
237:
238: /**
239: *
240: */
241: public Color getBackcolor();
242:
243: /**
244: *
245: */
246: public Color getOwnBackcolor();
247:
248: /**
249: *
250: */
251: public void setBackcolor(Color backcolor);
252:
253: /**
254: * Gets the the expression that is evaluated in order to decide if the element should be displayed. The print
255: * expression always returns a boolean value.
256: */
257: public JRExpression getPrintWhenExpression();
258:
259: /**
260: * Returns the group for which an element with a <i>printRepeatedValues</i> attribute set to true will be redisplayed
261: * even if the value has not changed.
262: * @see JRElement#isPrintRepeatedValues()
263: */
264: public JRGroup getPrintWhenGroupChanges();
265:
266: /**
267: * Indicates the logical group that the element belongs to. More elements can be grouped in order to get the height
268: * of the tallest one.
269: * @see JRElement#STRETCH_TYPE_RELATIVE_TO_TALLEST_OBJECT
270: */
271: public JRElementGroup getElementGroup();
272:
273: /**
274: *
275: */
276: public void collectExpressions(JRExpressionCollector collector);
277:
278: }
|