MarvinView: parameters and events


  1. Parameters
    1. Applet only parameters
    2. 3D and animation
    3. Molecule tables
      1. layout
      2. param
      3. celli
  2. Events fired by the JavaBean
  3. Troubleshooting - MView and JMView tables

1   Parameters

Parameters of the MView and JMView applets can be set using the <param> HTML tag. Parameters of the MViewPane JavaBean can be set using the setParams function.

dispQuality Display quality.
  • 0 - low quality, faster rendering
  • 1 - high quality (antialiasing), slower rendering
implicitH How to display H labels.
  • off
  • hetero - on heteroatoms
  • heteroterm - on hetero or terminal atoms
  • all - all atoms
explicitH Show explicit hydrogens. true
chiralitySupport When to show atom chirality (R/S).
  • off - never
  • selected - if the chiral flag is set for the molecule or the atom's enhanced stereo type is absolute
  • all - always
ezVisible Show (true) or hide (false) E/Z labels. false
navmode Mouse drag action.
  • translate - move the structure
  • zoom - change magnification
  • rotZ - rotate in the screen's plane
  • rot3d - 3D rotation
background Background color in hexa.  
molbg Molecule background color in hexa.  
colorScheme Color scheme.
  • mono - monochrome
  • cpk - Corey-Pauling-Kultun
  • shapely - shapely (residue types)
  • group - residue sequence numbers
winScale Magnification in the zoom window. A 1.54 Å long C-C bond is magnified to winScale pixels. 26.4
tabScale Magnification in the molecule table. Each cell has the specified magnification if positive. The scaling is automatic if negative (-1). -1
autoTabScale Automatically change scale when component size changed. Only in the swing version, only applicable to the MViewPane bean. false
atomsize Atom label font size in C-C bond length units:
atomsize*1.54 Å = atomsize*scale points,
where scale is the current magnification.
bondWidth Width of double bond in C-C bond length units:
width*1.54 Å = width*scale pixels,
where scale is the current magnification.
molFormat Default file format: mol, csmol, smiles, cml, pdb, pov, sybyl, or xyz. mol
debug Debug mode. Possible values: 0, 1, 2. 0
selectable Use selectable=false to forbid molecule selection with mouse click. true
Comma-separated list of atom numbers (0, ..., n-1).
Selected atoms are highlighted.
In a simple one-molecule viewer, selection0 must be used. In a molecule table, selectionn corresponds to molecule cell n.
editable Modes: display only (0) or editable (1, 2). If editable=2, then doubleclick launches MarvinSketch (instead of a viewer window). 0
downWedge Wedge bond display convention. Down wedge points downward in MDL's convention (mdl), upward (at the chiral center) in Daylight's (daylight). mdl
importConv Conversion(s) after molecule loading. Currently the following options are implemented:
"a" or "+a"     aromatization
"-a" dearomatization
"H" or "+H"     add explicit H atoms
"-H" remove explicit H atoms
"c" automatic cleaning
cleanOpts Options for cleaning (2D or 3D, depending on cleanDim)
clean2dOpts Options for 2D cleaning (0D->2D)
  • O0 - no optimization
  • O1 - optimize if needed
  • O2 - optimize
clean3dOpts Options for 3D cleaning (0D->3D)
  • O0 - lightweight optimization
  • OD - Dreiding optimization
cleanDim Number of space dimensions for cleaning.
  • 2 - two-dimensional cleaning
  • 3 - three-dimensional cleaning
See also: cleanOpts, importConv.
atomSet0.1 ... atomSet0.63
atomSet1.1 ... atomSet1.63
Atom sets. Comma separated list of atom indices (0, ..., n-1). An atom in molecule cell number N will be in set M if its number appears in the atomSetN.M list. By default, all atoms are in set 0.  
Atom set color in hexa.  
bondSet0.1 ... bondSet0.63
bondSet1.1 ... bondSet1.63
Bond sets. Comma separated list of atom index pairs in i-j format, where i, j = 0, ..., n-1. A bond in molecule cell number N will be in set M if the corresponding atom pair appears in the bondSetN.M list. By default, all bonds are in set 0.  
Bond set color in hexa.  
showSets Show the specified atom sets only. Comma separated list of set sequence numbers (0, ..., 63).  
setColoringEnabled Atom/bond set coloring. true
atomSymbolsVisible Show atom symbols
  • true - display
  • false - do not display
atomNumbersVisible Show atom numbers
  • true - display
  • false - do not display
atomMappingVisible Show atom mapping
  • true - display
  • false - do not display
grinv Display graph invariants
  • true - display
  • false - do not display
