first commit

This commit is contained in:
2025-07-28 13:56:49 +05:30
commit e9eb805edb
3438 changed files with 520990 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
package net.sf.jasperreports.engine.base;
import net.sf.jasperreports.engine.JRBand;
import net.sf.jasperreports.engine.JRElementGroup;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.design.events.JRChangeEventsSupport;
import net.sf.jasperreports.engine.design.events.JRPropertyChangeSupport;
public class JRBaseBand extends JRBaseElementGroup implements JRBand, JRChangeEventsSupport {
private static final long serialVersionUID = 10200L;
public static final String PROPERTY_SPLIT_ALLOWED = "splitAllowed";
protected int height = 0;
protected boolean isSplitAllowed = true;
protected JRExpression printWhenExpression = null;
private transient JRPropertyChangeSupport eventSupport;
protected JRBaseBand(JRBand band, JRBaseObjectFactory factory) {
super((JRElementGroup)band, factory);
this.height = band.getHeight();
this.isSplitAllowed = band.isSplitAllowed();
this.printWhenExpression = factory.getExpression(band.getPrintWhenExpression());
}
public int getHeight() {
return this.height;
}
public boolean isSplitAllowed() {
return this.isSplitAllowed;
}
public void setSplitAllowed(boolean isSplitAllowed) {
boolean old = this.isSplitAllowed;
this.isSplitAllowed = isSplitAllowed;
getEventSupport().firePropertyChange("splitAllowed", old, this.isSplitAllowed);
}
public JRExpression getPrintWhenExpression() {
return this.printWhenExpression;
}
public Object clone() {
JRBaseBand clone = (JRBaseBand)super.clone();
if (this.printWhenExpression != null)
clone.printWhenExpression = (JRExpression)this.printWhenExpression.clone();
return clone;
}
public JRPropertyChangeSupport getEventSupport() {
synchronized (this) {
if (this.eventSupport == null)
this.eventSupport = new JRPropertyChangeSupport(this);
}
return this.eventSupport;
}
}

View File

@@ -0,0 +1,16 @@
package net.sf.jasperreports.engine.base;
import net.sf.jasperreports.engine.JRLineBox;
import net.sf.jasperreports.engine.JRPen;
public class JRBaseBoxBottomPen extends JRBaseBoxPen {
private static final long serialVersionUID = 10200L;
public JRBaseBoxBottomPen(JRLineBox box) {
super(box);
}
public JRPen getPen(JRLineBox box) {
return box.getBottomPen();
}
}

View File

@@ -0,0 +1,16 @@
package net.sf.jasperreports.engine.base;
import net.sf.jasperreports.engine.JRLineBox;
import net.sf.jasperreports.engine.JRPen;
public class JRBaseBoxLeftPen extends JRBaseBoxPen {
private static final long serialVersionUID = 10200L;
public JRBaseBoxLeftPen(JRLineBox box) {
super(box);
}
public JRPen getPen(JRLineBox box) {
return box.getLeftPen();
}
}

View File

@@ -0,0 +1,44 @@
package net.sf.jasperreports.engine.base;
import java.awt.Color;
import net.sf.jasperreports.engine.JRLineBox;
import net.sf.jasperreports.engine.JRPen;
import net.sf.jasperreports.engine.JRPenContainer;
import net.sf.jasperreports.engine.util.JRStyleResolver;
public class JRBaseBoxPen extends JRBasePen implements JRBoxPen {
private static final long serialVersionUID = 10200L;
protected JRLineBox lineBox = null;
public JRBaseBoxPen(JRLineBox box) {
super((JRPenContainer)box);
this.lineBox = box;
}
public JRLineBox getBox() {
return this.lineBox;
}
public Float getLineWidth() {
return JRStyleResolver.getLineWidth(this, this.penContainer.getDefaultLineWidth());
}
public Byte getLineStyle() {
return JRStyleResolver.getLineStyle(this);
}
public Color getLineColor() {
return JRStyleResolver.getLineColor(this, this.penContainer.getDefaultLineColor());
}
public JRPen getPen(JRLineBox box) {
return box.getPen();
}
public JRBoxPen clone(JRLineBox lineBox) {
JRBaseBoxPen clone = (JRBaseBoxPen)clone((JRPenContainer)lineBox);
clone.lineBox = lineBox;
return clone;
}
}

View File

@@ -0,0 +1,16 @@
package net.sf.jasperreports.engine.base;
import net.sf.jasperreports.engine.JRLineBox;
import net.sf.jasperreports.engine.JRPen;
public class JRBaseBoxRightPen extends JRBaseBoxPen {
private static final long serialVersionUID = 10200L;
public JRBaseBoxRightPen(JRLineBox box) {
super(box);
}
public JRPen getPen(JRLineBox box) {
return box.getRightPen();
}
}

View File

@@ -0,0 +1,16 @@
package net.sf.jasperreports.engine.base;
import net.sf.jasperreports.engine.JRLineBox;
import net.sf.jasperreports.engine.JRPen;
public class JRBaseBoxTopPen extends JRBaseBoxPen {
private static final long serialVersionUID = 10200L;
public JRBaseBoxTopPen(JRLineBox box) {
super(box);
}
public JRPen getPen(JRLineBox box) {
return box.getTopPen();
}
}

View File

@@ -0,0 +1,45 @@
package net.sf.jasperreports.engine.base;
import net.sf.jasperreports.engine.JRBreak;
import net.sf.jasperreports.engine.JRElement;
import net.sf.jasperreports.engine.JRExpressionCollector;
import net.sf.jasperreports.engine.JRVisitor;
public class JRBaseBreak extends JRBaseElement implements JRBreak {
private static final long serialVersionUID = 10200L;
public static final String PROPERTY_TYPE = "type";
protected byte type = 1;
protected JRBaseBreak(JRBreak breakElement, JRBaseObjectFactory factory) {
super((JRElement)breakElement, factory);
this.type = breakElement.getType();
}
public int getX() {
return 0;
}
public int getHeight() {
return 1;
}
public byte getType() {
return this.type;
}
public void setType(byte type) {
byte old = this.type;
this.type = type;
getEventSupport().firePropertyChange("type", old, this.type);
}
public void collectExpressions(JRExpressionCollector collector) {
collector.collect(this);
}
public void visit(JRVisitor visitor) {
visitor.visitBreak(this);
}
}

View File

@@ -0,0 +1,781 @@
package net.sf.jasperreports.engine.base;
import java.awt.Color;
import java.io.IOException;
import java.io.ObjectInputStream;
import net.sf.jasperreports.charts.JRAreaPlot;
import net.sf.jasperreports.charts.JRBar3DPlot;
import net.sf.jasperreports.charts.JRBarPlot;
import net.sf.jasperreports.charts.JRBubblePlot;
import net.sf.jasperreports.charts.JRCandlestickPlot;
import net.sf.jasperreports.charts.JRCategoryDataset;
import net.sf.jasperreports.charts.JRHighLowDataset;
import net.sf.jasperreports.charts.JRHighLowPlot;
import net.sf.jasperreports.charts.JRLinePlot;
import net.sf.jasperreports.charts.JRMeterPlot;
import net.sf.jasperreports.charts.JRMultiAxisPlot;
import net.sf.jasperreports.charts.JRPie3DPlot;
import net.sf.jasperreports.charts.JRPieDataset;
import net.sf.jasperreports.charts.JRPiePlot;
import net.sf.jasperreports.charts.JRScatterPlot;
import net.sf.jasperreports.charts.JRThermometerPlot;
import net.sf.jasperreports.charts.JRTimePeriodDataset;
import net.sf.jasperreports.charts.JRTimeSeriesDataset;
import net.sf.jasperreports.charts.JRTimeSeriesPlot;
import net.sf.jasperreports.charts.JRValueDataset;
import net.sf.jasperreports.charts.JRXyDataset;
import net.sf.jasperreports.charts.JRXyzDataset;
import net.sf.jasperreports.engine.JRBox;
import net.sf.jasperreports.engine.JRBoxContainer;
import net.sf.jasperreports.engine.JRChart;
import net.sf.jasperreports.engine.JRChartDataset;
import net.sf.jasperreports.engine.JRChartPlot;
import net.sf.jasperreports.engine.JRCommonElement;
import net.sf.jasperreports.engine.JRElement;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.JRExpressionCollector;
import net.sf.jasperreports.engine.JRFont;
import net.sf.jasperreports.engine.JRGroup;
import net.sf.jasperreports.engine.JRHyperlink;
import net.sf.jasperreports.engine.JRHyperlinkHelper;
import net.sf.jasperreports.engine.JRHyperlinkParameter;
import net.sf.jasperreports.engine.JRLineBox;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.JRStyleContainer;
import net.sf.jasperreports.engine.JRVisitor;
import net.sf.jasperreports.engine.util.JRBoxUtil;
import net.sf.jasperreports.engine.util.JRPenUtil;
import net.sf.jasperreports.engine.util.JRStyleResolver;
import net.sf.jasperreports.engine.util.LineBoxWrapper;
public class JRBaseChart extends JRBaseElement implements JRChart {
private static final long serialVersionUID = 10200L;
public static final String PROPERTY_LEGEND_BACKGROUND_COLOR = "legendBackgroundColor";
public static final String PROPERTY_LEGEND_COLOR = "legendColor";
public static final String PROPERTY_LEGEND_POSITION = "legendPosition";
public static final String PROPERTY_SHOW_LEGEND = "showLegend";
public static final String PROPERTY_SUBTITLE_COLOR = "subtitleColor";
public static final String PROPERTY_TITLE_COLOR = "titleColor";
public static final String PROPERTY_TITLE_POSITION = "titlePosition";
public static final String PROPERTY_RENDER_TYPE = "renderType";
protected byte chartType = 0;
protected boolean isShowLegend = false;
protected byte evaluationTime = 1;
protected byte hyperlinkType = 0;
protected String linkType;
protected byte hyperlinkTarget = 1;
private JRHyperlinkParameter[] hyperlinkParameters;
protected byte titlePosition = 1;
protected Color titleColor = null;
protected Color subtitleColor = null;
protected Color legendColor = null;
protected Color legendBackgroundColor = null;
protected byte legendPosition = 2;
protected String renderType;
protected JRLineBox lineBox = null;
protected JRFont titleFont = null;
protected JRFont subtitleFont = null;
protected JRFont legendFont = null;
protected String customizerClass;
protected JRGroup evaluationGroup = null;
protected JRExpression titleExpression = null;
protected JRExpression subtitleExpression = null;
protected JRExpression anchorNameExpression = null;
protected JRExpression hyperlinkReferenceExpression = null;
protected JRExpression hyperlinkAnchorExpression = null;
protected JRExpression hyperlinkPageExpression = null;
private JRExpression hyperlinkTooltipExpression;
protected JRChartDataset dataset = null;
protected JRChartPlot plot = null;
protected int bookmarkLevel = 0;
private Byte border;
private Byte topBorder;
private Byte leftBorder;
private Byte bottomBorder;
private Byte rightBorder;
private Color borderColor;
private Color topBorderColor;
private Color leftBorderColor;
private Color bottomBorderColor;
private Color rightBorderColor;
private Integer padding;
private Integer topPadding;
private Integer leftPadding;
private Integer bottomPadding;
private Integer rightPadding;
protected JRBaseChart(JRChart chart, JRBaseObjectFactory factory) {
super((JRElement)chart, factory);
this.border = null;
this.topBorder = null;
this.leftBorder = null;
this.bottomBorder = null;
this.rightBorder = null;
this.borderColor = null;
this.topBorderColor = null;
this.leftBorderColor = null;
this.bottomBorderColor = null;
this.rightBorderColor = null;
this.padding = null;
this.topPadding = null;
this.leftPadding = null;
this.bottomPadding = null;
this.rightPadding = null;
this.chartType = chart.getChartType();
switch (this.chartType) {
case 1:
this.dataset = (JRChartDataset)factory.getCategoryDataset((JRCategoryDataset)chart.getDataset());
this.plot = (JRChartPlot)factory.getAreaPlot((JRAreaPlot)chart.getPlot());
break;
case 3:
this.dataset = (JRChartDataset)factory.getCategoryDataset((JRCategoryDataset)chart.getDataset());
this.plot = (JRChartPlot)factory.getBarPlot((JRBarPlot)chart.getPlot());
break;
case 2:
this.dataset = (JRChartDataset)factory.getCategoryDataset((JRCategoryDataset)chart.getDataset());
this.plot = (JRChartPlot)factory.getBar3DPlot((JRBar3DPlot)chart.getPlot());
break;
case 4:
this.dataset = (JRChartDataset)factory.getXyzDataset((JRXyzDataset)chart.getDataset());
this.plot = (JRChartPlot)factory.getBubblePlot((JRBubblePlot)chart.getPlot());
break;
case 5:
this.dataset = (JRChartDataset)factory.getHighLowDataset((JRHighLowDataset)chart.getDataset());
this.plot = (JRChartPlot)factory.getCandlestickPlot((JRCandlestickPlot)chart.getPlot());
break;
case 6:
this.dataset = (JRChartDataset)factory.getHighLowDataset((JRHighLowDataset)chart.getDataset());
this.plot = (JRChartPlot)factory.getHighLowPlot((JRHighLowPlot)chart.getPlot());
break;
case 7:
this.dataset = (JRChartDataset)factory.getCategoryDataset((JRCategoryDataset)chart.getDataset());
this.plot = (JRChartPlot)factory.getLinePlot((JRLinePlot)chart.getPlot());
break;
case 17:
this.dataset = (JRChartDataset)factory.getValueDataset((JRValueDataset)chart.getDataset());
this.plot = (JRChartPlot)factory.getMeterPlot((JRMeterPlot)chart.getPlot());
break;
case 19:
this.dataset = null;
this.plot = (JRChartPlot)factory.getMultiAxisPlot((JRMultiAxisPlot)chart.getPlot());
break;
case 9:
this.dataset = (JRChartDataset)factory.getPieDataset((JRPieDataset)chart.getDataset());
this.plot = (JRChartPlot)factory.getPiePlot((JRPiePlot)chart.getPlot());
break;
case 8:
this.dataset = (JRChartDataset)factory.getPieDataset((JRPieDataset)chart.getDataset());
this.plot = (JRChartPlot)factory.getPie3DPlot((JRPie3DPlot)chart.getPlot());
break;
case 10:
this.dataset = (JRChartDataset)factory.getXyDataset((JRXyDataset)chart.getDataset());
this.plot = (JRChartPlot)factory.getScatterPlot((JRScatterPlot)chart.getPlot());
break;
case 12:
this.dataset = (JRChartDataset)factory.getCategoryDataset((JRCategoryDataset)chart.getDataset());
this.plot = (JRChartPlot)factory.getBarPlot((JRBarPlot)chart.getPlot());
break;
case 11:
this.dataset = (JRChartDataset)factory.getCategoryDataset((JRCategoryDataset)chart.getDataset());
this.plot = (JRChartPlot)factory.getBar3DPlot((JRBar3DPlot)chart.getPlot());
break;
case 18:
this.dataset = (JRChartDataset)factory.getValueDataset((JRValueDataset)chart.getDataset());
this.plot = (JRChartPlot)factory.getThermometerPlot((JRThermometerPlot)chart.getPlot());
break;
case 16:
this.dataset = (JRChartDataset)factory.getTimeSeriesDataset((JRTimeSeriesDataset)chart.getDataset());
this.plot = (JRChartPlot)factory.getTimeSeriesPlot((JRTimeSeriesPlot)chart.getPlot());
break;
case 13:
this.dataset = (JRChartDataset)factory.getXyDataset((JRXyDataset)chart.getDataset());
this.plot = (JRChartPlot)factory.getAreaPlot((JRAreaPlot)chart.getPlot());
break;
case 14:
switch (chart.getDataset().getDatasetType()) {
case 6:
this.dataset = (JRChartDataset)factory.getTimeSeriesDataset((JRTimeSeriesDataset)chart.getDataset());
break;
case 5:
this.dataset = (JRChartDataset)factory.getTimePeriodDataset((JRTimePeriodDataset)chart.getDataset());
break;
case 3:
this.dataset = (JRChartDataset)factory.getXyDataset((JRXyDataset)chart.getDataset());
break;
}
this.plot = (JRChartPlot)factory.getBarPlot((JRBarPlot)chart.getPlot());
break;
case 15:
this.dataset = (JRChartDataset)factory.getXyDataset((JRXyDataset)chart.getDataset());
this.plot = (JRChartPlot)factory.getLinePlot((JRLinePlot)chart.getPlot());
break;
case 20:
this.dataset = (JRChartDataset)factory.getCategoryDataset((JRCategoryDataset)chart.getDataset());
this.plot = (JRChartPlot)factory.getAreaPlot((JRAreaPlot)chart.getPlot());
break;
default:
throw new JRRuntimeException("Chart type not supported.");
}
this.isShowLegend = chart.isShowLegend();
this.evaluationTime = chart.getEvaluationTime();
this.linkType = chart.getLinkType();
this.hyperlinkTarget = chart.getHyperlinkTarget();
this.titlePosition = chart.getTitlePosition();
this.titleColor = chart.getOwnTitleColor();
this.subtitleColor = chart.getOwnSubtitleColor();
this.legendColor = chart.getOwnLegendColor();
this.legendBackgroundColor = chart.getOwnLegendBackgroundColor();
this.legendPosition = chart.getLegendPosition();
this.renderType = chart.getRenderType();
this.titleFont = new JRBaseFont(null, null, (JRStyleContainer)this, chart.getTitleFont());
this.subtitleFont = new JRBaseFont(null, null, (JRStyleContainer)this, chart.getSubtitleFont());
this.legendFont = new JRBaseFont(null, null, (JRStyleContainer)this, chart.getLegendFont());
this.evaluationGroup = factory.getGroup(chart.getEvaluationGroup());
this.titleExpression = factory.getExpression(chart.getTitleExpression());
this.subtitleExpression = factory.getExpression(chart.getSubtitleExpression());
this.anchorNameExpression = factory.getExpression(chart.getAnchorNameExpression());
this.hyperlinkReferenceExpression = factory.getExpression(chart.getHyperlinkReferenceExpression());
this.hyperlinkAnchorExpression = factory.getExpression(chart.getHyperlinkAnchorExpression());
this.hyperlinkPageExpression = factory.getExpression(chart.getHyperlinkPageExpression());
this.hyperlinkTooltipExpression = factory.getExpression(chart.getHyperlinkTooltipExpression());
this.bookmarkLevel = chart.getBookmarkLevel();
this.hyperlinkParameters = JRBaseHyperlink.copyHyperlinkParameters((JRHyperlink)chart, factory);
this.customizerClass = chart.getCustomizerClass();
this.lineBox = chart.getLineBox().clone((JRBoxContainer)this);
}
public boolean isShowLegend() {
return this.isShowLegend;
}
public void setShowLegend(boolean isShowLegend) {
boolean old = this.isShowLegend;
this.isShowLegend = isShowLegend;
getEventSupport().firePropertyChange("showLegend", old, this.isShowLegend);
}
public byte getEvaluationTime() {
return this.evaluationTime;
}
public JRGroup getEvaluationGroup() {
return this.evaluationGroup;
}
public JRBox getBox() {
return (JRBox)new LineBoxWrapper(getLineBox());
}
public JRLineBox getLineBox() {
return this.lineBox;
}
public JRFont getTitleFont() {
return this.titleFont;
}
public byte getTitlePosition() {
return this.titlePosition;
}
public void setTitlePosition(byte titlePosition) {
byte old = this.titlePosition;
this.titlePosition = titlePosition;
getEventSupport().firePropertyChange("titlePosition", old, this.titlePosition);
}
public Color getTitleColor() {
return JRStyleResolver.getTitleColor(this);
}
public Color getOwnTitleColor() {
return this.titleColor;
}
public void setTitleColor(Color titleColor) {
Object old = this.titleColor;
this.titleColor = titleColor;
getEventSupport().firePropertyChange("titleColor", old, this.titleColor);
}
public JRFont getSubtitleFont() {
return this.subtitleFont;
}
public Color getOwnSubtitleColor() {
return this.subtitleColor;
}
public Color getSubtitleColor() {
return JRStyleResolver.getSubtitleColor(this);
}
public void setSubtitleColor(Color subtitleColor) {
Object old = this.subtitleColor;
this.subtitleColor = subtitleColor;
getEventSupport().firePropertyChange("subtitleColor", old, this.subtitleColor);
}
public Color getLegendBackgroundColor() {
return JRStyleResolver.getLegendBackgroundColor(this);
}
public Color getOwnLegendBackgroundColor() {
return this.legendBackgroundColor;
}
public Color getOwnLegendColor() {
return this.legendColor;
}
public Color getLegendColor() {
return JRStyleResolver.getLegendColor(this);
}
public JRFont getLegendFont() {
return this.legendFont;
}
public void setLegendBackgroundColor(Color legendBackgroundColor) {
Object old = this.legendBackgroundColor;
this.legendBackgroundColor = legendBackgroundColor;
getEventSupport().firePropertyChange("legendBackgroundColor", old, this.legendBackgroundColor);
}
public void setLegendColor(Color legendColor) {
Object old = this.legendColor;
this.legendColor = legendColor;
getEventSupport().firePropertyChange("legendColor", old, this.legendColor);
}
public byte getLegendPosition() {
return this.legendPosition;
}
public void setLegendPosition(byte legendPosition) {
byte old = this.legendPosition;
this.legendPosition = legendPosition;
getEventSupport().firePropertyChange("legendPosition", old, this.legendPosition);
}
public byte getHyperlinkType() {
return JRHyperlinkHelper.getHyperlinkType((JRHyperlink)this);
}
public byte getHyperlinkTarget() {
return this.hyperlinkTarget;
}
public JRExpression getTitleExpression() {
return this.titleExpression;
}
public JRExpression getSubtitleExpression() {
return this.subtitleExpression;
}
public JRExpression getAnchorNameExpression() {
return this.anchorNameExpression;
}
public JRExpression getHyperlinkReferenceExpression() {
return this.hyperlinkReferenceExpression;
}
public JRExpression getHyperlinkAnchorExpression() {
return this.hyperlinkAnchorExpression;
}
public JRExpression getHyperlinkPageExpression() {
return this.hyperlinkPageExpression;
}
public JRChartDataset getDataset() {
return this.dataset;
}
public JRChartPlot getPlot() {
return this.plot;
}
public byte getChartType() {
return this.chartType;
}
public String getRenderType() {
return this.renderType;
}
public void setRenderType(String renderType) {
String old = this.renderType;
this.renderType = renderType;
getEventSupport().firePropertyChange("renderType", old, this.renderType);
}
public void collectExpressions(JRExpressionCollector collector) {
collector.collect(this);
}
public void visit(JRVisitor visitor) {
visitor.visitChart(this);
}
public int getBookmarkLevel() {
return this.bookmarkLevel;
}
public String getCustomizerClass() {
return this.customizerClass;
}
public byte getMode() {
return JRStyleResolver.getMode((JRCommonElement)this, (byte)2);
}
public byte getBorder() {
return JRPenUtil.getPenFromLinePen(this.lineBox.getPen());
}
public Byte getOwnBorder() {
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getPen());
}
public void setBorder(byte border) {
JRPenUtil.setLinePenFromPen(border, this.lineBox.getPen());
}
public void setBorder(Byte border) {
JRPenUtil.setLinePenFromPen(border, this.lineBox.getPen());
}
public Color getBorderColor() {
return this.lineBox.getPen().getLineColor();
}
public Color getOwnBorderColor() {
return this.lineBox.getPen().getOwnLineColor();
}
public void setBorderColor(Color borderColor) {
this.lineBox.getPen().setLineColor(borderColor);
}
public int getPadding() {
return this.lineBox.getPadding().intValue();
}
public Integer getOwnPadding() {
return this.lineBox.getOwnPadding();
}
public void setPadding(int padding) {
this.lineBox.setPadding(padding);
}
public void setPadding(Integer padding) {
this.lineBox.setPadding(padding);
}
public byte getTopBorder() {
return JRPenUtil.getPenFromLinePen(this.lineBox.getTopPen());
}
public Byte getOwnTopBorder() {
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getTopPen());
}
public void setTopBorder(byte topBorder) {
JRPenUtil.setLinePenFromPen(topBorder, this.lineBox.getTopPen());
}
public void setTopBorder(Byte topBorder) {
JRPenUtil.setLinePenFromPen(topBorder, this.lineBox.getTopPen());
}
public Color getTopBorderColor() {
return this.lineBox.getTopPen().getLineColor();
}
public Color getOwnTopBorderColor() {
return this.lineBox.getTopPen().getOwnLineColor();
}
public void setTopBorderColor(Color topBorderColor) {
this.lineBox.getTopPen().setLineColor(topBorderColor);
}
public int getTopPadding() {
return this.lineBox.getTopPadding().intValue();
}
public Integer getOwnTopPadding() {
return this.lineBox.getOwnTopPadding();
}
public void setTopPadding(int topPadding) {
this.lineBox.setTopPadding(topPadding);
}
public void setTopPadding(Integer topPadding) {
this.lineBox.setTopPadding(topPadding);
}
public byte getLeftBorder() {
return JRPenUtil.getPenFromLinePen(this.lineBox.getLeftPen());
}
public Byte getOwnLeftBorder() {
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getLeftPen());
}
public void setLeftBorder(byte leftBorder) {
JRPenUtil.setLinePenFromPen(leftBorder, this.lineBox.getLeftPen());
}
public void setLeftBorder(Byte leftBorder) {
JRPenUtil.setLinePenFromPen(leftBorder, this.lineBox.getLeftPen());
}
public Color getLeftBorderColor() {
return this.lineBox.getLeftPen().getLineColor();
}
public Color getOwnLeftBorderColor() {
return this.lineBox.getLeftPen().getOwnLineColor();
}
public void setLeftBorderColor(Color leftBorderColor) {
this.lineBox.getLeftPen().setLineColor(leftBorderColor);
}
public int getLeftPadding() {
return this.lineBox.getLeftPadding().intValue();
}
public Integer getOwnLeftPadding() {
return this.lineBox.getOwnLeftPadding();
}
public void setLeftPadding(int leftPadding) {
this.lineBox.setLeftPadding(leftPadding);
}
public void setLeftPadding(Integer leftPadding) {
this.lineBox.setLeftPadding(leftPadding);
}
public byte getBottomBorder() {
return JRPenUtil.getPenFromLinePen(this.lineBox.getBottomPen());
}
public Byte getOwnBottomBorder() {
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getBottomPen());
}
public void setBottomBorder(byte bottomBorder) {
JRPenUtil.setLinePenFromPen(bottomBorder, this.lineBox.getBottomPen());
}
public void setBottomBorder(Byte bottomBorder) {
JRPenUtil.setLinePenFromPen(bottomBorder, this.lineBox.getBottomPen());
}
public Color getBottomBorderColor() {
return this.lineBox.getBottomPen().getLineColor();
}
public Color getOwnBottomBorderColor() {
return this.lineBox.getBottomPen().getOwnLineColor();
}
public void setBottomBorderColor(Color bottomBorderColor) {
this.lineBox.getBottomPen().setLineColor(bottomBorderColor);
}
public int getBottomPadding() {
return this.lineBox.getBottomPadding().intValue();
}
public Integer getOwnBottomPadding() {
return this.lineBox.getOwnBottomPadding();
}
public void setBottomPadding(int bottomPadding) {
this.lineBox.setBottomPadding(bottomPadding);
}
public void setBottomPadding(Integer bottomPadding) {
this.lineBox.setBottomPadding(bottomPadding);
}
public byte getRightBorder() {
return JRPenUtil.getPenFromLinePen(this.lineBox.getRightPen());
}
public Byte getOwnRightBorder() {
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getRightPen());
}
public void setRightBorder(byte rightBorder) {
JRPenUtil.setLinePenFromPen(rightBorder, this.lineBox.getRightPen());
}
public void setRightBorder(Byte rightBorder) {
JRPenUtil.setLinePenFromPen(rightBorder, this.lineBox.getRightPen());
}
public Color getRightBorderColor() {
return this.lineBox.getRightPen().getLineColor();
}
public Color getOwnRightBorderColor() {
return this.lineBox.getRightPen().getOwnLineColor();
}
public void setRightBorderColor(Color rightBorderColor) {
this.lineBox.getRightPen().setLineColor(rightBorderColor);
}
public int getRightPadding() {
return this.lineBox.getRightPadding().intValue();
}
public Integer getOwnRightPadding() {
return this.lineBox.getOwnRightPadding();
}
public void setRightPadding(int rightPadding) {
this.lineBox.setRightPadding(rightPadding);
}
public void setRightPadding(Integer rightPadding) {
this.lineBox.setRightPadding(rightPadding);
}
public String getLinkType() {
return this.linkType;
}
public JRHyperlinkParameter[] getHyperlinkParameters() {
return this.hyperlinkParameters;
}
protected void normalizeLinkType() {
if (this.linkType == null)
this.linkType = JRHyperlinkHelper.getLinkType(this.hyperlinkType);
this.hyperlinkType = 0;
}
public JRExpression getHyperlinkTooltipExpression() {
return this.hyperlinkTooltipExpression;
}
public Color getDefaultLineColor() {
return getForecolor();
}
public Object clone() {
JRBaseChart clone = (JRBaseChart)super.clone();
if (this.hyperlinkParameters != null) {
clone.hyperlinkParameters = new JRHyperlinkParameter[this.hyperlinkParameters.length];
for (int i = 0; i < this.hyperlinkParameters.length; i++)
clone.hyperlinkParameters[i] = (JRHyperlinkParameter)this.hyperlinkParameters[i].clone();
}
if (this.titleExpression != null)
clone.titleExpression = (JRExpression)this.titleExpression.clone();
if (this.subtitleExpression != null)
clone.subtitleExpression = (JRExpression)this.subtitleExpression.clone();
if (this.anchorNameExpression != null)
clone.anchorNameExpression = (JRExpression)this.anchorNameExpression.clone();
if (this.hyperlinkReferenceExpression != null)
clone.hyperlinkReferenceExpression = (JRExpression)this.hyperlinkReferenceExpression.clone();
if (this.hyperlinkAnchorExpression != null)
clone.hyperlinkAnchorExpression = (JRExpression)this.hyperlinkAnchorExpression.clone();
if (this.hyperlinkPageExpression != null)
clone.hyperlinkPageExpression = (JRExpression)this.hyperlinkPageExpression.clone();
if (this.hyperlinkTooltipExpression != null)
clone.hyperlinkTooltipExpression = (JRExpression)this.hyperlinkTooltipExpression.clone();
if (this.dataset != null)
clone.dataset = (JRChartDataset)this.dataset.clone();
if (this.plot != null)
clone.plot = (JRChartPlot)this.plot.clone(clone);
return clone;
}
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
if (this.lineBox == null) {
this.lineBox = new JRBaseLineBox((JRBoxContainer)this);
JRBoxUtil.setToBox(this.border, this.topBorder, this.leftBorder, this.bottomBorder, this.rightBorder, this.borderColor, this.topBorderColor, this.leftBorderColor, this.bottomBorderColor, this.rightBorderColor, this.padding, this.topPadding, this.leftPadding, this.bottomPadding, this.rightPadding, this.lineBox);
this.border = null;
this.topBorder = null;
this.leftBorder = null;
this.bottomBorder = null;
this.rightBorder = null;
this.borderColor = null;
this.topBorderColor = null;
this.leftBorderColor = null;
this.bottomBorderColor = null;
this.rightBorderColor = null;
this.padding = null;
this.topPadding = null;
this.leftPadding = null;
this.bottomPadding = null;
this.rightPadding = null;
}
normalizeLinkType();
}
}

View File

@@ -0,0 +1,18 @@
package net.sf.jasperreports.engine.base;
import net.sf.jasperreports.engine.JRChartDataset;
import net.sf.jasperreports.engine.JRElementDataset;
public abstract class JRBaseChartDataset extends JRBaseElementDataset implements JRChartDataset {
private static final long serialVersionUID = 10200L;
protected JRBaseChartDataset() {}
protected JRBaseChartDataset(JRChartDataset dataset) {
super((JRElementDataset)dataset);
}
protected JRBaseChartDataset(JRChartDataset dataset, JRBaseObjectFactory factory) {
super((JRElementDataset)dataset, factory);
}
}

View File

