0001: /*
0002: * ============================================================================
0003: * GNU Lesser General Public License
0004: * ============================================================================
0005: *
0006: * JasperReports - Free Java report-generating library.
0007: * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com
0008: *
0009: * This library is free software; you can redistribute it and/or
0010: * modify it under the terms of the GNU Lesser General Public
0011: * License as published by the Free Software Foundation; either
0012: * version 2.1 of the License, or (at your option) any later version.
0013: *
0014: * This library is distributed in the hope that it will be useful,
0015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
0016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0017: * Lesser General Public License for more details.
0018: *
0019: * You should have received a copy of the GNU Lesser General Public
0020: * License along with this library; if not, write to the Free Software
0021: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
0022: *
0023: * JasperSoft Corporation
0024: * 303 Second Street, Suite 450 North
0025: * San Francisco, CA 94107
0026: * http://www.jaspersoft.com
0027: */
0028: package net.sf.jasperreports.engine.base;
0029:
0030: import net.sf.jasperreports.charts.JRAreaPlot;
0031: import net.sf.jasperreports.charts.JRBar3DPlot;
0032: import net.sf.jasperreports.charts.JRBarPlot;
0033: import net.sf.jasperreports.charts.JRBubblePlot;
0034: import net.sf.jasperreports.charts.JRCandlestickPlot;
0035: import net.sf.jasperreports.charts.JRCategoryDataset;
0036: import net.sf.jasperreports.charts.JRCategorySeries;
0037: import net.sf.jasperreports.charts.JRChartAxis;
0038: import net.sf.jasperreports.charts.JRHighLowDataset;
0039: import net.sf.jasperreports.charts.JRHighLowPlot;
0040: import net.sf.jasperreports.charts.JRLinePlot;
0041: import net.sf.jasperreports.charts.JRMeterPlot;
0042: import net.sf.jasperreports.charts.JRMultiAxisPlot;
0043: import net.sf.jasperreports.charts.JRPie3DPlot;
0044: import net.sf.jasperreports.charts.JRPieDataset;
0045: import net.sf.jasperreports.charts.JRPiePlot;
0046: import net.sf.jasperreports.charts.JRScatterPlot;
0047: import net.sf.jasperreports.charts.JRThermometerPlot;
0048: import net.sf.jasperreports.charts.JRTimePeriodDataset;
0049: import net.sf.jasperreports.charts.JRTimePeriodSeries;
0050: import net.sf.jasperreports.charts.JRTimeSeries;
0051: import net.sf.jasperreports.charts.JRTimeSeriesDataset;
0052: import net.sf.jasperreports.charts.JRTimeSeriesPlot;
0053: import net.sf.jasperreports.charts.JRValueDataset;
0054: import net.sf.jasperreports.charts.JRXyDataset;
0055: import net.sf.jasperreports.charts.JRXySeries;
0056: import net.sf.jasperreports.charts.JRXyzDataset;
0057: import net.sf.jasperreports.charts.JRXyzSeries;
0058: import net.sf.jasperreports.charts.base.JRBaseAreaPlot;
0059: import net.sf.jasperreports.charts.base.JRBaseBar3DPlot;
0060: import net.sf.jasperreports.charts.base.JRBaseBarPlot;
0061: import net.sf.jasperreports.charts.base.JRBaseBubblePlot;
0062: import net.sf.jasperreports.charts.base.JRBaseCandlestickPlot;
0063: import net.sf.jasperreports.charts.base.JRBaseCategoryDataset;
0064: import net.sf.jasperreports.charts.base.JRBaseCategorySeries;
0065: import net.sf.jasperreports.charts.base.JRBaseChartAxis;
0066: import net.sf.jasperreports.charts.base.JRBaseHighLowDataset;
0067: import net.sf.jasperreports.charts.base.JRBaseHighLowPlot;
0068: import net.sf.jasperreports.charts.base.JRBaseLinePlot;
0069: import net.sf.jasperreports.charts.base.JRBaseMeterPlot;
0070: import net.sf.jasperreports.charts.base.JRBaseMultiAxisPlot;
0071: import net.sf.jasperreports.charts.base.JRBasePie3DPlot;
0072: import net.sf.jasperreports.charts.base.JRBasePieDataset;
0073: import net.sf.jasperreports.charts.base.JRBasePiePlot;
0074: import net.sf.jasperreports.charts.base.JRBaseScatterPlot;
0075: import net.sf.jasperreports.charts.base.JRBaseThermometerPlot;
0076: import net.sf.jasperreports.charts.base.JRBaseTimePeriodDataset;
0077: import net.sf.jasperreports.charts.base.JRBaseTimePeriodSeries;
0078: import net.sf.jasperreports.charts.base.JRBaseTimeSeries;
0079: import net.sf.jasperreports.charts.base.JRBaseTimeSeriesDataset;
0080: import net.sf.jasperreports.charts.base.JRBaseTimeSeriesPlot;
0081: import net.sf.jasperreports.charts.base.JRBaseValueDataset;
0082: import net.sf.jasperreports.charts.base.JRBaseXyDataset;
0083: import net.sf.jasperreports.charts.base.JRBaseXySeries;
0084: import net.sf.jasperreports.charts.base.JRBaseXyzDataset;
0085: import net.sf.jasperreports.charts.base.JRBaseXyzSeries;
0086: import net.sf.jasperreports.crosstabs.JRCellContents;
0087: import net.sf.jasperreports.crosstabs.JRCrosstab;
0088: import net.sf.jasperreports.crosstabs.JRCrosstabBucket;
0089: import net.sf.jasperreports.crosstabs.JRCrosstabCell;
0090: import net.sf.jasperreports.crosstabs.JRCrosstabColumnGroup;
0091: import net.sf.jasperreports.crosstabs.JRCrosstabDataset;
0092: import net.sf.jasperreports.crosstabs.JRCrosstabMeasure;
0093: import net.sf.jasperreports.crosstabs.JRCrosstabParameter;
0094: import net.sf.jasperreports.crosstabs.JRCrosstabRowGroup;
0095: import net.sf.jasperreports.crosstabs.base.JRBaseCellContents;
0096: import net.sf.jasperreports.crosstabs.base.JRBaseCrosstab;
0097: import net.sf.jasperreports.crosstabs.base.JRBaseCrosstabBucket;
0098: import net.sf.jasperreports.crosstabs.base.JRBaseCrosstabCell;
0099: import net.sf.jasperreports.crosstabs.base.JRBaseCrosstabColumnGroup;
0100: import net.sf.jasperreports.crosstabs.base.JRBaseCrosstabDataset;
0101: import net.sf.jasperreports.crosstabs.base.JRBaseCrosstabMeasure;
0102: import net.sf.jasperreports.crosstabs.base.JRBaseCrosstabParameter;
0103: import net.sf.jasperreports.crosstabs.base.JRBaseCrosstabRowGroup;
0104: import net.sf.jasperreports.engine.JRAbstractObjectFactory;
0105: import net.sf.jasperreports.engine.JRBand;
0106: import net.sf.jasperreports.engine.JRBreak;
0107: import net.sf.jasperreports.engine.JRChart;
0108: import net.sf.jasperreports.engine.JRConditionalStyle;
0109: import net.sf.jasperreports.engine.JRDataset;
0110: import net.sf.jasperreports.engine.JRDatasetParameter;
0111: import net.sf.jasperreports.engine.JRDatasetRun;
0112: import net.sf.jasperreports.engine.JRDefaultStyleProvider;
0113: import net.sf.jasperreports.engine.JRElementGroup;
0114: import net.sf.jasperreports.engine.JREllipse;
0115: import net.sf.jasperreports.engine.JRExpression;
0116: import net.sf.jasperreports.engine.JRExpressionChunk;
0117: import net.sf.jasperreports.engine.JRExpressionCollector;
0118: import net.sf.jasperreports.engine.JRField;
0119: import net.sf.jasperreports.engine.JRFrame;
0120: import net.sf.jasperreports.engine.JRGroup;
0121: import net.sf.jasperreports.engine.JRHyperlink;
0122: import net.sf.jasperreports.engine.JRHyperlinkParameter;
0123: import net.sf.jasperreports.engine.JRImage;
0124: import net.sf.jasperreports.engine.JRLine;
0125: import net.sf.jasperreports.engine.JRParameter;
0126: import net.sf.jasperreports.engine.JRQuery;
0127: import net.sf.jasperreports.engine.JRQueryChunk;
0128: import net.sf.jasperreports.engine.JRRectangle;
0129: import net.sf.jasperreports.engine.JRReportFont;
0130: import net.sf.jasperreports.engine.JRReportTemplate;
0131: import net.sf.jasperreports.engine.JRRuntimeException;
0132: import net.sf.jasperreports.engine.JRSortField;
0133: import net.sf.jasperreports.engine.JRStaticText;
0134: import net.sf.jasperreports.engine.JRStyle;
0135: import net.sf.jasperreports.engine.JRStyleContainer;
0136: import net.sf.jasperreports.engine.JRStyleSetter;
0137: import net.sf.jasperreports.engine.JRSubreport;
0138: import net.sf.jasperreports.engine.JRSubreportParameter;
0139: import net.sf.jasperreports.engine.JRSubreportReturnValue;
0140: import net.sf.jasperreports.engine.JRTextField;
0141: import net.sf.jasperreports.engine.JRVariable;
0142:
0143: /**
0144: * @author Teodor Danciu (teodord@users.sourceforge.net)
0145: * @version $Id: JRBaseObjectFactory.java 1795 2007-07-30 09:18:47Z teodord $
0146: */
0147: public class JRBaseObjectFactory extends JRAbstractObjectFactory {
0148:
0149: /**
0150: *
0151: */
0152: private JRDefaultStyleProvider defaultStyleProvider = null;
0153:
0154: /**
0155: * Expression collector used to retrieve generated expression IDs.
0156: */
0157: private JRExpressionCollector expressionCollector;
0158:
0159: /**
0160: *
0161: */
0162: protected JRBaseObjectFactory(
0163: JRDefaultStyleProvider defaultStyleProvider) {
0164: this .defaultStyleProvider = defaultStyleProvider;
0165: }
0166:
0167: /**
0168: * Constructs a base object factory.
0169: *
0170: * @param defaultStyleProvider the default style provider
0171: * @param expressionCollector the expression collector used as expression ID provider
0172: */
0173: protected JRBaseObjectFactory(
0174: JRDefaultStyleProvider defaultStyleProvider,
0175: JRExpressionCollector expressionCollector) {
0176: this .defaultStyleProvider = defaultStyleProvider;
0177: this .expressionCollector = expressionCollector;
0178: }
0179:
0180: /**
0181: *
0182: */
0183: public JRDefaultStyleProvider getDefaultStyleProvider() {
0184: return defaultStyleProvider;
0185: }
0186:
0187: /**
0188: *
0189: */
0190: public JRReportFont getReportFont(JRReportFont font) {
0191: JRBaseReportFont baseFont = null;
0192:
0193: if (font != null) {
0194: baseFont = (JRBaseReportFont) get(font);
0195: if (baseFont == null) {
0196: baseFont = new JRBaseReportFont(font);
0197: put(font, baseFont);
0198: }
0199: }
0200:
0201: return baseFont;
0202: }
0203:
0204: /**
0205: *
0206: */
0207: public JRStyle getStyle(JRStyle style) {
0208: JRBaseStyle baseStyle = null;
0209:
0210: if (style != null) {
0211: baseStyle = (JRBaseStyle) get(style);
0212: if (baseStyle == null) {
0213: baseStyle = new JRBaseStyle(style, this );
0214: put(style, baseStyle);
0215: }
0216: }
0217:
0218: return baseStyle;
0219: }
0220:
0221: /**
0222: * This method preserves both specified styles and external style name references.
0223: *
0224: * @see JRAbstractObjectFactory#setStyle(JRStyleSetter, JRStyleContainer)
0225: */
0226: public void setStyle(JRStyleSetter setter,
0227: JRStyleContainer styleContainer) {
0228: JRStyle style = styleContainer.getStyle();
0229: String nameReference = styleContainer.getStyleNameReference();
0230: if (style != null) {
0231: JRStyle newStyle = getStyle(style);
0232: setter.setStyle(newStyle);
0233: } else if (nameReference != null) {
0234: handleStyleNameReference(setter, nameReference);
0235: }
0236: }
0237:
0238: protected void handleStyleNameReference(JRStyleSetter setter,
0239: String nameReference) {
0240: setter.setStyleNameReference(nameReference);
0241: }
0242:
0243: /**
0244: *
0245: *
0246: public JRFont getFont(JRFont font)
0247: {
0248: JRBaseFont baseFont = null;
0249:
0250: if (font != null)
0251: {
0252: baseFont = (JRBaseFont)get(font);
0253: if (baseFont == null)
0254: {
0255: baseFont =
0256: new JRBaseFont(
0257: defaultStyleProvider,
0258: getReportFont(font.getReportFont()),
0259: font
0260: );
0261: put(font, baseFont);
0262: }
0263: }
0264:
0265: return baseFont;
0266: }
0267:
0268:
0269: /**
0270: *
0271: */
0272: protected JRBaseParameter getParameter(JRParameter parameter) {
0273: JRBaseParameter baseParameter = null;
0274:
0275: if (parameter != null) {
0276: baseParameter = (JRBaseParameter) get(parameter);
0277: if (baseParameter == null) {
0278: baseParameter = new JRBaseParameter(parameter, this );
0279: }
0280: }
0281:
0282: return baseParameter;
0283: }
0284:
0285: /**
0286: *
0287: */
0288: protected JRBaseQuery getQuery(JRQuery query) {
0289: JRBaseQuery baseQuery = null;
0290:
0291: if (query != null) {
0292: baseQuery = (JRBaseQuery) get(query);
0293: if (baseQuery == null) {
0294: baseQuery = new JRBaseQuery(query, this );
0295: }
0296: }
0297:
0298: return baseQuery;
0299: }
0300:
0301: /**
0302: *
0303: */
0304: protected JRBaseQueryChunk getQueryChunk(JRQueryChunk queryChunk) {
0305: JRBaseQueryChunk baseQueryChunk = null;
0306:
0307: if (queryChunk != null) {
0308: baseQueryChunk = (JRBaseQueryChunk) get(queryChunk);
0309: if (baseQueryChunk == null) {
0310: baseQueryChunk = new JRBaseQueryChunk(queryChunk, this );
0311: }
0312: }
0313:
0314: return baseQueryChunk;
0315: }
0316:
0317: /**
0318: *
0319: */
0320: protected JRBaseField getField(JRField field) {
0321: JRBaseField baseField = null;
0322:
0323: if (field != null) {
0324: baseField = (JRBaseField) get(field);
0325: if (baseField == null) {
0326: baseField = new JRBaseField(field, this );
0327: }
0328: }
0329:
0330: return baseField;
0331: }
0332:
0333: /**
0334: *
0335: */
0336: protected JRBaseSortField getSortField(JRSortField sortField) {
0337: JRBaseSortField baseSortField = null;
0338:
0339: if (sortField != null) {
0340: baseSortField = (JRBaseSortField) get(sortField);
0341: if (baseSortField == null) {
0342: baseSortField = new JRBaseSortField(sortField, this );
0343: }
0344: }
0345:
0346: return baseSortField;
0347: }
0348:
0349: /**
0350: *
0351: */
0352: public JRBaseVariable getVariable(JRVariable variable) {
0353: JRBaseVariable baseVariable = null;
0354:
0355: if (variable != null) {
0356: baseVariable = (JRBaseVariable) get(variable);
0357: if (baseVariable == null) {
0358: baseVariable = new JRBaseVariable(variable, this );
0359: }
0360: }
0361:
0362: return baseVariable;
0363: }
0364:
0365: /**
0366: *
0367: */
0368: public JRExpression getExpression(JRExpression expression,
0369: boolean assignNotUsedId) {
0370: JRBaseExpression baseExpression = null;
0371:
0372: if (expression != null) {
0373: baseExpression = (JRBaseExpression) get(expression);
0374: if (baseExpression == null) {
0375: Integer expressionId = getCollectedExpressionId(
0376: expression, assignNotUsedId);
0377: baseExpression = new JRBaseExpression(expression, this ,
0378: expressionId);
0379: }
0380: }
0381:
0382: return baseExpression;
0383: }
0384:
0385: private Integer getCollectedExpressionId(JRExpression expression,
0386: boolean assignNotUsedId) {
0387: Integer expressionId = null;
0388: if (expressionCollector != null) {
0389: expressionId = expressionCollector
0390: .getExpressionId(expression);
0391: if (expressionId == null) {
0392: if (assignNotUsedId) {
0393: expressionId = JRExpression.NOT_USED_ID;
0394: } else {
0395: throw new JRRuntimeException(
0396: "Expression ID not found for expression <<"
0397: + expression.getText() + ">>.");
0398: }
0399: }
0400: }
0401: return expressionId;
0402: }
0403:
0404: /**
0405: *
0406: */
0407: protected JRBaseExpressionChunk getExpressionChunk(
0408: JRExpressionChunk expressionChunk) {
0409: JRBaseExpressionChunk baseExpressionChunk = null;
0410:
0411: if (expressionChunk != null) {
0412: baseExpressionChunk = (JRBaseExpressionChunk) get(expressionChunk);
0413: if (baseExpressionChunk == null) {
0414: baseExpressionChunk = new JRBaseExpressionChunk(
0415: expressionChunk, this );
0416: }
0417: }
0418:
0419: return baseExpressionChunk;
0420: }
0421:
0422: /**
0423: *
0424: */
0425: protected JRBaseGroup getGroup(JRGroup group) {
0426: JRBaseGroup baseGroup = null;
0427:
0428: if (group != null) {
0429: baseGroup = (JRBaseGroup) get(group);
0430: if (baseGroup == null) {
0431: baseGroup = new JRBaseGroup(group, this );
0432: }
0433: }
0434:
0435: return baseGroup;
0436: }
0437:
0438: /**
0439: *
0440: */
0441: protected JRBaseBand getBand(JRBand band) {
0442: JRBaseBand baseBand = null;
0443:
0444: if (band != null) {
0445: baseBand = (JRBaseBand) get(band);
0446: if (baseBand == null) {
0447: baseBand = new JRBaseBand(band, this );
0448: }
0449: }
0450:
0451: return baseBand;
0452: }
0453:
0454: /**
0455: *
0456: */
0457: public JRElementGroup getElementGroup(JRElementGroup elementGroup) {
0458: JRBaseElementGroup baseElementGroup = null;
0459:
0460: if (elementGroup != null) {
0461: baseElementGroup = (JRBaseElementGroup) get(elementGroup);
0462: if (baseElementGroup == null) {
0463: baseElementGroup = new JRBaseElementGroup(elementGroup,
0464: this );
0465: }
0466: }
0467:
0468: return baseElementGroup;
0469: }
0470:
0471: /**
0472: *
0473: */
0474: public JRBreak getBreak(JRBreak breakElement) {
0475: JRBaseBreak baseBreak = null;
0476:
0477: if (breakElement != null) {
0478: baseBreak = (JRBaseBreak) get(breakElement);
0479: if (baseBreak == null) {
0480: baseBreak = new JRBaseBreak(breakElement, this );
0481: }
0482: }
0483:
0484: return baseBreak;
0485: }
0486:
0487: /**
0488: *
0489: */
0490: public JRLine getLine(JRLine line) {
0491: JRBaseLine baseLine = null;
0492:
0493: if (line != null) {
0494: baseLine = (JRBaseLine) get(line);
0495: if (baseLine == null) {
0496: baseLine = new JRBaseLine(line, this );
0497: }
0498: }
0499:
0500: return baseLine;
0501: }
0502:
0503: /**
0504: *
0505: */
0506: public JRRectangle getRectangle(JRRectangle rectangle) {
0507: JRBaseRectangle baseRectangle = null;
0508:
0509: if (rectangle != null) {
0510: baseRectangle = (JRBaseRectangle) get(rectangle);
0511: if (baseRectangle == null) {
0512: baseRectangle = new JRBaseRectangle(rectangle, this );
0513: }
0514: }
0515:
0516: return baseRectangle;
0517: }
0518:
0519: /**
0520: *
0521: */
0522: public JREllipse getEllipse(JREllipse ellipse) {
0523: JRBaseEllipse baseEllipse = null;
0524:
0525: if (ellipse != null) {
0526: baseEllipse = (JRBaseEllipse) get(ellipse);
0527: if (baseEllipse == null) {
0528: baseEllipse = new JRBaseEllipse(ellipse, this );
0529: }
0530: }
0531:
0532: return baseEllipse;
0533: }
0534:
0535: /**
0536: *
0537: */
0538: public JRImage getImage(JRImage image) {
0539: JRBaseImage baseImage = null;
0540:
0541: if (image != null) {
0542: baseImage = (JRBaseImage) get(image);
0543: if (baseImage == null) {
0544: baseImage = new JRBaseImage(image, this );
0545: }
0546: }
0547:
0548: return baseImage;
0549: }
0550:
0551: /**
0552: *
0553: */
0554: public JRStaticText getStaticText(JRStaticText staticText) {
0555: JRBaseStaticText baseStaticText = null;
0556:
0557: if (staticText != null) {
0558: baseStaticText = (JRBaseStaticText) get(staticText);
0559: if (baseStaticText == null) {
0560: baseStaticText = new JRBaseStaticText(staticText, this );
0561: }
0562: }
0563:
0564: return baseStaticText;
0565: }
0566:
0567: /**
0568: *
0569: */
0570: public JRTextField getTextField(JRTextField textField) {
0571: JRBaseTextField baseTextField = null;
0572:
0573: if (textField != null) {
0574: baseTextField = (JRBaseTextField) get(textField);
0575: if (baseTextField == null) {
0576: baseTextField = new JRBaseTextField(textField, this );
0577: }
0578: }
0579:
0580: return baseTextField;
0581: }
0582:
0583: /**
0584: *
0585: */
0586: public JRSubreport getSubreport(JRSubreport subreport) {
0587: JRBaseSubreport baseSubreport = null;
0588:
0589: if (subreport != null) {
0590: baseSubreport = (JRBaseSubreport) get(subreport);
0591: if (baseSubreport == null) {
0592: baseSubreport = new JRBaseSubreport(subreport, this );
0593: }
0594: }
0595:
0596: return baseSubreport;
0597: }
0598:
0599: /**
0600: *
0601: */
0602: protected JRBaseSubreportParameter getSubreportParameter(
0603: JRSubreportParameter subreportParameter) {
0604: JRBaseSubreportParameter baseSubreportParameter = null;
0605:
0606: if (subreportParameter != null) {
0607: baseSubreportParameter = (JRBaseSubreportParameter) get(subreportParameter);
0608: if (baseSubreportParameter == null) {
0609: baseSubreportParameter = new JRBaseSubreportParameter(
0610: subreportParameter, this );
0611: put(subreportParameter, baseSubreportParameter);
0612: }
0613: }
0614:
0615: return baseSubreportParameter;
0616: }
0617:
0618: protected JRBaseDatasetParameter getDatasetParameter(
0619: JRDatasetParameter datasetParameter) {
0620: JRBaseDatasetParameter baseSubreportParameter = null;
0621:
0622: if (datasetParameter != null) {
0623: baseSubreportParameter = (JRBaseDatasetParameter) get(datasetParameter);
0624: if (baseSubreportParameter == null) {
0625: baseSubreportParameter = new JRBaseDatasetParameter(
0626: datasetParameter, this );
0627: put(datasetParameter, baseSubreportParameter);
0628: }
0629: }
0630:
0631: return baseSubreportParameter;
0632: }
0633:
0634: /**
0635: *
0636: */
0637: public JRPieDataset getPieDataset(JRPieDataset pieDataset) {
0638: JRBasePieDataset basePieDataset = null;
0639:
0640: if (pieDataset != null) {
0641: basePieDataset = (JRBasePieDataset) get(pieDataset);
0642: if (basePieDataset == null) {
0643: basePieDataset = new JRBasePieDataset(pieDataset, this );
0644: }
0645: }
0646:
0647: return basePieDataset;
0648: }
0649:
0650: /**
0651: *
0652: */
0653: public JRPiePlot getPiePlot(JRPiePlot piePlot) {
0654: JRBasePiePlot basePiePlot = null;
0655:
0656: if (piePlot != null) {
0657: basePiePlot = (JRBasePiePlot) get(piePlot);
0658: if (basePiePlot == null) {
0659: basePiePlot = new JRBasePiePlot(piePlot, this );
0660: }
0661: }
0662:
0663: return basePiePlot;
0664: }
0665:
0666: /**
0667: *
0668: */
0669: public JRPie3DPlot getPie3DPlot(JRPie3DPlot pie3DPlot) {
0670: JRBasePie3DPlot basePie3DPlot = null;
0671:
0672: if (pie3DPlot != null) {
0673: basePie3DPlot = (JRBasePie3DPlot) get(pie3DPlot);
0674: if (basePie3DPlot == null) {
0675: basePie3DPlot = new JRBasePie3DPlot(pie3DPlot, this );
0676: }
0677: }
0678:
0679: return basePie3DPlot;
0680: }
0681:
0682: /**
0683: *
0684: */
0685: public JRCategoryDataset getCategoryDataset(
0686: JRCategoryDataset categoryDataset) {
0687: JRBaseCategoryDataset baseCategoryDataset = null;
0688:
0689: if (categoryDataset != null) {
0690: baseCategoryDataset = (JRBaseCategoryDataset) get(categoryDataset);
0691: if (baseCategoryDataset == null) {
0692: baseCategoryDataset = new JRBaseCategoryDataset(
0693: categoryDataset, this );
0694: }
0695: }
0696:
0697: return baseCategoryDataset;
0698: }
0699:
0700: public JRTimeSeriesDataset getTimeSeriesDataset(
0701: JRTimeSeriesDataset timeSeriesDataset) {
0702: JRBaseTimeSeriesDataset baseTimeSeriesDataset = null;
0703: if (timeSeriesDataset != null) {
0704: baseTimeSeriesDataset = (JRBaseTimeSeriesDataset) get(timeSeriesDataset);
0705: if (baseTimeSeriesDataset == null) {
0706: baseTimeSeriesDataset = new JRBaseTimeSeriesDataset(
0707: timeSeriesDataset, this );
0708: }
0709: }
0710:
0711: return baseTimeSeriesDataset;
0712: }
0713:
0714: public JRTimePeriodDataset getTimePeriodDataset(
0715: JRTimePeriodDataset timePeriodDataset) {
0716: JRBaseTimePeriodDataset baseTimePeriodDataset = null;
0717: if (timePeriodDataset != null) {
0718: baseTimePeriodDataset = (JRBaseTimePeriodDataset) get(timePeriodDataset);
0719: if (baseTimePeriodDataset == null) {
0720: baseTimePeriodDataset = new JRBaseTimePeriodDataset(
0721: timePeriodDataset, this );
0722: }
0723: }
0724: return baseTimePeriodDataset;
0725: }
0726:
0727: /**
0728: *
0729: */
0730: public JRCategorySeries getCategorySeries(
0731: JRCategorySeries categorySeries) {
0732: JRBaseCategorySeries baseCategorySeries = null;
0733:
0734: if (categorySeries != null) {
0735: baseCategorySeries = (JRBaseCategorySeries) get(categorySeries);
0736: if (baseCategorySeries == null) {
0737: baseCategorySeries = new JRBaseCategorySeries(
0738: categorySeries, this );
0739: }
0740: }
0741:
0742: return baseCategorySeries;
0743: }
0744:
0745: /**
0746: *
0747: */
0748: public JRXySeries getXySeries(JRXySeries xySeries) {
0749: JRBaseXySeries baseXySeries = null;
0750:
0751: if (xySeries != null) {
0752: baseXySeries = (JRBaseXySeries) get(xySeries);
0753: if (baseXySeries == null) {
0754: baseXySeries = new JRBaseXySeries(xySeries, this );
0755: }
0756: }
0757:
0758: return baseXySeries;
0759: }
0760:
0761: /**
0762: *
0763: */
0764: public JRTimeSeries getTimeSeries(JRTimeSeries timeSeries) {
0765: JRBaseTimeSeries baseTimeSeries = null;
0766:
0767: if (timeSeries != null) {
0768: baseTimeSeries = (JRBaseTimeSeries) get(timeSeries);
0769: if (baseTimeSeries == null) {
0770: baseTimeSeries = new JRBaseTimeSeries(timeSeries, this );
0771: }
0772: }
0773:
0774: return baseTimeSeries;
0775: }
0776:
0777: /**
0778: *
0779: */
0780: public JRTimePeriodSeries getTimePeriodSeries(
0781: JRTimePeriodSeries timePeriodSeries) {
0782: JRBaseTimePeriodSeries baseTimePeriodSeries = null;
0783: if (timePeriodSeries != null) {
0784: baseTimePeriodSeries = (JRBaseTimePeriodSeries) get(timePeriodSeries);
0785: if (baseTimePeriodSeries == null) {
0786: baseTimePeriodSeries = new JRBaseTimePeriodSeries(
0787: timePeriodSeries, this );
0788: }
0789: }
0790:
0791: return baseTimePeriodSeries;
0792: }
0793:
0794: /**
0795: *
0796: */
0797: public JRBarPlot getBarPlot(JRBarPlot barPlot) {
0798: JRBaseBarPlot baseBarPlot = null;
0799:
0800: if (barPlot != null) {
0801: baseBarPlot = (JRBaseBarPlot) get(barPlot);
0802: if (baseBarPlot == null) {
0803: baseBarPlot = new JRBaseBarPlot(barPlot, this );
0804: }
0805: }
0806:
0807: return baseBarPlot;
0808: }
0809:
0810: /* (non-Javadoc)
0811: * @see net.sf.jasperreports.engine.JRAbstractObjectFactory#getBar3DPlot(net.sf.jasperreports.charts.JRBar3DPlot)
0812: */
0813: public JRBar3DPlot getBar3DPlot(JRBar3DPlot barPlot) {
0814: JRBaseBar3DPlot baseBarPlot = null;
0815:
0816: if (barPlot != null) {
0817: baseBarPlot = (JRBaseBar3DPlot) get(barPlot);
0818: if (baseBarPlot == null) {
0819: baseBarPlot = new JRBaseBar3DPlot(barPlot, this );
0820: }
0821: }
0822:
0823: return baseBarPlot;
0824: }
0825:
0826: /**
0827: *
0828: */
0829: public JRLinePlot getLinePlot(JRLinePlot linePlot) {
0830: JRBaseLinePlot baseLinePlot = null;
0831:
0832: if (linePlot != null) {
0833: baseLinePlot = (JRBaseLinePlot) get(linePlot);
0834: if (baseLinePlot == null) {
0835: baseLinePlot = new JRBaseLinePlot(linePlot, this );
0836: }
0837: }
0838:
0839: return baseLinePlot;
0840: }
0841:
0842: /**
0843: *
0844: */
0845: public JRAreaPlot getAreaPlot(JRAreaPlot areaPlot) {
0846: JRBaseAreaPlot baseAreaPlot = null;
0847:
0848: if (areaPlot != null) {
0849: baseAreaPlot = (JRBaseAreaPlot) get(areaPlot);
0850: if (baseAreaPlot == null) {
0851: baseAreaPlot = new JRBaseAreaPlot(areaPlot, this );
0852: }
0853: }
0854:
0855: return baseAreaPlot;
0856: }
0857:
0858: /*
0859: *
0860: */
0861: public JRXyzDataset getXyzDataset(JRXyzDataset xyzDataset) {
0862: JRBaseXyzDataset baseXyzDataset = null;
0863:
0864: if (xyzDataset != null) {
0865: baseXyzDataset = (JRBaseXyzDataset) get(xyzDataset);
0866: if (baseXyzDataset == null) {
0867: baseXyzDataset = new JRBaseXyzDataset(xyzDataset, this );
0868: }
0869: }
0870:
0871: return baseXyzDataset;
0872: }
0873:
0874: /*
0875: *
0876: */
0877: public JRXyDataset getXyDataset(JRXyDataset xyDataset) {
0878: JRBaseXyDataset baseXyDataset = null;
0879:
0880: if (xyDataset != null) {
0881: baseXyDataset = (JRBaseXyDataset) get(xyDataset);
0882: if (baseXyDataset == null) {
0883: baseXyDataset = new JRBaseXyDataset(xyDataset, this );
0884: }
0885: }
0886:
0887: return baseXyDataset;
0888: }
0889:
0890: /*
0891: *
0892: */
0893: public JRHighLowDataset getHighLowDataset(
0894: JRHighLowDataset highLowDataset) {
0895: JRBaseHighLowDataset baseHighLowDataset = null;
0896:
0897: if (highLowDataset != null) {
0898: baseHighLowDataset = (JRBaseHighLowDataset) get(highLowDataset);
0899: if (baseHighLowDataset == null) {
0900: baseHighLowDataset = new JRBaseHighLowDataset(
0901: highLowDataset, this );
0902: }
0903: }
0904:
0905: return baseHighLowDataset;
0906: }
0907:
0908: /**
0909: *
0910: */
0911: public JRXyzSeries getXyzSeries(JRXyzSeries xyzSeries) {
0912: JRBaseXyzSeries baseXyzSeries = null;
0913:
0914: if (xyzSeries != null) {
0915: baseXyzSeries = (JRBaseXyzSeries) get(xyzSeries);
0916: if (baseXyzSeries == null) {
0917: baseXyzSeries = new JRBaseXyzSeries(xyzSeries, this );
0918: }
0919: }
0920:
0921: return baseXyzSeries;
0922: }
0923:
0924: /**
0925: *
0926: */
0927: public JRBubblePlot getBubblePlot(JRBubblePlot bubblePlot) {
0928: JRBaseBubblePlot baseBubblePlot = null;
0929:
0930: if (bubblePlot != null) {
0931: baseBubblePlot = (JRBaseBubblePlot) get(bubblePlot);
0932: if (baseBubblePlot == null) {
0933: baseBubblePlot = new JRBaseBubblePlot(bubblePlot, this );
0934: }
0935: }
0936:
0937: return baseBubblePlot;
0938: }
0939:
0940: /**
0941: *
0942: */
0943: public JRCandlestickPlot getCandlestickPlot(
0944: JRCandlestickPlot candlestickPlot) {
0945: JRBaseCandlestickPlot baseCandlestickPlot = null;
0946:
0947: if (candlestickPlot != null) {
0948: baseCandlestickPlot = (JRBaseCandlestickPlot) get(candlestickPlot);
0949: if (baseCandlestickPlot == null) {
0950: baseCandlestickPlot = new JRBaseCandlestickPlot(
0951: candlestickPlot, this );
0952: }
0953: }
0954:
0955: return baseCandlestickPlot;
0956: }
0957:
0958: /**
0959: *
0960: */
0961: public JRHighLowPlot getHighLowPlot(JRHighLowPlot highLowPlot) {
0962: JRBaseHighLowPlot baseHighLowPlot = null;
0963:
0964: if (highLowPlot != null) {
0965: baseHighLowPlot = (JRBaseHighLowPlot) get(highLowPlot);
0966: if (baseHighLowPlot == null) {
0967: baseHighLowPlot = new JRBaseHighLowPlot(highLowPlot,
0968: this );
0969: }
0970: }
0971:
0972: return baseHighLowPlot;
0973: }
0974:
0975: /**
0976: *
0977: */
0978: public JRScatterPlot getScatterPlot(JRScatterPlot scatterPlot) {
0979: JRBaseScatterPlot baseScatterPlot = null;
0980:
0981: if (scatterPlot != null) {
0982: baseScatterPlot = (JRBaseScatterPlot) get(scatterPlot);
0983: if (baseScatterPlot == null) {
0984: baseScatterPlot = new JRBaseScatterPlot(scatterPlot,
0985: this );
0986: }
0987: }
0988:
0989: return baseScatterPlot;
0990: }
0991:
0992: public JRTimeSeriesPlot getTimeSeriesPlot(JRTimeSeriesPlot plot) {
0993: JRBaseTimeSeriesPlot basePlot = null;
0994: if (plot != null) {
0995: basePlot = (JRBaseTimeSeriesPlot) get(plot);
0996: if (basePlot == null) {
0997: basePlot = new JRBaseTimeSeriesPlot(plot, this );
0998: }
0999: }
1000:
1001: return basePlot;
1002: }
1003:
1004: /**
1005: *
1006: */
1007: public JRValueDataset getValueDataset(JRValueDataset valueDataset) {
1008: JRBaseValueDataset baseValueDataset = null;
1009:
1010: if (valueDataset != null) {
1011: baseValueDataset = (JRBaseValueDataset) get(valueDataset);
1012: if (baseValueDataset == null) {
1013: baseValueDataset = new JRBaseValueDataset(valueDataset,
1014: this );
1015: }
1016: }
1017:
1018: return baseValueDataset;
1019: }
1020:
1021: /**
1022: *
1023: */
1024: public JRMeterPlot getMeterPlot(JRMeterPlot meterPlot) {
1025: JRBaseMeterPlot baseMeterPlot = null;
1026:
1027: if (meterPlot != null) {
1028: baseMeterPlot = (JRBaseMeterPlot) get(meterPlot);
1029: if (baseMeterPlot == null) {
1030: baseMeterPlot = new JRBaseMeterPlot(meterPlot, this );
1031: }
1032: }
1033:
1034: return baseMeterPlot;
1035: }
1036:
1037: /**
1038: *
1039: */
1040: public JRThermometerPlot getThermometerPlot(
1041: JRThermometerPlot thermometerPlot) {
1042: JRBaseThermometerPlot baseThermometerPlot = null;
1043:
1044: if (thermometerPlot != null) {
1045: baseThermometerPlot = (JRBaseThermometerPlot) get(thermometerPlot);
1046: if (baseThermometerPlot == null) {
1047: baseThermometerPlot = new JRBaseThermometerPlot(
1048: thermometerPlot, this );
1049: }
1050: }
1051:
1052: return baseThermometerPlot;
1053: }
1054:
1055: /**
1056: *
1057: */
1058: public JRMultiAxisPlot getMultiAxisPlot(
1059: JRMultiAxisPlot multiAxisPlot) {
1060: JRBaseMultiAxisPlot baseMultiAxisPlot = null;
1061:
1062: if (multiAxisPlot != null) {
1063: baseMultiAxisPlot = (JRBaseMultiAxisPlot) get(baseMultiAxisPlot);
1064: if (baseMultiAxisPlot == null) {
1065: baseMultiAxisPlot = new JRBaseMultiAxisPlot(
1066: multiAxisPlot, this );
1067: }
1068: }
1069:
1070: return baseMultiAxisPlot;
1071: }
1072:
1073: /**
1074: *
1075: */
1076: public JRChart getChart(JRChart chart) {
1077: JRBaseChart baseChart = null;
1078:
1079: if (chart != null) {
1080: baseChart = (JRBaseChart) get(chart);
1081: if (baseChart == null) {
1082: baseChart = new JRBaseChart(chart, this );
1083: }
1084: }
1085:
1086: return baseChart;
1087: }
1088:
1089: /**
1090: *
1091: */
1092: protected JRBaseSubreportReturnValue getSubreportReturnValue(
1093: JRSubreportReturnValue returnValue) {
1094: JRBaseSubreportReturnValue baseSubreportReturnValue = null;
1095:
1096: if (returnValue != null) {
1097: baseSubreportReturnValue = (JRBaseSubreportReturnValue) get(returnValue);
1098: if (baseSubreportReturnValue == null) {
1099: baseSubreportReturnValue = new JRBaseSubreportReturnValue(
1100: returnValue, this );
1101: put(returnValue, baseSubreportReturnValue);
1102: }
1103: }
1104:
1105: return baseSubreportReturnValue;
1106: }
1107:
1108: /**
1109: *
1110: */
1111: public JRConditionalStyle getConditionalStyle(
1112: JRConditionalStyle conditionalStyle, JRStyle style) {
1113: JRBaseConditionalStyle baseConditionalStyle = null;
1114: if (conditionalStyle != null) {
1115: baseConditionalStyle = (JRBaseConditionalStyle) get(conditionalStyle);
1116: if (baseConditionalStyle == null) {
1117: baseConditionalStyle = new JRBaseConditionalStyle(
1118: conditionalStyle, style, this );
1119: put(conditionalStyle, baseConditionalStyle);
1120: }
1121: }
1122: return baseConditionalStyle;
1123: }
1124:
1125: public JRBaseCrosstabDataset getCrosstabDataset(
1126: JRCrosstabDataset crosstabDataset) {
1127: JRBaseCrosstabDataset baseCrosstabDataset = null;
1128:
1129: if (crosstabDataset != null) {
1130: baseCrosstabDataset = (JRBaseCrosstabDataset) get(crosstabDataset);
1131: if (baseCrosstabDataset == null) {
1132: baseCrosstabDataset = new JRBaseCrosstabDataset(
1133: crosstabDataset, this );
1134: }
1135: }
1136:
1137: return baseCrosstabDataset;
1138: }
1139:
1140: public JRBaseCrosstabRowGroup getCrosstabRowGroup(
1141: JRCrosstabRowGroup group) {
1142: JRBaseCrosstabRowGroup baseCrosstabRowGroup = null;
1143:
1144: if (group != null) {
1145: baseCrosstabRowGroup = (JRBaseCrosstabRowGroup) get(group);
1146: if (baseCrosstabRowGroup == null) {
1147: baseCrosstabRowGroup = new JRBaseCrosstabRowGroup(
1148: group, this );
1149: }
1150: }
1151:
1152: return baseCrosstabRowGroup;
1153: }
1154:
1155: public JRBaseCrosstabColumnGroup getCrosstabColumnGroup(
1156: JRCrosstabColumnGroup group) {
1157: JRBaseCrosstabColumnGroup baseCrosstabDataset = null;
1158:
1159: if (group != null) {
1160: baseCrosstabDataset = (JRBaseCrosstabColumnGroup) get(group);
1161: if (baseCrosstabDataset == null) {
1162: baseCrosstabDataset = new JRBaseCrosstabColumnGroup(
1163: group, this );
1164: }
1165: }
1166:
1167: return baseCrosstabDataset;
1168: }
1169:
1170: public JRBaseCrosstabBucket getCrosstabBucket(
1171: JRCrosstabBucket bucket) {
1172: JRBaseCrosstabBucket baseCrosstabBucket = null;
1173:
1174: if (bucket != null) {
1175: baseCrosstabBucket = (JRBaseCrosstabBucket) get(bucket);
1176: if (baseCrosstabBucket == null) {
1177: baseCrosstabBucket = new JRBaseCrosstabBucket(bucket,
1178: this );
1179: }
1180: }
1181:
1182: return baseCrosstabBucket;
1183: }
1184:
1185: public JRBaseCrosstabMeasure getCrosstabMeasure(
1186: JRCrosstabMeasure measure) {
1187: JRBaseCrosstabMeasure baseCrosstabMeasure = null;
1188:
1189: if (measure != null) {
1190: baseCrosstabMeasure = (JRBaseCrosstabMeasure) get(measure);
1191: if (baseCrosstabMeasure == null) {
1192: baseCrosstabMeasure = new JRBaseCrosstabMeasure(
1193: measure, this );
1194: }
1195: }
1196:
1197: return baseCrosstabMeasure;
1198: }
1199:
1200: public JRCrosstab getCrosstab(JRCrosstab crosstab) {
1201: JRBaseCrosstab baseCrosstab = null;
1202:
1203: if (crosstab != null) {
1204: baseCrosstab = (JRBaseCrosstab) get(crosstab);
1205: if (baseCrosstab == null) {
1206: Integer id = expressionCollector
1207: .getCrosstabId(crosstab);
1208: if (id == null) {
1209: throw new JRRuntimeException(
1210: "Crosstab ID not found.");
1211: }
1212:
1213: baseCrosstab = new JRBaseCrosstab(crosstab, this , id
1214: .intValue());
1215: }
1216: }
1217:
1218: return baseCrosstab;
1219: }
1220:
1221: public JRBaseDataset getDataset(JRDataset dataset) {
1222: JRBaseDataset baseDataset = null;
1223:
1224: if (dataset != null) {
1225: baseDataset = (JRBaseDataset) get(dataset);
1226: if (baseDataset == null) {
1227: baseDataset = new JRBaseDataset(dataset, this );
1228: }
1229: }
1230:
1231: return baseDataset;
1232: }
1233:
1234: public JRBaseDatasetRun getDatasetRun(JRDatasetRun datasetRun) {
1235: JRBaseDatasetRun baseDatasetRun = null;
1236:
1237: if (datasetRun != null) {
1238: baseDatasetRun = (JRBaseDatasetRun) get(datasetRun);
1239: if (baseDatasetRun == null) {
1240: baseDatasetRun = new JRBaseDatasetRun(datasetRun, this );
1241: }
1242: }
1243:
1244: return baseDatasetRun;
1245: }
1246:
1247: public JRBaseCellContents getCell(JRCellContents cell) {
1248: JRBaseCellContents baseCell = null;
1249:
1250: if (cell != null) {
1251: baseCell = (JRBaseCellContents) get(cell);
1252: if (baseCell == null) {
1253: baseCell = new JRBaseCellContents(cell, this );
1254: }
1255: }
1256:
1257: return baseCell;
1258: }
1259:
1260: public JRCrosstabCell getCrosstabCell(JRCrosstabCell cell) {
1261: JRBaseCrosstabCell baseCell = null;
1262:
1263: if (cell != null) {
1264: baseCell = (JRBaseCrosstabCell) get(cell);
1265: if (baseCell == null) {
1266: baseCell = new JRBaseCrosstabCell(cell, this );
1267: }
1268: }
1269:
1270: return baseCell;
1271: }
1272:
1273: public JRBaseCrosstabParameter getCrosstabParameter(
1274: JRCrosstabParameter parameter) {
1275: JRBaseCrosstabParameter baseParameter = null;
1276:
1277: if (parameter != null) {
1278: baseParameter = (JRBaseCrosstabParameter) get(parameter);
1279: if (baseParameter == null) {
1280: baseParameter = new JRBaseCrosstabParameter(parameter,
1281: this );
1282: }
1283: }
1284:
1285: return baseParameter;
1286: }
1287:
1288: public JRFrame getFrame(JRFrame frame) {
1289: JRBaseFrame baseFrame = null;
1290:
1291: if (frame != null) {
1292: baseFrame = (JRBaseFrame) get(frame);
1293: if (baseFrame == null) {
1294: baseFrame = new JRBaseFrame(frame, this );
1295: }
1296: }
1297:
1298: return baseFrame;
1299: }
1300:
1301: public JRHyperlinkParameter getHyperlinkParameter(
1302: JRHyperlinkParameter parameter) {
1303: JRHyperlinkParameter baseParameter = null;
1304:
1305: if (parameter != null) {
1306: baseParameter = (JRHyperlinkParameter) get(parameter);
1307: if (baseParameter == null) {
1308: baseParameter = new JRBaseHyperlinkParameter(parameter,
1309: this );
1310: }
1311: }
1312:
1313: return baseParameter;
1314: }
1315:
1316: public JRHyperlink getHyperlink(JRHyperlink hyperlink) {
1317: JRHyperlink link = null;
1318: if (hyperlink != null) {
1319: link = (JRHyperlink) get(hyperlink);
1320: if (link == null) {
1321: link = new JRBaseHyperlink(hyperlink, this );
1322: }
1323: }
1324: return link;
1325: }
1326:
1327: public JRChartAxis getChartAxis(JRChartAxis axis) {
1328: JRChartAxis baseAxis = null;
1329: if (axis != null) {
1330: baseAxis = (JRChartAxis) get(axis);
1331: if (baseAxis == null) {
1332: baseAxis = new JRBaseChartAxis(axis, this );
1333: }
1334: }
1335: return baseAxis;
1336: }
1337:
1338: public JRReportTemplate getReportTemplate(JRReportTemplate template) {
1339: JRReportTemplate baseTemplate = null;
1340: if (template != null) {
1341: baseTemplate = (JRReportTemplate) get(template);
1342: if (baseTemplate == null) {
1343: baseTemplate = new JRBaseReportTemplate(template, this);
1344: }
1345: }
1346: return baseTemplate;
1347: }
1348:
1349: }
|