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


001:        /*
002:         * Copyright 2006 Pentaho Corporation.  All rights reserved. 
003:         * This software was developed by Pentaho Corporation and is provided under the terms 
004:         * of the Mozilla Public License, Version 1.1, or any later version. You may not use 
005:         * this file except in compliance with the license. If you need a copy of the license, 
006:         * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho 
007:         * BI Platform.  The Initial Developer is Pentaho Corporation.
008:         *
009:         * Software distributed under the Mozilla Public License is distributed on an "AS IS" 
010:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or  implied. Please refer to 
011:         * the license for the specific language governing your rights and limitations.
012:         *
013:         * @created Feb 01, 2006
014:         * @author Michael D'Amour
015:         */
016:        package org.pentaho.jfreereport.wizard;
017:
018:        import java.util.LinkedList;
019:        import java.util.List;
020:        import org.pentaho.jfreereport.wizard.ui.IWizardListener;
021:        import org.pentaho.jfreereport.wizard.ui.WizardPanel;
022:
023:        public class WizardManager {
024:            /**
025:             * 
026:             */
027:            List eventListenerList = new LinkedList();
028:
029:            /**
030:             * 
031:             */
032:            protected List steps = new LinkedList();
033:
034:            /**
035:             * 
036:             */
037:            protected WizardPanel currentStep = null;
038:
039:            /**
040:             * 
041:             */
042:            protected WizardPanel previousStep = null;
043:
044:            /**
045:             * 
046:             * 
047:             * @param l
048:             */
049:            public void addWizardListener(IWizardListener l) {
050:                eventListenerList.add(l);
051:            }
052:
053:            /**
054:             * 
055:             * 
056:             * @param l
057:             */
058:            public void removeWizardListener(IWizardListener l) {
059:                eventListenerList.remove(l);
060:            }
061:
062:            /**
063:             * 
064:             */
065:            public void removeAllWizardListeners() {
066:                eventListenerList.clear();
067:            }
068:
069:            /**
070:             * 
071:             * 
072:             * @return $objectType$
073:             */
074:            public boolean isContinueAllowed() {
075:                if ((currentStep == null) || (steps == null)
076:                        || !currentStep.isNextAllowed()) {
077:                    return false;
078:                }
079:                // we must check all steps leading up to this step
080:                boolean nextAllowed = true;
081:                for (int i = 0; nextAllowed
082:                        && (i <= steps.indexOf(currentStep)); i++) {
083:                    WizardPanel step = (WizardPanel) steps.get(i);
084:                    nextAllowed = step.isContinueAllowed();
085:                }
086:                return nextAllowed;
087:            }
088:
089:            /**
090:             * 
091:             * 
092:             * @return $objectType$
093:             */
094:            public boolean isNextAllowed() {
095:                boolean continueAllowed = isContinueAllowed();
096:                if (continueAllowed
097:                        && (currentStep == steps.get(steps.size() - 1))) {
098:                    continueAllowed = false;
099:                }
100:                return continueAllowed;
101:            }
102:
103:            /**
104:             * 
105:             * 
106:             * @return $objectType$
107:             */
108:            public boolean isFinishAllowed() {
109:                boolean finishAllowed = true;
110:                for (int i = 0; (i < steps.size()) && finishAllowed; i++) {
111:                    WizardPanel p = (WizardPanel) steps.get(i);
112:                    finishAllowed = p.isContinueAllowed();
113:                }
114:                return finishAllowed;
115:            }
116:
117:            /**
118:             * 
119:             * 
120:             * @return $objectType$
121:             */
122:            public boolean isBackAllowed() {
123:                if ((currentStep == null) || (steps == null)
124:                        || (currentStep == steps.get(0))
125:                        || !currentStep.isBackAllowed()) {
126:                    return false;
127:                }
128:                return true;
129:            }
130:
131:            /**
132:             * 
133:             * 
134:             * @return $objectType$
135:             */
136:            public boolean next() {
137:                System.out.println("currentStep nextFired begin: "
138:                        + currentStep.getClass().getName());
139:                boolean status = currentStep.nextFired(currentStep);
140:                System.out.println("currentStep nextFired end: "
141:                        + currentStep.getClass().getName());
142:                if (status) {
143:                    previousStep = currentStep;
144:                    currentStep = (WizardPanel) steps.get(steps
145:                            .indexOf(currentStep) + 1);
146:                    List delayedEventList = new LinkedList();
147:                    for (int i = 0; i < eventListenerList.size(); i++) {
148:                        IWizardListener l = (IWizardListener) eventListenerList
149:                                .get(i);
150:                        if (previousStep == l) {
151:                            continue;
152:                        } else if (l instanceof  WizardPanel) {
153:                            l.nextFired(previousStep);
154:                        } else {
155:                            delayedEventList.add(l);
156:                        }
157:                    }
158:                    for (int i = 0; i < delayedEventList.size(); i++) {
159:                        IWizardListener l = (IWizardListener) delayedEventList
160:                                .get(i);
161:                        l.nextFired(previousStep);
162:                    }
163:                    previousStep.stateChanged = false;
164:                }
165:                return status;
166:            }
167:
168:            /**
169:             * 
170:             * 
171:             * @return $objectType$
172:             */
173:            public boolean back() {
174:                currentStep.backFired(currentStep);
175:                previousStep = currentStep;
176:                currentStep = (WizardPanel) steps.get(steps
177:                        .indexOf(currentStep) - 1);
178:                List delayedEventList = new LinkedList();
179:                for (int i = 0; i < eventListenerList.size(); i++) {
180:                    IWizardListener l = (IWizardListener) eventListenerList
181:                            .get(i);
182:                    if (previousStep == l) {
183:                        continue;
184:                    } else if (l instanceof  WizardPanel) {
185:                        l.backFired(previousStep);
186:                    } else {
187:                        delayedEventList.add(l);
188:                    }
189:                }
190:                for (int i = 0; i < delayedEventList.size(); i++) {
191:                    IWizardListener l = (IWizardListener) delayedEventList
192:                            .get(i);
193:                    l.backFired(previousStep);
194:                }
195:                return true;
196:            }
197:
198:            public boolean publish() {
199:                currentStep.finishFired(currentStep);
200:                List delayedEventList = new LinkedList();
201:                for (int i = 0; i < eventListenerList.size(); i++) {
202:                    IWizardListener l = (IWizardListener) eventListenerList
203:                            .get(i);
204:                    if (previousStep == l) {
205:                        continue;
206:                    } else if (l instanceof  WizardPanel) {
207:                        l.publishFired(currentStep);
208:                    } else {
209:                        delayedEventList.add(l);
210:                    }
211:                }
212:                for (int i = 0; i < delayedEventList.size(); i++) {
213:                    IWizardListener l = (IWizardListener) delayedEventList
214:                            .get(i);
215:                    l.publishFired(currentStep);
216:                }
217:                currentStep.stateChanged = false;
218:                return true;
219:            }
220:
221:            /**
222:             * 
223:             * 
224:             * @return $objectType$
225:             */
226:            public boolean finish() {
227:                currentStep.finishFired(currentStep);
228:                List delayedEventList = new LinkedList();
229:                for (int i = 0; i < eventListenerList.size(); i++) {
230:                    IWizardListener l = (IWizardListener) eventListenerList
231:                            .get(i);
232:                    if (previousStep == l) {
233:                        continue;
234:                    } else if (l instanceof  WizardPanel) {
235:                        l.finishFired(currentStep);
236:                    } else {
237:                        delayedEventList.add(l);
238:                    }
239:                }
240:                for (int i = 0; i < delayedEventList.size(); i++) {
241:                    IWizardListener l = (IWizardListener) delayedEventList
242:                            .get(i);
243:                    l.finishFired(currentStep);
244:                }
245:                currentStep.stateChanged = false;
246:                return true;
247:            }
248:
249:            public boolean preview() {
250:                boolean status = currentStep.previewFired(currentStep);
251:                List delayedEventList = new LinkedList();
252:                for (int i = 0; status && i < eventListenerList.size(); i++) {
253:                    IWizardListener l = (IWizardListener) eventListenerList
254:                            .get(i);
255:                    if (previousStep == l) {
256:                        continue;
257:                    } else if (l instanceof  WizardPanel && l != currentStep) {
258:                        status = l.previewFired(currentStep);
259:                    } else {
260:                        delayedEventList.add(l);
261:                    }
262:                }
263:                for (int i = 0; status && i < delayedEventList.size(); i++) {
264:                    IWizardListener l = (IWizardListener) delayedEventList
265:                            .get(i);
266:                    status = l.previewFired(currentStep);
267:                }
268:                currentStep.stateChanged = false;
269:                return status;
270:            }
271:
272:            /**
273:             * 
274:             * 
275:             * @return $objectType$
276:             */
277:            public boolean cancel() {
278:                // any cleanup?
279:                boolean status = currentStep.cancelFired(currentStep);
280:                if (status) {
281:                    List delayedEventList = new LinkedList();
282:                    for (int i = 0; i < eventListenerList.size(); i++) {
283:                        IWizardListener l = (IWizardListener) eventListenerList
284:                                .get(i);
285:                        if (previousStep == l) {
286:                            continue;
287:                        } else if (l instanceof  WizardPanel) {
288:                            status = l.cancelFired(currentStep);
289:                        } else {
290:                            delayedEventList.add(l);
291:                        }
292:                    }
293:                    for (int i = 0; i < delayedEventList.size() && status; i++) {
294:                        IWizardListener l = (IWizardListener) delayedEventList
295:                                .get(i);
296:                        status = l.cancelFired(currentStep);
297:                    }
298:                }
299:                return status;
300:            }
301:
302:            /**
303:             * DOCUMENT ME!
304:             * 
305:             * @return Returns the currentStep.
306:             */
307:            public WizardPanel getCurrentStep() {
308:                return currentStep;
309:            }
310:
311:            /**
312:             * 
313:             * 
314:             * @param step
315:             */
316:            public void setCurrentStep(WizardPanel step) {
317:                currentStep = step;
318:            }
319:
320:            /**
321:             * 
322:             * 
323:             * @param steps
324:             */
325:            public void setSteps(List steps) {
326:                this .steps = steps;
327:            }
328:
329:            /**
330:             * 
331:             * 
332:             * @param step
333:             */
334:            public void addStep(WizardPanel step) {
335:                steps.add(step);
336:            }
337:
338:            /**
339:             * 
340:             */
341:            public void update() {
342:                for (int i = 0; i < steps.size(); i++) {
343:                    WizardPanel p = (WizardPanel) steps.get(i);
344:                    p.updateState();
345:                }
346:            }
347:
348:            /**
349:             * DOCUMENT ME!
350:             * 
351:             * @return Returns the previousStep.
352:             */
353:            public WizardPanel getPreviousStep() {
354:                return previousStep;
355:            }
356:
357:            /**
358:             * DOCUMENT ME!
359:             * 
360:             * @param previousStep
361:             *          The previousStep to set.
362:             */
363:            public void setPreviousStep(WizardPanel previousStep) {
364:                this .previousStep = previousStep;
365:            }
366:
367:            /**
368:             * 
369:             * 
370:             * @return $objectType$
371:             */
372:            public List getSteps() {
373:                return steps;
374:            }
375:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.