Editor-Related Functions
chemwriter.loadEditor({String} domID, {Object} params)
Creates an editor instance within the DOM element identified by domID. Editor startup behavior can be changed through the settings contained in params, which supports the following properties:
- licensePath The path to the license file on your server.
- lineWidth The width of bond lines.
- lineOffset The distance between parallel multiple bond lines.
- atomLabelHeight The height of atom labels.
- hoverRadius The radius around which atoms and bonds will be detected as being hovered.
- deviceBondLength The length of bond lines in screen coordinates (i.e., pixels).
- molfile A molfile representation of the document to load. Defaults to empty string.
- enableClipboard When true, Editor will support pasting of binary and text data from desktop applications on Windows. Defaults to false.
- appletPath The path to the chemwriter-util.jar file enabling system clipboard integration.
- enableTools The String names of optional tools, contained in an array. Currently supported tools are: ‘wildcard-atom-bond’; ‘atom-list’; ‘increase-r-group’; ‘decrease-r-group’, ‘crossed-bond’, and ‘wavy-bond’. Defaults to empty array.
chemwriter.ui.Editor#getMolfile() -> {String}
Returns a representation of the Editor’s document in MDL molfile format.
chemwriter.ui.Editor#setMolfile({String} file)
Clears the editor, loads file, and centers the resulting document in the Canvas area.
chemwriter.ui.Editor#getFile({String} mimeType) -> {String}
Returns a representation of the current document encoded according the mimeType. The only MIME type supported at this time is chemwriter.app.MIMEType.MOLFILE.
chemwriter.ui.Editor#setFile({String} file)
Clears the editor, loads file, and centers the resulting document in the Canvas area. The only currently supported format at this time is Molfile.
chemwriter.ui.Editor#autocenter()
Centers the document within the Editor’s Canvas area.
chemwriter.ui.Editor#autoscale()
Scales the document to fit the bounds of the editor and centers the resulting view.
chemwriter.ui.Editor#clear()
Removes the contents of the Editor’s document. This operation is not undoable.
chemwriter.ui.Editor#isBlank() -> {Boolean}
Returns true if the Editor’s document contains any elements.
chemwriter.ui.Editor#getLineWidth() -> {Number}
Returns the width of bond lines.
chemwriter.ui.Editor#setLineWidth({Number} width)
Sets the width of bond lines.
chemwriter.ui.Editor#getLineOffset() -> {Number}
Returns the distance between multiple bond parallel lines.
chemwriter.ui.Editor#setLineOffset({Number} offset)
Sets the distance between multiple bond parallel lines.
chemwriter.ui.Editor#getHoverRadius() -> {Number}
Returns the radius around which atoms and bond midpoints will be detected as hovered.
chemwriter.ui.Editor#setHoverRadius({Number} radius)
Sets the radius around which atoms and bond midpoints will be detected as hovered.
chemwriter.ui.Editor#getAtomLabelHeight() -> {Number}
Returns the height of atom labels.
chemwriter.ui.Editor#setAtomLabelHeight({Number} height)
Sets the hight of atom labels.
chemwriter.ui.Editor#getDeviceBondLength() -> {Number}
Returns the bond length in device units.
chemwriter.ui.Editor#setDeviceBondLength({Number} length)
Sets the bond length in device units.
Painter-Related Functions
chemwriter.loadPainter({String} domID, {Object} params)
Creates a painter instance within the DOM element identified by domID. Startup behavior can be changed through the settings contained in params, which supports the following properties:
- licensePath The path to the license file on your server.
- lineWidth The width of bond lines.
- lineOffset The distance between parallel multiple bond lines.
- atomLabelHeight The height of atom labels.
- molfile A molfile representation of the document to load. Defaults to empty string.
chemwriter.ui.Painter#getFile({String} mimeType) -> {String}
Returns a representation of the current document encoded according the mimeType. The only MIME type supported at this time is chemwriter.app.MIMEType.MOLFILE.
chemwriter.ui.Painter#setFile({String} file)
Clears the painter, loads file, scales, and centers the resulting document. The only currently supported format at this time is Molfile.
Clipboard-Related Functions
chemwriter.system.Clipboard.getInstance() -> chemwriter.system.Clipboard
Returns a clipboard to be used together with an optional applet for pasting structure into the ChemWriter editor from Windows desktop applications.
Global Properties
chemwriter.app.MIMEType.MOLFILE
Identifier for Molfile MIME type ‘chemical/x-mdl-molfile’.