KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > jasperreports > engine > base > JRBasePrintElement


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.base;
29
30 import java.awt.Color JavaDoc;
31 import java.io.Serializable JavaDoc;
32
33 import net.sf.jasperreports.engine.JRConstants;
34 import net.sf.jasperreports.engine.JRDefaultStyleProvider;
35 import net.sf.jasperreports.engine.JRElement;
36 import net.sf.jasperreports.engine.JRPrintElement;
37 import net.sf.jasperreports.engine.JRStyle;
38 import net.sf.jasperreports.engine.util.JRStyleResolver;
39
40
41 /**
42  * @author Teodor Danciu (teodord@users.sourceforge.net)
43  * @version $Id: JRBasePrintElement.java 1471 2006-11-09 18:16:34 +0200 (Thu, 09 Nov 2006) lucianc $
44  */

45 public class JRBasePrintElement implements JRPrintElement, Serializable JavaDoc
46 {
47
48
49     /**
50      *
51      */

52     private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID;
53
54     protected String JavaDoc key;
55     
56     /**
57      *
58      */

59     protected Byte JavaDoc mode = null;
60     protected int x = 0;
61     protected int y = 0;
62     protected int width = 0;
63     protected int height = 0;
64     protected Color JavaDoc forecolor = null;
65     protected Color JavaDoc backcolor = null;
66
67     protected JRDefaultStyleProvider defaultStyleProvider;
68     protected JRStyle style = null;
69
70     
71     /**
72      *
73      */

74     public JRBasePrintElement(JRDefaultStyleProvider defaultStyleProvider)
75     {
76         this.defaultStyleProvider = defaultStyleProvider;
77     }
78     
79
80     /**
81      *
82      */

83     public JRDefaultStyleProvider getDefaultStyleProvider()
84     {
85         return defaultStyleProvider;
86     }
87     
88     /**
89      *
90      */

91     public JRStyle getStyle()
92     {
93         return style;
94     }
95     
96     /**
97      *
98      */

99     public void setStyle(JRStyle style)
100     {
101         this.style = style;
102     }
103
104     /**
105      *
106      */

107     public byte getMode()
108     {
109         return JRStyleResolver.getMode(this, JRElement.MODE_OPAQUE);
110     }
111     
112     /**
113      *
114      */

115     public Byte JavaDoc getOwnMode()
116     {
117         return mode;
118     }
119     
120     /**
121      *
122      */

123     public void setMode(byte mode)
124     {
125         this.mode = new Byte JavaDoc(mode);
126     }
127     
128     /**
129      *
130      */

131     public void setMode(Byte JavaDoc mode)
132     {
133         this.mode = mode;
134     }
135     
136     /**
137      *
138      */

139     public int getX()
140     {
141         return this.x;
142     }
143     
144     /**
145      *
146      */

147     public void setX(int x)
148     {
149         this.x = x;
150     }
151     
152     /**
153      *
154      */

155     public int getY()
156     {
157         return this.y;
158     }
159     
160     /**
161      *
162      */

163     public void setY(int y)
164     {
165         this.y = y;
166     }
167     
168     /**
169      *
170      */

171     public int getWidth()
172     {
173         return this.width;
174     }
175     
176     /**
177      *
178      */

179     public void setWidth(int width)
180     {
181         this.width = width;
182     }
183     
184     /**
185      *
186      */

187     public int getHeight()
188     {
189         return this.height;
190     }
191     
192     /**
193      *
194      */

195     public void setHeight(int height)
196     {
197         this.height = height;
198     }
199     
200     /**
201      *
202      */

203     public Color JavaDoc getForecolor()
204     {
205         return JRStyleResolver.getForecolor(this);
206     }
207     
208     /**
209      *
210      */

211     public Color JavaDoc getOwnForecolor()
212     {
213         return forecolor;
214     }
215     
216     /**
217      *
218      */

219     public void setForecolor(Color JavaDoc forecolor)
220     {
221         this.forecolor = forecolor;
222     }
223     
224     /**
225      *
226      */

227     public Color JavaDoc getBackcolor()
228     {
229         return JRStyleResolver.getBackcolor(this);
230     }
231
232     /**
233      *
234      */

235     public Color JavaDoc getOwnBackcolor()
236     {
237         return backcolor;
238     }
239
240     /**
241      *
242      */

243     public void setBackcolor(Color JavaDoc backcolor)
244     {
245         this.backcolor = backcolor;
246     }
247
248
249     
250     public String JavaDoc getKey()
251     {
252         return key;
253     }
254
255
256     /**
257      * Sets the print element key.
258      *
259      * @param key the element key
260      * @see #getKey()
261      */

262     public void setKey(String JavaDoc key)
263     {
264         this.key = key;
265     }
266     
267
268 }
269
Popular Tags