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


001:        /* AuResponse.java
002:
003:        {{IS_NOTE
004:        	Purpose:
005:        		
006:        	Description:
007:        		
008:        	History:
009:        		Tue May 31 11:35:49     2005, Created by tomyeh
010:        }}IS_NOTE
011:
012:        Copyright (C) 2005 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.zk.au;
020:
021:        import java.util.Map;
022:        import java.util.HashMap;
023:
024:        import org.zkoss.zk.ui.Component;
025:        import org.zkoss.zk.ui.Page;
026:
027:        /**
028:         * A response sent from the server to the client via
029:         * {@link org.zkoss.zk.ui.sys.UiEngine}.
030:         *
031:         * <p>Application developers rarely need access this class and its derived
032:         * directly.
033:         * Rather, use {@link org.zkoss.zk.ui.util.Clients} instead.
034:         * If you prefer to use the derives directly, you can use them with
035:         * {@link org.zkoss.zk.ui.Execution#addAuResponse}.
036:         *
037:         * @author tomyeh
038:         */
039:        public class AuResponse {
040:            protected String _cmd;
041:            private final Object _depends;
042:            protected String[] _data;
043:
044:            /** Constructs a component-independent response.
045:             */
046:            protected AuResponse(String cmd) {
047:                this (cmd, (Component) null, (String[]) null);
048:            }
049:
050:            /** Constructs a component-independent response.
051:             */
052:            protected AuResponse(String cmd, String data) {
053:                this (cmd, (Component) null, data);
054:            }
055:
056:            /** Constructs a component-independent response.
057:             */
058:            protected AuResponse(String cmd, String[] data) {
059:                this (cmd, (Component) null, data);
060:            }
061:
062:            /** Constructs a response with one or zero data.
063:             *
064:             * @param depends specifies whether this response depends on whether
065:             * the depends component.
066:             * If depends is not null, this response shall be purged if the depends
067:             * component is removed.
068:             * If null, this response is called component-independent, and
069:             * always sent to the client.
070:             *
071:             * <p>Note: info of the depends component doesn't send to the client.
072:             * It is used only to optimize what responses to send.
073:             *
074:             * @param data specifies the data to be sent. If null, no data at all.
075:             */
076:            protected AuResponse(String cmd, Component depends, String data) {
077:                this (cmd, depends, data != null ? new String[] { data } : null);
078:            }
079:
080:            /** Constructs a response with multiple data.
081:             */
082:            protected AuResponse(String cmd, Component depends, String[] data) {
083:                if (cmd == null || cmd.length() == 0)
084:                    throw new IllegalArgumentException("cmd");
085:                _cmd = cmd;
086:                _depends = depends;
087:                _data = data;
088:            }
089:
090:            /** Constructs a response with multiple data.
091:             */
092:            protected AuResponse(String cmd, Page depends, String data) {
093:                this (cmd, depends, data != null ? new String[] { data } : null);
094:            }
095:
096:            /** Constructs a response with multiple data.
097:             */
098:            protected AuResponse(String cmd, Page depends, String[] data) {
099:                if (cmd == null || cmd.length() == 0)
100:                    throw new IllegalArgumentException("cmd");
101:                _cmd = cmd;
102:                _depends = depends;
103:                _data = data;
104:            }
105:
106:            /** Returns the command of this response (never null).
107:             */
108:            public String getCommand() {
109:                return _cmd;
110:            }
111:
112:            /** Returns the associated data of this response (might be null).
113:             */
114:            public String[] getData() {
115:                return _data;
116:            }
117:
118:            /** Returns the component or page that this response depends on.
119:             * If it is not null and the depends component/page is removed,
120:             * this response shall be removed, too.
121:             *
122:             * <p>Note: the returned object is either a {@link Component} or a
123:             * {@link Page}.
124:             */
125:            public final Object getDepends() {
126:                return _depends;
127:            }
128:
129:            //-- Object --//
130:            public final boolean equals(Object o) { //prevent override
131:                return this  == o;
132:            }
133:
134:            public String toString() {
135:                //Don't call getCommand and getData since it causes
136:                //AuSetDeferredAttribute to evaluate the deferred value
137:                final StringBuffer sb = new StringBuffer(60).append("[cmd=")
138:                        .append(_cmd);
139:                if (_data != null && _data.length > 0) {
140:                    sb.append(", data0=").append(_data[0]);
141:                    if (_data.length > 1) {
142:                        sb.append(", data1=").append(trimOutput(_data[1]));
143:                        if (_data.length > 2)
144:                            sb.append(", data2=").append(trimOutput(_data[2]));
145:                    }
146:                }
147:                return sb.append(']').toString();
148:            }
149:
150:            private static String trimOutput(String s) {
151:                if (s == null)
152:                    return null;
153:                s = s.trim();
154:                return s.length() <= 36 ? s : s.substring(0, 36) + "...";
155:            }
156:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.