|
[ Index ]
|
PHP Cross Reference of Drupal 6 (yi-drupal)
|
[Source view]
[Print]
[Project Stats]
JSObject allows Java to manipulate objects that are defined in JavaScript. Values passed from Java to JavaScript are converted as follows:<ul> <li>JSObject is converted to the original JavaScript object <li>Any other Java object is converted to a JavaScript wrapper, which can be used to access methods and fields of the java object. Converting this wrapper to a string will call the toString method on the original object, converting to a number will call the doubleValue method if possible and fail otherwise. Converting to a boolean will try to call the booleanValue method in the same way. <li>Java arrays are wrapped with a JavaScript object that understands array.length and array[index] <li>A Java boolean is converted to a JavaScript boolean <li>Java byte, char, short, int, long, float, and double are converted to JavaScript numbers </ul> Values passed from JavaScript to Java are converted as follows:<ul> <li>objects which are wrappers around java objects are unwrapped <li>other objects are wrapped with a JSObject <li>strings, numbers and booleans are converted to String, Double, and Boolean objects respectively </ul> This means that all JavaScript values show up as some kind of java.lang.Object in Java. In order to make much use of them, you will have to cast them to the appropriate subclass of Object, e.g. <code>(String) window.getMember("name");</code> or <code>(JSObject) window.getMember("document");</code>.
| File Size: | 162 lines (5 kb) |
| Included or required: | 0 times |
| Referenced: | 0 times |
| Includes or requires: | 0 files |