Set custom templates - how?

User ee508a317e

19-11-2010 15:25:45

Hello,


We are trying to add a custom template to SktechPane that contains a set of custom amino acids but the API docs and example docs don't agree. Please can someone provide some assistance here.


According to the template example at URL: http://www.chemaxon.com/marvin/examples/beans/sketch-templates/index.html we can use:



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");

The last setting allows us to specify our own template file in our own location I believe. But the UserSettings class has no constant named TEMPLATES.



Thanks.

ChemAxon 7c2d26e5cf

24-11-2010 12:55:18

We are checking it.

ChemAxon 5433b8e56b

26-11-2010 13:25:00

Hi Tim,


Yes you are right, we have eliminated those constants from the UserSettings class without refreshing the examples correctly. There is a documentation about the template related parameter settings on applets and bean components in Marvin. Here you can find it: Structure Templates.


The correct usage for now is to give the deleted constants value in the string parameter. We will make efforst on making this more comfortable, currently this is the way you can add templates to the bean component:



sketchPane.setParams(
"ttmpls0=*Generic*chemaxon/marvin/templates/generic.t\n"+
 "ttmpls1=*Rings*chemaxon/marvin/templates/rings.t\n"+
"xtmpls=chemaxon/marvin/templates/wedgebonds.t\n"+
"tmpls11=:Conformers:chemaxon/marvin/templates/conformers.t\n");



Regards,
Istvan



User 6352b89034

28-11-2010 15:55:59

this prgrom is very cool

ChemAxon 990acf0dec

29-11-2010 08:02:37

Thanks :)

User ee508a317e

30-11-2010 17:37:36

Hello Istvan,


Are these template files loaded via the classloader from a jar file or are they loaded from files on disk? The path quoted in your example could be a classpath or a file pathname relative to the working directory.


Also it is possible for us to have a custom templates file loaded from a URL rather than from a file?


 


Thanks,


Tim

ChemAxon 5433b8e56b

01-12-2010 15:26:19

Hi Tim,

the lookup order is the following:

- if the parameter contains a URL, then the template file is loaded form the URL.
- if it is not a URL then if there is a file in the given path relative to the classpath, then that file is being used.
- if the classpath not contains the file, and the running application is an applet, then the template is being searched in the applet codebase on the server
- finally the file is being searched in the chemaxon directory inside the home directory of the user. (on osx and linux it is called ".chemaxon") In this case the path is relative to the chemaxon directory.

If the path links to a directory then the directory contents are being used as templates, in this case the files can contain also multiple molecules. This is true for local file system and ftp links.


Regards,
Istvan