skin Change the component's Look & Feel (only in SWING). If you do not specify this parameter, Marvin will use the default LookAndFeel style.
This parameter value is the name of the new LookAndFeel class.
detachable Enable or disable popping up detached viewer window. If this parameter is true, the selected molecule can be displayed in separate window by selecting "Window" menu item in the popup menu or by doubleclicking on the canvas. Viewer is not detachable if detachable parameter is false. (See also editable.) true
importEnabled Allow or forbid molecule import. If this parameter is false, paste function is disabled in MarvinView, also Import option is disabled in the Molecule Source window. (Use editable parameter to forbid the editing of the molecules.) true
sketchHelp Sketcher help contents. chemaxon/marvin/help
sketchQuickHelp Sketcher quick help. chemaxon/marvin/help
viewHelp Viewer help contents. chemaxon/marvin/help
viewQuickHelp Viewer quick help. chemaxon/marvin/help

Simple viewer applet example:

<applet CODE=MView WIDTH=100 HEIGHT=100>
<param NAME="molbg" VALUE="#a0ffa0">
<param NAME="mol" VALUE="Pyrrole\

1.1   Applet only parameters

mol The URL of the molecule file or the molfile itself (inline) in MDL mol or compressed mol format.
If you specify the molfile inline in an HTML file (as an applet parameter), then you must end all lines with "\" (backslash). The file format and/or import options can be specified if one of the following forms is used:
"file(format:options)", or
If the MULTISET option is specified, then a multi-molecule file is read into one molecule object containing multiple atom sets.
Examples: "", ",f1.4C4)"
preload Comma-separated list of external modules to preload. External modules are class files in the chemaxon/marvin/modules directory.
moduleargument of getM() call that requires it
MolExport "mol", "csmol"
SmilesExport "smiles"
CmlExport "cml"
Parity "mol", "smiles" (but not "smiles:0")
PdbExport "pdb"
PovExport "pov"
SybylExport "sybyl"
XYZExport "xyz"
Note. Preloading is required if you call getM from JavaScript in a buggy browser/JVM combination. Without preloading, getM might freeze Netscape 6 (Sun Java 1.3) and Netscape 3 would also fail because these browsers cannot call network functions from JavaScript.
cacheMols Store loaded molecules in an internal cache (true or false).
loadMols Comma-separated list of molfiles to preload. Useful for caching molecules in JavaScript "slideshows".

1.2   3D and animation

rendering Rendering style.
  • wireframe - wireframe
  • wireknobs - wireframe with knobs
  • sticks - 3D sticks
  • ballstick - ball & stick
  • spacefill - balls
stickThickness 3D stick diameter for "sticks" and "ballstick" rendering modes, in Angstroms. 0.1
ballRadius Ball radius for "ballstick" rendering mode, in units of covalent radius. 0.5
animate Start an XYZ animation sequence, or starts rotating the specified 3D molecule(s).
Possible values: off, all, or a comma-separated list of molecule indices (0...n-1).
Note: This parameter does not apply to beans, only to applet.
animFPS Number of frames per second in 3D animation. 10
animDelay Delay (seconds) before repeating the animation. 0
animSync Whether the animations in different cells should be synchronized. false
Spinning rate and axis for animated molecules. Spinning rate is specified in degrees per second, the axis is specified with a 3D vector. Numbers are separated by commas.
Note: XYZ animations do not spin by default, only if this parameter is set.
Script containing a subset of RasMol commands delimited by semicolons. If this applet parameter is specified, then the mol parameter is neglected. The molecule(s) must be loaded using the load command in the script.
Note: To load the script from a file, use the script command:
<param NAME="script" VALUE="script myscript.spt">

1.3   Molecule tables

rows Number of "molecule rows", including the optional header row.
cols Number of "molecule columns".
visibleRows Number of visible rows. The table is scrollable if less than rows. Default value: visibleRows = rows.
visibleCols Number of visible columns. The table is scrollable if less than cols. Default value: visibleCols = cols.
layout Layout of molecule, label, button and checkbox components in a cell.
layoutH Layout for the header row.
param Parameters of the components.
paramH Parameters for the header row.
Contents of the cells.
Use these instead of the mol parameter.
border Border width in pixels. Default: 0 (no border between cells).
Increases the total applet WIDTH by border*(cols-1), and the HEIGHT by border*(rows-1).

1.3.1   layout

The layout and layoutH parameters are in the following format: ":rows:cols:type:k:l:h:w:anchor:fill:[weighty:[weightx:]]type:k:l:...", where : is the field separator, rows is the number of rows in the cell, cols is the number of columns, type is the type of the component in row k, column l of the current cell, h is the height of the component (rows), w is the width (columns).
The anchor parameter determines where to place the component if its size is smaller than its display area. It the component size is larger than the size of its text label, then anchor also sets the label alignment. Possible values: c (center), n (north), s (south), e (east), w (west), ne (northeast), etc.
The fill parameter determines how to resize the component if its size is smaller then its display area. Possible values: n (none), h (horizontal), v (vertical) or b (both).
The weights are nonnegative integers, zero by default. They determine how to distribute space. If all the weights are zero, all the components clump together in the center of the applet.

If you are familiar with Java, you might have noticed that anchor, fill, weightx and weighty have the same names as the fields of the GridBagConstraints class. The reason is that MarvinView uses the GridBagLayout class to determine the places and sizes of the components.

