Recent Changes - Search:





Parameters supported by applets created with EJS

Every applet generated with EJS supports a number of predefined parameters. These parameters are passed on to the applet by editing the <applet> tag and adding entries of the form <param name=“nameOfTheParameter” value=“desiredValue”>.
<applet code=“users.murcia.fem.physics.mechanics.ThrowingABall_pkg.ThrowingABallApplet.class”
            codebase=“.” archive=“ejs_ThrowingABall.jar”
            name=“ThrowingABall”  id=“ThrowingABall”
            width=“600” height=“342”>
            <param name=“initialState” value=“./ThrowingABall/aState.xml”>
            <param name=“locale” value=“es ES”>


Predefined EJS-generated applet parameters




An XML file containing a state previously saved of the simulation. The applet will load this state as the initial state for the simulation and reload it again whenever the simulation is reset (calling the _reset() predefined method). You can create this file using the “Save state” option of the simulation menu.
The applet will look for this file in a number of places. The first one being the JAR file of the applet and, inside it,relatively to the source XML file inside this jar. This means that relative addressing, such as “./data/mySavedState.xml” will work, where the data directory in this example must be a directory next to the simulation source XML file in the source directory of your EJS workspace.
If the file is not found there, the applet will also search for it in other places. If the filename is relative (i.e. starts with “./”), the applet will look for it under the same Web directory where the JAR file is. If it is absolute (i.e. starts with “http:” or “https:”), it will search for it in the specified Web location. This additional search increases network traffic. Therefore, for files that are located outside the JAR file, it is much better to use the initialStateFromURL parameter, described below.


Same as with initialState, an XML file containing a state previously saved of the simulation.
The only difference with initialState is that the applet does not look for this file inside the JAR file that contains the applet. Therefore, if your XML file is outside this JAR file, minimize network traffic by using this parameter instead of initialState.


A string of the form “xx” or “xx XX” indicating the locale of the simulation. The format for this string uses the standard Java style for locales. Examples, “en” for English, “es” for Spanish. But more precisely, “en EN” for British English and “en US” for American English. “es ES” for the Spanish locale used in Spain.
IMPORTANT: Specifying this parameter requires the applet to be signed. A non-signed applet will ignore this parameter.


Reserved for use within the OSP project.


Other applet parameters

You can add additional parameter entries to your applet tag. However, simulations created with EJS will not process them automatically. Your simulation must include code that will process those parameters. You can get the value of an applet parameter using the _getParameter(String parameterName) predefined method.

Edit - History - Print - Recent Changes - Search
Page last modified on December 05, 2009, at 10:10 PM