Source Code Cross Referenced for ReportDefinitionImpl.java in  » Report » pentaho-report » org » jfree » report » states » 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 » pentaho report » org.jfree.report.states 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * ===========================================
003:         * JFreeReport : a free Java reporting library
004:         * ===========================================
005:         *
006:         * Project Info:  http://reporting.pentaho.org/
007:         *
008:         * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
009:         *
010:         * This library is free software; you can redistribute it and/or modify it under the terms
011:         * of the GNU Lesser General Public License as published by the Free Software Foundation;
012:         * either 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, but WITHOUT ANY WARRANTY;
015:         * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
016:         * See the GNU Lesser General Public License for more details.
017:         *
018:         * You should have received a copy of the GNU Lesser General Public License along with this
019:         * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
020:         * Boston, MA 02111-1307, USA.
021:         *
022:         * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
023:         * in the United States and other countries.]
024:         *
025:         * ------------
026:         * ReportDefinitionImpl.java
027:         * ------------
028:         * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
029:         */package org.jfree.report.states;
030:
031:        import org.jfree.report.DataRow;
032:        import org.jfree.report.Group;
033:        import org.jfree.report.GroupList;
034:        import org.jfree.report.ItemBand;
035:        import org.jfree.report.NoDataBand;
036:        import org.jfree.report.PageDefinition;
037:        import org.jfree.report.PageFooter;
038:        import org.jfree.report.PageHeader;
039:        import org.jfree.report.ReportDefinition;
040:        import org.jfree.report.ReportFooter;
041:        import org.jfree.report.ReportHeader;
042:        import org.jfree.report.ReportProcessingException;
043:        import org.jfree.report.Watermark;
044:        import org.jfree.report.style.StyleSheetCollection;
045:        import org.jfree.report.util.ReportProperties;
046:
047:        /**
048:         * A report definition. This the working copy of the JFreeReport object. This object is
049:         * not serializable, as it is used internally. This implementation is not intended to be
050:         * known outside. Whatever you planned to do with it - dont do it!
051:         * <p/>
052:         * Its only pupose is to be used and manipulated in the report states, there is no reason
053:         * to do it outside.
054:         *
055:         * @author Thomas Morgner.
056:         */
057:        public class ReportDefinitionImpl implements  ReportDefinition {
058:            /**
059:             * An ordered list of report groups (each group defines its own header and footer).
060:             */
061:            private GroupList groups;
062:
063:            /**
064:             * The report header band (if not null, printed once at the start of the report).
065:             */
066:            private ReportHeader reportHeader;
067:
068:            /**
069:             * The report footer band (if not null, printed once at the end of the report).
070:             */
071:            private ReportFooter reportFooter;
072:
073:            /**
074:             * The page header band (if not null, printed at the start of every page).
075:             */
076:            private PageHeader pageHeader;
077:
078:            /**
079:             * The page footer band (if not null, printed at the end of every page).
080:             */
081:            private PageFooter pageFooter;
082:
083:            /**
084:             * The item band - used once for each row of data.
085:             */
086:            private ItemBand itemBand;
087:
088:            /**
089:             * The watermark acts a global page background.
090:             */
091:            private Watermark watermark;
092:
093:            /**
094:             * The watermark acts a global page background.
095:             */
096:            private NoDataBand noDataBand;
097:
098:            /**
099:             * Storage for arbitrary properties that a user can assign to the report.
100:             */
101:            private ReportProperties properties;
102:
103:            /**
104:             * The stylesheet collection of this report definition.
105:             */
106:            private StyleSheetCollection styleSheetCollection;
107:
108:            /**
109:             * The datarow connector used to feed all elements.
110:             */
111:            private DataRowConnector dataRowConnector;
112:
113:            /**
114:             * The page definition defines the output area.
115:             */
116:            private PageDefinition pageDefinition;
117:
118:            //  private Configuration configuration;
119:            //
120:            //  /**
121:            //   * The ResourceBundleFactory holds internationalization information.
122:            //   */
123:            //  private ResourceBundleFactory resourceBundleFactory;
124:            //  /**
125:            //   * The resource manager is used to load the report resources.
126:            //   */
127:            //  private transient ResourceManager resourceManager;
128:            //  /**
129:            //   * The base resource represents the resource that was used to create this
130:            //   * report.
131:            //   */
132:            //  private ResourceKey baseResource;
133:            //  /**
134:            //   * The content base is used to resolve relative URLs.
135:            //   */
136:            //  private ResourceKey contentBase;
137:
138:            private String query;
139:
140:            /**
141:             * Creates a report definition from a report object.
142:             *
143:             * @param report the report.
144:             * @throws ReportProcessingException if there is a problem cloning.
145:             */
146:            public ReportDefinitionImpl(final ReportDefinition report,
147:                    final PageDefinition pageDefinition)
148:                    throws ReportProcessingException {
149:                try {
150:                    this .groups = new UnmodifiableGroupList((GroupList) report
151:                            .getGroups().clone());
152:                    this .properties = (ReportProperties) report.getProperties()
153:                            .clone();
154:                    this .reportFooter = (ReportFooter) report.getReportFooter()
155:                            .clone();
156:                    this .reportHeader = (ReportHeader) report.getReportHeader()
157:                            .clone();
158:                    this .pageFooter = (PageFooter) report.getPageFooter()
159:                            .clone();
160:                    this .pageHeader = (PageHeader) report.getPageHeader()
161:                            .clone();
162:                    this .itemBand = (ItemBand) report.getItemBand().clone();
163:                    this .watermark = (Watermark) report.getWatermark().clone();
164:                    this .noDataBand = (NoDataBand) report.getNoDataBand()
165:                            .clone();
166:                    this .pageDefinition = pageDefinition;
167:                    this .styleSheetCollection = (StyleSheetCollection) report
168:                            .getStyleSheetCollection().clone();
169:                    this .dataRowConnector = new DataRowConnector();
170:                    this .query = report.getQuery();
171:                    //      this.configuration = configuration;
172:                    //      this.resourceBundleFactory = report.getResourceBundleFactory();
173:                    //      this.resourceBundleFactory = report.getResourceBundleFactory();
174:                    //      this.baseResource = report.getBaseResource();
175:                    //      this.contentBase = report.getContentBase();
176:                } catch (CloneNotSupportedException cne) {
177:                    throw new ReportProcessingException("Cloning failed");
178:                }
179:
180:                this .noDataBand.setReportDefinition(this );
181:                this .groups.setReportDefinition(this );
182:                this .reportHeader.setReportDefinition(this );
183:                this .reportFooter.setReportDefinition(this );
184:                this .pageHeader.setReportDefinition(this );
185:                this .pageFooter.setReportDefinition(this );
186:                this .itemBand.setReportDefinition(this );
187:                this .watermark.setReportDefinition(this );
188:            }
189:
190:            public String getQuery() {
191:                return query;
192:            }
193:
194:            /**
195:             * Returns the list of groups for the report.
196:             *
197:             * @return The list of groups.
198:             */
199:            public GroupList getGroups() {
200:                return groups;
201:            }
202:
203:            //  public Configuration getConfiguration()
204:            //  {
205:            //    return configuration;
206:            //  }
207:            //
208:            /**
209:             * Returns the report header.
210:             *
211:             * @return The report header.
212:             */
213:            public ReportHeader getReportHeader() {
214:                return reportHeader;
215:            }
216:
217:            /**
218:             * Returns the report footer.
219:             *
220:             * @return The report footer.
221:             */
222:            public ReportFooter getReportFooter() {
223:                return reportFooter;
224:            }
225:
226:            /**
227:             * Returns the page header.
228:             *
229:             * @return The page header.
230:             */
231:            public PageHeader getPageHeader() {
232:                return pageHeader;
233:            }
234:
235:            /**
236:             * Returns the page footer.
237:             *
238:             * @return The page footer.
239:             */
240:            public PageFooter getPageFooter() {
241:                return pageFooter;
242:            }
243:
244:            /**
245:             * Returns the item band.
246:             *
247:             * @return The item band.
248:             */
249:            public ItemBand getItemBand() {
250:                return itemBand;
251:            }
252:
253:            /**
254:             * Returns the "no-data" band, which is displayed if there is no data
255:             * available.
256:             *
257:             * @return The no-data band.
258:             */
259:            public NoDataBand getNoDataBand() {
260:                return noDataBand;
261:            }
262:
263:            /**
264:             * Returns the report properties.
265:             *
266:             * @return The report properties.
267:             */
268:            public ReportProperties getProperties() {
269:                return properties;
270:            }
271:
272:            /**
273:             * Returns the number of groups in this report. <P> Every report has at least one group
274:             * defined.
275:             *
276:             * @return the group count.
277:             */
278:            public int getGroupCount() {
279:                return groups.size();
280:            }
281:
282:            /**
283:             * Returns the group at the specified index or null, if there is no such group.
284:             *
285:             * @param count the group index.
286:             * @return the requested group.
287:             *
288:             * @throws IllegalArgumentException  if the count is negative.
289:             * @throws IndexOutOfBoundsException if the count is greater than the number of defined
290:             *                                   groups.
291:             */
292:            public Group getGroup(final int count) {
293:                if (count < 0) {
294:                    throw new IllegalArgumentException(
295:                            "GroupCount must not be negative");
296:                }
297:
298:                if (count >= groups.size()) {
299:                    throw new IndexOutOfBoundsException(
300:                            "No such group defined. " + count + " vs. "
301:                                    + groups.size());
302:                }
303:
304:                return groups.get(count);
305:            }
306:
307:            /**
308:             * Creates and returns a copy of this object.
309:             *
310:             * @return a clone of this instance.
311:             *
312:             * @throws CloneNotSupportedException if the object's class does not support the
313:             *                                    <code>Cloneable</code> interface. Subclasses that
314:             *                                    override the <code>clone</code> method can also
315:             *                                    throw this exception to indicate that an instance
316:             *                                    cannot be cloned.
317:             * @see java.lang.Cloneable
318:             */
319:            public Object clone() throws CloneNotSupportedException {
320:                final ReportDefinitionImpl report = (ReportDefinitionImpl) super 
321:                        .clone();
322:                report.groups = (GroupList) groups.clone();
323:                report.itemBand = (ItemBand) itemBand.clone();
324:                report.pageFooter = (PageFooter) pageFooter.clone();
325:                report.pageHeader = (PageHeader) pageHeader.clone();
326:                report.properties = (ReportProperties) properties.clone();
327:                report.reportFooter = (ReportFooter) reportFooter.clone();
328:                report.reportHeader = (ReportHeader) reportHeader.clone();
329:                report.watermark = (Watermark) watermark.clone();
330:                report.noDataBand = (NoDataBand) noDataBand.clone();
331:                // pagedefinition is not! cloned ...
332:                report.pageDefinition = pageDefinition;
333:                report.styleSheetCollection = (StyleSheetCollection) styleSheetCollection
334:                        .clone();
335:                report.dataRowConnector = new DataRowConnector();
336:
337:                report.noDataBand.setReportDefinition(report);
338:                report.groups.setReportDefinition(report);
339:                report.reportHeader.setReportDefinition(report);
340:                report.reportFooter.setReportDefinition(report);
341:                report.pageHeader.setReportDefinition(report);
342:                report.pageFooter.setReportDefinition(report);
343:                report.itemBand.setReportDefinition(report);
344:                report.watermark.setReportDefinition(report);
345:                return report;
346:            }
347:
348:            /**
349:             * Returns the stylesheet collection of this report definition. The stylesheet
350:             * collection is fixed for the report definition and all elements of the report. When a
351:             * band or group is added to the report it will get registered with this stylesheet
352:             * collection and cannot be used in an different report.
353:             *
354:             * @return the stylesheet collection of the report, never null.
355:             */
356:            public StyleSheetCollection getStyleSheetCollection() {
357:                return styleSheetCollection;
358:            }
359:
360:            /**
361:             * Returns the datarow connector used to feed all elements. This instance is not the one
362:             * used to feed the functions, so elements will always show the old values and never an
363:             * preview.
364:             *
365:             * @return the datarow connector.
366:             */
367:            public DataRowConnector getDataRowConnector() {
368:                return dataRowConnector;
369:            }
370:
371:            public Watermark getWatermark() {
372:                return watermark;
373:            }
374:
375:            public DataRow getDataRow() {
376:                return dataRowConnector;
377:            }
378:
379:            public PageDefinition getPageDefinition() {
380:                return pageDefinition;
381:            }
382:
383:            //  public ResourceBundleFactory getResourceBundleFactory ()
384:            //  {
385:            //    return resourceBundleFactory;
386:            //  }
387:            //
388:            //  public ResourceBundle getResourceBundle (final String identifier)
389:            //  {
390:            //    return getResourceBundleFactory().getResourceBundle(identifier);
391:            //  }
392:            //
393:            //  /**
394:            //   * Returns the resource manager that was responsible for loading the report.
395:            //   * This method will return a default manager if the report had been
396:            //   * constructed otherwise.
397:            //   * <p/>
398:            //   * The resource manager of the report should be used for all resource loading
399:            //   * activities during the report processing.
400:            //   *
401:            //   * @return the resource manager, never null.
402:            //   */
403:            //  public ResourceManager getResourceManager()
404:            //  {
405:            //    if (resourceManager == null)
406:            //    {
407:            //      resourceManager = new ResourceManager();
408:            //      resourceManager.registerDefaults();
409:            //    }
410:            //    return resourceManager;
411:            //  }
412:            //
413:            //  /**
414:            //   * Assigns a new resource manager or clears the current one. If no resource
415:            //   * manager is set anymore, the next call to 'getResourceManager' will recreate
416:            //   * one.
417:            //   *
418:            //   * @param resourceManager the new resource manager or null.
419:            //   */
420:            //  public void setResourceManager(final ResourceManager resourceManager)
421:            //  {
422:            //    this.resourceManager = resourceManager;
423:            //  }
424:            //
425:            //  /**
426:            //   * Returns the base resource for all resource loading activities. The base
427:            //   * resource represents the file that was used to load the report and can be
428:            //   * null, if the report has not been loaded through a ResourceLoader.
429:            //   *
430:            //   * @return the base resource.
431:            //   */
432:            //  public ResourceKey getBaseResource()
433:            //  {
434:            //    return baseResource;
435:            //  }
436:            //
437:            //  /**
438:            //   * Redefines the base resource key.
439:            //   *
440:            //   * @param baseResource the new base resource key or null.
441:            //   */
442:            //  public void setBaseResource(final ResourceKey baseResource)
443:            //  {
444:            //    this.baseResource = baseResource;
445:            //  }
446:            //
447:            //
448:            //  /**
449:            //   * Defines the content base for the report. The content base will be used to
450:            //   * resolve relative URLs during the report generation and resource loading. If
451:            //   * there is no content base defined, it will be impossible to resolve relative
452:            //   * paths.
453:            //   *
454:            //   * @param key the content base or null.
455:            //   */
456:            //  public void setContentBase(final ResourceKey key)
457:            //  {
458:            //    this.contentBase = key;
459:            //  }
460:            //
461:            //  /**
462:            //   * Returns the content base of this report. The content base is used to
463:            //   * resolve relative URLs during the report generation and resource loading. If
464:            //   * there is no content base defined, it will be impossible to resolve relative
465:            //   * paths.
466:            //   *
467:            //   * @return the content base or null, if no content base is defined.
468:            //   */
469:            //  public ResourceKey getContentBase()
470:            //  {
471:            //    return contentBase;
472:            //  }
473:
474:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.