@@ -0,0 +1,211 @@
package net.sf.jasperreports.engine.base;
import java.awt.Color;
import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;
import java.util.SortedSet;
import java.util.TreeSet;
import net.sf.jasperreports.engine.JRChart;
import net.sf.jasperreports.engine.JRChartPlot;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.JRVisitable;
import net.sf.jasperreports.engine.design.events.JRChangeEventsSupport;
import net.sf.jasperreports.engine.design.events.JRPropertyChangeSupport;
import net.sf.jasperreports.engine.util.JRStyleResolver;
import org.jfree.chart.plot.PlotOrientation;
public abstract class JRBaseChartPlot implements JRChartPlot, Serializable, JRChangeEventsSupport {
private static final long serialVersionUID = 10200L;
public static final String PROPERTY_BACKCOLOR = "backcolor";
public static final String PROPERTY_BACKGROUND_ALPHA = "backgroundAlpha";
public static final String PROPERTY_FOREGROUND_ALPHA = "foregroundAlpha";
public static final String PROPERTY_LABEL_ROTATION = "labelRotation";
public static final String PROPERTY_ORIENTATION = "orientation";
public static final String PROPERTY_SERIES_COLORS = "seriesColors";
protected JRChart chart = null;
protected Color backcolor = null;
protected PlotOrientation orientation = PlotOrientation.VERTICAL;
protected float backgroundAlpha = 1.0F;
protected float foregroundAlpha = 1.0F;
protected double labelRotation = 0.0D;
protected SortedSet seriesColors = null;
private transient JRPropertyChangeSupport eventSupport;
protected JRBaseChartPlot(JRChartPlot plot, JRChart chart) {
this.chart = chart;
if (plot != null) {
this.backcolor = plot.getOwnBackcolor();
this.orientation = plot.getOrientation();
this.backgroundAlpha = plot.getBackgroundAlpha();
this.foregroundAlpha = plot.getForegroundAlpha();
this.labelRotation = plot.getLabelRotation();
this.seriesColors = new TreeSet(plot.getSeriesColors());
} else {
this.seriesColors = new TreeSet();
}
}
protected JRBaseChartPlot(JRChartPlot plot, JRBaseObjectFactory factory) {
factory.put(plot, this);
this.chart = (JRChart)factory.getVisitResult((JRVisitable)plot.getChart());
this.backcolor = plot.getOwnBackcolor();
this.orientation = plot.getOrientation();
this.backgroundAlpha = plot.getBackgroundAlpha();
this.foregroundAlpha = plot.getForegroundAlpha();
this.labelRotation = plot.getLabelRotation();
this.seriesColors = new TreeSet(plot.getSeriesColors());
}
public JRChart getChart() {
return this.chart;
}
public Color getBackcolor() {
return JRStyleResolver.getBackcolor(this);
}
public Color getOwnBackcolor() {
return this.backcolor;
}
public void setBackcolor(Color backcolor) {
Object old = this.backcolor;
this.backcolor = backcolor;
getEventSupport().firePropertyChange("backcolor", old, this.backcolor);
}
public PlotOrientation getOrientation() {
return this.orientation;
}
public void setOrientation(PlotOrientation orientation) {
Object old = this.orientation;
this.orientation = orientation;
getEventSupport().firePropertyChange("orientation", old, this.orientation);
}
public float getBackgroundAlpha() {
return this.backgroundAlpha;
}
public void setBackgroundAlpha(float backgroundAlpha) {
float old = this.backgroundAlpha;
this.backgroundAlpha = backgroundAlpha;
getEventSupport().firePropertyChange("backgroundAlpha", old, this.backgroundAlpha);
}
public float getForegroundAlpha() {
return this.foregroundAlpha;
}
public void setForegroundAlpha(float foregroundAlpha) {
float old = this.foregroundAlpha;
this.foregroundAlpha = foregroundAlpha;
getEventSupport().firePropertyChange("foregroundAlpha", old, this.foregroundAlpha);
}
public double getLabelRotation() {
return this.labelRotation;
}
public void setLabelRotation(double labelRotation) {
double old = this.labelRotation;
this.labelRotation = labelRotation;
getEventSupport().firePropertyChange("labelRotation", old, this.labelRotation);
}
public SortedSet getSeriesColors() {
return this.seriesColors;
}
public void clearSeriesColors() {
setSeriesColors(null);
}
public void addSeriesColor(JRChartPlot.JRSeriesColor seriesColor) {
this.seriesColors.add(seriesColor);
getEventSupport().fireCollectionElementAddedEvent("seriesColors", seriesColor, this.seriesColors.size() - 1);
}
public void setSeriesColors(Collection colors) {
Object old = new TreeSet(this.seriesColors);
this.seriesColors.clear();
if (colors != null)
this.seriesColors.addAll(colors);
getEventSupport().firePropertyChange("seriesColors", old, this.seriesColors);
}
public static class JRBaseSeriesColor implements JRChartPlot.JRSeriesColor, Serializable, Comparable {
private static final long serialVersionUID = 10200L;
protected int seriesOrder = -1;
protected Color color = null;
public JRBaseSeriesColor(int seriesOrder, Color color) {
this.seriesOrder = seriesOrder;
this.color = color;
}
public int getSeriesOrder() {
return this.seriesOrder;
}
public Color getColor() {
return this.color;
}
public int compareTo(Object obj) {
if (obj == null)
throw new NullPointerException();
return this.seriesOrder - ((JRBaseSeriesColor)obj).getSeriesOrder();
}
public Object clone() {
try {
return super.clone();
} catch (CloneNotSupportedException e) {
throw new JRRuntimeException(e);
}
}
}
public Object clone(JRChart parentChart) {
JRBaseChartPlot clone = null;
try {
clone = (JRBaseChartPlot)clone();
} catch (CloneNotSupportedException e) {
throw new JRRuntimeException(e);
}
clone.chart = parentChart;
if (this.seriesColors != null) {
clone.seriesColors = new TreeSet();
for (Iterator it = this.seriesColors.iterator(); it.hasNext();)
clone.seriesColors.add(((JRChartPlot.JRSeriesColor)it.next()).clone());
}
return clone;
}
public JRPropertyChangeSupport getEventSupport() {
synchronized (this) {
if (this.eventSupport == null)
this.eventSupport = new JRPropertyChangeSupport(this);
}
return this.eventSupport;
}
}

View File

@@ -0,0 +1,48 @@
package net.sf.jasperreports.engine.base;
import net.sf.jasperreports.engine.JRAbstractObjectFactory;
import net.sf.jasperreports.engine.JRBoxContainer;
import net.sf.jasperreports.engine.JRConditionalStyle;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.JRPenContainer;
import net.sf.jasperreports.engine.JRStyle;
public class JRBaseConditionalStyle extends JRBaseStyle implements JRConditionalStyle {
private static final long serialVersionUID = 10200L;
protected JRExpression conditionExpression = null;
public JRBaseConditionalStyle() {}
public JRBaseConditionalStyle(JRConditionalStyle style, JRStyle parentStyle, JRAbstractObjectFactory factory) {
this.parentStyle = parentStyle;
this.mode = style.getOwnMode();
this.forecolor = style.getOwnForecolor();
this.backcolor = style.getOwnBackcolor();
this.linePen = style.getLinePen().clone((JRPenContainer)this);
this.fill = style.getOwnFill();
this.radius = style.getOwnRadius();
this.scaleImage = style.getOwnScaleImage();
this.horizontalAlignment = style.getOwnHorizontalAlignment();
this.verticalAlignment = style.getOwnVerticalAlignment();
this.lineBox = style.getLineBox().clone((JRBoxContainer)this);
this.rotation = style.getOwnRotation();
this.lineSpacing = style.getOwnLineSpacing();
this.markup = style.getOwnMarkup();
this.pattern = style.getOwnPattern();
this.fontName = style.getOwnFontName();
this.isBold = style.isOwnBold();
this.isItalic = style.isOwnItalic();
this.isUnderline = style.isOwnUnderline();
this.isStrikeThrough = style.isOwnStrikeThrough();
this.fontSize = style.getOwnFontSize();
this.pdfFontName = style.getOwnPdfFontName();
this.pdfEncoding = style.getOwnPdfEncoding();
this.isPdfEmbedded = style.isOwnPdfEmbedded();
this.conditionExpression = factory.getExpression(style.getConditionExpression(), true);
}
public JRExpression getConditionExpression() {
return this.conditionExpression;
}
}

View File

@@ -0,0 +1,212 @@
package net.sf.jasperreports.engine.base;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRDataset;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.JRField;
import net.sf.jasperreports.engine.JRGroup;
import net.sf.jasperreports.engine.JRParameter;
import net.sf.jasperreports.engine.JRPropertiesHolder;
import net.sf.jasperreports.engine.JRPropertiesMap;
import net.sf.jasperreports.engine.JRQuery;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.JRSortField;
import net.sf.jasperreports.engine.JRVariable;
import net.sf.jasperreports.engine.design.events.JRChangeEventsSupport;
import net.sf.jasperreports.engine.design.events.JRPropertyChangeSupport;
public class JRBaseDataset implements JRDataset, Serializable, JRChangeEventsSupport {
private static final long serialVersionUID = 10200L;
public static final String PROPERTY_WHEN_RESOURCE_MISSING_TYPE = "whenResourceMissingType";
protected final boolean isMain;
protected String name = null;
protected String scriptletClass = null;
protected JRParameter[] parameters = null;
protected JRQuery query = null;
protected JRField[] fields = null;
protected JRSortField[] sortFields = null;
protected JRVariable[] variables = null;
protected JRGroup[] groups = null;
protected String resourceBundle = null;
protected byte whenResourceMissingType = 1;
protected JRPropertiesMap propertiesMap;
protected JRExpression filterExpression;
private transient JRPropertyChangeSupport eventSupport;
protected JRBaseDataset(boolean isMain) {
this.isMain = isMain;
this.propertiesMap = new JRPropertiesMap();
}
protected JRBaseDataset(JRDataset dataset, JRBaseObjectFactory factory) {
factory.put(dataset, this);
this.name = dataset.getName();
this.scriptletClass = dataset.getScriptletClass();
this.resourceBundle = dataset.getResourceBundle();
this.whenResourceMissingType = dataset.getWhenResourceMissingType();
this.propertiesMap = dataset.getPropertiesMap().cloneProperties();
this.query = factory.getQuery(dataset.getQuery());
this.isMain = dataset.isMainDataset();
JRParameter[] jrParameters = dataset.getParameters();
if (jrParameters != null && jrParameters.length > 0) {
this.parameters = new JRParameter[jrParameters.length];
for (int i = 0; i < this.parameters.length; i++)
this.parameters[i] = factory.getParameter(jrParameters[i]);
}
JRField[] jrFields = dataset.getFields();
if (jrFields != null && jrFields.length > 0) {
this.fields = new JRField[jrFields.length];
for (int i = 0; i < this.fields.length; i++)
this.fields[i] = factory.getField(jrFields[i]);
}
JRSortField[] jrSortFields = dataset.getSortFields();
if (jrSortFields != null && jrSortFields.length > 0) {
this.sortFields = new JRSortField[jrSortFields.length];
for (int i = 0; i < this.sortFields.length; i++)
this.sortFields[i] = factory.getSortField(jrSortFields[i]);
}
JRVariable[] jrVariables = dataset.getVariables();
if (jrVariables != null && jrVariables.length > 0) {
this.variables = new JRVariable[jrVariables.length];
for (int i = 0; i < this.variables.length; i++)
this.variables[i] = factory.getVariable(jrVariables[i]);
}
JRGroup[] jrGroups = dataset.getGroups();
if (jrGroups != null && jrGroups.length > 0) {
this.groups = new JRGroup[jrGroups.length];
for (int i = 0; i < this.groups.length; i++)
this.groups[i] = factory.getGroup(jrGroups[i]);
}
this.filterExpression = factory.getExpression(dataset.getFilterExpression());
}
public String getName() {
return this.name;
}
public String getScriptletClass() {
return this.scriptletClass;
}
public JRQuery getQuery() {
return this.query;
}
public JRParameter[] getParameters() {
return this.parameters;
}
public JRField[] getFields() {
return this.fields;
}
public JRSortField[] getSortFields() {
return this.sortFields;
}
public JRVariable[] getVariables() {
return this.variables;
}
public JRGroup[] getGroups() {
return this.groups;
}
public boolean isMainDataset() {
return this.isMain;
}
public String getResourceBundle() {
return this.resourceBundle;
}
public byte getWhenResourceMissingType() {
return this.whenResourceMissingType;
}
public void setWhenResourceMissingType(byte whenResourceMissingType) {
byte old = this.whenResourceMissingType;
this.whenResourceMissingType = whenResourceMissingType;
getEventSupport().firePropertyChange("whenResourceMissingType", old, this.whenResourceMissingType);
}
public boolean hasProperties() {
return (this.propertiesMap != null && this.propertiesMap.hasProperties());
}
public JRPropertiesMap getPropertiesMap() {
return this.propertiesMap;
}
public JRPropertiesHolder getParentProperties() {
return null;
}
public JRExpression getFilterExpression() {
return this.filterExpression;
}
public Object clone() {
JRBaseDataset clone = null;
try {
clone = (JRBaseDataset)super.clone();
} catch (CloneNotSupportedException e) {
throw new JRRuntimeException(e);
}
if (this.query != null)
clone.query = (JRQuery)this.query.clone();
if (this.filterExpression != null)
clone.filterExpression = (JRExpression)this.filterExpression.clone();
if (this.propertiesMap != null)
clone.propertiesMap = (JRPropertiesMap)this.propertiesMap.clone();
if (this.parameters != null) {
clone.parameters = new JRParameter[this.parameters.length];
for (int i = 0; i < this.parameters.length; i++)
clone.parameters[i] = (JRParameter)this.parameters[i].clone();
}
if (this.fields != null) {
clone.fields = new JRField[this.fields.length];
for (int i = 0; i < this.fields.length; i++)
clone.fields[i] = (JRField)this.fields[i].clone();
}
if (this.sortFields != null) {
clone.sortFields = new JRSortField[this.sortFields.length];
for (int i = 0; i < this.sortFields.length; i++)
clone.sortFields[i] = (JRSortField)this.sortFields[i].clone();
}
if (this.variables != null) {
clone.variables = new JRVariable[this.variables.length];
for (int i = 0; i < this.variables.length; i++)
clone.variables[i] = (JRVariable)this.variables[i].clone();
}
if (this.groups != null) {
clone.groups = new JRGroup[this.groups.length];
for (int i = 0; i < this.groups.length; i++)
clone.groups[i] = (JRGroup)this.groups[i].clone();
}
return clone;
}
public JRPropertyChangeSupport getEventSupport() {
synchronized (this) {
if (this.eventSupport == null)
this.eventSupport = new JRPropertyChangeSupport(this);
}
return this.eventSupport;
}
}

View File

@@ -0,0 +1,38 @@
package net.sf.jasperreports.engine.base;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRDatasetParameter;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.JRRuntimeException;
public class JRBaseDatasetParameter implements JRDatasetParameter, Serializable {
private static final long serialVersionUID = 10200L;
protected String name = null;
protected JRExpression expression = null;
protected JRBaseDatasetParameter() {}
protected JRBaseDatasetParameter(JRDatasetParameter datasetParameter, JRBaseObjectFactory factory) {
factory.put(datasetParameter, this);
this.name = datasetParameter.getName();
this.expression = factory.getExpression(datasetParameter.getExpression());
}
public String getName() {
return this.name;
}
public JRExpression getExpression() {
return this.expression;
}
public Object clone() {
try {
return super.clone();
} catch (CloneNotSupportedException e) {
throw new JRRuntimeException(e);
}
}
}

View File

@@ -0,0 +1,78 @@
package net.sf.jasperreports.engine.base;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRDatasetParameter;
import net.sf.jasperreports.engine.JRDatasetRun;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.JRRuntimeException;
public class JRBaseDatasetRun implements JRDatasetRun, Serializable {
private static final long serialVersionUID = 10200L;
protected String datasetName;
protected JRExpression parametersMapExpression;
protected JRDatasetParameter[] parameters;
protected JRExpression connectionExpression;
protected JRExpression dataSourceExpression;
protected JRBaseDatasetRun() {}
protected JRBaseDatasetRun(JRDatasetRun datasetRun, JRBaseObjectFactory factory) {
factory.put(datasetRun, this);
this.datasetName = datasetRun.getDatasetName();
this.parametersMapExpression = factory.getExpression(datasetRun.getParametersMapExpression());
this.connectionExpression = factory.getExpression(datasetRun.getConnectionExpression());
this.dataSourceExpression = factory.getExpression(datasetRun.getDataSourceExpression());
JRDatasetParameter[] datasetParams = datasetRun.getParameters();
if (datasetParams != null && datasetParams.length > 0) {
this.parameters = (JRDatasetParameter[])new JRBaseDatasetParameter[datasetParams.length];
for (int i = 0; i < this.parameters.length; i++)
this.parameters[i] = factory.getDatasetParameter(datasetParams[i]);
}
}
public String getDatasetName() {
return this.datasetName;
}
public JRExpression getParametersMapExpression() {
return this.parametersMapExpression;
}
public JRDatasetParameter[] getParameters() {
return this.parameters;
}
public JRExpression getConnectionExpression() {
return this.connectionExpression;
}
public JRExpression getDataSourceExpression() {
return this.dataSourceExpression;
}
public Object clone() {
JRBaseDatasetRun clone = null;
try {
clone = (JRBaseDatasetRun)super.clone();
} catch (CloneNotSupportedException e) {
throw new JRRuntimeException(e);
}
if (this.parametersMapExpression != null)
clone.parametersMapExpression = (JRExpression)this.parametersMapExpression.clone();
if (this.connectionExpression != null)
clone.connectionExpression = (JRExpression)this.connectionExpression.clone();
if (this.dataSourceExpression != null)
clone.dataSourceExpression = (JRExpression)this.dataSourceExpression.clone();
if (this.parameters != null) {
clone.parameters = new JRDatasetParameter[this.parameters.length];
for (int i = 0; i < this.parameters.length; i++)
clone.parameters[i] = (JRDatasetParameter)this.parameters[i].clone();
}
return clone;
}
}

View File

@@ -0,0 +1,338 @@
package net.sf.jasperreports.engine.base;
import java.awt.Color;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRCommonElement;
import net.sf.jasperreports.engine.JRDefaultStyleProvider;
import net.sf.jasperreports.engine.JRElement;
import net.sf.jasperreports.engine.JRElementGroup;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.JRGroup;
import net.sf.jasperreports.engine.JRPropertiesHolder;
import net.sf.jasperreports.engine.JRPropertiesMap;
import net.sf.jasperreports.engine.JRPropertyExpression;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.JRStyle;
import net.sf.jasperreports.engine.JRVisitable;
import net.sf.jasperreports.engine.design.events.JRChangeEventsSupport;
import net.sf.jasperreports.engine.design.events.JRPropertyChangeSupport;
import net.sf.jasperreports.engine.util.JRStyleResolver;
public abstract class JRBaseElement implements JRElement, Serializable, JRChangeEventsSupport {
private static final long serialVersionUID = 10200L;
public static final String PROPERTY_POSITION_TYPE = "positionType";
public static final String PROPERTY_PRINT_IN_FIRST_WHOLE_BAND = "isPrintInFirstWholeBand";
public static final String PROPERTY_PRINT_REPEATED_VALUES = "isPrintRepeatedValues";
public static final String PROPERTY_PRINT_WHEN_DETAIL_OVERFLOWS = "isPrintWhenDetailOverflows";
public static final String PROPERTY_REMOVE_LINE_WHEN_BLANK = "isRemoveLineWhenBlank";
public static final String PROPERTY_STRETCH_TYPE = "stretchType";
public static final String PROPERTY_WIDTH = "width";
public static final String PROPERTY_X = "x";
protected String key = null;
protected byte positionType;
protected byte stretchType;
protected boolean isPrintRepeatedValues = true;
protected Byte mode;
protected int x = 0;
protected int y = 0;
protected int width = 0;
protected int height = 0;
protected boolean isRemoveLineWhenBlank = false;
protected boolean isPrintInFirstWholeBand = false;
protected boolean isPrintWhenDetailOverflows = false;
protected Color forecolor = null;
protected Color backcolor = null;
protected JRExpression printWhenExpression = null;
protected JRGroup printWhenGroupChanges = null;
protected JRElementGroup elementGroup = null;
protected JRDefaultStyleProvider defaultStyleProvider;
protected JRStyle parentStyle;
protected String parentStyleNameReference;
private JRPropertiesMap propertiesMap;
private JRPropertyExpression[] propertyExpressions;
private transient JRPropertyChangeSupport eventSupport;
protected JRBaseElement(JRDefaultStyleProvider defaultStyleProvider) {
this.defaultStyleProvider = defaultStyleProvider;
}
protected JRBaseElement(JRElement element, JRBaseObjectFactory factory) {
factory.put(element, this);
this.defaultStyleProvider = factory.getDefaultStyleProvider();
this.parentStyle = factory.getStyle(element.getStyle());
this.parentStyleNameReference = element.getStyleNameReference();
this.key = element.getKey();
this.positionType = element.getPositionType();
this.stretchType = element.getStretchType();
this.isPrintRepeatedValues = element.isPrintRepeatedValues();
this.mode = element.getOwnMode();
this.x = element.getX();
this.y = element.getY();
this.width = element.getWidth();
this.height = element.getHeight();
this.isRemoveLineWhenBlank = element.isRemoveLineWhenBlank();
this.isPrintInFirstWholeBand = element.isPrintInFirstWholeBand();
this.isPrintWhenDetailOverflows = element.isPrintWhenDetailOverflows();
this.forecolor = element.getOwnForecolor();
this.backcolor = element.getOwnBackcolor();
this.printWhenExpression = factory.getExpression(element.getPrintWhenExpression());
this.printWhenGroupChanges = factory.getGroup(element.getPrintWhenGroupChanges());
this.elementGroup = (JRElementGroup)factory.getVisitResult((JRVisitable)element.getElementGroup());
this.propertiesMap = JRPropertiesMap.getPropertiesClone((JRPropertiesHolder)element);
copyPropertyExpressions(element, factory);
}
private void copyPropertyExpressions(JRElement element, JRBaseObjectFactory factory) {
JRPropertyExpression[] props = element.getPropertyExpressions();
if (props != null && props.length > 0) {
this.propertyExpressions = new JRPropertyExpression[props.length];
for (int i = 0; i < props.length; i++)
this.propertyExpressions[i] = factory.getPropertyExpression(props[i]);
}
}
public JRDefaultStyleProvider getDefaultStyleProvider() {
return this.defaultStyleProvider;
}
protected JRStyle getBaseStyle() {
if (this.parentStyle != null)
return this.parentStyle;
if (this.defaultStyleProvider != null)
return this.defaultStyleProvider.getDefaultStyle();
return null;
}
public String getKey() {
return this.key;
}
public byte getPositionType() {
return this.positionType;
}
public void setPositionType(byte positionType) {
byte old = this.positionType;
this.positionType = positionType;
getEventSupport().firePropertyChange("positionType", old, this.positionType);
}
public byte getStretchType() {
return this.stretchType;
}
public void setStretchType(byte stretchType) {
byte old = this.stretchType;
this.stretchType = stretchType;
getEventSupport().firePropertyChange("stretchType", old, this.stretchType);
}
public boolean isPrintRepeatedValues() {
return this.isPrintRepeatedValues;
}
public void setPrintRepeatedValues(boolean isPrintRepeatedValues) {
boolean old = this.isPrintRepeatedValues;
this.isPrintRepeatedValues = isPrintRepeatedValues;
getEventSupport().firePropertyChange("isPrintRepeatedValues", old, this.isPrintRepeatedValues);
}
public byte getMode() {
return JRStyleResolver.getMode((JRCommonElement)this, (byte)1);
}
public Byte getOwnMode() {
return this.mode;
}
public void setMode(byte mode) {
setMode(new Byte(mode));
}
public void setMode(Byte mode) {
Object old = this.mode;
this.mode = mode;
getEventSupport().firePropertyChange("mode", old, this.mode);
}
public int getX() {
return this.x;
}
public void setX(int x) {
int old = this.x;
this.x = x;
getEventSupport().firePropertyChange("x", old, this.x);
}
public int getY() {
return this.y;
}
public int getWidth() {
return this.width;
}
public void setWidth(int width) {
int old = this.width;
this.width = width;
getEventSupport().firePropertyChange("width", old, this.width);
}
public int getHeight() {
return this.height;
}
public boolean isRemoveLineWhenBlank() {
return this.isRemoveLineWhenBlank;
}
public void setRemoveLineWhenBlank(boolean isRemoveLine) {
boolean old = this.isRemoveLineWhenBlank;
this.isRemoveLineWhenBlank = isRemoveLine;
getEventSupport().firePropertyChange("isRemoveLineWhenBlank", old, this.isRemoveLineWhenBlank);
}
public boolean isPrintInFirstWholeBand() {
return this.isPrintInFirstWholeBand;
}
public void setPrintInFirstWholeBand(boolean isPrint) {
boolean old = this.isPrintInFirstWholeBand;
this.isPrintInFirstWholeBand = isPrint;
getEventSupport().firePropertyChange("isPrintInFirstWholeBand", old, this.isPrintInFirstWholeBand);
}
public boolean isPrintWhenDetailOverflows() {
return this.isPrintWhenDetailOverflows;
}
public void setPrintWhenDetailOverflows(boolean isPrint) {
boolean old = this.isPrintWhenDetailOverflows;
this.isPrintWhenDetailOverflows = isPrint;
getEventSupport().firePropertyChange("isPrintWhenDetailOverflows", old, this.isPrintWhenDetailOverflows);
}
public Color getForecolor() {
return JRStyleResolver.getForecolor((JRCommonElement)this);
}
public Color getOwnForecolor() {
return this.forecolor;
}
public void setForecolor(Color forecolor) {
Object old = this.forecolor;
this.forecolor = forecolor;
getEventSupport().firePropertyChange("forecolor", old, this.forecolor);
}
public Color getBackcolor() {
return JRStyleResolver.getBackcolor((JRCommonElement)this);
}
public Color getOwnBackcolor() {
return this.backcolor;
}
public void setBackcolor(Color backcolor) {
Object old = this.backcolor;
this.backcolor = backcolor;
getEventSupport().firePropertyChange("backcolor", old, this.backcolor);
}
public JRExpression getPrintWhenExpression() {
return this.printWhenExpression;
}
public JRGroup getPrintWhenGroupChanges() {
return this.printWhenGroupChanges;
}
public JRElementGroup getElementGroup() {
return this.elementGroup;
}
public JRStyle getStyle() {
return this.parentStyle;
}
public String getStyleNameReference() {
return this.parentStyleNameReference;
}
public JRPropertyChangeSupport getEventSupport() {
synchronized (this) {
if (this.eventSupport == null)
this.eventSupport = new JRPropertyChangeSupport(this);
}
return this.eventSupport;
}
public Object clone() {
JRBaseElement clone = null;
try {
clone = (JRBaseElement)super.clone();
} catch (CloneNotSupportedException e) {
throw new JRRuntimeException(e);
}
if (this.printWhenExpression != null)
clone.printWhenExpression = (JRExpression)this.printWhenExpression.clone();
return clone;
}
public Object clone(JRElementGroup parentGroup) {
JRBaseElement clone = (JRBaseElement)clone();
clone.elementGroup = parentGroup;
return clone;
}
public boolean hasProperties() {
return (this.propertiesMap != null && this.propertiesMap.hasProperties());
}
public JRPropertiesMap getPropertiesMap() {
if (this.propertiesMap == null)
this.propertiesMap = new JRPropertiesMap();
return this.propertiesMap;
}
public JRPropertiesHolder getParentProperties() {
return null;
}
public JRPropertyExpression[] getPropertyExpressions() {
return this.propertyExpressions;
}
}

View File

@@ -0,0 +1,85 @@
package net.sf.jasperreports.engine.base;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRDatasetRun;
import net.sf.jasperreports.engine.JRElementDataset;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.JRGroup;
import net.sf.jasperreports.engine.JRRuntimeException;
public abstract class JRBaseElementDataset implements JRElementDataset, Serializable {
private static final long serialVersionUID = 10200L;
protected byte resetType = 1;
protected byte incrementType = 5;
protected JRGroup resetGroup = null;
protected JRGroup incrementGroup = null;
protected JRDatasetRun datasetRun;
protected JRExpression incrementWhenExpression;
protected JRBaseElementDataset() {}
protected JRBaseElementDataset(JRElementDataset dataset) {
if (dataset != null) {
this.resetType = dataset.getResetType();
this.incrementType = dataset.getIncrementType();
this.resetGroup = dataset.getResetGroup();
this.incrementGroup = dataset.getIncrementGroup();
this.datasetRun = dataset.getDatasetRun();
this.incrementWhenExpression = dataset.getIncrementWhenExpression();
}
}
protected JRBaseElementDataset(JRElementDataset dataset, JRBaseObjectFactory factory) {
factory.put(dataset, this);
this.resetType = dataset.getResetType();
this.incrementType = dataset.getIncrementType();
this.resetGroup = factory.getGroup(dataset.getResetGroup());
this.incrementGroup = factory.getGroup(dataset.getIncrementGroup());
this.datasetRun = factory.getDatasetRun(dataset.getDatasetRun());
this.incrementWhenExpression = factory.getExpression(dataset.getIncrementWhenExpression());
}
public byte getResetType() {
return this.resetType;
}
public byte getIncrementType() {
return this.incrementType;
}
public JRGroup getResetGroup() {
return this.resetGroup;
}
public JRGroup getIncrementGroup() {
return this.incrementGroup;
}
public JRDatasetRun getDatasetRun() {
return this.datasetRun;
}
public JRExpression getIncrementWhenExpression() {
return this.incrementWhenExpression;
}
public Object clone() {
JRBaseElementDataset clone = null;
try {
clone = (JRBaseElementDataset)super.clone();
} catch (CloneNotSupportedException e) {
throw new JRRuntimeException(e);
}
if (this.incrementWhenExpression != null)
clone.incrementWhenExpression = (JRExpression)this.incrementWhenExpression.clone();
if (this.datasetRun != null)
clone.datasetRun = (JRDatasetRun)this.datasetRun.clone();
return clone;
}
}

View File

@@ -0,0 +1,119 @@
package net.sf.jasperreports.engine.base;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import net.sf.jasperreports.crosstabs.JRCrosstab;
import net.sf.jasperreports.engine.JRChild;
import net.sf.jasperreports.engine.JRElement;
import net.sf.jasperreports.engine.JRElementGroup;
import net.sf.jasperreports.engine.JRFrame;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.JRVisitable;
import net.sf.jasperreports.engine.JRVisitor;
public class JRBaseElementGroup implements JRElementGroup, Serializable {
private static final long serialVersionUID = 10200L;
protected List children = new ArrayList();
protected JRElementGroup elementGroup = null;
protected JRBaseElementGroup() {}
protected JRBaseElementGroup(JRElementGroup elementGrp, JRBaseObjectFactory factory) {
factory.put(elementGrp, this);
List list = elementGrp.getChildren();
if (list != null && list.size() > 0)
for (int i = 0; i < list.size(); i++) {
JRChild child = list.get(i);
child = (JRChild)factory.getVisitResult((JRVisitable)child);
this.children.add(child);
}
this.elementGroup = (JRElementGroup)factory.getVisitResult((JRVisitable)elementGrp.getElementGroup());
}
public List getChildren() {
return this.children;
}
public JRElementGroup getElementGroup() {
return this.elementGroup;
}
public static JRElement[] getElements(List children) {
JRElement[] elements = null;
if (children != null) {
List allElements = new ArrayList();
Object child = null;
JRElement[] childElementArray = null;
for (int i = 0; i < children.size(); i++) {
child = children.get(i);
if (child instanceof JRElement) {
allElements.add(child);
} else if (child instanceof JRElementGroup) {
childElementArray = ((JRElementGroup)child).getElements();
if (childElementArray != null)
allElements.addAll(Arrays.asList((Object[])childElementArray));
}
}
elements = new JRElement[allElements.size()];
allElements.toArray(elements);
}
return elements;
}
public JRElement[] getElements() {
return getElements(this.children);
}
public static JRElement getElementByKey(JRElement[] elements, String key) {
JRElement element = null;
if (key != null)
if (elements != null) {
int i = 0;
while (element == null && i < elements.length) {
JRElement elem = elements[i];
if (key.equals(elem.getKey())) {
element = elem;
} else if (elem instanceof JRFrame) {
element = ((JRFrame)elem).getElementByKey(key);
} else if (elem instanceof JRCrosstab) {
element = ((JRCrosstab)elem).getElementByKey(key);
}
i++;
}
}
return element;
}
public JRElement getElementByKey(String key) {
return getElementByKey(getElements(), key);
}
public void visit(JRVisitor visitor) {
visitor.visitElementGroup(this);
}
public Object clone() {
JRBaseElementGroup clone = null;
try {
clone = (JRBaseElementGroup)super.clone();
} catch (CloneNotSupportedException e) {
throw new JRRuntimeException(e);
}
if (this.children != null) {
clone.children = new ArrayList(this.children.size());
for (int i = 0; i < this.children.size(); i++)
clone.children.add(((JRChild)this.children.get(i)).clone(clone));
}
return clone;
}
public Object clone(JRElementGroup parentGroup) {
JRBaseElementGroup clone = (JRBaseElementGroup)clone();
clone.elementGroup = parentGroup;
return clone;
}
}

View File

@@ -0,0 +1,22 @@
package net.sf.jasperreports.engine.base;
import net.sf.jasperreports.engine.JREllipse;
import net.sf.jasperreports.engine.JRExpressionCollector;
import net.sf.jasperreports.engine.JRGraphicElement;
import net.sf.jasperreports.engine.JRVisitor;
public class JRBaseEllipse extends JRBaseGraphicElement implements JREllipse {
private static final long serialVersionUID = 10200L;
protected JRBaseEllipse(JREllipse ellipse, JRBaseObjectFactory factory) {
super((JRGraphicElement)ellipse, factory);
}
public void collectExpressions(JRExpressionCollector collector) {
collector.collect(this);
}
public void visit(JRVisitor visitor) {
visitor.visitEllipse(this);
}
}

View File

