Source Code Cross Referenced for SubReport.java in  » Report » pentaho-report » org » jfree » report » 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 
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:         * SubReport.java
027:         * ------------
028:         * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
029:         */package org.jfree.report;
030:
031:        import java.util.HashMap;
032:        import java.util.Map;
033:
034:        /**
035:         * A subreport element. A subreport can be attached to a root-level band and will be printed afterwards. Subreports have
036:         * their own tablemodel (queried with the sub-reports's defined query and the master report's data-factory).
037:         * <p/>
038:         * A sub-report that has been added to a root-level band will always be printed below the root-level band.
039:         * <p/>
040:         * Sub-reports can have import and export parameters. The parameter mapping can be defined freely, so a subreport is not
041:         * required to use the same column names as the parent report.
042:         * <p/>
043:         * If a global import or export is defined (by adding the parameter mapping "*" => "*") the other defined parameter
044:         * mappings will be ignored.
045:         *
046:         * @author Thomas Morgner
047:         */
048:        public class SubReport extends AbstractReportDefinition {
049:            /**
050:             * A mapping of export parameters.
051:             */
052:            private HashMap exportParameters;
053:            /**
054:             * A mapping of import parameters.
055:             */
056:            private HashMap inputParameters;
057:
058:            /**
059:             * Creates a new subreport instance.
060:             */
061:            public SubReport() {
062:                exportParameters = new HashMap();
063:                inputParameters = new HashMap();
064:            }
065:
066:            /**
067:             * Returns the page definition assigned to the report definition. The page definition defines the report area and how
068:             * the report is subdivided by the child pages.
069:             *
070:             * @return null, as subreports have no page-definition at all.
071:             */
072:            public PageDefinition getPageDefinition() {
073:                return null;
074:            }
075:
076:            /**
077:             * Clones the report.
078:             *
079:             * @return the clone.
080:             * @throws CloneNotSupportedException this should never happen.
081:             */
082:            public Object clone() throws CloneNotSupportedException {
083:                final SubReport o = (SubReport) super .clone();
084:                o.exportParameters = (HashMap) exportParameters.clone();
085:                o.inputParameters = (HashMap) inputParameters.clone();
086:                return o;
087:            }
088:
089:            /**
090:             * Adds an export-parameter mapping to the subreport. The parameter specified by 'sourceColumn' will be made available
091:             * with the name 'outerName' in the parent report.
092:             *
093:             * @param outerName    the name the parameter will get in the master report.
094:             * @param sourceColumn the source-column in the sub-report.
095:             */
096:            public void addExportParameter(final String outerName,
097:                    final String sourceColumn) {
098:                if (outerName == null) {
099:                    throw new NullPointerException();
100:                }
101:                if (sourceColumn == null) {
102:                    throw new NullPointerException();
103:                }
104:                exportParameters.put(outerName, sourceColumn);
105:            }
106:
107:            /**
108:             * Removes the export parameter from the mapping.
109:             *
110:             * @param outerName the name of the parameter as it is known in the master report.
111:             */
112:            public void removeExportParameter(final String outerName) {
113:                if (outerName == null) {
114:                    throw new NullPointerException();
115:                }
116:                exportParameters.remove(outerName);
117:            }
118:
119:            /**
120:             * Returns the parameter mappings for the subreport. The parameter mappings define how columns of the sub-report get
121:             * mapped into the master report.
122:             *
123:             * @return the parameter mappings array.
124:             */
125:            public ParameterMapping[] getExportMappings() {
126:                final int length = exportParameters.size();
127:                final Map.Entry[] inputEntries = (Map.Entry[]) exportParameters
128:                        .entrySet().toArray(new Map.Entry[length]);
129:                final ParameterMapping[] mapping = new ParameterMapping[length];
130:
131:                for (int i = 0; i < length; i++) {
132:                    final Map.Entry entry = inputEntries[i];
133:                    final String name = (String) entry.getKey();
134:                    final String alias = (String) entry.getValue();
135:                    mapping[i] = new ParameterMapping(name, alias);
136:                }
137:                return mapping;
138:            }
139:
140:            /**
141:             * Adds an input-parameter mapping to the subreport. Input parameters define how columns that exist in the parent
142:             * report get mapped into the subreport.
143:             * <p/>
144:             * Input parameter mapping happens only once, so after the report has been started, changes to the parameters will not
145:             * pass through to the subreport.
146:             *
147:             * @param outerName    the name of the parent report's column that provides the data.
148:             * @param sourceColumn the name under which the parameter will be available in the subreport.
149:             */
150:            public void addInputParameter(final String outerName,
151:                    final String sourceColumn) {
152:                inputParameters.put(sourceColumn, outerName);
153:            }
154:
155:            /**
156:             * Removes the input parameter from the parameter mapping.
157:             *
158:             * @param sourceColumn the name of the column of the subreport report that acts as source for the input parameter.
159:             */
160:            public void removeInputParameter(final String sourceColumn) {
161:                inputParameters.remove(sourceColumn);
162:            }
163:
164:            /**
165:             * Returns the input mappings defined for this subreport.
166:             *
167:             * @return the input mappings, never null.
168:             */
169:            public ParameterMapping[] getInputMappings() {
170:                final int length = inputParameters.size();
171:                final Map.Entry[] inputEntries = (Map.Entry[]) inputParameters
172:                        .entrySet().toArray(new Map.Entry[length]);
173:                final ParameterMapping[] mapping = new ParameterMapping[length];
174:
175:                for (int i = 0; i < length; i++) {
176:                    final Map.Entry entry = inputEntries[i];
177:                    final String alias = (String) entry.getKey();
178:                    final String name = (String) entry.getValue();
179:                    mapping[i] = new ParameterMapping(name, alias);
180:                }
181:                return mapping;
182:            }
183:
184:            /**
185:             * Checks, whether a global import is defined. A global import effectly overrides all other imports.
186:             *
187:             * @return true, if there is a global import defined, false otherwise.
188:             */
189:            public boolean isGlobalImport() {
190:                return "*".equals(inputParameters.get("*"));
191:            }
192:
193:            /**
194:             * Checks, whether a global export is defined. A global export effectly overrides all other export mappings.
195:             *
196:             * @return true, if there is a global export defined, false otherwise.
197:             */
198:            public boolean isGlobalExport() {
199:                return "*".equals(exportParameters.get("*"));
200:            }
201:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.