Package org.jmol.util
Class GenericApplet
- java.lang.Object
-
- org.jmol.util.GenericApplet
-
- All Implemented Interfaces:
JmolAppletInterface,JmolCallbackListener,JmolStatusListener,JmolSyncInterface
public abstract class GenericApplet extends Object implements JmolAppletInterface, JmolStatusListener
A collection of all methods necessary for initialization of and communication with the applet, whether it be JavaScript or Java.
-
-
Field Summary
Fields Modifier and Type Field Description protected ObjectappletObjectprotected Map<CBK,String>callbacksprotected StringcodeBaseprotected StringdocumentBaseprotected booleandoTranslateprotected StringfullNameprotected ObjectgRightprotected booleanhaveDocumentAccessprotected booleanhaveNotifiedErrorprotected StringhtmlNameprotected static Map<String,Object>htRegistryprotected booleanisJNLPprotected booleanisJSprotected booleanisSignedprotected booleanisStereoSlaveprotected Stringlanguageprivate booleanloadingprotected booleanmayScriptprivate javajs.util.SBoutputBufferprivate static intSCRIPT_CHECKprivate static intSCRIPT_NOWAITprivate static intSCRIPT_WAITprotected StringstatusFormprotected StringstatusTextprotected StringstatusTextareaprivate StringsyncIdprotected Viewerviewerprotected Map<String,Object>vwrOptions
-
Constructor Summary
Constructors Constructor Description GenericApplet()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description (package private) static voidcheckIn(String name, Object applet)(package private) static voidcheckOut(String name)private voidconsoleMessage(String message)StringcreateImage(String fileName, String type, 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 abstract StringdoEval(String strEval)protected abstract float[][]doFunctionXY(String functionName, int nX, int nY)protected abstract float[][][]doFunctionXYZ(String functionName, int nX, int nY, int nZ)protected abstract StringdoSendCallback(String callback, Object[] data, String strInfo)protected abstract voiddoSendJsTextareaStatus(String strInfo)protected abstract voiddoSendJsTextStatus(String message)protected abstract voiddoShowDocument(URL url)protected abstract voiddoShowStatus(String errorMsg)Stringeval(String strEval)(package private) static voidfindApplets(String appletName, String mySyncId, String excludeName, javajs.util.Lst<String> apps)float[][]functionXY(String functionName, int nX, int nY)for isosurface FUNCTIONXYfloat[][][]functionXYZ(String functionName, int nX, int nY, int nZ)for isosurface FUNCTIONXYZStringgetAppletInfo()protected booleangetBooleanValue(String propertyName, boolean defaultValue)protected abstract StringgetJmolParameter(String name)Map<String,Object>getJSpecViewProperty(String key)JSpecView shares the JmolSyncInterface; used to get JSpecViewintgetModelIndexFromId(String id)ObjectgetProperty(String infoType)ObjectgetProperty(String infoType, String paramInfo)StringgetPropertyAsJSON(String infoType)StringgetPropertyAsJSON(String infoType, String paramInfo)StringgetPropertyAsString(String infoType)StringgetPropertyAsString(String infoType, String paramInfo)Map<String,Object>getRegistryInfo()protected StringgetValue(String propertyName, String defaultValue)private StringgetValueLowerCase(String paramName, String defaultValue)booleanhandleEvent(Event e)protected voidinit(Object applet)private voidinitApplication()protected abstract voidinitOptions()StringloadDOMNode(Object DOMNode)StringloadInline(String strModel)Deprecated.StringloadInline(String[] strModels)Deprecated.StringloadInline(String[] strModels, String script)Deprecated.StringloadInline(String strModel, String script)Deprecated.StringloadInlineArray(String[] strModels, String script, boolean isAppend)StringloadInlineString(String strModel, String script, boolean isAppend)voidnotifyAudioEnded(Object htParams)voidnotifyCallback(CBK type, Object[] data)booleannotifyEnabled(CBK type)private StringnotifySync(String info, String appletName)voidoutput(String s)voidregister(String id, JmolSyncInterface jsi)int[]resizeInnerPanel(String data)voidscript(String script)StringscriptCheck(String script)StringscriptNoWait(String script)private StringscriptProcessor(String script, String statusParams, int processType)StringscriptWait(String script)StringscriptWait(String script, String statusParams)StringscriptWaitOutput(String script)private StringsendScript(String script, String appletName, boolean isSync, boolean doCallback)voidsetCallbackFunction(String callbackName, String callbackFunction)private voidsetStringProperty(String name, String value)private voidsetValue(String name, String defaultValue)voidshowUrl(String urlString)voidsyncScript(String script)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jmol.api.JmolAppletInterface
setStereoGraphics
-
-
-
-
Field Detail
-
isJS
protected 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 String codeBase
-
documentBase
protected String documentBase
-
isSigned
protected boolean isSigned
-
language
protected String language
-
doTranslate
protected boolean doTranslate
-
haveDocumentAccess
protected boolean haveDocumentAccess
-
isStereoSlave
protected boolean isStereoSlave
-
mayScript
protected boolean mayScript
-
htmlName
protected String htmlName
-
fullName
protected String fullName
-
statusForm
protected String statusForm
-
statusText
protected String statusText
-
statusTextarea
protected String statusTextarea
-
gRight
protected Object gRight
-
viewer
protected Viewer viewer
-
haveNotifiedError
protected boolean haveNotifiedError
-
appletObject
protected Object appletObject
-
isJNLP
protected boolean isJNLP
-
loading
private boolean loading
-
syncId
private String syncId
-
outputBuffer
private javajs.util.SB outputBuffer
-
-
Method Detail
-
initOptions
protected abstract void initOptions()
-
doFunctionXY
protected abstract float[][] doFunctionXY(String functionName, int nX, int nY)
-
doFunctionXYZ
protected abstract float[][][] doFunctionXYZ(String functionName, int nX, int nY, int nZ)
-
doSendCallback
protected abstract String doSendCallback(String callback, Object[] data, String strInfo)
-
doSendJsTextareaStatus
protected abstract void doSendJsTextareaStatus(String strInfo)
-
doSendJsTextStatus
protected abstract void doSendJsTextStatus(String message)
-
doShowDocument
protected abstract void doShowDocument(URL url)
-
doShowStatus
protected abstract void doShowStatus(String errorMsg)
-
init
protected void init(Object applet)
-
initApplication
private void initApplication()
-
destroy
public void destroy()
- Specified by:
destroyin interfaceJmolAppletInterface
-
getBooleanValue
protected boolean getBooleanValue(String propertyName, boolean defaultValue)
-
scriptProcessor
private String scriptProcessor(String script, String statusParams, int processType)
-
register
public void register(String id, JmolSyncInterface jsi)
- Specified by:
registerin interfaceJmolSyncInterface
-
getJSpecViewProperty
public Map<String,Object> getJSpecViewProperty(String key)
JSpecView shares the JmolSyncInterface; used to get JSpecView- Specified by:
getJSpecViewPropertyin interfaceJmolStatusListener- Specified by:
getJSpecViewPropertyin interfaceJmolSyncInterface
-
syncScript
public void syncScript(String script)
- Specified by:
syncScriptin interfaceJmolSyncInterface
-
handleEvent
public boolean handleEvent(Event e)
- Specified by:
handleEventin interfaceJmolAppletInterface
-
getAppletInfo
public String getAppletInfo()
- Specified by:
getAppletInfoin interfaceJmolAppletInterface
-
script
public void script(String script)
- Specified by:
scriptin interfaceJmolAppletInterface
-
scriptCheck
public String scriptCheck(String script)
- Specified by:
scriptCheckin interfaceJmolAppletInterface
-
scriptNoWait
public String scriptNoWait(String script)
- Specified by:
scriptNoWaitin interfaceJmolAppletInterface
-
scriptWait
public String scriptWait(String script)
- Specified by:
scriptWaitin interfaceJmolAppletInterface
-
scriptWait
public String scriptWait(String script, String statusParams)
- Specified by:
scriptWaitin interfaceJmolAppletInterface
-
scriptWaitOutput
public String scriptWaitOutput(String script)
- Specified by:
scriptWaitOutputin interfaceJmolAppletInterface
-
getModelIndexFromId
public int getModelIndexFromId(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 Object getProperty(String infoType)
- Specified by:
getPropertyin interfaceJmolAppletInterface- Parameters:
infoType-- Returns:
- value
-
getProperty
public Object getProperty(String infoType, String paramInfo)
- Specified by:
getPropertyin interfaceJmolAppletInterface- Parameters:
infoType-paramInfo-- Returns:
- value
-
getPropertyAsString
public String getPropertyAsString(String infoType)
- Specified by:
getPropertyAsStringin interfaceJmolAppletInterface- Parameters:
infoType-- Returns:
- value
-
getPropertyAsString
public String getPropertyAsString(String infoType, String paramInfo)
- Specified by:
getPropertyAsStringin interfaceJmolAppletInterface- Parameters:
infoType-paramInfo-- Returns:
- value
-
getPropertyAsJSON
public String getPropertyAsJSON(String infoType)
- Specified by:
getPropertyAsJSONin interfaceJmolAppletInterface- Parameters:
infoType-- Returns:
- value
-
getPropertyAsJSON
public String getPropertyAsJSON(String infoType, String paramInfo)
- Specified by:
getPropertyAsJSONin interfaceJmolAppletInterface- Parameters:
infoType-paramInfo-- Returns:
- value
-
loadInlineString
public String loadInlineString(String strModel, String script, boolean isAppend)
- Specified by:
loadInlineStringin interfaceJmolAppletInterface
-
loadInlineArray
public String loadInlineArray(String[] strModels, String script, boolean isAppend)
- Specified by:
loadInlineArrayin interfaceJmolAppletInterface
-
loadDOMNode
public String loadDOMNode(Object DOMNode)
- Specified by:
loadDOMNodein interfaceJmolAppletInterface
-
loadInline
@Deprecated public String loadInline(String strModel)
Deprecated.- Specified by:
loadInlinein interfaceJmolAppletInterface- Parameters:
strModel-- Returns:
- error or null
-
loadInline
@Deprecated public String loadInline(String strModel, String script)
Deprecated.- Specified by:
loadInlinein interfaceJmolAppletInterface- Parameters:
strModel-script-- Returns:
- error or null
-
loadInline
@Deprecated public String loadInline(String[] strModels)
Deprecated.- Specified by:
loadInlinein interfaceJmolAppletInterface- Parameters:
strModels-- Returns:
- error or null
-
loadInline
@Deprecated public String loadInline(String[] strModels, String script)
Deprecated.- Specified by:
loadInlinein interfaceJmolAppletInterface- Parameters:
strModels-script-- Returns:
- error or null
-
output
public void output(String s)
-
setCallbackFunction
public void setCallbackFunction(String callbackName, String callbackFunction)
- Specified by:
setCallbackFunctionin interfaceJmolCallbackListener
-
consoleMessage
private void consoleMessage(String message)
-
notifyEnabled
public boolean notifyEnabled(CBK type)
- Specified by:
notifyEnabledin interfaceJmolCallbackListener
-
notifyCallback
public void notifyCallback(CBK type, Object[] data)
- Specified by:
notifyCallbackin interfaceJmolCallbackListener- Parameters:
type- the callback type or null for getJsObjectInfo() -- Java applet onlydata- type-dependent
-
sendScript
private String sendScript(String script, String appletName, boolean isSync, boolean doCallback)
-
eval
public String eval(String strEval)
- Specified by:
evalin interfaceJmolStatusListener
-
functionXY
public float[][] functionXY(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(String functionName, int nX, int nY, int nZ)
Description copied from interface:JmolStatusListenerfor isosurface FUNCTIONXYZ- Specified by:
functionXYZin interfaceJmolStatusListener- Returns:
- 3D array or null
-
createImage
public String createImage(String fileName, String type, 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 Map<String,Object> getRegistryInfo()
- Specified by:
getRegistryInfoin interfaceJmolStatusListener
-
showUrl
public void showUrl(String urlString)
- Specified by:
showUrlin interfaceJmolStatusListener
-
resizeInnerPanel
public int[] resizeInnerPanel(String data)
- Specified by:
resizeInnerPanelin interfaceJmolStatusListener
-
checkOut
static void checkOut(String name)
-
findApplets
static void findApplets(String appletName, String mySyncId, String excludeName, javajs.util.Lst<String> apps)
-
notifyAudioEnded
public void notifyAudioEnded(Object htParams)
- Specified by:
notifyAudioEndedin interfaceJmolAppletInterface
-
-