KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > jasperreports > engine > fill > JRFillObjectFactory


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.fill;
29
30 import java.util.ArrayList JavaDoc;
31 import java.util.HashMap JavaDoc;
32 import java.util.List JavaDoc;
33 import java.util.Map JavaDoc;
34
35 import net.sf.jasperreports.charts.JRAreaPlot;
36 import net.sf.jasperreports.charts.JRBar3DPlot;
37 import net.sf.jasperreports.charts.JRBarPlot;
38 import net.sf.jasperreports.charts.JRBubblePlot;
39 import net.sf.jasperreports.charts.JRCandlestickPlot;
40 import net.sf.jasperreports.charts.JRCategoryDataset;
41 import net.sf.jasperreports.charts.JRCategorySeries;
42 import net.sf.jasperreports.charts.JRChartAxis;
43 import net.sf.jasperreports.charts.JRHighLowDataset;
44 import net.sf.jasperreports.charts.JRHighLowPlot;
45 import net.sf.jasperreports.charts.JRLinePlot;
46 import net.sf.jasperreports.charts.JRMeterPlot;
47 import net.sf.jasperreports.charts.JRMultiAxisPlot;
48 import net.sf.jasperreports.charts.JRPie3DPlot;
49 import net.sf.jasperreports.charts.JRPieDataset;
50 import net.sf.jasperreports.charts.JRPiePlot;
51 import net.sf.jasperreports.charts.JRScatterPlot;
52 import net.sf.jasperreports.charts.JRThermometerPlot;
53 import net.sf.jasperreports.charts.JRTimePeriodDataset;
54 import net.sf.jasperreports.charts.JRTimePeriodSeries;
55 import net.sf.jasperreports.charts.JRTimeSeries;
56 import net.sf.jasperreports.charts.JRTimeSeriesDataset;
57 import net.sf.jasperreports.charts.JRTimeSeriesPlot;
58 import net.sf.jasperreports.charts.JRValueDataset;
59 import net.sf.jasperreports.charts.JRXyDataset;
60 import net.sf.jasperreports.charts.JRXySeries;
61 import net.sf.jasperreports.charts.JRXyzDataset;
62 import net.sf.jasperreports.charts.JRXyzSeries;
63 import net.sf.jasperreports.charts.fill.JRFillAreaPlot;
64 import net.sf.jasperreports.charts.fill.JRFillBar3DPlot;
65 import net.sf.jasperreports.charts.fill.JRFillBarPlot;
66 import net.sf.jasperreports.charts.fill.JRFillBubblePlot;
67 import net.sf.jasperreports.charts.fill.JRFillCandlestickPlot;
68 import net.sf.jasperreports.charts.fill.JRFillCategoryDataset;
69 import net.sf.jasperreports.charts.fill.JRFillCategorySeries;
70 import net.sf.jasperreports.charts.fill.JRFillChartAxis;
71 import net.sf.jasperreports.charts.fill.JRFillHighLowDataset;
72 import net.sf.jasperreports.charts.fill.JRFillHighLowPlot;
73 import net.sf.jasperreports.charts.fill.JRFillLinePlot;
74 import net.sf.jasperreports.charts.fill.JRFillMeterPlot;
75 import net.sf.jasperreports.charts.fill.JRFillMultiAxisPlot;
76 import net.sf.jasperreports.charts.fill.JRFillPie3DPlot;
77 import net.sf.jasperreports.charts.fill.JRFillPieDataset;
78 import net.sf.jasperreports.charts.fill.JRFillPiePlot;
79 import net.sf.jasperreports.charts.fill.JRFillScatterPlot;
80 import net.sf.jasperreports.charts.fill.JRFillThermometerPlot;
81 import net.sf.jasperreports.charts.fill.JRFillTimePeriodDataset;
82 import net.sf.jasperreports.charts.fill.JRFillTimePeriodSeries;
83 import net.sf.jasperreports.charts.fill.JRFillTimeSeries;
84 import net.sf.jasperreports.charts.fill.JRFillTimeSeriesDataset;
85 import net.sf.jasperreports.charts.fill.JRFillTimeSeriesPlot;
86 import net.sf.jasperreports.charts.fill.JRFillValueDataset;
87 import net.sf.jasperreports.charts.fill.JRFillXyDataset;
88 import net.sf.jasperreports.charts.fill.JRFillXySeries;
89 import net.sf.jasperreports.charts.fill.JRFillXyzDataset;
90 import net.sf.jasperreports.charts.fill.JRFillXyzSeries;
91 import net.sf.jasperreports.crosstabs.JRCellContents;
92 import net.sf.jasperreports.crosstabs.JRCrosstab;
93 import net.sf.jasperreports.crosstabs.JRCrosstabCell;
94 import net.sf.jasperreports.crosstabs.JRCrosstabColumnGroup;
95 import net.sf.jasperreports.crosstabs.JRCrosstabDataset;
96 import net.sf.jasperreports.crosstabs.JRCrosstabMeasure;
97 import net.sf.jasperreports.crosstabs.JRCrosstabParameter;
98 import net.sf.jasperreports.crosstabs.JRCrosstabRowGroup;
99 import net.sf.jasperreports.crosstabs.fill.JRFillCrosstabCell;
100 import net.sf.jasperreports.crosstabs.fill.JRFillCrosstabColumnGroup;
101 import net.sf.jasperreports.crosstabs.fill.JRFillCrosstabMeasure;
102 import net.sf.jasperreports.crosstabs.fill.JRFillCrosstabParameter;
103 import net.sf.jasperreports.crosstabs.fill.JRFillCrosstabRowGroup;
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.JRDatasetRun;
111 import net.sf.jasperreports.engine.JRElementGroup;
112 import net.sf.jasperreports.engine.JREllipse;
113 import net.sf.jasperreports.engine.JRExpression;
114 import net.sf.jasperreports.engine.JRField;
115 import net.sf.jasperreports.engine.JRFont;
116 import net.sf.jasperreports.engine.JRFrame;
117 import net.sf.jasperreports.engine.JRGroup;
118 import net.sf.jasperreports.engine.JRImage;
119 import net.sf.jasperreports.engine.JRLine;
120 import net.sf.jasperreports.engine.JRParameter;
121 import net.sf.jasperreports.engine.JRRectangle;
122 import net.sf.jasperreports.engine.JRReportFont;
123 import net.sf.jasperreports.engine.JRStaticText;
124 import net.sf.jasperreports.engine.JRStyle;
125 import net.sf.jasperreports.engine.JRSubreport;
126 import net.sf.jasperreports.engine.JRSubreportReturnValue;
127 import net.sf.jasperreports.engine.JRTextField;
128 import net.sf.jasperreports.engine.JRVariable;
129 import net.sf.jasperreports.engine.base.JRBaseConditionalStyle;
130 import net.sf.jasperreports.engine.base.JRBaseFont;
131 import net.sf.jasperreports.engine.base.JRBaseReportFont;
132 import net.sf.jasperreports.engine.base.JRBaseStyle;
133
134
135 /**
136  * @author Teodor Danciu (teodord@users.sourceforge.net)
137  * @version $Id: JRFillObjectFactory.java 1502 2006-11-21 18:14:56 +0200 (Tue, 21 Nov 2006) teodord $
138  */

