Development notes on using Autoplot as an applet. Recent examples: http://autoplot.org/applet_demos
Only a small number of DataSources support the security restrictions of applets. These include: qds, d2s, tsds. The dataSetURL must be to the same URL that the applet was loaded from.
<applet width="800" height="400" id="applet1" code="org.virbo.autoplot.AutoplotApplet" archive="AutoplotApplet.jar"> <param name="dataSetURL" value="http://www.autoplot.org/data/alpha_proton_ratio.qds"> </applet>
1.2. Testing Clients
Right now, only the Sun java plug-in for Mozilla firefox is supported. This can be tested at: http://www.java.com/en/download/testjava.jsp We intend to support other clients as well, including the OpenJDK plugin, see bug ticket.
1.3. Advanced: Pre-load
To load the Java Virtual Machine in the background after the page has loaded but before the user has had a chance to initiate an applet visualization, see http://aurora.gmu.edu/autoplot-applet/dist-packed/OnePanelApplet-bgloadAll.html.
1.4. Advanced: Compressed
The applet jar file can be compressed from 3 MB to 0.3 MB using pack200 and proguard (each give about a factor-of-three compression). See most recent applet release at http://autoplot.org/Autoplot_Change_Log and select the html file named AutoplotAppletCompressed.html. See page source for usage example.
The procedure for building Autoplot and the applet is described in build from source. The pack200 and proguard steps have been added to the build process. A packed applet requires a .htaccess file. See the file named htaccess.txt.
- Change applet memory settings: http://www.duckware.com/pmvr/howtoincreaseappletmemory.html
- Clear cache on Linux with rm -rf ~/.java/deployment/cache
- Clear cache on Windows with Control Panel -> Java -> General Tab -> "Temporary Internet Files Section -> Settings" -> Delete Files
- Clear cache on Mac using Finder->Applications->Utilities->Java->Java Preferences->Delete Files
See api#Common for the list of all parameters. Applet parameters are specified as
<param name="NAME" value="VALUE">
- splashImage is the image to use as the preview as the applet initializes.
- readParameters the configuration parameters have been read in.
- dataSourceSet the data source is resolved.
- dataSourceLoaded the data is loaded.
- ready the initial work is complete and the applet is waiting for user interaction.
- contextOverview=on (off is default.) Show two-panels, lower panel is context plot, upper panel is zoom in.
applet_1.setTimeRange( '2009-01-01' )
because the applet defines a public method setTimeRange that accepts a string parameter.
- setTimeRange(String). The string is parsed as a time range and the x axis is set to the new range.
- setDataSetURL(String). Point the applet to a new data source.
- setCanvasFont(String). Reset the canvas font. (Broken in current release.)
- setDomNode( String name, String value ). Uses Java introspection to set the value of the property identified. This uses the object serialization defined in QStream to parse strings into objects. Hopefully any type allowed in the dom tree will work here.
setDomNode( 'timeRange', '2009-05-06' ) setDomNode( 'plots.xaxis.log', 'true' ) # TODO: I think the indexed variables don't work presently. setDomNode( 'options.drawMinorGrid', 'true' )
printDomNode( 'timeRange' ) printDomNode( 'plots.xaxis.log' )
When adding to the applet's API, the thread calling the applet is considered a hostile thread and a security exception will be thrown when a setter is called. Wrap the setter in a Runnable, then pass the Runnable to SwingUtilities.invokeLater so the code is run from a trusted thread.
4. Development Notes
Many of these problems have been fixed. These notes are kept for reference only
Load applet w/o page hang
Note: This is no longer a problem. See http://aurora.gmu.edu/dist-packed/OnePanelApplet-bgload.html
- See https://applet-launcher.dev.java.net/ is requests to server for copyright notice may be avoided using
<param name="codebase_lookup" value="false">
The applet does not work in FF 3.07 on WinXP with JRE 1.6.0_07, possibly due to this problem: http://forums.java.net/jive/thread.jspa?threadID=39432. Works on IE7 and Safari ... A hint: Safari gives
while FF says
Bottom of this thread suggests reverse DNS lookup is needed: http://forums.java.net/jive/thread.jspa?messageID=277896 http://seclists.org/fulldisclosure/2007/Jul/0159.html
Java console on Mac: http://ruk.ca/article/3001
TODO: Try running applet from aurora.gmu.edu (which appears in the reverse lookup for 220.127.116.11 or explicitly use ip address instead of timeseries.org.
- Inserting applet in DOM in background: http://kaioa.com/node/21