KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > jasperreports > engine > fill > JRTemplateFrame


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.fill;
29
30 import java.awt.Color JavaDoc;
31
32 import net.sf.jasperreports.engine.JRBox;
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.util.JRStyleResolver;
37
38 /**
39  * Frame information shared by multiple print frame objects.
40  *
41  * @author Lucian Chirita (lucianc@users.sourceforge.net)
42  * @version $Id: JRTemplateFrame.java 1307 2006-06-20 19:01:54 +0300 (Tue, 20 Jun 2006) teodord $
43  * @see net.sf.jasperreports.engine.fill.JRTemplatePrintFrame
44  */

45 public class JRTemplateFrame extends JRTemplateElement implements JRBox
46 {
47     private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID;
48
49     
50     /**
51      * Creates a template frame for a crosstab cell.
52      *
53      * @param cell the cell
54      */

55     public JRTemplateFrame(JRDefaultStyleProvider defaultStyleProvider, JRFillCellContents cell)
56     {
57         super(defaultStyleProvider);
58         
59         parentStyle = cell.getStyle();
60         
61         setBackcolor(cell.getBackcolor());
62         setMode(cell.getMode());
63         setBox(cell.getBox());
64     }
65     
66     
67     /**
68      * Creates a template frame for a frame.
69      *
70      * @param frame the frame
71      */

72     public JRTemplateFrame(JRDefaultStyleProvider defaultStyleProvider, JRFillFrame frame)
73     {
74         super(defaultStyleProvider);
75
76         setElement(frame);
77         setBox(frame);
78     }
79
80     /**
81      *
82      */

83     public byte getMode()
84     {
85         return JRStyleResolver.getMode(this, JRElement.MODE_TRANSPARENT);
86     }
87     
88     /**
89      * Sets the border of this template frame.
90      *
91      * @param box the border
92      */

93     protected void setBox(JRBox box)
94     {
95         if (box != null)
96         {
97             border = box.getOwnBorder();
98             topBorder = box.getOwnTopBorder();
99             leftBorder = box.getOwnLeftBorder();
100             bottomBorder = box.getOwnBottomBorder();
101             rightBorder = box.getOwnRightBorder();
102             borderColor = box.getOwnBorderColor();
103             topBorderColor = box.getOwnTopBorderColor();
104             leftBorderColor = box.getOwnLeftBorderColor();
105             bottomBorderColor = box.getOwnBottomBorderColor();
106             rightBorderColor = box.getOwnRightBorderColor();
107             padding = box.getOwnPadding();
108             topPadding = box.getOwnTopPadding();
109             leftPadding = box.getOwnLeftPadding();
110             bottomPadding = box.getOwnBottomPadding();
111             rightPadding = box.getOwnRightPadding();
112         }
113     }
114     
115     
116     //box
117
protected Byte JavaDoc border;
118     protected Byte JavaDoc topBorder = null;
119     protected Byte JavaDoc leftBorder = null;
120     protected Byte JavaDoc bottomBorder = null;
121     protected Byte JavaDoc rightBorder = null;
122     protected Color JavaDoc borderColor = null;
123     protected Color JavaDoc topBorderColor = null;
124     protected Color JavaDoc leftBorderColor = null;
125     protected Color JavaDoc bottomBorderColor = null;
126     protected Color JavaDoc rightBorderColor = null;
127     protected Integer JavaDoc padding;
128     protected Integer JavaDoc topPadding = null;
129     protected Integer JavaDoc leftPadding = null;
130     protected Integer JavaDoc bottomPadding = null;
131     protected Integer JavaDoc rightPadding = null;
132
133     /**
134      *
135      */

136     public byte getBorder()
137     {
138         return JRStyleResolver.getBorder(this);
139     }
140
141     public Byte JavaDoc getOwnBorder()
142     {
143         return border;
144     }
145
146     /**
147      *
148      */

149     public void setBorder(byte border)
150     {
151         this.border = new Byte JavaDoc(border);
152     }
153
154     /**
155      *
156      */

157     public Color JavaDoc getBorderColor()
158     {
159         return JRStyleResolver.getBorderColor(this, getForecolor());
160     }
161
162     public Color JavaDoc getOwnBorderColor()
163     {
164         return borderColor;
165     }
166
167     /**
168      *
169      */

170     public void setBorderColor(Color JavaDoc borderColor)
171     {
172         this.borderColor = borderColor;
173     }
174
175     /**
176      *
177      */

178     public int getPadding()
179     {
180         return JRStyleResolver.getPadding(this);
181     }
182
183     public Integer JavaDoc getOwnPadding()
184     {
185         return padding;
186     }
187
188     /**
189      *
190      */

191     public void setPadding(int padding)
192     {
193         this.padding = new Integer JavaDoc(padding);
194     }
195
196     /**
197      *
198      */

199     public byte getTopBorder()
200     {
201         return JRStyleResolver.getTopBorder(this);
202     }
203
204     /**
205      *
206      */

207     public Byte JavaDoc getOwnTopBorder()
208     {
209         return topBorder;
210     }
211
212     /**
213      *
214      */

215     public void setTopBorder(byte topBorder)
216     {
217         this.topBorder = new Byte JavaDoc(topBorder);
218     }
219
220     /**
221      *
222      */

223     public Color JavaDoc getTopBorderColor()
224     {
225         return JRStyleResolver.getTopBorderColor(this, getForecolor());
226     }
227
228     /**
229      *
230      */

231     public Color JavaDoc getOwnTopBorderColor()
232     {
233         return topBorderColor;
234     }
235
236     /**
237      *
238      */

239     public void setTopBorderColor(Color JavaDoc topBorderColor)
240     {
241         this.topBorderColor = topBorderColor;
242     }
243
244     /**
245      *
246      */

247     public int getTopPadding()
248     {
249         return JRStyleResolver.getTopPadding(this);
250     }
251
252     /**
253      *
254      */

255     public Integer JavaDoc getOwnTopPadding()
256     {
257         return topPadding;
258     }
259
260     /**
261      *
262      */

263     public void setTopPadding(int topPadding)
264     {
265         this.topPadding = new Integer JavaDoc(topPadding);
266     }
267
268     /**
269      *
270      */

271     public byte getLeftBorder()
272     {
273         return JRStyleResolver.getLeftBorder(this);
274     }
275
276     /**
277      *
278      */

279     public Byte JavaDoc getOwnLeftBorder()
280     {
281         return leftBorder;
282     }
283
284     /**
285      *
286      */

287     public void setLeftBorder(byte leftBorder)
288     {
289         this.leftBorder = new Byte JavaDoc(leftBorder);
290     }
291
292     /**
293      *
294      */

295     public Color JavaDoc getLeftBorderColor()
296     {
297         return JRStyleResolver.getLeftBorderColor(this, getForecolor());
298     }
299
300     /**
301      *
302      */

303     public Color JavaDoc getOwnLeftBorderColor()
304     {
305         return leftBorderColor;
306     }
307
308     /**
309      *
310      */

311     public void setLeftBorderColor(Color JavaDoc leftBorderColor)
312     {
313         this.leftBorderColor = leftBorderColor;
314     }
315
316     /**
317      *
318      */

319     public int getLeftPadding()
320     {
321         return JRStyleResolver.getLeftPadding(this);
322     }
323
324     /**
325      *
326      */

327     public Integer JavaDoc getOwnLeftPadding()
328     {
329         return leftPadding;
330     }
331
332     /**
333      *
334      */

335     public void setLeftPadding(int leftPadding)
336     {
337         this.leftPadding = new Integer JavaDoc(leftPadding);
338     }
339
340     /**
341      *
342      */

343     public byte getBottomBorder()
344     {
345         return JRStyleResolver.getBottomBorder(this);
346     }
347
348     /**
349      *
350      */

351     public Byte JavaDoc getOwnBottomBorder()
352     {
353         return bottomBorder;
354     }
355
356     /**
357      *
358      */

359     public void setBottomBorder(byte bottomBorder)
360     {
361         this.bottomBorder = new Byte JavaDoc(bottomBorder);
362     }
363
364     /**
365      *
366      */

367     public Color JavaDoc getBottomBorderColor()
368     {
369         return JRStyleResolver.getBottomBorderColor(this, getForecolor());
370     }
371
372     /**
373      *
374      */

375     public Color JavaDoc getOwnBottomBorderColor()
376     {
377         return bottomBorderColor;
378     }
379
380     /**
381      *
382      */

383     public void setBottomBorderColor(Color JavaDoc bottomBorderColor)
384     {
385         this.bottomBorderColor = bottomBorderColor;
386     }
387
388     /**
389      *
390      */

391     public int getBottomPadding()
392     {
393         return JRStyleResolver.getBottomPadding(this);
394     }
395
396     /**
397      *
398      */

399     public Integer JavaDoc getOwnBottomPadding()
400     {
401         return bottomPadding;
402     }
403
404     /**
405      *
406      */

407     public void setBottomPadding(int bottomPadding)
408     {
409         this.bottomPadding = new Integer JavaDoc(bottomPadding);
410     }
411
412     /**
413      *
414      */

415     public byte getRightBorder()
416     {
417         return JRStyleResolver.getRightBorder(this);
418     }
419
420     /**
421      *
422      */

423     public Byte JavaDoc getOwnRightBorder()
424     {
425         return rightBorder;
426     }
427
428     /**
429      *
430      */

431     public void setRightBorder(byte rightBorder)
432     {
433         this.rightBorder = new Byte JavaDoc(rightBorder);
434     }
435
436     /**
437      *
438      */

439     public Color JavaDoc getRightBorderColor()
440     {
441         return JRStyleResolver.getRightBorderColor(this, getForecolor());
442     }
443
444     /**
445      *
446      */

447     public Color JavaDoc getOwnRightBorderColor()
448     {
449         return rightBorderColor;
450     }
451
452     /**
453      *
454      */

455     public void setRightBorderColor(Color JavaDoc rightBorderColor)
456     {
457         this.rightBorderColor = rightBorderColor;
458     }
459
460     /**
461      *
462      */

463     public int getRightPadding()
464     {
465         return JRStyleResolver.getRightPadding(this);
466     }
467
468     /**
469      *
470      */

471     public Integer JavaDoc getOwnRightPadding()
472     {
473         return rightPadding;
474     }
475
476     /**
477      *
478      */

479     public void setRightPadding(int rightPadding)
480     {
481         this.rightPadding = new Integer JavaDoc(rightPadding);
482     }
483
484     /**
485      *
486      */

487     public void setBorder(Byte JavaDoc border)
488     {
489         this.border = border;
490     }
491
492     /**
493      *
494      */

495     public void setPadding(Integer JavaDoc padding)
496     {
497         this.padding = padding;
498     }
499
500     /**
501      *
502      */

503     public void setTopBorder(Byte JavaDoc topBorder)
504     {
505         this.topBorder = topBorder;
506     }
507
508     /**
509      *
510      */

511     public void setTopPadding(Integer JavaDoc topPadding)
512     {
513         this.topPadding = topPadding;
514     }
515
516     /**
517      *
518      */

519     public void setLeftBorder(Byte JavaDoc leftBorder)
520     {
521         this.leftBorder = leftBorder;
522     }
523
524     /**
525      *
526      */

527     public void setLeftPadding(Integer JavaDoc leftPadding)
528     {
529         this.leftPadding = leftPadding;
530     }
531
532     /**
533      *
534      */

535     public void setBottomBorder(Byte JavaDoc bottomBorder)
536     {
537         this.bottomBorder = bottomBorder;
538     }
539
540     /**
541      *
542      */

543     public void setBottomPadding(Integer JavaDoc bottomPadding)
544     {
545         this.bottomPadding = bottomPadding;
546     }
547
548     /**
549      *
550      */

551     public void setRightBorder(Byte JavaDoc rightBorder)
552     {
553         this.rightBorder = rightBorder;
554     }
555
556     /**
557      *
558      */

559     public void setRightPadding(Integer JavaDoc rightPadding)
560     {
561         this.rightPadding = rightPadding;
562     }
563     
564 }
565
Popular Tags