MarvinSketch / Third-Party HTTP-Services

User 769e505c29

16-08-2013 12:40:47

Hi,


is there any information available on the HTML rendering engine that is used by MarvinSketch when I integrate a third-party HTTP-service that returns a HTML page? E.g., does your engine support JavaScript or other advanced features?


The background of my question is: I would like to integrate an external HTTP-service that might take a couple of seconds until the result is returned. To do this, I would like to be able to show a spinning wheel (etc.) to the user until the result is available and implement this by reloading the web page e.g. every second.


Any pointers / ideas?


Thanks,


Nils

ChemAxon 2c555f5717

16-08-2013 14:26:54

Dear Nils!


   You can find materials ( http://www.chemaxon.com/library/marvin-applets-developer-training/ at around 31 mins) that can show you how to communicate with the Marvin Applet through JavaScript on our protal. Do you need a webservice to solv your problem? 


Regards:
Balázs 

User 769e505c29

19-08-2013 09:02:01

Hi Balázs,


thanks for you help! I already have a (number of) web service(s) that I would like to use and I am already able to access those from MarvinSketch (which I currently use as a standalone application). I registered those web services under Edit -> Preferences -> Services as "HTTP Services".


My problem is this: The response times of my services are typically in the range of 5-10 seconds. This means that the user has to stare at an empty window for those 5-10 seconds without any feedback if (s)he calls one of my services via Tools -> Services -> .... This is a bit confusing and I would like to improve the user experience by showing some kind of animated gif (a sandbox or a spinning wheel etc.) or "please wait" message until the result of the calculation becomes available. I know how to modify my web service to achieve this (and already got it running in "normal" web browsers such as Firefox). Within MarvinSketch however, this does not seem to work - and I am wondering whether the window that opens when I click Tools -> Services -> ... does support more than just HTML rendering (e.g., JavaScript etc.).


Thanks,


Nils

ChemAxon 2db1f4037e

22-08-2013 07:33:38

Hi Nils,


Since Marvin 6.0 you can fully customize the service result display dialog. I am attaching a sample code that focuses on your issue: displaying a "Please Wait" message at the result view before service calculation starts.


The solution uses the fact that the service call action is first disabled, then the service called, and since it happens in the EDT you can listen to the enabled property change for the service call action, therefore you can update the result view to display a custom message. After the service call is completed, the result will be updated automatically.


Please note that this may cause "flickering" in quick service calls: the "Please Wait" message displays, then it immediately changes to the result message, so you may not want to display that in all times - you can see some "filtering" ideas in the sample code.


Currently the HTML renderer used in the default service result display is a pure JTextPane, so it has very limited capabilities, however you can replace that component with a more sophisticated one like Cobra/Lobo, Flying Saucer, CSS Box or you can use JavaFX's webview. (It is windows only for Java6, so we can not embed that until we go to Java7) I recommed the JavaFX version if you are on windows.


I am attaching a second example to show you how to use a custom component as a result view.

User 769e505c29

23-08-2013 14:45:49

Hi csepi,


this looks promising, I will have a look at your examples.


Thanks,


Nils