@@ -0,0 +1,157 @@
package net.sf.jasperreports.engine.base;
import java.io.Serializable;
import java.util.StringTokenizer;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.JRExpressionChunk;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.util.JRClassLoader;
public class JRBaseExpression implements JRExpression, Serializable {
private static final long serialVersionUID = 10200L;
protected String valueClassName = null;
protected String valueClassRealName = null;
protected int id = 0;
protected transient Class valueClass = null;
private JRExpressionChunk[] chunks = null;
private static int lastId = 0;
protected JRBaseExpression() {}
protected JRBaseExpression(JRExpression expression, JRBaseObjectFactory factory, Integer expressionId) {
factory.put(expression, this);
this.valueClassName = expression.getValueClassName();
if (expressionId == null) {
this.id = expression.getId();
} else {
this.id = expressionId.intValue();
}
JRExpressionChunk[] jrChunks = expression.getChunks();
if (jrChunks != null && jrChunks.length > 0) {
this.chunks = new JRExpressionChunk[jrChunks.length];
for (int i = 0; i < this.chunks.length; i++)
this.chunks[i] = factory.getExpressionChunk(jrChunks[i]);
}
}
protected JRBaseExpression(JRExpression expression, JRBaseObjectFactory factory) {
this(expression, factory, null);
}
private static synchronized int getNextId() {
return lastId++;
}
public void regenerateId() {
this.id = getNextId();
}
public Class getValueClass() {
if (this.valueClass == null) {
String className = getValueClassRealName();
if (className != null)
try {
this.valueClass = JRClassLoader.loadClassForName(className);
} catch (ClassNotFoundException e) {
throw new JRRuntimeException(e);
}
}
return this.valueClass;
}
public String getValueClassName() {
return this.valueClassName;
}
private String getValueClassRealName() {
if (this.valueClassRealName == null)
this.valueClassRealName = JRClassLoader.getClassRealName(this.valueClassName);
return this.valueClassRealName;
}
public int getId() {
return this.id;
}
public JRExpressionChunk[] getChunks() {
return this.chunks;
}
public String getText() {
String text = "";
this.chunks = getChunks();
if (this.chunks != null && this.chunks.length > 0) {
StringBuffer sbuffer = new StringBuffer();
for (int i = 0; i < this.chunks.length; i++) {
String textChunk;
String escapedText;
switch (this.chunks[i].getType()) {
case 2:
sbuffer.append("$P{");
sbuffer.append(this.chunks[i].getText());
sbuffer.append("}");
break;
case 3:
sbuffer.append("$F{");
sbuffer.append(this.chunks[i].getText());
sbuffer.append("}");
break;
case 4:
sbuffer.append("$V{");
sbuffer.append(this.chunks[i].getText());
sbuffer.append("}");
break;
case 5:
sbuffer.append("$R{");
sbuffer.append(this.chunks[i].getText());
sbuffer.append("}");
break;
default:
textChunk = this.chunks[i].getText();
escapedText = escapeTextChunk(textChunk);
sbuffer.append(escapedText);
break;
}
}
text = sbuffer.toString();
}
return text;
}
protected String escapeTextChunk(String text) {
if (text == null || text.indexOf('$') < 0)
return text;
StringBuffer sb = new StringBuffer(text.length() + 4);
StringTokenizer tkzer = new StringTokenizer(text, "$", true);
boolean wasDelim = false;
while (tkzer.hasMoreElements()) {
String token = tkzer.nextToken();
if (wasDelim && (token.startsWith("P{") || token.startsWith("F{") || token.startsWith("V{") || token.startsWith("R{")) && token.indexOf('}') > 0)
sb.append('$');
sb.append(token);
wasDelim = token.equals("$");
}
return sb.toString();
}
public Object clone() {
JRBaseExpression clone = null;
try {
clone = (JRBaseExpression)super.clone();
} catch (CloneNotSupportedException e) {
throw new JRRuntimeException(e);
}
if (this.chunks != null) {
clone.chunks = new JRExpressionChunk[this.chunks.length];
for (int i = 0; i < this.chunks.length; i++)
clone.chunks[i] = (JRExpressionChunk)this.chunks[i].clone();
}
return clone;
}
}

View File

@@ -0,0 +1,37 @@
package net.sf.jasperreports.engine.base;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRExpressionChunk;
import net.sf.jasperreports.engine.JRRuntimeException;
public class JRBaseExpressionChunk implements JRExpressionChunk, Serializable {
private static final long serialVersionUID = 10200L;
protected byte type = 1;
protected String text = null;
protected JRBaseExpressionChunk() {}
protected JRBaseExpressionChunk(JRExpressionChunk queryChunk, JRBaseObjectFactory factory) {
factory.put(queryChunk, this);
this.type = queryChunk.getType();
this.text = queryChunk.getText();
}
public byte getType() {
return this.type;
}
public String getText() {
return this.text;
}
public Object clone() {
try {
return super.clone();
} catch (CloneNotSupportedException e) {
throw new JRRuntimeException(e);
}
}
}

View File

@@ -0,0 +1,111 @@
package net.sf.jasperreports.engine.base;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRField;
import net.sf.jasperreports.engine.JRPropertiesHolder;
import net.sf.jasperreports.engine.JRPropertiesMap;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.design.events.JRChangeEventsSupport;
import net.sf.jasperreports.engine.design.events.JRPropertyChangeSupport;
import net.sf.jasperreports.engine.util.JRClassLoader;
public class JRBaseField implements JRField, Serializable, JRChangeEventsSupport {
private static final long serialVersionUID = 10200L;
public static final String PROPERTY_DESCRIPTION = "description";
protected String name = null;
protected String description = null;
protected String valueClassName = String.class.getName();
protected String valueClassRealName = null;
protected transient Class valueClass = null;
protected JRPropertiesMap propertiesMap;
private transient JRPropertyChangeSupport eventSupport;
protected JRBaseField() {
this.propertiesMap = new JRPropertiesMap();
}
protected JRBaseField(JRField field, JRBaseObjectFactory factory) {
factory.put(field, this);
this.name = field.getName();
this.description = field.getDescription();
this.valueClassName = field.getValueClassName();
this.propertiesMap = field.getPropertiesMap().cloneProperties();
}
public String getName() {
return this.name;
}
public String getDescription() {
return this.description;
}
public void setDescription(String description) {
Object old = this.description;
this.description = description;
getEventSupport().firePropertyChange("description", old, this.description);
}
public Class getValueClass() {
if (this.valueClass == null) {
String className = getValueClassRealName();
if (className != null)
try {
this.valueClass = JRClassLoader.loadClassForName(className);
} catch (ClassNotFoundException e) {
throw new JRRuntimeException(e);
}
}
return this.valueClass;
}
public String getValueClassName() {
return this.valueClassName;
}
private String getValueClassRealName() {
if (this.valueClassRealName == null)
this.valueClassRealName = JRClassLoader.getClassRealName(this.valueClassName);
return this.valueClassRealName;
}
public boolean hasProperties() {
return (this.propertiesMap != null && this.propertiesMap.hasProperties());
}
public JRPropertiesMap getPropertiesMap() {
return this.propertiesMap;
}
public JRPropertiesHolder getParentProperties() {
return null;
}
public Object clone() {
JRBaseField clone = null;
try {
clone = (JRBaseField)super.clone();
} catch (CloneNotSupportedException e) {
throw new JRRuntimeException(e);
}
if (this.propertiesMap != null)
clone.propertiesMap = (JRPropertiesMap)this.propertiesMap.clone();
return clone;
}
public JRPropertyChangeSupport getEventSupport() {
synchronized (this) {
if (this.eventSupport == null)
this.eventSupport = new JRPropertyChangeSupport(this);
}
return this.eventSupport;
}
}

View File

@@ -0,0 +1,322 @@
package net.sf.jasperreports.engine.base;
import java.awt.font.TextAttribute;
import java.io.Serializable;
import java.util.Map;
import net.sf.jasperreports.engine.JRDefaultFontProvider;
import net.sf.jasperreports.engine.JRDefaultStyleProvider;
import net.sf.jasperreports.engine.JRFont;
import net.sf.jasperreports.engine.JRReportFont;
import net.sf.jasperreports.engine.JRStyle;
import net.sf.jasperreports.engine.JRStyleContainer;
import net.sf.jasperreports.engine.design.events.JRChangeEventsSupport;
import net.sf.jasperreports.engine.design.events.JRPropertyChangeSupport;
import net.sf.jasperreports.engine.util.JRStyleResolver;
import net.sf.jasperreports.engine.util.JRTextAttribute;
public class JRBaseFont implements JRFont, Serializable, JRChangeEventsSupport {
private static final long serialVersionUID = 10200L;
public static final String PROPERTY_BOLD = "bold";
public static final String PROPERTY_FONT_NAME = "fontName";
public static final String PROPERTY_FONT_SIZE = "fontSize";
public static final String PROPERTY_ITALIC = "italic";
public static final String PROPERTY_PDF_EMBEDDED = "pdfEmbedded";
public static final String PROPERTY_PDF_ENCODING = "pdfEncoding";
public static final String PROPERTY_PDF_FONT_NAME = "pdfFontName";
public static final String PROPERTY_REPORT_FONT = "reportFont";
public static final String PROPERTY_STRIKE_THROUGH = "strikeThrough";
public static final String PROPERTY_UNDERLINE = "underline";
protected JRDefaultFontProvider defaultFontProvider = null;
protected JRReportFont reportFont = null;
protected JRStyleContainer styleContainer = null;
protected String fontName = null;
protected Boolean isBold = null;
protected Boolean isItalic = null;
protected Boolean isUnderline = null;
protected Boolean isStrikeThrough = null;
protected Integer fontSize = null;
protected String pdfFontName = null;
protected String pdfEncoding = null;
protected Boolean isPdfEmbedded = null;
private transient JRPropertyChangeSupport eventSupport;
public JRBaseFont() {}
public JRBaseFont(Map attributes) {
String fontNameAttr = (String)attributes.get(TextAttribute.FAMILY);
if (fontNameAttr != null)
setFontName(fontNameAttr);
Object bold = attributes.get(TextAttribute.WEIGHT);
if (bold != null)
setBold(TextAttribute.WEIGHT_BOLD.equals(bold));
Object italic = attributes.get(TextAttribute.POSTURE);
if (italic != null)
setItalic(TextAttribute.POSTURE_OBLIQUE.equals(italic));
Float sizeAttr = (Float)attributes.get(TextAttribute.SIZE);
if (sizeAttr != null)
setFontSize(sizeAttr.intValue());
Object underline = attributes.get(TextAttribute.UNDERLINE);
if (underline != null)
setUnderline(TextAttribute.UNDERLINE_ON.equals(underline));
Object strikeThrough = attributes.get(TextAttribute.STRIKETHROUGH);
if (strikeThrough != null)
setStrikeThrough(TextAttribute.STRIKETHROUGH_ON.equals(strikeThrough));
String pdfFontNameAttr = (String)attributes.get(JRTextAttribute.PDF_FONT_NAME);
if (pdfFontNameAttr != null)
setPdfFontName(pdfFontNameAttr);
String pdfEncodingAttr = (String)attributes.get(JRTextAttribute.PDF_ENCODING);
if (pdfEncodingAttr != null)
setPdfEncoding(pdfEncodingAttr);
Boolean isPdfEmbeddedAttr = (Boolean)attributes.get(JRTextAttribute.IS_PDF_EMBEDDED);
if (isPdfEmbeddedAttr != null)
setPdfEmbedded(isPdfEmbeddedAttr);
}
protected JRBaseFont(JRDefaultFontProvider defaultFontProvider) {
this.defaultFontProvider = defaultFontProvider;
}
public JRBaseFont(JRDefaultFontProvider defaultFontProvider, JRReportFont reportFont, JRFont font) {
this(defaultFontProvider, reportFont, null, font);
}
public JRBaseFont(JRDefaultFontProvider defaultFontProvider, JRReportFont reportFont, JRStyleContainer styleContainer, JRFont font) {
this.defaultFontProvider = defaultFontProvider;
this.reportFont = reportFont;
this.styleContainer = styleContainer;
if (font != null) {
this.fontName = font.getOwnFontName();
this.isBold = font.isOwnBold();
this.isItalic = font.isOwnItalic();
this.isUnderline = font.isOwnUnderline();
this.isStrikeThrough = font.isOwnStrikeThrough();
this.fontSize = font.getOwnFontSize();
this.pdfFontName = font.getOwnPdfFontName();
this.pdfEncoding = font.getOwnPdfEncoding();
this.isPdfEmbedded = font.isOwnPdfEmbedded();
}
}
public JRDefaultFontProvider getDefaultFontProvider() {
return this.defaultFontProvider;
}
public JRDefaultStyleProvider getDefaultStyleProvider() {
return (this.styleContainer == null) ? null : this.styleContainer.getDefaultStyleProvider();
}
public JRStyle getStyle() {
return (this.styleContainer == null) ? null : this.styleContainer.getStyle();
}
public JRReportFont getReportFont() {
return this.reportFont;
}
public void setReportFont(JRReportFont reportFont) {
Object old = this.reportFont;
this.reportFont = reportFont;
getEventSupport().firePropertyChange("reportFont", old, this.reportFont);
}
public String getFontName() {
return JRStyleResolver.getFontName(this);
}
public String getOwnFontName() {
return this.fontName;
}
public void setFontName(String fontName) {
Object old = this.fontName;
this.fontName = fontName;
getEventSupport().firePropertyChange("fontName", old, this.fontName);
}
public boolean isBold() {
return JRStyleResolver.isBold(this);
}
public Boolean isOwnBold() {
return this.isBold;
}
public void setBold(boolean isBold) {
setBold(isBold ? Boolean.TRUE : Boolean.FALSE);
}
public void setBold(Boolean isBold) {
Object old = this.isBold;
this.isBold = isBold;
getEventSupport().firePropertyChange("bold", old, this.isBold);
}
public boolean isItalic() {
return JRStyleResolver.isItalic(this);
}
public Boolean isOwnItalic() {
return this.isItalic;
}
public void setItalic(boolean isItalic) {
setItalic(isItalic ? Boolean.TRUE : Boolean.FALSE);
}
public void setItalic(Boolean isItalic) {
Object old = this.isItalic;
this.isItalic = isItalic;
getEventSupport().firePropertyChange("italic", old, this.isItalic);
}
public boolean isUnderline() {
return JRStyleResolver.isUnderline(this);
}
public Boolean isOwnUnderline() {
return this.isUnderline;
}
public void setUnderline(boolean isUnderline) {
setUnderline(isUnderline ? Boolean.TRUE : Boolean.FALSE);
}
public void setUnderline(Boolean isUnderline) {
Object old = this.isUnderline;
this.isUnderline = isUnderline;
getEventSupport().firePropertyChange("underline", old, this.isUnderline);
}
public boolean isStrikeThrough() {
return JRStyleResolver.isStrikeThrough(this);
}
public Boolean isOwnStrikeThrough() {
return this.isStrikeThrough;
}
public void setStrikeThrough(boolean isStrikeThrough) {
setStrikeThrough(isStrikeThrough ? Boolean.TRUE : Boolean.FALSE);
}
public void setStrikeThrough(Boolean isStrikeThrough) {
Object old = this.isStrikeThrough;
this.isStrikeThrough = isStrikeThrough;
getEventSupport().firePropertyChange("strikeThrough", old, this.isStrikeThrough);
}
public int getFontSize() {
return JRStyleResolver.getFontSize(this);
}
public Integer getOwnFontSize() {
return this.fontSize;
}
public void setFontSize(int fontSize) {
setFontSize(new Integer(fontSize));
}
public void setFontSize(Integer fontSize) {
Object old = this.fontSize;
this.fontSize = fontSize;
getEventSupport().firePropertyChange("fontSize", old, this.fontSize);
}
public int getSize() {
return getFontSize();
}
public Integer getOwnSize() {
return getOwnFontSize();
}
public void setSize(int size) {
setFontSize(size);
}
public void setSize(Integer size) {
setFontSize(size);
}
public String getPdfFontName() {
return JRStyleResolver.getPdfFontName(this);
}
public String getOwnPdfFontName() {
return this.pdfFontName;
}
public void setPdfFontName(String pdfFontName) {
Object old = this.pdfFontName;
this.pdfFontName = pdfFontName;
getEventSupport().firePropertyChange("pdfFontName", old, this.pdfFontName);
}
public String getPdfEncoding() {
return JRStyleResolver.getPdfEncoding(this);
}
public String getOwnPdfEncoding() {
return this.pdfEncoding;
}
public void setPdfEncoding(String pdfEncoding) {
Object old = this.pdfEncoding;
this.pdfEncoding = pdfEncoding;
getEventSupport().firePropertyChange("pdfEncoding", old, this.pdfEncoding);
}
public boolean isPdfEmbedded() {
return JRStyleResolver.isPdfEmbedded(this);
}
public Boolean isOwnPdfEmbedded() {
return this.isPdfEmbedded;
}
public void setPdfEmbedded(boolean isPdfEmbedded) {
setPdfEmbedded(isPdfEmbedded ? Boolean.TRUE : Boolean.FALSE);
}
public void setPdfEmbedded(Boolean isPdfEmbedded) {
Object old = this.isPdfEmbedded;
this.isPdfEmbedded = isPdfEmbedded;
getEventSupport().firePropertyChange("pdfEmbedded", old, this.isPdfEmbedded);
}
public String getStyleNameReference() {
return (this.styleContainer == null) ? null : this.styleContainer.getStyleNameReference();
}
public JRPropertyChangeSupport getEventSupport() {
synchronized (this) {
if (this.eventSupport == null)
this.eventSupport = new JRPropertyChangeSupport(this);
}
return this.eventSupport;
}
}

View File

@@ -0,0 +1,367 @@
package net.sf.jasperreports.engine.base;
import java.awt.Color;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import net.sf.jasperreports.engine.JRBox;
import net.sf.jasperreports.engine.JRBoxContainer;
import net.sf.jasperreports.engine.JRChild;
import net.sf.jasperreports.engine.JRCommonElement;
import net.sf.jasperreports.engine.JRElement;
import net.sf.jasperreports.engine.JRExpressionCollector;
import net.sf.jasperreports.engine.JRFrame;
import net.sf.jasperreports.engine.JRLineBox;
import net.sf.jasperreports.engine.JRVisitable;
import net.sf.jasperreports.engine.JRVisitor;
import net.sf.jasperreports.engine.util.JRBoxUtil;
import net.sf.jasperreports.engine.util.JRPenUtil;
import net.sf.jasperreports.engine.util.JRStyleResolver;
import net.sf.jasperreports.engine.util.LineBoxWrapper;
public class JRBaseFrame extends JRBaseElement implements JRFrame {
private static final long serialVersionUID = 10200L;
protected List children;
protected JRLineBox lineBox = null;
private Byte border;
private Byte topBorder;
private Byte leftBorder;
private Byte bottomBorder;
private Byte rightBorder;
private Color borderColor;
private Color topBorderColor;
private Color leftBorderColor;
private Color bottomBorderColor;
private Color rightBorderColor;
private Integer padding;
private Integer topPadding;
private Integer leftPadding;
private Integer bottomPadding;
private Integer rightPadding;
public JRBaseFrame(JRFrame frame, JRBaseObjectFactory factory) {
super((JRElement)frame, factory);
this.border = null;
this.topBorder = null;
this.leftBorder = null;
this.bottomBorder = null;
this.rightBorder = null;
this.borderColor = null;
this.topBorderColor = null;
this.leftBorderColor = null;
this.bottomBorderColor = null;
this.rightBorderColor = null;
this.padding = null;
this.topPadding = null;
this.leftPadding = null;
this.bottomPadding = null;
this.rightPadding = null;
List frameChildren = frame.getChildren();
if (frameChildren != null) {
this.children = new ArrayList(frameChildren.size());
for (Iterator it = frameChildren.iterator(); it.hasNext(); ) {
JRChild child = it.next();
this.children.add(factory.getVisitResult((JRVisitable)child));
}
}
this.lineBox = frame.getLineBox().clone((JRBoxContainer)this);
}
public JRElement[] getElements() {
return JRBaseElementGroup.getElements(this.children);
}
public void collectExpressions(JRExpressionCollector collector) {
collector.collect(this);
}
public void visit(JRVisitor visitor) {
visitor.visitFrame(this);
}
public List getChildren() {
return this.children;
}
public JRElement getElementByKey(String elementKey) {
return JRBaseElementGroup.getElementByKey(getElements(), elementKey);
}
public byte getMode() {
return JRStyleResolver.getMode((JRCommonElement)this, (byte)2);
}
public JRBox getBox() {
return (JRBox)new LineBoxWrapper(getLineBox());
}
public JRLineBox getLineBox() {
return this.lineBox;
}
public byte getBorder() {
return JRPenUtil.getPenFromLinePen(this.lineBox.getPen());
}
public Byte getOwnBorder() {
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getPen());
}
public void setBorder(byte border) {
JRPenUtil.setLinePenFromPen(border, this.lineBox.getPen());
}
public void setBorder(Byte border) {
JRPenUtil.setLinePenFromPen(border, this.lineBox.getPen());
}
public Color getBorderColor() {
return this.lineBox.getPen().getLineColor();
}
public Color getOwnBorderColor() {
return this.lineBox.getPen().getOwnLineColor();
}
public void setBorderColor(Color borderColor) {
this.lineBox.getPen().setLineColor(borderColor);
}
public int getPadding() {
return this.lineBox.getPadding().intValue();
}
public Integer getOwnPadding() {
return this.lineBox.getOwnPadding();
}
public void setPadding(int padding) {
this.lineBox.setPadding(padding);
}
public void setPadding(Integer padding) {
this.lineBox.setPadding(padding);
}
public byte getTopBorder() {
return JRPenUtil.getPenFromLinePen(this.lineBox.getTopPen());
}
public Byte getOwnTopBorder() {
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getTopPen());
}
public void setTopBorder(byte topBorder) {
JRPenUtil.setLinePenFromPen(topBorder, this.lineBox.getTopPen());
}
public void setTopBorder(Byte topBorder) {
JRPenUtil.setLinePenFromPen(topBorder, this.lineBox.getTopPen());
}
public Color getTopBorderColor() {
return this.lineBox.getTopPen().getLineColor();
}
public Color getOwnTopBorderColor() {
return this.lineBox.getTopPen().getOwnLineColor();
}
public void setTopBorderColor(Color topBorderColor) {
this.lineBox.getTopPen().setLineColor(topBorderColor);
}
public int getTopPadding() {
return this.lineBox.getTopPadding().intValue();
}
public Integer getOwnTopPadding() {
return this.lineBox.getOwnTopPadding();
}
public void setTopPadding(int topPadding) {
this.lineBox.setTopPadding(topPadding);
}
public void setTopPadding(Integer topPadding) {
this.lineBox.setTopPadding(topPadding);
}
public byte getLeftBorder() {
return JRPenUtil.getPenFromLinePen(this.lineBox.getLeftPen());
}
public Byte getOwnLeftBorder() {
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getLeftPen());
}
public void setLeftBorder(byte leftBorder) {
JRPenUtil.setLinePenFromPen(leftBorder, this.lineBox.getLeftPen());
}
public void setLeftBorder(Byte leftBorder) {
JRPenUtil.setLinePenFromPen(leftBorder, this.lineBox.getLeftPen());
}
public Color getLeftBorderColor() {
return this.lineBox.getLeftPen().getLineColor();
}
public Color getOwnLeftBorderColor() {
return this.lineBox.getLeftPen().getOwnLineColor();
}
public void setLeftBorderColor(Color leftBorderColor) {
this.lineBox.getLeftPen().setLineColor(leftBorderColor);
}
public int getLeftPadding() {
return this.lineBox.getLeftPadding().intValue();
}
public Integer getOwnLeftPadding() {
return this.lineBox.getOwnLeftPadding();
}
public void setLeftPadding(int leftPadding) {
this.lineBox.setLeftPadding(leftPadding);
}
public void setLeftPadding(Integer leftPadding) {
this.lineBox.setLeftPadding(leftPadding);
}
public byte getBottomBorder() {
return JRPenUtil.getPenFromLinePen(this.lineBox.getBottomPen());
}
public Byte getOwnBottomBorder() {
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getBottomPen());
}
public void setBottomBorder(byte bottomBorder) {
JRPenUtil.setLinePenFromPen(bottomBorder, this.lineBox.getBottomPen());
}
public void setBottomBorder(Byte bottomBorder) {
JRPenUtil.setLinePenFromPen(bottomBorder, this.lineBox.getBottomPen());
}
public Color getBottomBorderColor() {
return this.lineBox.getBottomPen().getLineColor();
}
public Color getOwnBottomBorderColor() {
return this.lineBox.getBottomPen().getOwnLineColor();
}
public void setBottomBorderColor(Color bottomBorderColor) {
this.lineBox.getBottomPen().setLineColor(bottomBorderColor);
}
public int getBottomPadding() {
return this.lineBox.getBottomPadding().intValue();
}
public Integer getOwnBottomPadding() {
return this.lineBox.getOwnBottomPadding();
}
public void setBottomPadding(int bottomPadding) {
this.lineBox.setBottomPadding(bottomPadding);
}
public void setBottomPadding(Integer bottomPadding) {
this.lineBox.setBottomPadding(bottomPadding);
}
public byte getRightBorder() {
return JRPenUtil.getPenFromLinePen(this.lineBox.getRightPen());
}
public Byte getOwnRightBorder() {
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getRightPen());
}
public void setRightBorder(byte rightBorder) {
JRPenUtil.setLinePenFromPen(rightBorder, this.lineBox.getRightPen());
}
public void setRightBorder(Byte rightBorder) {
JRPenUtil.setLinePenFromPen(rightBorder, this.lineBox.getRightPen());
}
public Color getRightBorderColor() {
return this.lineBox.getRightPen().getLineColor();
}
public Color getOwnRightBorderColor() {
return this.lineBox.getRightPen().getOwnLineColor();
}
public void setRightBorderColor(Color rightBorderColor) {
this.lineBox.getRightPen().setLineColor(rightBorderColor);
}
public int getRightPadding() {
return this.lineBox.getRightPadding().intValue();
}
public Integer getOwnRightPadding() {
return this.lineBox.getOwnRightPadding();
}
public void setRightPadding(int rightPadding) {
this.lineBox.setRightPadding(rightPadding);
}
public void setRightPadding(Integer rightPadding) {
this.lineBox.setRightPadding(rightPadding);
}
public Color getDefaultLineColor() {
return getForecolor();
}
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
if (this.lineBox == null) {
this.lineBox = new JRBaseLineBox((JRBoxContainer)this);
JRBoxUtil.setToBox(this.border, this.topBorder, this.leftBorder, this.bottomBorder, this.rightBorder, this.borderColor, this.topBorderColor, this.leftBorderColor, this.bottomBorderColor, this.rightBorderColor, this.padding, this.topPadding, this.leftPadding, this.bottomPadding, this.rightPadding, this.lineBox);
this.border = null;
this.topBorder = null;
this.leftBorder = null;
this.bottomBorder = null;
this.rightBorder = null;
this.borderColor = null;
this.topBorderColor = null;
this.leftBorderColor = null;
this.bottomBorderColor = null;
this.rightBorderColor = null;
this.padding = null;
this.topPadding = null;
this.leftPadding = null;
this.bottomPadding = null;
this.rightPadding = null;
}
}
}

View File

@@ -0,0 +1,83 @@
package net.sf.jasperreports.engine.base;
import java.awt.Color;
import java.io.IOException;
import java.io.ObjectInputStream;
import net.sf.jasperreports.engine.JRCommonGraphicElement;
import net.sf.jasperreports.engine.JRElement;
import net.sf.jasperreports.engine.JRGraphicElement;
import net.sf.jasperreports.engine.JRPen;
import net.sf.jasperreports.engine.JRPenContainer;
import net.sf.jasperreports.engine.util.JRPenUtil;
import net.sf.jasperreports.engine.util.JRStyleResolver;
public abstract class JRBaseGraphicElement extends JRBaseElement implements JRGraphicElement {
private static final long serialVersionUID = 10200L;
protected JRPen linePen;
protected Byte fill;
private Byte pen;
protected JRBaseGraphicElement(JRGraphicElement graphicElement, JRBaseObjectFactory factory) {
super((JRElement)graphicElement, factory);
this.linePen = graphicElement.getLinePen().clone((JRPenContainer)this);
this.fill = graphicElement.getOwnFill();
}
public JRPen getLinePen() {
return this.linePen;
}
public byte getPen() {
return JRPenUtil.getPenFromLinePen(this.linePen);
}
public Byte getOwnPen() {
return JRPenUtil.getOwnPenFromLinePen(this.linePen);
}
public void setPen(byte pen) {
setPen(new Byte(pen));
}
public void setPen(Byte pen) {
JRPenUtil.setLinePenFromPen(pen, this.linePen);
}
public byte getFill() {
return JRStyleResolver.getFill((JRCommonGraphicElement)this);
}
public Byte getOwnFill() {
return this.fill;
}
public void setFill(byte fill) {
setFill(new Byte(fill));
}
public void setFill(Byte fill) {
Object old = this.fill;
this.fill = fill;
getEventSupport().firePropertyChange("fill", old, this.fill);
}
public Float getDefaultLineWidth() {
return JRPen.LINE_WIDTH_1;
}
public Color getDefaultLineColor() {
return getForecolor();
}
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
if (this.linePen == null) {
this.linePen = new JRBasePen((JRPenContainer)this);
JRPenUtil.setLinePenFromPen(this.pen, this.linePen);
this.pen = null;
}
}
}

View File

@@ -0,0 +1,158 @@
package net.sf.jasperreports.engine.base;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRBand;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.JRGroup;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.JRVariable;
import net.sf.jasperreports.engine.design.events.JRChangeEventsSupport;
import net.sf.jasperreports.engine.design.events.JRPropertyChangeSupport;
public class JRBaseGroup implements JRGroup, Serializable, JRChangeEventsSupport {
private static final long serialVersionUID = 10200L;
public static final String PROPERTY_MIN_HEIGHT_TO_START_NEW_PAGE = "minHeightToStartNewPage";
public static final String PROPERTY_RESET_PAGE_NUMBER = "resetPageNumber";
public static final String PROPERTY_REPRINT_HEADER_ON_EACH_PAGE = "reprintHeaderOnEachPage";
public static final String PROPERTY_START_NEW_COLUMN = "startNewColumn";
public static final String PROPERTY_START_NEW_PAGE = "startNewPage";
protected String name = null;
protected boolean isStartNewColumn = false;
protected boolean isStartNewPage = false;
protected boolean isResetPageNumber = false;
protected boolean isReprintHeaderOnEachPage = false;
protected int minHeightToStartNewPage = 0;
protected JRExpression expression = null;
protected JRBand groupHeader = null;
protected JRBand groupFooter = null;
protected JRVariable countVariable = null;
private transient JRPropertyChangeSupport eventSupport;
protected JRBaseGroup() {}
protected JRBaseGroup(JRGroup group, JRBaseObjectFactory factory) {
factory.put(group, this);
this.name = group.getName();
this.isStartNewColumn = group.isStartNewColumn();
this.isStartNewPage = group.isStartNewPage();
this.isResetPageNumber = group.isResetPageNumber();
this.isReprintHeaderOnEachPage = group.isReprintHeaderOnEachPage();
this.minHeightToStartNewPage = group.getMinHeightToStartNewPage();
this.expression = factory.getExpression(group.getExpression());
this.groupHeader = factory.getBand(group.getGroupHeader());
this.groupFooter = factory.getBand(group.getGroupFooter());
this.countVariable = factory.getVariable(group.getCountVariable());
}
public String getName() {
return this.name;
}
public boolean isStartNewColumn() {
return this.isStartNewColumn;
}
public void setStartNewColumn(boolean isStart) {
boolean old = this.isStartNewColumn;
this.isStartNewColumn = isStart;
getEventSupport().firePropertyChange("startNewColumn", old, this.isStartNewColumn);
}
public boolean isStartNewPage() {
return this.isStartNewPage;
}
public void setStartNewPage(boolean isStart) {
boolean old = this.isStartNewPage;
this.isStartNewPage = isStart;
getEventSupport().firePropertyChange("startNewPage", old, this.isStartNewPage);
}
public boolean isResetPageNumber() {
return this.isResetPageNumber;
}
public void setResetPageNumber(boolean isReset) {
boolean old = this.isResetPageNumber;
this.isResetPageNumber = isReset;
getEventSupport().firePropertyChange("resetPageNumber", old, this.isResetPageNumber);
}
public boolean isReprintHeaderOnEachPage() {
return this.isReprintHeaderOnEachPage;
}
public void setReprintHeaderOnEachPage(boolean isReprint) {
boolean old = this.isReprintHeaderOnEachPage;
this.isReprintHeaderOnEachPage = isReprint;
getEventSupport().firePropertyChange("reprintHeaderOnEachPage", old, this.isReprintHeaderOnEachPage);
}
public int getMinHeightToStartNewPage() {
return this.minHeightToStartNewPage;
}
public void setMinHeightToStartNewPage(int minHeight) {
int old = this.minHeightToStartNewPage;
this.minHeightToStartNewPage = minHeight;
getEventSupport().firePropertyChange("minHeightToStartNewPage", old, this.minHeightToStartNewPage);
}
public JRExpression getExpression() {
return this.expression;
}
public JRBand getGroupHeader() {
return this.groupHeader;
}
public JRBand getGroupFooter() {
return this.groupFooter;
}
public JRVariable getCountVariable() {
return this.countVariable;
}
public Object clone() {
JRBaseGroup clone = null;
try {
clone = (JRBaseGroup)super.clone();
} catch (CloneNotSupportedException e) {
throw new JRRuntimeException(e);
}
if (this.expression != null)
clone.expression = (JRExpression)this.expression.clone();
if (this.groupHeader != null)
clone.groupHeader = (JRBand)this.groupHeader.clone();
if (this.groupFooter != null)
clone.groupFooter = (JRBand)this.groupFooter.clone();
if (this.countVariable != null)
clone.countVariable = (JRVariable)this.countVariable.clone();
return clone;
}
public JRPropertyChangeSupport getEventSupport() {
synchronized (this) {
if (this.eventSupport == null)
this.eventSupport = new JRPropertyChangeSupport(this);
}
return this.eventSupport;
}
}

View File

