KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > jasperreports > engine > util > JRStyleResolver


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.util;
29
30 import java.awt.Color JavaDoc;
31
32 import net.sf.jasperreports.engine.JRAlignment;
33 import net.sf.jasperreports.engine.JRBox;
34 import net.sf.jasperreports.engine.JRElement;
35 import net.sf.jasperreports.engine.JRFont;
36 import net.sf.jasperreports.engine.JRGraphicElement;
37 import net.sf.jasperreports.engine.JRImage;
38 import net.sf.jasperreports.engine.JRPrintElement;
39 import net.sf.jasperreports.engine.JRPrintGraphicElement;
40 import net.sf.jasperreports.engine.JRPrintImage;
41 import net.sf.jasperreports.engine.JRPrintRectangle;
42 import net.sf.jasperreports.engine.JRPrintText;
43 import net.sf.jasperreports.engine.JRRectangle;
44 import net.sf.jasperreports.engine.JRStyle;
45 import net.sf.jasperreports.engine.JRStyleContainer;
46 import net.sf.jasperreports.engine.JRTextElement;
47 import net.sf.jasperreports.engine.JRTextField;
48 import net.sf.jasperreports.engine.fill.JRTemplateElement;
49 import net.sf.jasperreports.engine.fill.JRTemplateGraphicElement;
50 import net.sf.jasperreports.engine.fill.JRTemplateImage;
51 import net.sf.jasperreports.engine.fill.JRTemplateRectangle;
52 import net.sf.jasperreports.engine.fill.JRTemplateText;
53
54
55 /**
56  * @author Teodor Danciu (teodord@users.sourceforge.net)
57  * @version $Id: JRStyleResolver.java 1505 2006-11-23 15:48:47 +0200 (Thu, 23 Nov 2006) teodord $
58  */

