Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

FileChooser and applets post and replies

Return to the FileChooser and applets thread
Login to post to this thread

FileChooser and applets/standalone programs - Nov 29, 2011 at 10:43AM
Juan M. Aguirregabiria
9 Posts

When a FileChooser is included in a simulation and the later is used as an applet a security exception is raised and the applet fails.

This is fine, but unfortunately it also happens when _isApplet() is used to make sure FileChooser is only used when the simulation is not run as a standalone program, as in the enclosed simulation.

Is there any workaround to allow the same source to generate simulations to be run standalone and as an applet?

Thanks

Attached File: FileChooser.zip


Replies to FileChooser and applets/standalone programs

Re: FileChooser and applets/standalone programs - Nov 29 2011 4:27PM
Francisco Esquembre
127 Posts

Juan Maria,

This was an unexpected behavior... (ok, a bug! :-) ) because I didn't foresee this possibility.

I have changed the FileChooser model element so that, if the simulation cannot access the disk, the filechooser will display an error dialog and return null if you try to select a file. But your simulation  won't crash.

Notice that checking for _isApplet() may be misleading, since a signed applet could actually access the disk. (But maybe you want to forbid also this possibility, in which case using :isApplet(9 would be correct, of course).

I have uploaded a new EJS version that is still beta, but you can work with it to polish your simulation. The new release, soon to come, will have this code ready.

The new EJS is at http://fem.um.es/EjsWiki/uploads/Download/EJS_4.3.5_111129.zip

Cheers,

Paco



The OSP Network:
Open Source Physics - Tracker - EJS Modeling
Physlet Physics
Physlet Quantum Physics