Source Code Cross Referenced for Form.java in  » Ajax » dwr » jsx3 » net » 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 » jsx3.net 
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 jsx3.net;
017:
018:        import org.directwebremoting.ScriptBuffer;
019:        import org.directwebremoting.proxy.ScriptProxy;
020:        import org.directwebremoting.proxy.io.Context;
021:
022:        /**
023:         * Provides support for legacy HTML GET and POST forms. Allows the submission of forms with arbitrary
024:         key-value pairs as well as file upload.
025:
026:         Prompting the user for a file upload field (promptForFile()) is only supported in
027:         Microsoft Internet Explorer.
028:         * @author Joe Walker [joe at getahead dot org]
029:         * @author DRAPGEN - Dwr Reverse Ajax Proxy GENerator
030:         */
031:        public class Form extends jsx3.lang.Object {
032:            /**
033:             * All reverse ajax proxies need context to work from
034:             * @param scriptProxy The place we are writing scripts to
035:             * @param context The script that got us to where we are now
036:             */
037:            public Form(Context context, String extension,
038:                    ScriptProxy scriptProxy) {
039:                super (context, extension, scriptProxy);
040:            }
041:
042:            /**
043:             * instance initializer
044:             * @param strMethod form method, METHOD_GET (default) or METHOD_POST
045:             * @param strAction the URL to submit to
046:             * @param bMultipart if true the form can support file upload
047:             */
048:            public Form(String strMethod, String strAction, boolean bMultipart) {
049:                super ((Context) null, (String) null, (ScriptProxy) null);
050:                ScriptBuffer script = new ScriptBuffer();
051:                script.appendCall("new Form", strMethod, strAction, bMultipart);
052:                setInitScript(script);
053:            }
054:
055:            /**
056:             * 
057:             */
058:            public static final String METHOD_GET = "get";
059:
060:            /**
061:             * 
062:             */
063:            public static final String METHOD_POST = "post";
064:
065:            /**
066:             * Event type published when a file has been chosen through user interaction. The event has properties field and value.
067:             */
068:            public static final String EVENT_FILE_SELECTED = "file";
069:
070:            /**
071:             * Event type published when the response has loaded.
072:             */
073:            public static final String EVENT_ON_RESPONSE = "response";
074:
075:            /**
076:             * Event type published when a security error occurs trying to access the response.
077:             */
078:            public static final String EVENT_ON_ERROR = "error";
079:
080:            /**
081:             * Event type published when the response is still not ready after the specified timeout period.
082:             */
083:            public static final String EVENT_ON_TIMEOUT = "timeout";
084:
085:            /**
086:             * Creates a new form and initialize it from the HTML representation of a form.
087:             * @param strFragment the html fragment containing a <form/> tag.
088:             */
089:            @SuppressWarnings("unchecked")
090:            public jsx3.net.Form newFromFragment(String strFragment) {
091:                String extension = "newFromFragment(\"" + strFragment + "\").";
092:                try {
093:                    java.lang.reflect.Constructor<jsx3.net.Form> ctor = jsx3.net.Form.class
094:                            .getConstructor(Context.class, String.class,
095:                                    ScriptProxy.class);
096:                    return ctor.newInstance(this , extension, getScriptProxy());
097:                } catch (Exception ex) {
098:                    throw new IllegalArgumentException("Unsupported type: "
099:                            + jsx3.net.Form.class.getName());
100:                }
101:            }
102:
103:            /**
104:             * Returns the method of this form.
105:             * @param callback <code>METHOD_GET</code> or <code>METHOD_POST</code>.
106:             */
107:            @SuppressWarnings("unchecked")
108:            public void getMethod(
109:                    org.directwebremoting.proxy.Callback<String> callback) {
110:                ScriptBuffer script = new ScriptBuffer();
111:                String callbackPrefix = "";
112:
113:                if (callback != null) {
114:                    callbackPrefix = "var reply = ";
115:                }
116:
117:                script.appendCall(callbackPrefix + getContextPath()
118:                        + "getMethod");
119:
120:                if (callback != null) {
121:                    String key = org.directwebremoting.extend.CallbackHelper
122:                            .saveCallback(callback, String.class);
123:                    script
124:                            .appendCall("__System.activateCallback", key,
125:                                    "reply");
126:                }
127:
128:                getScriptProxy().addScript(script);
129:            }
130:
131:            /**
132:             * Sets the method of this form.
133:             * @param method <code>METHOD_GET</code> or <code>METHOD_POST</code>.
134:             */
135:            public void setMethod(String method) {
136:                ScriptBuffer script = new ScriptBuffer();
137:                script.appendCall(getContextPath() + "setMethod", method);
138:                getScriptProxy().addScript(script);
139:            }
140:
141:            /**
142:             * Returns the action of this form, the URL that this form is submitted to.
143:             * @param callback action
144:             */
145:            @SuppressWarnings("unchecked")
146:            public void getAction(
147:                    org.directwebremoting.proxy.Callback<String> callback) {
148:                ScriptBuffer script = new ScriptBuffer();
149:                String callbackPrefix = "";
150:
151:                if (callback != null) {
152:                    callbackPrefix = "var reply = ";
153:                }
154:
155:                script.appendCall(callbackPrefix + getContextPath()
156:                        + "getAction");
157:
158:                if (callback != null) {
159:                    String key = org.directwebremoting.extend.CallbackHelper
160:                            .saveCallback(callback, String.class);
161:                    script
162:                            .appendCall("__System.activateCallback", key,
163:                                    "reply");
164:                }
165:
166:                getScriptProxy().addScript(script);
167:            }
168:
169:            /**
170:             * Sets the action of this form.
171:             * @param action 
172:             */
173:            public void setAction(String action) {
174:                ScriptBuffer script = new ScriptBuffer();
175:                script.appendCall(getContextPath() + "setAction", action);
176:                getScriptProxy().addScript(script);
177:            }
178:
179:            /**
180:             * Returns whether this form is multipart. Only multipart forms may upload files.
181:             */
182:            @SuppressWarnings("unchecked")
183:            public void getMultipart(
184:                    org.directwebremoting.proxy.Callback<Boolean> callback) {
185:                ScriptBuffer script = new ScriptBuffer();
186:                String callbackPrefix = "";
187:
188:                if (callback != null) {
189:                    callbackPrefix = "var reply = ";
190:                }
191:
192:                script.appendCall(callbackPrefix + getContextPath()
193:                        + "getMultipart");
194:
195:                if (callback != null) {
196:                    String key = org.directwebremoting.extend.CallbackHelper
197:                            .saveCallback(callback, Boolean.class);
198:                    script
199:                            .appendCall("__System.activateCallback", key,
200:                                    "reply");
201:                }
202:
203:                getScriptProxy().addScript(script);
204:            }
205:
206:            /**
207:             * Sets whether this form is multipart.
208:             * @param multipart 
209:             */
210:            public void setMultipart(boolean multipart) {
211:                ScriptBuffer script = new ScriptBuffer();
212:                script.appendCall(getContextPath() + "setMultipart", multipart);
213:                getScriptProxy().addScript(script);
214:            }
215:
216:            /**
217:             * Returns the value of a field in this form.
218:             * @param strName the name of the form field to query.
219:             * @param callback the field value or <code>null</code> if no such field exists.
220:             */
221:            @SuppressWarnings("unchecked")
222:            public void getField(String strName,
223:                    org.directwebremoting.proxy.Callback<String> callback) {
224:                ScriptBuffer script = new ScriptBuffer();
225:                String callbackPrefix = "";
226:
227:                if (callback != null) {
228:                    callbackPrefix = "var reply = ";
229:                }
230:
231:                script.appendCall(callbackPrefix + getContextPath()
232:                        + "getField", strName);
233:
234:                if (callback != null) {
235:                    String key = org.directwebremoting.extend.CallbackHelper
236:                            .saveCallback(callback, String.class);
237:                    script
238:                            .appendCall("__System.activateCallback", key,
239:                                    "reply");
240:                }
241:
242:                getScriptProxy().addScript(script);
243:            }
244:
245:            /**
246:             * Returns the names of all fields in this form.
247:             */
248:            @SuppressWarnings("unchecked")
249:            public void getFields(
250:                    org.directwebremoting.proxy.Callback<Object[]> callback) {
251:                ScriptBuffer script = new ScriptBuffer();
252:                String callbackPrefix = "";
253:
254:                if (callback != null) {
255:                    callbackPrefix = "var reply = ";
256:                }
257:
258:                script.appendCall(callbackPrefix + getContextPath()
259:                        + "getFields");
260:
261:                if (callback != null) {
262:                    String key = org.directwebremoting.extend.CallbackHelper
263:                            .saveCallback(callback, Object[].class);
264:                    script
265:                            .appendCall("__System.activateCallback", key,
266:                                    "reply");
267:                }
268:
269:                getScriptProxy().addScript(script);
270:            }
271:
272:            /**
273:             * Sets the value of a field in this form.
274:             * @param strName the name of the form field to set.
275:             * @param strValue the new value of form field.
276:             * @param bConcat if true, will append <code>" " + strValue</code> to the existing value. The space is
277:            only inserted if the existing value is not empty.
278:             */
279:            public void setField(String strName, String strValue,
280:                    boolean bConcat) {
281:                ScriptBuffer script = new ScriptBuffer();
282:                script.appendCall(getContextPath() + "setField", strName,
283:                        strValue, bConcat);
284:                getScriptProxy().addScript(script);
285:            }
286:
287:            /**
288:             * Removes a field from this form.
289:             * @param strName the name of the form field to remove.
290:             */
291:            public void removeField(String strName) {
292:                ScriptBuffer script = new ScriptBuffer();
293:                script.appendCall(getContextPath() + "removeField", strName);
294:                getScriptProxy().addScript(script);
295:            }
296:
297:            /**
298:             * Adds a file upload field to this form.
299:             * @param strName the name of the new field.
300:             */
301:            public void addFileUploadField(String strName) {
302:                ScriptBuffer script = new ScriptBuffer();
303:                script.appendCall(getContextPath() + "addFileUploadField",
304:                        strName);
305:                getScriptProxy().addScript(script);
306:            }
307:
308:            /**
309:             * Invokes the operating system file browser to choose a file for a file upload field. This method is not
310:            supported in browsers other than Microsoft Internet Explorer.
311:             * @param strFieldName the name of the file upload field.
312:             */
313:            public void promptForFile(String strFieldName) {
314:                ScriptBuffer script = new ScriptBuffer();
315:                script.appendCall(getContextPath() + "promptForFile",
316:                        strFieldName);
317:                getScriptProxy().addScript(script);
318:            }
319:
320:            /**
321:             * Stops polling for a response.
322:             */
323:            public void abort() {
324:                ScriptBuffer script = new ScriptBuffer();
325:                script.appendCall(getContextPath() + "abort");
326:                getScriptProxy().addScript(script);
327:            }
328:
329:            /**
330:             * Sends the form. Sending the form is always asynchronous. Once a form has been sent it may not be reused.
331:             * @param intPollInterval milliseconds between checking for a response. If not provided, the default value is 1/4 sec.
332:             * @param intTimeout total milliseconds before timeout. If not provided, the default value is 30 sec.
333:             */
334:            public void send(int intPollInterval, int intTimeout) {
335:                ScriptBuffer script = new ScriptBuffer();
336:                script.appendCall(getContextPath() + "send", intPollInterval,
337:                        intTimeout);
338:                getScriptProxy().addScript(script);
339:            }
340:
341:            /**
342:             * Returns the content of the response as a string.
343:             */
344:            @SuppressWarnings("unchecked")
345:            public void getResponseText(
346:                    org.directwebremoting.proxy.Callback<String> callback) {
347:                ScriptBuffer script = new ScriptBuffer();
348:                String callbackPrefix = "";
349:
350:                if (callback != null) {
351:                    callbackPrefix = "var reply = ";
352:                }
353:
354:                script.appendCall(callbackPrefix + getContextPath()
355:                        + "getResponseText");
356:
357:                if (callback != null) {
358:                    String key = org.directwebremoting.extend.CallbackHelper
359:                            .saveCallback(callback, String.class);
360:                    script
361:                            .appendCall("__System.activateCallback", key,
362:                                    "reply");
363:                }
364:
365:                getScriptProxy().addScript(script);
366:            }
367:
368:            /**
369:             * Returns the content of the response as an XML document.
370:             */
371:            @SuppressWarnings("unchecked")
372:            public jsx3.xml.CdfDocument getResponseXML() {
373:                String extension = "getResponseXML().";
374:                try {
375:                    java.lang.reflect.Constructor<jsx3.xml.CdfDocument> ctor = jsx3.xml.CdfDocument.class
376:                            .getConstructor(Context.class, String.class,
377:                                    ScriptProxy.class);
378:                    return ctor.newInstance(this , extension, getScriptProxy());
379:                } catch (Exception ex) {
380:                    throw new IllegalArgumentException("Unsupported type: "
381:                            + jsx3.xml.CdfDocument.class.getName());
382:                }
383:            }
384:
385:            /**
386:             * Returns the content of the response as an XML document.
387:             * @param returnType The expected return type
388:             */
389:            @SuppressWarnings("unchecked")
390:            public <T> T getResponseXML(Class<T> returnType) {
391:                String extension = "getResponseXML().";
392:                try {
393:                    java.lang.reflect.Constructor<T> ctor = returnType
394:                            .getConstructor(Context.class, String.class,
395:                                    ScriptProxy.class);
396:                    return ctor.newInstance(this , extension, getScriptProxy());
397:                } catch (Exception ex) {
398:                    throw new IllegalArgumentException(
399:                            "Unsupported return type: " + returnType.getName());
400:                }
401:            }
402:
403:            /**
404:             * Destroys the form and the hidden IFRAME. This method should be called after receiving an onResponse, onError, or 
405:            onTimeout event for proper garbage collection.
406:             */
407:            public void destroy() {
408:                ScriptBuffer script = new ScriptBuffer();
409:                script.appendCall(getContextPath() + "destroy");
410:                getScriptProxy().addScript(script);
411:            }
412:
413:            /**
414:             * Reveals the IFRAME containing this form for debugging purposes. Dimensions of the revealed form may be provided
415:            or a default position and dimensions will be used.
416:             * @param l pixels from the left side of the HTML page that the IFRAME will be displayed.
417:             * @param t pixels from the top of the HTML page that the IFRAME will be displayed.
418:             * @param w width of the revealed IFRAME, in pixels.
419:             * @param h height of the revealed IFRAME, in pixels.
420:             */
421:            public void reveal(int l, int t, int w, int h) {
422:                ScriptBuffer script = new ScriptBuffer();
423:                script.appendCall(getContextPath() + "reveal", l, t, w, h);
424:                getScriptProxy().addScript(script);
425:            }
426:
427:            /**
428:             * Hides the IFRAME containing this form after it has been shown by calling reveal().
429:             */
430:            public void conceal() {
431:                ScriptBuffer script = new ScriptBuffer();
432:                script.appendCall(getContextPath() + "conceal");
433:                getScriptProxy().addScript(script);
434:            }
435:
436:            /**
437:             * Publishes an event to all subscribed objects.
438:             * @param objEvent the event, should have at least a field 'subject' that is the event id, another common field is 'target' (target will default to this instance)
439:             * @param callback the number of listeners to which the event was broadcast
440:             */
441:            @SuppressWarnings("unchecked")
442:            public void publish(jsx3.lang.Object objEvent,
443:                    org.directwebremoting.proxy.Callback<Integer> callback) {
444:                ScriptBuffer script = new ScriptBuffer();
445:                String callbackPrefix = "";
446:
447:                if (callback != null) {
448:                    callbackPrefix = "var reply = ";
449:                }
450:
451:                script
452:                        .appendCall(callbackPrefix + getContextPath()
453:                                + "publish", objEvent);
454:
455:                if (callback != null) {
456:                    String key = org.directwebremoting.extend.CallbackHelper
457:                            .saveCallback(callback, Integer.class);
458:                    script
459:                            .appendCall("__System.activateCallback", key,
460:                                    "reply");
461:                }
462:
463:                getScriptProxy().addScript(script);
464:            }
465:
466:            /**
467:             * Subscribes an object or function to a type of event published by this object.
468:
469:            As of version 3.4 a string value for objHandler is deprecated.
470:             * @param strEventId the event type(s).
471:             * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
472:             * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
473:             */
474:            public void subscribe(String strEventId,
475:                    org.directwebremoting.proxy.CodeBlock objHandler,
476:                    String objFunction) {
477:                ScriptBuffer script = new ScriptBuffer();
478:                script.appendCall(getContextPath() + "subscribe", strEventId,
479:                        objHandler, objFunction);
480:                getScriptProxy().addScript(script);
481:            }
482:
483:            /**
484:             * Subscribes an object or function to a type of event published by this object.
485:
486:            As of version 3.4 a string value for objHandler is deprecated.
487:             * @param strEventId the event type(s).
488:             * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
489:             * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
490:             */
491:            public void subscribe(Object[] strEventId,
492:                    jsx3.lang.Object objHandler,
493:                    org.directwebremoting.proxy.CodeBlock objFunction) {
494:                ScriptBuffer script = new ScriptBuffer();
495:                script.appendCall(getContextPath() + "subscribe", strEventId,
496:                        objHandler, objFunction);
497:                getScriptProxy().addScript(script);
498:            }
499:
500:            /**
501:             * Subscribes an object or function to a type of event published by this object.
502:
503:            As of version 3.4 a string value for objHandler is deprecated.
504:             * @param strEventId the event type(s).
505:             * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
506:             * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
507:             */
508:            public void subscribe(Object[] strEventId, String objHandler,
509:                    String objFunction) {
510:                ScriptBuffer script = new ScriptBuffer();
511:                script.appendCall(getContextPath() + "subscribe", strEventId,
512:                        objHandler, objFunction);
513:                getScriptProxy().addScript(script);
514:            }
515:
516:            /**
517:             * Subscribes an object or function to a type of event published by this object.
518:
519:            As of version 3.4 a string value for objHandler is deprecated.
520:             * @param strEventId the event type(s).
521:             * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
522:             * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
523:             */
524:            public void subscribe(Object[] strEventId,
525:                    org.directwebremoting.proxy.CodeBlock objHandler,
526:                    String objFunction) {
527:                ScriptBuffer script = new ScriptBuffer();
528:                script.appendCall(getContextPath() + "subscribe", strEventId,
529:                        objHandler, objFunction);
530:                getScriptProxy().addScript(script);
531:            }
532:
533:            /**
534:             * Subscribes an object or function to a type of event published by this object.
535:
536:            As of version 3.4 a string value for objHandler is deprecated.
537:             * @param strEventId the event type(s).
538:             * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
539:             * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
540:             */
541:            public void subscribe(String strEventId,
542:                    jsx3.lang.Object objHandler,
543:                    org.directwebremoting.proxy.CodeBlock objFunction) {
544:                ScriptBuffer script = new ScriptBuffer();
545:                script.appendCall(getContextPath() + "subscribe", strEventId,
546:                        objHandler, objFunction);
547:                getScriptProxy().addScript(script);
548:            }
549:
550:            /**
551:             * Subscribes an object or function to a type of event published by this object.
552:
553:            As of version 3.4 a string value for objHandler is deprecated.
554:             * @param strEventId the event type(s).
555:             * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
556:             * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
557:             */
558:            public void subscribe(String strEventId, String objHandler,
559:                    String objFunction) {
560:                ScriptBuffer script = new ScriptBuffer();
561:                script.appendCall(getContextPath() + "subscribe", strEventId,
562:                        objHandler, objFunction);
563:                getScriptProxy().addScript(script);
564:            }
565:
566:            /**
567:             * Subscribes an object or function to a type of event published by this object.
568:
569:            As of version 3.4 a string value for objHandler is deprecated.
570:             * @param strEventId the event type(s).
571:             * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
572:             * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
573:             */
574:            public void subscribe(String strEventId, String objHandler,
575:                    org.directwebremoting.proxy.CodeBlock objFunction) {
576:                ScriptBuffer script = new ScriptBuffer();
577:                script.appendCall(getContextPath() + "subscribe", strEventId,
578:                        objHandler, objFunction);
579:                getScriptProxy().addScript(script);
580:            }
581:
582:            /**
583:             * Subscribes an object or function to a type of event published by this object.
584:
585:            As of version 3.4 a string value for objHandler is deprecated.
586:             * @param strEventId the event type(s).
587:             * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
588:             * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
589:             */
590:            public void subscribe(Object[] strEventId, String objHandler,
591:                    org.directwebremoting.proxy.CodeBlock objFunction) {
592:                ScriptBuffer script = new ScriptBuffer();
593:                script.appendCall(getContextPath() + "subscribe", strEventId,
594:                        objHandler, objFunction);
595:                getScriptProxy().addScript(script);
596:            }
597:
598:            /**
599:             * Subscribes an object or function to a type of event published by this object.
600:
601:            As of version 3.4 a string value for objHandler is deprecated.
602:             * @param strEventId the event type(s).
603:             * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
604:             * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
605:             */
606:            public void subscribe(String strEventId,
607:                    jsx3.lang.Object objHandler, String objFunction) {
608:                ScriptBuffer script = new ScriptBuffer();
609:                script.appendCall(getContextPath() + "subscribe", strEventId,
610:                        objHandler, objFunction);
611:                getScriptProxy().addScript(script);
612:            }
613:
614:            /**
615:             * Subscribes an object or function to a type of event published by this object.
616:
617:            As of version 3.4 a string value for objHandler is deprecated.
618:             * @param strEventId the event type(s).
619:             * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
620:             * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
621:             */
622:            public void subscribe(Object[] strEventId,
623:                    jsx3.lang.Object objHandler, String objFunction) {
624:                ScriptBuffer script = new ScriptBuffer();
625:                script.appendCall(getContextPath() + "subscribe", strEventId,
626:                        objHandler, objFunction);
627:                getScriptProxy().addScript(script);
628:            }
629:
630:            /**
631:             * Subscribes an object or function to a type of event published by this object.
632:
633:            As of version 3.4 a string value for objHandler is deprecated.
634:             * @param strEventId the event type(s).
635:             * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
636:             * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
637:             */
638:            public void subscribe(String strEventId,
639:                    org.directwebremoting.proxy.CodeBlock objHandler,
640:                    org.directwebremoting.proxy.CodeBlock objFunction) {
641:                ScriptBuffer script = new ScriptBuffer();
642:                script.appendCall(getContextPath() + "subscribe", strEventId,
643:                        objHandler, objFunction);
644:                getScriptProxy().addScript(script);
645:            }
646:
647:            /**
648:             * Subscribes an object or function to a type of event published by this object.
649:
650:            As of version 3.4 a string value for objHandler is deprecated.
651:             * @param strEventId the event type(s).
652:             * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
653:             * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
654:             */
655:            public void subscribe(Object[] strEventId,
656:                    org.directwebremoting.proxy.CodeBlock objHandler,
657:                    org.directwebremoting.proxy.CodeBlock objFunction) {
658:                ScriptBuffer script = new ScriptBuffer();
659:                script.appendCall(getContextPath() + "subscribe", strEventId,
660:                        objHandler, objFunction);
661:                getScriptProxy().addScript(script);
662:            }
663:
664:            /**
665:             * Unsubscribe an object or function from an event published by this object.
666:
667:            As of version 3.4 a string value for objHandler is deprecated.
668:             * @param strEventId the event type(s).
669:             * @param objHandler the value of objHandler passed to subscribe
670:             */
671:            public void unsubscribe(Object[] strEventId, String objHandler) {
672:                ScriptBuffer script = new ScriptBuffer();
673:                script.appendCall(getContextPath() + "unsubscribe", strEventId,
674:                        objHandler);
675:                getScriptProxy().addScript(script);
676:            }
677:
678:            /**
679:             * Unsubscribe an object or function from an event published by this object.
680:
681:            As of version 3.4 a string value for objHandler is deprecated.
682:             * @param strEventId the event type(s).
683:             * @param objHandler the value of objHandler passed to subscribe
684:             */
685:            public void unsubscribe(String strEventId,
686:                    org.directwebremoting.proxy.CodeBlock objHandler) {
687:                ScriptBuffer script = new ScriptBuffer();
688:                script.appendCall(getContextPath() + "unsubscribe", strEventId,
689:                        objHandler);
690:                getScriptProxy().addScript(script);
691:            }
692:
693:            /**
694:             * Unsubscribe an object or function from an event published by this object.
695:
696:            As of version 3.4 a string value for objHandler is deprecated.
697:             * @param strEventId the event type(s).
698:             * @param objHandler the value of objHandler passed to subscribe
699:             */
700:            public void unsubscribe(String strEventId,
701:                    jsx3.lang.Object objHandler) {
702:                ScriptBuffer script = new ScriptBuffer();
703:                script.appendCall(getContextPath() + "unsubscribe", strEventId,
704:                        objHandler);
705:                getScriptProxy().addScript(script);
706:            }
707:
708:            /**
709:             * Unsubscribe an object or function from an event published by this object.
710:
711:            As of version 3.4 a string value for objHandler is deprecated.
712:             * @param strEventId the event type(s).
713:             * @param objHandler the value of objHandler passed to subscribe
714:             */
715:            public void unsubscribe(String strEventId, String objHandler) {
716:                ScriptBuffer script = new ScriptBuffer();
717:                script.appendCall(getContextPath() + "unsubscribe", strEventId,
718:                        objHandler);
719:                getScriptProxy().addScript(script);
720:            }
721:
722:            /**
723:             * Unsubscribe an object or function from an event published by this object.
724:
725:            As of version 3.4 a string value for objHandler is deprecated.
726:             * @param strEventId the event type(s).
727:             * @param objHandler the value of objHandler passed to subscribe
728:             */
729:            public void unsubscribe(Object[] strEventId,
730:                    org.directwebremoting.proxy.CodeBlock objHandler) {
731:                ScriptBuffer script = new ScriptBuffer();
732:                script.appendCall(getContextPath() + "unsubscribe", strEventId,
733:                        objHandler);
734:                getScriptProxy().addScript(script);
735:            }
736:
737:            /**
738:             * Unsubscribe an object or function from an event published by this object.
739:
740:            As of version 3.4 a string value for objHandler is deprecated.
741:             * @param strEventId the event type(s).
742:             * @param objHandler the value of objHandler passed to subscribe
743:             */
744:            public void unsubscribe(Object[] strEventId,
745:                    jsx3.lang.Object objHandler) {
746:                ScriptBuffer script = new ScriptBuffer();
747:                script.appendCall(getContextPath() + "unsubscribe", strEventId,
748:                        objHandler);
749:                getScriptProxy().addScript(script);
750:            }
751:
752:            /**
753:             * Unsubscribes all subscribed objects to a type of event published by this object.
754:             * @param strEventId the event type
755:             */
756:            public void unsubscribeAll(String strEventId) {
757:                ScriptBuffer script = new ScriptBuffer();
758:                script.appendCall(getContextPath() + "unsubscribeAll",
759:                        strEventId);
760:                getScriptProxy().addScript(script);
761:            }
762:
763:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.