@@ -0,0 +1,107 @@
package net.sf.jasperreports.engine.base;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.JRHyperlink;
import net.sf.jasperreports.engine.JRHyperlinkHelper;
import net.sf.jasperreports.engine.JRHyperlinkParameter;
import net.sf.jasperreports.engine.JRRuntimeException;
public class JRBaseHyperlink implements JRHyperlink, Serializable {
private static final long serialVersionUID = 10200L;
protected String linkType;
protected byte hyperlinkTarget = 1;
protected JRExpression hyperlinkReferenceExpression;
protected JRExpression hyperlinkAnchorExpression;
protected JRExpression hyperlinkPageExpression;
protected JRExpression hyperlinkTooltipExpression;
protected JRHyperlinkParameter[] hyperlinkParameters;
public JRBaseHyperlink() {}
protected JRBaseHyperlink(JRHyperlink link, JRBaseObjectFactory factory) {
factory.put(link, this);
this.linkType = link.getLinkType();
this.hyperlinkTarget = link.getHyperlinkTarget();
this.hyperlinkReferenceExpression = factory.getExpression(link.getHyperlinkReferenceExpression());
this.hyperlinkAnchorExpression = factory.getExpression(link.getHyperlinkAnchorExpression());
this.hyperlinkPageExpression = factory.getExpression(link.getHyperlinkPageExpression());
this.hyperlinkTooltipExpression = factory.getExpression(link.getHyperlinkTooltipExpression());
this.hyperlinkParameters = copyHyperlinkParameters(link, factory);
}
public static JRHyperlinkParameter[] copyHyperlinkParameters(JRHyperlink link, JRBaseObjectFactory factory) {
JRHyperlinkParameter[] linkParameters = link.getHyperlinkParameters();
JRHyperlinkParameter[] parameters = null;
if (linkParameters != null && linkParameters.length > 0) {
parameters = new JRHyperlinkParameter[linkParameters.length];
for (int i = 0; i < linkParameters.length; i++) {
JRHyperlinkParameter parameter = linkParameters[i];
parameters[i] = factory.getHyperlinkParameter(parameter);
}
}
return parameters;
}
public JRExpression getHyperlinkAnchorExpression() {
return this.hyperlinkAnchorExpression;
}
public JRExpression getHyperlinkPageExpression() {
return this.hyperlinkPageExpression;
}
public JRHyperlinkParameter[] getHyperlinkParameters() {
return this.hyperlinkParameters;
}
public JRExpression getHyperlinkReferenceExpression() {
return this.hyperlinkReferenceExpression;
}
public byte getHyperlinkTarget() {
return this.hyperlinkTarget;
}
public byte getHyperlinkType() {
return JRHyperlinkHelper.getHyperlinkType(this);
}
public String getLinkType() {
return this.linkType;
}
public JRExpression getHyperlinkTooltipExpression() {
return this.hyperlinkTooltipExpression;
}
public Object clone() {
JRBaseHyperlink clone = null;
try {
clone = (JRBaseHyperlink)super.clone();
} catch (CloneNotSupportedException e) {
throw new JRRuntimeException(e);
}
if (this.hyperlinkParameters != null) {
clone.hyperlinkParameters = new JRHyperlinkParameter[this.hyperlinkParameters.length];
for (int i = 0; i < this.hyperlinkParameters.length; i++)
clone.hyperlinkParameters[i] = (JRHyperlinkParameter)this.hyperlinkParameters[i].clone();
}
if (this.hyperlinkReferenceExpression != null)
clone.hyperlinkReferenceExpression = (JRExpression)this.hyperlinkReferenceExpression.clone();
if (this.hyperlinkAnchorExpression != null)
clone.hyperlinkAnchorExpression = (JRExpression)this.hyperlinkAnchorExpression.clone();
if (this.hyperlinkPageExpression != null)
clone.hyperlinkPageExpression = (JRExpression)this.hyperlinkPageExpression.clone();
if (this.hyperlinkTooltipExpression != null)
clone.hyperlinkTooltipExpression = (JRExpression)this.hyperlinkTooltipExpression.clone();
return clone;
}
}

View File

@@ -0,0 +1,42 @@
package net.sf.jasperreports.engine.base;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.JRHyperlinkParameter;
import net.sf.jasperreports.engine.JRRuntimeException;
public class JRBaseHyperlinkParameter implements JRHyperlinkParameter, Serializable {
private static final long serialVersionUID = 10200L;
protected String name;
protected JRExpression valueExpression;
protected JRBaseHyperlinkParameter() {}
public JRBaseHyperlinkParameter(JRHyperlinkParameter parameter, JRBaseObjectFactory factory) {
factory.put(parameter, this);
this.name = parameter.getName();
this.valueExpression = factory.getExpression(parameter.getValueExpression());
}
public String getName() {
return this.name;
}
public JRExpression getValueExpression() {
return this.valueExpression;
}
public Object clone() {
JRBaseHyperlinkParameter clone = null;
try {
clone = (JRBaseHyperlinkParameter)super.clone();
} catch (CloneNotSupportedException e) {
throw new JRRuntimeException(e);
}
if (this.valueExpression != null)
clone.valueExpression = (JRExpression)this.valueExpression.clone();
return clone;
}
}

View File

@@ -0,0 +1,588 @@
package net.sf.jasperreports.engine.base;
import java.awt.Color;
import java.io.IOException;
import java.io.ObjectInputStream;
import net.sf.jasperreports.engine.JRAlignment;
import net.sf.jasperreports.engine.JRBox;
import net.sf.jasperreports.engine.JRBoxContainer;
import net.sf.jasperreports.engine.JRCommonElement;
import net.sf.jasperreports.engine.JRCommonImage;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.JRExpressionCollector;
import net.sf.jasperreports.engine.JRGraphicElement;
import net.sf.jasperreports.engine.JRGroup;
import net.sf.jasperreports.engine.JRHyperlink;
import net.sf.jasperreports.engine.JRHyperlinkHelper;
import net.sf.jasperreports.engine.JRHyperlinkParameter;
import net.sf.jasperreports.engine.JRImage;
import net.sf.jasperreports.engine.JRLineBox;
import net.sf.jasperreports.engine.JRPen;
import net.sf.jasperreports.engine.JRVisitor;
import net.sf.jasperreports.engine.util.JRBoxUtil;
import net.sf.jasperreports.engine.util.JRPenUtil;
import net.sf.jasperreports.engine.util.JRStyleResolver;
import net.sf.jasperreports.engine.util.LineBoxWrapper;
public class JRBaseImage extends JRBaseGraphicElement implements JRImage {
private static final long serialVersionUID = 10200L;
public static final String PROPERTY_LAZY = "lazy";
public static final String PROPERTY_ON_ERROR_TYPE = "onErrorType";
public static final String PROPERTY_USING_CACHE = "usingCache";
protected Byte scaleImage;
protected Byte horizontalAlignment;
protected Byte verticalAlignment;
protected Boolean isUsingCache = null;
protected boolean isLazy = false;
protected byte onErrorType = 1;
protected byte evaluationTime = 1;
protected byte hyperlinkType = 0;
protected String linkType;
protected byte hyperlinkTarget = 1;
private JRHyperlinkParameter[] hyperlinkParameters;
protected JRLineBox lineBox = null;
protected JRGroup evaluationGroup = null;
protected JRExpression expression = null;
protected JRExpression anchorNameExpression = null;
protected JRExpression hyperlinkReferenceExpression = null;
protected JRExpression hyperlinkAnchorExpression = null;
protected JRExpression hyperlinkPageExpression = null;
private JRExpression hyperlinkTooltipExpression;
protected int bookmarkLevel = 0;
private Byte border;
private Byte topBorder;
private Byte leftBorder;
private Byte bottomBorder;
private Byte rightBorder;
private Color borderColor;
private Color topBorderColor;
private Color leftBorderColor;
private Color bottomBorderColor;
private Color rightBorderColor;
private Integer padding;
private Integer topPadding;
private Integer leftPadding;
private Integer bottomPadding;
private Integer rightPadding;
protected JRBaseImage(JRImage image, JRBaseObjectFactory factory) {
super((JRGraphicElement)image, factory);
this.border = null;
this.topBorder = null;
this.leftBorder = null;
this.bottomBorder = null;
this.rightBorder = null;
this.borderColor = null;
this.topBorderColor = null;
this.leftBorderColor = null;
this.bottomBorderColor = null;
this.rightBorderColor = null;
this.padding = null;
this.topPadding = null;
this.leftPadding = null;
this.bottomPadding = null;
this.rightPadding = null;
this.scaleImage = image.getOwnScaleImage();
this.horizontalAlignment = image.getOwnHorizontalAlignment();
this.verticalAlignment = image.getOwnVerticalAlignment();
this.isUsingCache = image.isOwnUsingCache();
this.isLazy = image.isLazy();
this.onErrorType = image.getOnErrorType();
this.evaluationTime = image.getEvaluationTime();
this.linkType = image.getLinkType();
this.hyperlinkTarget = image.getHyperlinkTarget();
this.hyperlinkParameters = JRBaseHyperlink.copyHyperlinkParameters((JRHyperlink)image, factory);
this.lineBox = image.getLineBox().clone((JRBoxContainer)this);
this.evaluationGroup = factory.getGroup(image.getEvaluationGroup());
this.expression = factory.getExpression(image.getExpression());
this.anchorNameExpression = factory.getExpression(image.getAnchorNameExpression());
this.hyperlinkReferenceExpression = factory.getExpression(image.getHyperlinkReferenceExpression());
this.hyperlinkAnchorExpression = factory.getExpression(image.getHyperlinkAnchorExpression());
this.hyperlinkPageExpression = factory.getExpression(image.getHyperlinkPageExpression());
this.hyperlinkTooltipExpression = factory.getExpression(image.getHyperlinkTooltipExpression());
this.bookmarkLevel = image.getBookmarkLevel();
}
public byte getMode() {
return JRStyleResolver.getMode((JRCommonElement)this, (byte)2);
}
public byte getScaleImage() {
return JRStyleResolver.getScaleImage((JRCommonImage)this);
}
public Byte getOwnScaleImage() {
return this.scaleImage;
}
public void setScaleImage(byte scaleImage) {
setScaleImage(new Byte(scaleImage));
}
public void setScaleImage(Byte scaleImage) {
Object old = this.scaleImage;
this.scaleImage = scaleImage;
getEventSupport().firePropertyChange("scaleImage", old, this.scaleImage);
}
public byte getHorizontalAlignment() {
return JRStyleResolver.getHorizontalAlignment((JRAlignment)this);
}
public Byte getOwnHorizontalAlignment() {
return this.horizontalAlignment;
}
public void setHorizontalAlignment(byte horizontalAlignment) {
setHorizontalAlignment(new Byte(horizontalAlignment));
}
public void setHorizontalAlignment(Byte horizontalAlignment) {
Object old = this.horizontalAlignment;
this.horizontalAlignment = horizontalAlignment;
getEventSupport().firePropertyChange("horizontalAlignment", old, this.horizontalAlignment);
}
public byte getVerticalAlignment() {
return JRStyleResolver.getVerticalAlignment((JRAlignment)this);
}
public Byte getOwnVerticalAlignment() {
return this.verticalAlignment;
}
public void setVerticalAlignment(byte verticalAlignment) {
setVerticalAlignment(new Byte(verticalAlignment));
}
public void setVerticalAlignment(Byte verticalAlignment) {
Object old = this.verticalAlignment;
this.verticalAlignment = verticalAlignment;
getEventSupport().firePropertyChange("verticalAlignment", old, this.verticalAlignment);
}
public boolean isUsingCache() {
if (this.isUsingCache == null) {
if (getExpression() != null)
return String.class.getName().equals(getExpression().getValueClassName());
return true;
}
return this.isUsingCache.booleanValue();
}
public Boolean isOwnUsingCache() {
return this.isUsingCache;
}
public void setUsingCache(boolean isUsingCache) {
setUsingCache(isUsingCache ? Boolean.TRUE : Boolean.FALSE);
}
public void setUsingCache(Boolean isUsingCache) {
Object old = this.isUsingCache;
this.isUsingCache = isUsingCache;
getEventSupport().firePropertyChange("usingCache", old, this.isUsingCache);
}
public boolean isLazy() {
return this.isLazy;
}
public void setLazy(boolean isLazy) {
boolean old = this.isLazy;
this.isLazy = isLazy;
getEventSupport().firePropertyChange("lazy", old, this.isLazy);
}
public byte getOnErrorType() {
return this.onErrorType;
}
public void setOnErrorType(byte onErrorType) {
byte old = this.onErrorType;
this.onErrorType = onErrorType;
getEventSupport().firePropertyChange("onErrorType", old, this.onErrorType);
}
public byte getEvaluationTime() {
return this.evaluationTime;
}
public JRBox getBox() {
return (JRBox)new LineBoxWrapper(getLineBox());
}
public JRLineBox getLineBox() {
return this.lineBox;
}
public byte getHyperlinkType() {
return JRHyperlinkHelper.getHyperlinkType((JRHyperlink)this);
}
public byte getHyperlinkTarget() {
return this.hyperlinkTarget;
}
public JRGroup getEvaluationGroup() {
return this.evaluationGroup;
}
public JRExpression getExpression() {
return this.expression;
}
public JRExpression getAnchorNameExpression() {
return this.anchorNameExpression;
}
public JRExpression getHyperlinkReferenceExpression() {
return this.hyperlinkReferenceExpression;
}
public JRExpression getHyperlinkAnchorExpression() {
return this.hyperlinkAnchorExpression;
}
public JRExpression getHyperlinkPageExpression() {
return this.hyperlinkPageExpression;
}
public void collectExpressions(JRExpressionCollector collector) {
collector.collect(this);
}
public void visit(JRVisitor visitor) {
visitor.visitImage(this);
}
public int getBookmarkLevel() {
return this.bookmarkLevel;
}
public Float getDefaultLineWidth() {
return JRPen.LINE_WIDTH_0;
}
public byte getBorder() {
return JRPenUtil.getPenFromLinePen(this.lineBox.getPen());
}
public Byte getOwnBorder() {
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getPen());
}
public void setBorder(byte border) {
JRPenUtil.setLinePenFromPen(border, this.lineBox.getPen());
}
public void setBorder(Byte border) {
JRPenUtil.setLinePenFromPen(border, this.lineBox.getPen());
}
public Color getBorderColor() {
return this.lineBox.getPen().getLineColor();
}
public Color getOwnBorderColor() {
return this.lineBox.getPen().getOwnLineColor();
}
public void setBorderColor(Color borderColor) {
this.lineBox.getPen().setLineColor(borderColor);
}
public int getPadding() {
return this.lineBox.getPadding().intValue();
}
public Integer getOwnPadding() {
return this.lineBox.getOwnPadding();
}
public void setPadding(int padding) {
this.lineBox.setPadding(padding);
}
public void setPadding(Integer padding) {
this.lineBox.setPadding(padding);
}
public byte getTopBorder() {
return JRPenUtil.getPenFromLinePen(this.lineBox.getTopPen());
}
public Byte getOwnTopBorder() {
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getTopPen());
}
public void setTopBorder(byte topBorder) {
JRPenUtil.setLinePenFromPen(topBorder, this.lineBox.getTopPen());
}
public void setTopBorder(Byte topBorder) {
JRPenUtil.setLinePenFromPen(topBorder, this.lineBox.getTopPen());
}
public Color getTopBorderColor() {
return this.lineBox.getTopPen().getLineColor();
}
public Color getOwnTopBorderColor() {
return this.lineBox.getTopPen().getOwnLineColor();
}
public void setTopBorderColor(Color topBorderColor) {
this.lineBox.getTopPen().setLineColor(topBorderColor);
}
public int getTopPadding() {
return this.lineBox.getTopPadding().intValue();
}
public Integer getOwnTopPadding() {
return this.lineBox.getOwnTopPadding();
}
public void setTopPadding(int topPadding) {
this.lineBox.setTopPadding(topPadding);
}
public void setTopPadding(Integer topPadding) {
this.lineBox.setTopPadding(topPadding);
}
public byte getLeftBorder() {
return JRPenUtil.getPenFromLinePen(this.lineBox.getLeftPen());
}
public Byte getOwnLeftBorder() {
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getLeftPen());
}
public void setLeftBorder(byte leftBorder) {
JRPenUtil.setLinePenFromPen(leftBorder, this.lineBox.getLeftPen());
}
public void setLeftBorder(Byte leftBorder) {
JRPenUtil.setLinePenFromPen(leftBorder, this.lineBox.getLeftPen());
}
public Color getLeftBorderColor() {
return this.lineBox.getLeftPen().getLineColor();
}
public Color getOwnLeftBorderColor() {
return this.lineBox.getLeftPen().getOwnLineColor();
}
public void setLeftBorderColor(Color leftBorderColor) {
this.lineBox.getLeftPen().setLineColor(leftBorderColor);
}
public int getLeftPadding() {
return this.lineBox.getLeftPadding().intValue();
}
public Integer getOwnLeftPadding() {
return this.lineBox.getOwnLeftPadding();
}
public void setLeftPadding(int leftPadding) {
this.lineBox.setLeftPadding(leftPadding);
}
public void setLeftPadding(Integer leftPadding) {
this.lineBox.setLeftPadding(leftPadding);
}
public byte getBottomBorder() {
return JRPenUtil.getPenFromLinePen(this.lineBox.getBottomPen());
}
public Byte getOwnBottomBorder() {
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getBottomPen());
}
public void setBottomBorder(byte bottomBorder) {
JRPenUtil.setLinePenFromPen(bottomBorder, this.lineBox.getBottomPen());
}
public void setBottomBorder(Byte bottomBorder) {
JRPenUtil.setLinePenFromPen(bottomBorder, this.lineBox.getBottomPen());
}
public Color getBottomBorderColor() {
return this.lineBox.getBottomPen().getLineColor();
}
public Color getOwnBottomBorderColor() {
return this.lineBox.getBottomPen().getOwnLineColor();
}
public void setBottomBorderColor(Color bottomBorderColor) {
this.lineBox.getBottomPen().setLineColor(bottomBorderColor);
}
public int getBottomPadding() {
return this.lineBox.getBottomPadding().intValue();
}
public Integer getOwnBottomPadding() {
return this.lineBox.getOwnBottomPadding();
}
public void setBottomPadding(int bottomPadding) {
this.lineBox.setBottomPadding(bottomPadding);
}
public void setBottomPadding(Integer bottomPadding) {
this.lineBox.setBottomPadding(bottomPadding);
}
public byte getRightBorder() {
return JRPenUtil.getPenFromLinePen(this.lineBox.getRightPen());
}
public Byte getOwnRightBorder() {
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getRightPen());
}
public void setRightBorder(byte rightBorder) {
JRPenUtil.setLinePenFromPen(rightBorder, this.lineBox.getRightPen());
}
public void setRightBorder(Byte rightBorder) {
JRPenUtil.setLinePenFromPen(rightBorder, this.lineBox.getRightPen());
}
public Color getRightBorderColor() {
return this.lineBox.getRightPen().getLineColor();
}
public Color getOwnRightBorderColor() {
return this.lineBox.getRightPen().getOwnLineColor();
}
public void setRightBorderColor(Color rightBorderColor) {
this.lineBox.getRightPen().setLineColor(rightBorderColor);
}
public int getRightPadding() {
return this.lineBox.getRightPadding().intValue();
}
public Integer getOwnRightPadding() {
return this.lineBox.getOwnRightPadding();
}
public void setRightPadding(int rightPadding) {
this.lineBox.setRightPadding(rightPadding);
}
public void setRightPadding(Integer rightPadding) {
this.lineBox.setRightPadding(rightPadding);
}
public String getLinkType() {
return this.linkType;
}
public JRHyperlinkParameter[] getHyperlinkParameters() {
return this.hyperlinkParameters;
}
protected void normalizeLinkType() {
if (this.linkType == null)
this.linkType = JRHyperlinkHelper.getLinkType(this.hyperlinkType);
this.hyperlinkType = 0;
}
public JRExpression getHyperlinkTooltipExpression() {
return this.hyperlinkTooltipExpression;
}
public Object clone() {
JRBaseImage clone = (JRBaseImage)super.clone();
if (this.hyperlinkParameters != null) {
clone.hyperlinkParameters = new JRHyperlinkParameter[this.hyperlinkParameters.length];
for (int i = 0; i < this.hyperlinkParameters.length; i++)
clone.hyperlinkParameters[i] = (JRHyperlinkParameter)this.hyperlinkParameters[i].clone();
}
if (this.expression != null)
clone.expression = (JRExpression)this.expression.clone();
if (this.anchorNameExpression != null)
clone.anchorNameExpression = (JRExpression)this.anchorNameExpression.clone();
if (this.hyperlinkReferenceExpression != null)
clone.hyperlinkReferenceExpression = (JRExpression)this.hyperlinkReferenceExpression.clone();
if (this.hyperlinkAnchorExpression != null)
clone.hyperlinkAnchorExpression = (JRExpression)this.hyperlinkAnchorExpression.clone();
if (this.hyperlinkPageExpression != null)
clone.hyperlinkPageExpression = (JRExpression)this.hyperlinkPageExpression.clone();
if (this.hyperlinkTooltipExpression != null)
clone.hyperlinkTooltipExpression = (JRExpression)this.hyperlinkTooltipExpression.clone();
return clone;
}
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
if (this.lineBox == null) {
this.lineBox = new JRBaseLineBox((JRBoxContainer)this);
JRBoxUtil.setToBox(this.border, this.topBorder, this.leftBorder, this.bottomBorder, this.rightBorder, this.borderColor, this.topBorderColor, this.leftBorderColor, this.bottomBorderColor, this.rightBorderColor, this.padding, this.topPadding, this.leftPadding, this.bottomPadding, this.rightPadding, this.lineBox);
this.border = null;
this.topBorder = null;
this.leftBorder = null;
this.bottomBorder = null;
this.rightBorder = null;
this.borderColor = null;
this.topBorderColor = null;
this.leftBorderColor = null;
this.bottomBorderColor = null;
this.rightBorderColor = null;
this.padding = null;
this.topPadding = null;
this.leftPadding = null;
this.bottomPadding = null;
this.rightPadding = null;
}
normalizeLinkType();
}
}

View File

@@ -0,0 +1,43 @@
package net.sf.jasperreports.engine.base;
import net.sf.jasperreports.engine.JRExpressionCollector;
import net.sf.jasperreports.engine.JRGraphicElement;
import net.sf.jasperreports.engine.JRLine;
import net.sf.jasperreports.engine.JRVisitor;
public class JRBaseLine extends JRBaseGraphicElement implements JRLine {
private static final long serialVersionUID = 10200L;
public static final String PROPERTY_DIRECTION = "direction";
protected byte direction = 1;
protected JRBaseLine(JRLine line, JRBaseObjectFactory factory) {
super((JRGraphicElement)line, factory);
this.direction = line.getDirection();
}
public void setWidth(int width) {
if (width == 0)
width = 1;
super.setWidth(width);
}
public byte getDirection() {
return this.direction;
}
public void setDirection(byte direction) {
byte old = this.direction;
this.direction = direction;
getEventSupport().firePropertyChange("direction", old, this.direction);
}
public void collectExpressions(JRExpressionCollector collector) {
collector.collect(this);
}
public void visit(JRVisitor visitor) {
visitor.visitLine(this);
}
}

View File

@@ -0,0 +1,247 @@
package net.sf.jasperreports.engine.base;
import java.awt.Color;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRBoxContainer;
import net.sf.jasperreports.engine.JRDefaultStyleProvider;
import net.sf.jasperreports.engine.JRLineBox;
import net.sf.jasperreports.engine.JRPen;
import net.sf.jasperreports.engine.JRPenContainer;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.JRStyle;
import net.sf.jasperreports.engine.design.events.JRChangeEventsSupport;
import net.sf.jasperreports.engine.design.events.JRPropertyChangeSupport;
import net.sf.jasperreports.engine.util.JRStyleResolver;
public class JRBaseLineBox implements JRLineBox, JRPenContainer, Serializable, Cloneable, JRChangeEventsSupport {
private static final long serialVersionUID = 10200L;
public static final String PROPERTY_PADDING = "padding";
public static final String PROPERTY_TOP_PADDING = "topPadding";
public static final String PROPERTY_LEFT_PADDING = "leftPadding";
public static final String PROPERTY_BOTTOM_PADDING = "bottomPadding";
public static final String PROPERTY_RIGHT_PADDING = "rightPadding";
protected JRBoxContainer boxContainer = null;
protected JRBoxPen pen = null;
protected JRBoxPen topPen = null;
protected JRBoxPen leftPen = null;
protected JRBoxPen bottomPen = null;
protected JRBoxPen rightPen = null;
protected Integer padding = null;
protected Integer topPadding = null;
protected Integer leftPadding = null;
protected Integer bottomPadding = null;
protected Integer rightPadding = null;
private transient JRPropertyChangeSupport eventSupport;
public JRBaseLineBox(JRBoxContainer boxContainer) {
this.boxContainer = boxContainer;
this.pen = new JRBaseBoxPen(this);
this.topPen = new JRBaseBoxTopPen(this);
this.leftPen = new JRBaseBoxLeftPen(this);
this.bottomPen = new JRBaseBoxBottomPen(this);
this.rightPen = new JRBaseBoxRightPen(this);
}
public JRDefaultStyleProvider getDefaultStyleProvider() {
if (this.boxContainer != null)
return this.boxContainer.getDefaultStyleProvider();
return null;
}
public JRStyle getStyle() {
if (this.boxContainer != null)
return this.boxContainer.getStyle();
return null;
}
public String getStyleNameReference() {
if (this.boxContainer != null)
return this.boxContainer.getStyleNameReference();
return null;
}
public JRBoxContainer getBoxContainer() {
return this.boxContainer;
}
public Float getDefaultLineWidth() {
return JRPen.LINE_WIDTH_0;
}
public Color getDefaultLineColor() {
if (this.boxContainer != null)
return this.boxContainer.getDefaultLineColor();
return Color.black;
}
public JRBoxPen getPen() {
return this.pen;
}
public void copyPen(JRBoxPen pen) {
this.pen = pen.clone(this);
}
public JRBoxPen getTopPen() {
return this.topPen;
}
public void copyTopPen(JRBoxPen topPen) {
this.topPen = topPen.clone(this);
}
public JRBoxPen getLeftPen() {
return this.leftPen;
}
public void copyLeftPen(JRBoxPen leftPen) {
this.leftPen = leftPen.clone(this);
}
public JRBoxPen getBottomPen() {
return this.bottomPen;
}
public void copyBottomPen(JRBoxPen bottomPen) {
this.bottomPen = bottomPen.clone(this);
}
public JRBoxPen getRightPen() {
return this.rightPen;
}
public void copyRightPen(JRBoxPen rightPen) {
this.rightPen = rightPen.clone(this);
}
public Integer getPadding() {
return JRStyleResolver.getPadding(this);
}
public Integer getOwnPadding() {
return this.padding;
}
public void setPadding(int padding) {
setPadding(new Integer(padding));
}
public void setPadding(Integer padding) {
Object old = this.padding;
this.padding = padding;
getEventSupport().firePropertyChange("padding", old, this.padding);
}
public Integer getTopPadding() {
return JRStyleResolver.getTopPadding(this);
}
public Integer getOwnTopPadding() {
return this.topPadding;
}
public void setTopPadding(int topPadding) {
setTopPadding(new Integer(topPadding));
}
public void setTopPadding(Integer topPadding) {
Object old = this.topPadding;
this.topPadding = topPadding;
getEventSupport().firePropertyChange("topPadding", old, this.topPadding);
}
public Integer getLeftPadding() {
return JRStyleResolver.getLeftPadding(this);
}
public Integer getOwnLeftPadding() {
return this.leftPadding;
}
public void setLeftPadding(int leftPadding) {
setLeftPadding(new Integer(leftPadding));
}
public void setLeftPadding(Integer leftPadding) {
Object old = this.leftPadding;
this.leftPadding = leftPadding;
getEventSupport().firePropertyChange("leftPadding", old, this.leftPadding);
}
public Integer getBottomPadding() {
return JRStyleResolver.getBottomPadding(this);
}
public Integer getOwnBottomPadding() {
return this.bottomPadding;
}
public void setBottomPadding(int bottomPadding) {
setBottomPadding(new Integer(bottomPadding));
}
public void setBottomPadding(Integer bottomPadding) {
Object old = this.bottomPadding;
this.bottomPadding = bottomPadding;
getEventSupport().firePropertyChange("bottomPadding", old, this.bottomPadding);
}
public Integer getRightPadding() {
return JRStyleResolver.getRightPadding(this);
}
public Integer getOwnRightPadding() {
return this.rightPadding;
}
public void setRightPadding(int rightPadding) {
setRightPadding(new Integer(rightPadding));
}
public void setRightPadding(Integer rightPadding) {
Object old = this.rightPadding;
this.rightPadding = rightPadding;
getEventSupport().firePropertyChange("rightPadding", old, this.rightPadding);
}
public JRLineBox clone(JRBoxContainer boxContainer) {
JRBaseLineBox clone = null;
try {
clone = (JRBaseLineBox)clone();
} catch (CloneNotSupportedException e) {
throw new JRRuntimeException(e);
}
clone.boxContainer = boxContainer;
clone.pen = this.pen.clone(clone);
clone.topPen = this.topPen.clone(clone);
clone.leftPen = this.leftPen.clone(clone);
clone.bottomPen = this.bottomPen.clone(clone);
clone.rightPen = this.rightPen.clone(clone);
return clone;
}
public JRPropertyChangeSupport getEventSupport() {
synchronized (this) {
if (this.eventSupport == null)
this.eventSupport = new JRPropertyChangeSupport(this);
}
return this.eventSupport;
}
}

View File

