Difference between revisions of "Jmol JavaScript Object/Info"

From Jmol
Jump to navigation Jump to search
(getting specialized subsections out of the main Jmol-JSO page)
(disableInitialConsole and disableJ2SLoadMonitor, plus default values for all)
Line 5: Line 5:
 
<tt>Info</tt> is an associative array (a set of key/value pairs) indicating all the desired characteristics of the Jmol / JSmol applet or surrogate. For a full, up-to-date description of all of the options, see [{{SVN Trunk}}Jmol/appletweb/JmolApi.js JmolApi.js]. It is recommended that any page developer interested in utilizing Jmol extensively takes a look at this file.
 
<tt>Info</tt> is an associative array (a set of key/value pairs) indicating all the desired characteristics of the Jmol / JSmol applet or surrogate. For a full, up-to-date description of all of the options, see [{{SVN Trunk}}Jmol/appletweb/JmolApi.js JmolApi.js]. It is recommended that any page developer interested in utilizing Jmol extensively takes a look at this file.
  
* '''Info.addSelectionOptions''' Set this value to <code>true</code> if you want to display, below the applet, a menu with options for loading structures from public databases.
+
The value shown between angle brackets is the default.
* '''Info.color''' The background color of the applet, in any JmolScript-supported format: color name, decimal triplet <code>[r,g,b]</code> or hexadecimal <code>[xRRGGBB]</code>. Note that default is white (it is black in the classic Jmol.js method).
+
 
* '''Info.debug''' Set this value to <code>true</code> if you are having problems getting your page to show the applet or buttons.
+
== General ==
* '''Info.defaultModel''' A model to be retrieved from a public database and displayed when the applet is loaded.
+
 
* '''Info.height''' The size of the applet (or surrogate) in pixels or expressed as percent of its container height as a string in quotes: "100%". Note that for a percent to work, '''''all''''' surrounding HTML elements (including <code>body</code> and <code>html</code>) must explicitly implement the CSS attribute <code>style=height:...</code>.
+
* '''Info.addSelectionOptions''' <<code>false</code>> Set this value to <code>true</code> if you want to display, below the applet, a menu with options for loading structures from public databases.
* '''Info.isSigned'''  Make sure to change this to <code>true</code> if the file indicated for '''Info.jarFile''' is the signed applet.
+
* '''Info.color''' <<code>white</code>> The background color of the applet, in any JmolScript-supported format: color name, decimal triplet <code>[r,g,b]</code> or hexadecimal <code>[xRRGGBB]</code>. Note that default is now white, in contrast to black in the classic Jmol.js method.
* '''Info.jarFile''' The file used, usually either <code>JmolApplet0.jar</code> (for faster incremental loading) or <code>JmolApplet.jar</code> (a single 2.5+ MB download), or the signed versions <code>JmolAppletSigned0.jar</code> and <code>JmolAppletSigned.jar</code>.
+
* '''Info.debug''' <<code>false</code>> Set this value to <code>true</code> if you are having problems getting your page to show the applet or buttons.
* '''Info.jarPath''' The path to the applet files. Note that if the unsigned applet is used and the page is tested locally, then all model files must be in or under the folder indicated by this value, to satisfy Java security policy.
+
* '''Info.defaultModel''' <empty> A model to be retrieved from a public database and displayed when the applet is loaded.
* '''Info.memoryLimit''' The maximum amount of memory allowed for the applet, in MB.
+
* '''Info.disableInitialConsole''' <<code>false</code>> If set <code>true</code>, avoids the display of messages ('console') in the Jmol panel while the Jmol object is being built initially.
* '''Info.readyFunction''' The name of a JavaScript function to call when the applet has been created and is ready to receive commands (and also called when the applet is destroyed e.g. when the page is closed).
+
* '''Info.disableJ2SLoadMonitor''' <<code>false</code>> If set <code>true</code>, avoids the display of messages in a single line, colored, at bottom-left of the page while code loads (both initially and every time a new module is requested by a running script).
 +
* '''Info.height''' <<code>300</code>> The size of the applet (or surrogate) in pixels or expressed as percent of its container height as a string in quotes: "100%". Note that for a percent to work, '''''all''''' surrounding HTML elements (including <code>body</code> and <code>html</code>) must explicitly implement the CSS attribute <code>style=height:...</code>.
 +