59 public class JRStyleResolver
60 {
61
62
63     /**
64      *
65      */

66     private static JRFont getBaseFont(JRFont font)
67     {
68         if (font.getReportFont() != null)
69             return font.getReportFont();
70         if (font.getDefaultStyleProvider() != null)
71             return font.getDefaultStyleProvider().getDefaultFont();
72         return null;
73     }
74     
75     /**
76      *
77      */

78     private static JRStyle getBaseStyle(JRStyleContainer styleContainer)
79     {
80         if (styleContainer.getStyle() != null)
81             return styleContainer.getStyle();
82         if (styleContainer.getDefaultStyleProvider() != null)
83             return styleContainer.getDefaultStyleProvider().getDefaultStyle();
84         return null;
85     }
86
87
88     /**
89      *
90      */

91     public static byte getMode(JRElement element, byte defaultMode)
92     {
93         if (element.getOwnMode() != null)
94             return element.getOwnMode().byteValue();
95         JRStyle style = getBaseStyle(element);
96         if (style != null && style.getMode() != null)
97             return style.getMode().byteValue();
98         return defaultMode;
99     }
100
101     /**
102      *
103      */

104     public static byte getMode(JRPrintElement element, byte defaultMode)
105     {
106         if (element.getOwnMode() != null)
107             return element.getOwnMode().byteValue();
108         JRStyle style = getBaseStyle(element);
109         if (style != null && style.getMode() != null)
110             return style.getMode().byteValue();
111         return defaultMode;
112     }
113
114     /**
115      *
116      */

117     public static byte getMode(JRTemplateElement element, byte defaultMode)
118     {
119         if (element.getOwnMode() != null)
120             return element.getOwnMode().byteValue();
121         JRStyle style = getBaseStyle(element);
122         if (style != null && style.getMode() != null)
123             return style.getMode().byteValue();
124         return defaultMode;
125     }
126
127     /**
128      *
129      */

130     public static Byte JavaDoc getMode(JRStyle style)
131     {
132         if (style.getOwnMode() != null)
133             return style.getOwnMode();
134         JRStyle baseStyle = getBaseStyle(style);
135         if (baseStyle != null)
136             return baseStyle.getMode();
137         return null;
138     }
139
140     /**
141      *
142      */

143     public static Color JavaDoc getForecolor(JRElement element)
144     {
145         if (element.getOwnForecolor() != null)
146             return element.getOwnForecolor();
147         JRStyle style = getBaseStyle(element);
148         if (style != null && style.getForecolor() != null)
149             return style.getForecolor();
150         return Color.black;
151     }
152
153     /**
154      *
155      */

156     public static Color JavaDoc getForecolor(JRPrintElement element)
157     {
158         if (element.getOwnForecolor() != null)
159             return element.getOwnForecolor();
160         JRStyle style = getBaseStyle(element);
161         if (style != null && style.getForecolor() != null)
162             return style.getForecolor();
163         return Color.black;
164     }
165
166     /**
167      *
168      */

169     public static Color JavaDoc getForecolor(JRTemplateElement element)
170     {
171         if (element.getOwnForecolor() != null)
172             return element.getOwnForecolor();
173         JRStyle style = getBaseStyle(element);
174         if (style != null && style.getForecolor() != null)
175             return style.getForecolor();
176         return Color.black;
177     }
178
179     /**
180      *
181      */

182     public static Color JavaDoc getForecolor(JRStyle style)
183     {
184         if (style.getOwnForecolor() != null)
185             return style.getOwnForecolor();
186         JRStyle baseStyle = getBaseStyle(style);
187         if (baseStyle != null)
188             return baseStyle.getForecolor();
189         return null;
190     }
191
192     /**
193      *
194      */

195     public static Color JavaDoc getBackcolor(JRElement element)
196     {
197         if (element.getOwnBackcolor() != null)
198             return element.getOwnBackcolor();
199         JRStyle style = getBaseStyle(element);
200         if (style != null && style.getBackcolor() != null)
201             return style.getBackcolor();
202         return Color.white;
203     }
204
205     /**
206      *
207      */

208     public static Color JavaDoc getBackcolor(JRPrintElement element)
209     {
210         if (element.getOwnBackcolor() != null)
211             return element.getOwnBackcolor();
212         JRStyle style = getBaseStyle(element);
213         if (style != null && style.getBackcolor() != null)
214             return style.getBackcolor();
215         return Color.white;
216     }
217
218     /**
219      *
220      */

221     public static Color JavaDoc getBackcolor(JRTemplateElement element)
222     {
223         if (element.getOwnBackcolor() != null)
224             return element.getOwnBackcolor();
225         JRStyle style = getBaseStyle(element);
226         if (style != null && style.getBackcolor() != null)
227             return style.getBackcolor();
228         return Color.white;
229     }
230
231     /**
232      *
233      */

234     public static Color JavaDoc getBackcolor(JRStyle style)
235     {
236         if (style.getOwnBackcolor() != null)
237             return style.getOwnBackcolor();
238         JRStyle baseStyle = getBaseStyle(style);
239         if (baseStyle != null)
240             return baseStyle.getBackcolor();
241         return null;
242     }
243
244     /**
245      *
246      */

247     public static byte getPen(JRGraphicElement element, byte defaultPen)
248     {
249         if (element.getOwnPen() != null)
250             return element.getOwnPen().byteValue();
251         JRStyle baseStyle = getBaseStyle(element);
252         if (baseStyle != null && baseStyle.getPen() != null)
253             return baseStyle.getPen().byteValue();
254         return defaultPen;
255     }
256
257     /**
258      *
259      */

260     public static byte getPen(JRPrintGraphicElement element, byte defaultPen)
261     {
262         if (element.getOwnPen() != null)
263             return element.getOwnPen().byteValue();
264         JRStyle baseStyle = getBaseStyle(element);
265         if (baseStyle != null && baseStyle.getPen() != null)
266             return baseStyle.getPen().byteValue();
267         return defaultPen;
268     }
269
270     /**
271      *
272      */

273     public static byte getPen(JRTemplateGraphicElement element, byte defaultPen)
274     {
275         if (element.getOwnPen() != null)
276             return element.getOwnPen().byteValue();
277         JRStyle baseStyle = getBaseStyle(element);
278         if (baseStyle != null && baseStyle.getPen() != null)
279             return baseStyle.getPen().byteValue();
280         return defaultPen;
281     }
282
283     /**
284      *
285      */

286     public static Byte JavaDoc getPen(JRStyle style)
287     {
288         if (style.getOwnPen() != null)
289             return style.getOwnPen();
290         JRStyle baseStyle = getBaseStyle(style);
291         if (baseStyle != null)
292             return baseStyle.getPen();
293         return null;
294     }
295
296     /**
297      *
298      */

299     public static byte getFill(JRGraphicElement element, byte defaultFill)
300     {
301         if (element.getOwnFill() != null)
302             return element.getOwnFill().byteValue();
303         JRStyle baseStyle = getBaseStyle(element);
304         if (baseStyle != null && baseStyle.getFill() != null)
305             return baseStyle.getFill().byteValue();
306         return defaultFill;
307     }
308
309     /**
310      *
311      */

312     public static byte getFill(JRPrintGraphicElement element, byte defaultFill)
313     {
314         if (element.getOwnFill() != null)
315             return element.getOwnFill().byteValue();
316         JRStyle baseStyle = getBaseStyle(element);
317         if (baseStyle != null && baseStyle.getFill() != null)
318             return baseStyle.getFill().byteValue();
319         return defaultFill;
320     }
321
322     /**
323      *
324      */

325     public static byte getFill(JRTemplateGraphicElement element, byte defaultFill)
326     {
327         if (element.getOwnFill() != null)
328             return element.getOwnFill().byteValue();
329         JRStyle baseStyle = getBaseStyle(element);
330         if (baseStyle != null && baseStyle.getFill() != null)
331             return baseStyle.getFill().byteValue();
332         return defaultFill;
333     }
334
335     /**
336      *
337      */

338     public static Byte JavaDoc getFill(JRStyle style)
339     {
340         if (style.getOwnFill() != null)
341             return style.getOwnFill();
342         JRStyle baseStyle = getBaseStyle(style);
343         if (baseStyle != null)
344             return baseStyle.getFill();
345         return null;
346     }
347
348     /**
349      *
350      */

351     public static int getRadius(JRRectangle rectangle)
352     {
353         if (rectangle.getOwnRadius() != null)
354             return rectangle.getOwnRadius().intValue();
355         JRStyle baseStyle = getBaseStyle(rectangle);
356         if (baseStyle != null && baseStyle.getRadius() != null)
357             return baseStyle.getRadius().intValue();
358         return 0;
359     }
360
361     /**
362      *
363      */

364     public static int getRadius(JRPrintRectangle rectangle)
365     {
366         if (rectangle.getOwnRadius() != null)
367             return rectangle.getOwnRadius().intValue();
368         JRStyle baseStyle = getBaseStyle(rectangle);
369         if (baseStyle != null && baseStyle.getRadius() != null)
370             return baseStyle.getRadius().intValue();
371         return 0;
372     }
373
374     /**
375      *
376      */

377     public static int getRadius(JRTemplateRectangle rectangle)
378     {
379         if (rectangle.getOwnRadius() != null)
380             return rectangle.getOwnRadius().intValue();
381         JRStyle baseStyle = getBaseStyle(rectangle);
382         if (baseStyle != null && baseStyle.getRadius() != null)
383             return baseStyle.getRadius().intValue();
384         return 0;
385     }
386
387     /**
388      *
389      */

390     public static Integer JavaDoc getRadius(JRStyle style)
391     {
392         if (style.getOwnRadius() != null)
393             return style.getOwnRadius();
394         JRStyle baseStyle = getBaseStyle(style);
395         if (baseStyle != null)
396             return baseStyle.getRadius();
397         return null;
398     }
399
400     /**
401      *
402      */

403     public static byte getScaleImage(JRImage image)
404     {
405         if (image.getOwnScaleImage() != null)
406             return image.getOwnScaleImage().byteValue();
407         JRStyle baseStyle = getBaseStyle(image);
408         if (baseStyle != null && baseStyle.getScaleImage() != null)
409             return baseStyle.getScaleImage().byteValue();
410         return JRImage.SCALE_IMAGE_RETAIN_SHAPE;
411     }
412
413     /**
414      *
415      */

416     public static byte getScaleImage(JRPrintImage image)
417     {
418         if (image.getOwnScaleImage() != null)
419             return image.getOwnScaleImage().byteValue();
420         JRStyle baseStyle = getBaseStyle(image);
421         if (baseStyle != null && baseStyle.getScaleImage() != null)
422             return baseStyle.getScaleImage().byteValue();
423         return JRImage.SCALE_IMAGE_RETAIN_SHAPE;
424     }
425
426     /**
427      *
428      */

429     public static byte getScaleImage(JRTemplateImage image)
430     {
431         if (image.getOwnScaleImage() != null)
432             return image.getOwnScaleImage().byteValue();
433         JRStyle baseStyle = getBaseStyle(image);
434         if (baseStyle != null && baseStyle.getScaleImage() != null)
435             return baseStyle.getScaleImage().byteValue();
436         return JRImage.SCALE_IMAGE_RETAIN_SHAPE;
437     }
438
439     /**
440      *
441      */

442     public static Byte JavaDoc getScaleImage(JRStyle style)
443     {
444         if (style.getOwnScaleImage() != null)
445             return style.getOwnScaleImage();
446         JRStyle baseStyle = getBaseStyle(style);
447         if (baseStyle != null )
448             return baseStyle.getScaleImage();
449         return null;
450     }
451
452     /**
453      *
454      */

455     public static byte getHorizontalAlignment(JRAlignment alignment)
456     {
457         if (alignment.getOwnHorizontalAlignment() != null)
458             return alignment.getOwnHorizontalAlignment().byteValue();
459         JRStyle baseStyle = getBaseStyle(alignment);
460         if (baseStyle != null && baseStyle.getHorizontalAlignment() != null)
461             return baseStyle.getHorizontalAlignment().byteValue();
462         return JRAlignment.HORIZONTAL_ALIGN_LEFT;
463     }
464
465     /**
466      *
467      */

468     public static Byte JavaDoc getHorizontalAlignment(JRStyle style)
469     {
470         if (style.getOwnHorizontalAlignment() != null)
471             return style.getOwnHorizontalAlignment();
472         JRStyle baseStyle = getBaseStyle(style);
473         if (baseStyle != null && baseStyle.getHorizontalAlignment() != null)
474             return baseStyle.getHorizontalAlignment();
475         return null;
476     }
477
478     /**
479      *
480      */

481     public static byte getVerticalAlignment(JRAlignment alignment)
482     {
483         if (alignment.getOwnVerticalAlignment() != null)
484             return alignment.getOwnVerticalAlignment().byteValue();
485         JRStyle baseStyle = getBaseStyle(alignment);
486         if (baseStyle != null && baseStyle.getVerticalAlignment() != null)
487             return baseStyle.getVerticalAlignment().byteValue();
488         return JRAlignment.VERTICAL_ALIGN_TOP;
489     }
490
491     /**
492      *
493      */

494     public static Byte JavaDoc getVerticalAlignment(JRStyle style)
495     {
496         if (style.getOwnVerticalAlignment() != null)
497             return style.getOwnVerticalAlignment();
498         JRStyle baseStyle = getBaseStyle(style);
499         if (baseStyle != null && baseStyle.getVerticalAlignment() != null)
500             return baseStyle.getVerticalAlignment();
501         return null;
502     }
503
504     /**
505      *
506      */

507     public static byte getRotation(JRTextElement element)
508     {
509         if (element.getOwnRotation() != null)
510             return element.getOwnRotation().byteValue();
511         JRStyle baseStyle = getBaseStyle(element);
512         if (baseStyle != null && baseStyle.getRotation() != null)
513             return baseStyle.getRotation().byteValue();
514         return JRTextElement.ROTATION_NONE;
515     }
516
517     /**
518      *
519      */

520     public static byte getRotation(JRPrintText element)
521     {
522         if (element.getOwnRotation() != null)
523             return element.getOwnRotation().byteValue();
524         JRStyle baseStyle = getBaseStyle(element);
525         if (baseStyle != null && baseStyle.getRotation() != null)
526             return baseStyle.getRotation().byteValue();
527         return JRTextElement.ROTATION_NONE;
528     }
529
530     /**
531      *
532      */

533     public static byte getRotation(JRTemplateText element)
534     {
535         if (element.getOwnRotation() != null)
536             return element.getOwnRotation().byteValue();
537         JRStyle baseStyle = getBaseStyle(element);
538         if (baseStyle != null && baseStyle.getRotation() != null)
539             return baseStyle.getRotation().byteValue();
540         return JRTextElement.ROTATION_NONE;
541     }
542
543     /**
544      *
545      */

546     public static Byte JavaDoc getRotation(JRStyle style)
547     {
548         if (style.getOwnRotation() != null)
549             return style.getOwnRotation();
550         JRStyle baseStyle = getBaseStyle(style);
551         if (baseStyle != null)
552             return baseStyle.getRotation();
553         return null;
554     }
555
556     /**
557      *
558      */

559     public static byte getLineSpacing(JRTextElement element)
560     {
561         if (element.getOwnLineSpacing() != null)
562             return element.getOwnLineSpacing().byteValue();
563         JRStyle baseStyle = getBaseStyle(element);
564         if (baseStyle != null && baseStyle.getLineSpacing() != null)
565             return baseStyle.getLineSpacing().byteValue();
566         return JRTextElement.LINE_SPACING_SINGLE;
567     }
568
569     /**
570      *
571      */

572     public static byte getLineSpacing(JRPrintText element)
573     {
574         if (element.getOwnLineSpacing() != null)
575             return element.getOwnLineSpacing().byteValue();
576         JRStyle baseStyle = getBaseStyle(element);
577         if (baseStyle != null && baseStyle.getLineSpacing() != null)
578             return baseStyle.getLineSpacing().byteValue();
579         return JRTextElement.LINE_SPACING_SINGLE;
580     }
581
582     /**
583      *
584      */

585     public static byte getLineSpacing(JRTemplateText element)
586     {
587         if (element.getOwnLineSpacing() != null)
588             return element.getOwnLineSpacing().byteValue();
589         JRStyle baseStyle = getBaseStyle(element);
590         if (baseStyle != null && baseStyle.getLineSpacing() != null)
591             return baseStyle.getLineSpacing().byteValue();
592         return JRTextElement.LINE_SPACING_SINGLE;
593     }
594
595     /**
596      *
597      */

598     public static Byte JavaDoc getLineSpacing(JRStyle style)
599     {
600         if (style.getOwnLineSpacing() != null)
601             return style.getOwnLineSpacing();
602         JRStyle baseStyle = getBaseStyle(style);
603         if (baseStyle != null)
604             return baseStyle.getLineSpacing();
605         return null;
606     }
607
608     /**
609      *
610      */

611     public static boolean isStyledText(JRTextElement element)
612     {
613         if (element.isOwnStyledText() != null)
614             return element.isOwnStyledText().booleanValue();
615         JRStyle baseStyle = getBaseStyle(element);
616         if (baseStyle != null && baseStyle.isStyledText() != null)
617             return baseStyle.isStyledText().booleanValue();
618         return false;
619     }
620
621     /**
622      *
623      */

624     public static boolean isStyledText(JRPrintText element)
625     {
626         if (element.isOwnStyledText() != null)
627             return element.isOwnStyledText().booleanValue();
628         JRStyle baseStyle = getBaseStyle(element);
629         if (baseStyle != null && baseStyle.isStyledText() != null)
630             return baseStyle.isStyledText().booleanValue();
631         return false;
632     }
633
634     /**
635      *
636      */

637     public static boolean isStyledText(JRTemplateText element)
638     {
639         if (element.isOwnStyledText() != null)
640             return element.isOwnStyledText().booleanValue();
641         JRStyle baseStyle = getBaseStyle(element);
642         if (baseStyle != null && baseStyle.isStyledText() != null)
643             return baseStyle.isStyledText().booleanValue();
644         return false;
645     }
646
647     /**
648      *
649      */

650     public static Boolean JavaDoc isStyledText(JRStyle style)
651     {
652         if (style.isOwnStyledText() != null)
653             return style.isOwnStyledText();
654         JRStyle baseStyle = getBaseStyle(style);
655         if (baseStyle != null)
656             return baseStyle.isStyledText();
657         return null;
658     }
659
660     /**
661      *
662      */

663     public static String JavaDoc getPattern(JRTextField element)
664     {
665         if (element.getOwnPattern() != null)
666             return element.getOwnPattern();
667         JRStyle baseStyle = getBaseStyle(element);
668         if (baseStyle != null)
669             return baseStyle.getPattern();
670         return null;
671     }
672
673     /**
674      *
675      */

676     public static String JavaDoc getPattern(JRStyle style)
677     {
678         if (style.getOwnPattern() != null)
679             return style.getOwnPattern();
680         JRStyle baseStyle = getBaseStyle(style);
681         if (baseStyle != null)
682             return baseStyle.getPattern();
683         return null;
684     }
685
686     /**
687      *
688      */

689     public static boolean isBlankWhenNull(JRTextField element)
690     {
691         if (element.isOwnBlankWhenNull() != null)
692             return element.isOwnBlankWhenNull().booleanValue();
693         JRStyle baseStyle = getBaseStyle(element);
694         if (baseStyle != null && baseStyle.isBlankWhenNull() != null)
695             return baseStyle.isBlankWhenNull().booleanValue();
696         return false;
697     }
698
699     /**
700      *
701      */

702     public static Boolean JavaDoc isBlankWhenNull(JRStyle style)
703     {
704         if (style.isOwnBlankWhenNull() != null)
705             return style.isOwnBlankWhenNull();
706         JRStyle baseStyle = getBaseStyle(style);
707         if (baseStyle != null)
708             return baseStyle.isBlankWhenNull();
709         return null;
710     }
711
712     /**
713      *
714      */

715     public static String JavaDoc getFontName(JRFont font)
716     {
717         if (font.getOwnFontName() != null)
718             return font.getOwnFontName();
719         JRFont baseFont = getBaseFont(font);
720         if (baseFont != null && baseFont.getFontName() != null)
721             return baseFont.getFontName();
722         JRStyle baseStyle = getBaseStyle(font);
723         if (baseStyle != null && baseStyle.getFontName() != null)
724             return baseStyle.getFontName();
725         return JRProperties.getProperty(JRFont.DEFAULT_FONT_NAME);
726     }
727     
728     /**
729      *
730      */

731     public static String JavaDoc getFontName(JRStyle style)
732     {
733         if (style.getOwnFontName() != null)
734             return style.getOwnFontName();
735         JRStyle baseStyle = getBaseStyle(style);
736         if (baseStyle != null && baseStyle.getFontName() != null)
737             return baseStyle.getFontName();
738         return JRProperties.getProperty(JRFont.DEFAULT_FONT_NAME);
739     }
740
741     /**
742      *
743      */

744     public static boolean isBold(JRFont font)
745     {
746         if (font.isOwnBold() != null)
747             return font.isOwnBold().booleanValue();
748         JRFont baseFont = getBaseFont(font);
749         if (baseFont != null)
750             return baseFont.isBold();
751         JRStyle baseStyle = getBaseStyle(font);
752         if (baseStyle != null && baseStyle.isBold() != null)
753             return baseStyle.isBold().booleanValue();
754         return false;
755     }
756     
757     /**
758      *
759      */

760     public static Boolean JavaDoc isBold(JRStyle style)
761     {
762         if (style.isOwnBold() != null)
763             return style.isOwnBold();
764         JRStyle baseStyle = getBaseStyle(style);
765         if (baseStyle != null)
766             return baseStyle.isBold();
767         return null;
768     }
769
770     /**
771      *
772      */

773     public static boolean isItalic(JRFont font)
774     {
775         if (font.isOwnItalic() != null)
776             return font.isOwnItalic().booleanValue();
777         JRFont baseFont = getBaseFont(font);
778         if (baseFont != null)
779             return baseFont.isItalic();
780         JRStyle baseStyle = getBaseStyle(font);
781         if (baseStyle != null && baseStyle.isItalic() != null)
782             return baseStyle.isItalic().booleanValue();
783         return false;
784     }
785     
786     /**
787      *
788      */

789     public static Boolean JavaDoc isItalic(JRStyle style)
790     {
791         if (style.isOwnItalic() != null)
792             return style.isOwnItalic();
793         JRStyle baseStyle = getBaseStyle(style);
794         if (baseStyle != null)
795             return baseStyle.isItalic();
796         return null;
797     }
798
799     /**
800      *
801      */

802     public static boolean isUnderline(JRFont font)
803     {
804         if (font.isOwnUnderline() != null)
805             return font.isOwnUnderline().booleanValue();
806         JRFont baseFont = getBaseFont(font);
807         if (baseFont != null)
808             return baseFont.isUnderline();
809         JRStyle baseStyle = getBaseStyle(font);
810         if (baseStyle != null && baseStyle.isUnderline() != null)
811             return baseStyle.isUnderline().booleanValue();
812         return false;
813     }
814     
815     /**
816      *
817      */

818     public static Boolean JavaDoc isUnderline(JRStyle style)
819     {
820         if (style.isOwnUnderline() != null)
821             return style.isOwnUnderline();
822         JRStyle baseStyle = getBaseStyle(style);
823         if (baseStyle != null)
824             return baseStyle.isUnderline();
825         return null;
826     }
827
828     /**
829      *
830      */

831     public static boolean isStrikeThrough(JRFont font)
832     {
833         if (font.isOwnStrikeThrough() != null)
834             return font.isOwnStrikeThrough().booleanValue();
835         JRFont baseFont = getBaseFont(font);
836         if (baseFont != null)
837             return baseFont.isStrikeThrough();
838         JRStyle baseStyle = getBaseStyle(font);
839         if (baseStyle != null && baseStyle.isStrikeThrough() != null)
840             return baseStyle.isStrikeThrough().booleanValue();
841         return false;
842     }
843     
844     /**
845      *
846      */

847     public static Boolean JavaDoc isStrikeThrough(JRStyle style)
848     {
849         if (style.isOwnStrikeThrough() != null)
850             return style.isOwnStrikeThrough();
851         JRStyle baseStyle = getBaseStyle(style);
852         if (baseStyle != null)
853             return baseStyle.isStrikeThrough();
854         return null;
855     }
856
857     /**
858      *
859      */

860     public static int getFontSize(JRFont font)
861     {
862         if (font.getOwnFontSize() != null)
863             return font.getOwnFontSize().intValue();
864         JRFont baseFont = getBaseFont(font);
865         if (baseFont != null)
866             return baseFont.getFontSize();
867