@@ -0,0 +1,882 @@
package net.sf.jasperreports.engine.base;
import net.sf.jasperreports.charts.JRAreaPlot;
import net.sf.jasperreports.charts.JRBar3DPlot;
import net.sf.jasperreports.charts.JRBarPlot;
import net.sf.jasperreports.charts.JRBubblePlot;
import net.sf.jasperreports.charts.JRCandlestickPlot;
import net.sf.jasperreports.charts.JRCategoryDataset;
import net.sf.jasperreports.charts.JRCategorySeries;
import net.sf.jasperreports.charts.JRChartAxis;
import net.sf.jasperreports.charts.JRHighLowDataset;
import net.sf.jasperreports.charts.JRHighLowPlot;
import net.sf.jasperreports.charts.JRLinePlot;
import net.sf.jasperreports.charts.JRMeterPlot;
import net.sf.jasperreports.charts.JRMultiAxisPlot;
import net.sf.jasperreports.charts.JRPie3DPlot;
import net.sf.jasperreports.charts.JRPieDataset;
import net.sf.jasperreports.charts.JRPiePlot;
import net.sf.jasperreports.charts.JRScatterPlot;
import net.sf.jasperreports.charts.JRThermometerPlot;
import net.sf.jasperreports.charts.JRTimePeriodDataset;
import net.sf.jasperreports.charts.JRTimePeriodSeries;
import net.sf.jasperreports.charts.JRTimeSeries;
import net.sf.jasperreports.charts.JRTimeSeriesDataset;
import net.sf.jasperreports.charts.JRTimeSeriesPlot;
import net.sf.jasperreports.charts.JRValueDataset;
import net.sf.jasperreports.charts.JRXyDataset;
import net.sf.jasperreports.charts.JRXySeries;
import net.sf.jasperreports.charts.JRXyzDataset;
import net.sf.jasperreports.charts.JRXyzSeries;
import net.sf.jasperreports.charts.base.JRBaseAreaPlot;
import net.sf.jasperreports.charts.base.JRBaseBar3DPlot;
import net.sf.jasperreports.charts.base.JRBaseBarPlot;
import net.sf.jasperreports.charts.base.JRBaseBubblePlot;
import net.sf.jasperreports.charts.base.JRBaseCandlestickPlot;
import net.sf.jasperreports.charts.base.JRBaseCategoryDataset;
import net.sf.jasperreports.charts.base.JRBaseCategorySeries;
import net.sf.jasperreports.charts.base.JRBaseChartAxis;
import net.sf.jasperreports.charts.base.JRBaseHighLowDataset;
import net.sf.jasperreports.charts.base.JRBaseHighLowPlot;
import net.sf.jasperreports.charts.base.JRBaseLinePlot;
import net.sf.jasperreports.charts.base.JRBaseMeterPlot;
import net.sf.jasperreports.charts.base.JRBaseMultiAxisPlot;
import net.sf.jasperreports.charts.base.JRBasePie3DPlot;
import net.sf.jasperreports.charts.base.JRBasePieDataset;
import net.sf.jasperreports.charts.base.JRBasePiePlot;
import net.sf.jasperreports.charts.base.JRBaseScatterPlot;
import net.sf.jasperreports.charts.base.JRBaseThermometerPlot;
import net.sf.jasperreports.charts.base.JRBaseTimePeriodDataset;
import net.sf.jasperreports.charts.base.JRBaseTimePeriodSeries;
import net.sf.jasperreports.charts.base.JRBaseTimeSeries;
import net.sf.jasperreports.charts.base.JRBaseTimeSeriesDataset;
import net.sf.jasperreports.charts.base.JRBaseTimeSeriesPlot;
import net.sf.jasperreports.charts.base.JRBaseValueDataset;
import net.sf.jasperreports.charts.base.JRBaseXyDataset;
import net.sf.jasperreports.charts.base.JRBaseXySeries;
import net.sf.jasperreports.charts.base.JRBaseXyzDataset;
import net.sf.jasperreports.charts.base.JRBaseXyzSeries;
import net.sf.jasperreports.crosstabs.JRCellContents;
import net.sf.jasperreports.crosstabs.JRCrosstab;
import net.sf.jasperreports.crosstabs.JRCrosstabBucket;
import net.sf.jasperreports.crosstabs.JRCrosstabCell;
import net.sf.jasperreports.crosstabs.JRCrosstabColumnGroup;
import net.sf.jasperreports.crosstabs.JRCrosstabDataset;
import net.sf.jasperreports.crosstabs.JRCrosstabMeasure;
import net.sf.jasperreports.crosstabs.JRCrosstabParameter;
import net.sf.jasperreports.crosstabs.JRCrosstabRowGroup;
import net.sf.jasperreports.crosstabs.base.JRBaseCellContents;
import net.sf.jasperreports.crosstabs.base.JRBaseCrosstab;
import net.sf.jasperreports.crosstabs.base.JRBaseCrosstabBucket;
import net.sf.jasperreports.crosstabs.base.JRBaseCrosstabCell;
import net.sf.jasperreports.crosstabs.base.JRBaseCrosstabColumnGroup;
import net.sf.jasperreports.crosstabs.base.JRBaseCrosstabDataset;
import net.sf.jasperreports.crosstabs.base.JRBaseCrosstabMeasure;
import net.sf.jasperreports.crosstabs.base.JRBaseCrosstabParameter;
import net.sf.jasperreports.crosstabs.base.JRBaseCrosstabRowGroup;
import net.sf.jasperreports.engine.JRAbstractObjectFactory;
import net.sf.jasperreports.engine.JRBand;
import net.sf.jasperreports.engine.JRBreak;
import net.sf.jasperreports.engine.JRChart;
import net.sf.jasperreports.engine.JRConditionalStyle;
import net.sf.jasperreports.engine.JRDataset;
import net.sf.jasperreports.engine.JRDatasetParameter;
import net.sf.jasperreports.engine.JRDatasetRun;
import net.sf.jasperreports.engine.JRDefaultStyleProvider;
import net.sf.jasperreports.engine.JRElementGroup;
import net.sf.jasperreports.engine.JREllipse;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.JRExpressionChunk;
import net.sf.jasperreports.engine.JRExpressionCollector;
import net.sf.jasperreports.engine.JRField;
import net.sf.jasperreports.engine.JRFrame;
import net.sf.jasperreports.engine.JRGroup;
import net.sf.jasperreports.engine.JRHyperlink;
import net.sf.jasperreports.engine.JRHyperlinkParameter;
import net.sf.jasperreports.engine.JRImage;
import net.sf.jasperreports.engine.JRLine;
import net.sf.jasperreports.engine.JRParameter;
import net.sf.jasperreports.engine.JRPropertyExpression;
import net.sf.jasperreports.engine.JRQuery;
import net.sf.jasperreports.engine.JRQueryChunk;
import net.sf.jasperreports.engine.JRRectangle;
import net.sf.jasperreports.engine.JRReportFont;
import net.sf.jasperreports.engine.JRReportTemplate;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.JRSortField;
import net.sf.jasperreports.engine.JRStaticText;
import net.sf.jasperreports.engine.JRStyle;
import net.sf.jasperreports.engine.JRStyleContainer;
import net.sf.jasperreports.engine.JRStyleSetter;
import net.sf.jasperreports.engine.JRSubreport;
import net.sf.jasperreports.engine.JRSubreportParameter;
import net.sf.jasperreports.engine.JRSubreportReturnValue;
import net.sf.jasperreports.engine.JRTextField;
import net.sf.jasperreports.engine.JRVariable;
public class JRBaseObjectFactory extends JRAbstractObjectFactory {
private JRDefaultStyleProvider defaultStyleProvider = null;
private JRExpressionCollector expressionCollector;
protected JRBaseObjectFactory(JRDefaultStyleProvider defaultStyleProvider) {
this.defaultStyleProvider = defaultStyleProvider;
}
protected JRBaseObjectFactory(JRDefaultStyleProvider defaultStyleProvider, JRExpressionCollector expressionCollector) {
this.defaultStyleProvider = defaultStyleProvider;
this.expressionCollector = expressionCollector;
}
public JRDefaultStyleProvider getDefaultStyleProvider() {
return this.defaultStyleProvider;
}
public JRReportFont getReportFont(JRReportFont font) {
JRBaseReportFont baseFont = null;
if (font != null) {
baseFont = (JRBaseReportFont)get(font);
if (baseFont == null) {
baseFont = new JRBaseReportFont(font);
put(font, baseFont);
}
}
return baseFont;
}
public JRStyle getStyle(JRStyle style) {
JRBaseStyle baseStyle = null;
if (style != null) {
baseStyle = (JRBaseStyle)get(style);
if (baseStyle == null) {
baseStyle = new JRBaseStyle(style, this);
put(style, baseStyle);
}
}
return baseStyle;
}
public void setStyle(JRStyleSetter setter, JRStyleContainer styleContainer) {
JRStyle style = styleContainer.getStyle();
String nameReference = styleContainer.getStyleNameReference();
if (style != null) {
JRStyle newStyle = getStyle(style);
setter.setStyle(newStyle);
} else if (nameReference != null) {
handleStyleNameReference(setter, nameReference);
}
}
protected void handleStyleNameReference(JRStyleSetter setter, String nameReference) {
setter.setStyleNameReference(nameReference);
}
protected JRBaseParameter getParameter(JRParameter parameter) {
JRBaseParameter baseParameter = null;
if (parameter != null) {
baseParameter = (JRBaseParameter)get(parameter);
if (baseParameter == null)
baseParameter = new JRBaseParameter(parameter, this);
}
return baseParameter;
}
protected JRBaseQuery getQuery(JRQuery query) {
JRBaseQuery baseQuery = null;
if (query != null) {
baseQuery = (JRBaseQuery)get(query);
if (baseQuery == null)
baseQuery = new JRBaseQuery(query, this);
}
return baseQuery;
}
protected JRBaseQueryChunk getQueryChunk(JRQueryChunk queryChunk) {
JRBaseQueryChunk baseQueryChunk = null;
if (queryChunk != null) {
baseQueryChunk = (JRBaseQueryChunk)get(queryChunk);
if (baseQueryChunk == null)
baseQueryChunk = new JRBaseQueryChunk(queryChunk, this);
}
return baseQueryChunk;
}
protected JRBaseField getField(JRField field) {
JRBaseField baseField = null;
if (field != null) {
baseField = (JRBaseField)get(field);
if (baseField == null)
baseField = new JRBaseField(field, this);
}
return baseField;
}
protected JRBaseSortField getSortField(JRSortField sortField) {
JRBaseSortField baseSortField = null;
if (sortField != null) {
baseSortField = (JRBaseSortField)get(sortField);
if (baseSortField == null)
baseSortField = new JRBaseSortField(sortField, this);
}
return baseSortField;
}
public JRBaseVariable getVariable(JRVariable variable) {
JRBaseVariable baseVariable = null;
if (variable != null) {
baseVariable = (JRBaseVariable)get(variable);
if (baseVariable == null)
baseVariable = new JRBaseVariable(variable, this);
}
return baseVariable;
}
public JRExpression getExpression(JRExpression expression, boolean assignNotUsedId) {
JRBaseExpression baseExpression = null;
if (expression != null) {
baseExpression = (JRBaseExpression)get(expression);
if (baseExpression == null) {
Integer expressionId = getCollectedExpressionId(expression, assignNotUsedId);
baseExpression = new JRBaseExpression(expression, this, expressionId);
}
}
return baseExpression;
}
private Integer getCollectedExpressionId(JRExpression expression, boolean assignNotUsedId) {
Integer expressionId = null;
if (this.expressionCollector != null) {
expressionId = this.expressionCollector.getExpressionId(expression);
if (expressionId == null)
if (assignNotUsedId) {
expressionId = JRExpression.NOT_USED_ID;
} else {
throw new JRRuntimeException("Expression ID not found for expression <<" + expression.getText() + ">>.");
}
}
return expressionId;
}
protected JRBaseExpressionChunk getExpressionChunk(JRExpressionChunk expressionChunk) {
JRBaseExpressionChunk baseExpressionChunk = null;
if (expressionChunk != null) {
baseExpressionChunk = (JRBaseExpressionChunk)get(expressionChunk);
if (baseExpressionChunk == null)
baseExpressionChunk = new JRBaseExpressionChunk(expressionChunk, this);
}
return baseExpressionChunk;
}
protected JRBaseGroup getGroup(JRGroup group) {
JRBaseGroup baseGroup = null;
if (group != null) {
baseGroup = (JRBaseGroup)get(group);
if (baseGroup == null)
baseGroup = new JRBaseGroup(group, this);
}
return baseGroup;
}
protected JRBaseBand getBand(JRBand band) {
JRBaseBand baseBand = null;
if (band != null) {
baseBand = (JRBaseBand)get(band);
if (baseBand == null)
baseBand = new JRBaseBand(band, this);
}
return baseBand;
}
public void visitElementGroup(JRElementGroup elementGroup) {
JRElementGroup baseElementGroup = null;
if (elementGroup != null) {
baseElementGroup = (JRElementGroup)get(elementGroup);
if (baseElementGroup == null)
baseElementGroup = new JRBaseElementGroup(elementGroup, this);
}
setVisitResult(baseElementGroup);
}
public void visitBreak(JRBreak breakElement) {
JRBaseBreak baseBreak = null;
if (breakElement != null) {
baseBreak = (JRBaseBreak)get(breakElement);
if (baseBreak == null)
baseBreak = new JRBaseBreak(breakElement, this);
}
setVisitResult(baseBreak);
}
public void visitLine(JRLine line) {
JRBaseLine baseLine = null;
if (line != null) {
baseLine = (JRBaseLine)get(line);
if (baseLine == null)
baseLine = new JRBaseLine(line, this);
}
setVisitResult(baseLine);
}
public void visitRectangle(JRRectangle rectangle) {
JRBaseRectangle baseRectangle = null;
if (rectangle != null) {
baseRectangle = (JRBaseRectangle)get(rectangle);
if (baseRectangle == null)
baseRectangle = new JRBaseRectangle(rectangle, this);
}
setVisitResult(baseRectangle);
}
public void visitEllipse(JREllipse ellipse) {
JRBaseEllipse baseEllipse = null;
if (ellipse != null) {
baseEllipse = (JRBaseEllipse)get(ellipse);
if (baseEllipse == null)
baseEllipse = new JRBaseEllipse(ellipse, this);
}
setVisitResult(baseEllipse);
}
public void visitImage(JRImage image) {
JRBaseImage baseImage = null;
if (image != null) {
baseImage = (JRBaseImage)get(image);
if (baseImage == null)
baseImage = new JRBaseImage(image, this);
}
setVisitResult(baseImage);
}
public void visitStaticText(JRStaticText staticText) {
JRBaseStaticText baseStaticText = null;
if (staticText != null) {
baseStaticText = (JRBaseStaticText)get(staticText);
if (baseStaticText == null)
baseStaticText = new JRBaseStaticText(staticText, this);
}
setVisitResult(baseStaticText);
}
public void visitTextField(JRTextField textField) {
JRBaseTextField baseTextField = null;
if (textField != null) {
baseTextField = (JRBaseTextField)get(textField);
if (baseTextField == null)
baseTextField = new JRBaseTextField(textField, this);
}
setVisitResult(baseTextField);
}
public void visitSubreport(JRSubreport subreport) {
JRBaseSubreport baseSubreport = null;
if (subreport != null) {
baseSubreport = (JRBaseSubreport)get(subreport);
if (baseSubreport == null)
baseSubreport = new JRBaseSubreport(subreport, this);
}
setVisitResult(baseSubreport);
}
protected JRBaseSubreportParameter getSubreportParameter(JRSubreportParameter subreportParameter) {
JRBaseSubreportParameter baseSubreportParameter = null;
if (subreportParameter != null) {
baseSubreportParameter = (JRBaseSubreportParameter)get(subreportParameter);
if (baseSubreportParameter == null) {
baseSubreportParameter = new JRBaseSubreportParameter(subreportParameter, this);
put(subreportParameter, baseSubreportParameter);
}
}
return baseSubreportParameter;
}
protected JRBaseDatasetParameter getDatasetParameter(JRDatasetParameter datasetParameter) {
JRBaseDatasetParameter baseSubreportParameter = null;
if (datasetParameter != null) {
baseSubreportParameter = (JRBaseDatasetParameter)get(datasetParameter);
if (baseSubreportParameter == null) {
baseSubreportParameter = new JRBaseDatasetParameter(datasetParameter, this);
put(datasetParameter, baseSubreportParameter);
}
}
return baseSubreportParameter;
}
public JRPieDataset getPieDataset(JRPieDataset pieDataset) {
JRBasePieDataset basePieDataset = null;
if (pieDataset != null) {
basePieDataset = (JRBasePieDataset)get(pieDataset);
if (basePieDataset == null)
basePieDataset = new JRBasePieDataset(pieDataset, this);
}
return (JRPieDataset)basePieDataset;
}
public JRPiePlot getPiePlot(JRPiePlot piePlot) {
JRBasePiePlot basePiePlot = null;
if (piePlot != null) {
basePiePlot = (JRBasePiePlot)get(piePlot);
if (basePiePlot == null)
basePiePlot = new JRBasePiePlot(piePlot, this);
}
return (JRPiePlot)basePiePlot;
}
public JRPie3DPlot getPie3DPlot(JRPie3DPlot pie3DPlot) {
JRBasePie3DPlot basePie3DPlot = null;
if (pie3DPlot != null) {
basePie3DPlot = (JRBasePie3DPlot)get(pie3DPlot);
if (basePie3DPlot == null)
basePie3DPlot = new JRBasePie3DPlot(pie3DPlot, this);
}
return (JRPie3DPlot)basePie3DPlot;
}
public JRCategoryDataset getCategoryDataset(JRCategoryDataset categoryDataset) {
JRBaseCategoryDataset baseCategoryDataset = null;
if (categoryDataset != null) {
baseCategoryDataset = (JRBaseCategoryDataset)get(categoryDataset);
if (baseCategoryDataset == null)
baseCategoryDataset = new JRBaseCategoryDataset(categoryDataset, this);
}
return (JRCategoryDataset)baseCategoryDataset;
}
public JRTimeSeriesDataset getTimeSeriesDataset(JRTimeSeriesDataset timeSeriesDataset) {
JRBaseTimeSeriesDataset baseTimeSeriesDataset = null;
if (timeSeriesDataset != null) {
baseTimeSeriesDataset = (JRBaseTimeSeriesDataset)get(timeSeriesDataset);
if (baseTimeSeriesDataset == null)
baseTimeSeriesDataset = new JRBaseTimeSeriesDataset(timeSeriesDataset, this);
}
return (JRTimeSeriesDataset)baseTimeSeriesDataset;
}
public JRTimePeriodDataset getTimePeriodDataset(JRTimePeriodDataset timePeriodDataset) {
JRBaseTimePeriodDataset baseTimePeriodDataset = null;
if (timePeriodDataset != null) {
baseTimePeriodDataset = (JRBaseTimePeriodDataset)get(timePeriodDataset);
if (baseTimePeriodDataset == null)
baseTimePeriodDataset = new JRBaseTimePeriodDataset(timePeriodDataset, this);
}
return (JRTimePeriodDataset)baseTimePeriodDataset;
}
public JRCategorySeries getCategorySeries(JRCategorySeries categorySeries) {
JRBaseCategorySeries baseCategorySeries = null;
if (categorySeries != null) {
baseCategorySeries = (JRBaseCategorySeries)get(categorySeries);
if (baseCategorySeries == null)
baseCategorySeries = new JRBaseCategorySeries(categorySeries, this);
}
return (JRCategorySeries)baseCategorySeries;
}
public JRXySeries getXySeries(JRXySeries xySeries) {
JRBaseXySeries baseXySeries = null;
if (xySeries != null) {
baseXySeries = (JRBaseXySeries)get(xySeries);
if (baseXySeries == null)
baseXySeries = new JRBaseXySeries(xySeries, this);
}
return (JRXySeries)baseXySeries;
}
public JRTimeSeries getTimeSeries(JRTimeSeries timeSeries) {
JRBaseTimeSeries baseTimeSeries = null;
if (timeSeries != null) {
baseTimeSeries = (JRBaseTimeSeries)get(timeSeries);
if (baseTimeSeries == null)
baseTimeSeries = new JRBaseTimeSeries(timeSeries, this);
}
return (JRTimeSeries)baseTimeSeries;
}
public JRTimePeriodSeries getTimePeriodSeries(JRTimePeriodSeries timePeriodSeries) {
JRBaseTimePeriodSeries baseTimePeriodSeries = null;
if (timePeriodSeries != null) {
baseTimePeriodSeries = (JRBaseTimePeriodSeries)get(timePeriodSeries);
if (baseTimePeriodSeries == null)
baseTimePeriodSeries = new JRBaseTimePeriodSeries(timePeriodSeries, this);
}
return (JRTimePeriodSeries)baseTimePeriodSeries;
}
public JRBarPlot getBarPlot(JRBarPlot barPlot) {
JRBaseBarPlot baseBarPlot = null;
if (barPlot != null) {
baseBarPlot = (JRBaseBarPlot)get(barPlot);
if (baseBarPlot == null)
baseBarPlot = new JRBaseBarPlot(barPlot, this);
}
return (JRBarPlot)baseBarPlot;
}
public JRBar3DPlot getBar3DPlot(JRBar3DPlot barPlot) {
JRBaseBar3DPlot baseBarPlot = null;
if (barPlot != null) {
baseBarPlot = (JRBaseBar3DPlot)get(barPlot);
if (baseBarPlot == null)
baseBarPlot = new JRBaseBar3DPlot(barPlot, this);
}
return (JRBar3DPlot)baseBarPlot;
}
public JRLinePlot getLinePlot(JRLinePlot linePlot) {
JRBaseLinePlot baseLinePlot = null;
if (linePlot != null) {
baseLinePlot = (JRBaseLinePlot)get(linePlot);
if (baseLinePlot == null)
baseLinePlot = new JRBaseLinePlot(linePlot, this);
}
return (JRLinePlot)baseLinePlot;
}
public JRAreaPlot getAreaPlot(JRAreaPlot areaPlot) {
JRBaseAreaPlot baseAreaPlot = null;
if (areaPlot != null) {
baseAreaPlot = (JRBaseAreaPlot)get(areaPlot);
if (baseAreaPlot == null)
baseAreaPlot = new JRBaseAreaPlot(areaPlot, this);
}
return (JRAreaPlot)baseAreaPlot;
}
public JRXyzDataset getXyzDataset(JRXyzDataset xyzDataset) {
JRBaseXyzDataset baseXyzDataset = null;
if (xyzDataset != null) {
baseXyzDataset = (JRBaseXyzDataset)get(xyzDataset);
if (baseXyzDataset == null)
baseXyzDataset = new JRBaseXyzDataset(xyzDataset, this);
}
return (JRXyzDataset)baseXyzDataset;
}
public JRXyDataset getXyDataset(JRXyDataset xyDataset) {
JRBaseXyDataset baseXyDataset = null;
if (xyDataset != null) {
baseXyDataset = (JRBaseXyDataset)get(xyDataset);
if (baseXyDataset == null)
baseXyDataset = new JRBaseXyDataset(xyDataset, this);
}
return (JRXyDataset)baseXyDataset;
}
public JRHighLowDataset getHighLowDataset(JRHighLowDataset highLowDataset) {
JRBaseHighLowDataset baseHighLowDataset = null;
if (highLowDataset != null) {
baseHighLowDataset = (JRBaseHighLowDataset)get(highLowDataset);
if (baseHighLowDataset == null)
baseHighLowDataset = new JRBaseHighLowDataset(highLowDataset, this);
}
return (JRHighLowDataset)baseHighLowDataset;
}
public JRXyzSeries getXyzSeries(JRXyzSeries xyzSeries) {
JRBaseXyzSeries baseXyzSeries = null;
if (xyzSeries != null) {
baseXyzSeries = (JRBaseXyzSeries)get(xyzSeries);
if (baseXyzSeries == null)
baseXyzSeries = new JRBaseXyzSeries(xyzSeries, this);
}
return (JRXyzSeries)baseXyzSeries;
}
public JRBubblePlot getBubblePlot(JRBubblePlot bubblePlot) {
JRBaseBubblePlot baseBubblePlot = null;
if (bubblePlot != null) {
baseBubblePlot = (JRBaseBubblePlot)get(bubblePlot);
if (baseBubblePlot == null)
baseBubblePlot = new JRBaseBubblePlot(bubblePlot, this);
}
return (JRBubblePlot)baseBubblePlot;
}
public JRCandlestickPlot getCandlestickPlot(JRCandlestickPlot candlestickPlot) {
JRBaseCandlestickPlot baseCandlestickPlot = null;
if (candlestickPlot != null) {
baseCandlestickPlot = (JRBaseCandlestickPlot)get(candlestickPlot);
if (baseCandlestickPlot == null)
baseCandlestickPlot = new JRBaseCandlestickPlot(candlestickPlot, this);
}
return (JRCandlestickPlot)baseCandlestickPlot;
}
public JRHighLowPlot getHighLowPlot(JRHighLowPlot highLowPlot) {
JRBaseHighLowPlot baseHighLowPlot = null;
if (highLowPlot != null) {
baseHighLowPlot = (JRBaseHighLowPlot)get(highLowPlot);
if (baseHighLowPlot == null)
baseHighLowPlot = new JRBaseHighLowPlot(highLowPlot, this);
}
return (JRHighLowPlot)baseHighLowPlot;
}
public JRScatterPlot getScatterPlot(JRScatterPlot scatterPlot) {
JRBaseScatterPlot baseScatterPlot = null;
if (scatterPlot != null) {
baseScatterPlot = (JRBaseScatterPlot)get(scatterPlot);
if (baseScatterPlot == null)
baseScatterPlot = new JRBaseScatterPlot(scatterPlot, this);
}
return (JRScatterPlot)baseScatterPlot;
}
public JRTimeSeriesPlot getTimeSeriesPlot(JRTimeSeriesPlot plot) {
JRBaseTimeSeriesPlot basePlot = null;
if (plot != null) {
basePlot = (JRBaseTimeSeriesPlot)get(plot);
if (basePlot == null)
basePlot = new JRBaseTimeSeriesPlot(plot, this);
}
return (JRTimeSeriesPlot)basePlot;
}
public JRValueDataset getValueDataset(JRValueDataset valueDataset) {
JRBaseValueDataset baseValueDataset = null;
if (valueDataset != null) {
baseValueDataset = (JRBaseValueDataset)get(valueDataset);
if (baseValueDataset == null)
baseValueDataset = new JRBaseValueDataset(valueDataset, this);
}
return (JRValueDataset)baseValueDataset;
}
public JRMeterPlot getMeterPlot(JRMeterPlot meterPlot) {
JRBaseMeterPlot baseMeterPlot = null;
if (meterPlot != null) {
baseMeterPlot = (JRBaseMeterPlot)get(meterPlot);
if (baseMeterPlot == null)
baseMeterPlot = new JRBaseMeterPlot(meterPlot, this);
}
return (JRMeterPlot)baseMeterPlot;
}
public JRThermometerPlot getThermometerPlot(JRThermometerPlot thermometerPlot) {
JRBaseThermometerPlot baseThermometerPlot = null;
if (thermometerPlot != null) {
baseThermometerPlot = (JRBaseThermometerPlot)get(thermometerPlot);
if (baseThermometerPlot == null)
baseThermometerPlot = new JRBaseThermometerPlot(thermometerPlot, this);
}
return (JRThermometerPlot)baseThermometerPlot;
}
public JRMultiAxisPlot getMultiAxisPlot(JRMultiAxisPlot multiAxisPlot) {
JRBaseMultiAxisPlot baseMultiAxisPlot = null;
if (multiAxisPlot != null) {
baseMultiAxisPlot = (JRBaseMultiAxisPlot)get(baseMultiAxisPlot);
if (baseMultiAxisPlot == null)
baseMultiAxisPlot = new JRBaseMultiAxisPlot(multiAxisPlot, this);
}
return (JRMultiAxisPlot)baseMultiAxisPlot;
}
public void visitChart(JRChart chart) {
JRBaseChart baseChart = null;
if (chart != null) {
baseChart = (JRBaseChart)get(chart);
if (baseChart == null)
baseChart = new JRBaseChart(chart, this);
}
setVisitResult(baseChart);
}
protected JRBaseSubreportReturnValue getSubreportReturnValue(JRSubreportReturnValue returnValue) {
JRBaseSubreportReturnValue baseSubreportReturnValue = null;
if (returnValue != null) {
baseSubreportReturnValue = (JRBaseSubreportReturnValue)get(returnValue);
if (baseSubreportReturnValue == null) {
baseSubreportReturnValue = new JRBaseSubreportReturnValue(returnValue, this);
put(returnValue, baseSubreportReturnValue);
}
}
return baseSubreportReturnValue;
}
public JRConditionalStyle getConditionalStyle(JRConditionalStyle conditionalStyle, JRStyle style) {
JRBaseConditionalStyle baseConditionalStyle = null;
if (conditionalStyle != null) {
baseConditionalStyle = (JRBaseConditionalStyle)get(conditionalStyle);
if (baseConditionalStyle == null) {
baseConditionalStyle = new JRBaseConditionalStyle(conditionalStyle, style, this);
put(conditionalStyle, baseConditionalStyle);
}
}
return baseConditionalStyle;
}
public JRBaseCrosstabDataset getCrosstabDataset(JRCrosstabDataset crosstabDataset) {
JRBaseCrosstabDataset baseCrosstabDataset = null;
if (crosstabDataset != null) {
baseCrosstabDataset = (JRBaseCrosstabDataset)get(crosstabDataset);
if (baseCrosstabDataset == null)
baseCrosstabDataset = new JRBaseCrosstabDataset(crosstabDataset, this);
}
return baseCrosstabDataset;
}
public JRBaseCrosstabRowGroup getCrosstabRowGroup(JRCrosstabRowGroup group) {
JRBaseCrosstabRowGroup baseCrosstabRowGroup = null;
if (group != null) {
baseCrosstabRowGroup = (JRBaseCrosstabRowGroup)get(group);
if (baseCrosstabRowGroup == null)
baseCrosstabRowGroup = new JRBaseCrosstabRowGroup(group, this);
}
return baseCrosstabRowGroup;
}
public JRBaseCrosstabColumnGroup getCrosstabColumnGroup(JRCrosstabColumnGroup group) {
JRBaseCrosstabColumnGroup baseCrosstabDataset = null;
if (group != null) {
baseCrosstabDataset = (JRBaseCrosstabColumnGroup)get(group);
if (baseCrosstabDataset == null)
baseCrosstabDataset = new JRBaseCrosstabColumnGroup(group, this);
}
return baseCrosstabDataset;
}
public JRBaseCrosstabBucket getCrosstabBucket(JRCrosstabBucket bucket) {
JRBaseCrosstabBucket baseCrosstabBucket = null;
if (bucket != null) {
baseCrosstabBucket = (JRBaseCrosstabBucket)get(bucket);
if (baseCrosstabBucket == null)
baseCrosstabBucket = new JRBaseCrosstabBucket(bucket, this);
}
return baseCrosstabBucket;
}
public JRBaseCrosstabMeasure getCrosstabMeasure(JRCrosstabMeasure measure) {
JRBaseCrosstabMeasure baseCrosstabMeasure = null;
if (measure != null) {
baseCrosstabMeasure = (JRBaseCrosstabMeasure)get(measure);
if (baseCrosstabMeasure == null)
baseCrosstabMeasure = new JRBaseCrosstabMeasure(measure, this);
}
return baseCrosstabMeasure;
}
public void visitCrosstab(JRCrosstab crosstab) {
JRBaseCrosstab baseCrosstab = null;
if (crosstab != null) {
baseCrosstab = (JRBaseCrosstab)get(crosstab);
if (baseCrosstab == null) {
Integer id = this.expressionCollector.getCrosstabId(crosstab);
if (id == null)
throw new JRRuntimeException("Crosstab ID not found.");
baseCrosstab = new JRBaseCrosstab(crosstab, this, id.intValue());
}
}
setVisitResult(baseCrosstab);
}
public JRBaseDataset getDataset(JRDataset dataset) {
JRBaseDataset baseDataset = null;
if (dataset != null) {
baseDataset = (JRBaseDataset)get(dataset);
if (baseDataset == null)
baseDataset = new JRBaseDataset(dataset, this);
}
return baseDataset;
}
public JRBaseDatasetRun getDatasetRun(JRDatasetRun datasetRun) {
JRBaseDatasetRun baseDatasetRun = null;
if (datasetRun != null) {
baseDatasetRun = (JRBaseDatasetRun)get(datasetRun);
if (baseDatasetRun == null)
baseDatasetRun = new JRBaseDatasetRun(datasetRun, this);
}
return baseDatasetRun;
}
public JRBaseCellContents getCell(JRCellContents cell) {
JRBaseCellContents baseCell = null;
if (cell != null) {
baseCell = (JRBaseCellContents)get(cell);
if (baseCell == null)
baseCell = new JRBaseCellContents(cell, this);
}
return baseCell;
}
public JRCrosstabCell getCrosstabCell(JRCrosstabCell cell) {
JRBaseCrosstabCell baseCell = null;
if (cell != null) {
baseCell = (JRBaseCrosstabCell)get(cell);
if (baseCell == null)
baseCell = new JRBaseCrosstabCell(cell, this);
}
return (JRCrosstabCell)baseCell;
}
public JRBaseCrosstabParameter getCrosstabParameter(JRCrosstabParameter parameter) {
JRBaseCrosstabParameter baseParameter = null;
if (parameter != null) {
baseParameter = (JRBaseCrosstabParameter)get(parameter);
if (baseParameter == null)
baseParameter = new JRBaseCrosstabParameter(parameter, this);
}
return baseParameter;
}
public void visitFrame(JRFrame frame) {
JRBaseFrame baseFrame = null;
if (frame != null) {
baseFrame = (JRBaseFrame)get(frame);
if (baseFrame == null)
baseFrame = new JRBaseFrame(frame, this);
}
setVisitResult(baseFrame);
}
public JRHyperlinkParameter getHyperlinkParameter(JRHyperlinkParameter parameter) {
JRHyperlinkParameter baseParameter = null;
if (parameter != null) {
baseParameter = (JRHyperlinkParameter)get(parameter);
if (baseParameter == null)
baseParameter = new JRBaseHyperlinkParameter(parameter, this);
}
return baseParameter;
}
public JRHyperlink getHyperlink(JRHyperlink hyperlink) {
JRHyperlink link = null;
if (hyperlink != null) {
link = (JRHyperlink)get(hyperlink);
if (link == null)
link = new JRBaseHyperlink(hyperlink, this);
}
return link;
}
public JRChartAxis getChartAxis(JRChartAxis axis) {
JRBaseChartAxis jRBaseChartAxis;
JRChartAxis baseAxis = null;
if (axis != null) {
baseAxis = (JRChartAxis)get(axis);
if (baseAxis == null)
jRBaseChartAxis = new JRBaseChartAxis(axis, this);
}
return (JRChartAxis)jRBaseChartAxis;
}
public JRReportTemplate getReportTemplate(JRReportTemplate template) {
JRReportTemplate baseTemplate = null;
if (template != null) {
baseTemplate = (JRReportTemplate)get(template);
if (baseTemplate == null)
baseTemplate = new JRBaseReportTemplate(template, this);
}
return baseTemplate;
}
public JRPropertyExpression getPropertyExpression(JRPropertyExpression propertyExpression) {
JRPropertyExpression baseProp = null;
if (propertyExpression != null) {
baseProp = (JRPropertyExpression)get(propertyExpression);
if (baseProp == null)
baseProp = new JRBasePropertyExpression(propertyExpression, this);
}
return baseProp;
}
}

View File

@@ -0,0 +1,135 @@
package net.sf.jasperreports.engine.base;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.JRParameter;
import net.sf.jasperreports.engine.JRPropertiesHolder;
import net.sf.jasperreports.engine.JRPropertiesMap;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.design.events.JRChangeEventsSupport;
import net.sf.jasperreports.engine.design.events.JRPropertyChangeSupport;
import net.sf.jasperreports.engine.util.JRClassLoader;
public class JRBaseParameter implements JRParameter, Serializable, JRChangeEventsSupport {
private static final long serialVersionUID = 10200L;
public static final String PROPERTY_DESCRIPTION = "description";
protected String name = null;
protected String description = null;
protected String valueClassName = String.class.getName();
protected String valueClassRealName = null;
protected boolean isSystemDefined = false;
protected boolean isForPrompting = true;
protected transient Class valueClass = null;
protected JRExpression defaultValueExpression = null;
protected JRPropertiesMap propertiesMap;
private transient JRPropertyChangeSupport eventSupport;
protected JRBaseParameter() {
this.propertiesMap = new JRPropertiesMap();
}
protected JRBaseParameter(JRParameter parameter, JRBaseObjectFactory factory) {
factory.put(parameter, this);
this.name = parameter.getName();
this.description = parameter.getDescription();
this.valueClassName = parameter.getValueClassName();
this.isSystemDefined = parameter.isSystemDefined();
this.isForPrompting = parameter.isForPrompting();
this.defaultValueExpression = factory.getExpression(parameter.getDefaultValueExpression());
this.propertiesMap = parameter.getPropertiesMap().cloneProperties();
}
public String getName() {
return this.name;
}
public String getDescription() {
return this.description;
}
public void setDescription(String description) {
Object old = this.description;
this.description = description;
getEventSupport().firePropertyChange("description", old, this.description);
}
public Class getValueClass() {
if (this.valueClass == null) {
String className = getValueClassRealName();
if (className != null)
try {
this.valueClass = JRClassLoader.loadClassForName(className);
} catch (ClassNotFoundException e) {
throw new JRRuntimeException(e);
}
}
return this.valueClass;
}
public String getValueClassName() {
return this.valueClassName;
}
private String getValueClassRealName() {
if (this.valueClassRealName == null)
this.valueClassRealName = JRClassLoader.getClassRealName(this.valueClassName);
return this.valueClassRealName;
}
public boolean isSystemDefined() {
return this.isSystemDefined;
}
public boolean isForPrompting() {
return this.isForPrompting;
}
public JRExpression getDefaultValueExpression() {
return this.defaultValueExpression;
}
public boolean hasProperties() {
return (this.propertiesMap != null && this.propertiesMap.hasProperties());
}
public JRPropertiesMap getPropertiesMap() {
return this.propertiesMap;
}
public JRPropertiesHolder getParentProperties() {
return null;
}
public Object clone() {
JRBaseParameter clone = null;
try {
clone = (JRBaseParameter)super.clone();
} catch (CloneNotSupportedException e) {
throw new JRRuntimeException(e);
}
if (this.defaultValueExpression != null)
clone.defaultValueExpression = (JRExpression)this.defaultValueExpression.clone();
if (this.propertiesMap != null)
clone.propertiesMap = (JRPropertiesMap)this.propertiesMap.clone();
return clone;
}
public JRPropertyChangeSupport getEventSupport() {
synchronized (this) {
if (this.eventSupport == null)
this.eventSupport = new JRPropertyChangeSupport(this);
}
return this.eventSupport;
}
}