* '''Info.isSigned''' <<code>false</code>> Make sure to change this to <code>true</code> if the file indicated for '''Info.jarFile''' is the signed applet.
 +
* '''Info.jarFile''' <<code>JmolApplet0.jar</code>> The file used, usually either <code>JmolApplet0.jar</code> (for faster incremental loading) or <code>JmolApplet.jar</code> (a single 2.5+ MB download), or the signed versions <code>JmolAppletSigned0.jar</code> and <code>JmolAppletSigned.jar</code>. The setting here should match that of '''Info.isSigned'''.
 +
* '''Info.jarPath''' <<code>.</code>> The path to the applet files. Note that if the unsigned applet is used and the page is tested locally, then all model files must be in or under the folder indicated by this value, to satisfy Java security policy.
 +
* '''Info.memoryLimit''' <<code>512</code>> The maximum amount of memory allowed for the applet, in MB.
 +
* '''Info.readyFunction''' <empty> The name of a JavaScript function to call when the applet has been created and is ready to receive commands (and also called when the applet is destroyed e.g. when the page is closed).
 
*: For example, with <code>Info.readyFunction: jmolIsReady</code> any of the following JavaScript function definitions could be used:
 
*: For example, with <code>Info.readyFunction: jmolIsReady</code> any of the following JavaScript function definitions could be used:
 
*: <code>jmolIsReady = function(theJmol) { document.title = theJmol._id + " is ready"; }</code>
 
*: <code>jmolIsReady = function(theJmol) { document.title = theJmol._id + " is ready"; }</code>
 
*: <code>jmolIsReady = function() { alert('Welcome to Jmol!'); }</code>
 
*: <code>jmolIsReady = function() { alert('Welcome to Jmol!'); }</code>
 
*: <code>function jmolIsReady() { alert('Welcome to Jmol!'); }</code>
 
*: <code>function jmolIsReady() { alert('Welcome to Jmol!'); }</code>
* '''Info.script''' A script to run when the applet has loaded. Note that indicating a script here is not necessary; with Jmol-JSO, unlike with Jmol.js, you can start making script calls to the applet as soon as the applet wrapper object has been created in JavaScript; there is no need to wait for Java applet initialization to have completed.  
+
* '''Info.script''' <empty> A script to run when the applet has loaded. Note that indicating a script here is not necessary; with Jmol-JSO, unlike with Jmol.js, you can start making script calls to the applet as soon as the applet wrapper object has been created in JavaScript; there is no need to wait for Java applet initialization to have completed.  
* '''Info.serverURL''' The URL of the server to be used for getting file data into non-JmolApplet options. This can be left as "http://chemapps.stolaf.edu/jmol/jmolcd.php", since that is a public site accessible to cross-domain AJAX calls, but it can perhaps better be installed on the user's host for better performance.
+
* '''Info.serverURL''' <<code><nowiki>http://chemapps.stolaf.edu/jmol/jsmol/jsmol.php</nowiki></code>> The URL of the server to be used for getting file data into non-JmolApplet options. This can be left as default, since that is a public site accessible to cross-domain AJAX calls, but it can perhaps better be installed on the user's host for better performance.
 
* '''Info.src''' Same as '''Info.script''', only included because it is the syntax commonly used for images.
 
