Source Code Cross Referenced for Sound.java in  » Ajax » dwr » jsx3 » gui » 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.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * Copyright 2005 Joe Walker
0003:         *
0004:         * Licensed under the Apache License, Version 2.0 (the "License");
0005:         * you may not use this file except in compliance with the License.
0006:         * You may obtain a copy of the License at
0007:         *
0008:         *     http://www.apache.org/licenses/LICENSE-2.0
0009:         *
0010:         * Unless required by applicable law or agreed to in writing, software
0011:         * distributed under the License is distributed on an "AS IS" BASIS,
0012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0013:         * See the License for the specific language governing permissions and
0014:         * limitations under the License.
0015:         */
0016:        package jsx3.gui;
0017:
0018:        import org.directwebremoting.ScriptBuffer;
0019:        import org.directwebremoting.proxy.ScriptProxy;
0020:        import org.directwebremoting.proxy.io.Context;
0021:
0022:        /**
0023:         * Class that provides an object-oriented interface for playing sounds in a GI application.
0024:
0025:         Note that playing sounds in Internet Explorer requires a plug-in. This class currently supports the following
0026:         sound plug-ins:
0027:
0028:         Apple Quicktime
0029:         RealPlayer
0030:         Windows Media Player
0031:
0032:         The installed plug-ins determine which sound file formats are supported.
0033:         * @author Joe Walker [joe at getahead dot org]
0034:         * @author DRAPGEN - Dwr Reverse Ajax Proxy GENerator
0035:         */
0036:        public class Sound extends jsx3.gui.Painted {
0037:            /**
0038:             * All reverse ajax proxies need context to work from
0039:             * @param scriptProxy The place we are writing scripts to
0040:             * @param context The script that got us to where we are now
0041:             */
0042:            public Sound(Context context, String extension,
0043:                    ScriptProxy scriptProxy) {
0044:                super (context, extension, scriptProxy);
0045:            }
0046:
0047:            /**
0048:             * The instance initializer.
0049:             * @param strName the JSX name
0050:             * @param strURL the URL of the sound file to play
0051:             */
0052:            public Sound(String strName, String strURL) {
0053:                super ((Context) null, (String) null, (ScriptProxy) null);
0054:                ScriptBuffer script = new ScriptBuffer();
0055:                script.appendCall("new Sound", strName, strURL);
0056:                setInitScript(script);
0057:            }
0058:
0059:            /**
0060:             * Returns the URL of the sound file.
0061:             * @param callback the URL of the sound file to play
0062:             */
0063:            @SuppressWarnings("unchecked")
0064:            public void getURL(
0065:                    org.directwebremoting.proxy.Callback<String> callback) {
0066:                ScriptBuffer script = new ScriptBuffer();
0067:                String callbackPrefix = "";
0068:
0069:                if (callback != null) {
0070:                    callbackPrefix = "var reply = ";
0071:                }
0072:
0073:                script.appendCall(callbackPrefix + getContextPath() + "getURL");
0074:
0075:                if (callback != null) {
0076:                    String key = org.directwebremoting.extend.CallbackHelper
0077:                            .saveCallback(callback, String.class);
0078:                    script
0079:                            .appendCall("__System.activateCallback", key,
0080:                                    "reply");
0081:                }
0082:
0083:                getScriptProxy().addScript(script);
0084:            }
0085:
0086:            /**
0087:             * Sets the URL of the sound file.
0088:             * @param strURL the URL of the sound file to play
0089:             * @return this object
0090:             */
0091:            public jsx3.gui.Sound setURL(String strURL) {
0092:                ScriptBuffer script = new ScriptBuffer();
0093:                script.appendCall(getContextPath() + "setURL", strURL);
0094:                getScriptProxy().addScript(script);
0095:                return this ;
0096:            }
0097:
0098:            /**
0099:             * Returns the volume that the sound plays at.
0100:             * @param callback the volume to play the sound at, [0,100]
0101:             */
0102:            @SuppressWarnings("unchecked")
0103:            public void getVolume(
0104:                    org.directwebremoting.proxy.Callback<Integer> callback) {
0105:                ScriptBuffer script = new ScriptBuffer();
0106:                String callbackPrefix = "";
0107:
0108:                if (callback != null) {
0109:                    callbackPrefix = "var reply = ";
0110:                }
0111:
0112:                script.appendCall(callbackPrefix + getContextPath()
0113:                        + "getVolume");
0114:
0115:                if (callback != null) {
0116:                    String key = org.directwebremoting.extend.CallbackHelper
0117:                            .saveCallback(callback, Integer.class);
0118:                    script
0119:                            .appendCall("__System.activateCallback", key,
0120:                                    "reply");
0121:                }
0122:
0123:                getScriptProxy().addScript(script);
0124:            }
0125:
0126:            /**
0127:             * Sets the volume of this sound. The change takes effect immediately.
0128:             * @param intVolume the volume to play the sound at. 0 is mute, 100 is loudest
0129:             * @return this object
0130:             */
0131:            public jsx3.gui.Sound setVolume(int intVolume) {
0132:                ScriptBuffer script = new ScriptBuffer();
0133:                script.appendCall(getContextPath() + "setVolume", intVolume);
0134:                getScriptProxy().addScript(script);
0135:                return this ;
0136:            }
0137:
0138:            /**
0139:             * Plays the sound.
0140:             */
0141:            public void play() {
0142:                ScriptBuffer script = new ScriptBuffer();
0143:                script.appendCall(getContextPath() + "play");
0144:                getScriptProxy().addScript(script);
0145:            }
0146:
0147:            /**
0148:             * Pauses the sound. Calling play() after calling pause() will play the sound from the
0149:            point where it was paused.
0150:             */
0151:            public void pause() {
0152:                ScriptBuffer script = new ScriptBuffer();
0153:                script.appendCall(getContextPath() + "pause");
0154:                getScriptProxy().addScript(script);
0155:            }
0156:
0157:            /**
0158:             * Stops and rewinds the sound.
0159:             */
0160:            public void rewind() {
0161:                ScriptBuffer script = new ScriptBuffer();
0162:                script.appendCall(getContextPath() + "rewind");
0163:                getScriptProxy().addScript(script);
0164:            }
0165:
0166:            /**
0167:             * Returns the length of the sound in seconds.
0168:             * @param callback the length in seconds or <code>NaN</code> if the length can not be determined
0169:             */
0170:            @SuppressWarnings("unchecked")
0171:            public void getLength(
0172:                    org.directwebremoting.proxy.Callback<Float> callback) {
0173:                ScriptBuffer script = new ScriptBuffer();
0174:                String callbackPrefix = "";
0175:
0176:                if (callback != null) {
0177:                    callbackPrefix = "var reply = ";
0178:                }
0179:
0180:                script.appendCall(callbackPrefix + getContextPath()
0181:                        + "getLength");
0182:
0183:                if (callback != null) {
0184:                    String key = org.directwebremoting.extend.CallbackHelper
0185:                            .saveCallback(callback, Float.class);
0186:                    script
0187:                            .appendCall("__System.activateCallback", key,
0188:                                    "reply");
0189:                }
0190:
0191:                getScriptProxy().addScript(script);
0192:            }
0193:
0194:            /**
0195:             * Returns the current position (elapsed time) of the sound in seconds.
0196:             * @param callback the current position in seconds or <code>NaN</code> if the position can not be determined
0197:             */
0198:            @SuppressWarnings("unchecked")
0199:            public void getPosition(
0200:                    org.directwebremoting.proxy.Callback<Float> callback) {
0201:                ScriptBuffer script = new ScriptBuffer();
0202:                String callbackPrefix = "";
0203:
0204:                if (callback != null) {
0205:                    callbackPrefix = "var reply = ";
0206:                }
0207:
0208:                script.appendCall(callbackPrefix + getContextPath()
0209:                        + "getPosition");
0210:
0211:                if (callback != null) {
0212:                    String key = org.directwebremoting.extend.CallbackHelper
0213:                            .saveCallback(callback, Float.class);
0214:                    script
0215:                            .appendCall("__System.activateCallback", key,
0216:                                    "reply");
0217:                }
0218:
0219:                getScriptProxy().addScript(script);
0220:            }
0221:
0222:            /**
0223:             * Sets the current position (elapsed time) of the sound in seconds.
0224:             * @param position the new position in seconds
0225:             */
0226:            public void setPosition(float position) {
0227:                ScriptBuffer script = new ScriptBuffer();
0228:                script.appendCall(getContextPath() + "setPosition", position);
0229:                getScriptProxy().addScript(script);
0230:            }
0231:
0232:            /**
0233:             * Returns the full name and version number of the audio plugin used to play this sound.
0234:             */
0235:            @SuppressWarnings("unchecked")
0236:            public void getPluginVersion(
0237:                    org.directwebremoting.proxy.Callback<String> callback) {
0238:                ScriptBuffer script = new ScriptBuffer();
0239:                String callbackPrefix = "";
0240:
0241:                if (callback != null) {
0242:                    callbackPrefix = "var reply = ";
0243:                }
0244:
0245:                script.appendCall(callbackPrefix + getContextPath()
0246:                        + "getPluginVersion");
0247:
0248:                if (callback != null) {
0249:                    String key = org.directwebremoting.extend.CallbackHelper
0250:                            .saveCallback(callback, String.class);
0251:                    script
0252:                            .appendCall("__System.activateCallback", key,
0253:                                    "reply");
0254:                }
0255:
0256:                getScriptProxy().addScript(script);
0257:            }
0258:
0259:            /**
0260:             * Publishes a model event. This method both evaluates any registered event script for the given event type
0261:            and publishes the event through the EventDispatcher interface. This method ensures that any
0262:            registered event script is executed in isolation to prevent most side effects.
0263:             * @param strType the event type, one of the model event types defined as static fields in this class
0264:             * @param objContext JavaScript object array with name/value pairs that provide a local
0265:            variable stack for the execution of the event script. This argument is also passed as the <code>context</code>
0266:            property of the event object that is published through the <code>EventDispatcher</code> interface.
0267:             * @return the result of evaluating the event script or <code>null</code> if not event script is registered
0268:             */
0269:            @SuppressWarnings("unchecked")
0270:            public jsx3.lang.Object doEvent(String strType,
0271:                    jsx3.lang.Object objContext) {
0272:                String extension = "doEvent(\"" + strType + "\", \""
0273:                        + objContext + "\").";
0274:                try {
0275:                    java.lang.reflect.Constructor<jsx3.lang.Object> ctor = jsx3.lang.Object.class
0276:                            .getConstructor(Context.class, String.class,
0277:                                    ScriptProxy.class);
0278:                    return ctor.newInstance(this , extension, getScriptProxy());
0279:                } catch (Exception ex) {
0280:                    throw new IllegalArgumentException("Unsupported type: "
0281:                            + jsx3.lang.Object.class.getName());
0282:                }
0283:            }
0284:
0285:            /**
0286:             * Publishes a model event. This method both evaluates any registered event script for the given event type
0287:            and publishes the event through the EventDispatcher interface. This method ensures that any
0288:            registered event script is executed in isolation to prevent most side effects.
0289:             * @param strType the event type, one of the model event types defined as static fields in this class
0290:             * @param objContext JavaScript object array with name/value pairs that provide a local
0291:            variable stack for the execution of the event script. This argument is also passed as the <code>context</code>
0292:            property of the event object that is published through the <code>EventDispatcher</code> interface.
0293:             * @param returnType The expected return type
0294:             * @return the result of evaluating the event script or <code>null</code> if not event script is registered
0295:             */
0296:            @SuppressWarnings("unchecked")
0297:            public <T> T doEvent(String strType, jsx3.lang.Object objContext,
0298:                    Class<T> returnType) {
0299:                String extension = "doEvent(\"" + strType + "\", \""
0300:                        + objContext + "\").";
0301:                try {
0302:                    java.lang.reflect.Constructor<T> ctor = returnType
0303:                            .getConstructor(Context.class, String.class,
0304:                                    ScriptProxy.class);
0305:                    return ctor.newInstance(this , extension, getScriptProxy());
0306:                } catch (Exception ex) {
0307:                    throw new IllegalArgumentException(
0308:                            "Unsupported return type: " + returnType.getName());
0309:                }
0310:            }
0311:
0312:            /**
0313:             * Returns whether is object supports programmatic drag, meanining it will allow any contained item to be
0314:            dragged and dropped on another container supporting drop.
0315:             * @param callback <code>jsx3.Boolean.TRUE</code> or <code>jsx3.Boolean.FALSE</code>
0316:             */
0317:            @SuppressWarnings("unchecked")
0318:            public void getCanDrag(
0319:                    org.directwebremoting.proxy.Callback<Integer> callback) {
0320:                ScriptBuffer script = new ScriptBuffer();
0321:                String callbackPrefix = "";
0322:
0323:                if (callback != null) {
0324:                    callbackPrefix = "var reply = ";
0325:                }
0326:
0327:                script.appendCall(callbackPrefix + getContextPath()
0328:                        + "getCanDrag");
0329:
0330:                if (callback != null) {
0331:                    String key = org.directwebremoting.extend.CallbackHelper
0332:                            .saveCallback(callback, Integer.class);
0333:                    script
0334:                            .appendCall("__System.activateCallback", key,
0335:                                    "reply");
0336:                }
0337:
0338:                getScriptProxy().addScript(script);
0339:            }
0340:
0341:            /**
0342:             * Returns whether this object can be the target of a drop event.
0343:             * @param callback <code>jsx3.Boolean.TRUE</code> or <code>jsx3.Boolean.FALSE</code>
0344:             */
0345:            @SuppressWarnings("unchecked")
0346:            public void getCanDrop(
0347:                    org.directwebremoting.proxy.Callback<Integer> callback) {
0348:                ScriptBuffer script = new ScriptBuffer();
0349:                String callbackPrefix = "";
0350:
0351:                if (callback != null) {
0352:                    callbackPrefix = "var reply = ";
0353:                }
0354:
0355:                script.appendCall(callbackPrefix + getContextPath()
0356:                        + "getCanDrop");
0357:
0358:                if (callback != null) {
0359:                    String key = org.directwebremoting.extend.CallbackHelper
0360:                            .saveCallback(callback, Integer.class);
0361:                    script
0362:                            .appendCall("__System.activateCallback", key,
0363:                                    "reply");
0364:                }
0365:
0366:                getScriptProxy().addScript(script);
0367:            }
0368:
0369:            /**
0370:             * Returns whether is object can be moved around the screen (this is not the same as drag/drop).
0371:             * @param callback <code>jsx3.Boolean.TRUE</code> or <code>jsx3.Boolean.FALSE</code>
0372:             */
0373:            @SuppressWarnings("unchecked")
0374:            public void getCanMove(
0375:                    org.directwebremoting.proxy.Callback<Integer> callback) {
0376:                ScriptBuffer script = new ScriptBuffer();
0377:                String callbackPrefix = "";
0378:
0379:                if (callback != null) {
0380:                    callbackPrefix = "var reply = ";
0381:                }
0382:
0383:                script.appendCall(callbackPrefix + getContextPath()
0384:                        + "getCanMove");
0385:
0386:                if (callback != null) {
0387:                    String key = org.directwebremoting.extend.CallbackHelper
0388:                            .saveCallback(callback, Integer.class);
0389:                    script
0390:                            .appendCall("__System.activateCallback", key,
0391:                                    "reply");
0392:                }
0393:
0394:                getScriptProxy().addScript(script);
0395:            }
0396:
0397:            /**
0398:             * Returns whether is object can be spyglassed.
0399:             * @param callback <code>jsx3.Boolean.TRUE</code> or <code>jsx3.Boolean.FALSE</code>
0400:             */
0401:            @SuppressWarnings("unchecked")
0402:            public void getCanSpy(
0403:                    org.directwebremoting.proxy.Callback<Integer> callback) {
0404:                ScriptBuffer script = new ScriptBuffer();
0405:                String callbackPrefix = "";
0406:
0407:                if (callback != null) {
0408:                    callbackPrefix = "var reply = ";
0409:                }
0410:
0411:                script.appendCall(callbackPrefix + getContextPath()
0412:                        + "getCanSpy");
0413:
0414:                if (callback != null) {
0415:                    String key = org.directwebremoting.extend.CallbackHelper
0416:                            .saveCallback(callback, Integer.class);
0417:                    script
0418:                            .appendCall("__System.activateCallback", key,
0419:                                    "reply");
0420:                }
0421:
0422:                getScriptProxy().addScript(script);
0423:            }
0424:
0425:            /**
0426:             * Returns the event script registered for the given event type. This script could have been set by the
0427:            setEvent() method or during component deserialization.
0428:             * @param strType the event type, one of the model event types defined as static fields in this class
0429:             * @param callback the JavaScript event script
0430:             */
0431:            @SuppressWarnings("unchecked")
0432:            public void getEvent(String strType,
0433:                    org.directwebremoting.proxy.Callback<String> callback) {
0434:                ScriptBuffer script = new ScriptBuffer();
0435:                String callbackPrefix = "";
0436:
0437:                if (callback != null) {
0438:                    callbackPrefix = "var reply = ";
0439:                }
0440:
0441:                script.appendCall(callbackPrefix + getContextPath()
0442:                        + "getEvent", strType);
0443:
0444:                if (callback != null) {
0445:                    String key = org.directwebremoting.extend.CallbackHelper
0446:                            .saveCallback(callback, String.class);
0447:                    script
0448:                            .appendCall("__System.activateCallback", key,
0449:                                    "reply");
0450:                }
0451:
0452:                getScriptProxy().addScript(script);
0453:            }
0454:
0455:            /**
0456:             * Returns the associative array containing all the registered event script of this object. This method returns
0457:            the instance field itself and not a copy.
0458:             * @return an associative array mapping event type to event script
0459:             */
0460:            @SuppressWarnings("unchecked")
0461:            public jsx3.lang.Object getEvents() {
0462:                String extension = "getEvents().";
0463:                try {
0464:                    java.lang.reflect.Constructor<jsx3.lang.Object> ctor = jsx3.lang.Object.class
0465:                            .getConstructor(Context.class, String.class,
0466:                                    ScriptProxy.class);
0467:                    return ctor.newInstance(this , extension, getScriptProxy());
0468:                } catch (Exception ex) {
0469:                    throw new IllegalArgumentException("Unsupported type: "
0470:                            + jsx3.lang.Object.class.getName());
0471:                }
0472:            }
0473:
0474:            /**
0475:             * Returns the associative array containing all the registered event script of this object. This method returns
0476:            the instance field itself and not a copy.
0477:             * @param returnType The expected return type
0478:             * @return an associative array mapping event type to event script
0479:             */
0480:            @SuppressWarnings("unchecked")
0481:            public <T> T getEvents(Class<T> returnType) {
0482:                String extension = "getEvents().";
0483:                try {
0484:                    java.lang.reflect.Constructor<T> ctor = returnType
0485:                            .getConstructor(Context.class, String.class,
0486:                                    ScriptProxy.class);
0487:                    return ctor.newInstance(this , extension, getScriptProxy());
0488:                } catch (Exception ex) {
0489:                    throw new IllegalArgumentException(
0490:                            "Unsupported return type: " + returnType.getName());
0491:                }
0492:            }
0493:
0494:            /**
0495:             * Returns the name of the jsx3.gui.Menu instance to display (as a context menu) when a user
0496:            clicks on this object with the right button.
0497:             */
0498:            @SuppressWarnings("unchecked")
0499:            public void getMenu(
0500:                    org.directwebremoting.proxy.Callback<String> callback) {
0501:                ScriptBuffer script = new ScriptBuffer();
0502:                String callbackPrefix = "";
0503:
0504:                if (callback != null) {
0505:                    callbackPrefix = "var reply = ";
0506:                }
0507:
0508:                script
0509:                        .appendCall(callbackPrefix + getContextPath()
0510:                                + "getMenu");
0511:
0512:                if (callback != null) {
0513:                    String key = org.directwebremoting.extend.CallbackHelper
0514:                            .saveCallback(callback, String.class);
0515:                    script
0516:                            .appendCall("__System.activateCallback", key,
0517:                                    "reply");
0518:                }
0519:
0520:                getScriptProxy().addScript(script);
0521:            }
0522:
0523:            /**
0524:             * Returns true if there is a event script registered for the given event type.
0525:             * @param strType the event type, one of the model event types defined as static fields in this class
0526:             * @param callback the JavaScript event script
0527:             */
0528:            @SuppressWarnings("unchecked")
0529:            public void hasEvent(String strType,
0530:                    org.directwebremoting.proxy.Callback<String> callback) {
0531:                ScriptBuffer script = new ScriptBuffer();
0532:                String callbackPrefix = "";
0533:
0534:                if (callback != null) {
0535:                    callbackPrefix = "var reply = ";
0536:                }
0537:
0538:                script.appendCall(callbackPrefix + getContextPath()
0539:                        + "hasEvent", strType);
0540:
0541:                if (callback != null) {
0542:                    String key = org.directwebremoting.extend.CallbackHelper
0543:                            .saveCallback(callback, String.class);
0544:                    script
0545:                            .appendCall("__System.activateCallback", key,
0546:                                    "reply");
0547:                }
0548:
0549:                getScriptProxy().addScript(script);
0550:            }
0551:
0552:            /**
0553:             * Registers a hot key with this JSX model node. All keydown events that bubble up to this object
0554:            will be checked against the hot key. If an event matches, the callback function will execute and the event
0555:            bubble will be canceled.
0556:
0557:            If the four parameters vntKey, bShift, bControl, and bAlt
0558:            match a previously registered hot key, the previous hot key is clobbered by the new one. Only one hot key callback
0559:            function (the most recently registered) will be executed by a single keydown event.
0560:             * @param vntCallback either a function, or the name of a method bound to this object.
0561:            When a keydown event bubbles up to this object that matches the hot key created by this method, this function
0562:            is called on this object. If this function returns <code>false</code> then this hot key will not cancel the
0563:            key event. This parameter can also be an instance of <code>HotKey</code>, in which case all
0564:            other parameters are ignored.
0565:             * @param vntKey if this parameter is a String, the hot key matches that key (the keycode to match is
0566:            determined by <code>HotKey.keyDownCharToCode()</code>). If it is an integer, the hot key will match that
0567:            keycode value.
0568:             * @param bShift if not <code>null</code> the shift key state of the keydown event must match this value
0569:            to invoke the hot key.
0570:             * @param bControl if not <code>null</code> the control key state of the keydown event must match this value
0571:            to invoke the hot key.
0572:             * @param bAlt if not <code>null</code> the alt key state of the keydown event must match this value
0573:            to invoke the hot key.
0574:             * @return the registered hot key.
0575:             */
0576:            @SuppressWarnings("unchecked")
0577:            public jsx3.gui.HotKey registerHotKey(jsx3.gui.HotKey vntCallback,
0578:                    String vntKey, boolean bShift, boolean bControl,
0579:                    boolean bAlt) {
0580:                String extension = "registerHotKey(\"" + vntCallback + "\", \""
0581:                        + vntKey + "\", \"" + bShift + "\", \"" + bControl
0582:                        + "\", \"" + bAlt + "\").";
0583:                try {
0584:                    java.lang.reflect.Constructor<jsx3.gui.HotKey> ctor = jsx3.gui.HotKey.class
0585:                            .getConstructor(Context.class, String.class,
0586:                                    ScriptProxy.class);
0587:                    return ctor.newInstance(this , extension, getScriptProxy());
0588:                } catch (Exception ex) {
0589:                    throw new IllegalArgumentException("Unsupported type: "
0590:                            + jsx3.gui.HotKey.class.getName());
0591:                }
0592:            }
0593:
0594:            /**
0595:             * Registers a hot key with this JSX model node. All keydown events that bubble up to this object
0596:            will be checked against the hot key. If an event matches, the callback function will execute and the event
0597:            bubble will be canceled.
0598:
0599:            If the four parameters vntKey, bShift, bControl, and bAlt
0600:            match a previously registered hot key, the previous hot key is clobbered by the new one. Only one hot key callback
0601:            function (the most recently registered) will be executed by a single keydown event.
0602:             * @param vntCallback either a function, or the name of a method bound to this object.
0603:            When a keydown event bubbles up to this object that matches the hot key created by this method, this function
0604:            is called on this object. If this function returns <code>false</code> then this hot key will not cancel the
0605:            key event. This parameter can also be an instance of <code>HotKey</code>, in which case all
0606:            other parameters are ignored.
0607:             * @param vntKey if this parameter is a String, the hot key matches that key (the keycode to match is
0608:            determined by <code>HotKey.keyDownCharToCode()</code>). If it is an integer, the hot key will match that
0609:            keycode value.
0610:             * @param bShift if not <code>null</code> the shift key state of the keydown event must match this value
0611:            to invoke the hot key.
0612:             * @param bControl if not <code>null</code> the control key state of the keydown event must match this value
0613:            to invoke the hot key.
0614:             * @param bAlt if not <code>null</code> the alt key state of the keydown event must match this value
0615:            to invoke the hot key.
0616:             * @return the registered hot key.
0617:             */
0618:            @SuppressWarnings("unchecked")
0619:            public jsx3.gui.HotKey registerHotKey(
0620:                    org.directwebremoting.proxy.CodeBlock vntCallback,
0621:                    String vntKey, boolean bShift, boolean bControl,
0622:                    boolean bAlt) {
0623:                String extension = "registerHotKey(\"" + vntCallback + "\", \""
0624:                        + vntKey + "\", \"" + bShift + "\", \"" + bControl
0625:                        + "\", \"" + bAlt + "\").";
0626:                try {
0627:                    java.lang.reflect.Constructor<jsx3.gui.HotKey> ctor = jsx3.gui.HotKey.class
0628:                            .getConstructor(Context.class, String.class,
0629:                                    ScriptProxy.class);
0630:                    return ctor.newInstance(this , extension, getScriptProxy());
0631:                } catch (Exception ex) {
0632:                    throw new IllegalArgumentException("Unsupported type: "
0633:                            + jsx3.gui.HotKey.class.getName());
0634:                }
0635:            }
0636:
0637:            /**
0638:             * Registers a hot key with this JSX model node. All keydown events that bubble up to this object
0639:            will be checked against the hot key. If an event matches, the callback function will execute and the event
0640:            bubble will be canceled.
0641:
0642:            If the four parameters vntKey, bShift, bControl, and bAlt
0643:            match a previously registered hot key, the previous hot key is clobbered by the new one. Only one hot key callback
0644:            function (the most recently registered) will be executed by a single keydown event.
0645:             * @param vntCallback either a function, or the name of a method bound to this object.
0646:            When a keydown event bubbles up to this object that matches the hot key created by this method, this function
0647:            is called on this object. If this function returns <code>false</code> then this hot key will not cancel the
0648:            key event. This parameter can also be an instance of <code>HotKey</code>, in which case all
0649:            other parameters are ignored.
0650:             * @param vntKey if this parameter is a String, the hot key matches that key (the keycode to match is
0651:            determined by <code>HotKey.keyDownCharToCode()</code>). If it is an integer, the hot key will match that
0652:            keycode value.
0653:             * @param bShift if not <code>null</code> the shift key state of the keydown event must match this value
0654:            to invoke the hot key.
0655:             * @param bControl if not <code>null</code> the control key state of the keydown event must match this value
0656:            to invoke the hot key.
0657:             * @param bAlt if not <code>null</code> the alt key state of the keydown event must match this value
0658:            to invoke the hot key.
0659:             * @return the registered hot key.
0660:             */
0661:            @SuppressWarnings("unchecked")
0662:            public jsx3.gui.HotKey registerHotKey(String vntCallback,
0663:                    int vntKey, boolean bShift, boolean bControl, boolean bAlt) {
0664:                String extension = "registerHotKey(\"" + vntCallback + "\", \""
0665:                        + vntKey + "\", \"" + bShift + "\", \"" + bControl
0666:                        + "\", \"" + bAlt + "\").";
0667:                try {
0668:                    java.lang.reflect.Constructor<jsx3.gui.HotKey> ctor = jsx3.gui.HotKey.class
0669:                            .getConstructor(Context.class, String.class,
0670:                                    ScriptProxy.class);
0671:                    return ctor.newInstance(this , extension, getScriptProxy());
0672:                } catch (Exception ex) {
0673:                    throw new IllegalArgumentException("Unsupported type: "
0674:                            + jsx3.gui.HotKey.class.getName());
0675:                }
0676:            }
0677:
0678:            /**
0679:             * Registers a hot key with this JSX model node. All keydown events that bubble up to this object
0680:            will be checked against the hot key. If an event matches, the callback function will execute and the event
0681:            bubble will be canceled.
0682:
0683:            If the four parameters vntKey, bShift, bControl, and bAlt
0684:            match a previously registered hot key, the previous hot key is clobbered by the new one. Only one hot key callback
0685:            function (the most recently registered) will be executed by a single keydown event.
0686:             * @param vntCallback either a function, or the name of a method bound to this object.
0687:            When a keydown event bubbles up to this object that matches the hot key created by this method, this function
0688:            is called on this object. If this function returns <code>false</code> then this hot key will not cancel the
0689:            key event. This parameter can also be an instance of <code>HotKey</code>, in which case all
0690:            other parameters are ignored.
0691:             * @param vntKey if this parameter is a String, the hot key matches that key (the keycode to match is
0692:            determined by <code>HotKey.keyDownCharToCode()</code>). If it is an integer, the hot key will match that
0693:            keycode value.
0694:             * @param bShift if not <code>null</code> the shift key state of the keydown event must match this value
0695:            to invoke the hot key.
0696:             * @param bControl if not <code>null</code> the control key state of the keydown event must match this value
0697:            to invoke the hot key.
0698:             * @param bAlt if not <code>null</code> the alt key state of the keydown event must match this value
0699:            to invoke the hot key.
0700:             * @return the registered hot key.
0701:             */
0702:            @SuppressWarnings("unchecked")
0703:            public jsx3.gui.HotKey registerHotKey(String vntCallback,
0704:                    String vntKey, boolean bShift, boolean bControl,
0705:                    boolean bAlt) {
0706:                String extension = "registerHotKey(\"" + vntCallback + "\", \""
0707:                        + vntKey + "\", \"" + bShift + "\", \"" + bControl
0708:                        + "\", \"" + bAlt + "\").";
0709:                try {
0710:                    java.lang.reflect.Constructor<jsx3.gui.HotKey> ctor = jsx3.gui.HotKey.class
0711:                            .getConstructor(Context.class, String.class,
0712:                                    ScriptProxy.class);
0713:                    return ctor.newInstance(this , extension, getScriptProxy());
0714:                } catch (Exception ex) {
0715:                    throw new IllegalArgumentException("Unsupported type: "
0716:                            + jsx3.gui.HotKey.class.getName());
0717:                }
0718:            }
0719:
0720:            /**
0721:             * Registers a hot key with this JSX model node. All keydown events that bubble up to this object
0722:            will be checked against the hot key. If an event matches, the callback function will execute and the event
0723:            bubble will be canceled.
0724:
0725:            If the four parameters vntKey, bShift, bControl, and bAlt
0726:            match a previously registered hot key, the previous hot key is clobbered by the new one. Only one hot key callback
0727:            function (the most recently registered) will be executed by a single keydown event.
0728:             * @param vntCallback either a function, or the name of a method bound to this object.
0729:            When a keydown event bubbles up to this object that matches the hot key created by this method, this function
0730:            is called on this object. If this function returns <code>false</code> then this hot key will not cancel the
0731:            key event. This parameter can also be an instance of <code>HotKey</code>, in which case all
0732:            other parameters are ignored.
0733:             * @param vntKey if this parameter is a String, the hot key matches that key (the keycode to match is
0734:            determined by <code>HotKey.keyDownCharToCode()</code>). If it is an integer, the hot key will match that
0735:            keycode value.
0736:             * @param bShift if not <code>null</code> the shift key state of the keydown event must match this value
0737:            to invoke the hot key.
0738:             * @param bControl if not <code>null</code> the control key state of the keydown event must match this value
0739:            to invoke the hot key.
0740:             * @param bAlt if not <code>null</code> the alt key state of the keydown event must match this value
0741:            to invoke the hot key.
0742:             * @return the registered hot key.
0743:             */
0744:            @SuppressWarnings("unchecked")
0745:            public jsx3.gui.HotKey registerHotKey(jsx3.gui.HotKey vntCallback,
0746:                    int vntKey, boolean bShift, boolean bControl, boolean bAlt) {
0747:                String extension = "registerHotKey(\"" + vntCallback + "\", \""
0748:                        + vntKey + "\", \"" + bShift + "\", \"" + bControl
0749:                        + "\", \"" + bAlt + "\").";
0750:                try {
0751:                    java.lang.reflect.Constructor<jsx3.gui.HotKey> ctor = jsx3.gui.HotKey.class
0752:                            .getConstructor(Context.class, String.class,
0753:                                    ScriptProxy.class);
0754:                    return ctor.newInstance(this , extension, getScriptProxy());
0755:                } catch (Exception ex) {
0756:                    throw new IllegalArgumentException("Unsupported type: "
0757:                            + jsx3.gui.HotKey.class.getName());
0758:                }
0759:            }
0760:
0761:            /**
0762:             * Registers a hot key with this JSX model node. All keydown events that bubble up to this object
0763:            will be checked against the hot key. If an event matches, the callback function will execute and the event
0764:            bubble will be canceled.
0765:
0766:            If the four parameters vntKey, bShift, bControl, and bAlt
0767:            match a previously registered hot key, the previous hot key is clobbered by the new one. Only one hot key callback
0768:            function (the most recently registered) will be executed by a single keydown event.
0769:             * @param vntCallback either a function, or the name of a method bound to this object.
0770:            When a keydown event bubbles up to this object that matches the hot key created by this method, this function
0771:            is called on this object. If this function returns <code>false</code> then this hot key will not cancel the
0772:            key event. This parameter can also be an instance of <code>HotKey</code>, in which case all
0773:            other parameters are ignored.
0774:             * @param vntKey if this parameter is a String, the hot key matches that key (the keycode to match is
0775:            determined by <code>HotKey.keyDownCharToCode()</code>). If it is an integer, the hot key will match that
0776:            keycode value.
0777:             * @param bShift if not <code>null</code> the shift key state of the keydown event must match this value
0778:            to invoke the hot key.
0779:             * @param bControl if not <code>null</code> the control key state of the keydown event must match this value
0780:            to invoke the hot key.
0781:             * @param bAlt if not <code>null</code> the alt key state of the keydown event must match this value
0782:            to invoke the hot key.
0783:             * @return the registered hot key.
0784:             */
0785:            @SuppressWarnings("unchecked")
0786:            public jsx3.gui.HotKey registerHotKey(
0787:                    org.directwebremoting.proxy.CodeBlock vntCallback,
0788:                    int vntKey, boolean bShift, boolean bControl, boolean bAlt) {
0789:                String extension = "registerHotKey(\"" + vntCallback + "\", \""
0790:                        + vntKey + "\", \"" + bShift + "\", \"" + bControl
0791:                        + "\", \"" + bAlt + "\").";
0792:                try {
0793:                    java.lang.reflect.Constructor<jsx3.gui.HotKey> ctor = jsx3.gui.HotKey.class
0794:                            .getConstructor(Context.class, String.class,
0795:                                    ScriptProxy.class);
0796:                    return ctor.newInstance(this , extension, getScriptProxy());
0797:                } catch (Exception ex) {
0798:                    throw new IllegalArgumentException("Unsupported type: "
0799:                            + jsx3.gui.HotKey.class.getName());
0800:                }
0801:            }
0802:
0803:            /**
0804:             * Removes an event script registered for the given model event type.
0805:             * @param strType the event type, one of the model event types defined as static fields in this class
0806:             * @return this object
0807:             */
0808:            @SuppressWarnings("unchecked")
0809:            public jsx3.gui.Interactive removeEvent(String strType) {
0810:                String extension = "removeEvent(\"" + strType + "\").";
0811:                try {
0812:                    java.lang.reflect.Constructor<jsx3.gui.Interactive> ctor = jsx3.gui.Interactive.class
0813:                            .getConstructor(Context.class, String.class,
0814:                                    ScriptProxy.class);
0815:                    return ctor.newInstance(this , extension, getScriptProxy());
0816:                } catch (Exception ex) {
0817:                    throw new IllegalArgumentException("Unsupported type: "
0818:                            + jsx3.gui.Interactive.class.getName());
0819:                }
0820:            }
0821:
0822:            /**
0823:             * Removes an event script registered for the given model event type.
0824:             * @param strType the event type, one of the model event types defined as static fields in this class
0825:             * @param returnType The expected return type
0826:             * @return this object
0827:             */
0828:            @SuppressWarnings("unchecked")
0829:            public <T> T removeEvent(String strType, Class<T> returnType) {
0830:                String extension = "removeEvent(\"" + strType + "\").";
0831:                try {
0832:                    java.lang.reflect.Constructor<T> ctor = returnType
0833:                            .getConstructor(Context.class, String.class,
0834:                                    ScriptProxy.class);
0835:                    return ctor.newInstance(this , extension, getScriptProxy());
0836:                } catch (Exception ex) {
0837:                    throw new IllegalArgumentException(
0838:                            "Unsupported return type: " + returnType.getName());
0839:                }
0840:            }
0841:
0842:            /**
0843:             * Removes all events scripts registered with this object.
0844:             * @return this object
0845:             */
0846:            @SuppressWarnings("unchecked")
0847:            public jsx3.gui.Interactive removeEvents() {
0848:                String extension = "removeEvents().";
0849:                try {
0850:                    java.lang.reflect.Constructor<jsx3.gui.Interactive> ctor = jsx3.gui.Interactive.class
0851:                            .getConstructor(Context.class, String.class,
0852:                                    ScriptProxy.class);
0853:                    return ctor.newInstance(this , extension, getScriptProxy());
0854:                } catch (Exception ex) {
0855:                    throw new IllegalArgumentException("Unsupported type: "
0856:                            + jsx3.gui.Interactive.class.getName());
0857:                }
0858:            }
0859:
0860:            /**
0861:             * Removes all events scripts registered with this object.
0862:             * @param returnType The expected return type
0863:             * @return this object
0864:             */
0865:            @SuppressWarnings("unchecked")
0866:            public <T> T removeEvents(Class<T> returnType) {
0867:                String extension = "removeEvents().";
0868:                try {
0869:                    java.lang.reflect.Constructor<T> ctor = returnType
0870:                            .getConstructor(Context.class, String.class,
0871:                                    ScriptProxy.class);
0872:                    return ctor.newInstance(this , extension, getScriptProxy());
0873:                } catch (Exception ex) {
0874:                    throw new IllegalArgumentException(
0875:                            "Unsupported return type: " + returnType.getName());
0876:                }
0877:            }
0878:
0879:            /**
0880:             * Sets whether is object supports programmatic drag, meanining it will allow any contained item to be dragged/dropped.
0881:            Implementing classes can decide whether to consult this value or ignore it.
0882:             * @param bDrag <code>jsx3.Boolean.TRUE</code> or <code>jsx3.Boolean.FALSE</code>
0883:             * @return this object
0884:             */
0885:            @SuppressWarnings("unchecked")
0886:            public jsx3.gui.Interactive setCanDrag(int bDrag) {
0887:                String extension = "setCanDrag(\"" + bDrag + "\").";
0888:                try {
0889:                    java.lang.reflect.Constructor<jsx3.gui.Interactive> ctor = jsx3.gui.Interactive.class
0890:                            .getConstructor(Context.class, String.class,
0891:                                    ScriptProxy.class);
0892:                    return ctor.newInstance(this , extension, getScriptProxy());
0893:                } catch (Exception ex) {
0894:                    throw new IllegalArgumentException("Unsupported type: "
0895:                            + jsx3.gui.Interactive.class.getName());
0896:                }
0897:            }
0898:
0899:            /**
0900:             * Sets whether is object supports programmatic drag, meanining it will allow any contained item to be dragged/dropped.
0901:            Implementing classes can decide whether to consult this value or ignore it.
0902:             * @param bDrag <code>jsx3.Boolean.TRUE</code> or <code>jsx3.Boolean.FALSE</code>
0903:             * @param returnType The expected return type
0904:             * @return this object
0905:             */
0906:            @SuppressWarnings("unchecked")
0907:            public <T> T setCanDrag(int bDrag, Class<T> returnType) {
0908:                String extension = "setCanDrag(\"" + bDrag + "\").";
0909:                try {
0910:                    java.lang.reflect.Constructor<T> ctor = returnType
0911:                            .getConstructor(Context.class, String.class,
0912:                                    ScriptProxy.class);
0913:                    return ctor.newInstance(this , extension, getScriptProxy());
0914:                } catch (Exception ex) {
0915:                    throw new IllegalArgumentException(
0916:                            "Unsupported return type: " + returnType.getName());
0917:                }
0918:            }
0919:
0920:            /**
0921:             * Sets whether this object can be the target of a drop event. Implementing classes can decide whether to consult
0922:            this value or ignore it.
0923:             * @param bDrop <code>jsx3.Boolean.TRUE</code> or <code>jsx3.Boolean.FALSE</code>
0924:             * @return this object
0925:             */
0926:            @SuppressWarnings("unchecked")
0927:            public jsx3.gui.Interactive setCanDrop(int bDrop) {
0928:                String extension = "setCanDrop(\"" + bDrop + "\").";
0929:                try {
0930:                    java.lang.reflect.Constructor<jsx3.gui.Interactive> ctor = jsx3.gui.Interactive.class
0931:                            .getConstructor(Context.class, String.class,
0932:                                    ScriptProxy.class);
0933:                    return ctor.newInstance(this , extension, getScriptProxy());
0934:                } catch (Exception ex) {
0935:                    throw new IllegalArgumentException("Unsupported type: "
0936:                            + jsx3.gui.Interactive.class.getName());
0937:                }
0938:            }
0939:
0940:            /**
0941:             * Sets whether this object can be the target of a drop event. Implementing classes can decide whether to consult
0942:            this value or ignore it.
0943:             * @param bDrop <code>jsx3.Boolean.TRUE</code> or <code>jsx3.Boolean.FALSE</code>
0944:             * @param returnType The expected return type
0945:             * @return this object
0946:             */
0947:            @SuppressWarnings("unchecked")
0948:            public <T> T setCanDrop(int bDrop, Class<T> returnType) {
0949:                String extension = "setCanDrop(\"" + bDrop + "\").";
0950:                try {
0951:                    java.lang.reflect.Constructor<T> ctor = returnType
0952:                            .getConstructor(Context.class, String.class,
0953:                                    ScriptProxy.class);
0954:                    return ctor.newInstance(this , extension, getScriptProxy());
0955:                } catch (Exception ex) {
0956:                    throw new IllegalArgumentException(
0957:                            "Unsupported return type: " + returnType.getName());
0958:                }
0959:            }
0960:
0961:            /**
0962:             * Sets whether is object can be moved around the screen (this is not the same as drag/drop). Implementing classes
0963:            can decide whether to consult this value or ignore it.
0964:             * @param bMovable <code>jsx3.Boolean.TRUE</code> or <code>jsx3.Boolean.FALSE</code>
0965:             * @return this object
0966:             */
0967:            @SuppressWarnings("unchecked")
0968:            public jsx3.gui.Interactive setCanMove(int bMovable) {
0969:                String extension = "setCanMove(\"" + bMovable + "\").";
0970:                try {
0971:                    java.lang.reflect.Constructor<jsx3.gui.Interactive> ctor = jsx3.gui.Interactive.class
0972:                            .getConstructor(Context.class, String.class,
0973:                                    ScriptProxy.class);
0974:                    return ctor.newInstance(this , extension, getScriptProxy());
0975:                } catch (Exception ex) {
0976:                    throw new IllegalArgumentException("Unsupported type: "
0977:                            + jsx3.gui.Interactive.class.getName());
0978:                }
0979:            }
0980:
0981:            /**
0982:             * Sets whether is object can be moved around the screen (this is not the same as drag/drop). Implementing classes
0983:            can decide whether to consult this value or ignore it.
0984:             * @param bMovable <code>jsx3.Boolean.TRUE</code> or <code>jsx3.Boolean.FALSE</code>
0985:             * @param returnType The expected return type
0986:             * @return this object
0987:             */
0988:            @SuppressWarnings("unchecked")
0989:            public <T> T setCanMove(int bMovable, Class<T> returnType) {
0990:                String extension = "setCanMove(\"" + bMovable + "\").";
0991:                try {
0992:                    java.lang.reflect.Constructor<T> ctor = returnType
0993:                            .getConstructor(Context.class, String.class,
0994:                                    ScriptProxy.class);
0995:                    return ctor.newInstance(this , extension, getScriptProxy());
0996:                } catch (Exception ex) {
0997:                    throw new IllegalArgumentException(
0998:                            "Unsupported return type: " + returnType.getName());
0999:                }
1000:            }
1001:
1002:            /**
1003:             * Sets whether is object can be spyglassed. Implementing classes can decide whether to consult
1004:            this value or ignore it.
1005:             * @param bSpy <code>jsx3.Boolean.TRUE</code> or <code>jsx3.Boolean.FALSE</code>
1006:             * @return this object
1007:             */
1008:            @SuppressWarnings("unchecked")
1009:            public jsx3.gui.Interactive setCanSpy(int bSpy) {
1010:                String extension = "setCanSpy(\"" + bSpy + "\").";
1011:                try {
1012:                    java.lang.reflect.Constructor<jsx3.gui.Interactive> ctor = jsx3.gui.Interactive.class
1013:                            .getConstructor(Context.class, String.class,
1014:                                    ScriptProxy.class);
1015:                    return ctor.newInstance(this , extension, getScriptProxy());
1016:                } catch (Exception ex) {
1017:                    throw new IllegalArgumentException("Unsupported type: "
1018:                            + jsx3.gui.Interactive.class.getName());
1019:                }
1020:            }
1021:
1022:            /**
1023:             * Sets whether is object can be spyglassed. Implementing classes can decide whether to consult
1024:            this value or ignore it.
1025:             * @param bSpy <code>jsx3.Boolean.TRUE</code> or <code>jsx3.Boolean.FALSE</code>
1026:             * @param returnType The expected return type
1027:             * @return this object
1028:             */
1029:            @SuppressWarnings("unchecked")
1030:            public <T> T setCanSpy(int bSpy, Class<T> returnType) {
1031:                String extension = "setCanSpy(\"" + bSpy + "\").";
1032:                try {
1033:                    java.lang.reflect.Constructor<T> ctor = returnType
1034:                            .getConstructor(Context.class, String.class,
1035:                                    ScriptProxy.class);
1036:                    return ctor.newInstance(this , extension, getScriptProxy());
1037:                } catch (Exception ex) {
1038:                    throw new IllegalArgumentException(
1039:                            "Unsupported return type: " + returnType.getName());
1040:                }
1041:            }
1042:
1043:            /**
1044:             * Programmatically sets an event of this instance. Sets the script that will execute when this object publishes
1045:            a model event. The script value will be saved in the serialization file of a component. Not all classes that
1046:            implement this interface will publish events of every type. Consult the documentation of a class for a
1047:            description of the events it publishes.
1048:
1049:            For programmatic registering of event handlers when persistence in a serialization file is not required,
1050:            consider using jsx3.util.EventDispatcher.subscribe() instead of this method. Whenever a model
1051:            event is published, it is published using the EventDispatcher interface as well as by executing
1052:            any registered event script.
1053:             * @param strScript the actual JavaScript code that will execute when the given event is published.
1054:            For example: <code>obj.setEvent("alert('hello.');", jsx3.gui.Interactive.EXECUTE);</code>
1055:             * @param strType the event type. Must be one of the model event types defined as static fields in this class
1056:             * @return reference to this
1057:             */
1058:            @SuppressWarnings("unchecked")
1059:            public jsx3.gui.Interactive setEvent(String strScript,
1060:                    String strType) {
1061:                String extension = "setEvent(\"" + strScript + "\", \""
1062:                        + strType + "\").";
1063:                try {
1064:                    java.lang.reflect.Constructor<jsx3.gui.Interactive> ctor = jsx3.gui.Interactive.class
1065:                            .getConstructor(Context.class, String.class,
1066:                                    ScriptProxy.class);
1067:                    return ctor.newInstance(this , extension, getScriptProxy());
1068:                } catch (Exception ex) {
1069:                    throw new IllegalArgumentException("Unsupported type: "
1070:                            + jsx3.gui.Interactive.class.getName());
1071:                }
1072:            }
1073:
1074:            /**
1075:             * Programmatically sets an event of this instance. Sets the script that will execute when this object publishes
1076:            a model event. The script value will be saved in the serialization file of a component. Not all classes that
1077:            implement this interface will publish events of every type. Consult the documentation of a class for a
1078:            description of the events it publishes.
1079:
1080:            For programmatic registering of event handlers when persistence in a serialization file is not required,
1081:            consider using jsx3.util.EventDispatcher.subscribe() instead of this method. Whenever a model
1082:            event is published, it is published using the EventDispatcher interface as well as by executing
1083:            any registered event script.
1084:             * @param strScript the actual JavaScript code that will execute when the given event is published.
1085:            For example: <code>obj.setEvent("alert('hello.');", jsx3.gui.Interactive.EXECUTE);</code>
1086:             * @param strType the event type. Must be one of the model event types defined as static fields in this class
1087:             * @param returnType The expected return type
1088:             * @return reference to this
1089:             */
1090:            @SuppressWarnings("unchecked")
1091:            public <T> T setEvent(String strScript, String strType,
1092:                    Class<T> returnType) {
1093:                String extension = "setEvent(\"" + strScript + "\", \""
1094:                        + strType + "\").";
1095:                try {
1096:                    java.lang.reflect.Constructor<T> ctor = returnType
1097:                            .getConstructor(Context.class, String.class,
1098:                                    ScriptProxy.class);
1099:                    return ctor.newInstance(this , extension, getScriptProxy());
1100:                } catch (Exception ex) {
1101:                    throw new IllegalArgumentException(
1102:                            "Unsupported return type: " + returnType.getName());
1103:                }
1104:            }
1105:
1106:            /**
1107:             * Sets the name of the jsx3.gui.Menu instance to display when a user
1108:            clicks on this object with the right button. The name is a pointer by-name to a JSX object in the same server.
1109:             * @param strMenu name or id (jsxname or jsxid) of the context menu
1110:             * @return this object
1111:             */
1112:            @SuppressWarnings("unchecked")
1113:            public jsx3.gui.Interactive setMenu(String strMenu) {
1114:                String extension = "setMenu(\"" + strMenu + "\").";
1115:                try {
1116:                    java.lang.reflect.Constructor<jsx3.gui.Interactive> ctor = jsx3.gui.Interactive.class
1117:                            .getConstructor(Context.class, String.class,
1118:                                    ScriptProxy.class);
1119:                    return ctor.newInstance(this , extension, getScriptProxy());
1120:                } catch (Exception ex) {
1121:                    throw new IllegalArgumentException("Unsupported type: "
1122:                            + jsx3.gui.Interactive.class.getName());
1123:                }
1124:            }
1125:
1126:            /**
1127:             * Sets the name of the jsx3.gui.Menu instance to display when a user
1128:            clicks on this object with the right button. The name is a pointer by-name to a JSX object in the same server.
1129:             * @param strMenu name or id (jsxname or jsxid) of the context menu
1130:             * @param returnType The expected return type
1131:             * @return this object
1132:             */
1133:            @SuppressWarnings("unchecked")
1134:            public <T> T setMenu(String strMenu, Class<T> returnType) {
1135:                String extension = "setMenu(\"" + strMenu + "\").";
1136:                try {
1137:                    java.lang.reflect.Constructor<T> ctor = returnType
1138:                            .getConstructor(Context.class, String.class,
1139:                                    ScriptProxy.class);
1140:                    return ctor.newInstance(this , extension, getScriptProxy());
1141:                } catch (Exception ex) {
1142:                    throw new IllegalArgumentException(
1143:                            "Unsupported return type: " + returnType.getName());
1144:                }
1145:            }
1146:
1147:            /**
1148:             * Sets the CSS definition to apply to an HTML element when a spyglass is shown for that element
1149:             * @param strCSS valid CSS. For example, text-decoration:underline;color:red;
1150:             */
1151:            public void setSpyStyles(String strCSS) {
1152:                ScriptBuffer script = new ScriptBuffer();
1153:                script.appendCall(getContextPath() + "setSpyStyles", strCSS);
1154:                getScriptProxy().addScript(script);
1155:            }
1156:
1157:            /**
1158:             * called by 'window.setTimeout()' to display the spyglass hover for a given object;
1159:             * @param strHTML HTML/text to display in the spyglass; as the spyglass does not define a height/width, this content will
1160:                 have improved layout if it specifies a preferred width in its in-line-style or referenced-css rule.
1161:             * @param intLeft use an integer to specify an on-screen location; otherwise, use a <code>jsx3.gui.Event</code> instance to have the system automatically calculate the x/y position.
1162:             * @param intTop use an integer if <code>intLeft</code> also uses an integer. Otherwise, use null.
1163:             */
1164:            public void showSpy(String strHTML, int intLeft, int intTop) {
1165:                ScriptBuffer script = new ScriptBuffer();
1166:                script.appendCall(getContextPath() + "showSpy", strHTML,
1167:                        intLeft, intTop);
1168:                getScriptProxy().addScript(script);
1169:            }
1170:
1171:            /**
1172:             * called by 'window.setTimeout()' to display the spyglass hover for a given object;
1173:             * @param strHTML HTML/text to display in the spyglass; as the spyglass does not define a height/width, this content will
1174:                 have improved layout if it specifies a preferred width in its in-line-style or referenced-css rule.
1175:             * @param intLeft use an integer to specify an on-screen location; otherwise, use a <code>jsx3.gui.Event</code> instance to have the system automatically calculate the x/y position.
1176:             * @param intTop use an integer if <code>intLeft</code> also uses an integer. Otherwise, use null.
1177:             */
1178:            public void showSpy(String strHTML, jsx3.gui.Event intLeft,
1179:                    int intTop) {
1180:                ScriptBuffer script = new ScriptBuffer();
1181:                script.appendCall(getContextPath() + "showSpy", strHTML,
1182:                        intLeft, intTop);
1183:                getScriptProxy().addScript(script);
1184:            }
1185:
1186:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.