View File

@@ -0,0 +1,112 @@
package net.sf.jasperreports.engine.base;
import java.awt.Color;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRPen;
import net.sf.jasperreports.engine.JRPenContainer;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.JRStyleContainer;
import net.sf.jasperreports.engine.design.events.JRChangeEventsSupport;
import net.sf.jasperreports.engine.design.events.JRPropertyChangeSupport;
import net.sf.jasperreports.engine.util.JRStyleResolver;
public class JRBasePen implements JRPen, Serializable, Cloneable, JRChangeEventsSupport {
private static final long serialVersionUID = 10200L;
public static final String PROPERTY_LINE_WIDTH = "lineWidth";
public static final String PROPERTY_LINE_STYLE = "lineStyle";
public static final String PROPERTY_LINE_COLOR = "lineColor";
protected JRPenContainer penContainer = null;
protected Float lineWidth = null;
protected Byte lineStyle = null;
protected Color lineColor = null;
private transient JRPropertyChangeSupport eventSupport;
public JRBasePen(JRPenContainer penContainer) {
this.penContainer = penContainer;
}
public JRStyleContainer getStyleContainer() {
return (JRStyleContainer)this.penContainer;
}
public Float getLineWidth() {
return JRStyleResolver.getLineWidth(this, this.penContainer.getDefaultLineWidth());
}
public Float getOwnLineWidth() {
return this.lineWidth;
}
public void setLineWidth(float lineWidth) {
setLineWidth(new Float(lineWidth));
}
public void setLineWidth(Float lineWidth) {
Object old = this.lineWidth;
this.lineWidth = lineWidth;
getEventSupport().firePropertyChange("lineWidth", old, this.lineWidth);
}
public Byte getLineStyle() {
return JRStyleResolver.getLineStyle(this);
}
public Byte getOwnLineStyle() {
return this.lineStyle;
}
public void setLineStyle(byte lineStyle) {
setLineStyle(new Byte(lineStyle));
}
public void setLineStyle(Byte lineStyle) {
Object old = this.lineStyle;
this.lineStyle = lineStyle;
getEventSupport().firePropertyChange("lineStyle", old, this.lineStyle);
}
public Color getLineColor() {
return JRStyleResolver.getLineColor(this, this.penContainer.getDefaultLineColor());
}
public Color getOwnLineColor() {
return this.lineColor;
}
public void setLineColor(Color lineColor) {
Object old = this.lineColor;
this.lineColor = lineColor;
getEventSupport().firePropertyChange("lineColor", old, this.lineColor);
}
public String getStyleNameReference() {
return null;
}
public JRPen clone(JRPenContainer penContainer) {
JRBasePen clone = null;
try {
clone = (JRBasePen)clone();
} catch (CloneNotSupportedException e) {
throw new JRRuntimeException(e);
}
clone.penContainer = penContainer;
return clone;
}
public JRPropertyChangeSupport getEventSupport() {
synchronized (this) {
if (this.eventSupport == null)
this.eventSupport = new JRPropertyChangeSupport(this);
}
return this.eventSupport;
}
}

View File

@@ -0,0 +1,95 @@
package net.sf.jasperreports.engine.base;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRHyperlinkHelper;
import net.sf.jasperreports.engine.JRPrintHyperlink;
import net.sf.jasperreports.engine.JRPrintHyperlinkParameter;
import net.sf.jasperreports.engine.JRPrintHyperlinkParameters;
public class JRBasePrintHyperlink implements JRPrintHyperlink, Serializable {
private static final long serialVersionUID = 10200L;
private String linkType;
private byte hyperlinkTarget = 1;
private String hyperlinkReference;
private String hyperlinkAnchor;
private Integer hyperlinkPage;
private String hyperlinkTooltip;
private JRPrintHyperlinkParameters hyperlinkParameters;
public String getHyperlinkAnchor() {
return this.hyperlinkAnchor;
}
public Integer getHyperlinkPage() {
return this.hyperlinkPage;
}
public JRPrintHyperlinkParameters getHyperlinkParameters() {
return this.hyperlinkParameters;
}
public String getHyperlinkReference() {
return this.hyperlinkReference;
}
public byte getHyperlinkTarget() {
return this.hyperlinkTarget;
}
public byte getHyperlinkType() {
return JRHyperlinkHelper.getHyperlinkType(getLinkType());
}
public String getLinkType() {
return this.linkType;
}
public void setHyperlinkAnchor(String hyperlinkAnchor) {
this.hyperlinkAnchor = hyperlinkAnchor;
}
public void setHyperlinkPage(Integer hyperlinkPage) {
this.hyperlinkPage = hyperlinkPage;
}
public void setHyperlinkParameters(JRPrintHyperlinkParameters parameters) {
this.hyperlinkParameters = parameters;
}
public void setHyperlinkReference(String hyperlinkReference) {
this.hyperlinkReference = hyperlinkReference;
}
public void setHyperlinkTarget(byte hyperlinkTarget) {
this.hyperlinkTarget = hyperlinkTarget;
}
public void setHyperlinkType(byte hyperlinkType) {
setLinkType(JRHyperlinkHelper.getLinkType(hyperlinkType));
}
public void setLinkType(String type) {
this.linkType = type;
}
public void addHyperlinkParameter(JRPrintHyperlinkParameter parameter) {
if (this.hyperlinkParameters == null)
this.hyperlinkParameters = new JRPrintHyperlinkParameters();
this.hyperlinkParameters.addParameter(parameter);
}
public String getHyperlinkTooltip() {
return this.hyperlinkTooltip;
}
public void setHyperlinkTooltip(String hyperlinkTooltip) {
this.hyperlinkTooltip = hyperlinkTooltip;
}
}

View File

@@ -0,0 +1,25 @@
package net.sf.jasperreports.engine.base;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import net.sf.jasperreports.engine.JRPrintElement;
import net.sf.jasperreports.engine.JRPrintPage;
public class JRBasePrintPage implements JRPrintPage, Serializable {
private static final long serialVersionUID = 10200L;
protected List elements = new ArrayList();
public List getElements() {
return this.elements;
}
public void setElements(List elements) {
this.elements = elements;
}
public void addElement(JRPrintElement element) {
this.elements.add(element);
}
}

View File

@@ -0,0 +1,56 @@
package net.sf.jasperreports.engine.base;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.JRPropertyExpression;
import net.sf.jasperreports.engine.design.events.JRChangeEventsSupport;
import net.sf.jasperreports.engine.design.events.JRPropertyChangeSupport;
public class JRBasePropertyExpression implements JRPropertyExpression, Serializable, JRChangeEventsSupport {
private static final long serialVersionUID = 10200L;
public static final String PROPERTY_NAME = "name";
public static final String pROPERTY_VALUE_EXPRESSION = "valueExpression";
private String name;
private JRExpression valueExpression;
private transient JRPropertyChangeSupport eventSupport;
protected JRBasePropertyExpression() {}
public JRBasePropertyExpression(JRPropertyExpression propertyExpression, JRBaseObjectFactory factory) {
this.name = propertyExpression.getName();
this.valueExpression = factory.getExpression(propertyExpression.getValueExpression());
}
public String getName() {
return this.name;
}
public void setName(String name) {
Object old = this.name;
this.name = name;
getEventSupport().firePropertyChange("name", old, this.name);
}
public JRExpression getValueExpression() {
return this.valueExpression;
}
protected void setValueExpression(JRExpression valueExpression) {
Object old = this.valueExpression;
this.valueExpression = valueExpression;
getEventSupport().firePropertyChange("valueExpression", old, this.valueExpression);
}
public JRPropertyChangeSupport getEventSupport() {
synchronized (this) {
if (this.eventSupport == null)
this.eventSupport = new JRPropertyChangeSupport(this);
}
return this.eventSupport;
}
}

View File

@@ -0,0 +1,55 @@
package net.sf.jasperreports.engine.base;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRQuery;
import net.sf.jasperreports.engine.JRQueryChunk;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.util.JRQueryParser;
public class JRBaseQuery implements JRQuery, Serializable {
private static final long serialVersionUID = 10200L;
private JRQueryChunk[] chunks = null;
protected String language = "sql";
protected JRBaseQuery() {}
protected JRBaseQuery(JRQuery query, JRBaseObjectFactory factory) {
factory.put(query, this);
JRQueryChunk[] jrChunks = query.getChunks();
if (jrChunks != null && jrChunks.length > 0) {
this.chunks = new JRQueryChunk[jrChunks.length];
for (int i = 0; i < this.chunks.length; i++)
this.chunks[i] = factory.getQueryChunk(jrChunks[i]);
}
this.language = query.getLanguage();
}
public JRQueryChunk[] getChunks() {
return this.chunks;
}
public String getText() {
return JRQueryParser.instance().asText(getChunks());
}
public String getLanguage() {
return this.language;
}
public Object clone() {
JRBaseQuery clone = null;
try {
clone = (JRBaseQuery)super.clone();
} catch (CloneNotSupportedException e) {
throw new JRRuntimeException(e);
}
if (this.chunks != null) {
clone.chunks = new JRQueryChunk[this.chunks.length];
for (int i = 0; i < this.chunks.length; i++)
clone.chunks[i] = (JRQueryChunk)this.chunks[i].clone();
}
return clone;
}
}

View File

@@ -0,0 +1,53 @@
package net.sf.jasperreports.engine.base;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRQueryChunk;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.util.JRQueryParser;
public class JRBaseQueryChunk implements JRQueryChunk, Serializable {
private static final long serialVersionUID = 10200L;
protected byte type = 1;
protected String text = null;
protected String[] tokens;
protected JRBaseQueryChunk() {}
protected JRBaseQueryChunk(JRQueryChunk queryChunk, JRBaseObjectFactory factory) {
factory.put(queryChunk, this);
this.type = queryChunk.getType();
this.text = queryChunk.getText();
String[] chunkTokens = queryChunk.getTokens();
if (chunkTokens == null) {
this.tokens = null;
} else {
this.tokens = new String[chunkTokens.length];
System.arraycopy(chunkTokens, 0, this.tokens, 0, chunkTokens.length);
}
}
public byte getType() {
return this.type;
}
public String getText() {
if (this.type == 4)
return JRQueryParser.instance().asClauseText(getTokens());
return this.text;
}
public String[] getTokens() {
return this.tokens;
}
public Object clone() {
try {
return super.clone();
} catch (CloneNotSupportedException e) {
throw new JRRuntimeException(e);
}
}
}

View File

@@ -0,0 +1,45 @@
package net.sf.jasperreports.engine.base;
import net.sf.jasperreports.engine.JRCommonRectangle;
import net.sf.jasperreports.engine.JRExpressionCollector;
import net.sf.jasperreports.engine.JRGraphicElement;
import net.sf.jasperreports.engine.JRRectangle;
import net.sf.jasperreports.engine.JRVisitor;
import net.sf.jasperreports.engine.util.JRStyleResolver;
public class JRBaseRectangle extends JRBaseGraphicElement implements JRRectangle {
private static final long serialVersionUID = 10200L;
protected Integer radius;
protected JRBaseRectangle(JRRectangle rectangle, JRBaseObjectFactory factory) {
super((JRGraphicElement)rectangle, factory);
this.radius = rectangle.getOwnRadius();
}
public int getRadius() {
return JRStyleResolver.getRadius((JRCommonRectangle)this);
}
public Integer getOwnRadius() {
return this.radius;
}
public void setRadius(int radius) {
setRadius(new Integer(radius));
}
public void setRadius(Integer radius) {
Object old = this.radius;
this.radius = radius;
getEventSupport().firePropertyChange("radius", old, this.radius);
}
public void collectExpressions(JRExpressionCollector collector) {
collector.collect(this);
}
public void visit(JRVisitor visitor) {
visitor.visitRectangle(this);
}
}

View File

@@ -0,0 +1,415 @@
package net.sf.jasperreports.engine.base;
import java.io.Serializable;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import net.sf.jasperreports.engine.JRBand;
import net.sf.jasperreports.engine.JRDataset;
import net.sf.jasperreports.engine.JRDefaultStyleProvider;
import net.sf.jasperreports.engine.JRExpressionCollector;
import net.sf.jasperreports.engine.JRField;
import net.sf.jasperreports.engine.JRGroup;
import net.sf.jasperreports.engine.JRParameter;
import net.sf.jasperreports.engine.JRPropertiesHolder;
import net.sf.jasperreports.engine.JRPropertiesMap;
import net.sf.jasperreports.engine.JRQuery;
import net.sf.jasperreports.engine.JRReport;
import net.sf.jasperreports.engine.JRReportFont;
import net.sf.jasperreports.engine.JRReportTemplate;
import net.sf.jasperreports.engine.JRSortField;
import net.sf.jasperreports.engine.JRStyle;
import net.sf.jasperreports.engine.JRVariable;
import net.sf.jasperreports.engine.design.events.JRChangeEventsSupport;
import net.sf.jasperreports.engine.design.events.JRPropertyChangeSupport;
public class JRBaseReport implements JRReport, Serializable, JRChangeEventsSupport {
private static final long serialVersionUID = 10200L;
public static final String PROPERTY_WHEN_NO_DATA_TYPE = "whenNoDataType";
protected String name = null;
protected String language = "java";
protected int columnCount = 1;
protected byte printOrder = 1;
protected int pageWidth = 595;
protected int pageHeight = 842;
protected byte orientation = 1;
protected byte whenNoDataType = 1;
protected int columnWidth = 555;
protected int columnSpacing = 0;
protected int leftMargin = 20;
protected int rightMargin = 20;
protected int topMargin = 30;
protected int bottomMargin = 30;
protected boolean isTitleNewPage = false;
protected boolean isSummaryNewPage = false;
protected boolean isFloatColumnFooter = false;
protected boolean ignorePagination = false;
protected String formatFactoryClass = null;
protected Set importsSet = null;
protected JRReportTemplate[] templates;
protected JRReportFont defaultFont = null;
protected JRReportFont[] fonts = null;
protected JRStyle defaultStyle = null;
protected JRStyle[] styles = null;
protected JRDataset mainDataset;
protected JRDataset[] datasets;
protected JRBand background = null;
protected JRBand title = null;
protected JRBand pageHeader = null;
protected JRBand columnHeader = null;
protected JRBand detail = null;
protected JRBand columnFooter = null;
protected JRBand pageFooter = null;
protected JRBand lastPageFooter = null;
protected JRBand summary = null;
protected JRBand noData = null;
private transient JRPropertyChangeSupport eventSupport;
public JRBaseReport() {}
public JRBaseReport(JRReport report, JRExpressionCollector expressionCollector) {
this.name = report.getName();
this.language = report.getLanguage();
this.columnCount = report.getColumnCount();
this.printOrder = report.getPrintOrder();
this.pageWidth = report.getPageWidth();
this.pageHeight = report.getPageHeight();
this.orientation = report.getOrientation();
this.whenNoDataType = report.getWhenNoDataType();
this.columnWidth = report.getColumnWidth();
this.columnSpacing = report.getColumnSpacing();
this.leftMargin = report.getLeftMargin();
this.rightMargin = report.getRightMargin();
this.topMargin = report.getTopMargin();
this.bottomMargin = report.getBottomMargin();
this.isTitleNewPage = report.isTitleNewPage();
this.isSummaryNewPage = report.isSummaryNewPage();
this.isFloatColumnFooter = report.isFloatColumnFooter();
this.ignorePagination = report.isIgnorePagination();
this.formatFactoryClass = report.getFormatFactoryClass();
String[] imports = report.getImports();
if (imports != null && imports.length > 0) {
this.importsSet = new HashSet(imports.length);
this.importsSet.addAll(Arrays.asList(imports));
}
JRBaseObjectFactory factory = new JRBaseObjectFactory((JRDefaultStyleProvider)this, expressionCollector);
copyTemplates(report, factory);
this.defaultFont = factory.getReportFont(report.getDefaultFont());
JRReportFont[] jrFonts = report.getFonts();
if (jrFonts != null && jrFonts.length > 0) {
this.fonts = new JRReportFont[jrFonts.length];
for (int i = 0; i < this.fonts.length; i++)
this.fonts[i] = factory.getReportFont(jrFonts[i]);
}
this.defaultStyle = factory.getStyle(report.getDefaultStyle());
JRStyle[] jrStyles = report.getStyles();
if (jrStyles != null && jrStyles.length > 0) {
this.styles = new JRStyle[jrStyles.length];
for (int i = 0; i < this.styles.length; i++)
this.styles[i] = factory.getStyle(jrStyles[i]);
}
this.mainDataset = factory.getDataset(report.getMainDataset());
JRDataset[] datasetArray = report.getDatasets();
if (datasetArray != null && datasetArray.length > 0) {
this.datasets = new JRDataset[datasetArray.length];
for (int i = 0; i < this.datasets.length; i++)
this.datasets[i] = factory.getDataset(datasetArray[i]);
}
this.background = factory.getBand(report.getBackground());
this.title = factory.getBand(report.getTitle());
this.pageHeader = factory.getBand(report.getPageHeader());
this.columnHeader = factory.getBand(report.getColumnHeader());
this.detail = factory.getBand(report.getDetail());
this.columnFooter = factory.getBand(report.getColumnFooter());
this.pageFooter = factory.getBand(report.getPageFooter());
this.lastPageFooter = factory.getBand(report.getLastPageFooter());
this.summary = factory.getBand(report.getSummary());
this.noData = factory.getBand(report.getNoData());
}
protected void copyTemplates(JRReport report, JRBaseObjectFactory factory) {
JRReportTemplate[] reportTemplates = report.getTemplates();
if (reportTemplates == null || reportTemplates.length == 0) {
this.templates = null;
} else {
this.templates = new JRReportTemplate[reportTemplates.length];
for (int i = 0; i < reportTemplates.length; i++)
this.templates[i] = factory.getReportTemplate(reportTemplates[i]);
}
}
public JRBaseReport(JRReport report) {
this(report, null);
}
public String getName() {
return this.name;
}
public String getLanguage() {
return this.language;
}
public int getColumnCount() {
return this.columnCount;
}
public byte getPrintOrder() {
return this.printOrder;
}
public int getPageWidth() {
return this.pageWidth;
}
public int getPageHeight() {
return this.pageHeight;
}
public byte getOrientation() {
return this.orientation;
}
public byte getWhenNoDataType() {
return this.whenNoDataType;
}
public void setWhenNoDataType(byte whenNoDataType) {
byte old = getWhenNoDataType();
this.whenNoDataType = whenNoDataType;
getEventSupport().firePropertyChange("whenNoDataType", old, getWhenNoDataType());
}
public int getColumnWidth() {
return this.columnWidth;
}
public int getColumnSpacing() {
return this.columnSpacing;
}
public int getLeftMargin() {
return this.leftMargin;
}
public int getRightMargin() {
return this.rightMargin;
}
public int getTopMargin() {
return this.topMargin;
}
public int getBottomMargin() {
return this.bottomMargin;
}
public boolean isTitleNewPage() {
return this.isTitleNewPage;
}
public boolean isSummaryNewPage() {
return this.isSummaryNewPage;
}
public boolean isFloatColumnFooter() {
return this.isFloatColumnFooter;
}
public String getScriptletClass() {
return this.mainDataset.getScriptletClass();
}
public String getFormatFactoryClass() {
return this.formatFactoryClass;
}
public String getResourceBundle() {
return this.mainDataset.getResourceBundle();
}
public String[] getPropertyNames() {
return this.mainDataset.getPropertiesMap().getPropertyNames();
}
public String getProperty(String propName) {
return this.mainDataset.getPropertiesMap().getProperty(propName);
}
public void setProperty(String propName, String value) {
this.mainDataset.getPropertiesMap().setProperty(propName, value);
}
public void removeProperty(String propName) {
this.mainDataset.getPropertiesMap().removeProperty(propName);
}
public String[] getImports() {
if (this.importsSet != null)
return (String[])this.importsSet.toArray((Object[])new String[this.importsSet.size()]);
return null;
}
public JRReportFont getDefaultFont() {
return this.defaultFont;
}
public JRReportFont[] getFonts() {
return this.fonts;
}
public JRStyle getDefaultStyle() {
return this.defaultStyle;
}
public JRStyle[] getStyles() {
return this.styles;
}
public JRParameter[] getParameters() {
return this.mainDataset.getParameters();
}
public JRQuery getQuery() {
return this.mainDataset.getQuery();
}
public JRField[] getFields() {
return this.mainDataset.getFields();
}
public JRSortField[] getSortFields() {
return this.mainDataset.getSortFields();
}
public JRVariable[] getVariables() {
return this.mainDataset.getVariables();
}
public JRGroup[] getGroups() {
return this.mainDataset.getGroups();
}
public JRBand getBackground() {
return this.background;
}
public JRBand getTitle() {
return this.title;
}
public JRBand getPageHeader() {
return this.pageHeader;
}
public JRBand getColumnHeader() {
return this.columnHeader;
}
public JRBand getDetail() {
return this.detail;
}
public JRBand getColumnFooter() {
return this.columnFooter;
}
public JRBand getPageFooter() {
return this.pageFooter;
}
public JRBand getLastPageFooter() {
return this.lastPageFooter;
}
public JRBand getSummary() {
return this.summary;
}
public byte getWhenResourceMissingType() {
return this.mainDataset.getWhenResourceMissingType();
}
public void setWhenResourceMissingType(byte whenResourceMissingType) {
this.mainDataset.setWhenResourceMissingType(whenResourceMissingType);
}
public JRDataset getMainDataset() {
return this.mainDataset;
}
public JRDataset[] getDatasets() {
return this.datasets;
}
public boolean isIgnorePagination() {
return this.ignorePagination;
}
public boolean hasProperties() {
return this.mainDataset.hasProperties();
}
public JRPropertiesMap getPropertiesMap() {
return this.mainDataset.getPropertiesMap();
}
public JRPropertiesHolder getParentProperties() {
return null;
}
public JRReportTemplate[] getTemplates() {
return this.templates;
}
public JRBand getNoData() {
return this.noData;
}
public JRPropertyChangeSupport getEventSupport() {
synchronized (this) {
if (this.eventSupport == null)
this.eventSupport = new JRPropertyChangeSupport(this);
}
return this.eventSupport;
}
}

View File

@@ -0,0 +1,26 @@
package net.sf.jasperreports.engine.base;
import net.sf.jasperreports.engine.JRFont;
import net.sf.jasperreports.engine.JRReportFont;
public class JRBaseReportFont extends JRBaseFont implements JRReportFont {
private static final long serialVersionUID = 10200L;
protected String name = null;
protected boolean isDefault = false;
public JRBaseReportFont(JRReportFont reportFont) {
super(null, null, (JRFont)reportFont);
this.name = reportFont.getName();
this.isDefault = reportFont.isDefault();
}
public String getName() {
return this.name;
}
public boolean isDefault() {
return this.isDefault;
}
}

View File

@@ -0,0 +1,23 @@
package net.sf.jasperreports.engine.base;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRAbstractObjectFactory;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.JRReportTemplate;
public class JRBaseReportTemplate implements JRReportTemplate, Serializable {
private static final long serialVersionUID = 10200L;
protected JRExpression sourceExpression;
protected JRBaseReportTemplate() {}
public JRBaseReportTemplate(JRReportTemplate reportTemplate, JRAbstractObjectFactory factory) {
factory.put(reportTemplate, this);
this.sourceExpression = factory.getExpression(reportTemplate.getSourceExpression());
}
public JRExpression getSourceExpression() {
return this.sourceExpression;
}
}

View File

@@ -0,0 +1,57 @@
package net.sf.jasperreports.engine.base;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.JRSortField;
import net.sf.jasperreports.engine.design.events.JRChangeEventsSupport;
import net.sf.jasperreports.engine.design.events.JRPropertyChangeSupport;
public class JRBaseSortField implements JRSortField, Serializable, JRChangeEventsSupport {
private static final long serialVersionUID = 10200L;
public static final String PROPERTY_ORDER = "order";
protected String name = null;
protected byte order = 0;
private transient JRPropertyChangeSupport eventSupport;
protected JRBaseSortField() {}
protected JRBaseSortField(JRSortField sortField, JRBaseObjectFactory factory) {
factory.put(sortField, this);
this.name = sortField.getName();
this.order = sortField.getOrder();
}
public String getName() {
return this.name;
}
public byte getOrder() {
return this.order;
}
public void setOrder(byte order) {
byte old = this.order;
this.order = order;
getEventSupport().firePropertyChange("order", old, this.order);
}
public Object clone() {
try {
return super.clone();
} catch (CloneNotSupportedException e) {
throw new JRRuntimeException(e);
}
}
public JRPropertyChangeSupport getEventSupport() {
synchronized (this) {
if (this.eventSupport == null)
this.eventSupport = new JRPropertyChangeSupport(this);
}
return this.eventSupport;
}
}

View File

@@ -0,0 +1,37 @@
package net.sf.jasperreports.engine.base;
import net.sf.jasperreports.engine.JRExpressionCollector;
import net.sf.jasperreports.engine.JRStaticText;
import net.sf.jasperreports.engine.JRTextElement;
import net.sf.jasperreports.engine.JRVisitor;
public class JRBaseStaticText extends JRBaseTextElement implements JRStaticText {
private static final long serialVersionUID = 10200L;
public static final String PROPERTY_TEXT = "text";
protected String text = null;
protected JRBaseStaticText(JRStaticText staticText, JRBaseObjectFactory factory) {
super((JRTextElement)staticText, factory);
this.text = staticText.getText();
}
public String getText() {
return this.text;
}
public void setText(String text) {
Object old = this.text;
this.text = text;
getEventSupport().firePropertyChange("text", old, this.text);
}
public void collectExpressions(JRExpressionCollector collector) {
collector.collect(this);
}
public void visit(JRVisitor visitor) {
visitor.visitStaticText(this);
}
}

View File

