MarvinSketch Applet freezes

User 4ceb4fe234

18-06-2008 06:51:08

Hi everybody,





I've just a little problem with the Marvin Sketch applet. I've got a web page with 2 applets on it, a visible applet with a button and an invisible (size 0). When the button on applet #1 is pressed, it calls a method (showApplet()) of applet #2. This method loads and initializes the MarvinSketch applet, see attached file.





MarvinSketch opens and can be used to edit a structure. After MarvinSketch has been closed, a JavaScript function is triggered using the "listenpropertychanged" parameter. This function calls a Java function of applet #2 that retrieves the molecule from MarvinSketch using the getMol() function (or - equivalent - selectAllAtoms() followed by a getSelectedMol()).





This works very well using Java 1.6 in IE and Firefox. It also works very well using Java 1.5 in IE. But it does not work using Java 1.5 in Firefox (all versions). And it also does not work in Opera 9.50 using Java 1.5 or 1.6.





The error occurs while calling the MarvinSketch method getMol() or getSelectedMol(), respectively (see method getMolfile()). Other MarvinSketch method called from applet #2, like selectAllAtoms(), getMolFormula() or setMol(), are doing fine.





Can you give me a hint?





We are using Java 1.5.0_13, Marvin 5.0.x (I don't know the correct version, because I've installed many versions and the about box doesn't work).





Here is a code snippet defining the applet tag:


<applet codebase='jar' name='StartMarvin' code='StartMarvin.class' archive='ReaxysSEApplet.jar,jmarvin.jar' width='0' height='0' mayscript>


<param name='autoscale' value='false'>


<param name='detach' value='show'>


<param name='undetachByX' value='true'>





<param name='menubar' value='true'>


<param name='listenpropertychange' value='true'>


<param name='StructureEditor' value='MarvinInit2'>


<param name='ConfigFile' value='u:\se\se.ini'>


</applet>





Attached is a file that containing the code of applet#2.

ChemAxon 7c2d26e5cf

19-06-2008 00:15:12

Hi Helge,


In first view, I have no tipp.


My opinion is that your example is too complicated. I do not understand why you use actually 2 applets to open and close a MarvinSketch applet.


If I were you, I would insert the MarvinSketch applet into a DIV tag instead of into another applet.





My suggestion is that call a JavaScript code from the first applet (where the button is located). It updates the content of a DIV tag to load-in an MarvinSketch applet.


By closing of the MarvinSketch applet, the Javascript function that is referred in the propertyChange javascript method, reset the content of the DIV tag (with some delay). Since the MarvinSketch embedded page is replaced, the browser will notify the applet to stop.





A couple of other things are also not exactly clear for me.


- How the first applet calls the StartApplet.showApplet method?


- Are there any other files in the "jar" directory than "jmarvin.jar" and "ReaxysSEApplet.jar"? Is whole content of the marvin applet package is available there?


- Are there any error message on the Java console or in the JavaScript error dialog?

User 4ceb4fe234

19-06-2008 05:50:40

Hi Tamas,





it was just an informational question, if you have observed such a behavior in the past. There are many other reasons for this failure: a bug somewhere in Firefox, Java 1.5, or in the communication between those components. I was just wondering if you have an idea, a clue what's going wrong here, or more specific, exactly where it's going wrong.





You suggested to use a div to display Marvin. But, unfortunately, my target is to implement a fast loading web page with unique layout from which our users can either start Marvin as structure editor or their own editor, if there is one installed.





The unique layout and especially the launch of an external can only be done from an applet. This is applet #1. But what, if the external editor does not work? Then I have to launch Marvin. But - on the other hand - Marvin should not be loaded if only an external editor is used to save the download and initialization time.





This is the reason for the second applet that is very small and loads fast. If the users external editor does not work or he wants to use Marvin then, and only then, the function showApplet() is called and Marvin raises. It's pretty complicated, isn't it?





Regarding your questions:


- I could send you our source code but I cannot do it using this forum, because my boss wouldn't like it and it's quite large Here is the code snippet from applet#1 used to launch the Marvin applet.


if( sStructureEditor.equals( "MarvinInit2" ) )


{


if( DEBUG >= 2 ) System.out.println( "Starting Marvin Applet" );


sm = (StartMarvin)getAppletContext().getApplet("StartMarvin" );


sm.showApplet( );


sm.setMolfile( sSourceMolfile );


}


- The whole Marvin tree is in the jar directory. But it's not the original tree, I had to replace the signature with my own otherwise my applet won't be able to launch an external program.


- There are no messages in Firebug for JavaScript. There are a lot of messages in the Java Console - see attached log and trace file. As you can see there, the last thing that is written to the console are


the Messages:


APPLET: ...


METHOD: ...


APPLET: ...


METHOD: ...


These messages are generated in the getMolfile() routine, line 96 to 102. Please note that the messages after the "getSelectedMol()" call are not written to the console. Java never reaches this code.

ChemAxon 7c2d26e5cf

19-06-2008 13:33:48

Sorry, I have used a wrong word: "complicated" was not the proper phrase.


I wanted to express that your solution was new for me.


I have not met this kind of solution for this problem, earlier.


In my previous comment, I mentioned the DIV solution because I have already met with it in similar situation.





Thanks for the given info.


We need time to investigate this issue.


I understand that you don't want to share more details about your example.


I suggest to continue this conversation in private email.