Applets such as the applified versions of simulations from the CommunitySims project (http://communitysims.cs.vt.edu/) could be useful as content in workspaces, MOOs, or other interactive compositions. Ideally some minimal collaborative support could eventually be provided, though the applets could be useful even without this.
Implementing an embeddable applet viewer component that instantiates, initiates, and starts an applet should be relatively straightforward. Implementation issues include:
- Loading applet code. We do not want to further bloat the total size of the bridge package. The Stagecast Creator jar file used by the simulation applets, for example, is almost 3MB, making it nearly as large as all of the rest of the bridge jars put together. Solutions include:
- Implement a custom classloader that loads jars or class files on demand, just as they would be loaded in a browser. Without adding a custom caching implementation, however, this would potentially require re-loading the jars each time the applet was accessed.
- Implement per-directory jar extensions. When the full editor was launched from within the directory, the jar would be included in the WebStart (jnlp) file that the bridge server generates.
- would allow WebStart's caching mechanism to be used
- but would not work if the full editor was launched from within the directory. (This might suggest that we implement both solutions, using webstart where possible, but falling back to a custom classloader.)
- Some applets (including the simulation applets) will likely have double-buffering problems if added to a swing container instead of a heavyweight awt container. This could be fixed by an option to specify one type of container or the other.
- It might be possible to share/save snapshots of the applet
- It might be possible to (optionally?) render applet code for the component's WebView. This could either be custom (author-supplied) code, or generated automatically depending on how we handle jar/class loading.
The underlying replicated object for an applet component could be a record that contains:
- The class name of the applet
- The preferred size of the applet
- A boolean value specifying whether the applet's immediate parent should be a lighweight container (
JPanel) or a heavyweight container (Panel).
- An arbitrary set of parameter (name, value) pairs
- Codebase and documentbase for the applet. These can default to the url of the object's directory, but should be overridable by the author.
The ComponentView mapped to the object should:
- Show the applet as its primary UI. This should possibly be embedded in a
ScrollPane or JScrollPane to handle cases where the CV is shrunk smaller than the applet's preferred size. (Or maybe this should be an option, too, since many applets can probably be safely "stretched".)
- Provide a jajaja item to open a dialog for setting the properties
- Provide a menu item for reloading the applet
An initial implementation was added on030215:
- Object describing an embeddable applet and ComponentView for loading this object is in
edu.vt.chci.applet
- Changes to
bridge.apps.web.WebSite and bridge.apps.jnlp.JNLPServlet add support for per-site extra jars to be included in WebStart JNLP files.
|