@@ -0,0 +1,999 @@
package net.sf.jasperreports.engine.base;
import java.awt.Color;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRAbstractObjectFactory;
import net.sf.jasperreports.engine.JRBoxContainer;
import net.sf.jasperreports.engine.JRConditionalStyle;
import net.sf.jasperreports.engine.JRDefaultStyleProvider;
import net.sf.jasperreports.engine.JRLineBox;
import net.sf.jasperreports.engine.JRPen;
import net.sf.jasperreports.engine.JRPenContainer;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.JRStyle;
import net.sf.jasperreports.engine.JRStyleContainer;
import net.sf.jasperreports.engine.JRStyleSetter;
import net.sf.jasperreports.engine.design.events.JRChangeEventsSupport;
import net.sf.jasperreports.engine.design.events.JRPropertyChangeSupport;
import net.sf.jasperreports.engine.util.JRBoxUtil;
import net.sf.jasperreports.engine.util.JRPenUtil;
import net.sf.jasperreports.engine.util.JRStyleResolver;
public class JRBaseStyle implements JRStyle, Serializable, JRChangeEventsSupport {
private static final long serialVersionUID = 10001L;
public static final String PROPERTY_BACKCOLOR = "backcolor";
public static final String PROPERTY_BLANK_WHEN_NULL = "blankWhenNull";
public static final String PROPERTY_BOLD = "bold";
public static final String PROPERTY_FILL = "fill";
public static final String PROPERTY_FONT_NAME = "fontName";
public static final String PROPERTY_FONT_SIZE = "fontSize";
public static final String PROPERTY_FORECOLOR = "forecolor";
public static final String PROPERTY_HORIZONTAL_ALIGNMENT = "horizontalAlignment";
public static final String PROPERTY_ITALIC = "italic";
public static final String PROPERTY_LINE_SPACING = "lineSpacing";
public static final String PROPERTY_MODE = "mode";
public static final String PROPERTY_PATTERN = "pattern";
public static final String PROPERTY_PDF_EMBEDDED = "pdfEmbedded";
public static final String PROPERTY_PDF_ENCODING = "pdfEncoding";
public static final String PROPERTY_PDF_FONT_NAME = "pdfFontName";
public static final String PROPERTY_RADIUS = "radius";
public static final String PROPERTY_ROTATION = "rotation";
public static final String PROPERTY_SCALE_IMAGE = "scaleImage";
public static final String PROPERTY_STRIKE_THROUGH = "strikeThrough";
public static final String PROPERTY_IS_STYLED_TEXT = "isStyledText";
public static final String PROPERTY_MARKUP = "markup";
public static final String PROPERTY_UNDERLINE = "underline";
public static final String PROPERTY_VERTICAL_ALIGNMENT = "verticalAlignment";
protected JRDefaultStyleProvider defaultStyleProvider = null;
protected JRStyle parentStyle = null;
protected String parentStyleNameReference;
protected String name = null;
protected boolean isDefault = false;
protected Byte positionType = null;
protected Byte stretchType = null;
protected Byte mode = null;
protected Color forecolor = null;
protected Color backcolor = null;
protected JRPen linePen = null;
protected Byte fill = null;
protected Integer radius = null;
protected Byte scaleImage = null;
protected Byte horizontalAlignment = null;
protected Byte verticalAlignment = null;
protected JRLineBox lineBox = null;
protected String fontName = null;
protected Boolean isBold = null;
protected Boolean isItalic = null;
protected Boolean isUnderline = null;
protected Boolean isStrikeThrough = null;
protected Integer fontSize = null;
protected String pdfFontName = null;
protected String pdfEncoding = null;
protected Boolean isPdfEmbedded = null;
protected Byte rotation = null;
protected Byte lineSpacing = null;
protected String markup = null;
protected String pattern = null;
protected Boolean isBlankWhenNull = null;
protected JRConditionalStyle[] conditionalStyles;
private transient JRPropertyChangeSupport eventSupport;
private Byte pen;
private Byte border;
private Byte topBorder;
private Byte leftBorder;
private Byte bottomBorder;
private Byte rightBorder;
private Color borderColor;
private Color topBorderColor;
private Color leftBorderColor;
private Color bottomBorderColor;
private Color rightBorderColor;
private Integer padding;
private Integer topPadding;
private Integer leftPadding;
private Integer bottomPadding;
private Integer rightPadding;
private Boolean isStyledText;
protected void setParentStyle(JRStyle parentStyle) {
this.parentStyle = parentStyle;
checkCircularParent();
}
protected void checkCircularParent() {
for (JRStyle ancestor = this.parentStyle; ancestor != null; ancestor = ancestor.getStyle()) {
if (ancestor == this)
throw new JRRuntimeException("Circular dependency detected for style " + getName());
}
}
public JRDefaultStyleProvider getDefaultStyleProvider() {
return this.defaultStyleProvider;
}
public JRStyle getStyle() {
return this.parentStyle;
}
public String getName() {
return this.name;
}
public void rename(String newName) {
this.name = newName;
}
public boolean isDefault() {
return this.isDefault;
}
public Color getForecolor() {
return JRStyleResolver.getForecolor(this);
}
public Color getOwnForecolor() {
return this.forecolor;
}
public Color getBackcolor() {
return JRStyleResolver.getBackcolor(this);
}
public Color getOwnBackcolor() {
return this.backcolor;
}
public JRPen getLinePen() {
return this.linePen;
}
public Byte getPen() {
return new Byte(JRPenUtil.getPenFromLinePen(this.linePen));
}
public Byte getOwnPen() {
return JRPenUtil.getOwnPenFromLinePen(this.linePen);
}
public void setPen(byte pen) {
setPen(new Byte(pen));
}
public void setPen(Byte pen) {
JRPenUtil.setLinePenFromPen(pen, this.linePen);
}
public Byte getFill() {
return JRStyleResolver.getFill(this);
}
public Byte getOwnFill() {
return this.fill;
}
public Integer getRadius() {
return JRStyleResolver.getRadius(this);
}
public Integer getOwnRadius() {
return this.radius;
}
public Byte getScaleImage() {
return JRStyleResolver.getScaleImage(this);
}
public Byte getOwnScaleImage() {
return this.scaleImage;
}
public Byte getHorizontalAlignment() {
return JRStyleResolver.getHorizontalAlignment(this);
}
public Byte getOwnHorizontalAlignment() {
return this.horizontalAlignment;
}
public Byte getVerticalAlignment() {
return JRStyleResolver.getVerticalAlignment(this);
}
public Byte getOwnVerticalAlignment() {
return this.verticalAlignment;
}
public JRLineBox getLineBox() {
return this.lineBox;
}
public Byte getBorder() {
return new Byte(JRPenUtil.getPenFromLinePen(this.lineBox.getPen()));
}
public Byte getOwnBorder() {
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getPen());
}
public Color getBorderColor() {
return this.lineBox.getPen().getLineColor();
}
public Color getOwnBorderColor() {
return this.lineBox.getPen().getOwnLineColor();
}
public Integer getPadding() {
return this.lineBox.getPadding();
}
public Integer getOwnPadding() {
return this.lineBox.getOwnPadding();
}
public Byte getTopBorder() {
return new Byte(JRPenUtil.getPenFromLinePen(this.lineBox.getTopPen()));
}
public Byte getOwnTopBorder() {
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getTopPen());
}
public Color getTopBorderColor() {
return this.lineBox.getTopPen().getLineColor();
}
public Color getOwnTopBorderColor() {
return this.lineBox.getTopPen().getOwnLineColor();
}
public Integer getTopPadding() {
return this.lineBox.getTopPadding();
}
public Integer getOwnTopPadding() {
return this.lineBox.getOwnTopPadding();
}
public Byte getLeftBorder() {
return new Byte(JRPenUtil.getPenFromLinePen(this.lineBox.getLeftPen()));
}
public Byte getOwnLeftBorder() {
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getLeftPen());
}
public Color getLeftBorderColor() {
return this.lineBox.getLeftPen().getLineColor();
}
public Color getOwnLeftBorderColor() {
return this.lineBox.getLeftPen().getOwnLineColor();
}
public Integer getLeftPadding() {
return this.lineBox.getLeftPadding();
}
public Integer getOwnLeftPadding() {
return this.lineBox.getOwnLeftPadding();
}
public Byte getBottomBorder() {
return new Byte(JRPenUtil.getPenFromLinePen(this.lineBox.getBottomPen()));
}
public Byte getOwnBottomBorder() {
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getBottomPen());
}
public Color getBottomBorderColor() {
return this.lineBox.getBottomPen().getLineColor();
}
public Color getOwnBottomBorderColor() {
return this.lineBox.getBottomPen().getOwnLineColor();
}
public Integer getBottomPadding() {
return this.lineBox.getBottomPadding();
}
public Integer getOwnBottomPadding() {
return this.lineBox.getOwnBottomPadding();
}
public Byte getRightBorder() {
return new Byte(JRPenUtil.getPenFromLinePen(this.lineBox.getRightPen()));
}
public Byte getOwnRightBorder() {
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getRightPen());
}
public Color getRightBorderColor() {
return this.lineBox.getRightPen().getLineColor();
}
public Color getOwnRightBorderColor() {
return this.lineBox.getRightPen().getOwnLineColor();
}
public Integer getRightPadding() {
return this.lineBox.getRightPadding();
}
public Integer getOwnRightPadding() {
return this.lineBox.getOwnRightPadding();
}
public Byte getRotation() {
return JRStyleResolver.getRotation(this);
}
public Byte getOwnRotation() {
return this.rotation;
}
public Byte getLineSpacing() {
return JRStyleResolver.getLineSpacing(this);
}
public Byte getOwnLineSpacing() {
return this.lineSpacing;
}
public Boolean isStyledText() {
String mkp = getMarkup();
return "styled".equals(mkp) ? Boolean.TRUE : ((mkp == null) ? null : Boolean.FALSE);
}
public Boolean isOwnStyledText() {
String mkp = getOwnMarkup();
return "styled".equals(mkp) ? Boolean.TRUE : ((mkp == null) ? null : Boolean.FALSE);
}
public String getMarkup() {
return JRStyleResolver.getMarkup(this);
}
public String getOwnMarkup() {
return this.markup;
}
public Boolean isBlankWhenNull() {
return JRStyleResolver.isBlankWhenNull(this);
}
public Boolean isOwnBlankWhenNull() {
return this.isBlankWhenNull;
}
public String getFontName() {
return JRStyleResolver.getFontName(this);
}
public String getOwnFontName() {
return this.fontName;
}
public Boolean isBold() {
return JRStyleResolver.isBold(this);
}
public Boolean isOwnBold() {
return this.isBold;
}
public Boolean isItalic() {
return JRStyleResolver.isItalic(this);
}
public Boolean isOwnItalic() {
return this.isItalic;
}
public Boolean isUnderline() {
return JRStyleResolver.isUnderline(this);
}
public Boolean isOwnUnderline() {
return this.isUnderline;
}
public Boolean isStrikeThrough() {
return JRStyleResolver.isStrikeThrough(this);
}
public Boolean isOwnStrikeThrough() {
return this.isStrikeThrough;
}
public Integer getFontSize() {
return JRStyleResolver.getFontSize(this);
}
public Integer getOwnFontSize() {
return this.fontSize;
}
public String getPdfFontName() {
return JRStyleResolver.getPdfFontName(this);
}
public String getOwnPdfFontName() {
return this.pdfFontName;
}
public String getPdfEncoding() {
return JRStyleResolver.getPdfEncoding(this);
}
public String getOwnPdfEncoding() {
return this.pdfEncoding;
}
public Boolean isPdfEmbedded() {
return JRStyleResolver.isPdfEmbedded(this);
}
public Boolean isOwnPdfEmbedded() {
return this.isPdfEmbedded;
}
public String getPattern() {
return JRStyleResolver.getPattern(this);
}
public String getOwnPattern() {
return this.pattern;
}
public Byte getMode() {
return JRStyleResolver.getMode(this);
}
public Byte getOwnMode() {
return this.mode;
}
public void setForecolor(Color forecolor) {
Object old = this.forecolor;
this.forecolor = forecolor;
getEventSupport().firePropertyChange("forecolor", old, this.forecolor);
}
public void setBackcolor(Color backcolor) {
Object old = this.backcolor;
this.backcolor = backcolor;
getEventSupport().firePropertyChange("backcolor", old, this.backcolor);
}
public void setMode(byte mode) {
setMode(new Byte(mode));
}
public void setMode(Byte mode) {
Object old = this.mode;
this.mode = mode;
getEventSupport().firePropertyChange("mode", old, this.mode);
}
public void setFill(byte fill) {
setFill(new Byte(fill));
}
public void setFill(Byte fill) {
Object old = this.fill;
this.fill = fill;
getEventSupport().firePropertyChange("fill", old, this.fill);
}
public void setRadius(int radius) {
setRadius(new Integer(radius));
}
public void setRadius(Integer radius) {
Object old = this.radius;
this.radius = radius;
getEventSupport().firePropertyChange("radius", old, this.radius);
}
public void setScaleImage(byte scaleImage) {
setScaleImage(new Byte(scaleImage));
}
public void setScaleImage(Byte scaleImage) {
Object old = this.scaleImage;
this.scaleImage = scaleImage;
getEventSupport().firePropertyChange("scaleImage", old, this.scaleImage);
}
public void setHorizontalAlignment(byte horizontalAlignment) {
setHorizontalAlignment(new Byte(horizontalAlignment));
}
public void setHorizontalAlignment(Byte horizontalAlignment) {
Object old = this.horizontalAlignment;
this.horizontalAlignment = horizontalAlignment;
getEventSupport().firePropertyChange("horizontalAlignment", old, this.horizontalAlignment);
}
public void setVerticalAlignment(byte verticalAlignment) {
setVerticalAlignment(new Byte(verticalAlignment));
}
public void setVerticalAlignment(Byte verticalAlignment) {
Object old = this.verticalAlignment;
this.verticalAlignment = verticalAlignment;
getEventSupport().firePropertyChange("verticalAlignment", old, this.verticalAlignment);
}
public void setBorder(byte border) {
JRPenUtil.setLinePenFromPen(border, this.lineBox.getPen());
}
public void setBorder(Byte border) {
JRPenUtil.setLinePenFromPen(border, this.lineBox.getPen());
}
public void setBorderColor(Color borderColor) {
this.lineBox.getPen().setLineColor(borderColor);
}
public void setPadding(int padding) {
this.lineBox.setPadding(padding);
}
public void setPadding(Integer padding) {
this.lineBox.setPadding(padding);
}
public void setTopBorder(byte topBorder) {
JRPenUtil.setLinePenFromPen(topBorder, this.lineBox.getTopPen());
}
public void setTopBorder(Byte topBorder) {
JRPenUtil.setLinePenFromPen(topBorder, this.lineBox.getTopPen());
}
public void setTopBorderColor(Color topBorderColor) {
this.lineBox.getTopPen().setLineColor(topBorderColor);
}
public void setTopPadding(int topPadding) {
this.lineBox.setTopPadding(topPadding);
}
public void setTopPadding(Integer topPadding) {
this.lineBox.setTopPadding(topPadding);
}
public void setLeftBorder(byte leftBorder) {
JRPenUtil.setLinePenFromPen(leftBorder, this.lineBox.getLeftPen());
}
public void setLeftBorder(Byte leftBorder) {
JRPenUtil.setLinePenFromPen(leftBorder, this.lineBox.getLeftPen());
}
public void setLeftBorderColor(Color leftBorderColor) {
this.lineBox.getLeftPen().setLineColor(leftBorderColor);
}
public void setLeftPadding(int leftPadding) {
this.lineBox.setLeftPadding(leftPadding);
}
public void setLeftPadding(Integer leftPadding) {
this.lineBox.setLeftPadding(leftPadding);
}
public void setBottomBorder(byte bottomBorder) {
JRPenUtil.setLinePenFromPen(bottomBorder, this.lineBox.getBottomPen());
}
public void setBottomBorder(Byte bottomBorder) {
JRPenUtil.setLinePenFromPen(bottomBorder, this.lineBox.getBottomPen());
}
public void setBottomBorderColor(Color bottomBorderColor) {
this.lineBox.getBottomPen().setLineColor(bottomBorderColor);
}
public void setBottomPadding(int bottomPadding) {
this.lineBox.setBottomPadding(bottomPadding);
}
public void setBottomPadding(Integer bottomPadding) {
this.lineBox.setBottomPadding(bottomPadding);
}
public void setRightBorder(byte rightBorder) {
JRPenUtil.setLinePenFromPen(rightBorder, this.lineBox.getRightPen());
}
public void setRightBorder(Byte rightBorder) {
JRPenUtil.setLinePenFromPen(rightBorder, this.lineBox.getRightPen());
}
public void setRightBorderColor(Color rightBorderColor) {
this.lineBox.getRightPen().setLineColor(rightBorderColor);
}
public void setRightPadding(int rightPadding) {
this.lineBox.setRightPadding(rightPadding);
}
public void setRightPadding(Integer rightPadding) {
this.lineBox.setRightPadding(rightPadding);
}
public void setRotation(byte rotation) {
setRotation(new Byte(rotation));
}
public void setRotation(Byte rotation) {
Object old = this.rotation;
this.rotation = rotation;
getEventSupport().firePropertyChange("rotation", old, this.rotation);
}
public void setFontName(String fontName) {
Object old = this.fontName;
this.fontName = fontName;
getEventSupport().firePropertyChange("fontName", old, this.fontName);
}
public void setBold(boolean bold) {
setBold(bold ? Boolean.TRUE : Boolean.FALSE);
}
public void setBold(Boolean bold) {
Object old = this.isBold;
this.isBold = bold;
getEventSupport().firePropertyChange("bold", old, this.isBold);
}
public void setItalic(boolean italic) {
setItalic(italic ? Boolean.TRUE : Boolean.FALSE);
}
public void setItalic(Boolean italic) {
Object old = this.isItalic;
this.isItalic = italic;
getEventSupport().firePropertyChange("italic", old, this.isItalic);
}
public void setPdfEmbedded(boolean pdfEmbedded) {
setPdfEmbedded(pdfEmbedded ? Boolean.TRUE : Boolean.FALSE);
}
public void setPdfEmbedded(Boolean pdfEmbedded) {
Object old = this.isPdfEmbedded;
this.isPdfEmbedded = pdfEmbedded;
getEventSupport().firePropertyChange("pdfEmbedded", old, this.isPdfEmbedded);
}
public void setStrikeThrough(boolean strikeThrough) {
setStrikeThrough(strikeThrough ? Boolean.TRUE : Boolean.FALSE);
}
public void setStrikeThrough(Boolean strikeThrough) {
Object old = this.isStrikeThrough;
this.isStrikeThrough = strikeThrough;
getEventSupport().firePropertyChange("strikeThrough", old, this.isStrikeThrough);
}
public void setStyledText(boolean styledText) {
setStyledText(styledText ? Boolean.TRUE : Boolean.FALSE);
}
public void setStyledText(Boolean styledText) {
if (styledText == null) {
setMarkup(null);
} else {
setMarkup(styledText.booleanValue() ? "styled" : "none");
}
}
public void setMarkup(String markup) {
Object old = this.markup;
this.markup = markup;
getEventSupport().firePropertyChange("markup", old, this.markup);
}
public void setBlankWhenNull(boolean isBlankWhenNull) {
setBlankWhenNull(isBlankWhenNull ? Boolean.TRUE : Boolean.FALSE);
}
public void setBlankWhenNull(Boolean isBlankWhenNull) {
Object old = this.isBlankWhenNull;
this.isBlankWhenNull = isBlankWhenNull;
getEventSupport().firePropertyChange("blankWhenNull", old, this.isBlankWhenNull);
}
public void setUnderline(boolean underline) {
setUnderline(underline ? Boolean.TRUE : Boolean.FALSE);
}
public void setUnderline(Boolean underline) {
Object old = this.isUnderline;
this.isUnderline = underline;
getEventSupport().firePropertyChange("underline", old, this.isUnderline);
}
public void setLineSpacing(byte lineSpacing) {
setLineSpacing(new Byte(lineSpacing));
}
public void setLineSpacing(Byte lineSpacing) {
Object old = this.lineSpacing;
this.lineSpacing = lineSpacing;
getEventSupport().firePropertyChange("lineSpacing", old, this.lineSpacing);
}
public void setPattern(String pattern) {
Object old = this.pattern;
this.pattern = pattern;
getEventSupport().firePropertyChange("pattern", old, this.pattern);
}
public void setPdfEncoding(String pdfEncoding) {
Object old = this.pdfEncoding;
this.pdfEncoding = pdfEncoding;
getEventSupport().firePropertyChange("pdfEncoding", old, this.pdfEncoding);
}
public void setPdfFontName(String pdfFontName) {
Object old = this.pdfFontName;
this.pdfFontName = pdfFontName;
getEventSupport().firePropertyChange("pdfFontName", old, this.pdfFontName);
}
public void setFontSize(int fontSize) {
setFontSize(new Integer(fontSize));
}
public void setFontSize(Integer fontSize) {
Object old = this.fontSize;
this.fontSize = fontSize;
getEventSupport().firePropertyChange("fontSize", old, this.fontSize);
}
public JRConditionalStyle[] getConditionalStyles() {
return this.conditionalStyles;
}
public String getStyleNameReference() {
return this.parentStyleNameReference;
}
public Float getDefaultLineWidth() {
return null;
}
public Color getDefaultLineColor() {
return getForecolor();
}
public JRPropertyChangeSupport getEventSupport() {
synchronized (this) {
if (this.eventSupport == null)
this.eventSupport = new JRPropertyChangeSupport(this);
}
return this.eventSupport;
}
public JRBaseStyle() {
this.border = null;
this.topBorder = null;
this.leftBorder = null;
this.bottomBorder = null;
this.rightBorder = null;
this.borderColor = null;
this.topBorderColor = null;
this.leftBorderColor = null;
this.bottomBorderColor = null;
this.rightBorderColor = null;
this.padding = null;
this.topPadding = null;
this.leftPadding = null;
this.bottomPadding = null;
this.rightPadding = null;
this.isStyledText = null;
this.linePen = new JRBasePen((JRPenContainer)this);
this.lineBox = new JRBaseLineBox((JRBoxContainer)this);
}
public JRBaseStyle(String name) {
this.border = null;
this.topBorder = null;
this.leftBorder = null;
this.bottomBorder = null;
this.rightBorder = null;
this.borderColor = null;
this.topBorderColor = null;
this.leftBorderColor = null;
this.bottomBorderColor = null;
this.rightBorderColor = null;
this.padding = null;
this.topPadding = null;
this.leftPadding = null;
this.bottomPadding = null;
this.rightPadding = null;
this.isStyledText = null;
this.name = name;
this.linePen = new JRBasePen((JRPenContainer)this);
this.lineBox = new JRBaseLineBox((JRBoxContainer)this);
}
public JRBaseStyle(JRStyle style, JRAbstractObjectFactory factory) {
this.border = null;
this.topBorder = null;
this.leftBorder = null;
this.bottomBorder = null;
this.rightBorder = null;
this.borderColor = null;
this.topBorderColor = null;
this.leftBorderColor = null;
this.bottomBorderColor = null;
this.rightBorderColor = null;
this.padding = null;
this.topPadding = null;
this.leftPadding = null;
this.bottomPadding = null;
this.rightPadding = null;
this.isStyledText = null;
this.name = style.getName();
factory.setStyle(new JRStyleSetter() {
private final JRBaseStyle this$0;
public void setStyle(JRStyle aStyle) {
JRBaseStyle.this.setParentStyle(aStyle);
}
public void setStyleNameReference(String name) {
JRBaseStyle.this.parentStyleNameReference = name;
}
}, (JRStyleContainer)style);
this.isDefault = style.isDefault();
this.mode = style.getOwnMode();
this.forecolor = style.getOwnForecolor();
this.backcolor = style.getOwnBackcolor();
this.linePen = style.getLinePen().clone((JRPenContainer)this);
this.fill = style.getOwnFill();
this.radius = style.getOwnRadius();
this.scaleImage = style.getOwnScaleImage();
this.horizontalAlignment = style.getOwnHorizontalAlignment();
this.verticalAlignment = style.getOwnVerticalAlignment();
this.lineBox = style.getLineBox().clone((JRBoxContainer)this);
this.rotation = style.getOwnRotation();
this.lineSpacing = style.getOwnLineSpacing();
this.markup = style.getOwnMarkup();
this.pattern = style.getOwnPattern();
this.fontName = style.getOwnFontName();
this.isBold = style.isOwnBold();
this.isItalic = style.isOwnItalic();
this.isUnderline = style.isOwnUnderline();
this.isStrikeThrough = style.isOwnStrikeThrough();
this.fontSize = style.getOwnFontSize();
this.pdfFontName = style.getOwnPdfFontName();
this.pdfEncoding = style.getOwnPdfEncoding();
this.isPdfEmbedded = style.isOwnPdfEmbedded();
this.isBlankWhenNull = style.isOwnBlankWhenNull();
JRConditionalStyle[] condStyles = style.getConditionalStyles();
if (condStyles != null && condStyles.length > 0) {
this.conditionalStyles = new JRConditionalStyle[condStyles.length];
for (int i = 0; i < condStyles.length; i++)
this.conditionalStyles[i] = factory.getConditionalStyle(condStyles[i], this);
}
}
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
if (this.linePen == null) {
this.linePen = new JRBasePen((JRPenContainer)this);
JRPenUtil.setLinePenFromPen(this.pen, this.linePen);
this.pen = null;
}
if (this.lineBox == null) {
this.lineBox = new JRBaseLineBox((JRBoxContainer)this);
JRBoxUtil.setToBox(this.border, this.topBorder, this.leftBorder, this.bottomBorder, this.rightBorder, this.borderColor, this.topBorderColor, this.leftBorderColor, this.bottomBorderColor, this.rightBorderColor, this.padding, this.topPadding, this.leftPadding, this.bottomPadding, this.rightPadding, this.lineBox);
this.border = null;
this.topBorder = null;
this.leftBorder = null;
this.bottomBorder = null;
this.rightBorder = null;
this.borderColor = null;
this.topBorderColor = null;
this.leftBorderColor = null;
this.bottomBorderColor = null;
this.rightBorderColor = null;
this.padding = null;
this.topPadding = null;
this.leftPadding = null;
this.bottomPadding = null;
this.rightPadding = null;
}
if (this.isStyledText != null) {
this.markup = this.isStyledText.booleanValue() ? "styled" : "none";
this.isStyledText = null;
}
}
}

View File

@@ -0,0 +1,135 @@
package net.sf.jasperreports.engine.base;
import net.sf.jasperreports.engine.JRCommonElement;
import net.sf.jasperreports.engine.JRElement;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.JRExpressionCollector;
import net.sf.jasperreports.engine.JRSubreport;
import net.sf.jasperreports.engine.JRSubreportParameter;
import net.sf.jasperreports.engine.JRSubreportReturnValue;
import net.sf.jasperreports.engine.JRVisitor;
import net.sf.jasperreports.engine.util.JRStyleResolver;
public class JRBaseSubreport extends JRBaseElement implements JRSubreport {
private static final long serialVersionUID = 10200L;
public static final String PROPERTY_USING_CACHE = "usingCache";
protected Boolean isUsingCache = null;
protected JRExpression parametersMapExpression = null;
protected JRSubreportParameter[] parameters = null;
protected JRExpression connectionExpression = null;
protected JRExpression dataSourceExpression = null;
protected JRExpression expression = null;
protected JRSubreportReturnValue[] returnValues = null;
public byte getMode() {
return JRStyleResolver.getMode((JRCommonElement)this, (byte)2);
}
protected JRBaseSubreport(JRSubreport subreport, JRBaseObjectFactory factory) {
super((JRElement)subreport, factory);
this.isUsingCache = subreport.isOwnUsingCache();
this.parametersMapExpression = factory.getExpression(subreport.getParametersMapExpression());
JRSubreportParameter[] jrSubreportParameters = subreport.getParameters();
if (jrSubreportParameters != null && jrSubreportParameters.length > 0) {
this.parameters = new JRSubreportParameter[jrSubreportParameters.length];
for (int i = 0; i < this.parameters.length; i++)
this.parameters[i] = factory.getSubreportParameter(jrSubreportParameters[i]);
}
this.connectionExpression = factory.getExpression(subreport.getConnectionExpression());
this.dataSourceExpression = factory.getExpression(subreport.getDataSourceExpression());
JRSubreportReturnValue[] subrepReturnValues = subreport.getReturnValues();
if (subrepReturnValues != null && subrepReturnValues.length > 0) {
this.returnValues = new JRSubreportReturnValue[subrepReturnValues.length];
for (int i = 0; i < subrepReturnValues.length; i++)
this.returnValues[i] = factory.getSubreportReturnValue(subrepReturnValues[i]);
}
this.expression = factory.getExpression(subreport.getExpression());
}
public boolean isUsingCache() {
if (this.isUsingCache == null) {
JRExpression subreportExpression = getExpression();
if (subreportExpression != null)
return String.class.getName().equals(subreportExpression.getValueClassName());
return true;
}
return this.isUsingCache.booleanValue();
}
public void setUsingCache(boolean isUsingCache) {
setUsingCache(isUsingCache ? Boolean.TRUE : Boolean.FALSE);
}
public JRExpression getParametersMapExpression() {
return this.parametersMapExpression;
}
public JRSubreportParameter[] getParameters() {
return this.parameters;
}
public JRExpression getConnectionExpression() {
return this.connectionExpression;
}
public JRExpression getDataSourceExpression() {
return this.dataSourceExpression;
}
public JRExpression getExpression() {
return this.expression;
}
public void collectExpressions(JRExpressionCollector collector) {
collector.collect(this);
}
public void visit(JRVisitor visitor) {
visitor.visitSubreport(this);
}
public JRSubreportReturnValue[] getReturnValues() {
return this.returnValues;
}
public Boolean isOwnUsingCache() {
return this.isUsingCache;
}
public void setUsingCache(Boolean isUsingCache) {
Object old = this.isUsingCache;
this.isUsingCache = isUsingCache;
getEventSupport().firePropertyChange("usingCache", old, this.isUsingCache);
}
public Object clone() {
JRBaseSubreport clone = (JRBaseSubreport)super.clone();
if (this.parameters != null) {
clone.parameters = new JRSubreportParameter[this.parameters.length];
for (int i = 0; i < this.parameters.length; i++)
clone.parameters[i] = (JRSubreportParameter)this.parameters[i].clone();
}
if (this.returnValues != null) {
clone.returnValues = new JRSubreportReturnValue[this.returnValues.length];
for (int i = 0; i < this.returnValues.length; i++)
clone.returnValues[i] = (JRSubreportReturnValue)this.returnValues[i].clone();
}
if (this.parametersMapExpression != null)
clone.parametersMapExpression = (JRExpression)this.parametersMapExpression.clone();
if (this.connectionExpression != null)
clone.connectionExpression = (JRExpression)this.connectionExpression.clone();
if (this.dataSourceExpression != null)
clone.dataSourceExpression = (JRExpression)this.dataSourceExpression.clone();
if (this.expression != null)
clone.expression = (JRExpression)this.expression.clone();
return clone;
}
}

View File

@@ -0,0 +1,14 @@
package net.sf.jasperreports.engine.base;
import net.sf.jasperreports.engine.JRDatasetParameter;
import net.sf.jasperreports.engine.JRSubreportParameter;
public class JRBaseSubreportParameter extends JRBaseDatasetParameter implements JRSubreportParameter {
private static final long serialVersionUID = 10200L;
protected JRBaseSubreportParameter() {}
protected JRBaseSubreportParameter(JRSubreportParameter subreportParameter, JRBaseObjectFactory factory) {
super((JRDatasetParameter)subreportParameter, factory);
}
}

View File

@@ -0,0 +1,51 @@
package net.sf.jasperreports.engine.base;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.JRSubreportReturnValue;
public class JRBaseSubreportReturnValue implements JRSubreportReturnValue, Serializable {
private static final long serialVersionUID = 10200L;
protected String subreportVariable = null;
protected String toVariable = null;
protected byte calculation = 0;
protected String incrementerFactoryClassName = null;
protected JRBaseSubreportReturnValue() {}
protected JRBaseSubreportReturnValue(JRSubreportReturnValue returnValue, JRBaseObjectFactory factory) {
factory.put(returnValue, this);
this.subreportVariable = returnValue.getSubreportVariable();
this.toVariable = returnValue.getToVariable();
this.calculation = returnValue.getCalculation();
this.incrementerFactoryClassName = returnValue.getIncrementerFactoryClassName();
}
public String getSubreportVariable() {
return this.subreportVariable;
}
public String getToVariable() {
return this.toVariable;
}
public byte getCalculation() {
return this.calculation;
}
public String getIncrementerFactoryClassName() {
return this.incrementerFactoryClassName;
}
public Object clone() {
try {
return super.clone();
} catch (CloneNotSupportedException e) {
throw new JRRuntimeException(e);
}
}
}

View File

