Source Code Cross Referenced for Initiators.java in  » Ajax » zk » org » zkoss » jsp » zul » impl » 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 » Ajax » zk » org.zkoss.jsp.zul.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Initiators.java
002:
003:        {{IS_NOTE
004:        	Purpose:
005:        		
006:        	Description:
007:        		
008:        	History:
009:        		Wed August 08 14:27:47     2007, Created by Ian Tsai
010:        }}IS_NOTE
011:
012:        Copyright (C) 2007 Potix Corporation. All Rights Reserved.
013:
014:        {{IS_RIGHT
015:        	This program is distributed under GPL Version 2.0 in the hope that
016:        	it will be useful, but WITHOUT ANY WARRANTY.
017:        }}IS_RIGHT
018:         */
019:        package org.zkoss.jsp.zul.impl;
020:
021:        import java.util.Iterator;
022:        import java.util.LinkedList;
023:        import java.util.List;
024:
025:        import org.zkoss.util.logging.Log;
026:        import org.zkoss.zk.ui.Page;
027:        import org.zkoss.zk.ui.UiException;
028:        import org.zkoss.zk.ui.util.Initiator;
029:
030:        /**
031:         *  A helper class used to handle {@link Initiator} in jsp.
032:         * 
033:         * @author Ian Tsai
034:         *
035:         */
036:        public class Initiators {
037:            static final Log log = Log.lookup(Initiators.class);
038:            private final List _inits = new LinkedList();
039:
040:            /**
041:             * Add new initiator and it's args into this handler. 
042:             * @param init the initiator
043:             * @param args the args
044:             */
045:            public void addInitiator(Initiator init, List args) {
046:                _inits.add(new Object[] { init, args });
047:            }
048:
049:            /** Invokes {@link Initiator#doInit}, if any, and returns
050:             * an instance of{@link Initiators}.
051:             */
052:            public void doInit(Page page) {
053:                Object[] objArr;
054:                Initiator initiator;
055:                List args;
056:                for (Iterator it = _inits.iterator(); it.hasNext();) {
057:                    objArr = (Object[]) it.next();
058:                    initiator = (Initiator) objArr[0];
059:                    args = (List) objArr[1];
060:                    try {
061:                        initiator.doInit(page, args.toArray());
062:                    } catch (Throwable ex) {
063:                        throw UiException.Aide.wrap(ex);
064:                    }
065:                }
066:            }
067:
068:            /**
069:             * 
070:             * @param page
071:             * @throws Exception
072:             */
073:            public void doAfterCompose(Page page) throws Exception {
074:                for (Iterator it = _inits.iterator(); it.hasNext();) {
075:                    ((Initiator) ((Object[]) it.next())[0])
076:                            .doAfterCompose(page);
077:                }
078:            }
079:
080:            /** Invokes {@link Initiator#doCatch}.
081:             * It eats all exception without throwing one (but logging).
082:             * Caller has to re-throw the exception.
083:             */
084:            public void doCatch(Throwable t) {
085:                for (Iterator it = _inits.iterator(); it.hasNext();) {
086:                    final Initiator init = ((Initiator) ((Object[]) it.next())[0]);
087:                    try {
088:                        init.doCatch(t);
089:                    } catch (Throwable ex) {
090:                        log.error(ex);
091:                    }
092:                }
093:            }
094:
095:            /** Invokes {@link Initiator#doFinally}.
096:             */
097:            public void doFinally() {
098:                Throwable t = null;
099:                for (Iterator it = _inits.iterator(); it.hasNext();) {
100:                    final Initiator init = ((Initiator) ((Object[]) it.next())[0]);
101:                    try {
102:                        init.doFinally();
103:                    } catch (Throwable ex) {
104:                        log.error(ex);
105:                        if (t == null)
106:                            t = ex;
107:                    }
108:                }
109:                if (t != null)
110:                    throw UiException.Aide.wrap(t);
111:            }
112:
113:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.