KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > jasperreports > engine > base > JRBaseObjectFactory


1 /*
2  * ============================================================================
3  * GNU Lesser General Public License
4  * ============================================================================
5  *
6  * JasperReports - Free Java report-generating library.
7  * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
22  *
23  * JasperSoft Corporation
24  * 303 Second Street, Suite 450 North
25  * San Francisco, CA 94107
26  * http://www.jaspersoft.com
27  */

28 package net.sf.jasperreports.engine.base;
29
30 import net.sf.jasperreports.charts.JRAreaPlot;
31 import net.sf.jasperreports.charts.JRBar3DPlot;
32 import net.sf.jasperreports.charts.JRBarPlot;
33 import net.sf.jasperreports.charts.JRBubblePlot;
34 import net.sf.jasperreports.charts.JRCandlestickPlot;
35 import net.sf.jasperreports.charts.JRCategoryDataset;
36 import net.sf.jasperreports.charts.JRCategorySeries;
37 import net.sf.jasperreports.charts.JRChartAxis;
38 import net.sf.jasperreports.charts.JRHighLowDataset;
39 import net.sf.jasperreports.charts.JRHighLowPlot;
40 import net.sf.jasperreports.charts.JRLinePlot;
41 import net.sf.jasperreports.charts.JRMeterPlot;
42 import net.sf.jasperreports.charts.JRMultiAxisPlot;
43 import net.sf.jasperreports.charts.JRPie3DPlot;
44 import net.sf.jasperreports.charts.JRPieDataset;
45 import net.sf.jasperreports.charts.JRPiePlot;
46 import net.sf.jasperreports.charts.JRScatterPlot;
47 import net.sf.jasperreports.charts.JRThermometerPlot;
48 import net.sf.jasperreports.charts.JRTimePeriodDataset;
49 import net.sf.jasperreports.charts.JRTimePeriodSeries;
50 import net.sf.jasperreports.charts.JRTimeSeries;
51 import net.sf.jasperreports.charts.JRTimeSeriesDataset;
52 import net.sf.jasperreports.charts.JRTimeSeriesPlot;
53 import net.sf.jasperreports.charts.JRValueDataset;
54 import net.sf.jasperreports.charts.JRXyDataset;
55 import net.sf.jasperreports.charts.JRXySeries;
56 import net.sf.jasperreports.charts.JRXyzDataset;
57 import net.sf.jasperreports.charts.JRXyzSeries;
58 import net.sf.jasperreports.charts.base.JRBaseAreaPlot;
59 import net.sf.jasperreports.charts.base.JRBaseBar3DPlot;
60 import net.sf.jasperreports.charts.base.JRBaseBarPlot;
61 import net.sf.jasperreports.charts.base.JRBaseBubblePlot;
62 import net.sf.jasperreports.charts.base.JRBaseCandlestickPlot;
63 import net.sf.jasperreports.charts.base.JRBaseCategoryDataset;
64 import net.sf.jasperreports.charts.base.JRBaseCategorySeries;
65 import net.sf.jasperreports.charts.base.JRBaseChartAxis;
66 import net.sf.jasperreports.charts.base.JRBaseHighLowDataset;
67 import net.sf.jasperreports.charts.base.JRBaseHighLowPlot;
68 import net.sf.jasperreports.charts.base.JRBaseLinePlot;
69 import net.sf.jasperreports.charts.base.JRBaseMeterPlot;
70 import net.sf.jasperreports.charts.base.JRBaseMultiAxisPlot;
71 import net.sf.jasperreports.charts.base.JRBasePie3DPlot;
72 import net.sf.jasperreports.charts.base.JRBasePieDataset;
73 import net.sf.jasperreports.charts.base.JRBasePiePlot;
74 import net.sf.jasperreports.charts.base.JRBaseScatterPlot;
75 import net.sf.jasperreports.charts.base.JRBaseThermometerPlot;
76 import net.sf.jasperreports.charts.base.JRBaseTimePeriodDataset;
77 import net.sf.jasperreports.charts.base.JRBaseTimePeriodSeries;
78 import net.sf.jasperreports.charts.base.JRBaseTimeSeries;
79 import net.sf.jasperreports.charts.base.JRBaseTimeSeriesDataset;
80 import net.sf.jasperreports.charts.base.JRBaseTimeSeriesPlot;
81 import net.sf.jasperreports.charts.base.JRBaseValueDataset;
82 import net.sf.jasperreports.charts.base.JRBaseXyDataset;
83 import net.sf.jasperreports.charts.base.JRBaseXySeries;
84 import net.sf.jasperreports.charts.base.JRBaseXyzDataset;
85 import net.sf.jasperreports.charts.base.JRBaseXyzSeries;
86 import net.sf.jasperreports.crosstabs.JRCellContents;
87 import net.sf.jasperreports.crosstabs.JRCrosstab;
88 import net.sf.jasperreports.crosstabs.JRCrosstabBucket;
89 import net.sf.jasperreports.crosstabs.JRCrosstabCell;
90 import net.sf.jasperreports.crosstabs.JRCrosstabColumnGroup;
91 import net.sf.jasperreports.crosstabs.JRCrosstabDataset;
92 import net.sf.jasperreports.crosstabs.JRCrosstabMeasure;
93 import net.sf.jasperreports.crosstabs.JRCrosstabParameter;
94 import net.sf.jasperreports.crosstabs.JRCrosstabRowGroup;
95 import net.sf.jasperreports.crosstabs.base.JRBaseCellContents;
96 import net.sf.jasperreports.crosstabs.base.JRBaseCrosstab;
97 import net.sf.jasperreports.crosstabs.base.JRBaseCrosstabBucket;
98 import net.sf.jasperreports.crosstabs.base.JRBaseCrosstabCell;
99 import net.sf.jasperreports.crosstabs.base.JRBaseCrosstabColumnGroup;
100 import net.sf.jasperreports.crosstabs.base.JRBaseCrosstabDataset;
101 import net.sf.jasperreports.crosstabs.base.JRBaseCrosstabMeasure;
102 import net.sf.jasperreports.crosstabs.base.JRBaseCrosstabParameter;
103 import net.sf.jasperreports.crosstabs.base.JRBaseCrosstabRowGroup;
104 import net.sf.jasperreports.engine.JRAbstractObjectFactory;
105 import net.sf.jasperreports.engine.JRBand;
106 import net.sf.jasperreports.engine.JRBreak;
107 import net.sf.jasperreports.engine.JRChart;
108 import net.sf.jasperreports.engine.JRConditionalStyle;
109 import net.sf.jasperreports.engine.JRDataset;
110 import net.sf.jasperreports.engine.JRDatasetParameter;
111 import net.sf.jasperreports.engine.JRDatasetRun;
112 import net.sf.jasperreports.engine.JRDefaultStyleProvider;
113 import net.sf.jasperreports.engine.JRElementGroup;
114 import net.sf.jasperreports.engine.JREllipse;
115 import net.sf.jasperreports.engine.JRExpression;
116 import net.sf.jasperreports.engine.JRExpressionChunk;
117 import net.sf.jasperreports.engine.JRExpressionCollector;
118 import net.sf.jasperreports.engine.JRField;
119 import net.sf.jasperreports.engine.JRFont;
120 import net.sf.jasperreports.engine.JRFrame;
121 import net.sf.jasperreports.engine.JRGroup;
122 import net.sf.jasperreports.engine.JRHyperlink;
123 import net.sf.jasperreports.engine.JRHyperlinkParameter;
124 import net.sf.jasperreports.engine.JRImage;
125 import net.sf.jasperreports.engine.JRLine;
126 import net.sf.jasperreports.engine.JRParameter;
127 import net.sf.jasperreports.engine.JRQuery;
128 import net.sf.jasperreports.engine.JRQueryChunk;
129 import net.sf.jasperreports.engine.JRRectangle;
130 import net.sf.jasperreports.engine.JRReportFont;
131 import net.sf.jasperreports.engine.JRRuntimeException;
132 import net.sf.jasperreports.engine.JRSortField;
133 import net.sf.jasperreports.engine.JRStaticText;
134 import net.sf.jasperreports.engine.JRStyle;
135 import net.sf.jasperreports.engine.JRSubreport;
136 import net.sf.jasperreports.engine.JRSubreportParameter;
137 import net.sf.jasperreports.engine.JRSubreportReturnValue;
138 import net.sf.jasperreports.engine.JRTextField;
139 import net.sf.jasperreports.engine.JRVariable;
140
141
142 /**
143  * @author Teodor Danciu (teodord@users.sourceforge.net)
144  * @version $Id: JRBaseObjectFactory.java 1502 2006-11-21 18:14:56 +0200 (Tue, 21 Nov 2006) teodord $
145  */

