Source Code Cross Referenced for JRFillContext.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) 


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.fill;
029:
030:        import java.util.HashMap;
031:        import java.util.Locale;
032:        import java.util.Map;
033:        import java.util.TimeZone;
034:
035:        import net.sf.jasperreports.engine.JRException;
036:        import net.sf.jasperreports.engine.JRPrintImage;
037:        import net.sf.jasperreports.engine.JRPrintPage;
038:        import net.sf.jasperreports.engine.JRTemplate;
039:        import net.sf.jasperreports.engine.JasperReport;
040:        import net.sf.jasperreports.engine.query.JRQueryExecuter;
041:        import net.sf.jasperreports.engine.util.FormatFactory;
042:
043:        /**
044:         * Context class shared by all the fillers involved in a report (master and subfillers).
045:         * <p>
046:         * The context is created by the master filler and inherited by the subfillers.
047:         * 
048:         * @author Lucian Chirita (lucianc@users.sourceforge.net)
049:         * @version $Id: JRFillContext.java 1759 2007-06-20 16:47:34Z lucianc $
050:         * @see net.sf.jasperreports.engine.fill.JRBaseFiller
051:         */
052:        public class JRFillContext {
053:            private Map loadedImages;
054:            private Map loadedSubreports;
055:            private Map loadedTemplates;
056:            private boolean usingVirtualizer = false;
057:            private boolean perPageBoundElements = false;
058:            private JRPrintPage printPage = null;
059:            private boolean ignorePagination = false;
060:            private JRQueryExecuter queryExecuter;
061:
062:            private JRVirtualizationContext virtualizationContext;
063:
064:            private FormatFactory masterFormatFactory;
065:            private Locale masterLocale;
066:            private TimeZone masterTimeZone;
067:
068:            /**
069:             * Constructs a fill context.
070:             */
071:            public JRFillContext() {
072:                loadedImages = new HashMap();
073:                loadedSubreports = new HashMap();
074:                loadedTemplates = new HashMap();
075:            }
076:
077:            /**
078:             * Checks whether an image given by source has already been loaded and cached.
079:             * 
080:             * @param source the source of the image
081:             * @return whether the image has been cached
082:             * @see #getLoadedImage(Object)
083:             * @see #registerLoadedImage(Object, JRPrintImage)
084:             */
085:            public boolean hasLoadedImage(Object source) {
086:                return loadedImages.containsKey(source);
087:            }
088:
089:            /**
090:             * Gets a cached image.
091:             * 
092:             * @param source the source of the image
093:             * @return the cached image
094:             * @see #registerLoadedImage(Object, JRPrintImage)
095:             */
096:            public JRPrintImage getLoadedImage(Object source) {
097:                return (JRPrintImage) loadedImages.get(source);
098:            }
099:
100:            /**
101:             * Registers an image loaded from a source.
102:             * <p>
103:             * The image is cached for further use.
104:             * 
105:             * @param source the source that was used to load the image
106:             * @param image the loaded image
107:             * @see #getLoadedImage(Object)
108:             */
109:            public void registerLoadedImage(Object source, JRPrintImage image) {
110:                loadedImages.put(source, image);
111:                if (usingVirtualizer) {
112:                    virtualizationContext.cacheRenderer(image);
113:                }
114:            }
115:
116:            /**
117:             * Checks whether a subreport given by source has already been loaded and cached.
118:             * 
119:             * @param source the source of the subreport
120:             * @return whether the subreport has been cached
121:             * @see #getLoadedSubreport(Object)
122:             * @see #registerLoadedSubreport(Object, JasperReport)
123:             */
124:            public boolean hasLoadedSubreport(Object source) {
125:                return loadedSubreports.containsKey(source);
126:            }
127:
128:            /**
129:             * Gets a cached subreport.
130:             * 
131:             * @param source the source of the subreport
132:             * @return the cached subreport
133:             * @see #registerLoadedSubreport(Object, JasperReport)
134:             */
135:            public JasperReport getLoadedSubreport(Object source) {
136:                return (JasperReport) loadedSubreports.get(source);
137:            }
138:
139:            /**
140:             * Registers a subreport loaded from a source.
141:             * <p>
142:             * The subreport is cached for further use.
143:             * 
144:             * @param source the source that was used to load the subreport
145:             * @param subreport the loaded subreport
146:             * @see #getLoadedSubreport(Object)
147:             */
148:            public void registerLoadedSubreport(Object source,
149:                    JasperReport subreport) {
150:                loadedSubreports.put(source, subreport);
151:            }
152:
153:            /**
154:             * Sets the flag indicating whether a virtualizer is used by the filling process.
155:             * 
156:             * @param usingVirtualizer whether virtualization is used
157:             * @see #isUsingVirtualizer()
158:             */
159:            public void setUsingVirtualizer(boolean usingVirtualizer) {
160:                this .usingVirtualizer = usingVirtualizer;
161:                if (usingVirtualizer && virtualizationContext == null) {
162:                    virtualizationContext = new JRVirtualizationContext();
163:                }
164:            }
165:
166:            /**
167:             * Decides whether virtualization is used by the filling process.
168:             * 
169:             * @return <code>true</code> iff a virtualizer is used
170:             * @see #setUsingVirtualizer(boolean)
171:             * @see net.sf.jasperreports.engine.JRParameter#REPORT_VIRTUALIZER
172:             */
173:            public boolean isUsingVirtualizer() {
174:                return usingVirtualizer;
175:            }
176:
177:            /**
178:             * Sets the flag indicating whether fillers should keep per page bound
179:             * element maps.
180:             * 
181:             * @param perPageBoundElements the value of the flag
182:             * @see #isPerPageBoundElements()
183:             */
184:            public void setPerPageBoundElements(boolean perPageBoundElements) {
185:                this .perPageBoundElements = perPageBoundElements;
186:            }
187:
188:            /**
189:             * Decides whether fillers should keep per page bound element maps.
190:             * 
191:             * @return <code>true</code> iff fillers should keep per page bound element maps
192:             * @see #setPerPageBoundElements(boolean)
193:             */
194:            public boolean isPerPageBoundElements() {
195:                return perPageBoundElements;
196:            }
197:
198:            /**
199:             * Sets the current master print page.
200:             * 
201:             * @param page the master print page
202:             * @see #getPrintPage()
203:             */
204:            public void setPrintPage(JRPrintPage page) {
205:                printPage = page;
206:            }
207:
208:            /**
209:             * Returns the current master print page.
210:             *  
211:             * @return the current master print page
212:             * @see #setPrintPage(JRPrintPage)
213:             */
214:            public JRPrintPage getPrintPage() {
215:                return printPage;
216:            }
217:
218:            /**
219:             * Sets the flag that decides whether pagination should be ignored during filling.
220:             * 
221:             * @param ignorePagination
222:             * @see #isIgnorePagination()
223:             */
224:            public void setIgnorePagination(boolean ignorePagination) {
225:                this .ignorePagination = ignorePagination;
226:            }
227:
228:            /**
229:             * Decides whether the filling should ignore pagination.
230:             *  
231:             * @return whether the filling should ignore pagination
232:             * @see #setIgnorePagination(boolean)
233:             * @see net.sf.jasperreports.engine.JRParameter#IS_IGNORE_PAGINATION
234:             */
235:            public boolean isIgnorePagination() {
236:                return ignorePagination;
237:            }
238:
239:            /**
240:             * Sets the running query executer.
241:             * <p>
242:             * This method is called before firing the query.
243:             * 
244:             * @param queryExecuter the running query executer
245:             */
246:            public synchronized void setRunningQueryExecuter(
247:                    JRQueryExecuter queryExecuter) {
248:                this .queryExecuter = queryExecuter;
249:            }
250:
251:            /**
252:             * Clears the running query executer.
253:             * <p>
254:             * This method is called after the query has ended.
255:             *
256:             */
257:            public synchronized void clearRunningQueryExecuter() {
258:                this .queryExecuter = null;
259:            }
260:
261:            /**
262:             * Cancels the running query.
263:             * 
264:             * @return <code>true</code> iff there is a running query and it has been cancelled.
265:             * @throws JRException
266:             */
267:            public synchronized boolean cancelRunningQuery() throws JRException {
268:                if (queryExecuter != null) {
269:                    return queryExecuter.cancelQuery();
270:                }
271:
272:                return false;
273:            }
274:
275:            /**
276:             * Ensures that the master page is available when virtualization is used.
277:             */
278:            public void ensureMasterPageAvailable() {
279:                if (usingVirtualizer) {
280:                    printPage.getElements();
281:                }
282:            }
283:
284:            /**
285:             * Returns the virtualization context.
286:             * 
287:             * @return the virtualization context
288:             */
289:            public JRVirtualizationContext getVirtualizationContext() {
290:                return virtualizationContext;
291:            }
292:
293:            public FormatFactory getMasterFormatFactory() {
294:                return masterFormatFactory;
295:            }
296:
297:            public void setMasterFormatFactory(FormatFactory masterFormatFactory) {
298:                this .masterFormatFactory = masterFormatFactory;
299:            }
300:
301:            public Locale getMasterLocale() {
302:                return masterLocale;
303:            }
304:
305:            public void setMasterLocale(Locale masterLocale) {
306:                this .masterLocale = masterLocale;
307:            }
308:
309:            public TimeZone getMasterTimeZone() {
310:                return masterTimeZone;
311:            }
312:
313:            public void setMasterTimeZone(TimeZone masterTimeZone) {
314:                this .masterTimeZone = masterTimeZone;
315:            }
316:
317:            /**
318:             * Checks whether a template given by source has already been loaded and cached.
319:             * 
320:             * @param source the source of the template
321:             * @return whether the template has been cached
322:             * @see #getLoadedTemplate(Object)
323:             * @see #registerLoadedTemplate(Object, JRTemplate)
324:             */
325:            public boolean hasLoadedTemplate(Object source) {
326:                return loadedTemplates.containsKey(source);
327:            }
328:
329:            /**
330:             * Gets a cached template.
331:             * 
332:             * @param source the source of the templage
333:             * @return the cached templage
334:             * @see #registerLoadedTemplate(Object, JRTemplate)
335:             */
336:            public JRTemplate getLoadedTemplate(Object source) {
337:                return (JRTemplate) loadedTemplates.get(source);
338:            }
339:
340:            /**
341:             * Registers a template loaded from a source.
342:             * <p>
343:             * The template is cached for further use.
344:             * 
345:             * @param source the source that was used to load the template
346:             * @param template the loaded templage
347:             * @see #getLoadedTemplate(Object)
348:             */
349:            public void registerLoadedTemplate(Object source,
350:                    JRTemplate template) {
351:                loadedTemplates.put(source, template);
352:            }
353:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.