Component types: M (molecule), L (label), B (button), C (checkbox), T (text field) and I (image).


<param NAME=layout VALUE=":4:3:

1.3.2   param

In a param or paramH parameter, the first character is the field separator (`:' here). The first field is the type of the first component (M, L, B, C or T), followed by its n parameters in the forthcoming n fields. Then the same for the second component, etc. Component parameters:
:M:width:height width and height are in pixel units.
:L:fontprops fontprops: font properties.
fontprops: font properties,
description: description string,
target: target frame.
fontprops: font properties,
description: description string.
You may specify the checkbox group number in the type field, by writing gn next to the type-specifying character C, where n is the group number. No more than one button in a group can be pressed at the same time.
fontprops: font properties,
columns: number of columns,
editable: editable (rw) or read only (r).
The fontprops field usually contains only one number, the font size. Additional properties are "b" (bold font) and "i" (italic). A 12pt bold italic font is specified as "12bi".


<param NAME=param VALUE=":
C:10:select this molecule:
Cg0:10:include this structure:
B:10:search for more molecules like this:_self:

1.3.3   celli

In a celli parameter, the first character is the field separator (`|' here). The fields contain the component parameters in order.

M |molfile molfile: the molecule URL or the molecule itself (inline) in MDL mol or compressed mol format.
L |label label: the label string.
B |label|spec|action label: the button label,
spec: the special character (% from now),
action: the action string.
C |||||
label0: label for the unchecked state,
label1: label for the checked state,
state: default state (0, 1 or nothing),
action0: action string for unchecking,
action1: action string for checking.
For a "real" checkbox, both labels have to be empty string, otherwise the "checkbox" will be buttonlike.
If both action strings are empty, then the checkbox is disabled. To make it enabled without specifying JavaScript actions, the action values must be "-". Example: "|||1|-|-"
T |
string: initial value.
I |iconfile||
iconfile: GIF or JPEG file containing the icon,
action: image file or js:JavaScript code
title: window title, only used if action is an image file.

The action string can be an URL for buttons, a JPEG, PNG or GIF file for images, or js:javascript expression for buttons, checkboxes and images. The button action string may contain %C (where % is the special character), which is substituted with the checkbox states represented as a hexadecimal number. The nth bit in this number is the state of the nth checkbox.

A javascript expression can be used only if you specify the MAYSCRIPT attribute in the applet tag.

It is suggested to use celli parameter in MViewPane JavaBean to create an advanced layout (containing more visual elements than one molecule with a label, such as, checkboxes, buttons, images, etc.). Since Javascript is not supported in MarvinBeans: use ActionListeners and ItemListeners in your code instead of action strings. See marvinbeans/examples/view-checkbox/


<param NAME=cell2 VALUE="|\
  MSketch 04169816382D\\ 66 72  0  0  0  0  0  0  0  0999 V2000\mcIWFRwV60\
l0i01\M  END\|
not bad|
||1|js:cbx(1002,'not selected')|js:cbx(1002,'selected')|
 Include | Include ||js:cbx(1002,'no include')|js:cbx(1002,'include')|
 Exclude | Exclude ||js:cbx(1002,'no exclude')|js:cbx(1002,'exclude')|
 Search |%|searchmore.cgi?mol=1002&n=5&cbx=%C">

2   Events fired by the JavaBean

To handle the property change events of MViewPane, the java.beans.PropertyChangeListener interface must be implemented.

Property nameTypeMeaning
"mols#" Molecule[] Molecule(s) changed in the specified cell (# = 0, ..., n-1).
"implicitH" String Implicit Hydrogen display style changed.
"explicitH" Boolean Explicit Hydrogen display style changed.
true: show explicit H atoms
false: hide explicit H atoms
"navmode" String Drag action changed.
translate: Translate, zoom: Zoom, rotZ: Rotate, rot3d: Rotate in 3D
"colorScheme" String Color scheme changed.
"rendering" String Rendering style changed.
"stickThickness" Double Sticks diameter changed.
"ballRadius" Double Ball radius changed.
"grinv" Boolean Graph invariants displayed/not displayed.
"downWedge" String Down wedge bond orientation changed.
"animFPS" Double Animation frame rate changed.
"animDelay" Double Animation repeat delay changed.
"animSync" Double Animation synchronization changed.
"invisibleSets" Long Visibility of atom sets changed.
"winScale" Double Zoom window magnification changed.
"tabScale" Double Magnification for molecule cells changed.
"atomNumbersVisible" Boolean Visibility of atom numbers changed.
"atomMappingVisible" Boolean Visibility of atom mapping changed.
"popupMenusEnabled" Boolean Popup menus are enabled/disabled.
"detachable" Boolean Detachability of viewer changed.

Since the behaviour of buttons and checkboxes in molecule cells are similar as AbstractButton objects, they can fire ActionEvents and ItemEvents.

3   Troubleshooting - MView and JMView tables