Source Code Cross Referenced for JRBaseReport.java in  » Report » jasperreports-2.0.1 » net » sf » jasperreports » engine » base » 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.base 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * ============================================================================
003:         * GNU Lesser General Public License
004:         * ============================================================================
005:         *
006:         * JasperReports - Free Java report-generating library.
007:         * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com
008:         *
009:         * This library is free software; you can redistribute it and/or
010:         * modify it under the terms of the GNU Lesser General Public
011:         * License as published by the Free Software Foundation; either
012:         * version 2.1 of the License, or (at your option) any later version.
013:         *
014:         * This library is distributed in the hope that it will be useful,
015:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
016:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
017:         * Lesser General Public License for more details.
018:         *
019:         * You should have received a copy of the GNU Lesser General Public
020:         * License along with this library; if not, write to the Free Software
021:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
022:         *
023:         * JasperSoft Corporation
024:         * 303 Second Street, Suite 450 North
025:         * San Francisco, CA 94107
026:         * http://www.jaspersoft.com
027:         */
028:        package net.sf.jasperreports.engine.base;
029:
030:        import java.io.Serializable;
031:        import java.util.Arrays;
032:        import java.util.HashSet;
033:        import java.util.Set;
034:
035:        import net.sf.jasperreports.engine.JRBand;
036:        import net.sf.jasperreports.engine.JRConstants;
037:        import net.sf.jasperreports.engine.JRDataset;
038:        import net.sf.jasperreports.engine.JRExpressionCollector;
039:        import net.sf.jasperreports.engine.JRField;
040:        import net.sf.jasperreports.engine.JRGroup;
041:        import net.sf.jasperreports.engine.JRParameter;
042:        import net.sf.jasperreports.engine.JRPropertiesMap;
043:        import net.sf.jasperreports.engine.JRQuery;
044:        import net.sf.jasperreports.engine.JRReport;
045:        import net.sf.jasperreports.engine.JRReportFont;
046:        import net.sf.jasperreports.engine.JRReportTemplate;
047:        import net.sf.jasperreports.engine.JRSortField;
048:        import net.sf.jasperreports.engine.JRStyle;
049:        import net.sf.jasperreports.engine.JRVariable;
050:
051:        /**
052:         * @author Teodor Danciu (teodord@users.sourceforge.net)
053:         * @version $Id: JRBaseReport.java 1795 2007-07-30 09:18:47Z teodord $
054:         */
055:        public class JRBaseReport implements  JRReport, Serializable {
056:
057:            /**
058:             *
059:             */
060:            private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID;
061:
062:            /**
063:             *
064:             */
065:            protected String name = null;
066:            protected String language = LANGUAGE_JAVA;
067:            protected int columnCount = 1;
068:            protected byte printOrder = PRINT_ORDER_VERTICAL;
069:            protected int pageWidth = 595;
070:            protected int pageHeight = 842;
071:            protected byte orientation = ORIENTATION_PORTRAIT;
072:            protected byte whenNoDataType = WHEN_NO_DATA_TYPE_NO_PAGES;
073:            protected int columnWidth = 555;
074:            protected int columnSpacing = 0;
075:            protected int leftMargin = 20;
076:            protected int rightMargin = 20;
077:            protected int topMargin = 30;
078:            protected int bottomMargin = 30;
079:            protected boolean isTitleNewPage = false;
080:            protected boolean isSummaryNewPage = false;
081:            protected boolean isFloatColumnFooter = false;
082:            protected boolean ignorePagination = false;
083:
084:            /**
085:             *
086:             */
087:            protected String formatFactoryClass = null;
088:
089:            /**
090:             *
091:             */
092:            protected Set importsSet = null;
093:
094:            /**
095:             * Report templates.
096:             */
097:            protected JRReportTemplate[] templates;
098:
099:            protected JRReportFont defaultFont = null;
100:            protected JRReportFont[] fonts = null;
101:            protected JRStyle defaultStyle = null;
102:            protected JRStyle[] styles = null;
103:
104:            /**
105:             * The main dataset of the report.
106:             */
107:            protected JRDataset mainDataset;
108:
109:            /**
110:             * Sub datasets of the report.
111:             */
112:            protected JRDataset[] datasets;
113:
114:            protected JRBand background = null;
115:            protected JRBand title = null;
116:            protected JRBand pageHeader = null;
117:            protected JRBand columnHeader = null;
118:            protected JRBand detail = null;
119:            protected JRBand columnFooter = null;
120:            protected JRBand pageFooter = null;
121:            protected JRBand lastPageFooter = null;
122:            protected JRBand summary = null;
123:            protected JRBand noData = null;
124:
125:            /**
126:             *
127:             */
128:            public JRBaseReport() {
129:            }
130:
131:            /**
132:             * Constructs a copy of a report.
133:             *
134:             * @param report the original report
135:             * @param expressionCollector expression collector used to provide new expression IDs
136:             */
137:            public JRBaseReport(JRReport report,
138:                    JRExpressionCollector expressionCollector) {
139:                /*   */
140:                name = report.getName();
141:                language = report.getLanguage();
142:                columnCount = report.getColumnCount();
143:                printOrder = report.getPrintOrder();
144:                pageWidth = report.getPageWidth();
145:                pageHeight = report.getPageHeight();
146:                orientation = report.getOrientation();
147:                whenNoDataType = report.getWhenNoDataType();
148:                columnWidth = report.getColumnWidth();
149:                columnSpacing = report.getColumnSpacing();
150:                leftMargin = report.getLeftMargin();
151:                rightMargin = report.getRightMargin();
152:                topMargin = report.getTopMargin();
153:                bottomMargin = report.getBottomMargin();
154:                isTitleNewPage = report.isTitleNewPage();
155:                isSummaryNewPage = report.isSummaryNewPage();
156:                isFloatColumnFooter = report.isFloatColumnFooter();
157:                ignorePagination = report.isIgnorePagination();
158:
159:                formatFactoryClass = report.getFormatFactoryClass();
160:
161:                /*   */
162:                String[] imports = report.getImports();
163:                if (imports != null && imports.length > 0) {
164:                    importsSet = new HashSet(imports.length);
165:                    importsSet.addAll(Arrays.asList(imports));
166:                }
167:
168:                /*   */
169:                JRBaseObjectFactory factory = new JRBaseObjectFactory(this ,
170:                        expressionCollector);
171:
172:                copyTemplates(report, factory);
173:
174:                /*   */
175:                defaultFont = factory.getReportFont(report.getDefaultFont());
176:
177:                /*   */
178:                JRReportFont[] jrFonts = report.getFonts();
179:                if (jrFonts != null && jrFonts.length > 0) {
180:                    fonts = new JRReportFont[jrFonts.length];
181:                    for (int i = 0; i < fonts.length; i++) {
182:                        fonts[i] = factory.getReportFont(jrFonts[i]);
183:                    }
184:                }
185:
186:                /*   */
187:                defaultStyle = factory.getStyle(report.getDefaultStyle());
188:
189:                /*   */
190:                JRStyle[] jrStyles = report.getStyles();
191:                if (jrStyles != null && jrStyles.length > 0) {
192:                    styles = new JRStyle[jrStyles.length];
193:                    for (int i = 0; i < styles.length; i++) {
194:                        styles[i] = factory.getStyle(jrStyles[i]);
195:                    }
196:                }
197:
198:                mainDataset = factory.getDataset(report.getMainDataset());
199:
200:                JRDataset[] datasetArray = report.getDatasets();
201:                if (datasetArray != null && datasetArray.length > 0) {
202:                    datasets = new JRDataset[datasetArray.length];
203:                    for (int i = 0; i < datasets.length; i++) {
204:                        datasets[i] = factory.getDataset(datasetArray[i]);
205:                    }
206:                }
207:
208:                background = factory.getBand(report.getBackground());
209:                title = factory.getBand(report.getTitle());
210:                pageHeader = factory.getBand(report.getPageHeader());
211:                columnHeader = factory.getBand(report.getColumnHeader());
212:                detail = factory.getBand(report.getDetail());
213:                columnFooter = factory.getBand(report.getColumnFooter());
214:                pageFooter = factory.getBand(report.getPageFooter());
215:                lastPageFooter = factory.getBand(report.getLastPageFooter());
216:                summary = factory.getBand(report.getSummary());
217:                noData = factory.getBand(report.getNoData());
218:            }
219:
220:            protected void copyTemplates(JRReport report,
221:                    JRBaseObjectFactory factory) {
222:                JRReportTemplate[] reportTemplates = report.getTemplates();
223:                if (reportTemplates == null || reportTemplates.length == 0) {
224:                    templates = null;
225:                } else {
226:                    templates = new JRReportTemplate[reportTemplates.length];
227:                    for (int i = 0; i < reportTemplates.length; i++) {
228:                        templates[i] = factory
229:                                .getReportTemplate(reportTemplates[i]);
230:                    }
231:                }
232:            }
233:
234:            public JRBaseReport(JRReport report) {
235:                this (report, null);
236:            }
237:
238:            /**
239:             *
240:             */
241:            public String getName() {
242:                return name;
243:            }
244:
245:            /**
246:             *
247:             */
248:            public String getLanguage() {
249:                return language;
250:            }
251:
252:            /**
253:             *
254:             */
255:            public int getColumnCount() {
256:                return columnCount;
257:            }
258:
259:            /**
260:             *
261:             */
262:            public byte getPrintOrder() {
263:                return printOrder;
264:            }
265:
266:            /**
267:             *
268:             */
269:            public int getPageWidth() {
270:                return pageWidth;
271:            }
272:
273:            /**
274:             *
275:             */
276:            public int getPageHeight() {
277:                return pageHeight;
278:            }
279:
280:            /**
281:             *
282:             */
283:            public byte getOrientation() {
284:                return orientation;
285:            }
286:
287:            /**
288:             *
289:             */
290:            public byte getWhenNoDataType() {
291:                return whenNoDataType;
292:            }
293:
294:            /**
295:             *
296:             */
297:            public void setWhenNoDataType(byte whenNoDataType) {
298:                this .whenNoDataType = whenNoDataType;
299:            }
300:
301:            /**
302:             *
303:             */
304:            public int getColumnWidth() {
305:                return columnWidth;
306:            }
307:
308:            /**
309:             *
310:             */
311:            public int getColumnSpacing() {
312:                return columnSpacing;
313:            }
314:
315:            /**
316:             *
317:             */
318:            public int getLeftMargin() {
319:                return leftMargin;
320:            }
321:
322:            /**
323:             *
324:             */
325:            public int getRightMargin() {
326:                return rightMargin;
327:            }
328:
329:            /**
330:             *
331:             */
332:            public int getTopMargin() {
333:                return topMargin;
334:            }
335:
336:            /**
337:             *
338:             */
339:            public int getBottomMargin() {
340:                return bottomMargin;
341:            }
342:
343:            /**
344:             *
345:             */
346:            public boolean isTitleNewPage() {
347:                return isTitleNewPage;
348:            }
349:
350:            /**
351:             *
352:             */
353:            public boolean isSummaryNewPage() {
354:                return isSummaryNewPage;
355:            }
356:
357:            /**
358:             *
359:             */
360:            public boolean isFloatColumnFooter() {
361:                return isFloatColumnFooter;
362:            }
363:
364:            /**
365:             *
366:             */
367:            public String getScriptletClass() {
368:                return mainDataset.getScriptletClass();
369:            }
370:
371:            /**
372:             *
373:             */
374:            public String getFormatFactoryClass() {
375:                return formatFactoryClass;
376:            }
377:
378:            /**
379:             *
380:             */
381:            public String getResourceBundle() {
382:                return mainDataset.getResourceBundle();
383:            }
384:
385:            /**
386:             *
387:             */
388:            public String[] getPropertyNames() {
389:                return mainDataset.getPropertiesMap().getPropertyNames();
390:            }
391:
392:            /**
393:             *
394:             */
395:            public String getProperty(String propName) {
396:                return mainDataset.getPropertiesMap().getProperty(propName);
397:            }
398:
399:            /**
400:             *
401:             */
402:            public void setProperty(String propName, String value) {
403:                mainDataset.getPropertiesMap().setProperty(propName, value);
404:            }
405:
406:            /**
407:             *
408:             */
409:            public void removeProperty(String propName) {
410:                mainDataset.getPropertiesMap().removeProperty(propName);
411:            }
412:
413:            /**
414:             *
415:             */
416:            public String[] getImports() {
417:                if (importsSet != null) {
418:                    return (String[]) importsSet.toArray(new String[importsSet
419:                            .size()]);
420:                }
421:                return null;
422:            }
423:
424:            /**
425:             * @deprecated
426:             */
427:            public JRReportFont getDefaultFont() {
428:                return defaultFont;
429:            }
430:
431:            /**
432:             * @deprecated
433:             */
434:            public JRReportFont[] getFonts() {
435:                return fonts;
436:            }
437:
438:            /**
439:             *
440:             */
441:            public JRStyle getDefaultStyle() {
442:                return defaultStyle;
443:            }
444:
445:            /**
446:             *
447:             */
448:            public JRStyle[] getStyles() {
449:                return styles;
450:            }
451:
452:            /**
453:             * Gets an array of report parameters (including built-in ones).
454:             */
455:            public JRParameter[] getParameters() {
456:                return mainDataset.getParameters();
457:            }
458:
459:            /**
460:             *
461:             */
462:            public JRQuery getQuery() {
463:                return mainDataset.getQuery();
464:            }
465:
466:            /**
467:             *  Gets an array of report fields.
468:             */
469:            public JRField[] getFields() {
470:                return mainDataset.getFields();
471:            }
472:
473:            /**
474:             *  Gets an array of sort report fields.
475:             */
476:            public JRSortField[] getSortFields() {
477:                return mainDataset.getSortFields();
478:            }
479:
480:            /**
481:             * Gets an array of report variables.
482:             */
483:            public JRVariable[] getVariables() {
484:                return mainDataset.getVariables();
485:            }
486:
487:            /**
488:             *
489:             */
490:            public JRGroup[] getGroups() {
491:                return mainDataset.getGroups();
492:            }
493:
494:            /**
495:             *
496:             */
497:            public JRBand getBackground() {
498:                return background;
499:            }
500:
501:            /**
502:             *
503:             */
504:            public JRBand getTitle() {
505:                return title;
506:            }
507:
508:            /**
509:             *
510:             */
511:            public JRBand getPageHeader() {
512:                return pageHeader;
513:            }
514:
515:            /**
516:             *
517:             */
518:            public JRBand getColumnHeader() {
519:                return columnHeader;
520:            }
521:
522:            /**
523:             *
524:             */
525:            public JRBand getDetail() {
526:                return detail;
527:            }
528:
529:            /**
530:             *
531:             */
532:            public JRBand getColumnFooter() {
533:                return columnFooter;
534:            }
535:
536:            /**
537:             *
538:             */
539:            public JRBand getPageFooter() {
540:                return pageFooter;
541:            }
542:
543:            /**
544:             *
545:             */
546:            public JRBand getLastPageFooter() {
547:                return lastPageFooter;
548:            }
549:
550:            /**
551:             *
552:             */
553:            public JRBand getSummary() {
554:                return summary;
555:            }
556:
557:            /**
558:             *
559:             */
560:            public byte getWhenResourceMissingType() {
561:                return mainDataset.getWhenResourceMissingType();
562:            }
563:
564:            /**
565:             *
566:             */
567:            public void setWhenResourceMissingType(byte whenResourceMissingType) {
568:                mainDataset.setWhenResourceMissingType(whenResourceMissingType);
569:            }
570:
571:            public JRDataset getMainDataset() {
572:                return mainDataset;
573:            }
574:
575:            public JRDataset[] getDatasets() {
576:                return datasets;
577:            }
578:
579:            public boolean isIgnorePagination() {
580:                return ignorePagination;
581:            }
582:
583:            public JRPropertiesMap getPropertiesMap() {
584:                return mainDataset.getPropertiesMap();
585:            }
586:
587:            public JRReportTemplate[] getTemplates() {
588:                return templates;
589:            }
590:
591:            /**
592:             * @return the noData
593:             */
594:            public JRBand getNoData() {
595:                return noData;
596:            }
597:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.