Source Code Cross Referenced for EventMonitorFunction.java in  » Report » pentaho-report » org » jfree » report » function » 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.function 
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:         * EventMonitorFunction.java
027:         * ------------
028:         * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
029:         */package org.jfree.report.function;
030:
031:        import org.jfree.report.event.PageEventListener;
032:        import org.jfree.report.event.ReportEvent;
033:        import org.jfree.util.Log;
034:
035:        /**
036:         * A function that logs each event that it receives.  This function can be used for debugging purposes.
037:         *
038:         * @author Thomas Morgner
039:         */
040:        public class EventMonitorFunction extends AbstractFunction implements 
041:                PageEventListener {
042:            /**
043:             * Counts the number of times the reportStarted(...) method is called.
044:             */
045:            private transient int reportStartCount = 0;
046:            /**
047:             * A flag indicating whether this expression will receive events from subreports.
048:             */
049:            private boolean deepTraversing;
050:
051:            /**
052:             * Creates a new function.
053:             */
054:            public EventMonitorFunction() {
055:            }
056:
057:            /**
058:             * Creates a new function.
059:             *
060:             * @param name the name of the function
061:             */
062:            public EventMonitorFunction(final String name) {
063:                setName(name);
064:            }
065:
066:            /**
067:             * Receives notification that the report has started.
068:             *
069:             * @param event the event.
070:             */
071:            public void reportStarted(final ReportEvent event) {
072:                Log
073:                        .info("Report Started: Level = "
074:                                + event.getState().getLevel()
075:                                + " ItemCount: "
076:                                + event.getState().getCurrentDataItem()
077:                                + " Prepare Run: "
078:                                + event.getState().isPrepareRun()
079:                                + " Deep-Event "
080:                                + ((event.getType() & ReportEvent.DEEP_TRAVERSING_EVENT) != 0));
081:                reportStartCount++;
082:                Log.info("Report Started Count: " + reportStartCount);
083:            }
084:
085:            /**
086:             * Receives notification that the report has finished.
087:             *
088:             * @param event the event.
089:             */
090:            public void reportFinished(final ReportEvent event) {
091:                Log
092:                        .info("Report Finished: Level = "
093:                                + event.getState().getLevel()
094:                                + " ItemCount: "
095:                                + event.getState().getCurrentDataItem()
096:                                + " Prepare Run: "
097:                                + event.getState().isPrepareRun()
098:                                + " Deep-Event "
099:                                + ((event.getType() & ReportEvent.DEEP_TRAVERSING_EVENT) != 0));
100:            }
101:
102:            /**
103:             * Receives notification that report generation has completed, the report footer was printed, no more output is done.
104:             * This is a helper event to shut down the output service.
105:             *
106:             * @param event The event.
107:             */
108:            public void reportDone(final ReportEvent event) {
109:                Log
110:                        .info("Report Done: Level = "
111:                                + event.getState().getLevel()
112:                                + " ItemCount: "
113:                                + event.getState().getCurrentDataItem()
114:                                + " Prepare Run: "
115:                                + event.getState().isPrepareRun()
116:                                + " Deep-Event "
117:                                + ((event.getType() & ReportEvent.DEEP_TRAVERSING_EVENT) != 0));
118:
119:            }
120:
121:            /**
122:             * Receives notification that a page has started.
123:             *
124:             * @param event the event.
125:             */
126:            public void pageStarted(final ReportEvent event) {
127:                Log
128:                        .info("Page Started: Level = "
129:                                + event.getState().getLevel()
130:                                + " ItemCount: "
131:                                + event.getState().getCurrentDataItem()
132:                                + " Prepare Run: "
133:                                + event.getState().isPrepareRun()
134:                                + " Deep-Event "
135:                                + ((event.getType() & ReportEvent.DEEP_TRAVERSING_EVENT) != 0));
136:                Log.info("Page Started: " + event.getState().getCurrentPage());
137:            }
138:
139:            /**
140:             * Receives notification that a page has ended.
141:             *
142:             * @param event the event.
143:             */
144:            public void pageFinished(final ReportEvent event) {
145:                Log
146:                        .info("Page Finished: Level = "
147:                                + event.getState().getLevel()
148:                                + " ItemCount: "
149:                                + event.getState().getCurrentDataItem()
150:                                + " Prepare Run: "
151:                                + event.getState().isPrepareRun()
152:                                + " Deep-Event "
153:                                + ((event.getType() & ReportEvent.DEEP_TRAVERSING_EVENT) != 0));
154:                Log.info("Page Finished: " + event.getState().getCurrentPage());
155:            }
156:
157:            /**
158:             * Receives notification that a group has started.
159:             *
160:             * @param event the event.
161:             */
162:            public void groupStarted(final ReportEvent event) {
163:                Log
164:                        .info("Group Started: Level = "
165:                                + event.getState().getLevel()
166:                                + " ItemCount: "
167:                                + event.getState().getCurrentDataItem()
168:                                + " Prepare Run: "
169:                                + event.getState().isPrepareRun()
170:                                + " Deep-Event "
171:                                + ((event.getType() & ReportEvent.DEEP_TRAVERSING_EVENT) != 0));
172:                Log.info("Group Started: "
173:                        + event.getState().getCurrentGroupIndex());
174:            }
175:
176:            /**
177:             * Receives notification that a group has finished.
178:             *
179:             * @param event the event.
180:             */
181:            public void groupFinished(final ReportEvent event) {
182:                Log
183:                        .info("Group Finished: Level = "
184:                                + event.getState().getLevel()
185:                                + " ItemCount: "
186:                                + event.getState().getCurrentDataItem()
187:                                + " Prepare Run: "
188:                                + event.getState().isPrepareRun()
189:                                + " Deep-Event "
190:                                + ((event.getType() & ReportEvent.DEEP_TRAVERSING_EVENT) != 0));
191:                Log.info("Group Finished: "
192:                        + event.getState().getCurrentGroupIndex());
193:            }
194:
195:            /**
196:             * Receives notification that a row of data is being processed.
197:             *
198:             * @param event the event.
199:             */
200:            public void itemsAdvanced(final ReportEvent event) {
201:                Log
202:                        .info("Items Advanced: Level = "
203:                                + event.getState().getLevel()
204:                                + " ItemCount: "
205:                                + event.getState().getCurrentDataItem()
206:                                + " Prepare Run: "
207:                                + event.getState().isPrepareRun()
208:                                + " Deep-Event "
209:                                + ((event.getType() & ReportEvent.DEEP_TRAVERSING_EVENT) != 0));
210:            }
211:
212:            /**
213:             * Receives notification that a group of item bands is about to be processed.
214:             *
215:             * @param event the event.
216:             */
217:            public void itemsStarted(final ReportEvent event) {
218:                Log
219:                        .info("Items Started: Level = "
220:                                + event.getState().getLevel()
221:                                + " ItemCount: "
222:                                + event.getState().getCurrentDataItem()
223:                                + " Prepare Run: "
224:                                + event.getState().isPrepareRun()
225:                                + " Deep-Event "
226:                                + ((event.getType() & ReportEvent.DEEP_TRAVERSING_EVENT) != 0));
227:            }
228:
229:            /**
230:             * Receives notification that a group of item bands has been completed.
231:             *
232:             * @param event the event.
233:             */
234:            public void itemsFinished(final ReportEvent event) {
235:                Log
236:                        .info("Items Finished: Level = "
237:                                + event.getState().getLevel()
238:                                + " ItemCount: "
239:                                + event.getState().getCurrentDataItem()
240:                                + " Prepare Run: "
241:                                + event.getState().isPrepareRun()
242:                                + " Deep-Event "
243:                                + ((event.getType() & ReportEvent.DEEP_TRAVERSING_EVENT) != 0));
244:            }
245:
246:            /**
247:             * Receives notification that report generation initializes the current run. <P> The event carries a
248:             * ReportState.Started state.  Use this to initialize the report.
249:             *
250:             * @param event The event.
251:             */
252:            public void reportInitialized(final ReportEvent event) {
253:                Log
254:                        .info("Report Initialized: Level = "
255:                                + event.getState().getLevel()
256:                                + " ItemCount: "
257:                                + event.getState().getCurrentDataItem()
258:                                + " Prepare Run: "
259:                                + event.getState().isPrepareRun()
260:                                + " Deep-Event "
261:                                + ((event.getType() & ReportEvent.DEEP_TRAVERSING_EVENT) != 0));
262:            }
263:
264:            /**
265:             * Returns <code>null</code> since this function is for generating log messages only.
266:             *
267:             * @return the value of the function (<code>null</code>).
268:             */
269:            public Object getValue() {
270:                return null;
271:            }
272:
273:            /**
274:             * Returns whether this expression will receive events from subreports.
275:             *
276:             * @return true, if the function is deep-traversing, false otherwise.
277:             */
278:            public boolean isDeepTraversing() {
279:                return deepTraversing;
280:            }
281:
282:            /**
283:             * Defines, whether this expression will receive events from subreports.
284:             *
285:             * @param deepTraversing true, if the function is deep-traversing, false otherwise.
286:             */
287:            public void setDeepTraversing(final boolean deepTraversing) {
288:                this.deepTraversing = deepTraversing;
289:            }
290:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.