Source Code Cross Referenced for JRFillObjectFactory.java in  » Report » jasperreports-2.0.1 » net » sf » jasperreports » engine » fill » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Report » jasperreports 2.0.1 » net.sf.jasperreports.engine.fill 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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.fill;
0029:
0030:        import java.util.ArrayList;
0031:        import java.util.HashMap;
0032:        import java.util.HashSet;
0033:        import java.util.Iterator;
0034:        import java.util.List;
0035:        import java.util.Map;
0036:        import java.util.Set;
0037:
0038:        import net.sf.jasperreports.charts.JRAreaPlot;
0039:        import net.sf.jasperreports.charts.JRBar3DPlot;
0040:        import net.sf.jasperreports.charts.JRBarPlot;
0041:        import net.sf.jasperreports.charts.JRBubblePlot;
0042:        import net.sf.jasperreports.charts.JRCandlestickPlot;
0043:        import net.sf.jasperreports.charts.JRCategoryDataset;
0044:        import net.sf.jasperreports.charts.JRCategorySeries;
0045:        import net.sf.jasperreports.charts.JRChartAxis;
0046:        import net.sf.jasperreports.charts.JRHighLowDataset;
0047:        import net.sf.jasperreports.charts.JRHighLowPlot;
0048:        import net.sf.jasperreports.charts.JRLinePlot;
0049:        import net.sf.jasperreports.charts.JRMeterPlot;
0050:        import net.sf.jasperreports.charts.JRMultiAxisPlot;
0051:        import net.sf.jasperreports.charts.JRPie3DPlot;
0052:        import net.sf.jasperreports.charts.JRPieDataset;
0053:        import net.sf.jasperreports.charts.JRPiePlot;
0054:        import net.sf.jasperreports.charts.JRScatterPlot;
0055:        import net.sf.jasperreports.charts.JRThermometerPlot;
0056:        import net.sf.jasperreports.charts.JRTimePeriodDataset;
0057:        import net.sf.jasperreports.charts.JRTimePeriodSeries;
0058:        import net.sf.jasperreports.charts.JRTimeSeries;
0059:        import net.sf.jasperreports.charts.JRTimeSeriesDataset;
0060:        import net.sf.jasperreports.charts.JRTimeSeriesPlot;
0061:        import net.sf.jasperreports.charts.JRValueDataset;
0062:        import net.sf.jasperreports.charts.JRXyDataset;
0063:        import net.sf.jasperreports.charts.JRXySeries;
0064:        import net.sf.jasperreports.charts.JRXyzDataset;
0065:        import net.sf.jasperreports.charts.JRXyzSeries;
0066:        import net.sf.jasperreports.charts.fill.JRFillAreaPlot;
0067:        import net.sf.jasperreports.charts.fill.JRFillBar3DPlot;
0068:        import net.sf.jasperreports.charts.fill.JRFillBarPlot;
0069:        import net.sf.jasperreports.charts.fill.JRFillBubblePlot;
0070:        import net.sf.jasperreports.charts.fill.JRFillCandlestickPlot;
0071:        import net.sf.jasperreports.charts.fill.JRFillCategoryDataset;
0072:        import net.sf.jasperreports.charts.fill.JRFillCategorySeries;
0073:        import net.sf.jasperreports.charts.fill.JRFillChartAxis;
0074:        import net.sf.jasperreports.charts.fill.JRFillHighLowDataset;
0075:        import net.sf.jasperreports.charts.fill.JRFillHighLowPlot;
0076:        import net.sf.jasperreports.charts.fill.JRFillLinePlot;
0077:        import net.sf.jasperreports.charts.fill.JRFillMeterPlot;
0078:        import net.sf.jasperreports.charts.fill.JRFillMultiAxisPlot;
0079:        import net.sf.jasperreports.charts.fill.JRFillPie3DPlot;
0080:        import net.sf.jasperreports.charts.fill.JRFillPieDataset;
0081:        import net.sf.jasperreports.charts.fill.JRFillPiePlot;
0082:        import net.sf.jasperreports.charts.fill.JRFillScatterPlot;
0083:        import net.sf.jasperreports.charts.fill.JRFillThermometerPlot;
0084:        import net.sf.jasperreports.charts.fill.JRFillTimePeriodDataset;
0085:        import net.sf.jasperreports.charts.fill.JRFillTimePeriodSeries;
0086:        import net.sf.jasperreports.charts.fill.JRFillTimeSeries;
0087:        import net.sf.jasperreports.charts.fill.JRFillTimeSeriesDataset;
0088:        import net.sf.jasperreports.charts.fill.JRFillTimeSeriesPlot;
0089:        import net.sf.jasperreports.charts.fill.JRFillValueDataset;
0090:        import net.sf.jasperreports.charts.fill.JRFillXyDataset;
0091:        import net.sf.jasperreports.charts.fill.JRFillXySeries;
0092:        import net.sf.jasperreports.charts.fill.JRFillXyzDataset;
0093:        import net.sf.jasperreports.charts.fill.JRFillXyzSeries;
0094:        import net.sf.jasperreports.crosstabs.JRCellContents;
0095:        import net.sf.jasperreports.crosstabs.JRCrosstab;
0096:        import net.sf.jasperreports.crosstabs.JRCrosstabCell;
0097:        import net.sf.jasperreports.crosstabs.JRCrosstabColumnGroup;
0098:        import net.sf.jasperreports.crosstabs.JRCrosstabDataset;
0099:        import net.sf.jasperreports.crosstabs.JRCrosstabMeasure;
0100:        import net.sf.jasperreports.crosstabs.JRCrosstabParameter;
0101:        import net.sf.jasperreports.crosstabs.JRCrosstabRowGroup;
0102:        import net.sf.jasperreports.crosstabs.fill.JRFillCrosstabCell;
0103:        import net.sf.jasperreports.crosstabs.fill.JRFillCrosstabColumnGroup;
0104:        import net.sf.jasperreports.crosstabs.fill.JRFillCrosstabMeasure;
0105:        import net.sf.jasperreports.crosstabs.fill.JRFillCrosstabParameter;
0106:        import net.sf.jasperreports.crosstabs.fill.JRFillCrosstabRowGroup;
0107:        import net.sf.jasperreports.engine.JRAbstractObjectFactory;
0108:        import net.sf.jasperreports.engine.JRBand;
0109:        import net.sf.jasperreports.engine.JRBreak;
0110:        import net.sf.jasperreports.engine.JRChart;
0111:        import net.sf.jasperreports.engine.JRConditionalStyle;
0112:        import net.sf.jasperreports.engine.JRDataset;
0113:        import net.sf.jasperreports.engine.JRDatasetRun;
0114:        import net.sf.jasperreports.engine.JRDefaultStyleProvider;
0115:        import net.sf.jasperreports.engine.JRElementGroup;
0116:        import net.sf.jasperreports.engine.JREllipse;
0117:        import net.sf.jasperreports.engine.JRExpression;
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.JRImage;
0122:        import net.sf.jasperreports.engine.JRLine;
0123:        import net.sf.jasperreports.engine.JRParameter;
0124:        import net.sf.jasperreports.engine.JRRectangle;
0125:        import net.sf.jasperreports.engine.JRReportFont;
0126:        import net.sf.jasperreports.engine.JRReportTemplate;
0127:        import net.sf.jasperreports.engine.JRRuntimeException;
0128:        import net.sf.jasperreports.engine.JRStaticText;
0129:        import net.sf.jasperreports.engine.JRStyle;
0130:        import net.sf.jasperreports.engine.JRStyleContainer;
0131:        import net.sf.jasperreports.engine.JRStyleSetter;
0132:        import net.sf.jasperreports.engine.JRSubreport;
0133:        import net.sf.jasperreports.engine.JRSubreportReturnValue;
0134:        import net.sf.jasperreports.engine.JRTextField;
0135:        import net.sf.jasperreports.engine.JRVariable;
0136:        import net.sf.jasperreports.engine.base.JRBaseConditionalStyle;
0137:        import net.sf.jasperreports.engine.base.JRBaseReportFont;
0138:        import net.sf.jasperreports.engine.base.JRBaseStyle;
0139:
0140:        import org.apache.commons.collections.SequencedHashMap;
0141:
0142:        /**
0143:         * @author Teodor Danciu (teodord@users.sourceforge.net)
0144:         * @version $Id: JRFillObjectFactory.java 1809 2007-08-13 11:13:52Z teodord $
0145:         */
0146:        public class JRFillObjectFactory extends JRAbstractObjectFactory {
0147:
0148:            /**
0149:             *
0150:             */
0151:            private JRBaseFiller filler = null;
0152:            private JRFillExpressionEvaluator evaluator;
0153:
0154:            private JRFillObjectFactory parentFiller;
0155:
0156:            //	private JRFont defaultFont = null;
0157:
0158:            private List elementDatasets = new ArrayList();
0159:            private Map elementDatasetMap = new HashMap();
0160:
0161:            private Map delayedStyleSettersByName = new HashMap();
0162:
0163:            protected static class StylesList {
0164:                private final List styles = new ArrayList();
0165:                private final Map stylesIdx = new HashMap();
0166:
0167:                public boolean containsStyle(String name) {
0168:                    return stylesIdx.containsKey(name);
0169:                }
0170:
0171:                public JRStyle getStyle(String name) {
0172:                    Integer idx = (Integer) stylesIdx.get(name);
0173:                    return idx == null ? null : (JRStyle) styles.get(idx
0174:                            .intValue());
0175:                }
0176:
0177:                public void addStyle(JRStyle style) {
0178:                    styles.add(style);
0179:                    stylesIdx.put(style.getName(), new Integer(
0180:                            styles.size() - 1));
0181:                }
0182:
0183:                public void renamed(String oldName, String newName) {
0184:                    Integer idx = (Integer) stylesIdx.remove(oldName);
0185:                    stylesIdx.put(newName, idx);
0186:                }
0187:            }
0188:
0189:            private Set originalStyleList;
0190:            private StylesList stylesMap = new StylesList();
0191:
0192:            /**
0193:             *
0194:             */
0195:            protected JRFillObjectFactory(JRBaseFiller filler) {
0196:                this .filler = filler;
0197:                this .evaluator = filler.calculator;
0198:            }
0199:
0200:            /**
0201:             *
0202:             */
0203:            public JRFillObjectFactory(JRBaseFiller filler,
0204:                    JRFillExpressionEvaluator expressionEvaluator) {
0205:                this .filler = filler;
0206:                this .evaluator = expressionEvaluator;
0207:            }
0208:
0209:            public JRFillObjectFactory(JRFillObjectFactory parent,
0210:                    JRFillExpressionEvaluator expressionEvaluator) {
0211:                this .parentFiller = parent;
0212:                this .filler = parent.filler;
0213:                this .evaluator = expressionEvaluator;
0214:            }
0215:
0216:            protected JRFillExpressionEvaluator getExpressionEvaluator() {
0217:                return evaluator;
0218:            }
0219:
0220:            /**
0221:             *
0222:             */
0223:            protected JRFillChartDataset[] getDatasets() {
0224:                return (JRFillChartDataset[]) elementDatasets
0225:                        .toArray(new JRFillChartDataset[elementDatasets.size()]);
0226:            }
0227:
0228:            protected JRFillElementDataset[] getElementDatasets(
0229:                    JRDataset dataset) {
0230:                JRFillElementDataset[] elementDatasetsArray;
0231:                List elementDatasetsList;
0232:                if (dataset.isMainDataset()) {
0233:                    elementDatasetsList = elementDatasets;
0234:                } else {
0235:                    elementDatasetsList = (List) elementDatasetMap.get(dataset
0236:                            .getName());
0237:                }
0238:
0239:                if (elementDatasetsList == null
0240:                        || elementDatasetsList.size() == 0) {
0241:                    elementDatasetsArray = new JRFillElementDataset[0];
0242:                } else {
0243:                    elementDatasetsArray = new JRFillElementDataset[elementDatasetsList
0244:                            .size()];
0245:                    elementDatasetsList.toArray(elementDatasetsArray);
0246:                }
0247:
0248:                return elementDatasetsArray;
0249:            }
0250:
0251:            /**
0252:             *
0253:             */
0254:            public JRReportFont getReportFont(JRReportFont font) {
0255:                JRBaseReportFont fillFont = null;
0256:
0257:                if (font != null) {
0258:                    fillFont = (JRBaseReportFont) get(font);
0259:                    if (fillFont == null) {
0260:                        fillFont = new JRBaseReportFont(font);
0261:                        put(font, fillFont);
0262:                    }
0263:                }
0264:
0265:                return fillFont;
0266:            }
0267:
0268:            protected void registerDelayedStyleSetter(
0269:                    JRStyleSetter delayedSetter, String styleName) {
0270:                if (parentFiller == null) {
0271:                    List setters = (List) delayedStyleSettersByName
0272:                            .get(styleName);
0273:                    if (setters == null) {
0274:                        setters = new ArrayList();
0275:                        delayedStyleSettersByName.put(styleName, setters);
0276:                    }
0277:
0278:                    setters.add(delayedSetter);
0279:                } else {
0280:                    parentFiller.registerDelayedStyleSetter(delayedSetter,
0281:                            styleName);
0282:                }
0283:            }
0284:
0285:            public void registerDelayedStyleSetter(JRStyleSetter delayedSetter,
0286:                    JRStyleContainer styleContainer) {
0287:                JRStyle style = styleContainer.getStyle();
0288:                String nameReference = styleContainer.getStyleNameReference();
0289:                if (style != null) {
0290:                    registerDelayedStyleSetter(delayedSetter, style.getName());
0291:                } else if (nameReference != null) {
0292:                    registerDelayedStyleSetter(delayedSetter, nameReference);
0293:                }
0294:            }
0295:
0296:            public JRStyle getStyle(JRStyle style) {
0297:                JRBaseStyle fillStyle = null;
0298:
0299:                if (style != null) {
0300:                    fillStyle = (JRBaseStyle) get(style);
0301:                    if (fillStyle == null) {
0302:                        fillStyle = new JRBaseStyle(style, this );
0303:                        put(style, fillStyle);
0304:
0305:                        if (originalStyleList != null
0306:                                && originalStyleList.contains(style)) {
0307:                            renameExistingStyle(style.getName());
0308:                            stylesMap.addStyle(style);
0309:                        }
0310:                    }
0311:                }
0312:
0313:                return fillStyle;
0314:            }
0315:
0316:            protected void renameExistingStyle(String name) {
0317:                JRStyle originalStyle = stylesMap.getStyle(name);
0318:                if (originalStyle != null) {
0319:                    //found a previous external style with the same name
0320:                    //renaming the previous style
0321:                    JRBaseStyle style = (JRBaseStyle) get(originalStyle);
0322:
0323:                    String newName;
0324:                    int suf = 1;
0325:                    do {
0326:                        newName = name + suf;
0327:                        ++suf;
0328:                    } while (stylesMap.containsStyle(newName));
0329:
0330:                    style.rename(newName);
0331:                    stylesMap.renamed(name, newName);
0332:                }
0333:            }
0334:
0335:            public void setStyle(JRStyleSetter setter,
0336:                    JRStyleContainer styleContainer) {
0337:                JRStyle style = styleContainer.getStyle();
0338:                String nameReference = styleContainer.getStyleNameReference();
0339:                if (style != null) {
0340:                    JRStyle newStyle = getStyle(style);
0341:                    setter.setStyle(newStyle);
0342:                } else if (nameReference != null) {
0343:                    JRStyle originalStyle = stylesMap.getStyle(nameReference);
0344:                    if (originalStyle == null) {
0345:                        throw new JRRuntimeException("Style " + nameReference
0346:                                + " not found");
0347:                    }
0348:
0349:                    JRStyle externalStyle = (JRStyle) get(originalStyle);
0350:                    setter.setStyle(externalStyle);
0351:                }
0352:            }
0353:
0354:            /**
0355:             *
0356:             *
0357:            protected JRBaseFont getFont(JRFont font)
0358:            {
0359:            	JRBaseFont fillFont = null;
0360:
0361:            	if (font != null)
0362:            	{
0363:            		fillFont = (JRBaseFont)get(font);
0364:            		if (fillFont == null)
0365:            		{
0366:            			fillFont =
0367:            				new JRBaseFont(
0368:            					filler.getJasperPrint().getDefaultStyleProvider(),
0369:            					getReportFont(font.getReportFont()),
0370:            					font
0371:            					);
0372:            			put(font, fillFont);
0373:            		}
0374:            	}
0375:            	else
0376:            	{
0377:            		if (defaultFont == null)
0378:            		{
0379:            			defaultFont = new JRBaseFont();
0380:            		}
0381:            		fillFont = getFont(defaultFont);
0382:            	}
0383:
0384:            	return fillFont;
0385:            }
0386:
0387:
0388:            /**
0389:             *
0390:             */
0391:            protected JRFillParameter getParameter(JRParameter parameter) {
0392:                JRFillParameter fillParameter = null;
0393:
0394:                if (parameter != null) {
0395:                    fillParameter = (JRFillParameter) get(parameter);
0396:                    if (fillParameter == null) {
0397:                        fillParameter = new JRFillParameter(parameter, this );
0398:                    }
0399:                }
0400:
0401:                return fillParameter;
0402:            }
0403:
0404:            /**
0405:             *
0406:             */
0407:            protected JRFillField getField(JRField field) {
0408:                JRFillField fillField = null;
0409:
0410:                if (field != null) {
0411:                    fillField = (JRFillField) get(field);
0412:                    if (fillField == null) {
0413:                        fillField = new JRFillField(field, this );
0414:                    }
0415:                }
0416:
0417:                return fillField;
0418:            }
0419:
0420:            /**
0421:             *
0422:             */
0423:            public JRFillVariable getVariable(JRVariable variable) {
0424:                JRFillVariable fillVariable = null;
0425:
0426:                if (variable != null) {
0427:                    fillVariable = (JRFillVariable) get(variable);
0428:                    if (fillVariable == null) {
0429:                        fillVariable = new JRFillVariable(variable, this );
0430:                    }
0431:                }
0432:
0433:                return fillVariable;
0434:            }
0435:
0436:            /**
0437:             *
0438:             */
0439:            protected JRFillGroup getGroup(JRGroup group) {
0440:                JRFillGroup fillGroup = null;
0441:
0442:                if (group != null) {
0443:                    fillGroup = (JRFillGroup) get(group);
0444:                    if (fillGroup == null) {
0445:                        fillGroup = new JRFillGroup(group, this );
0446:                    }
0447:                }
0448:
0449:                return fillGroup;
0450:            }
0451:
0452:            /**
0453:             *
0454:             */
0455:            protected JRFillBand getBand(JRBand band) {
0456:                JRFillBand fillBand = null;
0457:
0458:                //if (band != null)
0459:                //{
0460:                // for null bands, the filler's missingFillBand will be returned
0461:                fillBand = (JRFillBand) get(band);
0462:                if (fillBand == null) {
0463:                    fillBand = new JRFillBand(filler, band, this );
0464:                }
0465:                //}
0466:
0467:                return fillBand;
0468:            }
0469:
0470:            /**
0471:             *
0472:             */
0473:            public JRElementGroup getElementGroup(JRElementGroup elementGroup) {
0474:                JRFillElementGroup fillElementGroup = null;
0475:
0476:                if (elementGroup != null) {
0477:                    fillElementGroup = (JRFillElementGroup) get(elementGroup);
0478:                    if (fillElementGroup == null) {
0479:                        fillElementGroup = new JRFillElementGroup(elementGroup,
0480:                                this );
0481:                    }
0482:                }
0483:
0484:                return fillElementGroup;
0485:            }
0486:
0487:            /**
0488:             *
0489:             */
0490:            public JRBreak getBreak(JRBreak breakElement) {
0491:                JRFillBreak fillBreak = null;
0492:
0493:                if (breakElement != null) {
0494:                    fillBreak = (JRFillBreak) get(breakElement);
0495:                    if (fillBreak == null) {
0496:                        fillBreak = new JRFillBreak(filler, breakElement, this );
0497:                    }
0498:                }
0499:
0500:                return fillBreak;
0501:            }
0502:
0503:            /**
0504:             *
0505:             */
0506:            public JRLine getLine(JRLine line) {
0507:                JRFillLine fillLine = null;
0508:
0509:                if (line != null) {
0510:                    fillLine = (JRFillLine) get(line);
0511:                    if (fillLine == null) {
0512:                        fillLine = new JRFillLine(filler, line, this );
0513:                    }
0514:                }
0515:
0516:                return fillLine;
0517:            }
0518:
0519:            /**
0520:             *
0521:             */
0522:            public JRRectangle getRectangle(JRRectangle rectangle) {
0523:                JRFillRectangle fillRectangle = null;
0524:
0525:                if (rectangle != null) {
0526:                    fillRectangle = (JRFillRectangle) get(rectangle);
0527:                    if (fillRectangle == null) {
0528:                        fillRectangle = new JRFillRectangle(filler, rectangle,
0529:                                this );
0530:                    }
0531:                }
0532:
0533:                return fillRectangle;
0534:            }
0535:
0536:            /**
0537:             *
0538:             */
0539:            public JREllipse getEllipse(JREllipse ellipse) {
0540:                JRFillEllipse fillEllipse = null;
0541:
0542:                if (ellipse != null) {
0543:                    fillEllipse = (JRFillEllipse) get(ellipse);
0544:                    if (fillEllipse == null) {
0545:                        fillEllipse = new JRFillEllipse(filler, ellipse, this );
0546:                    }
0547:                }
0548:
0549:                return fillEllipse;
0550:            }
0551:
0552:            /**
0553:             *
0554:             */
0555:            public JRImage getImage(JRImage image) {
0556:                JRFillImage fillImage = null;
0557:
0558:                if (image != null) {
0559:                    fillImage = (JRFillImage) get(image);
0560:                    if (fillImage == null) {
0561:                        fillImage = new JRFillImage(filler, image, this );
0562:                    }
0563:                }
0564:
0565:                return fillImage;
0566:            }
0567:
0568:            /**
0569:             *
0570:             */
0571:            public JRStaticText getStaticText(JRStaticText staticText) {
0572:                JRFillStaticText fillStaticText = null;
0573:
0574:                if (staticText != null) {
0575:                    fillStaticText = (JRFillStaticText) get(staticText);
0576:                    if (fillStaticText == null) {
0577:                        fillStaticText = new JRFillStaticText(filler,
0578:                                staticText, this );
0579:                    }
0580:                }
0581:
0582:                return fillStaticText;
0583:            }
0584:
0585:            /**
0586:             *
0587:             */
0588:            public JRTextField getTextField(JRTextField textField) {
0589:                JRFillTextField fillTextField = null;
0590:
0591:                if (textField != null) {
0592:                    fillTextField = (JRFillTextField) get(textField);
0593:                    if (fillTextField == null) {
0594:                        fillTextField = new JRFillTextField(filler, textField,
0595:                                this );
0596:                    }
0597:                }
0598:
0599:                return fillTextField;
0600:            }
0601:
0602:            /**
0603:             *
0604:             */
0605:            public JRSubreport getSubreport(JRSubreport subreport) {
0606:                JRFillSubreport fillSubreport = null;
0607:
0608:                if (subreport != null) {
0609:                    fillSubreport = (JRFillSubreport) get(subreport);
0610:                    if (fillSubreport == null) {
0611:                        fillSubreport = new JRFillSubreport(filler, subreport,
0612:                                this );
0613:                    }
0614:                }
0615:
0616:                return fillSubreport;
0617:            }
0618:
0619:            public JRChart getChart(JRChart chart) {
0620:                JRFillChart fillChart = null;
0621:
0622:                if (chart != null) {
0623:                    fillChart = (JRFillChart) get(chart);
0624:                    if (fillChart == null) {
0625:                        fillChart = new JRFillChart(filler, chart, this );
0626:                    }
0627:                }
0628:
0629:                return fillChart;
0630:            }
0631:
0632:            /**
0633:             *
0634:             */
0635:            public JRPieDataset getPieDataset(JRPieDataset pieDataset) {
0636:                JRFillPieDataset fillPieDataset = null;
0637:
0638:                if (pieDataset != null) {
0639:                    fillPieDataset = (JRFillPieDataset) get(pieDataset);
0640:                    if (fillPieDataset == null) {
0641:                        fillPieDataset = new JRFillPieDataset(pieDataset, this );
0642:                        addChartDataset(fillPieDataset);
0643:                    }
0644:                }
0645:
0646:                return fillPieDataset;
0647:            }
0648:
0649:            /**
0650:             *
0651:             */
0652:            public JRPiePlot getPiePlot(JRPiePlot piePlot) {
0653:                JRFillPiePlot fillPiePlot = null;
0654:
0655:                if (piePlot != null) {
0656:                    fillPiePlot = (JRFillPiePlot) get(piePlot);
0657:                    if (fillPiePlot == null) {
0658:                        fillPiePlot = new JRFillPiePlot(piePlot, this );
0659:                    }
0660:                }
0661:
0662:                return fillPiePlot;
0663:            }
0664:
0665:            /**
0666:             *
0667:             */
0668:            public JRPie3DPlot getPie3DPlot(JRPie3DPlot pie3DPlot) {
0669:                JRFillPie3DPlot fillPie3DPlot = null;
0670:
0671:                if (pie3DPlot != null) {
0672:                    fillPie3DPlot = (JRFillPie3DPlot) get(pie3DPlot);
0673:                    if (fillPie3DPlot == null) {
0674:                        fillPie3DPlot = new JRFillPie3DPlot(pie3DPlot, this );
0675:                    }
0676:                }
0677:
0678:                return fillPie3DPlot;
0679:            }
0680:
0681:            /**
0682:             *
0683:             */
0684:            public JRCategoryDataset getCategoryDataset(
0685:                    JRCategoryDataset categoryDataset) {
0686:                JRFillCategoryDataset fillCategoryDataset = null;
0687:
0688:                if (categoryDataset != null) {
0689:                    fillCategoryDataset = (JRFillCategoryDataset) get(categoryDataset);
0690:                    if (fillCategoryDataset == null) {
0691:                        fillCategoryDataset = new JRFillCategoryDataset(
0692:                                categoryDataset, this );
0693:                        addChartDataset(fillCategoryDataset);
0694:                    }
0695:                }
0696:
0697:                return fillCategoryDataset;
0698:            }
0699:
0700:            public JRXyzDataset getXyzDataset(JRXyzDataset xyzDataset) {
0701:                JRFillXyzDataset fillXyzDataset = null;
0702:                if (xyzDataset != null) {
0703:                    fillXyzDataset = (JRFillXyzDataset) get(xyzDataset);
0704:                    if (fillXyzDataset == null) {
0705:                        fillXyzDataset = new JRFillXyzDataset(xyzDataset, this );
0706:                        addChartDataset(fillXyzDataset);
0707:                    }
0708:                }
0709:
0710:                return fillXyzDataset;
0711:
0712:            }
0713:
0714:            /**
0715:             *
0716:             */
0717:            public JRXyDataset getXyDataset(JRXyDataset xyDataset) {
0718:                JRFillXyDataset fillXyDataset = null;
0719:
0720:                if (xyDataset != null) {
0721:                    fillXyDataset = (JRFillXyDataset) get(xyDataset);
0722:                    if (fillXyDataset == null) {
0723:                        fillXyDataset = new JRFillXyDataset(xyDataset, this );
0724:                        addChartDataset(fillXyDataset);
0725:                    }
0726:                }
0727:
0728:                return fillXyDataset;
0729:            }
0730:
0731:            /**
0732:             *
0733:             */
0734:            public JRTimeSeriesDataset getTimeSeriesDataset(
0735:                    JRTimeSeriesDataset timeSeriesDataset) {
0736:                JRFillTimeSeriesDataset fillTimeSeriesDataset = null;
0737:
0738:                if (timeSeriesDataset != null) {
0739:
0740:                    fillTimeSeriesDataset = (JRFillTimeSeriesDataset) get(timeSeriesDataset);
0741:
0742:                    if (fillTimeSeriesDataset == null) {
0743:                        fillTimeSeriesDataset = new JRFillTimeSeriesDataset(
0744:                                timeSeriesDataset, this );
0745:                        addChartDataset(fillTimeSeriesDataset);
0746:                    }
0747:                }
0748:
0749:                return fillTimeSeriesDataset;
0750:            }
0751:
0752:            public JRTimePeriodDataset getTimePeriodDataset(
0753:                    JRTimePeriodDataset timePeriodDataset) {
0754:                JRFillTimePeriodDataset fillTimePeriodDataset = null;
0755:                if (timePeriodDataset != null) {
0756:                    fillTimePeriodDataset = (JRFillTimePeriodDataset) get(timePeriodDataset);
0757:                    if (fillTimePeriodDataset == null) {
0758:                        fillTimePeriodDataset = new JRFillTimePeriodDataset(
0759:                                timePeriodDataset, this );
0760:                        addChartDataset(fillTimePeriodDataset);
0761:                    }
0762:                }
0763:                return fillTimePeriodDataset;
0764:            }
0765:
0766:            /**
0767:             *
0768:             */
0769:            public JRCategorySeries getCategorySeries(
0770:                    JRCategorySeries categorySeries) {
0771:                JRFillCategorySeries fillCategorySeries = null;
0772:
0773:                if (categorySeries != null) {
0774:                    fillCategorySeries = (JRFillCategorySeries) get(categorySeries);
0775:                    if (fillCategorySeries == null) {
0776:                        fillCategorySeries = new JRFillCategorySeries(
0777:                                categorySeries, this );
0778:                    }
0779:                }
0780:
0781:                return fillCategorySeries;
0782:            }
0783:
0784:            public JRXyzSeries getXyzSeries(JRXyzSeries xyzSeries) {
0785:                JRFillXyzSeries fillXyzSeries = null;
0786:
0787:                if (xyzSeries != null) {
0788:                    fillXyzSeries = (JRFillXyzSeries) get(xyzSeries);
0789:
0790:                    if (fillXyzSeries == null) {
0791:                        fillXyzSeries = new JRFillXyzSeries(xyzSeries, this );
0792:                    }
0793:                }
0794:
0795:                return fillXyzSeries;
0796:            }
0797:
0798:            /**
0799:             *
0800:             */
0801:            public JRXySeries getXySeries(JRXySeries xySeries) {
0802:                JRFillXySeries fillXySeries = null;
0803:
0804:                if (xySeries != null) {
0805:                    fillXySeries = (JRFillXySeries) get(xySeries);
0806:                    if (fillXySeries == null) {
0807:                        fillXySeries = new JRFillXySeries(xySeries, this );
0808:                    }
0809:                }
0810:
0811:                return fillXySeries;
0812:            }
0813:
0814:            /**
0815:             *
0816:             */
0817:            public JRBarPlot getBarPlot(JRBarPlot barPlot) {
0818:                JRFillBarPlot fillBarPlot = null;
0819:
0820:                if (barPlot != null) {
0821:                    fillBarPlot = (JRFillBarPlot) get(barPlot);
0822:                    if (fillBarPlot == null) {
0823:                        fillBarPlot = new JRFillBarPlot(barPlot, this );
0824:                    }
0825:                }
0826:
0827:                return fillBarPlot;
0828:            }
0829:
0830:            /**
0831:             *
0832:             */
0833:            public JRTimeSeries getTimeSeries(JRTimeSeries timeSeries) {
0834:                JRFillTimeSeries fillTimeSeries = null;
0835:
0836:                if (timeSeries != null) {
0837:                    fillTimeSeries = (JRFillTimeSeries) get(timeSeries);
0838:                    if (fillTimeSeries == null) {
0839:                        fillTimeSeries = new JRFillTimeSeries(timeSeries, this );
0840:                    }
0841:                }
0842:
0843:                return fillTimeSeries;
0844:            }
0845:
0846:            public JRTimePeriodSeries getTimePeriodSeries(
0847:                    JRTimePeriodSeries timePeriodSeries) {
0848:                JRFillTimePeriodSeries fillTimePeriodSeries = null;
0849:                if (timePeriodSeries != null) {
0850:                    fillTimePeriodSeries = (JRFillTimePeriodSeries) get(timePeriodSeries);
0851:                    if (fillTimePeriodSeries == null) {
0852:                        fillTimePeriodSeries = new JRFillTimePeriodSeries(
0853:                                timePeriodSeries, this );
0854:                    }
0855:                }
0856:
0857:                return fillTimePeriodSeries;
0858:            }
0859:
0860:            /**
0861:             *
0862:             */
0863:            public JRBar3DPlot getBar3DPlot(JRBar3DPlot barPlot) {
0864:                JRFillBar3DPlot fillBarPlot = null;
0865:
0866:                if (barPlot != null) {
0867:                    fillBarPlot = (JRFillBar3DPlot) get(barPlot);
0868:                    if (fillBarPlot == null) {
0869:                        fillBarPlot = new JRFillBar3DPlot(barPlot, this );
0870:                    }
0871:                }
0872:
0873:                return fillBarPlot;
0874:            }
0875:
0876:            /**
0877:             *
0878:             */
0879:            public JRLinePlot getLinePlot(JRLinePlot linePlot) {
0880:                JRFillLinePlot fillLinePlot = null;
0881:
0882:                if (linePlot != null) {
0883:                    fillLinePlot = (JRFillLinePlot) get(linePlot);
0884:                    if (fillLinePlot == null) {
0885:                        fillLinePlot = new JRFillLinePlot(linePlot, this );
0886:                    }
0887:                }
0888:
0889:                return fillLinePlot;
0890:            }
0891:
0892:            /**
0893:             *
0894:             */
0895:            public JRScatterPlot getScatterPlot(JRScatterPlot scatterPlot) {
0896:                JRFillScatterPlot fillScatterPlot = null;
0897:
0898:                if (scatterPlot != null) {
0899:                    fillScatterPlot = (JRFillScatterPlot) get(scatterPlot);
0900:                    if (fillScatterPlot == null) {
0901:                        fillScatterPlot = new JRFillScatterPlot(scatterPlot,
0902:                                this );
0903:                    }
0904:                }
0905:
0906:                return fillScatterPlot;
0907:            }
0908:
0909:            /**
0910:             *
0911:             */
0912:            public JRAreaPlot getAreaPlot(JRAreaPlot areaPlot) {
0913:                JRFillAreaPlot fillAreaPlot = null;
0914:
0915:                if (areaPlot != null) {
0916:                    fillAreaPlot = (JRFillAreaPlot) get(areaPlot);
0917:                    if (fillAreaPlot == null) {
0918:                        fillAreaPlot = new JRFillAreaPlot(areaPlot, this );
0919:                    }
0920:                }
0921:
0922:                return fillAreaPlot;
0923:            }
0924:
0925:            /* (non-Javadoc)
0926:             * @see net.sf.jasperreports.engine.JRAbstractObjectFactory#getBubblePlot(net.sf.jasperreports.charts.JRBubblePlot)
0927:             */
0928:            public JRBubblePlot getBubblePlot(JRBubblePlot bubblePlot) {
0929:                JRFillBubblePlot fillBubblePlot = null;
0930:
0931:                if (bubblePlot != null) {
0932:                    fillBubblePlot = (JRFillBubblePlot) get(bubblePlot);
0933:                    if (fillBubblePlot == null) {
0934:                        fillBubblePlot = new JRFillBubblePlot(bubblePlot, this );
0935:                    }
0936:                }
0937:
0938:                return fillBubblePlot;
0939:            }
0940:
0941:            /**
0942:             *
0943:             */
0944:            public JRHighLowDataset getHighLowDataset(
0945:                    JRHighLowDataset highLowDataset) {
0946:                JRFillHighLowDataset fillHighLowDataset = null;
0947:
0948:                if (highLowDataset != null) {
0949:                    fillHighLowDataset = (JRFillHighLowDataset) get(highLowDataset);
0950:                    if (fillHighLowDataset == null) {
0951:                        fillHighLowDataset = new JRFillHighLowDataset(
0952:                                highLowDataset, this );
0953:                        addChartDataset(fillHighLowDataset);
0954:                    }
0955:                }
0956:
0957:                return fillHighLowDataset;
0958:            }
0959:
0960:            /**
0961:             *
0962:             */
0963:            public JRHighLowPlot getHighLowPlot(JRHighLowPlot highLowPlot) {
0964:                JRFillHighLowPlot fillHighLowPlot = null;
0965:
0966:                if (highLowPlot != null) {
0967:                    fillHighLowPlot = (JRFillHighLowPlot) get(highLowPlot);
0968:                    if (fillHighLowPlot == null) {
0969:                        fillHighLowPlot = new JRFillHighLowPlot(highLowPlot,
0970:                                this );
0971:                    }
0972:                }
0973:
0974:                return fillHighLowPlot;
0975:            }
0976:
0977:            public JRCandlestickPlot getCandlestickPlot(
0978:                    JRCandlestickPlot candlestickPlot) {
0979:                JRFillCandlestickPlot fillCandlestickPlot = null;
0980:
0981:                if (candlestickPlot != null) {
0982:                    fillCandlestickPlot = (JRFillCandlestickPlot) get(candlestickPlot);
0983:                    if (fillCandlestickPlot == null) {
0984:                        fillCandlestickPlot = new JRFillCandlestickPlot(
0985:                                candlestickPlot, this );
0986:                    }
0987:                }
0988:
0989:                return fillCandlestickPlot;
0990:            }
0991:
0992:            public JRTimeSeriesPlot getTimeSeriesPlot(JRTimeSeriesPlot plot) {
0993:                JRFillTimeSeriesPlot fillPlot = null;
0994:                if (plot != null) {
0995:                    fillPlot = (JRFillTimeSeriesPlot) get(plot);
0996:                    if (fillPlot == null) {
0997:                        fillPlot = new JRFillTimeSeriesPlot(plot, this );
0998:                    }
0999:                }
1000:
1001:                return fillPlot;
1002:
1003:            }
1004:
1005:            /**
1006:             *
1007:             */
1008:            public JRValueDataset getValueDataset(JRValueDataset valueDataset) {
1009:                JRFillValueDataset fillValueDataset = null;
1010:
1011:                if (valueDataset != null) {
1012:                    fillValueDataset = (JRFillValueDataset) get(valueDataset);
1013:                    if (fillValueDataset == null) {
1014:                        fillValueDataset = new JRFillValueDataset(valueDataset,
1015:                                this );
1016:                        addChartDataset(fillValueDataset);
1017:                    }
1018:                }
1019:
1020:                return fillValueDataset;
1021:            }
1022:
1023:            /**
1024:             *
1025:             */
1026:            public JRMeterPlot getMeterPlot(JRMeterPlot meterPlot) {
1027:                JRFillMeterPlot fillMeterPlot = null;
1028:
1029:                if (meterPlot != null) {
1030:                    fillMeterPlot = (JRFillMeterPlot) get(meterPlot);
1031:                    if (fillMeterPlot == null) {
1032:                        fillMeterPlot = new JRFillMeterPlot(meterPlot, this );
1033:                    }
1034:                }
1035:
1036:                return fillMeterPlot;
1037:            }
1038:
1039:            /**
1040:             *
1041:             */
1042:            public JRThermometerPlot getThermometerPlot(
1043:                    JRThermometerPlot thermometerPlot) {
1044:                JRFillThermometerPlot fillThermometerPlot = null;
1045:
1046:                if (thermometerPlot != null) {
1047:                    fillThermometerPlot = (JRFillThermometerPlot) get(thermometerPlot);
1048:                    if (fillThermometerPlot == null) {
1049:                        fillThermometerPlot = new JRFillThermometerPlot(
1050:                                thermometerPlot, this );
1051:                    }
1052:                }
1053:
1054:                return fillThermometerPlot;
1055:            }
1056:
1057:            /**
1058:             *
1059:             */
1060:            public JRMultiAxisPlot getMultiAxisPlot(
1061:                    JRMultiAxisPlot multiAxisPlot) {
1062:                JRFillMultiAxisPlot fillMultiAxisPlot = null;
1063:
1064:                if (multiAxisPlot != null) {
1065:                    fillMultiAxisPlot = (JRFillMultiAxisPlot) get(multiAxisPlot);
1066:                    if (fillMultiAxisPlot == null) {
1067:                        fillMultiAxisPlot = new JRFillMultiAxisPlot(
1068:                                multiAxisPlot, this );
1069:                    }
1070:                }
1071:
1072:                return fillMultiAxisPlot;
1073:            }
1074:
1075:            protected JRFillSubreportReturnValue getSubreportReturnValue(
1076:                    JRSubreportReturnValue returnValue) {
1077:                JRFillSubreportReturnValue fillReturnValue = null;
1078:
1079:                if (returnValue != null) {
1080:                    fillReturnValue = (JRFillSubreportReturnValue) get(returnValue);
1081:                    if (fillReturnValue == null) {
1082:                        fillReturnValue = new JRFillSubreportReturnValue(
1083:                                returnValue, this , filler);
1084:                    }
1085:                }
1086:
1087:                return fillReturnValue;
1088:            }
1089:
1090:            public JRCrosstab getCrosstab(JRCrosstab crosstabElement) {
1091:                JRFillCrosstab fillCrosstab = null;
1092:
1093:                if (crosstabElement != null) {
1094:                    fillCrosstab = (JRFillCrosstab) get(crosstabElement);
1095:                    if (fillCrosstab == null) {
1096:                        fillCrosstab = new JRFillCrosstab(filler,
1097:                                crosstabElement, this );
1098:                    }
1099:                }
1100:
1101:                return fillCrosstab;
1102:            }
1103:
1104:            public JRFillCrosstab.JRFillCrosstabDataset getCrosstabDataset(
1105:                    JRCrosstabDataset dataset, JRFillCrosstab fillCrosstab) {
1106:                JRFillCrosstab.JRFillCrosstabDataset fillDataset = null;
1107:
1108:                if (dataset != null) {
1109:                    fillDataset = (JRFillCrosstab.JRFillCrosstabDataset) get(dataset);
1110:                    if (fillDataset == null) {
1111:                        fillDataset = fillCrosstab.new JRFillCrosstabDataset(
1112:                                dataset, this );
1113:                        addChartDataset(fillDataset);
1114:                    }
1115:                }
1116:
1117:                return fillDataset;
1118:            }
1119:
1120:            public JRFillDataset getDataset(JRDataset dataset) {
1121:                JRFillDataset fillDataset = null;
1122:
1123:                if (dataset != null) {
1124:                    fillDataset = (JRFillDataset) get(dataset);
1125:                    if (fillDataset == null) {
1126:                        fillDataset = new JRFillDataset(filler, dataset, this );
1127:                    }
1128:                }
1129:
1130:                return fillDataset;
1131:            }
1132:
1133:            private void addChartDataset(JRFillElementDataset elementDataset) {
1134:                List elementDatasetsList;
1135:                JRDatasetRun datasetRun = elementDataset.getDatasetRun();
1136:                if (datasetRun == null) {
1137:                    elementDatasetsList = elementDatasets;
1138:                } else {
1139:                    String datasetName = datasetRun.getDatasetName();
1140:                    elementDatasetsList = (List) elementDatasetMap
1141:                            .get(datasetName);
1142:                    if (elementDatasetsList == null) {
1143:                        elementDatasetsList = new ArrayList();
1144:                        elementDatasetMap.put(datasetName, elementDatasetsList);
1145:                    }
1146:                }
1147:                elementDatasetsList.add(elementDataset);
1148:            }
1149:
1150:            public JRFillDatasetRun getDatasetRun(JRDatasetRun datasetRun) {
1151:                JRFillDatasetRun fillDatasetRun = null;
1152:
1153:                if (datasetRun != null) {
1154:                    fillDatasetRun = (JRFillDatasetRun) get(datasetRun);
1155:                    if (fillDatasetRun == null) {
1156:                        fillDatasetRun = new JRFillDatasetRun(filler,
1157:                                datasetRun, this );
1158:                    }
1159:                }
1160:
1161:                return fillDatasetRun;
1162:            }
1163:
1164:            public JRFillCrosstabParameter getCrosstabParameter(
1165:                    JRCrosstabParameter parameter) {
1166:                JRFillCrosstabParameter fillParameter = null;
1167:
1168:                if (parameter != null) {
1169:                    fillParameter = (JRFillCrosstabParameter) get(parameter);
1170:                    if (fillParameter == null) {
1171:                        fillParameter = new JRFillCrosstabParameter(parameter,
1172:                                this );
1173:                    }
1174:                }
1175:
1176:                return fillParameter;
1177:            }
1178:
1179:            public JRFillCellContents getCell(JRCellContents cell) {
1180:                JRFillCellContents fillCell = null;
1181:
1182:                if (cell != null) {
1183:                    fillCell = (JRFillCellContents) get(cell);
1184:                    if (fillCell == null) {
1185:                        fillCell = new JRFillCellContents(filler, cell, this );
1186:                    }
1187:                }
1188:
1189:                return fillCell;
1190:            }
1191:
1192:            public JRFillCrosstabRowGroup getCrosstabRowGroup(
1193:                    JRCrosstabRowGroup group) {
1194:                JRFillCrosstabRowGroup fillGroup = null;
1195:
1196:                if (group != null) {
1197:                    fillGroup = (JRFillCrosstabRowGroup) get(group);
1198:                    if (fillGroup == null) {
1199:                        fillGroup = new JRFillCrosstabRowGroup(group, this );
1200:                    }
1201:                }
1202:
1203:                return fillGroup;
1204:            }
1205:
1206:            public JRFillCrosstabColumnGroup getCrosstabColumnGroup(
1207:                    JRCrosstabColumnGroup group) {
1208:                JRFillCrosstabColumnGroup fillGroup = null;
1209:
1210:                if (group != null) {
1211:                    fillGroup = (JRFillCrosstabColumnGroup) get(group);
1212:                    if (fillGroup == null) {
1213:                        fillGroup = new JRFillCrosstabColumnGroup(group, this );
1214:                    }
1215:                }
1216:
1217:                return fillGroup;
1218:            }
1219:
1220:            public JRFillCrosstabCell getCrosstabCell(JRCrosstabCell cell) {
1221:                JRFillCrosstabCell fillCell = null;
1222:
1223:                if (cell != null) {
1224:                    fillCell = (JRFillCrosstabCell) get(cell);
1225:                    if (fillCell == null) {
1226:                        fillCell = new JRFillCrosstabCell(cell, this );
1227:                    }
1228:                }
1229:
1230:                return fillCell;
1231:            }
1232:
1233:            public JRFillCrosstabMeasure getCrosstabMeasure(
1234:                    JRCrosstabMeasure measure) {
1235:                JRFillCrosstabMeasure fillMeasure = null;
1236:
1237:                if (measure != null) {
1238:                    fillMeasure = (JRFillCrosstabMeasure) get(measure);
1239:                    if (fillMeasure == null) {
1240:                        fillMeasure = new JRFillCrosstabMeasure(measure, this );
1241:                    }
1242:                }
1243:
1244:                return fillMeasure;
1245:            }
1246:
1247:            public JRFrame getFrame(JRFrame frame) {
1248:                JRFillFrame fillFrame = null;
1249:
1250:                if (frame != null) {
1251:                    fillFrame = (JRFillFrame) get(frame);
1252:                    if (fillFrame == null) {
1253:                        fillFrame = new JRFillFrame(filler, frame, this );
1254:                    }
1255:                }
1256:
1257:                return fillFrame;
1258:            }
1259:
1260:            protected JRBaseFiller getFiller() {
1261:                return filler;
1262:            }
1263:
1264:            /**
1265:             *
1266:             */
1267:            public JRConditionalStyle getConditionalStyle(
1268:                    JRConditionalStyle conditionalStyle, JRStyle style) {
1269:                JRBaseConditionalStyle baseConditionalStyle = null;
1270:                if (conditionalStyle != null) {
1271:                    baseConditionalStyle = (JRBaseConditionalStyle) get(conditionalStyle);
1272:                    if (baseConditionalStyle == null) {
1273:                        baseConditionalStyle = new JRBaseConditionalStyle(
1274:                                conditionalStyle, style, this );
1275:                        put(conditionalStyle, baseConditionalStyle);
1276:                    }
1277:                }
1278:                return baseConditionalStyle;
1279:            }
1280:
1281:            public JRExpression getExpression(JRExpression expression,
1282:                    boolean assignNotUsedId) {
1283:                return expression;
1284:            }
1285:
1286:            public JRChartAxis getChartAxis(JRChartAxis axis) {
1287:                JRFillChartAxis fillAxis = null;
1288:                if (axis != null) {
1289:                    fillAxis = (JRFillChartAxis) get(axis);
1290:                    if (fillAxis == null) {
1291:                        fillAxis = new JRFillChartAxis(axis, this );
1292:                    }
1293:                }
1294:                return fillAxis;
1295:            }
1296:
1297:            public JRFillReportTemplate getReportTemplate(
1298:                    JRReportTemplate template) {
1299:                JRFillReportTemplate fillTemplate = null;
1300:                if (template != null) {
1301:                    fillTemplate = (JRFillReportTemplate) get(template);
1302:                    if (fillTemplate == null) {
1303:                        fillTemplate = new JRFillReportTemplate(template,
1304:                                filler, this );
1305:                    }
1306:                }
1307:                return fillTemplate;
1308:            }
1309:
1310:            public List setStyles(List styles) {
1311:                originalStyleList = new HashSet(styles);
1312:
1313:                //filtering requested styles
1314:                Set requestedStyles = collectRequestedStyles(styles);
1315:
1316:                //collect used styles
1317:                Map usedStylesMap = new SequencedHashMap();
1318:                Map allStylesMap = new HashMap();
1319:                for (Iterator it = styles.iterator(); it.hasNext();) {
1320:                    JRStyle style = (JRStyle) it.next();
1321:                    if (requestedStyles.contains(style)) {
1322:                        collectUsedStyles(style, usedStylesMap, allStylesMap);
1323:                    }
1324:                    allStylesMap.put(style.getName(), style);
1325:                }
1326:
1327:                List includedStyles = new ArrayList();
1328:                for (Iterator it = usedStylesMap.keySet().iterator(); it
1329:                        .hasNext();) {
1330:                    JRStyle style = (JRStyle) it.next();
1331:                    JRStyle newStyle = getStyle(style);
1332:
1333:                    includedStyles.add(newStyle);
1334:                    if (requestedStyles.contains(style)) {
1335:                        useDelayedStyle(newStyle);
1336:                    }
1337:                }
1338:
1339:                checkUnresolvedReferences();
1340:
1341:                return includedStyles;
1342:            }
1343:
1344:            protected Set collectRequestedStyles(List externalStyles) {
1345:                Map requestedStylesMap = new HashMap();
1346:                for (Iterator it = externalStyles.iterator(); it.hasNext();) {
1347:                    JRStyle style = (JRStyle) it.next();
1348:                    String name = style.getName();
1349:                    if (delayedStyleSettersByName.containsKey(name)) {
1350:                        requestedStylesMap.put(name, style);
1351:                    }
1352:                }
1353:
1354:                return new HashSet(requestedStylesMap.values());
1355:            }
1356:
1357:            protected void collectUsedStyles(JRStyle style, Map usedStylesMap,
1358:                    Map allStylesMap) {
1359:                if (!usedStylesMap.containsKey(style)
1360:                        && originalStyleList.contains(style)) {
1361:                    JRStyle parent = style.getStyle();
1362:                    if (parent == null) {
1363:                        String parentName = style.getStyleNameReference();
1364:                        if (parentName != null) {
1365:                            parent = (JRStyle) allStylesMap.get(parentName);
1366:                            if (parent == null) {
1367:                                throw new JRRuntimeException("Style "
1368:                                        + parentName + " not found");
1369:                            }
1370:                        }
1371:                    }
1372:
1373:                    if (parent != null) {
1374:                        collectUsedStyles(parent, usedStylesMap, allStylesMap);
1375:                    }
1376:
1377:                    usedStylesMap.put(style, null);
1378:                }
1379:            }
1380:
1381:            protected void useDelayedStyle(JRStyle style) {
1382:                List delayedSetters = (List) delayedStyleSettersByName
1383:                        .remove(style.getName());
1384:                if (delayedSetters != null) {
1385:                    for (Iterator it = delayedSetters.iterator(); it.hasNext();) {
1386:                        JRStyleSetter setter = (JRStyleSetter) it.next();
1387:                        setter.setStyle(style);
1388:                    }
1389:                }
1390:            }
1391:
1392:            protected void checkUnresolvedReferences() {
1393:                if (!delayedStyleSettersByName.isEmpty()) {
1394:                    StringBuffer errorMsg = new StringBuffer(
1395:                            "Could not resolved style(s): ");
1396:                    for (Iterator it = delayedStyleSettersByName.keySet()
1397:                            .iterator(); it.hasNext();) {
1398:                        String name = (String) it.next();
1399:                        errorMsg.append(name);
1400:                        errorMsg.append(", ");
1401:                    }
1402:
1403:                    throw new JRRuntimeException(errorMsg.substring(0, errorMsg
1404:                            .length() - 2));
1405:                }
1406:            }
1407:
1408:            public JRDefaultStyleProvider getDefaultStyleProvider() {
1409:                return filler.getJasperPrint().getDefaultStyleProvider();
1410:            }
1411:
1412:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.