OH, ok. You mean like as in JmolApplet.js. Sure.

On Tue, Aug 7, 2012 at 11:51 AM, Gusts Kaksis <gusts.kak...@gmail.com>wrote:

>  Comments bellow...
>
>
>
>   My new idea is to create an applet wrapper class, that gets created
>> once the applet becomes ready. It will be thrown around in all the
>> events/callbacks as the first argument. And it will export applet's methods
>> or store something in cache if applet (for some unknown reason) would not
>> be available. jQuery-Jmol plugin would be used only to initialize DOM node
>> of Jmol applet and update some basic things, like dimensions, visibility of
>> the applet, also destroying it and restoring placeholder to it's initial
>> state (this option kind of complies with jQuery UI widget guidelines). I'm
>> targetting this:
>>
>> Initialization:
>> $('#jmol').jmol({... options ...});
>> Update options:
>> $('#jmol').jmol({... options ...});
>> Update single option:
>> $('#jmol').jmol('option', 'width', 200);
>>
>> Some jQuery-Jmol internal commands:
>> $('#jmol').jmol('hide'); // Hide applet - set it to 2x2 px
>> $('#jmol').jmol('show'); // Restore to original dimensions (from options)
>> $('#jmol').jmol('destroy'); // Remove Jmol from DOM and destroy every
>> reference
>> $('#jmol').jmol('bind', 'pick', myPickListener); // This would be an
>> event binding wrapper -
>> $('#jmol').jmol('unbind', 'pick', myPickListener); // This would be an
>> unbind wrapper -
>>
>> Binding wrapper would do the trick (although still, not quite jQuery-way)
>> - it would set up an appropriate callback in Jmol and then bind an event
>> listener to itself, so that callback listener could trigger an event. And
>> when all the listeners are removed, callback should also be freed, so I'll
>> send "set [callback] NONE". Event listeners should always receive my
>> wrapper object (which wraps a single instance of an applet) and other
>> parameters sent to callback (except for the ID attirbute). For example a
>> hoverCallback would be translated into an event, that would receive these
>> arguments:
>>
>> function myHoverListener (jmol, label, index){
>>   // Now you can just do some scripting
>>   jmol.script('... some script source ...');
>> }
>>
>> Methods, that I currently have in my Jmol wrapper, are:
>> getProperty - underneath it would use getPropertyAsJSON and parse the
>> JSON string prior returning a result.
>> getId - an ID attribute value of Jmol applet
>> script - same as in applet
>> scriptNoWait - same
>> scriptCheck  - same
>> scriptWait  - same
>> scriptWaitOutput  - same
>> And, if I understood you correctly - other methods should not be made
>> public for JavaScript developers, these are either deprecated or for Jmol
>> intercommunication, right?
>>
>> So, this is what I'm currently playing around with.
>>
>
> Not sure what you are aiming at there. Jmol already has an applet wrapper,
> right? Are you saying this wrapper would not extend Applet? In Jmol right
> now the AppleWrapper class is an extension of Applet, so it, like any
> applet, must become fully initialized before it can ever be called. The
> Viewer class is what is being used for the display, but it is not the
> "applet" itself. (It is accessed by the wrapped applet using the JmolViewer
> interface.)
>
> By applet wrapper, I mean a JavaScript class that holds an applet's
> reference object (received by appletReadyCallback) and it exports some
> methods for developers to use. Also as it's written with prototyping, it
> could be extended with all the bells and whistles of Jmol.Controls.js
> functionality
>
>
> The applet interface is
>
> public interface JmolAppletInterface extends JmolScriptInterface {
>
>   public String getPropertyAsString(String infoType);
>   public String getPropertyAsString(String infoType, String paramInfo);
>   public String getPropertyAsJSON(String infoType);
>   public String getPropertyAsJSON(String infoType, String paramInfo);
>   public Object getProperty(String infoType);
>   public Object getProperty(String infoType, String paramInfo);
>   public String loadInlineString(String strModel, String script, boolean
> isAppend);
>   public String loadInlineArray(String[] strModels, String script, boolean
> isAppend);
>   public String loadNodeId(String nodeId);
>   public String loadDOMNode(JSObject DOMNode);
>
> }
>
> with
>
> public interface JmolScriptInterface extends JmolSyncInterface {
>
>   public Object setStereoGraphics(boolean isStereo);
>   public void script(String script);
>   public String scriptCheck(String script);
>   public String scriptWait(String script);
>   public String scriptWaitOutput(String script);
>   public String scriptWait(String script, String statusParams);
>   public String scriptNoWait(String script);
>
> }
>
> and
>
> public interface JmolSyncInterface {
>
>   public abstract void syncScript(String script);
>   public abstract void register(String id, JmolSyncInterface jsi);
>   public Object getProperty(String key);
>
> }
>
>   This one I followed through in SVN, it's all clear.
>
> OK, so now I've a little bit clearer view over Jmol's ins and outs. Thanks!
>
> --
> Gusts Kaksis
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Jmol-developers mailing list
> Jmol-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-developers
>
>


-- 
Robert M. Hanson
Larson-Anderson Professor of Chemistry
Chair, Chemistry Department
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr


If nature does not answer first what we want,
it is better to take what answer we get.

-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Jmol-developers mailing list
Jmol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to