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.base;
029:
030: import java.awt.Color;
031: import java.io.Serializable;
032:
033: import net.sf.jasperreports.engine.JRConstants;
034: import net.sf.jasperreports.engine.JRDefaultStyleProvider;
035: import net.sf.jasperreports.engine.JRElement;
036: import net.sf.jasperreports.engine.JRPrintElement;
037: import net.sf.jasperreports.engine.JRStyle;
038: import net.sf.jasperreports.engine.util.JRStyleResolver;
039:
040: /**
041: * @author Teodor Danciu (teodord@users.sourceforge.net)
042: * @version $Id: JRBasePrintElement.java 1759 2007-06-20 16:47:34Z lucianc $
043: */
044: public class JRBasePrintElement implements JRPrintElement, Serializable {
045:
046: /**
047: *
048: */
049: private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID;
050:
051: protected String key;
052:
053: /**
054: *
055: */
056: protected Byte mode = null;
057: protected int x = 0;
058: protected int y = 0;
059: protected int width = 0;
060: protected int height = 0;
061: protected Color forecolor = null;
062: protected Color backcolor = null;
063:
064: protected JRDefaultStyleProvider defaultStyleProvider;
065: protected JRStyle style = null;
066:
067: /**
068: *
069: */
070: public JRBasePrintElement(
071: JRDefaultStyleProvider defaultStyleProvider) {
072: this .defaultStyleProvider = defaultStyleProvider;
073: }
074:
075: /**
076: *
077: */
078: public JRDefaultStyleProvider getDefaultStyleProvider() {
079: return defaultStyleProvider;
080: }
081:
082: /**
083: *
084: */
085: public JRStyle getStyle() {
086: return style;
087: }
088:
089: /**
090: *
091: */
092: public void setStyle(JRStyle style) {
093: this .style = style;
094: }
095:
096: /**
097: *
098: */
099: public byte getMode() {
100: return JRStyleResolver.getMode(this , JRElement.MODE_OPAQUE);
101: }
102:
103: /**
104: *
105: */
106: public Byte getOwnMode() {
107: return mode;
108: }
109:
110: /**
111: *
112: */
113: public void setMode(byte mode) {
114: this .mode = new Byte(mode);
115: }
116:
117: /**
118: *
119: */
120: public void setMode(Byte mode) {
121: this .mode = mode;
122: }
123:
124: /**
125: *
126: */
127: public int getX() {
128: return this .x;
129: }
130:
131: /**
132: *
133: */
134: public void setX(int x) {
135: this .x = x;
136: }
137:
138: /**
139: *
140: */
141: public int getY() {
142: return this .y;
143: }
144:
145: /**
146: *
147: */
148: public void setY(int y) {
149: this .y = y;
150: }
151:
152: /**
153: *
154: */
155: public int getWidth() {
156: return this .width;
157: }
158:
159: /**
160: *
161: */
162: public void setWidth(int width) {
163: this .width = width;
164: }
165:
166: /**
167: *
168: */
169: public int getHeight() {
170: return this .height;
171: }
172:
173: /**
174: *
175: */
176: public void setHeight(int height) {
177: this .height = height;
178: }
179:
180: /**
181: *
182: */
183: public Color getForecolor() {
184: return JRStyleResolver.getForecolor(this );
185: }
186:
187: /**
188: *
189: */
190: public Color getOwnForecolor() {
191: return forecolor;
192: }
193:
194: /**
195: *
196: */
197: public void setForecolor(Color forecolor) {
198: this .forecolor = forecolor;
199: }
200:
201: /**
202: *
203: */
204: public Color getBackcolor() {
205: return JRStyleResolver.getBackcolor(this );
206: }
207:
208: /**
209: *
210: */
211: public Color getOwnBackcolor() {
212: return backcolor;
213: }
214:
215: /**
216: *
217: */
218: public void setBackcolor(Color backcolor) {
219: this .backcolor = backcolor;
220: }
221:
222: public String getKey() {
223: return key;
224: }
225:
226: /**
227: * Sets the print element key.
228: *
229: * @param key the element key
230: * @see #getKey()
231: */
232: public void setKey(String key) {
233: this .key = key;
234: }
235:
236: /**
237: * Returns null as external style references are not allowed for print objects.
238: */
239: public String getStyleNameReference() {
240: return null;
241: }
242:
243: }
|