public class JSME
extends java.lang.Object
implements org.timepedia.exporter.client.Exportable
Constructor and Description |
---|
JSME(java.lang.String htmlId) |
JSME(java.lang.String htmlId,
com.google.gwt.core.client.JavaScriptObject parameterJso)
/**
|
JSME(java.lang.String htmlId,
java.lang.String width,
java.lang.String height) |
JSME(java.lang.String htmlId,
java.lang.String width,
java.lang.String height,
com.google.gwt.core.client.JavaScriptObject parameters)
parameters is a JavaScript object for additional customization, e.g.
|
Modifier and Type | Method and Description |
---|---|
void |
activateMarkerColor(int colorIndex)
Choose the background color to be used for the atom or bond.
|
void |
addClickHandler(JsClosureJsme jsEventHandler)
Add a click handler to a JSME instance.
|
void |
addMouseDownHandler(JsClosureJsme jsEventHandler)
Add a mouse down handler to a JSME instance.
|
void |
addMouseOutHandler(JsClosureJsme jsEventHandler)
Add a mouse out handler to a JSME instance.
|
void |
addMouseOverHandler(JsClosureJsme jsEventHandler)
Add a mouse over handler to a JSME instance.
|
void |
alert(java.lang.String message)
Display an alert box with the look and feel of JSME (Mosaic GWT library)
|
void |
clear()
Same effect as clicking on the clear icon: clear the molecular drawing area
|
static void |
clearFontCache()
JSME computes font height and string width to display text in SVG (or VML).
|
void |
deferredRepaint()
Repaint the applet after the browser event loop returns.
|
java.lang.String[] |
getAlldefinedCallBackNames()
Return an array containing all possible callback names.
|
jsapplet.nativejs.JsArrayString |
getAllGraphicsString()
Returns all graphics representations used in the applet, either a SVG or a VML string
This is an advanced feature.
|
JSMEatom |
getAtom(int molIndex,
int atomIndex)
Molecule and atom indices are starting at 1.
|
com.google.gwt.core.client.JavaScriptObject |
getAtomAdditionalData(int atomE)
Retrieve the javaScript object that was stored in the JSME atom object or null
|
java.lang.String[] |
getBackGroundColorPalette()
Returns the list of colors used for highlighting
atoms and bonds (background color) in hexadecimal format
|
JSMEBond |
getBond(int molIndex,
int bondIndex)
Same comments as for atom.
|
com.google.gwt.core.client.JavaScriptObject |
getBondAdditionalData(int bondE)
Retrieve the javaScript object that was stored in the JSME bond object or null
|
com.google.gwt.core.client.JavaScriptObject |
getCallBack(java.lang.String callbackName)
Generic callback
|
java.lang.String |
getCopyToClipboardFormat()
Set the file format used for copying to the clipboard with the Ctrl C keyboard shortcut and drag and drop.
|
int |
getCreationIndex()
The JSME class keeps tract of the number of instance that have been created.
|
java.lang.String |
getHelpURL() |
double |
getMenuScale() |
java.lang.String |
getMenuXShortcuts()
Get the custom keyboard shortcuts letters that have been set using
the
setMenuXShortcuts(String) method |
boolean |
getMolecularAreaAntiAlias()
Return the antialias setting for the molecular drawing area
|
java.lang.String |
getMolecularAreaGraphicsString()
Returns the graphics representation used in the molecular area, either a SVG or a VML string
This is an advanced feature.
|
float |
getMolecularAreaLineWidth() |
double |
getMolecularAreaScale() |
JSMEmolecule |
getMolecule(int molIndex)
Molecule index starts at 1.
|
java.lang.String[] |
getMultiSDFstack()
JSME accepts a SDF with multiple records.
|
boolean |
getNewButtonStatus()
Get the status of the NEW button in the GUI.
|
java.lang.String |
getNotifyStructuralChangeJSfunction()
Deprecated.
|
int |
getNumberOfColorsForBackGroundPalette()
Returns the number of colors used for highlighting
atoms and bonds (background color)
|
int |
getOffsetHeight()
Gets the object's offset height in pixels.
|
com.google.gwt.core.client.JsArrayInteger |
getOffsetSize()
Gets the object's offset width and height in pixels.
|
int |
getOffsetWidth()
Gets the object's offset width in pixels.
|
com.google.gwt.user.client.Element |
getParentContainer()
Return the parent DOM element that contains myself.
|
java.lang.String |
getPasteLabel()
|
java.lang.String |
getPrePasteJSfunction() |
jsapplet.nativejs.JsArrayString |
getSupportedFileFormats()
Retrieve the list of all supported file formats, such as SMILES, MOL, INCHI, ...
|
java.lang.String |
getWebSearchInchiKeyBaseUrl() |
boolean |
hasMarkedAtom()
Return true if at least one of the atom has a marking or an atom map larger than 0
|
boolean |
hasMolecule()
Return true if the drawing canvas contains at least an atom
|
void |
initializationError(java.lang.String message) |
boolean |
isDepictMode() |
boolean |
isVisible()
Returns whether the given element is visible in a way consistent with
setVisible(boolean) . |
java.lang.String |
jmeFile() |
java.lang.String |
molFile() |
java.lang.String |
molFile(boolean isV3000) |
java.lang.String |
nonisomericSmiles() |
int |
numberOfMolecules()
Return the number of molecules availble in the editor
|
void |
options(java.lang.String options) |
boolean |
read_MOL_SDF_RXN(java.lang.String s)
Deprecated.
|
void |
readGenericMolecularInput(java.lang.String s) |
void |
readGenericMolecularInput(java.lang.String s,
boolean fireReadEvent) |
void |
readMolecule(java.lang.String s)
Read a molecular structure encoded in JME format.
|
void |
readMolFile(java.lang.String s)
Read a molecular structure encoded in MOL format, or a reaction encoded in RXN format.
|
void |
repaint()
Redraw the whole applet if it is visible
|
static int |
replaceAllAppletsByJSME()
Scan the DOM for DIV's containing an attribute code="JME.class" and install a running JSME.
|
static int |
replaceAllAppletsByJSME(JsClosure jsFunctionWithJsmeInstanceArg)
Scan the DOM for DIV's containing an attribute code="JME.class" and install a running JSME.
|
void |
reset() |
void |
resetAtomColors(int molIndex)
Clear all background colors for all atom of the molecule (fragment) specified by the argument.
|
void |
resetAtomMaps(int molIndex)
Clear all mapping numbers for all atom of the molecule (fragment) specified by the argument.
|
void |
resetAtomMarks(int molIndex) |
void |
resetBondColors(int molIndex)
If mol index is 0, then the bond indices are valid for the molecular ensemble
Reset background colors
|
void |
resetBondMarks(int molIndex) |
void |
setAction(int action)
select one of the menu action without having to click on the menu.
|
void |
setAfterDepictEditToggleEventHandler(JsClosureJsme jsEventHandler) |
void |
setAfterPasteCallback(com.google.gwt.core.client.JavaScriptObject callbackFunction)
Deprecated.
|
void |
setAfterStructureModifiedCallback(com.google.gwt.core.client.JavaScriptObject callbackFunction)
Deprecated.
|
void |
setAntialias(boolean onOff)
Set globally antialias
|
void |
setAtomAdditionalData(int atomE,
com.google.gwt.core.client.JavaScriptObject data,
boolean pushOnUndoStack,
boolean emitJSMEEvent)
Store any javaScript object in the JSME atom object
|
void |
setAtomBackgroundColors(int molIndex,
java.lang.String atomAndColorCSV)
If mol index is 0, then the atom indices are valid for the molecular ensemble.
|
void |
setAtomMolecularAreaFontSize(float fs) |
void |
setAtomToHighLight(int molIndex,
int atomIndex)
Highlight atom like a mouse over.
|
void |
setBackGroundColorPalette(java.lang.String[] palette)
Set the list of colors used for highlighting
atoms and bonds (background color) in hexadecimal format.
|
void |
setBeforePasteCallback(com.google.gwt.core.client.JavaScriptObject callbackFunction)
Deprecated.
|
void |
setBondAdditionalData(int bondE,
com.google.gwt.core.client.JavaScriptObject data,
boolean pushOnUndoStack,
boolean emitJSMEEvent)
Store any javaScript object in the JSME bond object
|
void |
setBondBackgroundColors(int molIndex,
java.lang.String bondAndColorCSV)
If mol index is 0, then the bond indices are valid for the molecular ensemble.
|
void |
setBondToHighLight(int molIndex,
int bondIndex)
Highlight bond like a mouse over.
|
void |
setCallBack(java.lang.String callbackName,
com.google.gwt.core.client.JavaScriptObject callbackFunction)
Generic call back.
|
void |
setCopyToClipboardFormat(java.lang.String format)
Set the file format to be used for copying to the clipboard with the Ctrl C keyboard shortcut and drag and drop
|
void |
setHeight(java.lang.String height)
Sets the object's height.
|
void |
setHelpURL(java.lang.String url)
set the url to display the JSME help page.
|
void |
setMarkerColor(java.lang.String hexColor)
Deprecated.
|
void |
setMarkerMenuBackGroundColorPalette(com.google.gwt.core.client.JsArray<ColorSpec> palette)
Set the list of colors used for highlighting
atoms and bonds (background color) in hexadecimal format
provide a name for each color that will be shown in the marker pop up menu,
the markerMenu option must be set.
|
void |
setMenuScale(double scale) |
void |
setMenuXShortcuts(java.lang.String shortcuts)
Specify custom keyboard shortcuts letters for the X menu box.
|
void |
setMolecularAreaAntiAlias(boolean molecularAreaAntiAlias)
Set antialias for the molecular drawing area
|
void |
setMolecularAreaLineWidth(float molecularAreaLineWidth)
Line width in pixel
|
void |
setMolecularAreaScale(double scale) |
void |
setNewButtonStatus(boolean newStatus)
Set the status of the NEW button in the GUI.
|
void |
setNotifyAtomHighLightChangeJSfunction(java.lang.String notifyAtomHighLightJSfunction)
Deprecated.
|
void |
setNotifyStructuralChangeJSfunction(java.lang.String notifyStructuralChangeJSfunction)
Deprecated.
|
void |
setPasteLabel(java.lang.String pasteLabel)
Set the label of the context popup menu for pasting string, instead of using the default label.
|
void |
setPrePasteJSfunction(java.lang.String prePasteJSfunction)
Deprecated.
|
void |
setSize(int width,
int height)
Sets the object's size.
|
void |
setSize(int width,
int height,
boolean resizeParent)
Sets the object's size.
|
void |
setSize(java.lang.String width,
java.lang.String height)
Sets the object's size.
|
void |
setSize(java.lang.String width,
java.lang.String height,
boolean resizeParent)
Sets the object's size.
|
void |
setStarColor(java.lang.String hexColor)
Deprecated.
|
void |
setSubstituent(java.lang.String s)
Select the next FG to be used.
|
void |
setTemplate(java.lang.String templateAsJmeMol,
java.lang.String templateName)
Provide a template, a molecular fragment with one marked atom, in JME format.
|
void |
setUserInterfaceBackgroundColor(java.lang.String bgColor)
Choose another background color for the GUI frame and the dialog boxes
|
void |
setVisible(boolean visible)
Shows or hides the given element.
|
void |
setWebSearchInchiKeyBaseUrl(java.lang.String webSearchInchiKeyBaseUrl)
Set the base url for inchi key search.
|
void |
setWidth(java.lang.String width)
Sets the object's width.
|
void |
showInfo(java.lang.String message)
Display a message in the bottom bar.
|
java.lang.String |
smiles() |
int |
totalNumberOfAtoms()
Return the total number of atoms (for all molecules)
|
int |
totalNumberOfBonds()
Return the total number of bonds (for all molecules)
|
public JSME(java.lang.String htmlId, java.lang.String width, java.lang.String height)
public JSME(java.lang.String htmlId)
public JSME(java.lang.String htmlId, java.lang.String width, java.lang.String height, com.google.gwt.core.client.JavaScriptObject parameters)
htmlId
- width
- height
- parameters
- public JSME(java.lang.String htmlId, com.google.gwt.core.client.JavaScriptObject parameterJso)
htmlId
- parameterJso
- public jsapplet.nativejs.JsArrayString getAllGraphicsString()
public java.lang.String getMolecularAreaGraphicsString()
public java.lang.String getWebSearchInchiKeyBaseUrl()
setWebSearchInchiKeyBaseUrl(String webSearchInchiKeyBaseUrl)
public void setWebSearchInchiKeyBaseUrl(java.lang.String webSearchInchiKeyBaseUrl)
webSearchInchiKeyBaseUrl:
- the web search InchiKey base Url to set
Note: alternatively, one can replace the web search by a custom function call.
See setCallBack(String,JavaScriptObject)
To find the inchi key search callback name, see getAlldefinedCallBackNames()
See also see getWebSearchInchiKeyBaseUrl()
public double getMolecularAreaScale()
public void setMolecularAreaScale(double scale)
public double getMenuScale()
public void setMenuScale(double scale)
public int getCreationIndex()
public com.google.gwt.user.client.Element getParentContainer()
public void setNewButtonStatus(boolean newStatus)
public boolean getNewButtonStatus()
public void initializationError(java.lang.String message)
public void setAntialias(boolean onOff)
onOff
- public void options(java.lang.String options)
options,
- a comma separated value list - same as original JMEpublic void readMolecule(java.lang.String s)
s
- public void readMolFile(java.lang.String s)
s,
- a molecular structure@Deprecated public boolean read_MOL_SDF_RXN(java.lang.String s)
s
- public void readGenericMolecularInput(java.lang.String s)
public void readGenericMolecularInput(java.lang.String s, boolean fireReadEvent)
public java.lang.String molFile(boolean isV3000)
isV3000
- public java.lang.String molFile()
public java.lang.String smiles()
public java.lang.String nonisomericSmiles()
public java.lang.String jmeFile()
public void reset()
public void clear()
public static void clearFontCache()
public void setTemplate(java.lang.String templateAsJmeMol, java.lang.String templateName)
templateAsJmeMol
- templateName
- public void setUserInterfaceBackgroundColor(java.lang.String bgColor)
bgColor
- : string in RGB hex format like "#FFFBBCC"@Deprecated public void setStarColor(java.lang.String hexColor)
hexColor
- : string in RGB hex format like "#FFFBBCC"@Deprecated public void setMarkerColor(java.lang.String hexColor)
hexColor
- : string in RGB hex format like "#FFFBBCC"public void setSubstituent(java.lang.String s)
s
- public void setMenuXShortcuts(java.lang.String shortcuts)
shortcuts
- public java.lang.String getMenuXShortcuts()
setMenuXShortcuts(String)
methodpublic void repaint()
public void deferredRepaint()
runAfterBrowserEventLoopReturns
public java.lang.String getHelpURL()
public void setHelpURL(java.lang.String url)
url
- public void alert(java.lang.String message)
message
- public void showInfo(java.lang.String message)
message
- @Deprecated public java.lang.String getNotifyStructuralChangeJSfunction()
@Deprecated public void setNotifyStructuralChangeJSfunction(java.lang.String notifyStructuralChangeJSfunction)
setAfterStructureModifiedCallback(JavaScriptObject)
method instead.notifyStructuralChangeJSfunction
- the name of the JavaScript function
This method is deprecated. Use setCallBack(String,JavaScriptObject)
instead.@Deprecated public void setAfterStructureModifiedCallback(com.google.gwt.core.client.JavaScriptObject callbackFunction)
callbackFunction,
- a Javascript function - not the name of the function
This method is deprecated. Use setCallBack(String,JavaScriptObject)
instead.public void setCallBack(java.lang.String callbackName, com.google.gwt.core.client.JavaScriptObject callbackFunction)
getAlldefinedCallBackNames()
for all predefined callback names.callbackName
- callbackFunction
- public com.google.gwt.core.client.JavaScriptObject getCallBack(java.lang.String callbackName)
callbackName
- public java.lang.String[] getAlldefinedCallBackNames()
public void setAtomToHighLight(int molIndex, int atomIndex)
molIndex
- (first index is 1, not 0)atomIndex
- (first index is 1, not 0)public void setBondToHighLight(int molIndex, int bondIndex)
molIndex
- (first index is 1, not 0)bondIndex
- (first index is 1, not 0)@Deprecated public void setNotifyAtomHighLightChangeJSfunction(java.lang.String notifyAtomHighLightJSfunction)
setCallBack(String,JavaScriptObject)
instead.notifyAtomHighLightJSfunction
- must be a string@Deprecated public void setAfterPasteCallback(com.google.gwt.core.client.JavaScriptObject callbackFunction)
callbackFunction
- with two arguments, the jsme instance and the content that was pasted.
This method is deprecated. Use setCallBack(String,JavaScriptObject)
instead.@Deprecated public void setBeforePasteCallback(com.google.gwt.core.client.JavaScriptObject callbackFunction)
callbackFunction
- with two arguments, the jsme instance and the content that was pasted.
This method is deprecated. Use setCallBack(String,JavaScriptObject)
instead.public int getNumberOfColorsForBackGroundPalette()
public java.lang.String[] getBackGroundColorPalette()
public void setBackGroundColorPalette(java.lang.String[] palette)
setMarkerMenuBackGroundColorPalette
public void setMarkerMenuBackGroundColorPalette(com.google.gwt.core.client.JsArray<ColorSpec> palette)
if labels are not needed.
public void activateMarkerColor(int colorIndex)
colorIndex
- (first value is 1)public java.lang.String[] getMultiSDFstack()
public void setAtomBackgroundColors(int molIndex, java.lang.String atomAndColorCSV)
molIndex
- atomAndColorCSV
- : at,c,at,c,at,c, ... at: atom index; c: color indexpublic void setBondBackgroundColors(int molIndex, java.lang.String bondAndColorCSV)
molIndex
- bondAndColorCSV
- : b,c,b,c,b,c, ... at: bond index; c: color indexpublic void resetAtomMaps(int molIndex)
molIndex
- public void resetAtomMarks(int molIndex)
public void resetBondMarks(int molIndex)
public void resetAtomColors(int molIndex)
molIndex
- public void resetBondColors(int molIndex)
molIndex
- public java.lang.String getPrePasteJSfunction()
setPrePasteJSfunction
@Deprecated public void setPrePasteJSfunction(java.lang.String prePasteJSfunction)
prePasteJSfunction
- This method is deprecated. Use setCallBack(String,JavaScriptObject)
instead.public boolean hasMarkedAtom()
public boolean hasMolecule()
public java.lang.String getPasteLabel()
public void setPasteLabel(java.lang.String pasteLabel)
setPrePasteJSfunction(String)
pasteLabel
- public void setCopyToClipboardFormat(java.lang.String format)
format
- getCopyToClipboardFormat()
,
getSupportedFileFormats()
public java.lang.String getCopyToClipboardFormat()
getSupportedFileFormats()
public jsapplet.nativejs.JsArrayString getSupportedFileFormats()
getCopyToClipboardFormat()
,
setCopyToClipboardFormat
public float getMolecularAreaLineWidth()
public void setMolecularAreaLineWidth(float molecularAreaLineWidth)
molecularAreaLineWidth
- public void setAtomMolecularAreaFontSize(float fs)
public boolean getMolecularAreaAntiAlias()
public void setMolecularAreaAntiAlias(boolean molecularAreaAntiAlias)
molecularAreaAntiAlias
- public void setSize(java.lang.String width, java.lang.String height)
width
- the applet's new width, in CSS units (e.g. "10px", "1em", "100%")height
- the applet's new height, in CSS units (e.g. "10px", "1em")public void setSize(int width, int height)
width
- the applet's new width, in pixelsheight
- the applet's new height, in pixelspublic void setSize(java.lang.String width, java.lang.String height, boolean resizeParent)
width
- the applet's new width, in CSS units (e.g. "10px", "1em", "100%")height
- the applet's new height, in CSS units (e.g. "10px", "1em")public void setSize(int width, int height, boolean resizeParent)
width
- the object's new width, in pixelsheight
- the object's new height, in pixelspublic void setWidth(java.lang.String width)
width
- the object's new width, in CSS units (e.g. "10px", "1em")public void setHeight(java.lang.String height)
height
- the object's new height, in CSS units (e.g. "10px", "1em")public com.google.gwt.core.client.JsArrayInteger getOffsetSize()
public int getOffsetWidth()
public int getOffsetHeight()
public void setVisible(boolean visible)
Warning: implemented with a heuristic based on the "display" style:
clears the "display" style to its default value if visible
is true,
else forces the style to "none". If the "display" style is set to "none"
via CSS style sheets, the element remains invisible after a call to
setVisible(true)
.
public boolean isVisible()
setVisible(boolean)
.
Warning: implemented with a heuristic. The value returned takes into account only the "display" style, ignoring CSS and Aria roles, thus may not accurately reflect whether the element is actually visible in the browser.
public static int replaceAllAppletsByJSME()
public static int replaceAllAppletsByJSME(JsClosure jsFunctionWithJsmeInstanceArg)
getCreationIndex
.jsFunctionWithJsmeInstanceArg:
- a function defined in JavaScript such as : function(eachJsmeInstance){alert("JSME created. Creation index: "+ eachJsmeInstance.getCreationIndex() )};public void addClickHandler(JsClosureJsme jsEventHandler)
jsEventHandler:
- a JavaScript function with two arguments.public void addMouseDownHandler(JsClosureJsme jsEventHandler)
jsEventHandler:
- a JavaScript function with two arguments.public void addMouseOverHandler(JsClosureJsme jsEventHandler)
jsEventHandler:
- a JavaScript function with two arguments.public void addMouseOutHandler(JsClosureJsme jsEventHandler)
jsEventHandler:
- a JavaScript function with two arguments.public void setAfterDepictEditToggleEventHandler(JsClosureJsme jsEventHandler)
public void setAction(int action)
action
- public boolean isDepictMode()
public void setAtomAdditionalData(int atomE, com.google.gwt.core.client.JavaScriptObject data, boolean pushOnUndoStack, boolean emitJSMEEvent)
atomE:
- ensemble based indexdata:
- any JavasStipt variable, content, value, ...public com.google.gwt.core.client.JavaScriptObject getAtomAdditionalData(int atomE)
atomE:
- atom ensemble index (first index is 1, not 0)public int totalNumberOfAtoms()
public void setBondAdditionalData(int bondE, com.google.gwt.core.client.JavaScriptObject data, boolean pushOnUndoStack, boolean emitJSMEEvent)
bondE:
- ensemble based indexdata:
- any JavasStipt variable, content, value, ...public com.google.gwt.core.client.JavaScriptObject getBondAdditionalData(int bondE)
bondE:
- ensemble based indexpublic int totalNumberOfBonds()
public int numberOfMolecules()
public JSMEmolecule getMolecule(int molIndex)
public JSMEatom getAtom(int molIndex, int atomIndex)
molIndex
- (first index is 1, not 0)atomIndex
- (first index is 1, not 0)totalNumberOfAtoms()
,
setAtomAdditionalData(int, JavaScriptObject, boolean, boolean)
,
getAtomAdditionalData(int)
public JSMEBond getBond(int molIndex, int bondIndex)
molIndex
- bondIndex
- getAtom(int, int)
,
totalNumberOfBonds()
,
setBondAdditionalData(int, JavaScriptObject, boolean, boolean)
,
getBondAdditionalData(int)