The Templates paragraph of the MarvinSketch User's Guide contains the basic description of templates, template groups and of their usage.
The Developer's Guide describes the ways of working with templates and template groups.
By default, MarvinSketch contains 12 template groups, as described in the Developer's Guide. The Generic and My Templates groups automatically appear on the Advanced Templates toolbar for easier access. In this example, the My Templates group contains one molecule, benzene.
The goal of this example is to customize the template structures of MarvinSketch in the following way:
The result of this customization can be seen on the picture below. The Conformers and My Templates template groups are not visible on the toolbar in this case.
The code below is taken from SketchTemplates.java
,
where the structure templates are customized using the
setParams
method of
the MSketchPane
class.
Currently this is the only way of defining template groups.
In the example, the characters * and : are used as delimiters.
sketchPane.setParams( UserSettings.TOOLBAR_TEMPLATES+"0=*Generic*chemaxon/marvin/templates/generic.t\n"+ UserSettings.TOOLBAR_TEMPLATES+"1=*Rings*chemaxon/marvin/templates/rings.t\n"+ UserSettings.EXTRA_TEMPLATES+"=chemaxon/marvin/templates/wedgebonds.t\n"+ UserSettings.TEMPLATES+"11=:Conformers:chemaxon/marvin/templates/conformers.t\n");
Using the ttmpls parameter,
Generic and Rings template groups will appear on the toolbar beside the structures
defined by xtmpls.
The new template group called Conformers is defined with the tmpls
parameter, which makes it
available in the Template Library.
In this example we have used the wedgebonds.t and conformers.t compressed SDfiles. Note that currently template files can only be in SDfiles or compressed SDfiles formats with .t extension.
The same example is available as an applet example, showing the usage and effect of using these parameters in applets.