139 public class JRFillObjectFactory extends JRAbstractObjectFactory
140 {
141
142
143     /**
144      *
145      */

146     private JRBaseFiller filler = null;
147     private JRFillExpressionEvaluator evaluator;
148
149     private JRFont defaultFont = null;
150
151     private List JavaDoc elementDatasets = new ArrayList JavaDoc();
152     private Map JavaDoc elementDatasetMap = new HashMap JavaDoc();
153
154
155     /**
156      *
157      */

158     protected JRFillObjectFactory(JRBaseFiller filler)
159     {
160         this.filler = filler;
161         this.evaluator = filler.calculator;
162     }
163
164
165     /**
166      *
167      */

168     public JRFillObjectFactory(JRBaseFiller filler, JRFillExpressionEvaluator expressionEvaluator)
169     {
170         this.filler = filler;
171         this.evaluator = expressionEvaluator;
172     }
173
174
175     protected JRFillExpressionEvaluator getExpressionEvaluator()
176     {
177         return evaluator;
178     }
179
180     /**
181      *
182      */

183     protected JRFillChartDataset[] getDatasets()
184     {
185         return (JRFillChartDataset[]) elementDatasets.toArray(new JRFillChartDataset[elementDatasets.size()]);
186     }
187
188
189     protected JRFillElementDataset[] getElementDatasets(JRDataset dataset)
190     {
191         JRFillElementDataset[] elementDatasetsArray;
192         List JavaDoc elementDatasetsList;
193         if (dataset.isMainDataset())
194         {
195             elementDatasetsList = elementDatasets;
196         }
197         else
198         {
199             elementDatasetsList = (List JavaDoc) elementDatasetMap.get(dataset.getName());
200         }
201
202         if (elementDatasetsList == null || elementDatasetsList.size() == 0)
203         {
204             elementDatasetsArray = new JRFillElementDataset[0];
205         }
206         else
207         {
208             elementDatasetsArray = new JRFillElementDataset[elementDatasetsList.size()];
209             elementDatasetsList.toArray(elementDatasetsArray);
210         }
211
212         return elementDatasetsArray;
213     }
214
215
216     /**
217      *
218      */

219     public JRReportFont getReportFont(JRReportFont font)
220     {
221         JRBaseReportFont fillFont = null;
222
223         if (font != null)
224         {
225             fillFont = (JRBaseReportFont)get(font);
226             if (fillFont == null)
227             {
228                 fillFont = new JRBaseReportFont(font);
229                 put(font, fillFont);
230             }
231         }
232
233         return fillFont;
234     }
235
236
237     /**
238      *
239      */

240     public JRStyle getStyle(JRStyle style)
241     {
242         JRBaseStyle fillStyle = null;
243
244         if (style != null)
245         {
246             fillStyle = (JRBaseStyle)get(style);
247             if (fillStyle == null)
248             {
249                 fillStyle = new JRBaseStyle(style, this);
250                 put(style, fillStyle);
251             }
252         }
253
254         return fillStyle;
255     }
256
257
258     /**
259      *
260      */

261     protected JRBaseFont getFont(JRFont font)
262     {
263         JRBaseFont fillFont = null;
264
265         if (font != null)
266         {
267             fillFont = (JRBaseFont)get(font);
268             if (fillFont == null)
269             {
270                 fillFont =
271                     new JRBaseFont(
272                         filler.getJasperPrint().getDefaultStyleProvider(),
273                         getReportFont(font.getReportFont()),
274                         font
275                         );
276                 put(font, fillFont);
277             }
278         }
279         else
280         {
281             if (defaultFont == null)
282             {
283                 defaultFont = new JRBaseFont();
284             }
285             fillFont = getFont(defaultFont);
286         }
287
288         return fillFont;
289     }
290
291
292     /**
293      *
294      */

295     protected JRFillParameter getParameter(JRParameter parameter)
296     {
297         JRFillParameter fillParameter = null;
298
299         if (parameter != null)
300         {
301             fillParameter = (JRFillParameter)get(parameter);
302             if (fillParameter == null)
303             {
304                 fillParameter = new JRFillParameter(parameter, this);
305             }
306         }
307
308         return fillParameter;
309     }
310
311
312     /**
313      *
314      */

315     protected JRFillField getField(JRField field)
316     {
317         JRFillField fillField = null;
318
319         if (field != null)
320         {
321             fillField = (JRFillField)get(field);
322             if (fillField == null)
323             {
324                 fillField = new JRFillField(field, this);
325             }
326         }
327
328         return fillField;
329     }
330
331
332     /**
333      *
334      */

335     public JRFillVariable getVariable(JRVariable variable)
336     {
337         JRFillVariable fillVariable = null;
338
339         if (variable != null)
340         {
341             fillVariable = (JRFillVariable)get(variable);
342             if (fillVariable == null)
343             {
344                 fillVariable = new JRFillVariable(variable, this);
345             }
346         }
347
348         return fillVariable;
349     }
350
351
352     /**
353      *
354      */

355     protected JRFillGroup getGroup(JRGroup group)
356     {
357         JRFillGroup fillGroup = null;
358
359         if (group != null)
360         {
361             fillGroup = (JRFillGroup)get(group);
362             if (fillGroup == null)
363             {
364                 fillGroup = new JRFillGroup(group, this);
365             }
366         }
367
368         return fillGroup;
369     }
370
371
372     /**
373      *
374      */

375     protected JRFillBand getBand(JRBand band)
376     {
377         JRFillBand fillBand = null;
378
379         //if (band != null)
380
//{
381
// for null bands, the filler's missingFillBand will be returned
382
fillBand = (JRFillBand)get(band);
383             if (fillBand == null)
384             {
385                 fillBand = new JRFillBand(filler, band, this);
386             }
387         //}
388

389         return fillBand;
390     }
391
392
393     /**
394      *
395      */

396     public JRElementGroup getElementGroup(JRElementGroup elementGroup)
397     {
398         JRFillElementGroup fillElementGroup = null;
399
400         if (elementGroup != null)
401         {
402             fillElementGroup = (JRFillElementGroup)get(elementGroup);
403             if (fillElementGroup == null)
404             {
405                 fillElementGroup = new JRFillElementGroup(elementGroup, this);
406             }
407         }
408
409         return fillElementGroup;
410     }
411
412
413     /**
414      *
415      */

416     public JRBreak getBreak(JRBreak breakElement)
417     {
418         JRFillBreak fillBreak = null;
419
420         if (breakElement != null)
421         {
422             fillBreak = (JRFillBreak)get(breakElement);
423             if (fillBreak == null)
424             {
425                 fillBreak = new JRFillBreak(filler, breakElement, this);
426             }
427         }
428
429         return fillBreak;
430     }
431
432
433     /**
434      *
435      */

436     public JRLine getLine(JRLine line)
437     {
438         JRFillLine fillLine = null;
439
440         if (line != null)
441         {
442             fillLine = (JRFillLine)get(line);
443             if (fillLine == null)
444             {
445                 fillLine = new JRFillLine(filler, line, this);
446             }
447         }
448
449         return fillLine;
450     }
451
452
453     /**
454      *
455      */

456     public JRRectangle getRectangle(JRRectangle rectangle)
457     {
458         JRFillRectangle fillRectangle = null;
459
460         if (rectangle != null)
461         {
462             fillRectangle = (JRFillRectangle)get(rectangle);
463             if (fillRectangle == null)
464             {
465                 fillRectangle = new JRFillRectangle(filler, rectangle, this);
466             }
467         }
468
469         return fillRectangle;
470     }
471
472
473     /**
474      *
475      */

476     public JREllipse getEllipse(JREllipse ellipse)
477     {
478         JRFillEllipse fillEllipse = null;
479
480         if (ellipse != null)
481         {
482             fillEllipse = (JRFillEllipse)get(ellipse);
483             if (fillEllipse == null)
484             {
485                 fillEllipse = new JRFillEllipse(filler, ellipse, this);
486             }
487         }
488
489         return fillEllipse;
490     }
491
492
493     /**
494      *
495      */

496     public JRImage getImage(JRImage image)
497     {
498         JRFillImage fillImage = null;
499
500         if (image != null)
501         {
502             fillImage = (JRFillImage)get(image);
503             if (fillImage == null)
504             {
505                 fillImage = new JRFillImage(filler, image, this);
506             }
507         }
508
509         return fillImage;
510     }
511
512
513     /**
514      *
515      */

516     public JRStaticText getStaticText(JRStaticText staticText)
517     {
518         JRFillStaticText fillStaticText = null;
519
520         if (staticText != null)
521         {
522             fillStaticText = (JRFillStaticText)get(staticText);
523             if (fillStaticText == null)
524             {
525                 fillStaticText = new JRFillStaticText(filler, staticText, this);
526             }
527         }
528
529         return fillStaticText;
530     }
531
532
533     /**
534      *
535      */

536     public JRTextField getTextField(JRTextField textField)
537     {
538         JRFillTextField fillTextField = null;
539
540         if (textField != null)
541         {
542             fillTextField = (JRFillTextField)get(textField);
543             if (fillTextField == null)
544             {
545                 fillTextField = new JRFillTextField(filler, textField, this);
546             }
547         }
548
549         return fillTextField;
550     }
551
552
553     /**
554      *
555      */

556     public JRSubreport getSubreport(JRSubreport subreport)
557     {
558         JRFillSubreport fillSubreport = null;
559
560         if (subreport != null)
561         {
562             fillSubreport = (JRFillSubreport)get(subreport);
563             if (fillSubreport == null)
564             {
565                 fillSubreport = new JRFillSubreport(filler, subreport, this);
566             }
567         }
568
569         return fillSubreport;
570     }
571
572
573     public JRChart getChart(JRChart chart)
574     {
575         JRFillChart fillChart = null;
576
577         if (chart != null)
578         {
579             fillChart = (JRFillChart)get(chart);
580             if (fillChart == null)
581             {
582                 fillChart = new JRFillChart(filler, chart, this);
583             }
584         }
585
586         return fillChart;
587     }
588
589
590     /**
591      *
592      */

593     public JRPieDataset getPieDataset(JRPieDataset pieDataset)
594     {
595         JRFillPieDataset fillPieDataset = null;
596
597         if (pieDataset != null)
598         {
599             fillPieDataset = (JRFillPieDataset)get(pieDataset);
600             if (fillPieDataset == null)
601             {
602                 fillPieDataset = new JRFillPieDataset(pieDataset, this);
603                 addChartDataset(fillPieDataset);
604             }
605         }
606
607         return fillPieDataset;
608     }
609
610
611     /**
612      *
613      */

614     public JRPiePlot getPiePlot(JRPiePlot piePlot)
615     {
616         JRFillPiePlot fillPiePlot = null;
617
618         if (piePlot != null)
619         {
620             fillPiePlot = (JRFillPiePlot)get(piePlot);
621             if (fillPiePlot == null)
622             {
623                 fillPiePlot = new JRFillPiePlot(piePlot, this);
624             }
625         }
626
627         return fillPiePlot;
628     }
629
630
631     /**
632      *
633      */

634     public JRPie3DPlot getPie3DPlot(JRPie3DPlot pie3DPlot)
635     {
636         JRFillPie3DPlot fillPie3DPlot = null;
637
638         if (pie3DPlot != null)
639         {
640             fillPie3DPlot = (JRFillPie3DPlot)get(pie3DPlot);
641             if (fillPie3DPlot == null)
642             {
643                 fillPie3DPlot = new JRFillPie3DPlot(pie3DPlot, this);
644             }
645         }
646
647         return fillPie3DPlot;
648     }
649
650
651     /**
652      *
653      */

654     public JRCategoryDataset getCategoryDataset(JRCategoryDataset categoryDataset)
655     {
656         JRFillCategoryDataset fillCategoryDataset = null;
657
658         if (categoryDataset != null)
659         {
660             fillCategoryDataset = (JRFillCategoryDataset)get(categoryDataset);
661             if (fillCategoryDataset == null)
662             {
663                 fillCategoryDataset = new JRFillCategoryDataset(categoryDataset, this);
664                 addChartDataset(fillCategoryDataset);
665             }
666         }
667
668         return fillCategoryDataset;
669     }
670
671     public JRXyzDataset getXyzDataset( JRXyzDataset xyzDataset ){
672         JRFillXyzDataset fillXyzDataset = null;
673         if( xyzDataset != null ){
674             fillXyzDataset = (JRFillXyzDataset)get( xyzDataset );
675             if( fillXyzDataset == null ){
676                 fillXyzDataset = new JRFillXyzDataset( xyzDataset, this );
677                 addChartDataset(fillXyzDataset);
678             }
679         }
680
681         return fillXyzDataset;
682
683     }
684
685
686     /**
687      *
688      */

689     public JRXyDataset getXyDataset(JRXyDataset xyDataset)
690     {
691         JRFillXyDataset fillXyDataset = null;
692
693         if (xyDataset != null)
694         {
695             fillXyDataset = (JRFillXyDataset)get(xyDataset);
696             if (fillXyDataset == null)
697             {
698                 fillXyDataset = new JRFillXyDataset(xyDataset, this);
699                 addChartDataset(fillXyDataset);
700             }
701         }
702
703         return fillXyDataset;
704     }
705
706
707     /**
708      *
709      */

710     public JRTimeSeriesDataset getTimeSeriesDataset( JRTimeSeriesDataset timeSeriesDataset ){
711         JRFillTimeSeriesDataset fillTimeSeriesDataset = null;
712
713         if( timeSeriesDataset != null ){
714
715             fillTimeSeriesDataset = (JRFillTimeSeriesDataset)get( timeSeriesDataset );
716
717             if( fillTimeSeriesDataset == null ){
718                 fillTimeSeriesDataset = new JRFillTimeSeriesDataset( timeSeriesDataset, this );
719                 addChartDataset(fillTimeSeriesDataset);
720             }
721         }
722
723         return fillTimeSeriesDataset;
724     }
725
726     public JRTimePeriodDataset getTimePeriodDataset( JRTimePeriodDataset timePeriodDataset ){
727         JRFillTimePeriodDataset fillTimePeriodDataset = null;
728         if( timePeriodDataset != null ){
729             fillTimePeriodDataset = (JRFillTimePeriodDataset)get( timePeriodDataset );
730             if( fillTimePeriodDataset == null ){
731                 fillTimePeriodDataset = new JRFillTimePeriodDataset( timePeriodDataset, this );
732                 addChartDataset(fillTimePeriodDataset);
733             }
734         }
735         return fillTimePeriodDataset;
736     }
737
738     /**
739      *
740      */

741     public JRCategorySeries getCategorySeries(JRCategorySeries categorySeries)
742     {
743         JRFillCategorySeries fillCategorySeries = null;
744
745         if (categorySeries != null)
746         {
747             fillCategorySeries = (JRFillCategorySeries)get(categorySeries);
748             if (fillCategorySeries == null)
749             {
750                 fillCategorySeries = new JRFillCategorySeries(categorySeries, this);
751             }
752         }
753
754         return fillCategorySeries;
755     }
756
757
758     public JRXyzSeries getXyzSeries( JRXyzSeries xyzSeries ){
759         JRFillXyzSeries fillXyzSeries = null;
760
761         if( xyzSeries != null ){
762             fillXyzSeries = (JRFillXyzSeries)get( xyzSeries );
763
764             if( fillXyzSeries == null ){
765                 fillXyzSeries = new JRFillXyzSeries( xyzSeries, this );
766             }
767         }
768
769         return fillXyzSeries;
770     }
771
772
773     /**
774      *
775      */

776     public JRXySeries getXySeries(JRXySeries xySeries)
777     {
778         JRFillXySeries fillXySeries = null;
779
780         if (xySeries != null)
781         {
782             fillXySeries = (JRFillXySeries)get(xySeries);
783             if (fillXySeries == null)
784             {
785                 fillXySeries = new JRFillXySeries(xySeries, this);
786             }
787         }
788
789         return fillXySeries;
790     }
791
792
793     /**
794      *
795      */

796     public JRBarPlot getBarPlot(JRBarPlot barPlot)
797     {
798         JRFillBarPlot fillBarPlot = null;
799
800         if (barPlot != null)
801         {
802             fillBarPlot = (JRFillBarPlot)get(barPlot);
803             if (fillBarPlot == null)
804             {
805                 fillBarPlot = new JRFillBarPlot(barPlot, this);
806             }
807         }
808
809         return fillBarPlot;
810     }
811
812
813     /**
814      *
815      */

816     public JRTimeSeries getTimeSeries(JRTimeSeries timeSeries)
817     {
818         JRFillTimeSeries fillTimeSeries = null;
819
820         if (timeSeries != null)
821         {
822             fillTimeSeries = (JRFillTimeSeries)get(timeSeries);
823             if (fillTimeSeries == null)
824             {
825                 fillTimeSeries = new JRFillTimeSeries(timeSeries, this);
826             }
827         }
828
829         return fillTimeSeries;
830     }
831
832     public JRTimePeriodSeries getTimePeriodSeries( JRTimePeriodSeries timePeriodSeries ){
833         JRFillTimePeriodSeries fillTimePeriodSeries = null;
834         if( timePeriodSeries != null ){
835             fillTimePeriodSeries = (JRFillTimePeriodSeries)get( timePeriodSeries );
836             if( fillTimePeriodSeries == null ){
837                 fillTimePeriodSeries = new JRFillTimePeriodSeries( timePeriodSeries, this );
838             }
839         }
840
841         return fillTimePeriodSeries;
842     }
843
844
845     /**
846      *
847      */

848     public JRBar3DPlot getBar3DPlot(JRBar3DPlot barPlot) {
849         JRFillBar3DPlot fillBarPlot = null;
850
851         if (barPlot != null){
852             fillBarPlot = (JRFillBar3DPlot)get(barPlot);
853             if (fillBarPlot == null){
854                 fillBarPlot = new JRFillBar3DPlot(barPlot, this);
855             }
856         }
857
858         return fillBarPlot;
859     }
860
861
862     /**
863      *
864      */

865     public JRLinePlot getLinePlot(JRLinePlot linePlot) {
866         JRFillLinePlot fillLinePlot = null;
867
868         if (linePlot != null){
869             fillLinePlot = (JRFillLinePlot)get(linePlot);
870             if (fillLinePlot == null){
871                 fillLinePlot = new JRFillLinePlot(linePlot, this);
872             }
873         }
874
875         return fillLinePlot;
876     }
877
878
879     /**
880      *
881      */

882     public JRScatterPlot getScatterPlot(JRScatterPlot scatterPlot) {
883         JRFillScatterPlot fillScatterPlot = null;
884
885         if (scatterPlot != null){
886             fillScatterPlot = (JRFillScatterPlot)get(scatterPlot);
887             if (fillScatterPlot == null){
888                 fillScatterPlot = new JRFillScatterPlot(scatterPlot, this);
889             }
890         }
891
892         return fillScatterPlot;
893     }
894
895
896     /**
897      *
898      */

899     public JRAreaPlot getAreaPlot(JRAreaPlot areaPlot) {
900         JRFillAreaPlot fillAreaPlot = null;
901
902         if (areaPlot != null)
903         {
904             fillAreaPlot = (JRFillAreaPlot)get(areaPlot);
905             if (fillAreaPlot == null)
906             {
907                 fillAreaPlot = new JRFillAreaPlot(areaPlot, this);
908             }
909         }
910
911         return fillAreaPlot;
912     }
913
914
915     /* (non-Javadoc)
916      * @see net.sf.jasperreports.engine.JRAbstractObjectFactory#getBubblePlot(net.sf.jasperreports.charts.JRBubblePlot)
917      */

918     public JRBubblePlot getBubblePlot(JRBubblePlot bubblePlot) {
919         JRFillBubblePlot fillBubblePlot = null;
920
921         if (bubblePlot != null)
922         {
923             fillBubblePlot = (JRFillBubblePlot)get(bubblePlot);
924             if (fillBubblePlot == null)
925             {
926                 fillBubblePlot = new JRFillBubblePlot(bubblePlot, this);
927             }
928         }
929
930         return fillBubblePlot;
931     }
932
933
934     /**
935      *
936      */

937     public JRHighLowDataset getHighLowDataset(JRHighLowDataset highLowDataset)
938     {
939         JRFillHighLowDataset fillHighLowDataset = null;
940
941         if (highLowDataset != null)
942         {
943             fillHighLowDataset = (JRFillHighLowDataset)get(highLowDataset);
944             if (fillHighLowDataset == null)
945             {
946                 fillHighLowDataset = new JRFillHighLowDataset(highLowDataset, this);
947                 addChartDataset(fillHighLowDataset);
948             }
949         }
950
951         return fillHighLowDataset;
952     }
953
954
955     /**
956      *
957      */

958     public JRHighLowPlot getHighLowPlot(JRHighLowPlot highLowPlot) {
959         JRFillHighLowPlot fillHighLowPlot = null;
960
961         if (highLowPlot != null){
962             fillHighLowPlot = (JRFillHighLowPlot)get(highLowPlot);
963             if (fillHighLowPlot == null){
964                 fillHighLowPlot = new JRFillHighLowPlot(highLowPlot, this);
965             }
966         }
967
968         return fillHighLowPlot;
969     }
970
971
972     public JRCandlestickPlot getCandlestickPlot(JRCandlestickPlot candlestickPlot)
973     {
974         JRFillCandlestickPlot fillCandlestickPlot = null;
975
976         if (candlestickPlot != null){
977             fillCandlestickPlot = (JRFillCandlestickPlot)get(candlestickPlot);
978             if (fillCandlestickPlot == null){
979                 fillCandlestickPlot = new JRFillCandlestickPlot(candlestickPlot, this);
980             }
981         }
982
983         return fillCandlestickPlot;
984     }
985
986
987
988     public JRTimeSeriesPlot getTimeSeriesPlot( JRTimeSeriesPlot plot ){
989         JRFillTimeSeriesPlot fillPlot = null;
990         if( plot != null ){
991             fillPlot = (JRFillTimeSeriesPlot)get( plot );
992             if( fillPlot == null ){
993                 fillPlot = new JRFillTimeSeriesPlot( plot, this );
994             }
995         }
996
997         return fillPlot;
998
999     }
1000
1001    /**
1002     *
1003     */

1004    public JRValueDataset getValueDataset(JRValueDataset valueDataset)
1005    {
1006        JRFillValueDataset fillValueDataset = null;
1007
1008        if (valueDataset != null)
1009        {
1010            fillValueDataset = (JRFillValueDataset)get(valueDataset);
1011            if (fillValueDataset == null)
1012            {
1013                fillValueDataset = new JRFillValueDataset(valueDataset, this);
1014                addChartDataset(fillValueDataset);
1015            }
1016        }
1017
1018        return fillValueDataset;
1019    }
1020
1021    /**
1022     *
1023     */

1024    public JRMeterPlot getMeterPlot(JRMeterPlot meterPlot)
1025    {
1026        JRFillMeterPlot fillMeterPlot = null;
1027
1028        if (meterPlot != null)
1029        {
1030            fillMeterPlot = (JRFillMeterPlot)get(meterPlot);
1031            if (fillMeterPlot == null)
1032            {
1033                fillMeterPlot = new JRFillMeterPlot(meterPlot, this);
1034            }
1035        }
1036
1037        return fillMeterPlot;
1038    }
1039    
1040    /**
1041     *
1042     */

1043    public JRThermometerPlot getThermometerPlot(JRThermometerPlot thermometerPlot)
1044    {
1045        JRFillThermometerPlot fillThermometerPlot = null;
1046
1047        if (thermometerPlot != null)
1048        {
1049            fillThermometerPlot = (JRFillThermometerPlot)get(thermometerPlot);
1050            if (fillThermometerPlot == null)
1051            {
1052                fillThermometerPlot = new JRFillThermometerPlot(thermometerPlot, this);
1053            }
1054        }
1055
1056        return fillThermometerPlot;
1057    }
1058    
1059    
1060    /**
1061     *
1062     */

1063    public JRMultiAxisPlot getMultiAxisPlot(JRMultiAxisPlot multiAxisPlot)
1064    {
1065        JRFillMultiAxisPlot fillMultiAxisPlot = null;
1066
1067        if (multiAxisPlot != null)
1068        {
1069            fillMultiAxisPlot = (JRFillMultiAxisPlot)get(multiAxisPlot);
1070            if (fillMultiAxisPlot == null)
1071            {
1072                fillMultiAxisPlot = new JRFillMultiAxisPlot(multiAxisPlot, this);
1073            }
1074        }
1075
1076        return fillMultiAxisPlot;
1077    }
1078    
1079    
1080    protected JRFillSubreportReturnValue getSubreportReturnValue(JRSubreportReturnValue returnValue)
1081    {
1082        JRFillSubreportReturnValue fillReturnValue = null;
1083
1084        if (returnValue != null)
1085        {
1086            fillReturnValue = (JRFillSubreportReturnValue) get(returnValue);
1087            if (fillReturnValue == null)
1088            {
1089                fillReturnValue = new JRFillSubreportReturnValue(returnValue, this, filler);
1090            }
1091        }
1092
1093        return fillReturnValue;
1094    }
1095
1096
1097    public JRCrosstab getCrosstab(JRCrosstab crosstabElement)
1098    {
1099        JRFillCrosstab fillCrosstab = null;
1100
1101        if (crosstabElement != null)
1102        {
1103            fillCrosstab = (JRFillCrosstab) get(crosstabElement);
1104            if (fillCrosstab == null)
1105            {
1106                fillCrosstab = new JRFillCrosstab(filler, crosstabElement, this);
1107            }
1108        }
1109
1110        return fillCrosstab;
1111    }
1112
1113
1114    public JRFillCrosstab.JRFillCrosstabDataset getCrosstabDataset(JRCrosstabDataset dataset, JRFillCrosstab fillCrosstab)
1115    {
1116        JRFillCrosstab.JRFillCrosstabDataset fillDataset = null;
1117
1118        if (dataset != null)
1119        {
1120            fillDataset = (JRFillCrosstab.JRFillCrosstabDataset)get(dataset);
1121            if (fillDataset == null)
1122            {
1123                fillDataset = fillCrosstab.new JRFillCrosstabDataset(dataset, this);
1124                addChartDataset(fillDataset);
1125            }
1126        }
1127
1128        return fillDataset;
1129    }
1130
1131
1132    public JRFillDataset getDataset(JRDataset dataset)
1133    {
1134        JRFillDataset fillDataset = null;
1135
1136        if (dataset != null)
1137        {
1138            fillDataset = (JRFillDataset) get(dataset);
1139            if (fillDataset == null)
1140            {
1141                fillDataset = new JRFillDataset(filler, dataset, this);
1142            }
1143        }
1144
1145        return fillDataset;
1146    }
1147
1148
1149    private void addChartDataset(JRFillElementDataset elementDataset)
1150    {
1151        List JavaDoc elementDatasetsList;
1152        JRDatasetRun datasetRun = elementDataset.getDatasetRun();
1153        if (datasetRun == null)
1154        {
1155            elementDatasetsList = elementDatasets;
1156        }
1157        else
1158        {
1159            String JavaDoc datasetName = datasetRun.getDatasetName();
1160            elementDatasetsList = (List JavaDoc) elementDatasetMap.get(datasetName);
1161            if (elementDatasetsList == null)
1162            {
1163                elementDatasetsList = new ArrayList JavaDoc();
1164                elementDatasetMap.put(datasetName, elementDatasetsList);
1165            }
1166        }
1167        elementDatasetsList.add(elementDataset);
1168    }
1169
1170
1171    public JRFillDatasetRun getDatasetRun(JRDatasetRun datasetRun)
1172    {
1173        JRFillDatasetRun fillDatasetRun = null;
1174
1175        if (datasetRun != null)
1176        {
1177            fillDatasetRun = (JRFillDatasetRun) get(datasetRun);
1178            if (fillDatasetRun == null)
1179            {
1180                fillDatasetRun = new JRFillDatasetRun(filler, datasetRun, this);
1181            }
1182        }
1183
1184        return fillDatasetRun;
1185    }
1186
1187
1188    public JRFillCrosstabParameter getCrosstabParameter(JRCrosstabParameter parameter)
1189    {
1190        JRFillCrosstabParameter fillParameter = null;
1191
1192        if (parameter != null)
1193        {
1194            fillParameter = (JRFillCrosstabParameter) get(parameter);
1195            if (fillParameter == null)
1196            {
1197                fillParameter = new JRFillCrosstabParameter(parameter, this);
1198            }
1199        }
1200
1201        return fillParameter;
1202    }
1203
1204
1205    public JRFillCellContents getCell(JRCellContents cell)
1206    {
1207        JRFillCellContents fillCell = null;
1208
1209        if (cell != null)
1210        {
1211            fillCell = (JRFillCellContents) get(cell);
1212            if (fillCell == null)
1213            {
1214                fillCell = new JRFillCellContents(filler, cell, this);
1215            }
1216        }
1217
1218        return fillCell;
1219    }
1220
1221
1222    public JRFillCrosstabRowGroup getCrosstabRowGroup(JRCrosstabRowGroup group)
1223    {
1224        JRFillCrosstabRowGroup fillGroup = null;
1225
1226        if (group != null)
1227        {
1228            fillGroup = (JRFillCrosstabRowGroup) get(group);
1229            if (fillGroup == null)
1230            {
1231                fillGroup = new JRFillCrosstabRowGroup(group, this);
1232            }
1233        }
1234
1235        return fillGroup;
1236    }
1237
1238
1239    public JRFillCrosstabColumnGroup getCrosstabColumnGroup(JRCrosstabColumnGroup group)
1240    {
1241        JRFillCrosstabColumnGroup fillGroup = null;
1242
1243        if (group != null)
1244        {
1245            fillGroup = (JRFillCrosstabColumnGroup) get(group);
1246            if (fillGroup == null)
1247            {
1248                fillGroup = new JRFillCrosstabColumnGroup(group, this);
1249            }
1250        }
1251
1252        return fillGroup;
1253    }
1254
1255
1256    public JRFillCrosstabCell getCrosstabCell(JRCrosstabCell cell)
1257    {
1258        JRFillCrosstabCell fillCell = null;
1259
1260        if (cell != null)
1261        {
1262            fillCell = (JRFillCrosstabCell) get(cell);
1263            if (fillCell == null)
1264            {
1265                fillCell = new JRFillCrosstabCell(cell, this);
1266            }
1267        }
1268
1269        return fillCell;
1270    }
1271
1272
1273    public JRFillCrosstabMeasure getCrosstabMeasure(JRCrosstabMeasure measure)
1274    {
1275        JRFillCrosstabMeasure fillMeasure = null;
1276
1277        if (measure != null)
1278        {
1279            fillMeasure = (JRFillCrosstabMeasure) get(measure);
1280            if (fillMeasure == null)
1281            {
1282                fillMeasure = new JRFillCrosstabMeasure(measure, this);
1283            }
1284        }
1285
1286        return fillMeasure;
1287    }
1288
1289
1290    public JRFrame getFrame(JRFrame frame)
1291    {
1292        JRFillFrame fillFrame = null;
1293
1294        if (frame != null)
1295        {
1296            fillFrame = (JRFillFrame) get(frame);
1297            if (fillFrame == null)
1298            {
1299                fillFrame = new JRFillFrame(filler, frame, this);
1300            }
1301        }
1302
1303        return fillFrame;
1304    }
1305
1306
1307    protected JRBaseFiller getFiller()
1308    {
1309        return filler;
1310    }
1311
1312
1313    /**
1314     *
1315     */

1316    public JRConditionalStyle getConditionalStyle(JRConditionalStyle conditionalStyle, JRStyle style)
1317    {
1318        JRBaseConditionalStyle baseConditionalStyle = null;
1319        if (conditionalStyle != null)
1320        {
1321            baseConditionalStyle = (JRBaseConditionalStyle) get(conditionalStyle);
1322            if (baseConditionalStyle == null) {
1323                baseConditionalStyle = new JRBaseConditionalStyle(conditionalStyle, style, this);
1324                put(conditionalStyle, baseConditionalStyle);
1325            }
1326        }
1327        return baseConditionalStyle;
1328    }
1329
1330
1331    public JRExpression getExpression(JRExpression expression, boolean assignNotUsedId)
1332    {
1333        return expression;
1334    }
1335
1336
1337    public JRChartAxis getChartAxis(JRChartAxis axis)
1338    {
1339        JRFillChartAxis fillAxis = null;
1340        if (axis != null)
1341        {
1342            fillAxis = (JRFillChartAxis) get(axis);
1343            if (fillAxis == null)
1344            {
1345                fillAxis = new JRFillChartAxis(axis, this);
1346            }
1347        }
1348        return fillAxis;
1349    }
1350}
1351
Popular Tags