0001: /*
0002: * ============================================================================
0003: * GNU Lesser General Public License
0004: * ============================================================================
0005: *
0006: * JasperReports - Free Java report-generating library.
0007: * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com
0008: *
0009: * This library is free software; you can redistribute it and/or
0010: * modify it under the terms of the GNU Lesser General Public
0011: * License as published by the Free Software Foundation; either
0012: * version 2.1 of the License, or (at your option) any later version.
0013: *
0014: * This library is distributed in the hope that it will be useful,
0015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
0016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0017: * Lesser General Public License for more details.
0018: *
0019: * You should have received a copy of the GNU Lesser General Public
0020: * License along with this library; if not, write to the Free Software
0021: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
0022: *
0023: * JasperSoft Corporation
0024: * 303 Second Street, Suite 450 North
0025: * San Francisco, CA 94107
0026: * http://www.jaspersoft.com
0027: */
0028: package net.sf.jasperreports.engine.util;
0029:
0030: import java.awt.Color;
0031:
0032: import net.sf.jasperreports.charts.JRCategoryAxisFormat;
0033: import net.sf.jasperreports.charts.JRTimeAxisFormat;
0034: import net.sf.jasperreports.charts.JRValueAxisFormat;
0035: import net.sf.jasperreports.charts.JRXAxisFormat;
0036: import net.sf.jasperreports.charts.JRYAxisFormat;
0037: import net.sf.jasperreports.engine.JRAlignment;
0038: import net.sf.jasperreports.engine.JRBox;
0039: import net.sf.jasperreports.engine.JRChart;
0040: import net.sf.jasperreports.engine.JRChartPlot;
0041: import net.sf.jasperreports.engine.JRElement;
0042: import net.sf.jasperreports.engine.JRFont;
0043: import net.sf.jasperreports.engine.JRGraphicElement;
0044: import net.sf.jasperreports.engine.JRImage;
0045: import net.sf.jasperreports.engine.JRPrintElement;
0046: import net.sf.jasperreports.engine.JRPrintGraphicElement;
0047: import net.sf.jasperreports.engine.JRPrintImage;
0048: import net.sf.jasperreports.engine.JRPrintRectangle;
0049: import net.sf.jasperreports.engine.JRPrintText;
0050: import net.sf.jasperreports.engine.JRRectangle;
0051: import net.sf.jasperreports.engine.JRStyle;
0052: import net.sf.jasperreports.engine.JRStyleContainer;
0053: import net.sf.jasperreports.engine.JRTextElement;
0054: import net.sf.jasperreports.engine.JRTextField;
0055: import net.sf.jasperreports.engine.fill.JRTemplateElement;
0056: import net.sf.jasperreports.engine.fill.JRTemplateGraphicElement;
0057: import net.sf.jasperreports.engine.fill.JRTemplateImage;
0058: import net.sf.jasperreports.engine.fill.JRTemplateRectangle;
0059: import net.sf.jasperreports.engine.fill.JRTemplateText;
0060:
0061: /**
0062: * @author Teodor Danciu (teodord@users.sourceforge.net)
0063: * @version $Id: JRStyleResolver.java 1577 2007-02-09 11:25:48Z teodord $
0064: */
0065: public class JRStyleResolver {
0066:
0067: /**
0068: *
0069: */
0070: private static JRFont getBaseFont(JRFont font) {
0071: if (font.getReportFont() != null)
0072: return font.getReportFont();
0073: if (font.getDefaultStyleProvider() != null)
0074: return font.getDefaultStyleProvider().getDefaultFont();
0075: return null;
0076: }
0077:
0078: /**
0079: *
0080: */
0081: private static JRStyle getBaseStyle(JRStyleContainer styleContainer) {
0082: if (styleContainer.getStyle() != null)
0083: return styleContainer.getStyle();
0084: if (styleContainer.getDefaultStyleProvider() != null)
0085: return styleContainer.getDefaultStyleProvider()
0086: .getDefaultStyle();
0087: return null;
0088: }
0089:
0090: /**
0091: *
0092: */
0093: public static byte getMode(JRElement element, byte defaultMode) {
0094: if (element.getOwnMode() != null)
0095: return element.getOwnMode().byteValue();
0096: JRStyle style = getBaseStyle(element);
0097: if (style != null && style.getMode() != null)
0098: return style.getMode().byteValue();
0099: return defaultMode;
0100: }
0101:
0102: /**
0103: *
0104: */
0105: public static byte getMode(JRPrintElement element, byte defaultMode) {
0106: if (element.getOwnMode() != null)
0107: return element.getOwnMode().byteValue();
0108: JRStyle style = getBaseStyle(element);
0109: if (style != null && style.getMode() != null)
0110: return style.getMode().byteValue();
0111: return defaultMode;
0112: }
0113:
0114: /**
0115: *
0116: */
0117: public static byte getMode(JRTemplateElement element,
0118: byte defaultMode) {
0119: if (element.getOwnMode() != null)
0120: return element.getOwnMode().byteValue();
0121: JRStyle style = getBaseStyle(element);
0122: if (style != null && style.getMode() != null)
0123: return style.getMode().byteValue();
0124: return defaultMode;
0125: }
0126:
0127: /**
0128: *
0129: */
0130: public static Byte getMode(JRStyle style) {
0131: if (style.getOwnMode() != null)
0132: return style.getOwnMode();
0133: JRStyle baseStyle = getBaseStyle(style);
0134: if (baseStyle != null)
0135: return baseStyle.getMode();
0136: return null;
0137: }
0138:
0139: /**
0140: *
0141: */
0142: public static Color getForecolor(JRElement element) {
0143: if (element.getOwnForecolor() != null)
0144: return element.getOwnForecolor();
0145: JRStyle style = getBaseStyle(element);
0146: if (style != null && style.getForecolor() != null)
0147: return style.getForecolor();
0148: return Color.black;
0149: }
0150:
0151: /**
0152: *
0153: */
0154: public static Color getForecolor(JRChartPlot plot) {
0155: JRChart chart = plot.getChart();
0156: if (chart != null)
0157: return getForecolor(chart);
0158: return Color.black;
0159: }
0160:
0161: /**
0162: *
0163: */
0164: public static Color getForecolor(JRPrintElement element) {
0165: if (element.getOwnForecolor() != null)
0166: return element.getOwnForecolor();
0167: JRStyle style = getBaseStyle(element);
0168: if (style != null && style.getForecolor() != null)
0169: return style.getForecolor();
0170: return Color.black;
0171: }
0172:
0173: /**
0174: *
0175: */
0176: public static Color getForecolor(JRTemplateElement element) {
0177: if (element.getOwnForecolor() != null)
0178: return element.getOwnForecolor();
0179: JRStyle style = getBaseStyle(element);
0180: if (style != null && style.getForecolor() != null)
0181: return style.getForecolor();
0182: return Color.black;
0183: }
0184:
0185: /**
0186: *
0187: */
0188: public static Color getForecolor(JRStyle style) {
0189: if (style.getOwnForecolor() != null)
0190: return style.getOwnForecolor();
0191: JRStyle baseStyle = getBaseStyle(style);
0192: if (baseStyle != null)
0193: return baseStyle.getForecolor();
0194: return null;
0195: }
0196:
0197: /**
0198: *
0199: */
0200: public static Color getBackcolor(JRElement element) {
0201: if (element.getOwnBackcolor() != null)
0202: return element.getOwnBackcolor();
0203: JRStyle style = getBaseStyle(element);
0204: if (style != null && style.getBackcolor() != null)
0205: return style.getBackcolor();
0206: return Color.white;
0207: }
0208:
0209: /**
0210: *
0211: */
0212: public static Color getBackcolor(JRChartPlot plot) {
0213: if (plot.getOwnBackcolor() != null)
0214: return plot.getOwnBackcolor();
0215: JRChart chart = plot.getChart();
0216: if (chart != null)
0217: return getBackcolor(chart);
0218: return Color.white;
0219: }
0220:
0221: /**
0222: *
0223: */
0224: public static Color getBackcolor(JRPrintElement element) {
0225: if (element.getOwnBackcolor() != null)
0226: return element.getOwnBackcolor();
0227: JRStyle style = getBaseStyle(element);
0228: if (style != null && style.getBackcolor() != null)
0229: return style.getBackcolor();
0230: return Color.white;
0231: }
0232:
0233: /**
0234: *
0235: */
0236: public static Color getBackcolor(JRTemplateElement element) {
0237: if (element.getOwnBackcolor() != null)
0238: return element.getOwnBackcolor();
0239: JRStyle style = getBaseStyle(element);
0240: if (style != null && style.getBackcolor() != null)
0241: return style.getBackcolor();
0242: return Color.white;
0243: }
0244:
0245: /**
0246: *
0247: */
0248: public static Color getBackcolor(JRStyle style) {
0249: if (style.getOwnBackcolor() != null)
0250: return style.getOwnBackcolor();
0251: JRStyle baseStyle = getBaseStyle(style);
0252: if (baseStyle != null)
0253: return baseStyle.getBackcolor();
0254: return null;
0255: }
0256:
0257: /**
0258: *
0259: */
0260: public static byte getPen(JRGraphicElement element, byte defaultPen) {
0261: if (element.getOwnPen() != null)
0262: return element.getOwnPen().byteValue();
0263: JRStyle baseStyle = getBaseStyle(element);
0264: if (baseStyle != null && baseStyle.getPen() != null)
0265: return baseStyle.getPen().byteValue();
0266: return defaultPen;
0267: }
0268:
0269: /**
0270: *
0271: */
0272: public static byte getPen(JRPrintGraphicElement element,
0273: byte defaultPen) {
0274: if (element.getOwnPen() != null)
0275: return element.getOwnPen().byteValue();
0276: JRStyle baseStyle = getBaseStyle(element);
0277: if (baseStyle != null && baseStyle.getPen() != null)
0278: return baseStyle.getPen().byteValue();
0279: return defaultPen;
0280: }
0281:
0282: /**
0283: *
0284: */
0285: public static byte getPen(JRTemplateGraphicElement element,
0286: byte defaultPen) {
0287: if (element.getOwnPen() != null)
0288: return element.getOwnPen().byteValue();
0289: JRStyle baseStyle = getBaseStyle(element);
0290: if (baseStyle != null && baseStyle.getPen() != null)
0291: return baseStyle.getPen().byteValue();
0292: return defaultPen;
0293: }
0294:
0295: /**
0296: *
0297: */
0298: public static Byte getPen(JRStyle style) {
0299: if (style.getOwnPen() != null)
0300: return style.getOwnPen();
0301: JRStyle baseStyle = getBaseStyle(style);
0302: if (baseStyle != null)
0303: return baseStyle.getPen();
0304: return null;
0305: }
0306:
0307: /**
0308: *
0309: */
0310: public static byte getFill(JRGraphicElement element,
0311: byte defaultFill) {
0312: if (element.getOwnFill() != null)
0313: return element.getOwnFill().byteValue();
0314: JRStyle baseStyle = getBaseStyle(element);
0315: if (baseStyle != null && baseStyle.getFill() != null)
0316: return baseStyle.getFill().byteValue();
0317: return defaultFill;
0318: }
0319:
0320: /**
0321: *
0322: */
0323: public static byte getFill(JRPrintGraphicElement element,
0324: byte defaultFill) {
0325: if (element.getOwnFill() != null)
0326: return element.getOwnFill().byteValue();
0327: JRStyle baseStyle = getBaseStyle(element);
0328: if (baseStyle != null && baseStyle.getFill() != null)
0329: return baseStyle.getFill().byteValue();
0330: return defaultFill;
0331: }
0332:
0333: /**
0334: *
0335: */
0336: public static byte getFill(JRTemplateGraphicElement element,
0337: byte defaultFill) {
0338: if (element.getOwnFill() != null)
0339: return element.getOwnFill().byteValue();
0340: JRStyle baseStyle = getBaseStyle(element);
0341: if (baseStyle != null && baseStyle.getFill() != null)
0342: return baseStyle.getFill().byteValue();
0343: return defaultFill;
0344: }
0345:
0346: /**
0347: *
0348: */
0349: public static Byte getFill(JRStyle style) {
0350: if (style.getOwnFill() != null)
0351: return style.getOwnFill();
0352: JRStyle baseStyle = getBaseStyle(style);
0353: if (baseStyle != null)
0354: return baseStyle.getFill();
0355: return null;
0356: }
0357:
0358: /**
0359: *
0360: */
0361: public static int getRadius(JRRectangle rectangle) {
0362: if (rectangle.getOwnRadius() != null)
0363: return rectangle.getOwnRadius().intValue();
0364: JRStyle baseStyle = getBaseStyle(rectangle);
0365: if (baseStyle != null && baseStyle.getRadius() != null)
0366: return baseStyle.getRadius().intValue();
0367: return 0;
0368: }
0369:
0370: /**
0371: *
0372: */
0373: public static int getRadius(JRPrintRectangle rectangle) {
0374: if (rectangle.getOwnRadius() != null)
0375: return rectangle.getOwnRadius().intValue();
0376: JRStyle baseStyle = getBaseStyle(rectangle);
0377: if (baseStyle != null && baseStyle.getRadius() != null)
0378: return baseStyle.getRadius().intValue();
0379: return 0;
0380: }
0381:
0382: /**
0383: *
0384: */
0385: public static int getRadius(JRTemplateRectangle rectangle) {
0386: if (rectangle.getOwnRadius() != null)
0387: return rectangle.getOwnRadius().intValue();
0388: JRStyle baseStyle = getBaseStyle(rectangle);
0389: if (baseStyle != null && baseStyle.getRadius() != null)
0390: return baseStyle.getRadius().intValue();
0391: return 0;
0392: }
0393:
0394: /**
0395: *
0396: */
0397: public static Integer getRadius(JRStyle style) {
0398: if (style.getOwnRadius() != null)
0399: return style.getOwnRadius();
0400: JRStyle baseStyle = getBaseStyle(style);
0401: if (baseStyle != null)
0402: return baseStyle.getRadius();
0403: return null;
0404: }
0405:
0406: /**
0407: *
0408: */
0409: public static byte getScaleImage(JRImage image) {
0410: if (image.getOwnScaleImage() != null)
0411: return image.getOwnScaleImage().byteValue();
0412: JRStyle baseStyle = getBaseStyle(image);
0413: if (baseStyle != null && baseStyle.getScaleImage() != null)
0414: return baseStyle.getScaleImage().byteValue();
0415: return JRImage.SCALE_IMAGE_RETAIN_SHAPE;
0416: }
0417:
0418: /**
0419: *
0420: */
0421: public static byte getScaleImage(JRPrintImage image) {
0422: if (image.getOwnScaleImage() != null)
0423: return image.getOwnScaleImage().byteValue();
0424: JRStyle baseStyle = getBaseStyle(image);
0425: if (baseStyle != null && baseStyle.getScaleImage() != null)
0426: return baseStyle.getScaleImage().byteValue();
0427: return JRImage.SCALE_IMAGE_RETAIN_SHAPE;
0428: }
0429:
0430: /**
0431: *
0432: */
0433: public static byte getScaleImage(JRTemplateImage image) {
0434: if (image.getOwnScaleImage() != null)
0435: return image.getOwnScaleImage().byteValue();
0436: JRStyle baseStyle = getBaseStyle(image);
0437: if (baseStyle != null && baseStyle.getScaleImage() != null)
0438: return baseStyle.getScaleImage().byteValue();
0439: return JRImage.SCALE_IMAGE_RETAIN_SHAPE;
0440: }
0441:
0442: /**
0443: *
0444: */
0445: public static Byte getScaleImage(JRStyle style) {
0446: if (style.getOwnScaleImage() != null)
0447: return style.getOwnScaleImage();
0448: JRStyle baseStyle = getBaseStyle(style);
0449: if (baseStyle != null)
0450: return baseStyle.getScaleImage();
0451: return null;
0452: }
0453:
0454: /**
0455: *
0456: */
0457: public static byte getHorizontalAlignment(JRAlignment alignment) {
0458: if (alignment.getOwnHorizontalAlignment() != null)
0459: return alignment.getOwnHorizontalAlignment().byteValue();
0460: JRStyle baseStyle = getBaseStyle(alignment);
0461: if (baseStyle != null
0462: && baseStyle.getHorizontalAlignment() != null)
0463: return baseStyle.getHorizontalAlignment().byteValue();
0464: return JRAlignment.HORIZONTAL_ALIGN_LEFT;
0465: }
0466:
0467: /**
0468: *
0469: */
0470: public static Byte getHorizontalAlignment(JRStyle style) {
0471: if (style.getOwnHorizontalAlignment() != null)
0472: return style.getOwnHorizontalAlignment();
0473: JRStyle baseStyle = getBaseStyle(style);
0474: if (baseStyle != null
0475: && baseStyle.getHorizontalAlignment() != null)
0476: return baseStyle.getHorizontalAlignment();
0477: return null;
0478: }
0479:
0480: /**
0481: *
0482: */
0483: public static byte getVerticalAlignment(JRAlignment alignment) {
0484: if (alignment.getOwnVerticalAlignment() != null)
0485: return alignment.getOwnVerticalAlignment().byteValue();
0486: JRStyle baseStyle = getBaseStyle(alignment);
0487: if (baseStyle != null
0488: && baseStyle.getVerticalAlignment() != null)
0489: return baseStyle.getVerticalAlignment().byteValue();
0490: return JRAlignment.VERTICAL_ALIGN_TOP;
0491: }
0492:
0493: /**
0494: *
0495: */
0496: public static Byte getVerticalAlignment(JRStyle style) {
0497: if (style.getOwnVerticalAlignment() != null)
0498: return style.getOwnVerticalAlignment();
0499: JRStyle baseStyle = getBaseStyle(style);
0500: if (baseStyle != null
0501: && baseStyle.getVerticalAlignment() != null)
0502: return baseStyle.getVerticalAlignment();
0503: return null;
0504: }
0505:
0506: /**
0507: *
0508: */
0509: public static byte getRotation(JRTextElement element) {
0510: if (element.getOwnRotation() != null)
0511: return element.getOwnRotation().byteValue();
0512: JRStyle baseStyle = getBaseStyle(element);
0513: if (baseStyle != null && baseStyle.getRotation() != null)
0514: return baseStyle.getRotation().byteValue();
0515: return JRTextElement.ROTATION_NONE;
0516: }
0517:
0518: /**
0519: *
0520: */
0521: public static byte getRotation(JRPrintText element) {
0522: if (element.getOwnRotation() != null)
0523: return element.getOwnRotation().byteValue();
0524: JRStyle baseStyle = getBaseStyle(element);
0525: if (baseStyle != null && baseStyle.getRotation() != null)
0526: return baseStyle.getRotation().byteValue();
0527: return JRTextElement.ROTATION_NONE;
0528: }
0529:
0530: /**
0531: *
0532: */
0533: public static byte getRotation(JRTemplateText element) {
0534: if (element.getOwnRotation() != null)
0535: return element.getOwnRotation().byteValue();
0536: JRStyle baseStyle = getBaseStyle(element);
0537: if (baseStyle != null && baseStyle.getRotation() != null)
0538: return baseStyle.getRotation().byteValue();
0539: return JRTextElement.ROTATION_NONE;
0540: }
0541:
0542: /**
0543: *
0544: */
0545: public static Byte getRotation(JRStyle style) {
0546: if (style.getOwnRotation() != null)
0547: return style.getOwnRotation();
0548: JRStyle baseStyle = getBaseStyle(style);
0549: if (baseStyle != null)
0550: return baseStyle.getRotation();
0551: return null;
0552: }
0553:
0554: /**
0555: *
0556: */
0557: public static byte getLineSpacing(JRTextElement element) {
0558: if (element.getOwnLineSpacing() != null)
0559: return element.getOwnLineSpacing().byteValue();
0560: JRStyle baseStyle = getBaseStyle(element);
0561: if (baseStyle != null && baseStyle.getLineSpacing() != null)
0562: return baseStyle.getLineSpacing().byteValue();
0563: return JRTextElement.LINE_SPACING_SINGLE;
0564: }
0565:
0566: /**
0567: *
0568: */
0569: public static byte getLineSpacing(JRPrintText element) {
0570: if (element.getOwnLineSpacing() != null)
0571: return element.getOwnLineSpacing().byteValue();
0572: JRStyle baseStyle = getBaseStyle(element);
0573: if (baseStyle != null && baseStyle.getLineSpacing() != null)
0574: return baseStyle.getLineSpacing().byteValue();
0575: return JRTextElement.LINE_SPACING_SINGLE;
0576: }
0577:
0578: /**
0579: *
0580: */
0581: public static byte getLineSpacing(JRTemplateText element) {
0582: if (element.getOwnLineSpacing() != null)
0583: return element.getOwnLineSpacing().byteValue();
0584: JRStyle baseStyle = getBaseStyle(element);
0585: if (baseStyle != null && baseStyle.getLineSpacing() != null)
0586: return baseStyle.getLineSpacing().byteValue();
0587: return JRTextElement.LINE_SPACING_SINGLE;
0588: }
0589:
0590: /**
0591: *
0592: */
0593: public static Byte getLineSpacing(JRStyle style) {
0594: if (style.getOwnLineSpacing() != null)
0595: return style.getOwnLineSpacing();
0596: JRStyle baseStyle = getBaseStyle(style);
0597: if (baseStyle != null)
0598: return baseStyle.getLineSpacing();
0599: return null;
0600: }
0601:
0602: /**
0603: *
0604: */
0605: public static boolean isStyledText(JRTextElement element) {
0606: if (element.isOwnStyledText() != null)
0607: return element.isOwnStyledText().booleanValue();
0608: JRStyle baseStyle = getBaseStyle(element);
0609: if (baseStyle != null && baseStyle.isStyledText() != null)
0610: return baseStyle.isStyledText().booleanValue();
0611: return false;
0612: }
0613:
0614: /**
0615: *
0616: */
0617: public static boolean isStyledText(JRPrintText element) {
0618: if (element.isOwnStyledText() != null)
0619: return element.isOwnStyledText().booleanValue();
0620: JRStyle baseStyle = getBaseStyle(element);
0621: if (baseStyle != null && baseStyle.isStyledText() != null)
0622: return baseStyle.isStyledText().booleanValue();
0623: return false;
0624: }
0625:
0626: /**
0627: *
0628: */
0629: public static boolean isStyledText(JRTemplateText element) {
0630: if (element.isOwnStyledText() != null)
0631: return element.isOwnStyledText().booleanValue();
0632: JRStyle baseStyle = getBaseStyle(element);
0633: if (baseStyle != null && baseStyle.isStyledText() != null)
0634: return baseStyle.isStyledText().booleanValue();
0635: return false;
0636: }
0637:
0638: /**
0639: *
0640: */
0641: public static Boolean isStyledText(JRStyle style) {
0642: if (style.isOwnStyledText() != null)
0643: return style.isOwnStyledText();
0644: JRStyle baseStyle = getBaseStyle(style);
0645: if (baseStyle != null)
0646: return baseStyle.isStyledText();
0647: return null;
0648: }
0649:
0650: /**
0651: *
0652: */
0653: public static String getPattern(JRTextField element) {
0654: if (element.getOwnPattern() != null)
0655: return element.getOwnPattern();
0656: JRStyle baseStyle = getBaseStyle(element);
0657: if (baseStyle != null)
0658: return baseStyle.getPattern();
0659: return null;
0660: }
0661:
0662: /**
0663: *
0664: */
0665: public static String getPattern(JRStyle style) {
0666: if (style.getOwnPattern() != null)
0667: return style.getOwnPattern();
0668: JRStyle baseStyle = getBaseStyle(style);
0669: if (baseStyle != null)
0670: return baseStyle.getPattern();
0671: return null;
0672: }
0673:
0674: /**
0675: *
0676: */
0677: public static boolean isBlankWhenNull(JRTextField element) {
0678: if (element.isOwnBlankWhenNull() != null)
0679: return element.isOwnBlankWhenNull().booleanValue();
0680: JRStyle baseStyle = getBaseStyle(element);
0681: if (baseStyle != null && baseStyle.isBlankWhenNull() != null)
0682: return baseStyle.isBlankWhenNull().booleanValue();
0683: return false;
0684: }
0685:
0686: /**
0687: *
0688: */
0689: public static Boolean isBlankWhenNull(JRStyle style) {
0690: if (style.isOwnBlankWhenNull() != null)
0691: return style.isOwnBlankWhenNull();
0692: JRStyle baseStyle = getBaseStyle(style);
0693: if (baseStyle != null)
0694: return baseStyle.isBlankWhenNull();
0695: return null;
0696: }
0697:
0698: /**
0699: *
0700: */
0701: public static String getFontName(JRFont font) {
0702: if (font.getOwnFontName() != null)
0703: return font.getOwnFontName();
0704: JRFont baseFont = getBaseFont(font);
0705: if (baseFont != null && baseFont.getFontName() != null)
0706: return baseFont.getFontName();
0707: JRStyle baseStyle = getBaseStyle(font);
0708: if (baseStyle != null && baseStyle.getFontName() != null)
0709: return baseStyle.getFontName();
0710: return JRProperties.getProperty(JRFont.DEFAULT_FONT_NAME);
0711: }
0712:
0713: /**
0714: *
0715: */
0716: public static String getFontName(JRStyle style) {
0717: if (style.getOwnFontName() != null)
0718: return style.getOwnFontName();
0719: JRStyle baseStyle = getBaseStyle(style);
0720: if (baseStyle != null && baseStyle.getFontName() != null)
0721: return baseStyle.getFontName();
0722: return JRProperties.getProperty(JRFont.DEFAULT_FONT_NAME);
0723: }
0724:
0725: /**
0726: *
0727: */
0728: public static boolean isBold(JRFont font) {
0729: if (font.isOwnBold() != null)
0730: return font.isOwnBold().booleanValue();
0731: JRFont baseFont = getBaseFont(font);
0732: if (baseFont != null)
0733: return baseFont.isBold();
0734: JRStyle baseStyle = getBaseStyle(font);
0735: if (baseStyle != null && baseStyle.isBold() != null)
0736: return baseStyle.isBold().booleanValue();
0737: return false;
0738: }
0739:
0740: /**
0741: *
0742: */
0743: public static Boolean isBold(JRStyle style) {
0744: if (style.isOwnBold() != null)
0745: return style.isOwnBold();
0746: JRStyle baseStyle = getBaseStyle(style);
0747: if (baseStyle != null)
0748: return baseStyle.isBold();
0749: return null;
0750: }
0751:
0752: /**
0753: *
0754: */
0755: public static boolean isItalic(JRFont font) {
0756: if (font.isOwnItalic() != null)
0757: return font.isOwnItalic().booleanValue();
0758: JRFont baseFont = getBaseFont(font);
0759: if (baseFont != null)
0760: return baseFont.isItalic();
0761: JRStyle baseStyle = getBaseStyle(font);
0762: if (baseStyle != null && baseStyle.isItalic() != null)
0763: return baseStyle.isItalic().booleanValue();
0764: return false;
0765: }
0766:
0767: /**
0768: *
0769: */
0770: public static Boolean isItalic(JRStyle style) {
0771: if (style.isOwnItalic() != null)
0772: return style.isOwnItalic();
0773: JRStyle baseStyle = getBaseStyle(style);
0774: if (baseStyle != null)
0775: return baseStyle.isItalic();
0776: return null;
0777: }
0778:
0779: /**
0780: *
0781: */
0782: public static boolean isUnderline(JRFont font) {
0783: if (font.isOwnUnderline() != null)
0784: return font.isOwnUnderline().booleanValue();
0785: JRFont baseFont = getBaseFont(font);
0786: if (baseFont != null)
0787: return baseFont.isUnderline();
0788: JRStyle baseStyle = getBaseStyle(font);
0789: if (baseStyle != null && baseStyle.isUnderline() != null)
0790: return baseStyle.isUnderline().booleanValue();
0791: return false;
0792: }
0793:
0794: /**
0795: *
0796: */
0797: public static Boolean isUnderline(JRStyle style) {
0798: if (style.isOwnUnderline() != null)
0799: return style.isOwnUnderline();
0800: JRStyle baseStyle = getBaseStyle(style);
0801: if (baseStyle != null)
0802: return baseStyle.isUnderline();
0803: return null;
0804: }
0805:
0806: /**
0807: *
0808: */
0809: public static boolean isStrikeThrough(JRFont font) {
0810: if (font.isOwnStrikeThrough() != null)
0811: return font.isOwnStrikeThrough().booleanValue();
0812: JRFont baseFont = getBaseFont(font);
0813: if (baseFont != null)
0814: return baseFont.isStrikeThrough();
0815: JRStyle baseStyle = getBaseStyle(font);
0816: if (baseStyle != null && baseStyle.isStrikeThrough() != null)
0817: return baseStyle.isStrikeThrough().booleanValue();
0818: return false;
0819: }
0820:
0821: /**
0822: *
0823: */
0824: public static Boolean isStrikeThrough(JRStyle style) {
0825: if (style.isOwnStrikeThrough() != null)
0826: return style.isOwnStrikeThrough();
0827: JRStyle baseStyle = getBaseStyle(style);
0828: if (baseStyle != null)
0829: return baseStyle.isStrikeThrough();
0830: return null;
0831: }
0832:
0833: /**
0834: *
0835: */
0836: public static int getFontSize(JRFont font) {
0837: if (font.getOwnFontSize() != null)
0838: return font.getOwnFontSize().intValue();
0839: JRFont baseFont = getBaseFont(font);
0840: if (baseFont != null)
0841: return baseFont.getFontSize();
0842: JRStyle baseStyle = getBaseStyle(font);
0843: if (baseStyle != null && baseStyle.getFontSize() != null)
0844: return baseStyle.getFontSize().intValue();
0845: return JRProperties
0846: .getIntegerProperty(JRFont.DEFAULT_FONT_SIZE);
0847: }
0848:
0849: /**
0850: *
0851: */
0852: public static Integer getFontSize(JRStyle style) {
0853: if (style.getOwnFontSize() != null)
0854: return style.getOwnFontSize();
0855: JRStyle baseStyle = getBaseStyle(style);
0856: if (baseStyle != null)
0857: return baseStyle.getFontSize();
0858: return null;
0859: }
0860:
0861: /**
0862: *
0863: */
0864: public static String getPdfFontName(JRFont font) {
0865: if (font.getOwnPdfFontName() != null)
0866: return font.getOwnPdfFontName();
0867: JRFont baseFont = getBaseFont(font);
0868: if (baseFont != null && baseFont.getPdfFontName() != null)
0869: return baseFont.getPdfFontName();
0870: JRStyle baseStyle = getBaseStyle(font);
0871: if (baseStyle != null && baseStyle.getPdfFontName() != null)
0872: return baseStyle.getPdfFontName();
0873: return JRProperties.getProperty(JRFont.DEFAULT_PDF_FONT_NAME);
0874: }
0875:
0876: /**
0877: *
0878: */
0879: public static String getPdfFontName(JRStyle style) {
0880: if (style.getOwnPdfFontName() != null)
0881: return style.getOwnPdfFontName();
0882: JRStyle baseStyle = getBaseStyle(style);
0883: if (baseStyle != null && baseStyle.getPdfFontName() != null)
0884: return baseStyle.getPdfFontName();
0885: return JRProperties.getProperty(JRFont.DEFAULT_PDF_FONT_NAME);
0886: }
0887:
0888: /**
0889: *
0890: */
0891: public static String getPdfEncoding(JRFont font) {
0892: if (font.getOwnPdfEncoding() != null)
0893: return font.getOwnPdfEncoding();
0894: JRFont baseFont = getBaseFont(font);
0895: if (baseFont != null && baseFont.getPdfEncoding() != null)
0896: return baseFont.getPdfEncoding();
0897: JRStyle baseStyle = getBaseStyle(font);
0898: if (baseStyle != null && baseStyle.getPdfEncoding() != null)
0899: return baseStyle.getPdfEncoding();
0900: return JRProperties.getProperty(JRFont.DEFAULT_PDF_ENCODING);
0901: }
0902:
0903: /**
0904: *
0905: */
0906: public static String getPdfEncoding(JRStyle style) {
0907: if (style.getOwnPdfEncoding() != null)
0908: return style.getOwnPdfEncoding();
0909: JRStyle baseStyle = getBaseStyle(style);
0910: if (baseStyle != null && baseStyle.getPdfEncoding() != null)
0911: return baseStyle.getPdfEncoding();
0912: return JRProperties.getProperty(JRFont.DEFAULT_PDF_ENCODING);
0913: }
0914:
0915: /**
0916: *
0917: */
0918: public static boolean isPdfEmbedded(JRFont font) {
0919: if (font.isOwnPdfEmbedded() != null)
0920: return font.isOwnPdfEmbedded().booleanValue();
0921: JRFont baseFont = getBaseFont(font);
0922: if (baseFont != null)
0923: return baseFont.isPdfEmbedded();
0924: JRStyle baseStyle = getBaseStyle(font);
0925: if (baseStyle != null && baseStyle.isPdfEmbedded() != null)
0926: return baseStyle.isPdfEmbedded().booleanValue();
0927: return JRProperties
0928: .getBooleanProperty(JRFont.DEFAULT_PDF_EMBEDDED);
0929: }
0930:
0931: /**
0932: *
0933: */
0934: public static Boolean isPdfEmbedded(JRStyle style) {
0935: if (style.isOwnPdfEmbedded() != null)
0936: return style.isOwnPdfEmbedded();
0937: JRStyle baseStyle = getBaseStyle(style);
0938: if (baseStyle != null)
0939: return baseStyle.isPdfEmbedded();
0940: return null;
0941: }
0942:
0943: /**
0944: *
0945: */
0946: public static byte getBorder(JRBox box) {
0947: if (box.getOwnBorder() != null)
0948: return box.getOwnBorder().byteValue();
0949: JRStyle baseStyle = getBaseStyle(box);
0950: if (baseStyle != null && baseStyle.getBorder() != null)
0951: return baseStyle.getBorder().byteValue();
0952: return JRGraphicElement.PEN_NONE;
0953: }
0954:
0955: /**
0956: *
0957: */
0958: public static Byte getBorder(JRStyle style) {
0959: if (style.getOwnBorder() != null)
0960: return style.getOwnBorder();
0961: JRStyle baseStyle = getBaseStyle(style);
0962: if (baseStyle != null)
0963: return baseStyle.getBorder();
0964: return null;
0965: }
0966:
0967: /**
0968: *
0969: */
0970: public static byte getTopBorder(JRBox box) {
0971: if (box.getOwnTopBorder() != null)
0972: return box.getOwnTopBorder().byteValue();
0973: if (box.getOwnBorder() != null)
0974: return box.getOwnBorder().byteValue();
0975: JRStyle style = getBaseStyle(box);
0976: if (style != null && style.getTopBorder() != null)
0977: return style.getTopBorder().byteValue();
0978: return JRGraphicElement.PEN_NONE;
0979: }
0980:
0981: /**
0982: *
0983: */
0984: public static Byte getTopBorder(JRStyle style) {
0985: if (style.getOwnTopBorder() != null)
0986: return style.getOwnTopBorder();
0987: if (style.getOwnBorder() != null)
0988: return style.getOwnBorder();
0989: JRStyle baseStyle = getBaseStyle(style);
0990: if (baseStyle != null)
0991: return baseStyle.getTopBorder();
0992: return null;
0993: }
0994:
0995: /**
0996: *
0997: */
0998: public static byte getLeftBorder(JRBox box) {
0999: if (box.getOwnLeftBorder() != null)
1000: return box.getOwnLeftBorder().byteValue();
1001: if (box.getOwnBorder() != null)
1002: return box.getOwnBorder().byteValue();
1003: JRStyle style = getBaseStyle(box);
1004: if (style != null && style.getLeftBorder() != null)
1005: return style.getLeftBorder().byteValue();
1006: return JRGraphicElement.PEN_NONE;
1007: }
1008:
1009: /**
1010: *
1011: */
1012: public static Byte getLeftBorder(JRStyle style) {
1013: if (style.getOwnLeftBorder() != null)
1014: return style.getOwnLeftBorder();
1015: if (style.getOwnBorder() != null)
1016: return style.getOwnBorder();
1017: JRStyle baseStyle = getBaseStyle(style);
1018: if (baseStyle != null)
1019: return baseStyle.getLeftBorder();
1020: return null;
1021: }
1022:
1023: /**
1024: *
1025: */
1026: public static byte getBottomBorder(JRBox box) {
1027: if (box.getOwnBottomBorder() != null)
1028: return box.getOwnBottomBorder().byteValue();
1029: if (box.getOwnBorder() != null)
1030: return box.getOwnBorder().byteValue();
1031: JRStyle style = getBaseStyle(box);
1032: if (style != null && style.getBottomBorder() != null)
1033: return style.getBottomBorder().byteValue();
1034: return JRGraphicElement.PEN_NONE;
1035: }
1036:
1037: /**
1038: *
1039: */
1040: public static Byte getBottomBorder(JRStyle style) {
1041: if (style.getOwnBottomBorder() != null)
1042: return style.getOwnBottomBorder();
1043: if (style.getOwnBorder() != null)
1044: return style.getOwnBorder();
1045: JRStyle baseStyle = getBaseStyle(style);
1046: if (baseStyle != null)
1047: return baseStyle.getBottomBorder();
1048: return null;
1049: }
1050:
1051: /**
1052: *
1053: */
1054: public static byte getRightBorder(JRBox box) {
1055: if (box.getOwnRightBorder() != null)
1056: return box.getOwnRightBorder().byteValue();
1057: if (box.getOwnBorder() != null)
1058: return box.getOwnBorder().byteValue();
1059: JRStyle style = getBaseStyle(box);
1060: if (style != null && style.getRightBorder() != null)
1061: return style.getRightBorder().byteValue();
1062: return JRGraphicElement.PEN_NONE;
1063: }
1064:
1065: /**
1066: *
1067: */
1068: public static Byte getRightBorder(JRStyle style) {
1069: if (style.getOwnRightBorder() != null)
1070: return style.getOwnRightBorder();
1071: if (style.getOwnBorder() != null)
1072: return style.getOwnBorder();
1073: JRStyle baseStyle = getBaseStyle(style);
1074: if (baseStyle != null)
1075: return baseStyle.getRightBorder();
1076: return null;
1077: }
1078:
1079: /**
1080: *
1081: */
1082: public static Color getBorderColor(JRBox box, Color defaultColor) {
1083: if (box.getOwnBorderColor() != null)
1084: return box.getOwnBorderColor();
1085: JRStyle baseStyle = getBaseStyle(box);
1086: if (baseStyle != null && baseStyle.getBorderColor() != null)
1087: return baseStyle.getBorderColor();
1088: return defaultColor;
1089: }
1090:
1091: /**
1092: *
1093: */
1094: public static Color getBorderColor(JRStyle style) {
1095: if (style.getOwnBorderColor() != null)
1096: return style.getOwnBorderColor();
1097: JRStyle baseStyle = getBaseStyle(style);
1098: if (baseStyle != null)
1099: return baseStyle.getBorderColor();
1100: return null;
1101: }
1102:
1103: /**
1104: *
1105: */
1106: public static Color getTopBorderColor(JRBox box, Color defaultColor) {
1107: if (box.getOwnTopBorderColor() != null)
1108: return box.getOwnTopBorderColor();
1109: if (box.getOwnBorderColor() != null)
1110: return box.getOwnBorderColor();
1111: JRStyle style = getBaseStyle(box);
1112: if (style != null && style.getTopBorderColor() != null)
1113: return style.getTopBorderColor();
1114: return defaultColor;
1115: }
1116:
1117: /**
1118: *
1119: */
1120: public static Color getTopBorderColor(JRStyle style) {
1121: if (style.getOwnTopBorderColor() != null)
1122: return style.getOwnTopBorderColor();
1123: if (style.getOwnBorderColor() != null)
1124: return style.getOwnBorderColor();
1125: JRStyle baseStyle = getBaseStyle(style);
1126: if (baseStyle != null)
1127: return baseStyle.getTopBorderColor();
1128: return null;
1129: }
1130:
1131: /**
1132: *
1133: */
1134: public static Color getLeftBorderColor(JRBox box, Color defaultColor) {
1135: if (box.getOwnLeftBorderColor() != null)
1136: return box.getOwnLeftBorderColor();
1137: if (box.getOwnBorderColor() != null)
1138: return box.getOwnBorderColor();
1139: JRStyle style = getBaseStyle(box);
1140: if (style != null && style.getLeftBorderColor() != null)
1141: return style.getLeftBorderColor();
1142: return defaultColor;
1143: }
1144:
1145: /**
1146: *
1147: */
1148: public static Color getLeftBorderColor(JRStyle style) {
1149: if (style.getOwnLeftBorderColor() != null)
1150: return style.getOwnLeftBorderColor();
1151: if (style.getOwnBorderColor() != null)
1152: return style.getOwnBorderColor();
1153: JRStyle baseStyle = getBaseStyle(style);
1154: if (baseStyle != null)
1155: return baseStyle.getLeftBorderColor();
1156: return null;
1157: }
1158:
1159: /**
1160: *
1161: */
1162: public static Color getBottomBorderColor(JRBox box,
1163: Color defaultColor) {
1164: if (box.getOwnBottomBorderColor() != null)
1165: return box.getOwnBottomBorderColor();
1166: if (box.getOwnBorderColor() != null)
1167: return box.getOwnBorderColor();
1168: JRStyle style = getBaseStyle(box);
1169: if (style != null && style.getBottomBorderColor() != null)
1170: return style.getBottomBorderColor();
1171: return defaultColor;
1172: }
1173:
1174: /**
1175: *
1176: */
1177: public static Color getBottomBorderColor(JRStyle style) {
1178: if (style.getOwnBottomBorderColor() != null)
1179: return style.getOwnBottomBorderColor();
1180: if (style.getOwnBorderColor() != null)
1181: return style.getOwnBorderColor();
1182: JRStyle baseStyle = getBaseStyle(style);
1183: if (baseStyle != null)
1184: return baseStyle.getBottomBorderColor();
1185: return null;
1186: }
1187:
1188: /**
1189: *
1190: */
1191: public static Color getRightBorderColor(JRBox box,
1192: Color defaultColor) {
1193: if (box.getOwnRightBorderColor() != null)
1194: return box.getOwnRightBorderColor();
1195: if (box.getOwnBorderColor() != null)
1196: return box.getOwnBorderColor();
1197: JRStyle style = getBaseStyle(box);
1198: if (style != null && style.getRightBorderColor() != null)
1199: return style.getRightBorderColor();
1200: return defaultColor;
1201: }
1202:
1203: /**
1204: *
1205: */
1206: public static Color getRightBorderColor(JRStyle style) {
1207: if (style.getOwnRightBorderColor() != null)
1208: return style.getOwnRightBorderColor();
1209: if (style.getOwnBorderColor() != null)
1210: return style.getOwnBorderColor();
1211: JRStyle baseStyle = getBaseStyle(style);
1212: if (baseStyle != null)
1213: return baseStyle.getRightBorderColor();
1214: return null;
1215: }
1216:
1217: /**
1218: *
1219: */
1220: public static int getPadding(JRBox box) {
1221: if (box.getOwnPadding() != null)
1222: return box.getOwnPadding().intValue();
1223: JRStyle baseStyle = getBaseStyle(box);
1224: if (baseStyle != null && baseStyle.getPadding() != null)
1225: return baseStyle.getPadding().intValue();
1226: return 0;
1227: }
1228:
1229: /**
1230: *
1231: */
1232: public static Integer getPadding(JRStyle style) {
1233: if (style.getOwnPadding() != null)
1234: return style.getOwnPadding();
1235: JRStyle baseStyle = getBaseStyle(style);
1236: if (baseStyle != null)
1237: return baseStyle.getPadding();
1238: return null;
1239: }
1240:
1241: /**
1242: *
1243: */
1244: public static int getTopPadding(JRBox box) {
1245: if (box.getOwnTopPadding() != null)
1246: return box.getOwnTopPadding().intValue();
1247: if (box.getOwnPadding() != null)
1248: return box.getOwnPadding().intValue();
1249: JRStyle style = getBaseStyle(box);
1250: if (style != null && style.getTopPadding() != null)
1251: return style.getTopPadding().intValue();
1252: return 0;
1253: }
1254:
1255: /**
1256: *
1257: */
1258: public static Integer getTopPadding(JRStyle style) {
1259: if (style.getOwnTopPadding() != null)
1260: return style.getOwnTopPadding();
1261: if (style.getOwnPadding() != null)
1262: return style.getOwnPadding();
1263: JRStyle baseStyle = getBaseStyle(style);
1264: if (baseStyle != null)
1265: return baseStyle.getTopPadding();
1266: return null;
1267: }
1268:
1269: /**
1270: *
1271: */
1272: public static int getLeftPadding(JRBox box) {
1273: if (box.getOwnLeftPadding() != null)
1274: return box.getOwnLeftPadding().intValue();
1275: if (box.getOwnPadding() != null)
1276: return box.getOwnPadding().intValue();
1277: JRStyle style = getBaseStyle(box);
1278: if (style != null && style.getLeftPadding() != null)
1279: return style.getLeftPadding().intValue();
1280: return 0;
1281: }
1282:
1283: /**
1284: *
1285: */
1286: public static Integer getLeftPadding(JRStyle style) {
1287: if (style.getOwnLeftPadding() != null)
1288: return style.getOwnLeftPadding();
1289: if (style.getOwnPadding() != null)
1290: return style.getOwnPadding();
1291: JRStyle baseStyle = getBaseStyle(style);
1292: if (baseStyle != null)
1293: return baseStyle.getLeftPadding();
1294: return null;
1295: }
1296:
1297: /**
1298: *
1299: */
1300: public static int getBottomPadding(JRBox box) {
1301: if (box.getOwnBottomPadding() != null)
1302: return box.getOwnBottomPadding().intValue();
1303: if (box.getOwnPadding() != null)
1304: return box.getOwnPadding().intValue();
1305: JRStyle style = getBaseStyle(box);
1306: if (style != null && style.getBottomPadding() != null)
1307: return style.getBottomPadding().intValue();
1308: return 0;
1309: }
1310:
1311: /**
1312: *
1313: */
1314: public static Integer getBottomPadding(JRStyle style) {
1315: if (style.getOwnBottomPadding() != null)
1316: return style.getOwnBottomPadding();
1317: if (style.getOwnPadding() != null)
1318: return style.getOwnPadding();
1319: JRStyle baseStyle = getBaseStyle(style);
1320: if (baseStyle != null)
1321: return baseStyle.getBottomPadding();
1322: return null;
1323: }
1324:
1325: /**
1326: *
1327: */
1328: public static int getRightPadding(JRBox box) {
1329: if (box.getOwnRightPadding() != null)
1330: return box.getOwnRightPadding().intValue();
1331: if (box.getOwnPadding() != null)
1332: return box.getOwnPadding().intValue();
1333: JRStyle style = getBaseStyle(box);
1334: if (style != null && style.getRightPadding() != null)
1335: return style.getRightPadding().intValue();
1336: return 0;
1337: }
1338:
1339: /**
1340: *
1341: */
1342: public static Integer getRightPadding(JRStyle style) {
1343: if (style.getOwnRightPadding() != null)
1344: return style.getOwnRightPadding();
1345: if (style.getOwnPadding() != null)
1346: return style.getOwnPadding();
1347: JRStyle baseStyle = getBaseStyle(style);
1348: if (baseStyle != null)
1349: return baseStyle.getRightPadding();
1350: return null;
1351: }
1352:
1353: /**
1354: * Merges two styles, by appending the properties of the source style to the ones of the destination style.
1355: */
1356: public static void appendStyle(JRStyle destStyle, JRStyle srcStyle) {
1357: if (srcStyle.getOwnMode() != null)
1358: destStyle.setMode(srcStyle.getOwnMode());
1359: if (srcStyle.getOwnForecolor() != null)
1360: destStyle.setForecolor(srcStyle.getOwnForecolor());
1361: if (srcStyle.getOwnBackcolor() != null)
1362: destStyle.setBackcolor(srcStyle.getOwnBackcolor());
1363:
1364: if (srcStyle.getOwnPen() != null)
1365: destStyle.setPen(srcStyle.getOwnPen());
1366: if (srcStyle.getOwnFill() != null)
1367: destStyle.setFill(srcStyle.getOwnFill());
1368:
1369: if (srcStyle.getOwnRadius() != null)
1370: destStyle.setRadius(srcStyle.getOwnRadius());
1371:
1372: if (srcStyle.getOwnScaleImage() != null)
1373: destStyle.setScaleImage(srcStyle.getOwnScaleImage());
1374: if (srcStyle.getOwnHorizontalAlignment() != null)
1375: destStyle.setHorizontalAlignment(srcStyle
1376: .getOwnHorizontalAlignment());
1377: if (srcStyle.getOwnVerticalAlignment() != null)
1378: destStyle.setVerticalAlignment(srcStyle
1379: .getOwnVerticalAlignment());
1380:
1381: if (srcStyle.getOwnBorder() != null)
1382: destStyle.setBorder(srcStyle.getOwnBorder());
1383: if (srcStyle.getOwnTopBorder() != null)
1384: destStyle.setTopBorder(srcStyle.getOwnTopBorder());
1385: if (srcStyle.getOwnLeftBorder() != null)
1386: destStyle.setLeftBorder(srcStyle.getOwnLeftBorder());
1387: if (srcStyle.getOwnBottomBorder() != null)
1388: destStyle.setBottomBorder(srcStyle.getOwnBottomBorder());
1389: if (srcStyle.getOwnRightBorder() != null)
1390: destStyle.setRightBorder(srcStyle.getOwnRightBorder());
1391: if (srcStyle.getOwnBorderColor() != null)
1392: destStyle.setBorderColor(srcStyle.getOwnBorderColor());
1393: if (srcStyle.getOwnTopBorderColor() != null)
1394: destStyle
1395: .setTopBorderColor(srcStyle.getOwnTopBorderColor());
1396: if (srcStyle.getOwnLeftBorderColor() != null)
1397: destStyle.setLeftBorderColor(srcStyle
1398: .getOwnLeftBorderColor());
1399: if (srcStyle.getOwnBottomBorderColor() != null)
1400: destStyle.setBottomBorderColor(srcStyle
1401: .getOwnBottomBorderColor());
1402: if (srcStyle.getOwnRightBorderColor() != null)
1403: destStyle.setRightBorderColor(srcStyle
1404: .getOwnRightBorderColor());
1405: if (srcStyle.getOwnPadding() != null)
1406: destStyle.setPadding(srcStyle.getOwnPadding());
1407: if (srcStyle.getOwnTopPadding() != null)
1408: destStyle.setTopPadding(srcStyle.getOwnTopPadding());
1409: if (srcStyle.getOwnLeftPadding() != null)
1410: destStyle.setLeftPadding(srcStyle.getOwnLeftPadding());
1411: if (srcStyle.getOwnBottomPadding() != null)
1412: destStyle.setBottomPadding(srcStyle.getOwnBottomPadding());
1413: if (srcStyle.getOwnRightPadding() != null)
1414: destStyle.setRightPadding(srcStyle.getOwnRightPadding());
1415:
1416: if (srcStyle.getOwnRotation() != null)
1417: destStyle.setRotation(srcStyle.getOwnRotation());
1418: if (srcStyle.getOwnLineSpacing() != null)
1419: destStyle.setLineSpacing(srcStyle.getOwnLineSpacing());
1420: if (srcStyle.isOwnStyledText() != null)
1421: destStyle.setStyledText(srcStyle.isOwnStyledText());
1422:
1423: if (srcStyle.getOwnPattern() != null)
1424: destStyle.setPattern(srcStyle.getOwnPattern());
1425:
1426: if (srcStyle.getOwnFontName() != null)
1427: destStyle.setFontName(srcStyle.getOwnFontName());
1428: if (srcStyle.isOwnBold() != null)
1429: destStyle.setBold(srcStyle.isOwnBold());
1430: if (srcStyle.isOwnItalic() != null)
1431: destStyle.setItalic(srcStyle.isOwnItalic());
1432: if (srcStyle.isOwnUnderline() != null)
1433: destStyle.setUnderline(srcStyle.isOwnUnderline());
1434: if (srcStyle.isOwnStrikeThrough() != null)
1435: destStyle.setStrikeThrough(srcStyle.isOwnStrikeThrough());
1436: if (srcStyle.getOwnFontSize() != null)
1437: destStyle.setFontSize(srcStyle.getOwnFontSize());
1438: if (srcStyle.getOwnPdfFontName() != null)
1439: destStyle.setPdfFontName(srcStyle.getOwnPdfFontName());
1440: if (srcStyle.getOwnPdfEncoding() != null)
1441: destStyle.setPdfEncoding(srcStyle.getOwnPdfEncoding());
1442: if (srcStyle.isOwnPdfEmbedded() != null)
1443: destStyle.setPdfEmbedded(srcStyle.isOwnPdfEmbedded());
1444: }
1445:
1446: /**
1447: *
1448: */
1449: public static Color getTitleColor(JRChart chart) {
1450: if (chart.getOwnTitleColor() != null)
1451: return chart.getOwnTitleColor();
1452: return getForecolor(chart);
1453: }
1454:
1455: /**
1456: *
1457: */
1458: public static Color getSubtitleColor(JRChart chart) {
1459: if (chart.getOwnSubtitleColor() != null)
1460: return chart.getOwnSubtitleColor();
1461: return getForecolor(chart);
1462: }
1463:
1464: /**
1465: *
1466: */
1467: public static Color getLegendColor(JRChart chart) {
1468: if (chart.getOwnLegendColor() != null)
1469: return chart.getOwnLegendColor();
1470: return getForecolor(chart);
1471: }
1472:
1473: /**
1474: *
1475: */
1476: public static Color getLegendBackgroundColor(JRChart chart) {
1477: if (chart.getOwnLegendBackgroundColor() != null)
1478: return chart.getOwnLegendBackgroundColor();
1479: return getBackcolor(chart);
1480: }
1481:
1482: /**
1483: *
1484: */
1485: public static Color getCategoryAxisLabelColor(
1486: JRCategoryAxisFormat axisFormat, JRChartPlot plot) {
1487: if (axisFormat.getOwnCategoryAxisLabelColor() != null)
1488: return axisFormat.getOwnCategoryAxisLabelColor();
1489: return getForecolor(plot);
1490: }
1491:
1492: /**
1493: *
1494: */
1495: public static Color getCategoryAxisTickLabelColor(
1496: JRCategoryAxisFormat axisFormat, JRChartPlot plot) {
1497: if (axisFormat.getOwnCategoryAxisTickLabelColor() != null)
1498: return axisFormat.getOwnCategoryAxisTickLabelColor();
1499: return getForecolor(plot);
1500: }
1501:
1502: /**
1503: *
1504: */
1505: public static Color getCategoryAxisLineColor(
1506: JRCategoryAxisFormat axisFormat, JRChartPlot plot) {
1507: if (axisFormat.getOwnCategoryAxisLineColor() != null)
1508: return axisFormat.getOwnCategoryAxisLineColor();
1509: return getForecolor(plot);
1510: }
1511:
1512: /**
1513: *
1514: */
1515: public static Color getValueAxisLabelColor(
1516: JRValueAxisFormat axisFormat, JRChartPlot plot) {
1517: if (axisFormat.getOwnValueAxisLabelColor() != null)
1518: return axisFormat.getOwnValueAxisLabelColor();
1519: return getForecolor(plot);
1520: }
1521:
1522: /**
1523: *
1524: */
1525: public static Color getValueAxisTickLabelColor(
1526: JRValueAxisFormat axisFormat, JRChartPlot plot) {
1527: if (axisFormat.getOwnValueAxisTickLabelColor() != null)
1528: return axisFormat.getOwnValueAxisTickLabelColor();
1529: return getForecolor(plot);
1530: }
1531:
1532: /**
1533: *
1534: */
1535: public static Color getValueAxisLineColor(
1536: JRValueAxisFormat axisFormat, JRChartPlot plot) {
1537: if (axisFormat.getOwnValueAxisLineColor() != null)
1538: return axisFormat.getOwnValueAxisLineColor();
1539: return getForecolor(plot);
1540: }
1541:
1542: /**
1543: *
1544: */
1545: public static Color getXAxisLabelColor(JRXAxisFormat axisFormat,
1546: JRChartPlot plot) {
1547: if (axisFormat.getOwnXAxisLabelColor() != null)
1548: return axisFormat.getOwnXAxisLabelColor();
1549: return getForecolor(plot);
1550: }
1551:
1552: /**
1553: *
1554: */
1555: public static Color getXAxisTickLabelColor(
1556: JRXAxisFormat axisFormat, JRChartPlot plot) {
1557: if (axisFormat.getOwnXAxisTickLabelColor() != null)
1558: return axisFormat.getOwnXAxisTickLabelColor();
1559: return getForecolor(plot);
1560: }
1561:
1562: /**
1563: *
1564: */
1565: public static Color getXAxisLineColor(JRXAxisFormat axisFormat,
1566: JRChartPlot plot) {
1567: if (axisFormat.getOwnXAxisLineColor() != null)
1568: return axisFormat.getOwnXAxisLineColor();
1569: return getForecolor(plot);
1570: }
1571:
1572: /**
1573: *
1574: */
1575: public static Color getYAxisLabelColor(JRYAxisFormat axisFormat,
1576: JRChartPlot plot) {
1577: if (axisFormat.getOwnYAxisLabelColor() != null)
1578: return axisFormat.getOwnYAxisLabelColor();
1579: return getForecolor(plot);
1580: }
1581:
1582: /**
1583: *
1584: */
1585: public static Color getYAxisTickLabelColor(
1586: JRYAxisFormat axisFormat, JRChartPlot plot) {
1587: if (axisFormat.getOwnYAxisTickLabelColor() != null)
1588: return axisFormat.getOwnYAxisTickLabelColor();
1589: return getForecolor(plot);
1590: }
1591:
1592: /**
1593: *
1594: */
1595: public static Color getYAxisLineColor(JRYAxisFormat axisFormat,
1596: JRChartPlot plot) {
1597: if (axisFormat.getOwnYAxisLineColor() != null)
1598: return axisFormat.getOwnYAxisLineColor();
1599: return getForecolor(plot);
1600: }
1601:
1602: /**
1603: *
1604: */
1605: public static Color getTimeAxisLabelColor(
1606: JRTimeAxisFormat axisFormat, JRChartPlot plot) {
1607: if (axisFormat.getOwnTimeAxisLabelColor() != null)
1608: return axisFormat.getOwnTimeAxisLabelColor();
1609: return getForecolor(plot);
1610: }
1611:
1612: /**
1613: *
1614: */
1615: public static Color getTimeAxisTickLabelColor(
1616: JRTimeAxisFormat axisFormat, JRChartPlot plot) {
1617: if (axisFormat.getOwnTimeAxisTickLabelColor() != null)
1618: return axisFormat.getOwnTimeAxisTickLabelColor();
1619: return getForecolor(plot);
1620: }
1621:
1622: /**
1623: *
1624: */
1625: public static Color getTimeAxisLineColor(
1626: JRTimeAxisFormat axisFormat, JRChartPlot plot) {
1627: if (axisFormat.getOwnTimeAxisLineColor() != null)
1628: return axisFormat.getOwnTimeAxisLineColor();
1629: return getForecolor(plot);
1630: }
1631:
1632: }
|