If I am not too far off, that should be easy to implement the
getProperty() method to return a Java object, and the getJsonProperty()
method to convert this Java object into a JSON string.

very straightforward. The JSON object would consist of

a) a primary associative array consisting of ONE property
   name and its associated property value. This property
   name is the name of the primary getProperty() parameter.

b) property values consisting of one of four data types:

 numeric, string, 0-based sequential array, associative array

(JavaScript doesn't distinguish among numeric data types.)

That's all one needs. I wrote a little ditty toJSON() in ModelManager (I think) that converts Java arrays.toString() to JavaScript arrays. So that's done.

That said, I don't think that EVERY return needs to be a JSON string. For example, there is no need to package a file name or file contents or file header in a JSON string. But that's a minor detail, I think. In what I did, I simply made anything having "Info" in the property name a JSON return; anything else was just a simple string.



However, I think that there may be another piece. I think that we may need
to have a mechanism to have a 'reference' to an internal object without
having the object itself. This fits in with my concern about having nested
"Objects". But this is a good step as an extension of Bob's work.

This would be interesting. I do think it might be asking for cross-platform trouble if JavaScript is dipping into actual Jmol applet objects. We could experiment. Anyone know of examples of this -- where JavaScript gets a Java object reference and works with it? Yeiks! My intuition says, "don't go there." I'm certainly interested in learning how all this works.

Bob




--

Robert M. Hanson, [EMAIL PROTECTED], 507-646-3107
Professor of Chemistry, St. Olaf College
1520 St. Olaf Ave., Northfield, MN 55057
mailto:[EMAIL PROTECTED]
http://www.stolaf.edu/people/hansonr

"Imagination is more important than knowledge."  - Albert Einstein


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to