package net.sf.jasperreports.engine.util; import java.awt.Color; import net.sf.jasperreports.charts.JRCategoryAxisFormat; import net.sf.jasperreports.charts.JRTimeAxisFormat; import net.sf.jasperreports.charts.JRValueAxisFormat; import net.sf.jasperreports.charts.JRXAxisFormat; import net.sf.jasperreports.charts.JRYAxisFormat; import net.sf.jasperreports.engine.JRAlignment; import net.sf.jasperreports.engine.JRChart; import net.sf.jasperreports.engine.JRChartPlot; import net.sf.jasperreports.engine.JRCommonElement; import net.sf.jasperreports.engine.JRCommonGraphicElement; import net.sf.jasperreports.engine.JRCommonImage; import net.sf.jasperreports.engine.JRCommonRectangle; import net.sf.jasperreports.engine.JRCommonText; import net.sf.jasperreports.engine.JRFont; import net.sf.jasperreports.engine.JRLineBox; import net.sf.jasperreports.engine.JRPen; import net.sf.jasperreports.engine.JRStyle; import net.sf.jasperreports.engine.JRStyleContainer; import net.sf.jasperreports.engine.JRTextField; import net.sf.jasperreports.engine.base.JRBoxPen; public class JRStyleResolver { private static final Integer INTEGER_ZERO = new Integer(0); private static JRFont getBaseFont(JRFont font) { if (font.getReportFont() != null) return (JRFont)font.getReportFont(); if (font.getDefaultStyleProvider() != null) return (JRFont)font.getDefaultStyleProvider().getDefaultFont(); return null; } private static JRStyle getBaseStyle(JRStyleContainer styleContainer) { if (styleContainer != null) { if (styleContainer.getStyle() != null) return styleContainer.getStyle(); if (styleContainer.getDefaultStyleProvider() != null) return styleContainer.getDefaultStyleProvider().getDefaultStyle(); } return null; } public static byte getMode(JRCommonElement element, byte defaultMode) { if (element.getOwnMode() != null) return element.getOwnMode().byteValue(); JRStyle style = getBaseStyle((JRStyleContainer)element); if (style != null && style.getMode() != null) return style.getMode().byteValue(); return defaultMode; } public static Byte getMode(JRStyle style) { if (style.getOwnMode() != null) return style.getOwnMode(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)style); if (baseStyle != null) return baseStyle.getMode(); return null; } public static Color getForecolor(JRCommonElement element) { if (element.getOwnForecolor() != null) return element.getOwnForecolor(); JRStyle style = getBaseStyle((JRStyleContainer)element); if (style != null && style.getForecolor() != null) return style.getForecolor(); return Color.black; } public static Color getForecolor(JRChartPlot plot) { JRChart chart = plot.getChart(); if (chart != null) return getForecolor((JRCommonElement)chart); return Color.black; } public static Color getForecolor(JRStyle style) { if (style.getOwnForecolor() != null) return style.getOwnForecolor(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)style); if (baseStyle != null) return baseStyle.getForecolor(); return null; } public static Color getBackcolor(JRCommonElement element) { if (element.getOwnBackcolor() != null) return element.getOwnBackcolor(); JRStyle style = getBaseStyle((JRStyleContainer)element); if (style != null && style.getBackcolor() != null) return style.getBackcolor(); return Color.white; } public static Color getBackcolor(JRChartPlot plot) { if (plot.getOwnBackcolor() != null) return plot.getOwnBackcolor(); JRChart chart = plot.getChart(); if (chart != null) return getBackcolor((JRCommonElement)chart); return Color.white; } public static Color getBackcolor(JRStyle style) { if (style.getOwnBackcolor() != null) return style.getOwnBackcolor(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)style); if (baseStyle != null) return baseStyle.getBackcolor(); return null; } public static Float getLineWidth(JRPen pen, Float defaultLineWidth) { if (pen.getOwnLineWidth() != null) return pen.getOwnLineWidth(); JRStyle baseStyle = getBaseStyle(pen.getStyleContainer()); if (baseStyle != null && baseStyle.getLinePen().getLineWidth() != null) return baseStyle.getLinePen().getLineWidth(); return defaultLineWidth; } public static Float getLineWidth(JRBoxPen boxPen, Float defaultLineWidth) { if (boxPen.getOwnLineWidth() != null) return boxPen.getOwnLineWidth(); if (boxPen.getBox().getPen().getOwnLineWidth() != null) return boxPen.getBox().getPen().getOwnLineWidth(); JRStyle baseStyle = getBaseStyle(boxPen.getStyleContainer()); if (baseStyle != null && boxPen.getPen(baseStyle.getLineBox()).getLineWidth() != null) return boxPen.getPen(baseStyle.getLineBox()).getLineWidth(); return defaultLineWidth; } public static Byte getLineStyle(JRPen pen) { if (pen.getOwnLineStyle() != null) return pen.getOwnLineStyle(); JRStyle baseStyle = getBaseStyle(pen.getStyleContainer()); if (baseStyle != null && baseStyle.getLinePen().getLineStyle() != null) return baseStyle.getLinePen().getLineStyle(); return new Byte((byte)0); } public static Byte getLineStyle(JRBoxPen boxPen) { if (boxPen.getOwnLineStyle() != null) return boxPen.getOwnLineStyle(); if (boxPen.getBox().getPen().getOwnLineStyle() != null) return boxPen.getBox().getPen().getOwnLineStyle(); JRStyle baseStyle = getBaseStyle(boxPen.getStyleContainer()); if (baseStyle != null && boxPen.getPen(baseStyle.getLineBox()).getLineStyle() != null) return boxPen.getPen(baseStyle.getLineBox()).getLineStyle(); return new Byte((byte)0); } public static Color getLineColor(JRPen pen, Color defaultColor) { if (pen.getOwnLineColor() != null) return pen.getOwnLineColor(); JRStyle baseStyle = getBaseStyle(pen.getStyleContainer()); if (baseStyle != null && baseStyle.getLinePen().getLineColor() != null) return baseStyle.getLinePen().getLineColor(); return defaultColor; } public static Color getLineColor(JRBoxPen boxPen, Color defaultColor) { if (boxPen.getOwnLineColor() != null) return boxPen.getOwnLineColor(); if (boxPen.getBox().getPen().getOwnLineColor() != null) return boxPen.getBox().getPen().getOwnLineColor(); JRStyle baseStyle = getBaseStyle(boxPen.getStyleContainer()); if (baseStyle != null && boxPen.getPen(baseStyle.getLineBox()).getLineColor() != null) return boxPen.getPen(baseStyle.getLineBox()).getLineColor(); return defaultColor; } public static byte getFill(JRCommonGraphicElement element) { if (element.getOwnFill() != null) return element.getOwnFill().byteValue(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)element); if (baseStyle != null && baseStyle.getFill() != null) return baseStyle.getFill().byteValue(); return 1; } public static Byte getFill(JRStyle style) { if (style.getOwnFill() != null) return style.getOwnFill(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)style); if (baseStyle != null) return baseStyle.getFill(); return null; } public static int getRadius(JRCommonRectangle rectangle) { if (rectangle.getOwnRadius() != null) return rectangle.getOwnRadius().intValue(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)rectangle); if (baseStyle != null && baseStyle.getRadius() != null) return baseStyle.getRadius().intValue(); return 0; } public static Integer getRadius(JRStyle style) { if (style.getOwnRadius() != null) return style.getOwnRadius(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)style); if (baseStyle != null) return baseStyle.getRadius(); return null; } public static byte getScaleImage(JRCommonImage image) { if (image.getOwnScaleImage() != null) return image.getOwnScaleImage().byteValue(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)image); if (baseStyle != null && baseStyle.getScaleImage() != null) return baseStyle.getScaleImage().byteValue(); return 3; } public static Byte getScaleImage(JRStyle style) { if (style.getOwnScaleImage() != null) return style.getOwnScaleImage(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)style); if (baseStyle != null) return baseStyle.getScaleImage(); return null; } public static byte getHorizontalAlignment(JRAlignment alignment) { if (alignment.getOwnHorizontalAlignment() != null) return alignment.getOwnHorizontalAlignment().byteValue(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)alignment); if (baseStyle != null && baseStyle.getHorizontalAlignment() != null) return baseStyle.getHorizontalAlignment().byteValue(); return 1; } public static Byte getHorizontalAlignment(JRStyle style) { if (style.getOwnHorizontalAlignment() != null) return style.getOwnHorizontalAlignment(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)style); if (baseStyle != null && baseStyle.getHorizontalAlignment() != null) return baseStyle.getHorizontalAlignment(); return null; } public static byte getVerticalAlignment(JRAlignment alignment) { if (alignment.getOwnVerticalAlignment() != null) return alignment.getOwnVerticalAlignment().byteValue(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)alignment); if (baseStyle != null && baseStyle.getVerticalAlignment() != null) return baseStyle.getVerticalAlignment().byteValue(); return 1; } public static Byte getVerticalAlignment(JRStyle style) { if (style.getOwnVerticalAlignment() != null) return style.getOwnVerticalAlignment(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)style); if (baseStyle != null && baseStyle.getVerticalAlignment() != null) return baseStyle.getVerticalAlignment(); return null; } public static byte getRotation(JRCommonText element) { if (element.getOwnRotation() != null) return element.getOwnRotation().byteValue(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)element); if (baseStyle != null && baseStyle.getRotation() != null) return baseStyle.getRotation().byteValue(); return 0; } public static Byte getRotation(JRStyle style) { if (style.getOwnRotation() != null) return style.getOwnRotation(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)style); if (baseStyle != null) return baseStyle.getRotation(); return null; } public static byte getLineSpacing(JRCommonText element) { if (element.getOwnLineSpacing() != null) return element.getOwnLineSpacing().byteValue(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)element); if (baseStyle != null && baseStyle.getLineSpacing() != null) return baseStyle.getLineSpacing().byteValue(); return 0; } public static Byte getLineSpacing(JRStyle style) { if (style.getOwnLineSpacing() != null) return style.getOwnLineSpacing(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)style); if (baseStyle != null) return baseStyle.getLineSpacing(); return null; } public static String getMarkup(JRCommonText element) { if (element.getOwnMarkup() != null) return element.getOwnMarkup(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)element); if (baseStyle != null && baseStyle.getMarkup() != null) return baseStyle.getMarkup(); return "none"; } public static String getMarkup(JRStyle style) { if (style.getOwnMarkup() != null) return style.getOwnMarkup(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)style); if (baseStyle != null) return baseStyle.getMarkup(); return "none"; } public static String getPattern(JRTextField element) { if (element.getOwnPattern() != null) return element.getOwnPattern(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)element); if (baseStyle != null) return baseStyle.getPattern(); return null; } public static String getPattern(JRStyle style) { if (style.getOwnPattern() != null) return style.getOwnPattern(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)style); if (baseStyle != null) return baseStyle.getPattern(); return null; } public static boolean isBlankWhenNull(JRTextField element) { if (element.isOwnBlankWhenNull() != null) return element.isOwnBlankWhenNull().booleanValue(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)element); if (baseStyle != null && baseStyle.isBlankWhenNull() != null) return baseStyle.isBlankWhenNull().booleanValue(); return false; } public static Boolean isBlankWhenNull(JRStyle style) { if (style.isOwnBlankWhenNull() != null) return style.isOwnBlankWhenNull(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)style); if (baseStyle != null) return baseStyle.isBlankWhenNull(); return null; } public static String getFontName(JRFont font) { if (font.getOwnFontName() != null) return font.getOwnFontName(); JRFont baseFont = getBaseFont(font); if (baseFont != null && baseFont.getFontName() != null) return baseFont.getFontName(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)font); if (baseStyle != null && baseStyle.getFontName() != null) return baseStyle.getFontName(); return JRProperties.getProperty("net.sf.jasperreports.default.font.name"); } public static String getFontName(JRStyle style) { if (style.getOwnFontName() != null) return style.getOwnFontName(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)style); if (baseStyle != null && baseStyle.getFontName() != null) return baseStyle.getFontName(); return JRProperties.getProperty("net.sf.jasperreports.default.font.name"); } public static boolean isBold(JRFont font) { if (font.isOwnBold() != null) return font.isOwnBold().booleanValue(); JRFont baseFont = getBaseFont(font); if (baseFont != null) return baseFont.isBold(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)font); if (baseStyle != null && baseStyle.isBold() != null) return baseStyle.isBold().booleanValue(); return false; } public static Boolean isBold(JRStyle style) { if (style.isOwnBold() != null) return style.isOwnBold(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)style); if (baseStyle != null) return baseStyle.isBold(); return null; } public static boolean isItalic(JRFont font) { if (font.isOwnItalic() != null) return font.isOwnItalic().booleanValue(); JRFont baseFont = getBaseFont(font); if (baseFont != null) return baseFont.isItalic(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)font); if (baseStyle != null && baseStyle.isItalic() != null) return baseStyle.isItalic().booleanValue(); return false; } public static Boolean isItalic(JRStyle style) { if (style.isOwnItalic() != null) return style.isOwnItalic(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)style); if (baseStyle != null) return baseStyle.isItalic(); return null; } public static boolean isUnderline(JRFont font) { if (font.isOwnUnderline() != null) return font.isOwnUnderline().booleanValue(); JRFont baseFont = getBaseFont(font); if (baseFont != null) return baseFont.isUnderline(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)font); if (baseStyle != null && baseStyle.isUnderline() != null) return baseStyle.isUnderline().booleanValue(); return false; } public static Boolean isUnderline(JRStyle style) { if (style.isOwnUnderline() != null) return style.isOwnUnderline(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)style); if (baseStyle != null) return baseStyle.isUnderline(); return null; } public static boolean isStrikeThrough(JRFont font) { if (font.isOwnStrikeThrough() != null) return font.isOwnStrikeThrough().booleanValue(); JRFont baseFont = getBaseFont(font); if (baseFont != null) return baseFont.isStrikeThrough(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)font); if (baseStyle != null && baseStyle.isStrikeThrough() != null) return baseStyle.isStrikeThrough().booleanValue(); return false; } public static Boolean isStrikeThrough(JRStyle style) { if (style.isOwnStrikeThrough() != null) return style.isOwnStrikeThrough(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)style); if (baseStyle != null) return baseStyle.isStrikeThrough(); return null; } public static int getFontSize(JRFont font) { if (font.getOwnFontSize() != null) return font.getOwnFontSize().intValue(); JRFont baseFont = getBaseFont(font); if (baseFont != null) return baseFont.getFontSize(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)font); if (baseStyle != null && baseStyle.getFontSize() != null) return baseStyle.getFontSize().intValue(); return JRProperties.getIntegerProperty("net.sf.jasperreports.default.font.size"); } public static Integer getFontSize(JRStyle style) { if (style.getOwnFontSize() != null) return style.getOwnFontSize(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)style); if (baseStyle != null) return baseStyle.getFontSize(); return null; } public static String getPdfFontName(JRFont font) { if (font.getOwnPdfFontName() != null) return font.getOwnPdfFontName(); JRFont baseFont = getBaseFont(font); if (baseFont != null && baseFont.getPdfFontName() != null) return baseFont.getPdfFontName(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)font); if (baseStyle != null && baseStyle.getPdfFontName() != null) return baseStyle.getPdfFontName(); return JRProperties.getProperty("net.sf.jasperreports.default.pdf.font.name"); } public static String getPdfFontName(JRStyle style) { if (style.getOwnPdfFontName() != null) return style.getOwnPdfFontName(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)style); if (baseStyle != null && baseStyle.getPdfFontName() != null) return baseStyle.getPdfFontName(); return JRProperties.getProperty("net.sf.jasperreports.default.pdf.font.name"); } public static String getPdfEncoding(JRFont font) { if (font.getOwnPdfEncoding() != null) return font.getOwnPdfEncoding(); JRFont baseFont = getBaseFont(font); if (baseFont != null && baseFont.getPdfEncoding() != null) return baseFont.getPdfEncoding(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)font); if (baseStyle != null && baseStyle.getPdfEncoding() != null) return baseStyle.getPdfEncoding(); return JRProperties.getProperty("net.sf.jasperreports.default.pdf.encoding"); } public static String getPdfEncoding(JRStyle style) { if (style.getOwnPdfEncoding() != null) return style.getOwnPdfEncoding(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)style); if (baseStyle != null && baseStyle.getPdfEncoding() != null) return baseStyle.getPdfEncoding(); return JRProperties.getProperty("net.sf.jasperreports.default.pdf.encoding"); } public static boolean isPdfEmbedded(JRFont font) { if (font.isOwnPdfEmbedded() != null) return font.isOwnPdfEmbedded().booleanValue(); JRFont baseFont = getBaseFont(font); if (baseFont != null) return baseFont.isPdfEmbedded(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)font); if (baseStyle != null && baseStyle.isPdfEmbedded() != null) return baseStyle.isPdfEmbedded().booleanValue(); return JRProperties.getBooleanProperty("net.sf.jasperreports.default.pdf.embedded"); } public static Boolean isPdfEmbedded(JRStyle style) { if (style.isOwnPdfEmbedded() != null) return style.isOwnPdfEmbedded(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)style); if (baseStyle != null) return baseStyle.isPdfEmbedded(); return null; } public static Integer getPadding(JRLineBox box) { if (box.getOwnPadding() != null) return box.getOwnPadding(); JRStyle baseStyle = getBaseStyle((JRStyleContainer)box); if (baseStyle != null && baseStyle.getLineBox().getPadding() != null) return baseStyle.getLineBox().getPadding(); return INTEGER_ZERO; } public static Integer getTopPadding(JRLineBox box) { if (box.getOwnTopPadding() != null) return box.getOwnTopPadding(); if (box.getOwnPadding() != null) return box.getOwnPadding(); JRStyle style = getBaseStyle((JRStyleContainer)box); if (style != null && style.getLineBox().getTopPadding() != null) return style.getLineBox().getTopPadding(); return INTEGER_ZERO; } public static Integer getLeftPadding(JRLineBox box) { if (box.getOwnLeftPadding() != null) return box.getOwnLeftPadding(); if (box.getOwnPadding() != null) return box.getOwnPadding(); JRStyle style = getBaseStyle((JRStyleContainer)box); if (style != null && style.getLineBox().getLeftPadding() != null) return style.getLineBox().getLeftPadding(); return INTEGER_ZERO; } public static Integer getBottomPadding(JRLineBox box) { if (box.getOwnBottomPadding() != null) return box.getOwnBottomPadding(); if (box.getOwnPadding() != null) return box.getOwnPadding(); JRStyle style = getBaseStyle((JRStyleContainer)box); if (style != null && style.getLineBox().getBottomPadding() != null) return style.getLineBox().getBottomPadding(); return INTEGER_ZERO; } public static Integer getRightPadding(JRLineBox box) { if (box.getOwnRightPadding() != null) return box.getOwnRightPadding(); if (box.getOwnPadding() != null) return box.getOwnPadding(); JRStyle style = getBaseStyle((JRStyleContainer)box); if (style != null && style.getLineBox().getRightPadding() != null) return style.getLineBox().getRightPadding(); return INTEGER_ZERO; } public static void appendStyle(JRStyle destStyle, JRStyle srcStyle) { if (srcStyle.getOwnMode() != null) destStyle.setMode(srcStyle.getOwnMode()); if (srcStyle.getOwnForecolor() != null) destStyle.setForecolor(srcStyle.getOwnForecolor()); if (srcStyle.getOwnBackcolor() != null) destStyle.setBackcolor(srcStyle.getOwnBackcolor()); appendPen(destStyle.getLinePen(), srcStyle.getLinePen()); if (srcStyle.getOwnFill() != null) destStyle.setFill(srcStyle.getOwnFill()); if (srcStyle.getOwnRadius() != null) destStyle.setRadius(srcStyle.getOwnRadius()); if (srcStyle.getOwnScaleImage() != null) destStyle.setScaleImage(srcStyle.getOwnScaleImage()); if (srcStyle.getOwnHorizontalAlignment() != null) destStyle.setHorizontalAlignment(srcStyle.getOwnHorizontalAlignment()); if (srcStyle.getOwnVerticalAlignment() != null) destStyle.setVerticalAlignment(srcStyle.getOwnVerticalAlignment()); appendBox(destStyle.getLineBox(), srcStyle.getLineBox()); if (srcStyle.getOwnRotation() != null) destStyle.setRotation(srcStyle.getOwnRotation()); if (srcStyle.getOwnLineSpacing() != null) destStyle.setLineSpacing(srcStyle.getOwnLineSpacing()); if (srcStyle.getOwnMarkup() != null) destStyle.setMarkup(srcStyle.getOwnMarkup()); if (srcStyle.getOwnPattern() != null) destStyle.setPattern(srcStyle.getOwnPattern()); if (srcStyle.getOwnFontName() != null) destStyle.setFontName(srcStyle.getOwnFontName()); if (srcStyle.isOwnBold() != null) destStyle.setBold(srcStyle.isOwnBold()); if (srcStyle.isOwnItalic() != null) destStyle.setItalic(srcStyle.isOwnItalic()); if (srcStyle.isOwnUnderline() != null) destStyle.setUnderline(srcStyle.isOwnUnderline()); if (srcStyle.isOwnStrikeThrough() != null) destStyle.setStrikeThrough(srcStyle.isOwnStrikeThrough()); if (srcStyle.getOwnFontSize() != null) destStyle.setFontSize(srcStyle.getOwnFontSize()); if (srcStyle.getOwnPdfFontName() != null) destStyle.setPdfFontName(srcStyle.getOwnPdfFontName()); if (srcStyle.getOwnPdfEncoding() != null) destStyle.setPdfEncoding(srcStyle.getOwnPdfEncoding()); if (srcStyle.isOwnPdfEmbedded() != null) destStyle.setPdfEmbedded(srcStyle.isOwnPdfEmbedded()); } private static void appendPen(JRPen destPen, JRPen srcPen) { if (srcPen.getOwnLineWidth() != null) destPen.setLineWidth(srcPen.getOwnLineWidth()); if (srcPen.getOwnLineStyle() != null) destPen.setLineStyle(srcPen.getOwnLineStyle()); if (srcPen.getOwnLineColor() != null) destPen.setLineColor(srcPen.getOwnLineColor()); } private static void appendBox(JRLineBox destBox, JRLineBox srcBox) { appendPen((JRPen)destBox.getPen(), (JRPen)srcBox.getPen()); appendPen((JRPen)destBox.getTopPen(), (JRPen)srcBox.getTopPen()); appendPen((JRPen)destBox.getLeftPen(), (JRPen)srcBox.getLeftPen()); appendPen((JRPen)destBox.getBottomPen(), (JRPen)srcBox.getBottomPen()); appendPen((JRPen)destBox.getRightPen(), (JRPen)srcBox.getRightPen()); if (srcBox.getOwnPadding() != null) destBox.setPadding(srcBox.getOwnPadding()); if (srcBox.getOwnTopPadding() != null) destBox.setTopPadding(srcBox.getOwnTopPadding()); if (srcBox.getOwnLeftPadding() != null) destBox.setLeftPadding(srcBox.getOwnLeftPadding()); if (srcBox.getOwnBottomPadding() != null) destBox.setBottomPadding(srcBox.getOwnBottomPadding()); if (srcBox.getOwnRightPadding() != null) destBox.setRightPadding(srcBox.getOwnRightPadding()); } public static Color getTitleColor(JRChart chart) { if (chart.getOwnTitleColor() != null) return chart.getOwnTitleColor(); return getForecolor((JRCommonElement)chart); } public static Color getSubtitleColor(JRChart chart) { if (chart.getOwnSubtitleColor() != null) return chart.getOwnSubtitleColor(); return getForecolor((JRCommonElement)chart); } public static Color getLegendColor(JRChart chart) { if (chart.getOwnLegendColor() != null) return chart.getOwnLegendColor(); return getForecolor((JRCommonElement)chart); } public static Color getLegendBackgroundColor(JRChart chart) { if (chart.getOwnLegendBackgroundColor() != null) return chart.getOwnLegendBackgroundColor(); return getBackcolor((JRCommonElement)chart); } public static Color getCategoryAxisLabelColor(JRCategoryAxisFormat axisFormat, JRChartPlot plot) { if (axisFormat.getOwnCategoryAxisLabelColor() != null) return axisFormat.getOwnCategoryAxisLabelColor(); return getForecolor(plot); } public static Color getCategoryAxisTickLabelColor(JRCategoryAxisFormat axisFormat, JRChartPlot plot) { if (axisFormat.getOwnCategoryAxisTickLabelColor() != null) return axisFormat.getOwnCategoryAxisTickLabelColor(); return getForecolor(plot); } public static Color getCategoryAxisLineColor(JRCategoryAxisFormat axisFormat, JRChartPlot plot) { if (axisFormat.getOwnCategoryAxisLineColor() != null) return axisFormat.getOwnCategoryAxisLineColor(); return getForecolor(plot); } public static Color getValueAxisLabelColor(JRValueAxisFormat axisFormat, JRChartPlot plot) { if (axisFormat.getOwnValueAxisLabelColor() != null) return axisFormat.getOwnValueAxisLabelColor(); return getForecolor(plot); } public static Color getValueAxisTickLabelColor(JRValueAxisFormat axisFormat, JRChartPlot plot) { if (axisFormat.getOwnValueAxisTickLabelColor() != null) return axisFormat.getOwnValueAxisTickLabelColor(); return getForecolor(plot); } public static Color getValueAxisLineColor(JRValueAxisFormat axisFormat, JRChartPlot plot) { if (axisFormat.getOwnValueAxisLineColor() != null) return axisFormat.getOwnValueAxisLineColor(); return getForecolor(plot); } public static Color getXAxisLabelColor(JRXAxisFormat axisFormat, JRChartPlot plot) { if (axisFormat.getOwnXAxisLabelColor() != null) return axisFormat.getOwnXAxisLabelColor(); return getForecolor(plot); } public static Color getXAxisTickLabelColor(JRXAxisFormat axisFormat, JRChartPlot plot) { if (axisFormat.getOwnXAxisTickLabelColor() != null) return axisFormat.getOwnXAxisTickLabelColor(); return getForecolor(plot); } public static Color getXAxisLineColor(JRXAxisFormat axisFormat, JRChartPlot plot) { if (axisFormat.getOwnXAxisLineColor() != null) return axisFormat.getOwnXAxisLineColor(); return getForecolor(plot); } public static Color getYAxisLabelColor(JRYAxisFormat axisFormat, JRChartPlot plot) { if (axisFormat.getOwnYAxisLabelColor() != null) return axisFormat.getOwnYAxisLabelColor(); return getForecolor(plot); } public static Color getYAxisTickLabelColor(JRYAxisFormat axisFormat, JRChartPlot plot) { if (axisFormat.getOwnYAxisTickLabelColor() != null) return axisFormat.getOwnYAxisTickLabelColor(); return getForecolor(plot); } public static Color getYAxisLineColor(JRYAxisFormat axisFormat, JRChartPlot plot) { if (axisFormat.getOwnYAxisLineColor() != null) return axisFormat.getOwnYAxisLineColor(); return getForecolor(plot); } public static Color getTimeAxisLabelColor(JRTimeAxisFormat axisFormat, JRChartPlot plot) { if (axisFormat.getOwnTimeAxisLabelColor() != null) return axisFormat.getOwnTimeAxisLabelColor(); return getForecolor(plot); } public static Color getTimeAxisTickLabelColor(JRTimeAxisFormat axisFormat, JRChartPlot plot) { if (axisFormat.getOwnTimeAxisTickLabelColor() != null) return axisFormat.getOwnTimeAxisTickLabelColor(); return getForecolor(plot); } public static Color getTimeAxisLineColor(JRTimeAxisFormat axisFormat, JRChartPlot plot) { if (axisFormat.getOwnTimeAxisLineColor() != null) return axisFormat.getOwnTimeAxisLineColor(); return getForecolor(plot); } }