* '''Info.src''' Same as '''Info.script''', only included because it is the syntax commonly used for images.
* '''Info.use''' This string determines the various options to be tried (applet and surrogates) and the order in which to try them.
+
* '''Info.use''' <<code>Java noWebGL noHTML5 noImage</code>> This string determines the various options to be tried (applet and surrogates) and the order in which to try them.
** The default setting of <code> Java noWebGL noHTML5 noImage </code> is the same as just <code> Java </code> by itself and indicates to just use Java (and display a message if Java is not enabled).
+
** The default setting is the same as just <code>Java</code> by itself and indicates to just use Java (and display a message if Java is not enabled).
** A value of <code> Java Image </code> would allow PNGJ files to be displayed as images or simple file loading to be delivered as an image from a server if Java is not available.
+
** A value of <code>Java Image</code> would allow PNGJ files to be displayed as images or simple file loading to be delivered as an image from a server if Java is not available.
** The value <code> Java HTML5 </code> would test for Java and then, if that is not available, use GLmol or HTML5-only ChemDoodle or JSmol (whichever is made available).  
+
** The value <code>Java HTML5</code> would test for Java and then, if that is not available, use GLmol or HTML5-only ChemDoodle or JSmol (whichever is made available).  
** The value <code> Java WebGL HTML5 Image </code> allows at least some model on all standard platforms.  
+
** The value <code>Java WebGL HTML5 Image</code> allows at least some model on all standard platforms.  
: Note that Jmol-JSO cannot detect if the user has intentionally disabled Java in Microsoft Internet Explorer. Thus, MSIE users intentionally disabling Java will only have the Java option, and a message will be displayed that Java is not available.
+
: Note that Jmol-JSO cannot detect if the user has intentionally disabled Java in some browsers (at least Microsoft Internet Explorer). Thus, users intentionally disabling Java may only get the Java option, and a message will be displayed that Java is not available.
* '''Info.width''' The width of the applet in pixels or expressed as percent of its container width as a string in quotes: "100%". Note that for a percent to work, '''''all''''' surrounding HTML elements must explicitly implement the CSS attribute <code>style=width:...</code>.
+
* '''Info.width''' <<code>300</code>> The width of the applet in pixels or expressed as percent of its container width as a string in quotes: "100%". Note that for a percent to work, '''''all''''' surrounding HTML elements must explicitly implement the CSS attribute <code>style=width:...</code>.
 +
 
 +
== Callbacks ==
  
In addition to these keys are a set of parameters that using Jmol.js could be set using the <code>jmolSetParameter()</code> or <code>jmolSetCallback()</code> functions. These are discussed in sets:
+
There are several parameters that in Jmol.js could be set using the <code>jmolSetParameter()</code> or <code>jmolSetCallback()</code> functions. These are discussed in sets:
  
 
* '''Info.animframecallback'''
 
* '''Info.animframecallback'''
Line 48: Line 56:
  
 
These callbacks allow the page designer to get information about what is happening within the applet. The name of a JavaScript function, in single- or double-quotes should be given here if desired. Do not use <code>function() {....}</code> syntax.
 
These callbacks allow the page designer to get information about what is happening within the applet. The name of a JavaScript function, in single- or double-quotes should be given here if desired. Do not use <code>function() {....}</code> syntax.
 +
 +
== Misc. ==
  
 
* '''Info.language'''  
 
* '''Info.language'''  
 