@@ -0,0 +1,696 @@
package net.sf.jasperreports.engine.base;
import java.awt.Color;
import java.io.IOException;
import java.io.ObjectInputStream;
import net.sf.jasperreports.engine.JRAlignment;
import net.sf.jasperreports.engine.JRBox;
import net.sf.jasperreports.engine.JRBoxContainer;
import net.sf.jasperreports.engine.JRCommonElement;
import net.sf.jasperreports.engine.JRCommonText;
import net.sf.jasperreports.engine.JRElement;
import net.sf.jasperreports.engine.JRFont;
import net.sf.jasperreports.engine.JRLineBox;
import net.sf.jasperreports.engine.JRReportFont;
import net.sf.jasperreports.engine.JRStyle;
import net.sf.jasperreports.engine.JRTextElement;
import net.sf.jasperreports.engine.util.JRBoxUtil;
import net.sf.jasperreports.engine.util.JRPenUtil;
import net.sf.jasperreports.engine.util.JRStyleResolver;
import net.sf.jasperreports.engine.util.LineBoxWrapper;
public abstract class JRBaseTextElement extends JRBaseElement implements JRTextElement {
private static final long serialVersionUID = 10200L;
protected Byte horizontalAlignment;
protected Byte verticalAlignment;
protected Byte rotation;
protected Byte lineSpacing;
protected String markup;
protected JRLineBox lineBox = null;
protected JRReportFont reportFont = null;
protected String fontName = null;
protected Boolean isBold = null;
protected Boolean isItalic = null;
protected Boolean isUnderline = null;
protected Boolean isStrikeThrough = null;
protected Integer fontSize = null;
protected String pdfFontName = null;
protected String pdfEncoding = null;
protected Boolean isPdfEmbedded = null;
private Byte border;
private Byte topBorder;
private Byte leftBorder;
private Byte bottomBorder;
private Byte rightBorder;
private Color borderColor;
private Color topBorderColor;
private Color leftBorderColor;
private Color bottomBorderColor;
private Color rightBorderColor;
private Integer padding;
private Integer topPadding;
private Integer leftPadding;
private Integer bottomPadding;
private Integer rightPadding;
private Boolean isStyledText;
protected JRBaseTextElement(JRTextElement textElement, JRBaseObjectFactory factory) {
super((JRElement)textElement, factory);
this.border = null;
this.topBorder = null;
this.leftBorder = null;
this.bottomBorder = null;
this.rightBorder = null;
this.borderColor = null;
this.topBorderColor = null;
this.leftBorderColor = null;
this.bottomBorderColor = null;
this.rightBorderColor = null;
this.padding = null;
this.topPadding = null;
this.leftPadding = null;
this.bottomPadding = null;
this.rightPadding = null;
this.isStyledText = null;
this.horizontalAlignment = textElement.getOwnHorizontalAlignment();
this.verticalAlignment = textElement.getOwnVerticalAlignment();
this.rotation = textElement.getOwnRotation();
this.lineSpacing = textElement.getOwnLineSpacing();
this.markup = textElement.getOwnMarkup();
this.lineBox = textElement.getLineBox().clone((JRBoxContainer)this);
this.reportFont = factory.getReportFont(textElement.getReportFont());
this.fontName = textElement.getOwnFontName();
this.isBold = textElement.isOwnBold();
this.isItalic = textElement.isOwnItalic();
this.isUnderline = textElement.isOwnUnderline();
this.isStrikeThrough = textElement.isOwnStrikeThrough();
this.fontSize = textElement.getOwnFontSize();
this.pdfFontName = textElement.getOwnPdfFontName();
this.pdfEncoding = textElement.getOwnPdfEncoding();
this.isPdfEmbedded = textElement.isOwnPdfEmbedded();
}
protected JRFont getBaseFont() {
if (this.reportFont != null)
return (JRFont)this.reportFont;
if (this.defaultStyleProvider != null)
return (JRFont)this.defaultStyleProvider.getDefaultFont();
return null;
}
public byte getTextAlignment() {
if (this.horizontalAlignment == null) {
JRStyle style = getBaseStyle();
if (style != null && style.getHorizontalAlignment() != null)
return style.getHorizontalAlignment().byteValue();
return 1;
}
return this.horizontalAlignment.byteValue();
}
public void setTextAlignment(byte horizontalAlignment) {
setHorizontalAlignment(new Byte(horizontalAlignment));
}
public byte getHorizontalAlignment() {
return JRStyleResolver.getHorizontalAlignment((JRAlignment)this);
}
public Byte getOwnHorizontalAlignment() {
return this.horizontalAlignment;
}
public void setHorizontalAlignment(byte horizontalAlignment) {
setHorizontalAlignment(new Byte(horizontalAlignment));
}
public void setHorizontalAlignment(Byte horizontalAlignment) {
Object old = this.horizontalAlignment;
this.horizontalAlignment = horizontalAlignment;
getEventSupport().firePropertyChange("horizontalAlignment", old, this.horizontalAlignment);
}
public byte getVerticalAlignment() {
return JRStyleResolver.getVerticalAlignment((JRAlignment)this);
}
public Byte getOwnVerticalAlignment() {
return this.verticalAlignment;
}
public void setVerticalAlignment(byte verticalAlignment) {
setVerticalAlignment(new Byte(verticalAlignment));
}
public void setVerticalAlignment(Byte verticalAlignment) {
Object old = this.verticalAlignment;
this.verticalAlignment = verticalAlignment;
getEventSupport().firePropertyChange("verticalAlignment", old, this.verticalAlignment);
}
public byte getRotation() {
return JRStyleResolver.getRotation((JRCommonText)this);
}
public Byte getOwnRotation() {
return this.rotation;
}
public void setRotation(byte rotation) {
setRotation(new Byte(rotation));
}
public void setRotation(Byte rotation) {
Object old = this.rotation;
this.rotation = rotation;
getEventSupport().firePropertyChange("rotation", old, this.rotation);
}
public byte getLineSpacing() {
return JRStyleResolver.getLineSpacing((JRCommonText)this);
}
public Byte getOwnLineSpacing() {
return this.lineSpacing;
}
public void setLineSpacing(byte lineSpacing) {
setLineSpacing(new Byte(lineSpacing));
}
public void setLineSpacing(Byte lineSpacing) {
Object old = this.lineSpacing;
this.lineSpacing = lineSpacing;
getEventSupport().firePropertyChange("lineSpacing", old, this.lineSpacing);
}
public boolean isStyledText() {
return "styled".equals(getMarkup());
}
public Boolean isOwnStyledText() {
String mkp = getOwnMarkup();
return "styled".equals(mkp) ? Boolean.TRUE : ((mkp == null) ? null : Boolean.FALSE);
}
public void setStyledText(boolean isStyledText) {
setStyledText(isStyledText ? Boolean.TRUE : Boolean.FALSE);
}
public void setStyledText(Boolean isStyledText) {
if (isStyledText == null) {
setMarkup((String)null);
} else {
setMarkup(isStyledText.booleanValue() ? "styled" : "none");
}
}
public String getMarkup() {
return JRStyleResolver.getMarkup((JRCommonText)this);
}
public String getOwnMarkup() {
return this.markup;
}
public void setMarkup(String markup) {
Object old = this.markup;
this.markup = markup;
getEventSupport().firePropertyChange("markup", old, this.markup);
}
public JRBox getBox() {
return (JRBox)new LineBoxWrapper(getLineBox());
}
public JRLineBox getLineBox() {
return this.lineBox;
}
public JRFont getFont() {
return (JRFont)this;
}
public byte getMode() {
return JRStyleResolver.getMode((JRCommonElement)this, (byte)2);
}
public byte getBorder() {
return JRPenUtil.getPenFromLinePen(this.lineBox.getPen());
}
public Byte getOwnBorder() {
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getPen());
}
public void setBorder(byte border) {
JRPenUtil.setLinePenFromPen(border, this.lineBox.getPen());
}
public void setBorder(Byte border) {
JRPenUtil.setLinePenFromPen(border, this.lineBox.getPen());
}
public Color getBorderColor() {
return this.lineBox.getPen().getLineColor();
}
public Color getOwnBorderColor() {
return this.lineBox.getPen().getOwnLineColor();
}
public void setBorderColor(Color borderColor) {
this.lineBox.getPen().setLineColor(borderColor);
}
public int getPadding() {
return this.lineBox.getPadding().intValue();
}
public Integer getOwnPadding() {
return this.lineBox.getOwnPadding();
}
public void setPadding(int padding) {
this.lineBox.setPadding(padding);
}
public void setPadding(Integer padding) {
this.lineBox.setPadding(padding);
}
public byte getTopBorder() {
return JRPenUtil.getPenFromLinePen(this.lineBox.getTopPen());
}
public Byte getOwnTopBorder() {
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getTopPen());
}
public void setTopBorder(byte topBorder) {
JRPenUtil.setLinePenFromPen(topBorder, this.lineBox.getTopPen());
}
public void setTopBorder(Byte topBorder) {
JRPenUtil.setLinePenFromPen(topBorder, this.lineBox.getTopPen());
}
public Color getTopBorderColor() {
return this.lineBox.getTopPen().getLineColor();
}
public Color getOwnTopBorderColor() {
return this.lineBox.getTopPen().getOwnLineColor();
}
public void setTopBorderColor(Color topBorderColor) {
this.lineBox.getTopPen().setLineColor(topBorderColor);
}
public int getTopPadding() {
return this.lineBox.getTopPadding().intValue();
}
public Integer getOwnTopPadding() {
return this.lineBox.getOwnTopPadding();
}
public void setTopPadding(int topPadding) {
this.lineBox.setTopPadding(topPadding);
}
public void setTopPadding(Integer topPadding) {
this.lineBox.setTopPadding(topPadding);
}
public byte getLeftBorder() {
return JRPenUtil.getPenFromLinePen(this.lineBox.getLeftPen());
}
public Byte getOwnLeftBorder() {
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getLeftPen());
}
public void setLeftBorder(byte leftBorder) {
JRPenUtil.setLinePenFromPen(leftBorder, this.lineBox.getLeftPen());
}
public void setLeftBorder(Byte leftBorder) {
JRPenUtil.setLinePenFromPen(leftBorder, this.lineBox.getLeftPen());
}
public Color getLeftBorderColor() {
return this.lineBox.getLeftPen().getLineColor();
}
public Color getOwnLeftBorderColor() {
return this.lineBox.getLeftPen().getOwnLineColor();
}
public void setLeftBorderColor(Color leftBorderColor) {
this.lineBox.getLeftPen().setLineColor(leftBorderColor);
}
public int getLeftPadding() {
return this.lineBox.getLeftPadding().intValue();
}
public Integer getOwnLeftPadding() {
return this.lineBox.getOwnLeftPadding();
}
public void setLeftPadding(int leftPadding) {
this.lineBox.setLeftPadding(leftPadding);
}
public void setLeftPadding(Integer leftPadding) {
this.lineBox.setLeftPadding(leftPadding);
}
public byte getBottomBorder() {
return JRPenUtil.getPenFromLinePen(this.lineBox.getBottomPen());
}
public Byte getOwnBottomBorder() {
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getBottomPen());
}
public void setBottomBorder(byte bottomBorder) {
JRPenUtil.setLinePenFromPen(bottomBorder, this.lineBox.getBottomPen());
}
public void setBottomBorder(Byte bottomBorder) {
JRPenUtil.setLinePenFromPen(bottomBorder, this.lineBox.getBottomPen());
}
public Color getBottomBorderColor() {
return this.lineBox.getBottomPen().getLineColor();
}
public Color getOwnBottomBorderColor() {
return this.lineBox.getBottomPen().getOwnLineColor();
}
public void setBottomBorderColor(Color bottomBorderColor) {
this.lineBox.getBottomPen().setLineColor(bottomBorderColor);
}
public int getBottomPadding() {
return this.lineBox.getBottomPadding().intValue();
}
public Integer getOwnBottomPadding() {
return this.lineBox.getOwnBottomPadding();
}
public void setBottomPadding(int bottomPadding) {
this.lineBox.setBottomPadding(bottomPadding);
}
public void setBottomPadding(Integer bottomPadding) {
this.lineBox.setBottomPadding(bottomPadding);
}
public byte getRightBorder() {
return JRPenUtil.getPenFromLinePen(this.lineBox.getRightPen());
}
public Byte getOwnRightBorder() {
return JRPenUtil.getOwnPenFromLinePen(this.lineBox.getRightPen());
}
public void setRightBorder(byte rightBorder) {
JRPenUtil.setLinePenFromPen(rightBorder, this.lineBox.getRightPen());
}
public void setRightBorder(Byte rightBorder) {
JRPenUtil.setLinePenFromPen(rightBorder, this.lineBox.getRightPen());
}
public Color getRightBorderColor() {
return this.lineBox.getRightPen().getLineColor();
}
public Color getOwnRightBorderColor() {
return this.lineBox.getRightPen().getOwnLineColor();
}
public void setRightBorderColor(Color rightBorderColor) {
this.lineBox.getRightPen().setLineColor(rightBorderColor);
}
public int getRightPadding() {
return this.lineBox.getRightPadding().intValue();
}
public Integer getOwnRightPadding() {
return this.lineBox.getOwnRightPadding();
}
public void setRightPadding(int rightPadding) {
this.lineBox.setRightPadding(rightPadding);
}
public void setRightPadding(Integer rightPadding) {
this.lineBox.setRightPadding(rightPadding);
}
public JRReportFont getReportFont() {
return this.reportFont;
}
public void setReportFont(JRReportFont reportFont) {
Object old = this.reportFont;
this.reportFont = reportFont;
getEventSupport().firePropertyChange("reportFont", old, this.reportFont);
}
public String getFontName() {
return JRStyleResolver.getFontName((JRFont)this);
}
public String getOwnFontName() {
return this.fontName;
}
public void setFontName(String fontName) {
Object old = this.fontName;
this.fontName = fontName;
getEventSupport().firePropertyChange("fontName", old, this.fontName);
}
public boolean isBold() {
return JRStyleResolver.isBold((JRFont)this);
}
public Boolean isOwnBold() {
return this.isBold;
}
public void setBold(boolean isBold) {
setBold(isBold ? Boolean.TRUE : Boolean.FALSE);
}
public void setBold(Boolean isBold) {
Object old = this.isBold;
this.isBold = isBold;
getEventSupport().firePropertyChange("bold", old, this.isBold);
}
public boolean isItalic() {
return JRStyleResolver.isItalic((JRFont)this);
}
public Boolean isOwnItalic() {
return this.isItalic;
}
public void setItalic(boolean isItalic) {
setItalic(isItalic ? Boolean.TRUE : Boolean.FALSE);
}
public void setItalic(Boolean isItalic) {
Object old = this.isItalic;
this.isItalic = isItalic;
getEventSupport().firePropertyChange("italic", old, this.isItalic);
}
public boolean isUnderline() {
return JRStyleResolver.isUnderline((JRFont)this);
}
public Boolean isOwnUnderline() {
return this.isUnderline;
}
public void setUnderline(boolean isUnderline) {
setUnderline(isUnderline ? Boolean.TRUE : Boolean.FALSE);
}
public void setUnderline(Boolean isUnderline) {
Object old = this.isUnderline;
this.isUnderline = isUnderline;
getEventSupport().firePropertyChange("underline", old, this.isUnderline);
}
public boolean isStrikeThrough() {
return JRStyleResolver.isStrikeThrough((JRFont)this);
}
public Boolean isOwnStrikeThrough() {
return this.isStrikeThrough;
}
public void setStrikeThrough(boolean isStrikeThrough) {
setStrikeThrough(isStrikeThrough ? Boolean.TRUE : Boolean.FALSE);
}
public void setStrikeThrough(Boolean isStrikeThrough) {
Object old = this.isStrikeThrough;
this.isStrikeThrough = isStrikeThrough;
getEventSupport().firePropertyChange("strikeThrough", old, this.isStrikeThrough);
}
public int getFontSize() {
return JRStyleResolver.getFontSize((JRFont)this);
}
public Integer getOwnFontSize() {
return this.fontSize;
}
public void setFontSize(int fontSize) {
setFontSize(new Integer(fontSize));
}
public void setFontSize(Integer fontSize) {
Object old = this.fontSize;
this.fontSize = fontSize;
getEventSupport().firePropertyChange("fontSize", old, this.fontSize);
}
public int getSize() {
return getFontSize();
}
public Integer getOwnSize() {
return getOwnFontSize();
}
public void setSize(int size) {
setFontSize(size);
}
public void setSize(Integer size) {
setFontSize(size);
}
public String getPdfFontName() {
return JRStyleResolver.getPdfFontName((JRFont)this);
}
public String getOwnPdfFontName() {
return this.pdfFontName;
}
public void setPdfFontName(String pdfFontName) {
Object old = this.pdfFontName;
this.pdfFontName = pdfFontName;
getEventSupport().firePropertyChange("pdfFontName", old, this.pdfFontName);
}
public String getPdfEncoding() {
return JRStyleResolver.getPdfEncoding((JRFont)this);
}
public String getOwnPdfEncoding() {
return this.pdfEncoding;
}
public void setPdfEncoding(String pdfEncoding) {
Object old = this.pdfEncoding;
this.pdfEncoding = pdfEncoding;
getEventSupport().firePropertyChange("pdfEncoding", old, this.pdfEncoding);
}
public boolean isPdfEmbedded() {
return JRStyleResolver.isPdfEmbedded((JRFont)this);
}
public Boolean isOwnPdfEmbedded() {
return this.isPdfEmbedded;
}
public void setPdfEmbedded(boolean isPdfEmbedded) {
setPdfEmbedded(isPdfEmbedded ? Boolean.TRUE : Boolean.FALSE);
}
public void setPdfEmbedded(Boolean isPdfEmbedded) {
Object old = this.isPdfEmbedded;
this.isPdfEmbedded = isPdfEmbedded;
getEventSupport().firePropertyChange("pdfEmbedded", old, this.isPdfEmbedded);
}
public Color getDefaultLineColor() {
return getForecolor();
}
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
if (this.lineBox == null) {
this.lineBox = new JRBaseLineBox((JRBoxContainer)this);
JRBoxUtil.setToBox(this.border, this.topBorder, this.leftBorder, this.bottomBorder, this.rightBorder, this.borderColor, this.topBorderColor, this.leftBorderColor, this.bottomBorderColor, this.rightBorderColor, this.padding, this.topPadding, this.leftPadding, this.bottomPadding, this.rightPadding, this.lineBox);
this.border = null;
this.topBorder = null;
this.leftBorder = null;
this.bottomBorder = null;
this.rightBorder = null;
this.borderColor = null;
this.topBorderColor = null;
this.leftBorderColor = null;
this.bottomBorderColor = null;
this.rightBorderColor = null;
this.padding = null;
this.topPadding = null;
this.leftPadding = null;
this.bottomPadding = null;
this.rightPadding = null;
}
if (this.isStyledText != null) {
this.markup = this.isStyledText.booleanValue() ? "styled" : "none";
this.isStyledText = null;
}
}
}

View File

@@ -0,0 +1,206 @@
package net.sf.jasperreports.engine.base;
import java.io.IOException;
import java.io.ObjectInputStream;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.JRExpressionCollector;
import net.sf.jasperreports.engine.JRGroup;
import net.sf.jasperreports.engine.JRHyperlink;
import net.sf.jasperreports.engine.JRHyperlinkHelper;
import net.sf.jasperreports.engine.JRHyperlinkParameter;
import net.sf.jasperreports.engine.JRTextElement;
import net.sf.jasperreports.engine.JRTextField;
import net.sf.jasperreports.engine.JRVisitor;
import net.sf.jasperreports.engine.util.JRStyleResolver;
public class JRBaseTextField extends JRBaseTextElement implements JRTextField {
private static final long serialVersionUID = 10200L;
public static final String PROPERTY_STRETCH_WITH_OVERFLOW = "stretchWithOverflow";
protected boolean isStretchWithOverflow = false;
protected byte evaluationTime = 1;
protected String pattern;
protected Boolean isBlankWhenNull = null;
protected byte hyperlinkType = 0;
protected String linkType;
protected byte hyperlinkTarget = 1;
private JRHyperlinkParameter[] hyperlinkParameters;
protected JRGroup evaluationGroup = null;
protected JRExpression expression = null;
protected JRExpression anchorNameExpression = null;
protected JRExpression hyperlinkReferenceExpression = null;
protected JRExpression hyperlinkAnchorExpression = null;
protected JRExpression hyperlinkPageExpression = null;
private JRExpression hyperlinkTooltipExpression;
protected int bookmarkLevel = 0;
protected JRBaseTextField(JRTextField textField, JRBaseObjectFactory factory) {
super((JRTextElement)textField, factory);
this.isStretchWithOverflow = textField.isStretchWithOverflow();
this.evaluationTime = textField.getEvaluationTime();
this.pattern = textField.getOwnPattern();
this.isBlankWhenNull = textField.isOwnBlankWhenNull();
this.linkType = textField.getLinkType();
this.hyperlinkTarget = textField.getHyperlinkTarget();
this.hyperlinkParameters = JRBaseHyperlink.copyHyperlinkParameters((JRHyperlink)textField, factory);
this.evaluationGroup = factory.getGroup(textField.getEvaluationGroup());
this.expression = factory.getExpression(textField.getExpression());
this.anchorNameExpression = factory.getExpression(textField.getAnchorNameExpression());
this.hyperlinkReferenceExpression = factory.getExpression(textField.getHyperlinkReferenceExpression());
this.hyperlinkAnchorExpression = factory.getExpression(textField.getHyperlinkAnchorExpression());
this.hyperlinkPageExpression = factory.getExpression(textField.getHyperlinkPageExpression());
this.hyperlinkTooltipExpression = factory.getExpression(textField.getHyperlinkTooltipExpression());
this.bookmarkLevel = textField.getBookmarkLevel();
}
public boolean isStretchWithOverflow() {
return this.isStretchWithOverflow;
}
public void setStretchWithOverflow(boolean isStretchWithOverflow) {
boolean old = this.isStretchWithOverflow;
this.isStretchWithOverflow = isStretchWithOverflow;
getEventSupport().firePropertyChange("stretchWithOverflow", old, this.isStretchWithOverflow);
}
public byte getEvaluationTime() {
return this.evaluationTime;
}
public String getPattern() {
return JRStyleResolver.getPattern(this);
}
public String getOwnPattern() {
return this.pattern;
}
public void setPattern(String pattern) {
Object old = this.pattern;
this.pattern = pattern;
getEventSupport().firePropertyChange("pattern", old, this.pattern);
}
public boolean isBlankWhenNull() {
return JRStyleResolver.isBlankWhenNull(this);
}
public Boolean isOwnBlankWhenNull() {
return this.isBlankWhenNull;
}
public void setBlankWhenNull(Boolean isBlank) {
Object old = this.isBlankWhenNull;
this.isBlankWhenNull = isBlank;
getEventSupport().firePropertyChange("blankWhenNull", old, this.isBlankWhenNull);
}
public void setBlankWhenNull(boolean isBlank) {
setBlankWhenNull(isBlank ? Boolean.TRUE : Boolean.FALSE);
}
public byte getHyperlinkType() {
return JRHyperlinkHelper.getHyperlinkType((JRHyperlink)this);
}
public byte getHyperlinkTarget() {
return this.hyperlinkTarget;
}
public JRGroup getEvaluationGroup() {
return this.evaluationGroup;
}
public JRExpression getExpression() {
return this.expression;
}
public JRExpression getAnchorNameExpression() {
return this.anchorNameExpression;
}
public JRExpression getHyperlinkReferenceExpression() {
return this.hyperlinkReferenceExpression;
}
public JRExpression getHyperlinkAnchorExpression() {
return this.hyperlinkAnchorExpression;
}
public JRExpression getHyperlinkPageExpression() {
return this.hyperlinkPageExpression;
}
public void collectExpressions(JRExpressionCollector collector) {
collector.collect(this);
}
public void visit(JRVisitor visitor) {
visitor.visitTextField(this);
}
public int getBookmarkLevel() {
return this.bookmarkLevel;
}
public String getLinkType() {
return this.linkType;
}
public JRHyperlinkParameter[] getHyperlinkParameters() {
return this.hyperlinkParameters;
}
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
normalizeLinkType();
}
protected void normalizeLinkType() {
if (this.linkType == null)
this.linkType = JRHyperlinkHelper.getLinkType(this.hyperlinkType);
this.hyperlinkType = 0;
}
public JRExpression getHyperlinkTooltipExpression() {
return this.hyperlinkTooltipExpression;
}
public Object clone() {
JRBaseTextField clone = (JRBaseTextField)super.clone();
if (this.hyperlinkParameters != null) {
clone.hyperlinkParameters = new JRHyperlinkParameter[this.hyperlinkParameters.length];
for (int i = 0; i < this.hyperlinkParameters.length; i++)
clone.hyperlinkParameters[i] = (JRHyperlinkParameter)this.hyperlinkParameters[i].clone();
}
if (this.expression != null)
clone.expression = (JRExpression)this.expression.clone();
if (this.anchorNameExpression != null)
clone.anchorNameExpression = (JRExpression)this.anchorNameExpression.clone();
if (this.hyperlinkReferenceExpression != null)
clone.hyperlinkReferenceExpression = (JRExpression)this.hyperlinkReferenceExpression.clone();
if (this.hyperlinkAnchorExpression != null)
clone.hyperlinkAnchorExpression = (JRExpression)this.hyperlinkAnchorExpression.clone();
if (this.hyperlinkPageExpression != null)
clone.hyperlinkPageExpression = (JRExpression)this.hyperlinkPageExpression.clone();
if (this.hyperlinkTooltipExpression != null)
clone.hyperlinkTooltipExpression = (JRExpression)this.hyperlinkTooltipExpression.clone();
return clone;
}
}

View File

@@ -0,0 +1,155 @@
package net.sf.jasperreports.engine.base;
import java.io.Serializable;
import net.sf.jasperreports.engine.JRExpression;
import net.sf.jasperreports.engine.JRGroup;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.JRVariable;
import net.sf.jasperreports.engine.util.JRClassLoader;
public class JRBaseVariable implements JRVariable, Serializable {
private static final long serialVersionUID = 10200L;
protected String name = null;
protected String valueClassName = String.class.getName();
protected String valueClassRealName = null;
protected String incrementerFactoryClassName = null;
protected String incrementerFactoryClassRealName = null;
protected byte resetType = 1;
protected byte incrementType = 5;
protected byte calculation = 0;
protected boolean isSystemDefined = false;
protected transient Class valueClass = null;
protected transient Class incrementerFactoryClass = null;
protected JRExpression expression = null;
protected JRExpression initialValueExpression = null;
protected JRGroup resetGroup = null;
protected JRGroup incrementGroup = null;
protected JRBaseVariable(JRVariable variable, JRBaseObjectFactory factory) {
factory.put(variable, this);
this.name = variable.getName();
this.valueClassName = variable.getValueClassName();
this.incrementerFactoryClassName = variable.getIncrementerFactoryClassName();
this.resetType = variable.getResetType();
this.incrementType = variable.getIncrementType();
this.calculation = variable.getCalculation();
this.isSystemDefined = variable.isSystemDefined();
this.expression = factory.getExpression(variable.getExpression());
this.initialValueExpression = factory.getExpression(variable.getInitialValueExpression());
this.resetGroup = factory.getGroup(variable.getResetGroup());
this.incrementGroup = factory.getGroup(variable.getIncrementGroup());
}
public String getName() {
return this.name;
}
public Class getValueClass() {
if (this.valueClass == null) {
String className = getValueClassRealName();
if (className != null)
try {
this.valueClass = JRClassLoader.loadClassForName(className);
} catch (ClassNotFoundException e) {
throw new JRRuntimeException(e);
}
}
return this.valueClass;
}
public String getValueClassName() {
return this.valueClassName;
}
private String getValueClassRealName() {
if (this.valueClassRealName == null)
this.valueClassRealName = JRClassLoader.getClassRealName(this.valueClassName);
return this.valueClassRealName;
}
public Class getIncrementerFactoryClass() {
if (this.incrementerFactoryClass == null) {
String className = getIncrementerFactoryClassRealName();
if (className != null)
try {
this.incrementerFactoryClass = JRClassLoader.loadClassForName(className);
} catch (ClassNotFoundException e) {
throw new JRRuntimeException(e);
}
}
return this.incrementerFactoryClass;
}
public String getIncrementerFactoryClassName() {
return this.incrementerFactoryClassName;
}
private String getIncrementerFactoryClassRealName() {
if (this.incrementerFactoryClassRealName == null)
this.incrementerFactoryClassRealName = JRClassLoader.getClassRealName(this.incrementerFactoryClassName);
return this.incrementerFactoryClassRealName;
}
public byte getResetType() {
return this.resetType;
}
public byte getIncrementType() {
return this.incrementType;
}
public byte getCalculation() {
return this.calculation;
}
public boolean isSystemDefined() {
return this.isSystemDefined;
}
public JRExpression getExpression() {
return this.expression;
}
public JRExpression getInitialValueExpression() {
return this.initialValueExpression;
}
public JRGroup getResetGroup() {
return this.resetGroup;
}
public JRGroup getIncrementGroup() {
return this.incrementGroup;
}
public Object clone() {
JRBaseVariable clone = null;
try {
clone = (JRBaseVariable)super.clone();
} catch (CloneNotSupportedException e) {
throw new JRRuntimeException(e);
}
if (this.expression != null)
clone.expression = (JRExpression)this.expression.clone();
if (this.initialValueExpression != null)
clone.initialValueExpression = (JRExpression)this.initialValueExpression.clone();
return clone;
}
protected JRBaseVariable() {}
}

View File

@@ -0,0 +1,12 @@
package net.sf.jasperreports.engine.base;
import net.sf.jasperreports.engine.JRLineBox;
import net.sf.jasperreports.engine.JRPen;
public interface JRBoxPen extends JRPen {
JRLineBox getBox();
JRPen getPen(JRLineBox paramJRLineBox);
JRBoxPen clone(JRLineBox paramJRLineBox);
}

View File

@@ -0,0 +1,439 @@
package net.sf.jasperreports.engine.base;
import java.awt.Graphics2D;
import java.awt.geom.Dimension2D;
import java.awt.geom.Rectangle2D;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRPrintElement;
import net.sf.jasperreports.engine.JRPrintFrame;
import net.sf.jasperreports.engine.JRPrintImage;
import net.sf.jasperreports.engine.JRPrintPage;
import net.sf.jasperreports.engine.JRRenderable;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.JRVirtualizable;
import net.sf.jasperreports.engine.JRVirtualizationHelper;
import net.sf.jasperreports.engine.JRVirtualizer;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.fill.JRTemplateElement;
import net.sf.jasperreports.engine.fill.JRTemplatePrintElement;
import net.sf.jasperreports.engine.fill.JRVirtualizationContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class JRVirtualPrintPage implements JRPrintPage, JRVirtualizable, Serializable {
protected static final Log log = LogFactory.getLog(JRVirtualPrintPage.class);
private static final long serialVersionUID = 10200L;
public static class ObjectIDPair implements Serializable {
private static final long serialVersionUID = 10200L;
private final Object o;
private final int id;
public ObjectIDPair(Object o) {
this.o = o;
this.id = System.identityHashCode(o);
}
public Object getObject() {
return this.o;
}
public int getIdentity() {
return this.id;
}
}
private static final Random random = new Random(System.currentTimeMillis());
private static short counter = 1;
protected List elements = new ArrayList();
private String uid;
private transient JRVirtualizer virtualizer;
private transient IdentityDataProvider[] identityProviders;
protected JRVirtualizationContext virtualizationContext;
public JRVirtualPrintPage(JasperPrint printObject, JRVirtualizer virtualizer, JRVirtualizationContext virtualizationContext) {
this.virtualizationContext = virtualizationContext;
this.uid = makeUID(printObject);
this.virtualizer = virtualizer;
this.identityProviders = null;
if (virtualizer != null)
virtualizer.registerObject(this);
}
private static String makeUID(JasperPrint printObject) {
synchronized (random) {
counter = (short)(counter + 1);
return Integer.toString(System.identityHashCode(printObject)) + "_" + printObject.getPages().size() + "_" + Integer.toString(counter) + "_" + Integer.toString(random.nextInt());
}
}
public final String getUID() {
return this.uid;
}
public void setVirtualData(Object o) {
this.elements = (List)o;
}
public Object getVirtualData() {
return this.elements;
}
public void removeVirtualData() {
this.elements = null;
}
public void setIdentityData(Object o) {
if (this.identityProviders != null)
for (int i = 0; i < this.identityProviders.length; i++)
this.identityProviders[i].setIdentityData(this, (ObjectIDPair[])o);
}
public Object getIdentityData() {
ObjectIDPair[] data;
if (this.identityProviders != null) {
if (this.identityProviders.length == 1) {
data = this.identityProviders[0].getIdentityData(this);
} else if (this.identityProviders.length > 1) {
Set list = new HashSet();
for (int i = 0; i < this.identityProviders.length; i++) {
ObjectIDPair[] pairs = this.identityProviders[i].getIdentityData(this);
if (pairs != null)
for (int j = 0; j < pairs.length; j++)
list.add(pairs[j]);
}
data = list.<ObjectIDPair>toArray(new ObjectIDPair[list.size()]);
} else {
data = null;
}
} else {
data = null;
}
return data;
}
public boolean isVirtualized() {
return (this.elements == null);
}
public void setVirtualizer(JRVirtualizer virtualizer) {
this.virtualizer = virtualizer;
}
public JRVirtualizer getVirtualizer() {
return this.virtualizer;
}
public void addIdentityDataProvider(IdentityDataProvider p) {
if (this.identityProviders == null) {
this.identityProviders = new IdentityDataProvider[] { p };
} else {
IdentityDataProvider[] newList = new IdentityDataProvider[this.identityProviders.length + 1];
System.arraycopy(this.identityProviders, 0, newList, 0, this.identityProviders.length);
newList[this.identityProviders.length] = p;
this.identityProviders = newList;
}
}
public void removeIdentityDataProvider(IdentityDataProvider p) {
if (this.identityProviders != null)
for (int idx = 0; idx < this.identityProviders.length; idx++) {
if (this.identityProviders[idx] == p) {
IdentityDataProvider[] newList = new IdentityDataProvider[this.identityProviders.length - 1];
System.arraycopy(this.identityProviders, 0, newList, 0, idx);
int remaining = this.identityProviders.length - idx - 1;
if (remaining > 0)
System.arraycopy(this.identityProviders, idx + 1, newList, idx, remaining);
this.identityProviders = newList;
break;
}
}
}
public List getElements() {
ensureVirtualData();
return this.elements;
}
protected void ensureVirtualData() {
if (this.virtualizer != null)
this.virtualizer.requestData(this);
}
public void setElements(List elements) {
cleanVirtualData();
this.elements = elements;
cacheInContext(this.elements);
}
protected void cleanVirtualData() {
if (this.virtualizer != null)
this.virtualizer.clearData(this);
}
public void addElement(JRPrintElement element) {
ensureVirtualData();
this.elements.add(element);
cacheInContext(element);
}
public static interface IdentityDataProvider {
JRVirtualPrintPage.ObjectIDPair[] getIdentityData(JRVirtualPrintPage param1JRVirtualPrintPage);
void setIdentityData(JRVirtualPrintPage param1JRVirtualPrintPage, JRVirtualPrintPage.ObjectIDPair[] param1ArrayOfObjectIDPair);
}
protected static class JRIdHolderRenderer implements JRRenderable, Serializable {
private static final long serialVersionUID = 10200L;
protected final String id;
protected JRIdHolderRenderer(JRRenderable renderer) {
this.id = renderer.getId();
}
public String getId() {
return this.id;
}
public byte getType() {
return 0;
}
public byte getImageType() {
return 0;
}
public Dimension2D getDimension() throws JRException {
return null;
}
public byte[] getImageData() throws JRException {
return null;
}
public void render(Graphics2D grx, Rectangle2D rectanle) throws JRException {}
}
protected static class JRIdHolderTemplateElement extends JRTemplateElement {
private static final long serialVersionUID = 10200L;
protected JRIdHolderTemplateElement(String id) {
super(id);
}
}
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
this.uid = (String)in.readObject();
this.virtualizationContext = (JRVirtualizationContext)in.readObject();
int length = in.readInt();
byte[] buffer = new byte[length];
in.readFully(buffer);
ByteArrayInputStream inputStream = new ByteArrayInputStream(buffer, 0, buffer.length);
ObjectInputStream elementsStream = new ObjectInputStream(inputStream);
this.elements = (List)elementsStream.readObject();
afterInternalization();
setThreadVirtualizer();
}
private void writeObject(ObjectOutputStream out) throws IOException {
ensureVirtualData();
beforeExternalization();
try {
out.writeObject(this.uid);
out.writeObject(this.virtualizationContext);
ByteArrayOutputStream bout = new ByteArrayOutputStream();
ObjectOutputStream stream = new ObjectOutputStream(bout);
stream.writeObject(this.elements);
stream.flush();
byte[] bytes = bout.toByteArray();
out.writeInt(bytes.length);
out.write(bytes);
} finally {
afterExternalization();
}
}
private void setThreadVirtualizer() {
JRVirtualizer threadVirtualizer = JRVirtualizationHelper.getThreadVirtualizer();
if (threadVirtualizer != null) {
this.virtualizer = threadVirtualizer;
this.virtualizer.registerObject(this);
}
}
protected void finalize() {
if (this.virtualizer != null)
this.virtualizer.deregisterObject(this);
}
protected List getDeepElements() {
List deepElements = new ArrayList(this.elements.size());
collectDeepElements(this.elements, deepElements);
return deepElements;
}
protected void collectDeepElements(List elementsList, List deepElements) {
for (Iterator it = elementsList.iterator(); it.hasNext(); ) {
JRPrintElement element = it.next();
deepElements.add(element);
if (element instanceof JRPrintFrame) {
JRPrintFrame frame = (JRPrintFrame)element;
collectDeepElements(frame.getElements(), deepElements);
}
}
}
public void beforeExternalization() {
setElementsExternalData();
}
protected void setElementsExternalData() {
traverseDeepElements(new ExternalizationElementVisitor());
}
protected void setExternalizationRenderer(JRPrintImage image) {
JRRenderable renderer = image.getRenderer();
if (renderer != null && this.virtualizationContext.hasCachedRenderer(renderer.getId()))
image.setRenderer(new JRIdHolderRenderer(renderer));
}
protected void cacheInContext(List elementList) {
if (elementList != null && !elementList.isEmpty())
for (Iterator it = elementList.iterator(); it.hasNext(); ) {
JRPrintElement element = it.next();
cacheInContext(element);
}
}
protected void cacheInContext(JRPrintElement element) {
if (element instanceof JRTemplatePrintElement) {
JRTemplatePrintElement templateElement = (JRTemplatePrintElement)element;
JRTemplateElement template = templateElement.getTemplate();
if (template != null)
this.virtualizationContext.cacheTemplate(template);
}
if (element instanceof JRPrintFrame) {
JRPrintFrame frame = (JRPrintFrame)element;
cacheInContext(frame.getElements());
}
}
public void afterInternalization() {
restoreElementsData();
}
protected void restoreElementsData() {
traverseDeepElements(new InternalizationElementVisitor());
}
public JRVirtualizationContext getContext() {
return this.virtualizationContext;
}
public void afterExternalization() {
restoreElementsData();
}
protected void traverseDeepElements(ElementVisitor visitor) {
traverseDeepElements(visitor, this.elements);
}
protected void traverseDeepElements(ElementVisitor visitor, List elementsList) {
for (Iterator it = elementsList.iterator(); it.hasNext(); ) {
JRPrintElement element = it.next();
visitor.visitElement(element);
if (element instanceof JRPrintFrame) {
JRPrintFrame frame = (JRPrintFrame)element;
traverseDeepElements(visitor, frame.getElements());
}
}
}
protected static interface ElementVisitor {
void visitElement(JRPrintElement param1JRPrintElement);
}
protected class ExternalizationElementVisitor implements ElementVisitor {
private final Map idTemplates = new HashMap();
private final JRVirtualPrintPage this$0;
public void visitElement(JRPrintElement element) {
if (element instanceof JRTemplatePrintElement)
setExternalizationTemplate((JRTemplatePrintElement)element);
if (element instanceof JRPrintImage)
JRVirtualPrintPage.this.setExternalizationRenderer((JRPrintImage)element);
}
protected void setExternalizationTemplate(JRTemplatePrintElement templateElement) {
JRTemplateElement template = templateElement.getTemplate();
if (template != null)
if (JRVirtualPrintPage.this.virtualizationContext.hasCachedTemplate(template.getId())) {
String templateId = template.getId();
JRVirtualPrintPage.JRIdHolderTemplateElement idTemplate = (JRVirtualPrintPage.JRIdHolderTemplateElement)this.idTemplates.get(templateId);
if (idTemplate == null) {
idTemplate = new JRVirtualPrintPage.JRIdHolderTemplateElement(templateId);
this.idTemplates.put(templateId, idTemplate);
}
templateElement.setTemplate(idTemplate);
} else if (JRVirtualPrintPage.log.isDebugEnabled()) {
JRVirtualPrintPage.log.debug("Template " + template + " having id " + template.getId() + " not found in virtualization context cache");
}
}
}
protected class InternalizationElementVisitor implements ElementVisitor {
private final JRVirtualPrintPage this$0;
public void visitElement(JRPrintElement element) {
if (element instanceof JRTemplatePrintElement)
restoreTemplate((JRTemplatePrintElement)element);
if (element instanceof JRPrintImage)
restoreRenderer((JRPrintImage)element);
}
protected void restoreTemplate(JRTemplatePrintElement element) {
JRTemplateElement template = element.getTemplate();
if (template != null && template instanceof JRVirtualPrintPage.JRIdHolderTemplateElement) {
JRTemplateElement cachedTemplate = JRVirtualPrintPage.this.virtualizationContext.getCachedTemplate(template.getId());
if (cachedTemplate == null)
throw new JRRuntimeException("Template " + template.getId() + " not found in virtualization context.");
element.setTemplate(cachedTemplate);
}
}
protected void restoreRenderer(JRPrintImage image) {
JRRenderable renderer = image.getRenderer();
if (renderer != null && renderer instanceof JRVirtualPrintPage.JRIdHolderRenderer) {
JRRenderable cachedRenderer = JRVirtualPrintPage.this.virtualizationContext.getCachedRenderer(renderer.getId());
if (cachedRenderer == null)
throw new JRRuntimeException("Renderer " + renderer.getId() + " not found in virtualization context.");
image.setRenderer(cachedRenderer);
}
}
}
}