Source Code Cross Referenced for DOM.java in  » Ajax » dwr » jsx3 » app » 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.app 
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.app;
017:
018:        import org.directwebremoting.ScriptBuffer;
019:        import org.directwebremoting.proxy.ScriptProxy;
020:        import org.directwebremoting.proxy.io.Context;
021:
022:        /**
023:         * Registers all DOM nodes in an instance of jsx3.app.Server and publishes related events.
024:         This class keeps all contained JSX objects indexed on id and name.
025:         * @author Joe Walker [joe at getahead dot org]
026:         * @author DRAPGEN - Dwr Reverse Ajax Proxy GENerator
027:         */
028:        public class DOM extends jsx3.lang.Object {
029:            /**
030:             * All reverse ajax proxies need context to work from
031:             * @param scriptProxy The place we are writing scripts to
032:             * @param context The script that got us to where we are now
033:             */
034:            public DOM(Context context, String extension,
035:                    ScriptProxy scriptProxy) {
036:                super (context, extension, scriptProxy);
037:            }
038:
039:            /**
040:             * The instance initializer.
041:             */
042:            public DOM() {
043:                super ((Context) null, (String) null, (ScriptProxy) null);
044:                ScriptBuffer script = new ScriptBuffer();
045:                script.appendCall("new DOM");
046:                setInitScript(script);
047:            }
048:
049:            /**
050:             * 0
051:             */
052:            public static final int TYPEADD = 0;
053:
054:            /**
055:             * 1
056:             */
057:            public static final int TYPEREMOVE = 1;
058:
059:            /**
060:             * 2
061:             */
062:            public static final int TYPEREARRANGE = 2;
063:
064:            /**
065:             * Creates a new unique system id.
066:             * @param strNameSpace the application namespace for which to generate the id.
067:             */
068:            @SuppressWarnings("unchecked")
069:            public void newId(String strNameSpace,
070:                    org.directwebremoting.proxy.Callback<String> callback) {
071:                ScriptBuffer script = new ScriptBuffer();
072:                String callbackPrefix = "";
073:
074:                if (callback != null) {
075:                    callbackPrefix = "var reply = ";
076:                }
077:
078:                script.appendCall(callbackPrefix + getContextPath() + "newId",
079:                        strNameSpace);
080:
081:                if (callback != null) {
082:                    String key = org.directwebremoting.extend.CallbackHelper
083:                            .saveCallback(callback, String.class);
084:                    script
085:                            .appendCall("__System.activateCallback", key,
086:                                    "reply");
087:                }
088:
089:                getScriptProxy().addScript(script);
090:            }
091:
092:            /**
093:             * The instance finalizer.
094:             */
095:            public void destroy() {
096:                ScriptBuffer script = new ScriptBuffer();
097:                script.appendCall(getContextPath() + "destroy");
098:                getScriptProxy().addScript(script);
099:            }
100:
101:            /**
102:             * Looks up a DOM object contained in this DOM by id or name.
103:             * @param strId either the id of the object to return or its name.
104:             * @return the matching DOM object or <code>null</code> if none found.
105:             */
106:            @SuppressWarnings("unchecked")
107:            public jsx3.app.Model get(String strId) {
108:                String extension = "get(\"" + strId + "\").";
109:                try {
110:                    java.lang.reflect.Constructor<jsx3.app.Model> ctor = jsx3.app.Model.class
111:                            .getConstructor(Context.class, String.class,
112:                                    ScriptProxy.class);
113:                    return ctor.newInstance(this , extension, getScriptProxy());
114:                } catch (Exception ex) {
115:                    throw new IllegalArgumentException("Unsupported type: "
116:                            + jsx3.app.Model.class.getName());
117:                }
118:            }
119:
120:            /**
121:             * Looks up a DOM object contained in this DOM by id or name.
122:             * @param strId either the id of the object to return or its name.
123:             * @param returnType The expected return type
124:             * @return the matching DOM object or <code>null</code> if none found.
125:             */
126:            @SuppressWarnings("unchecked")
127:            public <T> T get(String strId, Class<T> returnType) {
128:                String extension = "get(\"" + strId + "\").";
129:                try {
130:                    java.lang.reflect.Constructor<T> ctor = returnType
131:                            .getConstructor(Context.class, String.class,
132:                                    ScriptProxy.class);
133:                    return ctor.newInstance(this , extension, getScriptProxy());
134:                } catch (Exception ex) {
135:                    throw new IllegalArgumentException(
136:                            "Unsupported return type: " + returnType.getName());
137:                }
138:            }
139:
140:            /**
141:             * Looks up a DOM object contained in this DOM by name. It is left to the developer to specify unique names for
142:            all DOM nodes that must be accessed in this manner. If more than one DOM nodes exist with a name of
143:            strName the behavior of this method is undefined.
144:             * @param strName the name of the object to return.
145:             * @return the matching DOM object or <code>null</code> if none found.
146:             */
147:            @SuppressWarnings("unchecked")
148:            public jsx3.app.Model getByName(String strName) {
149:                String extension = "getByName(\"" + strName + "\").";
150:                try {
151:                    java.lang.reflect.Constructor<jsx3.app.Model> ctor = jsx3.app.Model.class
152:                            .getConstructor(Context.class, String.class,
153:                                    ScriptProxy.class);
154:                    return ctor.newInstance(this , extension, getScriptProxy());
155:                } catch (Exception ex) {
156:                    throw new IllegalArgumentException("Unsupported type: "
157:                            + jsx3.app.Model.class.getName());
158:                }
159:            }
160:
161:            /**
162:             * Looks up a DOM object contained in this DOM by name. It is left to the developer to specify unique names for
163:            all DOM nodes that must be accessed in this manner. If more than one DOM nodes exist with a name of
164:            strName the behavior of this method is undefined.
165:             * @param strName the name of the object to return.
166:             * @param returnType The expected return type
167:             * @return the matching DOM object or <code>null</code> if none found.
168:             */
169:            @SuppressWarnings("unchecked")
170:            public <T> T getByName(String strName, Class<T> returnType) {
171:                String extension = "getByName(\"" + strName + "\").";
172:                try {
173:                    java.lang.reflect.Constructor<T> ctor = returnType
174:                            .getConstructor(Context.class, String.class,
175:                                    ScriptProxy.class);
176:                    return ctor.newInstance(this , extension, getScriptProxy());
177:                } catch (Exception ex) {
178:                    throw new IllegalArgumentException(
179:                            "Unsupported return type: " + returnType.getName());
180:                }
181:            }
182:
183:            /**
184:             * Returns all the DOM nodes in this DOM with a name of strName. The name index keeps a bucket of
185:            DOM nodes for each unique name. Therefore, this method performs efficiently.
186:             * @param strName the name of the objects to return.
187:             * @param callback an array of the matching DOM nodes. This return value should not be mutated as
188:            that will effect the internal functioning of this DOM.
189:             */
190:            @SuppressWarnings("unchecked")
191:            public void getAllByName(String strName,
192:                    org.directwebremoting.proxy.Callback<Object[]> callback) {
193:                ScriptBuffer script = new ScriptBuffer();
194:                String callbackPrefix = "";
195:
196:                if (callback != null) {
197:                    callbackPrefix = "var reply = ";
198:                }
199:
200:                script.appendCall(callbackPrefix + getContextPath()
201:                        + "getAllByName", strName);
202:
203:                if (callback != null) {
204:                    String key = org.directwebremoting.extend.CallbackHelper
205:                            .saveCallback(callback, Object[].class);
206:                    script
207:                            .appendCall("__System.activateCallback", key,
208:                                    "reply");
209:                }
210:
211:                getScriptProxy().addScript(script);
212:            }
213:
214:            /**
215:             * Looks up a DOM object contained in this DOM by id.
216:             * @param strId the id of the object to return.
217:             * @return the matching DOM object or <code>null</code> if none found.
218:             */
219:            @SuppressWarnings("unchecked")
220:            public jsx3.app.Model getById(String strId) {
221:                String extension = "getById(\"" + strId + "\").";
222:                try {
223:                    java.lang.reflect.Constructor<jsx3.app.Model> ctor = jsx3.app.Model.class
224:                            .getConstructor(Context.class, String.class,
225:                                    ScriptProxy.class);
226:                    return ctor.newInstance(this , extension, getScriptProxy());
227:                } catch (Exception ex) {
228:                    throw new IllegalArgumentException("Unsupported type: "
229:                            + jsx3.app.Model.class.getName());
230:                }
231:            }
232:
233:            /**
234:             * Looks up a DOM object contained in this DOM by id.
235:             * @param strId the id of the object to return.
236:             * @param returnType The expected return type
237:             * @return the matching DOM object or <code>null</code> if none found.
238:             */
239:            @SuppressWarnings("unchecked")
240:            public <T> T getById(String strId, Class<T> returnType) {
241:                String extension = "getById(\"" + strId + "\").";
242:                try {
243:                    java.lang.reflect.Constructor<T> ctor = returnType
244:                            .getConstructor(Context.class, String.class,
245:                                    ScriptProxy.class);
246:                    return ctor.newInstance(this , extension, getScriptProxy());
247:                } catch (Exception ex) {
248:                    throw new IllegalArgumentException(
249:                            "Unsupported return type: " + returnType.getName());
250:                }
251:            }
252:
253:            /**
254:             * Adds a JSX object to this DOM and indexes it by its id and name.
255:             * @param objJSX 
256:             */
257:            public void add(jsx3.app.Model objJSX) {
258:                ScriptBuffer script = new ScriptBuffer();
259:                script.appendCall(getContextPath() + "add", objJSX);
260:                getScriptProxy().addScript(script);
261:            }
262:
263:            /**
264:             * Removes a JSX object from this DOM and removes it from the indices.
265:             * @param objJSX 
266:             */
267:            public void remove(jsx3.app.Model objJSX) {
268:                ScriptBuffer script = new ScriptBuffer();
269:                script.appendCall(getContextPath() + "remove", objJSX);
270:                getScriptProxy().addScript(script);
271:            }
272:
273:            /**
274:             * A method that must be called after changing the name of a contained DOM node. This method updates the name
275:            index appropriately.
276:             * @param objJSX 
277:             * @param oldName the name before it was changed
278:             */
279:            public void onNameChange(jsx3.app.Model objJSX, String oldName) {
280:                ScriptBuffer script = new ScriptBuffer();
281:                script.appendCall(getContextPath() + "onNameChange", objJSX,
282:                        oldName);
283:                getScriptProxy().addScript(script);
284:            }
285:
286:            /**
287:             * called when a change to the JSX DOM occurs for this server instance (adopt, load, delete, etc); publishes an event object (javascript object) with the following named properties: subject (jsx3.app.DOM.EVENT_CHANGE); type (jsx3.app.DOM.TYPEADD | jsx3.app.DOM.TYPEREMOVE); parentId (id of JSX parent); jsxId (id of element added or removed)
288:             * @param TYPE one of: jsx3.app.DOM.TYPEADD, jsx3.app.DOM.TYPEREMOVE
289:             * @param JSXPARENTID id of dom parent
290:             * @param JSXID id of dom element either added or removed
291:             */
292:            public void onChange(int TYPE, String JSXPARENTID, String JSXID) {
293:                ScriptBuffer script = new ScriptBuffer();
294:                script.appendCall(getContextPath() + "onChange", TYPE,
295:                        JSXPARENTID, JSXID);
296:                getScriptProxy().addScript(script);
297:            }
298:
299:            /**
300:             * Publishes an event to all subscribed objects.
301:             * @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)
302:             * @param callback the number of listeners to which the event was broadcast
303:             */
304:            @SuppressWarnings("unchecked")
305:            public void publish(jsx3.lang.Object objEvent,
306:                    org.directwebremoting.proxy.Callback<Integer> callback) {
307:                ScriptBuffer script = new ScriptBuffer();
308:                String callbackPrefix = "";
309:
310:                if (callback != null) {
311:                    callbackPrefix = "var reply = ";
312:                }
313:
314:                script
315:                        .appendCall(callbackPrefix + getContextPath()
316:                                + "publish", objEvent);
317:
318:                if (callback != null) {
319:                    String key = org.directwebremoting.extend.CallbackHelper
320:                            .saveCallback(callback, Integer.class);
321:                    script
322:                            .appendCall("__System.activateCallback", key,
323:                                    "reply");
324:                }
325:
326:                getScriptProxy().addScript(script);
327:            }
328:
329:            /**
330:             * Subscribes an object or function to a type of event published by this object.
331:
332:            As of version 3.4 a string value for objHandler is deprecated.
333:             * @param strEventId the event type(s).
334:             * @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)
335:             * @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
336:             */
337:            public void subscribe(Object[] strEventId,
338:                    jsx3.lang.Object objHandler, String objFunction) {
339:                ScriptBuffer script = new ScriptBuffer();
340:                script.appendCall(getContextPath() + "subscribe", strEventId,
341:                        objHandler, objFunction);
342:                getScriptProxy().addScript(script);
343:            }
344:
345:            /**
346:             * Subscribes an object or function to a type of event published by this object.
347:
348:            As of version 3.4 a string value for objHandler is deprecated.
349:             * @param strEventId the event type(s).
350:             * @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)
351:             * @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
352:             */
353:            public void subscribe(Object[] strEventId,
354:                    org.directwebremoting.proxy.CodeBlock objHandler,
355:                    org.directwebremoting.proxy.CodeBlock objFunction) {
356:                ScriptBuffer script = new ScriptBuffer();
357:                script.appendCall(getContextPath() + "subscribe", strEventId,
358:                        objHandler, objFunction);
359:                getScriptProxy().addScript(script);
360:            }
361:
362:            /**
363:             * Subscribes an object or function to a type of event published by this object.
364:
365:            As of version 3.4 a string value for objHandler is deprecated.
366:             * @param strEventId the event type(s).
367:             * @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)
368:             * @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
369:             */
370:            public void subscribe(Object[] strEventId,
371:                    jsx3.lang.Object objHandler,
372:                    org.directwebremoting.proxy.CodeBlock objFunction) {
373:                ScriptBuffer script = new ScriptBuffer();
374:                script.appendCall(getContextPath() + "subscribe", strEventId,
375:                        objHandler, objFunction);
376:                getScriptProxy().addScript(script);
377:            }
378:
379:            /**
380:             * Subscribes an object or function to a type of event published by this object.
381:
382:            As of version 3.4 a string value for objHandler is deprecated.
383:             * @param strEventId the event type(s).
384:             * @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)
385:             * @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
386:             */
387:            public void subscribe(String strEventId,
388:                    org.directwebremoting.proxy.CodeBlock objHandler,
389:                    org.directwebremoting.proxy.CodeBlock objFunction) {
390:                ScriptBuffer script = new ScriptBuffer();
391:                script.appendCall(getContextPath() + "subscribe", strEventId,
392:                        objHandler, objFunction);
393:                getScriptProxy().addScript(script);
394:            }
395:
396:            /**
397:             * Subscribes an object or function to a type of event published by this object.
398:
399:            As of version 3.4 a string value for objHandler is deprecated.
400:             * @param strEventId the event type(s).
401:             * @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)
402:             * @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
403:             */
404:            public void subscribe(String strEventId,
405:                    jsx3.lang.Object objHandler,
406:                    org.directwebremoting.proxy.CodeBlock objFunction) {
407:                ScriptBuffer script = new ScriptBuffer();
408:                script.appendCall(getContextPath() + "subscribe", strEventId,
409:                        objHandler, objFunction);
410:                getScriptProxy().addScript(script);
411:            }
412:
413:            /**
414:             * Subscribes an object or function to a type of event published by this object.
415:
416:            As of version 3.4 a string value for objHandler is deprecated.
417:             * @param strEventId the event type(s).
418:             * @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)
419:             * @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
420:             */
421:            public void subscribe(String strEventId,
422:                    jsx3.lang.Object objHandler, String objFunction) {
423:                ScriptBuffer script = new ScriptBuffer();
424:                script.appendCall(getContextPath() + "subscribe", strEventId,
425:                        objHandler, objFunction);
426:                getScriptProxy().addScript(script);
427:            }
428:
429:            /**
430:             * Subscribes an object or function to a type of event published by this object.
431:
432:            As of version 3.4 a string value for objHandler is deprecated.
433:             * @param strEventId the event type(s).
434:             * @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)
435:             * @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
436:             */
437:            public void subscribe(String strEventId,
438:                    org.directwebremoting.proxy.CodeBlock objHandler,
439:                    String objFunction) {
440:                ScriptBuffer script = new ScriptBuffer();
441:                script.appendCall(getContextPath() + "subscribe", strEventId,
442:                        objHandler, objFunction);
443:                getScriptProxy().addScript(script);
444:            }
445:
446:            /**
447:             * Subscribes an object or function to a type of event published by this object.
448:
449:            As of version 3.4 a string value for objHandler is deprecated.
450:             * @param strEventId the event type(s).
451:             * @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)
452:             * @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
453:             */
454:            public void subscribe(String strEventId, String objHandler,
455:                    String objFunction) {
456:                ScriptBuffer script = new ScriptBuffer();
457:                script.appendCall(getContextPath() + "subscribe", strEventId,
458:                        objHandler, objFunction);
459:                getScriptProxy().addScript(script);
460:            }
461:
462:            /**
463:             * Subscribes an object or function to a type of event published by this object.
464:
465:            As of version 3.4 a string value for objHandler is deprecated.
466:             * @param strEventId the event type(s).
467:             * @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)
468:             * @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
469:             */
470:            public void subscribe(Object[] strEventId, String objHandler,
471:                    String objFunction) {
472:                ScriptBuffer script = new ScriptBuffer();
473:                script.appendCall(getContextPath() + "subscribe", strEventId,
474:                        objHandler, objFunction);
475:                getScriptProxy().addScript(script);
476:            }
477:
478:            /**
479:             * Subscribes an object or function to a type of event published by this object.
480:
481:            As of version 3.4 a string value for objHandler is deprecated.
482:             * @param strEventId the event type(s).
483:             * @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)
484:             * @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
485:             */
486:            public void subscribe(Object[] strEventId,
487:                    org.directwebremoting.proxy.CodeBlock objHandler,
488:                    String objFunction) {
489:                ScriptBuffer script = new ScriptBuffer();
490:                script.appendCall(getContextPath() + "subscribe", strEventId,
491:                        objHandler, objFunction);
492:                getScriptProxy().addScript(script);
493:            }
494:
495:            /**
496:             * Subscribes an object or function to a type of event published by this object.
497:
498:            As of version 3.4 a string value for objHandler is deprecated.
499:             * @param strEventId the event type(s).
500:             * @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)
501:             * @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
502:             */
503:            public void subscribe(Object[] strEventId, String objHandler,
504:                    org.directwebremoting.proxy.CodeBlock objFunction) {
505:                ScriptBuffer script = new ScriptBuffer();
506:                script.appendCall(getContextPath() + "subscribe", strEventId,
507:                        objHandler, objFunction);
508:                getScriptProxy().addScript(script);
509:            }
510:
511:            /**
512:             * Subscribes an object or function to a type of event published by this object.
513:
514:            As of version 3.4 a string value for objHandler is deprecated.
515:             * @param strEventId the event type(s).
516:             * @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)
517:             * @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
518:             */
519:            public void subscribe(String strEventId, String objHandler,
520:                    org.directwebremoting.proxy.CodeBlock objFunction) {
521:                ScriptBuffer script = new ScriptBuffer();
522:                script.appendCall(getContextPath() + "subscribe", strEventId,
523:                        objHandler, objFunction);
524:                getScriptProxy().addScript(script);
525:            }
526:
527:            /**
528:             * Unsubscribe an object or function from an event published by this object.
529:
530:            As of version 3.4 a string value for objHandler is deprecated.
531:             * @param strEventId the event type(s).
532:             * @param objHandler the value of objHandler passed to subscribe
533:             */
534:            public void unsubscribe(String strEventId, String objHandler) {
535:                ScriptBuffer script = new ScriptBuffer();
536:                script.appendCall(getContextPath() + "unsubscribe", strEventId,
537:                        objHandler);
538:                getScriptProxy().addScript(script);
539:            }
540:
541:            /**
542:             * Unsubscribe an object or function from an event published by this object.
543:
544:            As of version 3.4 a string value for objHandler is deprecated.
545:             * @param strEventId the event type(s).
546:             * @param objHandler the value of objHandler passed to subscribe
547:             */
548:            public void unsubscribe(Object[] strEventId,
549:                    jsx3.lang.Object objHandler) {
550:                ScriptBuffer script = new ScriptBuffer();
551:                script.appendCall(getContextPath() + "unsubscribe", strEventId,
552:                        objHandler);
553:                getScriptProxy().addScript(script);
554:            }
555:
556:            /**
557:             * Unsubscribe an object or function from an event published by this object.
558:
559:            As of version 3.4 a string value for objHandler is deprecated.
560:             * @param strEventId the event type(s).
561:             * @param objHandler the value of objHandler passed to subscribe
562:             */
563:            public void unsubscribe(String strEventId,
564:                    jsx3.lang.Object objHandler) {
565:                ScriptBuffer script = new ScriptBuffer();
566:                script.appendCall(getContextPath() + "unsubscribe", strEventId,
567:                        objHandler);
568:                getScriptProxy().addScript(script);
569:            }
570:
571:            /**
572:             * Unsubscribe an object or function from an event published by this object.
573:
574:            As of version 3.4 a string value for objHandler is deprecated.
575:             * @param strEventId the event type(s).
576:             * @param objHandler the value of objHandler passed to subscribe
577:             */
578:            public void unsubscribe(Object[] strEventId,
579:                    org.directwebremoting.proxy.CodeBlock objHandler) {
580:                ScriptBuffer script = new ScriptBuffer();
581:                script.appendCall(getContextPath() + "unsubscribe", strEventId,
582:                        objHandler);
583:                getScriptProxy().addScript(script);
584:            }
585:
586:            /**
587:             * Unsubscribe an object or function from an event published by this object.
588:
589:            As of version 3.4 a string value for objHandler is deprecated.
590:             * @param strEventId the event type(s).
591:             * @param objHandler the value of objHandler passed to subscribe
592:             */
593:            public void unsubscribe(Object[] strEventId, String objHandler) {
594:                ScriptBuffer script = new ScriptBuffer();
595:                script.appendCall(getContextPath() + "unsubscribe", strEventId,
596:                        objHandler);
597:                getScriptProxy().addScript(script);
598:            }
599:
600:            /**
601:             * Unsubscribe an object or function from an event published by this object.
602:
603:            As of version 3.4 a string value for objHandler is deprecated.
604:             * @param strEventId the event type(s).
605:             * @param objHandler the value of objHandler passed to subscribe
606:             */
607:            public void unsubscribe(String strEventId,
608:                    org.directwebremoting.proxy.CodeBlock objHandler) {
609:                ScriptBuffer script = new ScriptBuffer();
610:                script.appendCall(getContextPath() + "unsubscribe", strEventId,
611:                        objHandler);
612:                getScriptProxy().addScript(script);
613:            }
614:
615:            /**
616:             * Unsubscribes all subscribed objects to a type of event published by this object.
617:             * @param strEventId the event type
618:             */
619:            public void unsubscribeAll(String strEventId) {
620:                ScriptBuffer script = new ScriptBuffer();
621:                script.appendCall(getContextPath() + "unsubscribeAll",
622:                        strEventId);
623:                getScriptProxy().addScript(script);
624:            }
625:
626:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.