This setting can be used to specify a language to be used in the JmolApplet interface (primarily for testing; the default language used in the applet is automatically detected from the system settings of the user's browser).
 
This setting can be used to specify a language to be used in the JmolApplet interface (primarily for testing; the default language used in the applet is automatically detected from the system settings of the user's browser).
 +
Please note that language (localization) is not currently implemented in non-Java surrogates (including JSmol).
  
 
* '''Info.usecommandthread'''
 
* '''Info.usecommandthread'''

Revision as of 14:18, 26 February 2013

Documentation of parameters of the Info variable

This page explains the parameters of the Info variable, an essential part of the Jmol JavaScript Object.

Info is an associative array (a set of key/value pairs) indicating all the desired characteristics of the Jmol / JSmol applet or surrogate. For a full, up-to-date description of all of the options, see JmolApi.js. It is recommended that any page developer interested in utilizing Jmol extensively takes a look at this file.

The value shown between angle brackets is the default.

General

  • Info.addSelectionOptions <false> Set this value to true if you want to display, below the applet, a menu with options for loading structures from public databases.
  • Info.color <white> The background color of the applet, in any JmolScript-supported format: color name, decimal triplet [r,g,b] or hexadecimal [xRRGGBB]. Note that default is now white, in contrast to black in the classic Jmol.js method.
  • Info.debug <false> Set this value to true if you are having problems getting your page to show the applet or buttons.
  • Info.defaultModel <empty> A model to be retrieved from a public database and displayed when the applet is loaded.
  • Info.disableInitialConsole <false> If set true, avoids the display of messages ('console') in the Jmol panel while the Jmol object is being built initially.
  • Info.disableJ2SLoadMonitor <false> If set true, avoids the display of messages in a single line, colored, at bottom-left of the page while code loads (both initially and every time a new module is requested by a running script).
  • Info.height <300> The size of the applet (or surrogate) in pixels or expressed as percent of its container height as a string in quotes: "100%". Note that for a percent to work, all surrounding HTML elements (including body and html) must explicitly implement the CSS attribute style=height:....
  • Info.isSigned <false> Make sure to change this to true if the file indicated for Info.jarFile is the signed applet.
  • Info.jarFile <JmolApplet0.jar> The file used, usually either JmolApplet0.jar (for faster incremental loading) or JmolApplet.jar (a single 2.5+ MB download), or the signed versions JmolAppletSigned0.jar and JmolAppletSigned.jar. The setting here should match that of Info.isSigned.
  • Info.jarPath <.> The path to the applet files. Note that if the unsigned applet is used and the page is tested locally, then all model files must be in or under the folder indicated by this value, to satisfy Java security policy.
  • Info.memoryLimit <512> The maximum amount of memory allowed for the applet, in MB.
  • Info.readyFunction <empty> The name of a JavaScript function to call when the applet has been created and is ready to receive commands (and also called when the applet is destroyed e.g. when the page is closed).
    For example, with Info.readyFunction: jmolIsReady any of the following JavaScript function definitions could be used:
    jmolIsReady = function(theJmol) { document.title = theJmol._id + " is ready"; }
    jmolIsReady = function() { alert('Welcome to Jmol!'); }
    function jmolIsReady() { alert('Welcome to Jmol!'); }
  • Info.script <empty> A script to run when the applet has loaded. Note that indicating a script here is not necessary; with Jmol-JSO, unlike with Jmol.js, you can start making script calls to the applet as soon as the applet wrapper object has been created in JavaScript; there is no need to wait for Java applet initialization to have completed.
  • Info.serverURL <http://chemapps.stolaf.edu/jmol/jsmol/jsmol.php> The URL of the server to be used for getting file data into non-JmolApplet options. This can be left as default, since that is a public site accessible to cross-domain AJAX calls, but it can perhaps better be installed on the user's host for better performance.
  • Info.src Same as Info.script, only included because it is the syntax commonly used for images.
  • Info.use <Java noWebGL noHTML5 noImage> This string determines the various options to be tried (applet and surrogates) and the order in which to try them.
    • The default setting is the same as just Java by itself and indicates to just use Java (and display a message if Java is not enabled).
    • A value of Java Image would allow PNGJ files to be displayed as images or simple file loading to be delivered as an image from a server if Java is not available.
    • The value Java HTML5 would test for Java and then, if that is not available, use GLmol or HTML5-only ChemDoodle or JSmol (whichever is made available).
    • The value Java WebGL HTML5 Image allows at least some model on all standard platforms.
Note that Jmol-JSO cannot detect if the user has intentionally disabled Java in some browsers (at least Microsoft Internet Explorer). Thus, users intentionally disabling Java may only get the Java option, and a message will be displayed that Java is not available.
  • Info.width <300> The width of the applet in pixels or expressed as percent of its container width as a string in quotes: "100%". Note that for a percent to work, all surrounding HTML elements must explicitly implement the CSS attribute style=width:....

Callbacks

There are several parameters that in Jmol.js could be set using the jmolSetParameter() or jmolSetCallback() functions. These are discussed in sets:

  • Info.animframecallback
  • Info.appletreadycallback
  • Info.atommovedcallback
  • Info.echocallback
  • Info.evalcallback
  • Info.hovercallback
  • Info.loadstructcallback
  • Info.messagecallback
  • Info.pickcallback
  • Info.measurecallback
  • Info.minimizationcallback
  • Info.resizecallback
  • Info.scriptcallback
  • Info.synccallback

These callbacks allow the page designer to get information about what is happening within the applet. The name of a JavaScript function, in single- or double-quotes should be given here if desired. Do not use function() {....} syntax.

Misc.

  • Info.language

This setting can be used to specify a language to be used in the JmolApplet interface (primarily for testing; the default language used in the applet is automatically detected from the system settings of the user's browser). Please note that language (localization) is not currently implemented in non-Java surrogates (including JSmol).

  • Info.usecommandthread

The signed Jmol applet generally runs commands by passing them to a command thread that is established when the applet is created, while the unsigned applet does not. You can change this behavior if you are observing Java security issues. Otherwise, it should not be adjusted.

  • Info.boxbgcolor
  • Info.boxfgcolor
  • Info.boxmessage
  • Info.progressbar
  • Info.progresscolor

These five values generally should not be adjusted.

Contributors

AngelHerraez