Applets/JavaFx in OpenSocial/iGoogle (and bugs that need to be fixed...)
I have started to look for some framework to put together in the same web page different contributions from loosely coupled applications. After reading about claims of portlet's demise, I was pointed to OpenSocial, Shingdig and the like. Now, I couldn't care less about the "Social" part of this (I am writing applications to manage data of particle accelerators and light sources... not teenage romantic life) but the ability to break down things in gadgets and have the option of assemble pieces coming from loosely coupled applications written in different languages (as long that their output is html), that's something I'd like. And, as I understand, I could use Shingdig on my own internal, set it up...
Now, the interesting part was: how long did it take me to take one of the applets I made and create a gadget out of it? And make it appear in my iGoogle (which is implemented on top of OpenSocial)? Less time than is taking me to write this blog entry...
You create an XML file such as:
<?xml version="1.0" encoding="UTF-8" ?>
<ModulePrefs title="IRMIS Component Browser" author_email="email@example.com" height="600" width="800">
<Require feature="opensocial-0.8" />
<applet height="100%" width="100%" code="gov.bnl.irmis.applets.ComponentBrowserApplet"
codebase="https://irmis-dev.bnl.gov/IRMIS/lib" archive="IRMISApplets.jar" id="applet">
<param name="irmis.service" value="https://irmis-dev.bnl.gov/IRMISDataService" />
<param name="java.util.logging.config.file" value="https://irmis-dev.bnl.gov/IRMIS/logging.properties" />
<param name="uploadLog" value="https://irmis-dev.bnl.gov/IRMIS/uploadLog" />
<param name="progressbar" value="true" />
<param name="draggable" value="true" />
<param name="separate_jvm" value="true">
<param name="java_arguments" value="-Xmx256m">
<param name="image" value="IRMIS360.png">
<param name="boxborder" value="false">
<param name="centerimage" value="true">
Note that there nothing in the html except an applet tag, stretched to take the whole height and width. Then you make it available at a public URL, open your iGoogle page, give the URL of the xml file and your applet is in iGoogle! (which I can't show because the attachment upload seems to be broken...)
This is great for me, but I think it's even more important for someone looking into using JavaFX in this context. And there are a couple of things that definetely need fixing, which are generic applet plugin support and probably have nothing to do with OpenSocial/iGoogle specifically:
- Cursor. If an html popup appears over the applet, the cursor keeps oscillating between what the applet wants and what the popup wants.
- Mouse drag. If you start a mouse drag anywhere in the page (say you are moving a gadget) and the drag passes over the applet, the drag is terminated. So, you can't drag _over_ and applet, you need to drag _around_.
- Alpha. If a popup appears and grays out the page underneath, the applets are not greyed out (probably painted on top) so it shines like a punch in the eye
- Shared jvm per codebase. If you break up an application into multiple gadget, it would be nice if they could share the same jvm so that the applets can communicate (selection in one changes the other), minimize library load and share data (my applets need to get about 60 MB of data...)
Note that the first three are _not_ a problem with Flash.