146 public class JRBaseObjectFactory extends JRAbstractObjectFactory
147 {
148
149
150     /**
151      *
152      */

153     private JRDefaultStyleProvider defaultStyleProvider = null;
154
155     /**
156      * Expression collector used to retrieve generated expression IDs.
157      */

158     private JRExpressionCollector expressionCollector;
159
160
161     /**
162      *
163      */

164     protected JRBaseObjectFactory(JRDefaultStyleProvider defaultStyleProvider)
165     {
166         this.defaultStyleProvider = defaultStyleProvider;
167     }
168
169
170     /**
171      * Constructs a base object factory.
172      *
173      * @param defaultStyleProvider the default style provider
174      * @param expressionCollector the expression collector used as expression ID provider
175      */

176     protected JRBaseObjectFactory(JRDefaultStyleProvider defaultStyleProvider, JRExpressionCollector expressionCollector)
177     {
178         this.defaultStyleProvider = defaultStyleProvider;
179         this.expressionCollector = expressionCollector;
180     }
181
182
183     /**
184      *
185      */

186     public JRDefaultStyleProvider getDefaultStyleProvider()
187     {
188         return defaultStyleProvider;
189     }
190
191
192     /**
193      *
194      */

195     public JRReportFont getReportFont(JRReportFont font)
196     {
197         JRBaseReportFont baseFont = null;
198
199         if (font != null)
200         {
201             baseFont = (JRBaseReportFont)get(font);
202             if (baseFont == null)
203             {
204                 baseFont = new JRBaseReportFont(font);
205                 put(font, baseFont);
206             }
207         }
208
209         return baseFont;
210     }
211
212
213     /**
214      *
215      */

216     public JRStyle getStyle(JRStyle style)
217     {
218         JRBaseStyle baseStyle = null;
219
220         if (style != null)
221         {
222             baseStyle = (JRBaseStyle)get(style);
223             if (baseStyle == null)
224             {
225                 baseStyle = new JRBaseStyle(style, this);
226                 put(style, baseStyle);
227             }
228         }
229
230         return baseStyle;
231     }
232
233
234     /**
235      *
236      */

237     public JRFont getFont(JRFont font)
238     {
239         JRBaseFont baseFont = null;
240
241         if (font != null)
242         {
243             baseFont = (JRBaseFont)get(font);
244             if (baseFont == null)
245             {
246                 baseFont =
247                     new JRBaseFont(
248                         defaultStyleProvider,
249                         getReportFont(font.getReportFont()),
250                         font
251                         );
252                 put(font, baseFont);
253             }
254         }
255
256         return baseFont;
257     }
258
259
260     /**
261      *
262      */

263     protected JRBaseParameter getParameter(JRParameter parameter)
264     {
265         JRBaseParameter baseParameter = null;
266
267         if (parameter != null)
268         {
269             baseParameter = (JRBaseParameter)get(parameter);
270             if (baseParameter == null)
271             {
272                 baseParameter = new JRBaseParameter(parameter, this);
273             }
274         }
275
276         return baseParameter;
277     }
278
279
280     /**
281      *
282      */

283     protected JRBaseQuery getQuery(JRQuery query)
284     {
285         JRBaseQuery baseQuery = null;
286
287         if (query != null)
288         {
289             baseQuery = (JRBaseQuery)get(query);
290             if (baseQuery == null)
291             {
292                 baseQuery = new JRBaseQuery(query, this);
293             }
294         }
295
296         return baseQuery;
297     }
298
299
300     /**
301      *
302      */

303     protected JRBaseQueryChunk getQueryChunk(JRQueryChunk queryChunk)
304     {
305         JRBaseQueryChunk baseQueryChunk = null;
306
307         if (queryChunk != null)
308         {
309             baseQueryChunk = (JRBaseQueryChunk)get(queryChunk);
310             if (baseQueryChunk == null)
311             {
312                 baseQueryChunk = new JRBaseQueryChunk(queryChunk, this);
313             }
314         }
315
316         return baseQueryChunk;
317     }
318
319
320     /**
321      *
322      */

323     protected JRBaseField getField(JRField field)
324     {
325         JRBaseField baseField = null;
326
327         if (field != null)
328         {
329             baseField = (JRBaseField)get(field);
330             if (baseField == null)
331             {
332                 baseField = new JRBaseField(field, this);
333             }
334         }
335
336         return baseField;
337     }
338
339
340     /**
341      *
342      */

343     protected JRBaseSortField getSortField(JRSortField sortField)
344     {
345         JRBaseSortField baseSortField = null;
346
347         if (sortField != null)
348         {
349             baseSortField = (JRBaseSortField)get(sortField);
350             if (baseSortField == null)
351             {
352                 baseSortField = new JRBaseSortField(sortField, this);
353             }
354         }
355
356         return baseSortField;
357     }
358
359
360     /**
361      *
362      */

363     public JRBaseVariable getVariable(JRVariable variable)
364     {
365         JRBaseVariable baseVariable = null;
366
367         if (variable != null)
368         {
369             baseVariable = (JRBaseVariable)get(variable);
370             if (baseVariable == null)
371             {
372                 baseVariable = new JRBaseVariable(variable, this);
373             }
374         }
375
376         return baseVariable;
377     }
378
379
380     /**
381      *
382      */

383     public JRExpression getExpression(JRExpression expression, boolean assignNotUsedId)
384     {
385         JRBaseExpression baseExpression = null;
386
387         if (expression != null)
388         {
389             baseExpression = (JRBaseExpression)get(expression);
390             if (baseExpression == null)
391             {
392                 Integer JavaDoc expressionId = getCollectedExpressionId(expression, assignNotUsedId);
393                 baseExpression = new JRBaseExpression(expression, this, expressionId);
394             }
395         }
396
397         return baseExpression;
398     }
399
400
401     private Integer JavaDoc getCollectedExpressionId(JRExpression expression, boolean assignNotUsedId)
402     {
403         Integer JavaDoc expressionId = null;
404         if (expressionCollector != null)
405         {
406             expressionId = expressionCollector.getExpressionId(expression);
407             if (expressionId == null)
408             {
409                 if (assignNotUsedId)
410                 {
411                     expressionId = JRExpression.NOT_USED_ID;
412                 }
413                 else
414                 {
415                     throw new JRRuntimeException("Expression ID not found for expression <<" + expression.getText() + ">>.");
416                 }
417             }
418         }
419         return expressionId;
420     }
421
422
423     /**
424      *
425      */

426     protected JRBaseExpressionChunk getExpressionChunk(JRExpressionChunk expressionChunk)
427     {
428         JRBaseExpressionChunk baseExpressionChunk = null;
429
430         if (expressionChunk != null)
431         {
432             baseExpressionChunk = (JRBaseExpressionChunk)get(expressionChunk);
433             if (baseExpressionChunk == null)
434             {
435                 baseExpressionChunk = new JRBaseExpressionChunk(expressionChunk, this);
436             }
437         }
438
439         return baseExpressionChunk;
440     }
441
442
443     /**
444      *
445      */

446     protected JRBaseGroup getGroup(JRGroup group)
447     {
448         JRBaseGroup baseGroup = null;
449
450         if (group != null)
451         {
452             baseGroup = (JRBaseGroup)get(group);
453             if (baseGroup == null)
454             {
455                 baseGroup = new JRBaseGroup(group, this);
456             }
457         }
458
459         return baseGroup;
460     }
461
462
463     /**
464      *
465      */

466     protected JRBaseBand getBand(JRBand band)
467     {
468         JRBaseBand baseBand = null;
469
470         if (band != null)
471         {
472             baseBand = (JRBaseBand)get(band);
473             if (baseBand == null)
474             {
475                 baseBand = new JRBaseBand(band, this);
476             }
477         }
478
479         return baseBand;
480     }
481
482
483     /**
484      *
485      */

486     public JRElementGroup getElementGroup(JRElementGroup elementGroup)
487     {
488         JRBaseElementGroup baseElementGroup = null;
489
490         if (elementGroup != null)
491         {
492             baseElementGroup = (JRBaseElementGroup)get(elementGroup);
493             if (baseElementGroup == null)
494             {
495                 baseElementGroup = new JRBaseElementGroup(elementGroup, this);
496             }
497         }
498
499         return baseElementGroup;
500     }
501
502
503     /**
504      *
505      */

506     public JRBreak getBreak(JRBreak breakElement)
507     {
508         JRBaseBreak baseBreak = null;
509
510         if (breakElement != null)
511         {
512             baseBreak = (JRBaseBreak)get(breakElement);
513             if (baseBreak == null)
514             {
515                 baseBreak = new JRBaseBreak(breakElement, this);
516             }
517         }
518
519         return baseBreak;
520     }
521
522
523     /**
524      *
525      */

526     public JRLine getLine(JRLine line)
527     {
528         JRBaseLine baseLine = null;
529
530         if (line != null)
531         {
532             baseLine = (JRBaseLine)get(line);
533             if (baseLine == null)
534             {
535                 baseLine = new JRBaseLine(line, this);
536             }
537         }
538
539         return baseLine;
540     }
541
542
543     /**
544      *
545      */

546     public JRRectangle getRectangle(JRRectangle rectangle)
547     {
548         JRBaseRectangle baseRectangle = null;
549
550         if (rectangle != null)
551         {
552             baseRectangle = (JRBaseRectangle)get(rectangle);
553             if (baseRectangle == null)
554             {
555                 baseRectangle = new JRBaseRectangle(rectangle, this);
556             }
557         }
558
559         return baseRectangle;
560     }
561
562
563     /**
564      *
565      */

566     public JREllipse getEllipse(JREllipse ellipse)
567     {
568         JRBaseEllipse baseEllipse = null;
569
570         if (ellipse != null)
571         {
572             baseEllipse = (JRBaseEllipse)get(ellipse);
573             if (baseEllipse == null)
574             {
575                 baseEllipse = new JRBaseEllipse(ellipse, this);
576             }
577         }
578
579         return baseEllipse;
580     }
581
582
583     /**
584      *
585      */

586     public JRImage getImage(JRImage image)
587     {
588         JRBaseImage baseImage = null;
589
590         if (image != null)
591         {
592             baseImage = (JRBaseImage)get(image);
593             if (baseImage == null)
594             {
595                 baseImage = new JRBaseImage(image, this);
596             }
597         }
598
599         return baseImage;
600     }
601
602
603     /**
604      *
605      */

606     public JRStaticText getStaticText(JRStaticText staticText)
607     {
608         JRBaseStaticText baseStaticText = null;
609
610         if (staticText != null)
611         {
612             baseStaticText = (JRBaseStaticText)get(staticText);
613             if (baseStaticText == null)
614             {
615                 baseStaticText = new JRBaseStaticText(staticText, this);
616             }
617         }
618
619         return baseStaticText;
620     }
621
622
623     /**
624      *
625      */

626     public JRTextField getTextField(JRTextField textField)
627     {
628         JRBaseTextField baseTextField = null;
629
630         if (textField != null)
631         {
632             baseTextField = (JRBaseTextField)get(textField);
633             if (baseTextField == null)
634             {
635                 baseTextField = new JRBaseTextField(textField, this);
636             }
637         }
638
639         return baseTextField;
640     }
641
642
643     /**
644      *
645      */

646     public JRSubreport getSubreport(JRSubreport subreport)
647     {
648         JRBaseSubreport baseSubreport = null;
649
650         if (subreport != null)
651         {
652             baseSubreport = (JRBaseSubreport)get(subreport);
653             if (baseSubreport == null)
654             {
655                 baseSubreport = new JRBaseSubreport(subreport, this);
656             }
657         }
658
659         return baseSubreport;
660     }
661
662
663     /**
664      *
665      */

666     protected JRBaseSubreportParameter getSubreportParameter(JRSubreportParameter subreportParameter)
667     {
668         JRBaseSubreportParameter baseSubreportParameter = null;
669
670         if (subreportParameter != null)
671         {
672             baseSubreportParameter = (JRBaseSubreportParameter)get(subreportParameter);
673             if (baseSubreportParameter == null)
674             {
675                 baseSubreportParameter = new JRBaseSubreportParameter(subreportParameter, this);
676                 put(subreportParameter, baseSubreportParameter);
677             }
678         }
679
680         return baseSubreportParameter;
681     }
682
683
684     protected JRBaseDatasetParameter getDatasetParameter(JRDatasetParameter datasetParameter)
685     {
686         JRBaseDatasetParameter baseSubreportParameter = null;
687
688         if (datasetParameter != null)
689         {
690             baseSubreportParameter = (JRBaseDatasetParameter) get(datasetParameter);
691             if (baseSubreportParameter == null)
692             {
693                 baseSubreportParameter = new JRBaseDatasetParameter(datasetParameter, this);
694                 put(datasetParameter, baseSubreportParameter);
695             }
696         }
697
698         return baseSubreportParameter;
699     }
700
701
702     /**
703      *
704      */

705     public JRPieDataset getPieDataset(JRPieDataset pieDataset)
706     {
707         JRBasePieDataset basePieDataset = null;
708
709         if (pieDataset != null)
710         {
711             basePieDataset = (JRBasePieDataset)get(pieDataset);
712             if (basePieDataset == null)
713             {
714                 basePieDataset = new JRBasePieDataset(pieDataset, this);
715             }
716         }
717
718         return basePieDataset;
719     }
720
721
722     /**
723      *
724      */

725     public JRPiePlot getPiePlot(JRPiePlot piePlot)
726     {
727         JRBasePiePlot basePiePlot = null;
728
729         if (piePlot != null)
730         {
731             basePiePlot = (JRBasePiePlot)get(piePlot);
732             if (basePiePlot == null)
733             {
734                 basePiePlot = new JRBasePiePlot(piePlot, this);
735             }
736         }
737
738         return basePiePlot;
739     }
740
741
742     /**
743      *
744      */

745     public JRPie3DPlot getPie3DPlot(JRPie3DPlot pie3DPlot)
746     {
747         JRBasePie3DPlot basePie3DPlot = null;
748
749         if (pie3DPlot != null)
750         {
751             basePie3DPlot = (JRBasePie3DPlot)get(pie3DPlot);
752             if (basePie3DPlot == null)
753             {
754                 basePie3DPlot = new JRBasePie3DPlot(pie3DPlot, this);
755             }
756         }
757
758         return basePie3DPlot;
759     }
760
761
762     /**
763      *
764      */

765     public JRCategoryDataset getCategoryDataset(JRCategoryDataset categoryDataset)
766     {
767         JRBaseCategoryDataset baseCategoryDataset = null;
768
769         if (categoryDataset != null)
770         {
771             baseCategoryDataset = (JRBaseCategoryDataset)get(categoryDataset);
772             if (baseCategoryDataset == null)
773             {
774                 baseCategoryDataset = new JRBaseCategoryDataset(categoryDataset, this);
775             }
776         }
777
778         return baseCategoryDataset;
779     }
780
781     public JRTimeSeriesDataset getTimeSeriesDataset( JRTimeSeriesDataset timeSeriesDataset ){
782         JRBaseTimeSeriesDataset baseTimeSeriesDataset = null;
783         if( timeSeriesDataset != null ){
784             baseTimeSeriesDataset = (JRBaseTimeSeriesDataset)get( timeSeriesDataset );
785             if( baseTimeSeriesDataset == null ){
786                 baseTimeSeriesDataset = new JRBaseTimeSeriesDataset( timeSeriesDataset, this );
787             }
788         }
789
790         return baseTimeSeriesDataset;
791     }
792
793
794     public JRTimePeriodDataset getTimePeriodDataset( JRTimePeriodDataset timePeriodDataset ){
795         JRBaseTimePeriodDataset baseTimePeriodDataset = null;
796         if( timePeriodDataset != null ){
797             baseTimePeriodDataset = (JRBaseTimePeriodDataset)get( timePeriodDataset );
798             if( baseTimePeriodDataset == null ){
799                 baseTimePeriodDataset = new JRBaseTimePeriodDataset( timePeriodDataset, this );
800             }
801         }
802         return baseTimePeriodDataset;
803     }
804
805     /**
806      *
807      */

808     public JRCategorySeries getCategorySeries(JRCategorySeries categorySeries)
809     {
810         JRBaseCategorySeries baseCategorySeries = null;
811
812         if (categorySeries != null)
813         {
814             baseCategorySeries = (JRBaseCategorySeries)get(categorySeries);
815             if (baseCategorySeries == null)
816             {
817                 baseCategorySeries = new JRBaseCategorySeries(categorySeries, this);
818             }
819         }
820
821         return baseCategorySeries;
822     }
823
824
825     /**
826      *
827      */

828     public JRXySeries getXySeries(JRXySeries xySeries)
829     {
830         JRBaseXySeries baseXySeries = null;
831
832         if (xySeries != null)
833         {
834             baseXySeries = (JRBaseXySeries)get(xySeries);
835             if (baseXySeries == null)
836             {
837                 baseXySeries = new JRBaseXySeries(xySeries, this);
838             }
839         }
840
841         return baseXySeries;
842     }
843
844
845     /**
846      *
847      */

848     public JRTimeSeries getTimeSeries(JRTimeSeries timeSeries)
849     {
850         JRBaseTimeSeries baseTimeSeries = null;
851
852         if (timeSeries != null)
853         {
854             baseTimeSeries = (JRBaseTimeSeries)get(timeSeries);
855             if (baseTimeSeries == null)
856             {
857                 baseTimeSeries = new JRBaseTimeSeries(timeSeries, this);
858             }
859         }
860
861         return baseTimeSeries;
862     }
863
864     /**
865      *
866      */

867     public JRTimePeriodSeries getTimePeriodSeries( JRTimePeriodSeries timePeriodSeries ){
868         JRBaseTimePeriodSeries baseTimePeriodSeries = null;
869         if( timePeriodSeries != null ){
870             baseTimePeriodSeries = (JRBaseTimePeriodSeries)get( timePeriodSeries );
871             if( baseTimePeriodSeries == null ){
872                 baseTimePeriodSeries = new JRBaseTimePeriodSeries( timePeriodSeries, this );
873             }
874         }
875
876         return baseTimePeriodSeries;
877     }
878
879
880     /**
881      *
882      */

883     public JRBarPlot getBarPlot(JRBarPlot barPlot)
884     {
885         JRBaseBarPlot baseBarPlot = null;
886
887         if (barPlot != null)
888         {
889             baseBarPlot = (JRBaseBarPlot)get(barPlot);
890             if (baseBarPlot == null)
891             {
892                 baseBarPlot = new JRBaseBarPlot(barPlot, this);
893             }
894         }
895
896         return baseBarPlot;
897     }
898
899
900     /* (non-Javadoc)
901      * @see net.sf.jasperreports.engine.JRAbstractObjectFactory#getBar3DPlot(net.sf.jasperreports.charts.JRBar3DPlot)
902      */

903     public JRBar3DPlot getBar3DPlot(JRBar3DPlot barPlot) {
904         JRBaseBar3DPlot baseBarPlot = null;
905
906         if (barPlot != null)
907         {
908             baseBarPlot = (JRBaseBar3DPlot)get(barPlot);
909             if (baseBarPlot == null)
910             {
911                 baseBarPlot = new JRBaseBar3DPlot(barPlot, this);
912             }
913         }
914
915         return baseBarPlot;
916     }
917
918
919     /**
920      *
921      */

922     public JRLinePlot getLinePlot(JRLinePlot linePlot) {
923         JRBaseLinePlot baseLinePlot = null;
924
925         if (linePlot != null)
926         {
927             baseLinePlot = (JRBaseLinePlot)get(linePlot);
928             if (baseLinePlot == null)
929             {
930                 baseLinePlot = new JRBaseLinePlot(linePlot, this);
931             }
932         }
933
934         return baseLinePlot;
935     }
936
937
938     /**
939      *
940      */

941     public JRAreaPlot getAreaPlot(JRAreaPlot areaPlot) {
942         JRBaseAreaPlot baseAreaPlot = null;
943
944         if (areaPlot != null)
945         {
946             baseAreaPlot = (JRBaseAreaPlot)get(areaPlot);
947             if (baseAreaPlot == null)
948             {
949                 baseAreaPlot = new JRBaseAreaPlot(areaPlot, this);
950             }
951         }
952
953         return baseAreaPlot;
954     }
955
956
957     /*
958      *
959      */

960     public JRXyzDataset getXyzDataset(JRXyzDataset xyzDataset) {
961         JRBaseXyzDataset baseXyzDataset = null;
962
963         if (xyzDataset != null)
964         {
965             baseXyzDataset = (JRBaseXyzDataset)get(xyzDataset);
966             if (baseXyzDataset == null)
967             {
968                 baseXyzDataset = new JRBaseXyzDataset(xyzDataset, this);
969             }
970         }
971
972         return baseXyzDataset;
973     }
974
975
976     /*
977      *
978      */

979     public JRXyDataset getXyDataset(JRXyDataset xyDataset) {
980         JRBaseXyDataset baseXyDataset = null;
981
982         if (xyDataset != null)
983         {
984             baseXyDataset = (JRBaseXyDataset)get(xyDataset);
985             if (baseXyDataset == null)
986             {
987                 baseXyDataset = new JRBaseXyDataset(xyDataset, this);
988             }
989         }
990
991         return baseXyDataset;
992     }
993
994     /*
995      *
996      */

997     public JRHighLowDataset getHighLowDataset(JRHighLowDataset highLowDataset) {
998         JRBaseHighLowDataset baseHighLowDataset = null;
999
1000        if (highLowDataset != null)
1001        {
1002            baseHighLowDataset = (JRBaseHighLowDataset)get(highLowDataset);
1003            if (baseHighLowDataset == null)
1004            {
1005                baseHighLowDataset = new JRBaseHighLowDataset(highLowDataset, this);
1006            }
1007        }
1008
1009        return baseHighLowDataset;
1010    }
1011
1012
1013    /**
1014     *
1015     */

1016    public JRXyzSeries getXyzSeries(JRXyzSeries xyzSeries) {
1017        JRBaseXyzSeries baseXyzSeries = null;
1018
1019        if (xyzSeries != null)
1020        {
1021            baseXyzSeries = (JRBaseXyzSeries)get(xyzSeries);
1022            if (baseXyzSeries == null)
1023            {
1024                baseXyzSeries = new JRBaseXyzSeries(xyzSeries, this);
1025            }
1026        }
1027
1028        return baseXyzSeries;
1029    }
1030
1031
1032    /**
1033     *
1034     */

1035    public JRBubblePlot getBubblePlot(JRBubblePlot bubblePlot) {
1036        JRBaseBubblePlot baseBubblePlot = null;
1037
1038        if (bubblePlot != null)
1039        {
1040            baseBubblePlot = (JRBaseBubblePlot)get(bubblePlot);
1041            if (baseBubblePlot == null)
1042            {
1043                baseBubblePlot = new JRBaseBubblePlot(bubblePlot, this);
1044            }
1045        }
1046
1047        return baseBubblePlot;
1048    }
1049
1050
1051     /**
1052      *
1053      */

1054     public JRCandlestickPlot getCandlestickPlot(JRCandlestickPlot candlestickPlot)
1055    {
1056        JRBaseCandlestickPlot baseCandlestickPlot = null;
1057
1058        if (candlestickPlot != null)
1059        {
1060            baseCandlestickPlot = (JRBaseCandlestickPlot)get(candlestickPlot);
1061            if (baseCandlestickPlot == null)
1062            {
1063                baseCandlestickPlot = new JRBaseCandlestickPlot(candlestickPlot, this);
1064            }
1065        }
1066
1067        return baseCandlestickPlot;
1068    }
1069
1070
1071    /**
1072     *
1073     */

1074    public JRHighLowPlot getHighLowPlot(JRHighLowPlot highLowPlot)
1075    {
1076        JRBaseHighLowPlot baseHighLowPlot = null;
1077
1078        if (highLowPlot != null)
1079        {
1080            baseHighLowPlot = (JRBaseHighLowPlot)get(highLowPlot);
1081            if (baseHighLowPlot == null)
1082            {
1083                baseHighLowPlot = new JRBaseHighLowPlot(highLowPlot, this);
1084            }
1085        }
1086
1087        return baseHighLowPlot;
1088    }
1089
1090
1091    /**
1092     *
1093     */

1094    public JRScatterPlot getScatterPlot(JRScatterPlot scatterPlot)
1095    {
1096        JRBaseScatterPlot baseScatterPlot = null;
1097
1098        if (scatterPlot != null)
1099        {
1100            baseScatterPlot = (JRBaseScatterPlot)get(scatterPlot);
1101            if (baseScatterPlot == null)
1102            {
1103                baseScatterPlot = new JRBaseScatterPlot(scatterPlot, this);
1104            }
1105        }
1106
1107        return baseScatterPlot;
1108    }
1109
1110
1111
1112    public JRTimeSeriesPlot getTimeSeriesPlot( JRTimeSeriesPlot plot ){
1113        JRBaseTimeSeriesPlot basePlot = null;
1114        if( plot != null ){
1115            basePlot = (JRBaseTimeSeriesPlot)get( plot );
1116            if( basePlot == null ){
1117                basePlot = new JRBaseTimeSeriesPlot( plot, this );
1118            }
1119        }
1120
1121        return basePlot;
1122    }
1123
1124
1125    /**
1126     *
1127     */

1128    public JRValueDataset getValueDataset(JRValueDataset valueDataset)
1129    {
1130        JRBaseValueDataset baseValueDataset = null;
1131        
1132        if (valueDataset != null)
1133        {
1134            baseValueDataset = (JRBaseValueDataset)get(valueDataset);
1135            if (baseValueDataset == null)
1136            {
1137                baseValueDataset = new JRBaseValueDataset(valueDataset, this);
1138            }
1139        }
1140        
1141        return baseValueDataset;
1142    }
1143
1144    
1145    /**
1146     *
1147     */

1148    public JRMeterPlot getMeterPlot(JRMeterPlot meterPlot)
1149    {
1150        JRBaseMeterPlot baseMeterPlot = null;
1151
1152        if (meterPlot != null)
1153        {
1154            baseMeterPlot = (JRBaseMeterPlot)get(meterPlot);
1155            if (baseMeterPlot == null)
1156            {
1157                baseMeterPlot = new JRBaseMeterPlot(meterPlot, this);
1158            }
1159        }
1160
1161        return baseMeterPlot;
1162    }
1163
1164    
1165    /**
1166     *
1167     */

1168    public JRThermometerPlot getThermometerPlot(JRThermometerPlot thermometerPlot)
1169    {
1170        JRBaseThermometerPlot baseThermometerPlot = null;
1171
1172        if (thermometerPlot != null)
1173        {
1174            baseThermometerPlot = (JRBaseThermometerPlot)get(thermometerPlot);
1175            if (baseThermometerPlot == null)
1176            {
1177                baseThermometerPlot = new JRBaseThermometerPlot(thermometerPlot, this);
1178            }
1179        }
1180
1181        return baseThermometerPlot;
1182    }
1183
1184
1185    /**
1186     *
1187     */

1188    public JRMultiAxisPlot getMultiAxisPlot(JRMultiAxisPlot multiAxisPlot)
1189    {
1190        JRBaseMultiAxisPlot baseMultiAxisPlot = null;
1191
1192        if (multiAxisPlot != null)
1193        {
1194            baseMultiAxisPlot = (JRBaseMultiAxisPlot)get(baseMultiAxisPlot);
1195            if (baseMultiAxisPlot == null)
1196            {
1197                baseMultiAxisPlot = new JRBaseMultiAxisPlot(multiAxisPlot, this);
1198            }
1199        }
1200
1201        return baseMultiAxisPlot;
1202    }
1203
1204
1205    /**
1206     *
1207     */

1208    public JRChart getChart(JRChart chart)
1209    {
1210        JRBaseChart baseChart = null;
1211
1212        if (chart != null)
1213        {
1214            baseChart = (JRBaseChart)get(chart);
1215            if (baseChart == null)
1216            {
1217                baseChart = new JRBaseChart(chart, this);
1218            }
1219        }
1220
1221        return baseChart;
1222    }
1223
1224    /**
1225     *
1226     */

1227    protected JRBaseSubreportReturnValue getSubreportReturnValue(JRSubreportReturnValue returnValue)
1228    {
1229        JRBaseSubreportReturnValue baseSubreportReturnValue = null;
1230
1231        if (returnValue != null)
1232        {
1233            baseSubreportReturnValue = (JRBaseSubreportReturnValue)get(returnValue);
1234            if (baseSubreportReturnValue == null)
1235            {
1236                baseSubreportReturnValue = new JRBaseSubreportReturnValue(returnValue, this);
1237                put(returnValue, baseSubreportReturnValue);
1238            }
1239        }
1240
1241        return baseSubreportReturnValue;
1242    }
1243
1244
1245    /**
1246     *
1247     */

1248    public JRConditionalStyle getConditionalStyle(JRConditionalStyle conditionalStyle, JRStyle style)
1249    {
1250        JRBaseConditionalStyle baseConditionalStyle = null;
1251        if (conditionalStyle != null)
1252        {
1253            baseConditionalStyle = (JRBaseConditionalStyle) get(conditionalStyle);
1254            if (baseConditionalStyle == null) {
1255                baseConditionalStyle = new JRBaseConditionalStyle(conditionalStyle, style, this);
1256                put(conditionalStyle, baseConditionalStyle);
1257            }
1258        }
1259        return baseConditionalStyle;
1260    }
1261
1262
1263    public JRBaseCrosstabDataset getCrosstabDataset(JRCrosstabDataset crosstabDataset)
1264    {
1265        JRBaseCrosstabDataset baseCrosstabDataset = null;
1266
1267        if (crosstabDataset != null)
1268        {
1269            baseCrosstabDataset = (JRBaseCrosstabDataset) get(crosstabDataset);
1270            if (baseCrosstabDataset == null)
1271            {
1272                baseCrosstabDataset = new JRBaseCrosstabDataset(crosstabDataset, this);
1273            }
1274        }
1275
1276        return baseCrosstabDataset;
1277    }
1278
1279
1280    public JRBaseCrosstabRowGroup getCrosstabRowGroup(JRCrosstabRowGroup group)
1281    {
1282        JRBaseCrosstabRowGroup baseCrosstabRowGroup = null;
1283
1284        if (group != null)
1285        {
1286            baseCrosstabRowGroup = (JRBaseCrosstabRowGroup) get(group);
1287            if (baseCrosstabRowGroup == null)
1288            {
1289                baseCrosstabRowGroup = new JRBaseCrosstabRowGroup(group, this);
1290            }
1291        }
1292
1293        return baseCrosstabRowGroup;
1294    }
1295
1296
1297    public JRBaseCrosstabColumnGroup getCrosstabColumnGroup(JRCrosstabColumnGroup group)
1298    {
1299        JRBaseCrosstabColumnGroup baseCrosstabDataset = null;
1300
1301        if (group != null)
1302        {
1303            baseCrosstabDataset = (JRBaseCrosstabColumnGroup) get(group);
1304            if (baseCrosstabDataset == null)
1305            {
1306                baseCrosstabDataset = new JRBaseCrosstabColumnGroup(group, this);
1307            }
1308        }
1309
1310        return baseCrosstabDataset;
1311    }
1312
1313
1314    public JRBaseCrosstabBucket getCrosstabBucket(JRCrosstabBucket bucket)
1315    {
1316        JRBaseCrosstabBucket baseCrosstabBucket = null;
1317
1318        if (bucket != null)
1319        {
1320            baseCrosstabBucket = (JRBaseCrosstabBucket) get(bucket);
1321            if (baseCrosstabBucket == null)
1322            {
1323                baseCrosstabBucket = new JRBaseCrosstabBucket(bucket, this);
1324            }
1325        }
1326
1327        return baseCrosstabBucket;
1328    }
1329
1330
1331    public JRBaseCrosstabMeasure getCrosstabMeasure(JRCrosstabMeasure measure)
1332    {
1333        JRBaseCrosstabMeasure baseCrosstabMeasure = null;
1334
1335        if (measure != null)
1336        {
1337            baseCrosstabMeasure = (JRBaseCrosstabMeasure) get(measure);
1338            if (baseCrosstabMeasure == null)
1339            {
1340                baseCrosstabMeasure = new JRBaseCrosstabMeasure(measure, this);
1341            }
1342        }
1343
1344        return baseCrosstabMeasure;
1345    }
1346
1347
1348    public JRCrosstab getCrosstab(JRCrosstab crosstab)
1349    {
1350        JRBaseCrosstab baseCrosstab = null;
1351
1352        if (crosstab != null)
1353        {
1354            baseCrosstab = (JRBaseCrosstab) get(crosstab);
1355            if (baseCrosstab == null)
1356            {
1357                Integer JavaDoc id = expressionCollector.getCrosstabId(crosstab);
1358                if (id == null)
1359                {
1360                    throw new JRRuntimeException("Crosstab ID not found.");
1361                }
1362
1363                baseCrosstab = new JRBaseCrosstab(crosstab, this, id.intValue());
1364            }
1365        }
1366
1367        return baseCrosstab;
1368    }
1369
1370
1371    public JRBaseDataset getDataset(JRDataset dataset)
1372    {
1373        JRBaseDataset baseDataset = null;
1374
1375        if (dataset != null)
1376        {
1377            baseDataset = (JRBaseDataset)get(dataset);
1378            if (baseDataset == null)
1379            {
1380                baseDataset = new JRBaseDataset(dataset, this);
1381            }
1382        }
1383
1384        return baseDataset;
1385    }
1386
1387
1388    public JRBaseDatasetRun getDatasetRun(JRDatasetRun datasetRun)
1389    {
1390        JRBaseDatasetRun baseDatasetRun = null;
1391
1392        if (datasetRun != null)
1393        {
1394            baseDatasetRun = (JRBaseDatasetRun)get(datasetRun);
1395            if (baseDatasetRun == null)
1396            {
1397                baseDatasetRun = new JRBaseDatasetRun(datasetRun, this);
1398            }
1399        }
1400
1401        return baseDatasetRun;
1402    }
1403
1404
1405    public JRBaseCellContents getCell(JRCellContents cell)
1406    {
1407        JRBaseCellContents baseCell = null;
1408
1409        if (cell != null)
1410        {
1411            baseCell = (JRBaseCellContents)get(cell);
1412            if (baseCell == null)
1413            {
1414                baseCell = new JRBaseCellContents(cell, this);
1415            }
1416        }
1417
1418        return baseCell;
1419    }
1420
1421
1422    public JRCrosstabCell getCrosstabCell(JRCrosstabCell cell)
1423    {
1424        JRBaseCrosstabCell baseCell = null;
1425
1426        if (cell != null)
1427        {
1428            baseCell = (JRBaseCrosstabCell)get(cell);
1429            if (baseCell == null)
1430            {
1431                baseCell = new JRBaseCrosstabCell(cell, this);
1432            }
1433        }
1434
1435        return baseCell;
1436    }
1437
1438
1439    public JRBaseCrosstabParameter getCrosstabParameter(JRCrosstabParameter parameter)
1440    {
1441        JRBaseCrosstabParameter baseParameter = null;
1442
1443        if (parameter != null)
1444        {
1445            baseParameter = (JRBaseCrosstabParameter) get(parameter);
1446            if (baseParameter == null)
1447            {
1448                baseParameter = new JRBaseCrosstabParameter(parameter, this);
1449            }
1450        }
1451
1452        return baseParameter;
1453    }
1454
1455
1456    public JRFrame getFrame(JRFrame frame)
1457    {
1458        JRBaseFrame baseFrame = null;
1459
1460        if (frame != null)
1461        {
1462            baseFrame = (JRBaseFrame) get(frame);
1463            if (baseFrame == null)
1464            {
1465                baseFrame = new JRBaseFrame(frame, this);
1466            }
1467        }
1468
1469        return baseFrame;
1470    }
1471
1472
1473    public JRHyperlinkParameter getHyperlinkParameter(JRHyperlinkParameter parameter)
1474    {
1475        JRHyperlinkParameter baseParameter = null;
1476
1477        if (parameter != null)
1478        {
1479            baseParameter = (JRHyperlinkParameter) get(parameter);
1480            if (baseParameter == null)
1481            {
1482                baseParameter = new JRBaseHyperlinkParameter(parameter, this);
1483            }
1484        }
1485
1486        return baseParameter;
1487    }
1488
1489
1490    public JRHyperlink getHyperlink(JRHyperlink hyperlink)
1491    {
1492        JRHyperlink link = null;
1493        if (hyperlink != null)
1494        {
1495            link = (JRHyperlink) get(hyperlink);
1496            if (link == null)
1497            {
1498                link = new JRBaseHyperlink(hyperlink, this);
1499            }
1500        }
1501        return link;
1502    }
1503    
1504    
1505    public JRChartAxis getChartAxis(JRChartAxis axis)
1506    {
1507        JRChartAxis baseAxis = null;
1508        if (axis != null)
1509        {
1510            baseAxis = (JRChartAxis) get(axis);
1511            if (baseAxis == null)
1512            {
1513                baseAxis = new JRBaseChartAxis(axis, this);
1514            }
1515        }
1516        return baseAxis;
1517    }
1518}
1519
Popular Tags