Package org.jmol.util
Class GenericApplet
- java.lang.Object
-
- org.jmol.util.GenericApplet
-
- All Implemented Interfaces:
javajs.api.JSInterface,JmolAppletInterface,JmolCallbackListener,JmolStatusListener,JmolSyncInterface
- Direct Known Subclasses:
Jmol
public abstract class GenericApplet extends java.lang.Object implements javajs.api.JSInterface, JmolAppletInterface, JmolStatusListener
A collection of all methods necessary for initialization of and communication with the applet. JavaScript and Java applet (which is still part of Jmol-SwingJS).
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.ObjectappletObjectprotected java.util.Map<CBK,java.lang.String>callbacksprotected java.lang.StringcodeBaseprotected java.lang.StringdocumentBaseprotected booleandoTranslateprotected java.lang.StringfullNameprotected java.lang.ObjectgRightprotected booleanhaveDocumentAccessprotected booleanhaveNotifiedErrorprotected java.lang.StringhtmlNameprotected java.util.Map<java.lang.String,java.lang.Object>htParamsprotected static java.util.Map<java.lang.String,java.lang.Object>htRegistryprotected static booleanisJSprotected booleanisSignedprotected booleanisStereoSlaveprotected java.lang.Stringlanguageprivate booleanloadingprotected booleanmayScriptprivate javajs.util.SBoutputBufferprivate static intSCRIPT_CHECKprivate static intSCRIPT_NOWAITprivate static intSCRIPT_WAITprotected java.lang.StringstatusFormprotected java.lang.StringstatusTextprotected java.lang.StringstatusTextareaprivate java.lang.StringsyncIdprotected Viewerviewerprotected java.util.Map<java.lang.String,java.lang.Object>vwrOptions
-
Constructor Summary
Constructors Constructor Description GenericApplet()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intcacheFileByName(java.lang.String fileName, boolean isAdd)voidcachePut(java.lang.String key, java.lang.Object data)(package private) static voidcheckIn(java.lang.String name, java.lang.Object applet)(package private) static voidcheckOut(java.lang.String name)private voidconsoleMessage(java.lang.String message)java.lang.StringcreateImage(java.lang.String fileName, java.lang.String type, java.lang.Object text_or_bytes, int quality)Starting with Jmol 11.8.RC5, for a context where the Jmol application is embedded in another application simply to send the returned message to the application.voiddestroy()protected java.lang.StringdoEval(java.lang.String strEval)return RAW JAVASCRIPT OBJECT, NOT A STRINGprotected java.lang.StringdoSendCallback(CBK type, java.lang.Object callback, java.lang.Object[] data, java.lang.String strInfo)protected voiddoShowDocument(java.net.URL url)protected voiddoShowStatus(java.lang.String message)java.lang.Stringeval(java.lang.String strEval)(package private) static voidfindApplets(java.lang.String appletName, java.lang.String mySyncId, java.lang.String excludeName, javajs.util.Lst<java.lang.String> apps)float[][]functionXY(java.lang.String functionName, int nX, int nY)for isosurface FUNCTIONXYfloat[][][]functionXYZ(java.lang.String functionName, int nX, int nY, int nZ)for isosurface FUNCTIONXYZjava.lang.StringgetAppletInfo()protected booleangetBooleanValue(java.lang.String propertyName, boolean defaultValue)java.lang.StringgetFullName()java.lang.ObjectgetGLmolView()This method is only called by JmolGLmol applet._refresh();protected java.lang.StringgetJmolParameter(java.lang.String paramName)java.util.Map<java.lang.String,java.lang.Object>getJSpecViewProperty(java.lang.String key)JSpecView shares the JmolSyncInterface; used to get JSpecViewintgetModelIndexFromId(java.lang.String id)java.lang.ObjectgetProperty(java.lang.String infoType)java.lang.ObjectgetProperty(java.lang.String infoType, java.lang.String paramInfo)java.lang.StringgetPropertyAsJSON(java.lang.String infoType)java.lang.StringgetPropertyAsJSON(java.lang.String infoType, java.lang.String paramInfo)java.lang.StringgetPropertyAsString(java.lang.String infoType)java.lang.StringgetPropertyAsString(java.lang.String infoType, java.lang.String paramInfo)java.util.Map<java.lang.String,java.lang.Object>getRegistryInfo()protected java.lang.StringgetValue(java.lang.String propertyName, java.lang.String defaultValue)private java.lang.StringgetValueLowerCase(java.lang.String paramName, java.lang.String defaultValue)booleanhandleEvent(java.awt.Event e)protected voidinit(java.lang.Object applet)private voidinitApplication()protected voidinitOptions()java.lang.StringloadDOMNode(java.lang.Object DOMNode)java.lang.StringloadInline(java.lang.String strModel)Deprecated.java.lang.StringloadInline(java.lang.String[] strModels)Deprecated.java.lang.StringloadInline(java.lang.String[] strModels, java.lang.String script)Deprecated.java.lang.StringloadInline(java.lang.String strModel, java.lang.String script)Deprecated.java.lang.StringloadInlineArray(java.lang.String[] strModels, java.lang.String script, boolean isAppend)java.lang.StringloadInlineString(java.lang.String strModel, java.lang.String script, boolean isAppend)voidnotifyAudioEnded(java.lang.Object htParams)voidnotifyCallback(CBK type, java.lang.Object[] data)booleannotifyEnabled(CBK type)private java.lang.StringnotifySync(java.lang.String info, java.lang.String appletName)java.lang.StringopenFile(java.lang.String fileName)possibly called from JSmolApplet.js upon start upvoidopenFileAsyncSpecial(java.lang.String fileName, int flags)voidoutput(java.lang.String s)booleanprocessMouseEvent(int id, int x, int y, int modifiers, long time)voidprocessTwoPointGesture(float[][][] touches)voidregister(java.lang.String id, JmolSyncInterface jsi)(package private) voidresizeDisplay(int width, int height)int[]resizeInnerPanel(java.lang.String data)voidscript(java.lang.String script)java.lang.StringscriptCheck(java.lang.String script)java.lang.StringscriptNoWait(java.lang.String script)private java.lang.StringscriptProcessor(java.lang.String script, java.lang.String statusParams, int processType)java.lang.StringscriptWait(java.lang.String script)java.lang.StringscriptWait(java.lang.String script, java.lang.String statusParams)java.lang.StringscriptWaitOutput(java.lang.String script)private java.lang.StringsendScript(java.lang.String script, java.lang.String appletName, boolean isSync, boolean doCallback)voidsetCallback(java.lang.String name, java.lang.Object callbackObject)set a callback either as a function or a function name from JavaScriptvoidsetCallbackFunction(java.lang.String callbackName, java.lang.String callbackObject)From StatusManagervoidsetDisplay(java.lang.Object canvas)protected voidsetJSOptions(java.util.Map<java.lang.String,java.lang.Object> vwrOptions)voidsetScreenDimension(int width, int height)booleansetStatusDragDropped(int mode, int x, int y, java.lang.String fileName)java.lang.ObjectsetStereoGraphics(boolean isStereo)private voidsetStringProperty(java.lang.String name, java.lang.String value)voidshowUrl(java.lang.String urlString)voidstartHoverWatcher(boolean enable)voidsyncScript(java.lang.String script)voidupdate()
-
-
-
Field Detail
-
htRegistry
protected static java.util.Map<java.lang.String,java.lang.Object> htRegistry
-
isJS
protected static boolean isJS
-
SCRIPT_CHECK
private static final int SCRIPT_CHECK
- See Also:
- Constant Field Values
-
SCRIPT_WAIT
private static final int SCRIPT_WAIT
- See Also:
- Constant Field Values
-
SCRIPT_NOWAIT
private static final int SCRIPT_NOWAIT
- See Also:
- Constant Field Values
-
codeBase
protected java.lang.String codeBase
-
documentBase
protected java.lang.String documentBase
-
isSigned
protected boolean isSigned
-
language
protected java.lang.String language
-
doTranslate
protected boolean doTranslate
-
haveDocumentAccess
protected boolean haveDocumentAccess
-
isStereoSlave
protected boolean isStereoSlave
-
mayScript
protected boolean mayScript
-
htmlName
protected java.lang.String htmlName
-
fullName
protected java.lang.String fullName
-
statusForm
protected java.lang.String statusForm
-
statusText
protected java.lang.String statusText
-
statusTextarea
protected java.lang.String statusTextarea
-
gRight
protected java.lang.Object gRight
-
viewer
protected Viewer viewer
-
callbacks
protected java.util.Map<CBK,java.lang.String> callbacks
-
vwrOptions
protected java.util.Map<java.lang.String,java.lang.Object> vwrOptions
-
haveNotifiedError
protected boolean haveNotifiedError
-
appletObject
protected java.lang.Object appletObject
-
loading
private boolean loading
-
syncId
private java.lang.String syncId
-
outputBuffer
private javajs.util.SB outputBuffer
-
htParams
protected java.util.Map<java.lang.String,java.lang.Object> htParams
-
-
Method Detail
-
setStereoGraphics
public java.lang.Object setStereoGraphics(boolean isStereo)
- Specified by:
setStereoGraphicsin interfaceJmolAppletInterface
-
processMouseEvent
public boolean processMouseEvent(int id, int x, int y, int modifiers, long time)- Specified by:
processMouseEventin interfacejavajs.api.JSInterface
-
setDisplay
public void setDisplay(java.lang.Object canvas)
- Specified by:
setDisplayin interfacejavajs.api.JSInterface
-
setStatusDragDropped
public boolean setStatusDragDropped(int mode, int x, int y, java.lang.String fileName)- Specified by:
setStatusDragDroppedin interfacejavajs.api.JSInterface
-
startHoverWatcher
public void startHoverWatcher(boolean enable)
- Specified by:
startHoverWatcherin interfacejavajs.api.JSInterface
-
update
public void update()
- Specified by:
updatein interfacejavajs.api.JSInterface
-
openFileAsyncSpecial
public void openFileAsyncSpecial(java.lang.String fileName, int flags)- Specified by:
openFileAsyncSpecialin interfacejavajs.api.JSInterface
-
processTwoPointGesture
public void processTwoPointGesture(float[][][] touches)
- Specified by:
processTwoPointGesturein interfacejavajs.api.JSInterface
-
setScreenDimension
public void setScreenDimension(int width, int height)- Specified by:
setScreenDimensionin interfacejavajs.api.JSInterface
-
resizeDisplay
void resizeDisplay(int width, int height)
-
init
protected void init(java.lang.Object applet)
-
initApplication
private void initApplication()
-
destroy
public void destroy()
- Specified by:
destroyin interfaceJmolAppletInterface- Specified by:
destroyin interfacejavajs.api.JSInterface
-
getBooleanValue
protected boolean getBooleanValue(java.lang.String propertyName, boolean defaultValue)
-
getValue
protected java.lang.String getValue(java.lang.String propertyName, java.lang.String defaultValue)
-
getValueLowerCase
private java.lang.String getValueLowerCase(java.lang.String paramName, java.lang.String defaultValue)
-
setStringProperty
private void setStringProperty(java.lang.String name, java.lang.String value)
-
scriptProcessor
private java.lang.String scriptProcessor(java.lang.String script, java.lang.String statusParams, int processType)
-
register
public void register(java.lang.String id, JmolSyncInterface jsi)- Specified by:
registerin interfaceJmolSyncInterface
-
getJSpecViewProperty
public java.util.Map<java.lang.String,java.lang.Object> getJSpecViewProperty(java.lang.String key)
JSpecView shares the JmolSyncInterface; used to get JSpecView- Specified by:
getJSpecViewPropertyin interfaceJmolStatusListener- Specified by:
getJSpecViewPropertyin interfaceJmolSyncInterface
-
syncScript
public void syncScript(java.lang.String script)
- Specified by:
syncScriptin interfaceJmolSyncInterface
-
handleEvent
public boolean handleEvent(java.awt.Event e)
- Specified by:
handleEventin interfaceJmolAppletInterface
-
getAppletInfo
public java.lang.String getAppletInfo()
- Specified by:
getAppletInfoin interfaceJmolAppletInterface
-
script
public void script(java.lang.String script)
- Specified by:
scriptin interfaceJmolAppletInterface
-
scriptCheck
public java.lang.String scriptCheck(java.lang.String script)
- Specified by:
scriptCheckin interfaceJmolAppletInterface
-
scriptNoWait
public java.lang.String scriptNoWait(java.lang.String script)
- Specified by:
scriptNoWaitin interfaceJmolAppletInterface
-
scriptWait
public java.lang.String scriptWait(java.lang.String script)
- Specified by:
scriptWaitin interfaceJmolAppletInterface
-
scriptWait
public java.lang.String scriptWait(java.lang.String script, java.lang.String statusParams)- Specified by:
scriptWaitin interfaceJmolAppletInterface
-
scriptWaitOutput
public java.lang.String scriptWaitOutput(java.lang.String script)
- Specified by:
scriptWaitOutputin interfaceJmolAppletInterface
-
getModelIndexFromId
public int getModelIndexFromId(java.lang.String id)
- Specified by:
getModelIndexFromIdin interfaceJmolAppletInterface- Parameters:
id- some_id, filename#id, or ~fileNo.modelNo added ".basemodel" indicates to get the first model in a series from a JDX-MOL file.- Returns:
- model index if found; -2 if file found but model not found -2 if no file indicated and no model found -1 if no such file
-
getProperty
public java.lang.Object getProperty(java.lang.String infoType)
- Specified by:
getPropertyin interfaceJmolAppletInterface- Parameters:
infoType-- Returns:
- value
-
getProperty
public java.lang.Object getProperty(java.lang.String infoType, java.lang.String paramInfo)- Specified by:
getPropertyin interfaceJmolAppletInterface- Parameters:
infoType-paramInfo-- Returns:
- value
-
getPropertyAsString
public java.lang.String getPropertyAsString(java.lang.String infoType)
- Specified by:
getPropertyAsStringin interfaceJmolAppletInterface- Parameters:
infoType-- Returns:
- value
-
getPropertyAsString
public java.lang.String getPropertyAsString(java.lang.String infoType, java.lang.String paramInfo)- Specified by:
getPropertyAsStringin interfaceJmolAppletInterface- Parameters:
infoType-paramInfo-- Returns:
- value
-
getPropertyAsJSON
public java.lang.String getPropertyAsJSON(java.lang.String infoType)
- Specified by:
getPropertyAsJSONin interfaceJmolAppletInterface- Parameters:
infoType-- Returns:
- value
-
getPropertyAsJSON
public java.lang.String getPropertyAsJSON(java.lang.String infoType, java.lang.String paramInfo)- Specified by:
getPropertyAsJSONin interfaceJmolAppletInterface- Parameters:
infoType-paramInfo-- Returns:
- value
-
loadInlineString
public java.lang.String loadInlineString(java.lang.String strModel, java.lang.String script, boolean isAppend)- Specified by:
loadInlineStringin interfaceJmolAppletInterface
-
loadInlineArray
public java.lang.String loadInlineArray(java.lang.String[] strModels, java.lang.String script, boolean isAppend)- Specified by:
loadInlineArrayin interfaceJmolAppletInterface
-
loadDOMNode
public java.lang.String loadDOMNode(java.lang.Object DOMNode)
- Specified by:
loadDOMNodein interfaceJmolAppletInterface
-
loadInline
@Deprecated public java.lang.String loadInline(java.lang.String strModel)
Deprecated.- Specified by:
loadInlinein interfaceJmolAppletInterface- Parameters:
strModel-- Returns:
- error or null
-
loadInline
@Deprecated public java.lang.String loadInline(java.lang.String strModel, java.lang.String script)Deprecated.- Specified by:
loadInlinein interfaceJmolAppletInterface- Parameters:
strModel-script-- Returns:
- error or null
-
loadInline
@Deprecated public java.lang.String loadInline(java.lang.String[] strModels)
Deprecated.- Specified by:
loadInlinein interfaceJmolAppletInterface- Parameters:
strModels-- Returns:
- error or null
-
loadInline
@Deprecated public java.lang.String loadInline(java.lang.String[] strModels, java.lang.String script)Deprecated.- Specified by:
loadInlinein interfaceJmolAppletInterface- Parameters:
strModels-script-- Returns:
- error or null
-
output
public void output(java.lang.String s)
-
setCallback
public void setCallback(java.lang.String name, java.lang.Object callbackObject)set a callback either as a function or a function name from JavaScript- Specified by:
setCallbackin interfaceJmolAppletInterface
-
setCallbackFunction
public void setCallbackFunction(java.lang.String callbackName, java.lang.String callbackObject)From StatusManager- Specified by:
setCallbackFunctionin interfaceJmolCallbackListener
-
consoleMessage
private void consoleMessage(java.lang.String message)
-
notifyEnabled
public boolean notifyEnabled(CBK type)
- Specified by:
notifyEnabledin interfaceJmolCallbackListener
-
notifyCallback
public void notifyCallback(CBK type, java.lang.Object[] data)
- Specified by:
notifyCallbackin interfaceJmolCallbackListener- Parameters:
type- the callback type or null for getJsObjectInfo() -- Java applet onlydata- type-dependent
-
sendScript
private java.lang.String sendScript(java.lang.String script, java.lang.String appletName, boolean isSync, boolean doCallback)
-
notifySync
private java.lang.String notifySync(java.lang.String info, java.lang.String appletName)
-
eval
public java.lang.String eval(java.lang.String strEval)
- Specified by:
evalin interfaceJmolStatusListener
-
createImage
public java.lang.String createImage(java.lang.String fileName, java.lang.String type, java.lang.Object text_or_bytes, int quality)Description copied from interface:JmolStatusListenerStarting with Jmol 11.8.RC5, for a context where the Jmol application is embedded in another application simply to send the returned message to the application. In this way any application can have access to the WRITE command.- Specified by:
createImagein interfaceJmolStatusListenertext_or_bytes- information or null indicates message AFTER Jmol creates the image- Returns:
- null (canceled) or a message starting with OK or an error message
-
getRegistryInfo
public java.util.Map<java.lang.String,java.lang.Object> getRegistryInfo()
- Specified by:
getRegistryInfoin interfaceJmolStatusListener
-
showUrl
public void showUrl(java.lang.String urlString)
- Specified by:
showUrlin interfaceJmolStatusListener
-
resizeInnerPanel
public int[] resizeInnerPanel(java.lang.String data)
- Specified by:
resizeInnerPanelin interfaceJmolStatusListener
-
checkIn
static void checkIn(java.lang.String name, java.lang.Object applet)
-
checkOut
static void checkOut(java.lang.String name)
-
findApplets
static void findApplets(java.lang.String appletName, java.lang.String mySyncId, java.lang.String excludeName, javajs.util.Lst<java.lang.String> apps)
-
notifyAudioEnded
public void notifyAudioEnded(java.lang.Object htParams)
- Specified by:
notifyAudioEndedin interfaceJmolAppletInterface
-
setJSOptions
protected void setJSOptions(java.util.Map<java.lang.String,java.lang.Object> vwrOptions)
-
initOptions
protected void initOptions()
-
getJmolParameter
protected java.lang.String getJmolParameter(java.lang.String paramName)
-
functionXY
public float[][] functionXY(java.lang.String functionName, int nX, int nY)Description copied from interface:JmolStatusListenerfor isosurface FUNCTIONXY- Specified by:
functionXYin interfaceJmolStatusListener- Returns:
- 2D array or null
-
functionXYZ
public float[][][] functionXYZ(java.lang.String functionName, int nX, int nY, int nZ)Description copied from interface:JmolStatusListenerfor isosurface FUNCTIONXYZ- Specified by:
functionXYZin interfaceJmolStatusListener- Returns:
- 3D array or null
-
doShowDocument
protected void doShowDocument(java.net.URL url)
-
doSendCallback
protected java.lang.String doSendCallback(CBK type, java.lang.Object callback, java.lang.Object[] data, java.lang.String strInfo)
-
doEval
protected java.lang.String doEval(java.lang.String strEval)
return RAW JAVASCRIPT OBJECT, NOT A STRING- Parameters:
strEval-- Returns:
- result, not necessarily a String
-
doShowStatus
protected void doShowStatus(java.lang.String message)
-
getGLmolView
public java.lang.Object getGLmolView()
This method is only called by JmolGLmol applet._refresh();- Returns:
- enough data to update a WebGL view
-
openFile
public java.lang.String openFile(java.lang.String fileName)
possibly called from JSmolApplet.js upon start up- Parameters:
fileName-- Returns:
- error or null
-
cacheFileByName
public int cacheFileByName(java.lang.String fileName, boolean isAdd)- Specified by:
cacheFileByNamein interfacejavajs.api.JSInterface
-
cachePut
public void cachePut(java.lang.String key, java.lang.Object data)- Specified by:
cachePutin interfacejavajs.api.JSInterface
-
getFullName
public java.lang.String getFullName()
- Specified by:
getFullNamein interfacejavajs.api.JSInterface
-
-