Source Code Cross Referenced for ScriptProxy.java in  » Ajax » dwr » org » directwebremoting » proxy » 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 » dwr » org.directwebremoting.proxy 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005 Joe Walker
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *     http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package org.directwebremoting.proxy;
017:
018:        import java.util.ArrayList;
019:        import java.util.Collection;
020:        import java.util.List;
021:
022:        import org.directwebremoting.ScriptBuffer;
023:        import org.directwebremoting.ScriptSession;
024:
025:        /**
026:         * Class to help people send scripts to collections of browsers.
027:         * ScriptProxy also is the base class for the Java implementations of GI, Util
028:         * and Script.aculo.us.Effect.
029:         * @author Joe Walker [joe at getahead dot ltd dot uk]
030:         */
031:        public class ScriptProxy {
032:            /**
033:             * Http thread constructor
034:             */
035:            public ScriptProxy() {
036:            }
037:
038:            /**
039:             * Http thread constructor
040:             * @param scriptSession The browser to alter
041:             */
042:            public ScriptProxy(ScriptSession scriptSession) {
043:                scriptSessions.add(scriptSession);
044:            }
045:
046:            /**
047:             * Non-http thread constructor
048:             * @param scriptSessions The browsers to alter
049:             */
050:            public ScriptProxy(Collection<ScriptSession> scriptSessions) {
051:                this .scriptSessions.addAll(scriptSessions);
052:            }
053:
054:            /**
055:             * @param scriptSession The script session to add to the list
056:             */
057:            public void addScriptSession(ScriptSession scriptSession) {
058:                scriptSessions.add(scriptSession);
059:            }
060:
061:            /**
062:             * @param addScriptSessions The script sessions to add to the list
063:             */
064:            public void addScriptSessions(
065:                    Collection<ScriptSession> addScriptSessions) {
066:                scriptSessions.addAll(addScriptSessions);
067:            }
068:
069:            /**
070:             * Call a named function with no parameters.
071:             * @param funcName The name of the function to call
072:             */
073:            public void addFunctionCall(String funcName) {
074:                ScriptBuffer script = new ScriptBuffer();
075:                script.appendScript(funcName).appendScript("();");
076:                addScript(script);
077:            }
078:
079:            /**
080:             * Call a named function with one parameter.
081:             * @param funcName The name of the function to call
082:             * @param param1 The first parameter to the above function
083:             */
084:            public void addFunctionCall(String funcName, Object param1) {
085:                ScriptBuffer script = new ScriptBuffer();
086:                script.appendScript(funcName).appendScript("(").appendData(
087:                        param1).appendScript(");");
088:                addScript(script);
089:            }
090:
091:            /**
092:             * Call a named function with one parameter.
093:             * @param funcName The name of the function to call
094:             * @param param1 The first parameter to the above function
095:             * @param param2 The second parameter to the above function
096:             */
097:            public void addFunctionCall(String funcName, Object param1,
098:                    Object param2) {
099:                ScriptBuffer script = new ScriptBuffer();
100:                script.appendScript(funcName).appendScript("(").appendData(
101:                        param1).appendScript(",").appendData(param2)
102:                        .appendScript(");");
103:                addScript(script);
104:            }
105:
106:            /**
107:             * Call a named function with one parameter.
108:             * @param funcName The name of the function to call
109:             * @param param1 The first parameter to the above function
110:             * @param param2 The second parameter to the above function
111:             * @param param3 The third parameter to the above function
112:             */
113:            public void addFunctionCall(String funcName, Object param1,
114:                    Object param2, Object param3) {
115:                ScriptBuffer script = new ScriptBuffer();
116:                script.appendScript(funcName).appendScript("(").appendData(
117:                        param1).appendScript(",").appendData(param2)
118:                        .appendScript(",").appendData(param3)
119:                        .appendScript(");");
120:                addScript(script);
121:            }
122:
123:            /**
124:             * Call a named function with one parameter.
125:             * @param funcName The name of the function to call
126:             * @param param1 The first parameter to the above function
127:             * @param param2 The second parameter to the above function
128:             * @param param3 The third parameter to the above function
129:             * @param param4 The fourth parameter to the above function
130:             */
131:            public void addFunctionCall(String funcName, Object param1,
132:                    Object param2, Object param3, Object param4) {
133:                ScriptBuffer script = new ScriptBuffer();
134:                script.appendScript(funcName).appendScript("(").appendData(
135:                        param1).appendScript(",").appendData(param2)
136:                        .appendScript(",").appendData(param3).appendScript(",")
137:                        .appendData(param4).appendScript(");");
138:                addScript(script);
139:            }
140:
141:            /**
142:             * Call a named function with one parameter.
143:             * @param funcName The name of the function to call
144:             * @param param1 The first parameter to the above function
145:             * @param param2 The second parameter to the above function
146:             * @param param3 The third parameter to the above function
147:             * @param param4 The fourth parameter to the above function
148:             * @param param5 The fifth parameter to the above function
149:             */
150:            public void addFunctionCall(String funcName, Object param1,
151:                    Object param2, Object param3, Object param4, Object param5) {
152:                ScriptBuffer script = new ScriptBuffer();
153:                script.appendScript(funcName).appendScript("(").appendData(
154:                        param1).appendScript(",").appendData(param2)
155:                        .appendScript(",").appendData(param3).appendScript(",")
156:                        .appendData(param4).appendScript(",")
157:                        .appendData(param5).appendScript(");");
158:                addScript(script);
159:            }
160:
161:            /**
162:             * Call a named function with one parameter.
163:             * @param funcName The name of the function to call
164:             * @param param1 The first parameter to the above function
165:             * @param param2 The second parameter to the above function
166:             * @param param3 The third parameter to the above function
167:             * @param param4 The fourth parameter to the above function
168:             * @param param5 The fifth parameter to the above function
169:             * @param param6 The sixth parameter to the above function
170:             */
171:            public void addFunctionCall(String funcName, Object param1,
172:                    Object param2, Object param3, Object param4, Object param5,
173:                    Object param6) {
174:                ScriptBuffer script = new ScriptBuffer();
175:                script.appendScript(funcName).appendScript("(").appendData(
176:                        param1).appendScript(",").appendData(param2)
177:                        .appendScript(",").appendData(param3).appendScript(",")
178:                        .appendData(param4).appendScript(",")
179:                        .appendData(param5).appendScript(",")
180:                        .appendData(param6).appendScript(");");
181:                addScript(script);
182:            }
183:
184:            /**
185:             * Call a named function with one parameter.
186:             * @param funcName The name of the function to call
187:             * @param param1 The first parameter to the above function
188:             * @param param2 The second parameter to the above function
189:             * @param param3 The third parameter to the above function
190:             * @param param4 The fourth parameter to the above function
191:             * @param param5 The fifth parameter to the above function
192:             * @param param6 The sixth parameter to the above function
193:             * @param param7 The seventh parameter to the above function
194:             */
195:            public void addFunctionCall(String funcName, Object param1,
196:                    Object param2, Object param3, Object param4, Object param5,
197:                    Object param6, Object param7) {
198:                ScriptBuffer script = new ScriptBuffer();
199:                script.appendScript(funcName).appendScript("(").appendData(
200:                        param1).appendScript(",").appendData(param2)
201:                        .appendScript(",").appendData(param3).appendScript(",")
202:                        .appendData(param4).appendScript(",")
203:                        .appendData(param5).appendScript(",")
204:                        .appendData(param6).appendScript(",")
205:                        .appendData(param7).appendScript(");");
206:                addScript(script);
207:            }
208:
209:            /**
210:             * Utility to add the given script to all known browsers.
211:             * @param script The Javascript to send to the browsers
212:             */
213:            public void addScript(ScriptBuffer script) {
214:                for (ScriptSession scriptSession : scriptSessions) {
215:                    scriptSession.addScript(script);
216:                }
217:            }
218:
219:            /**
220:             * The browsers that we affect.
221:             */
222:            private final List<ScriptSession> scriptSessions = new ArrayList<ScriptSession>();
223:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.