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 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
FieldsModifier and TypeFieldDescriptionprotected Object
protected String
protected String
protected boolean
protected String
protected Object
protected boolean
protected boolean
protected String
protected static boolean
protected boolean
protected boolean
protected String
private boolean
protected boolean
private javajs.util.SB
private static final int
private static final int
private static final int
protected String
protected String
protected String
private String
protected Viewer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
cacheFileByName
(String fileName, boolean isAdd) void
(package private) static void
(package private) static void
private void
consoleMessage
(String message) createImage
(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.void
destroy()
protected String
return RAW JAVASCRIPT OBJECT, NOT A STRINGprotected String
doSendCallback
(CBK type, Object callback, Object[] data, String strInfo) protected void
doShowDocument
(URL url) protected void
doShowStatus
(String message) (package private) static void
findApplets
(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 FUNCTIONXYZprotected boolean
getBooleanValue
(String propertyName, boolean defaultValue) This method is only called by JmolGLmol applet._refresh();protected String
getJmolParameter
(String paramName) JSpecView shares the JmolSyncInterface; used to get JSpecViewint
getProperty
(String infoType) getProperty
(String infoType, String paramInfo) getPropertyAsJSON
(String infoType) getPropertyAsJSON
(String infoType, String paramInfo) getPropertyAsString
(String infoType) getPropertyAsString
(String infoType, String paramInfo) protected String
private String
getValueLowerCase
(String paramName, String defaultValue) boolean
handleEvent
(Event e) protected void
private void
protected void
loadDOMNode
(Object DOMNode) loadInline
(String strModel) Deprecated.loadInline
(String[] strModels) Deprecated.loadInline
(String[] strModels, String script) Deprecated.loadInline
(String strModel, String script) Deprecated.loadInlineArray
(String[] strModels, String script, boolean isAppend) loadInlineString
(String strModel, String script, boolean isAppend) void
notifyAudioEnded
(Object htParams) void
notifyCallback
(CBK type, Object[] data) boolean
notifyEnabled
(CBK type) private String
notifySync
(String info, String appletName) possibly called from JSmolApplet.js upon start upvoid
openFileAsyncSpecial
(String fileName, int flags) void
openFileAsyncSpecialType
(String fileName, int flags, String type) void
void
processKeyEvent
(Object event) boolean
processMouseEvent
(int id, int x, int y, int modifiers, long time) void
processTwoPointGesture
(float[][][] touches) void
register
(String id, JmolSyncInterface jsi) (package private) void
resizeDisplay
(int width, int height) int[]
resizeInnerPanel
(String data) void
scriptCheck
(String script) scriptNoWait
(String script) private String
scriptProcessor
(String script, String statusParams, int processType) scriptWait
(String script) scriptWait
(String script, String statusParams) scriptWaitOutput
(String script) private String
sendScript
(String script, String appletName, boolean isSync, boolean doCallback) void
setCallback
(String name, Object callbackObject) set a callback either as a function or a function name from JavaScriptvoid
setCallbackFunction
(String callbackName, String callbackObject) From StatusManagervoid
setDisplay
(Object canvas) protected void
setJSOptions
(Map<String, Object> vwrOptions) void
setScreenDimension
(int width, int height) boolean
setStatusDragDropped
(int mode, int x, int y, String fileName, String[] retType) setStereoGraphics
(boolean isStereo) private void
setStringProperty
(String name, String value) void
void
startHoverWatcher
(boolean enable) void
syncScript
(String script) void
update()
-
Field Details
-
htRegistry
-
isJS
protected static boolean isJS -
SCRIPT_CHECK
private static final int SCRIPT_CHECK- See Also:
-
SCRIPT_WAIT
private static final int SCRIPT_WAIT- See Also:
-
SCRIPT_NOWAIT
private static final int SCRIPT_NOWAIT- See Also:
-
codeBase
-
documentBase
-
isSigned
protected boolean isSigned -
language
-
doTranslate
protected boolean doTranslate -
haveDocumentAccess
protected boolean haveDocumentAccess -
isStereoSlave
protected boolean isStereoSlave -
mayScript
protected boolean mayScript -
htmlName
-
fullName
-
statusForm
-
statusText
-
statusTextarea
-
gRight
-
viewer
-
callbacks
-
vwrOptions
-
haveNotifiedError
protected boolean haveNotifiedError -
appletObject
-
loading
private boolean loading -
syncId
-
outputBuffer
private javajs.util.SB outputBuffer -
htParams
-
-
Constructor Details
-
GenericApplet
public GenericApplet()
-
-
Method Details
-
setStereoGraphics
- Specified by:
setStereoGraphics
in interfaceJmolAppletInterface
-
processMouseEvent
public boolean processMouseEvent(int id, int x, int y, int modifiers, long time) - Specified by:
processMouseEvent
in interfacejavajs.api.JSInterface
-
processKeyEvent
- Specified by:
processKeyEvent
in interfacejavajs.api.JSInterface
-
setDisplay
- Specified by:
setDisplay
in interfacejavajs.api.JSInterface
-
setStatusDragDropped
- Specified by:
setStatusDragDropped
in interfacejavajs.api.JSInterface
-
startHoverWatcher
public void startHoverWatcher(boolean enable) - Specified by:
startHoverWatcher
in interfacejavajs.api.JSInterface
-
update
public void update()- Specified by:
update
in interfacejavajs.api.JSInterface
-
openFileAsyncSpecial
- Specified by:
openFileAsyncSpecial
in interfacejavajs.api.JSInterface
-
openFileAsyncSpecialType
- Specified by:
openFileAsyncSpecialType
in interfacejavajs.api.JSInterface
-
processTwoPointGesture
public void processTwoPointGesture(float[][][] touches) - Specified by:
processTwoPointGesture
in interfacejavajs.api.JSInterface
-
setScreenDimension
public void setScreenDimension(int width, int height) - Specified by:
setScreenDimension
in interfacejavajs.api.JSInterface
-
resizeDisplay
void resizeDisplay(int width, int height) -
init
-
initApplication
private void initApplication() -
destroy
public void destroy()- Specified by:
destroy
in interfaceJmolAppletInterface
- Specified by:
destroy
in interfacejavajs.api.JSInterface
-
getBooleanValue
-
getValue
-
getValueLowerCase
-
setStringProperty
-
scriptProcessor
-
register
- Specified by:
register
in interfaceJmolSyncInterface
-
getJSpecViewProperty
JSpecView shares the JmolSyncInterface; used to get JSpecView- Specified by:
getJSpecViewProperty
in interfaceJmolStatusListener
- Specified by:
getJSpecViewProperty
in interfaceJmolSyncInterface
-
syncScript
- Specified by:
syncScript
in interfaceJmolSyncInterface
-
handleEvent
- Specified by:
handleEvent
in interfaceJmolAppletInterface
-
getAppletInfo
- Specified by:
getAppletInfo
in interfaceJmolAppletInterface
-
script
- Specified by:
script
in interfaceJmolAppletInterface
-
scriptCheck
- Specified by:
scriptCheck
in interfaceJmolAppletInterface
-
scriptNoWait
- Specified by:
scriptNoWait
in interfaceJmolAppletInterface
-
scriptWait
- Specified by:
scriptWait
in interfaceJmolAppletInterface
-
scriptWait
- Specified by:
scriptWait
in interfaceJmolAppletInterface
-
scriptWaitOutput
- Specified by:
scriptWaitOutput
in interfaceJmolAppletInterface
-
getModelIndexFromId
- Specified by:
getModelIndexFromId
in 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
- Specified by:
getProperty
in interfaceJmolAppletInterface
- Parameters:
infoType
-- Returns:
- value
-
getProperty
- Specified by:
getProperty
in interfaceJmolAppletInterface
- Parameters:
infoType
-paramInfo
-- Returns:
- value
-
getPropertyAsString
- Specified by:
getPropertyAsString
in interfaceJmolAppletInterface
- Parameters:
infoType
-- Returns:
- value
-
getPropertyAsString
- Specified by:
getPropertyAsString
in interfaceJmolAppletInterface
- Parameters:
infoType
-paramInfo
-- Returns:
- value
-
getPropertyAsJSON
- Specified by:
getPropertyAsJSON
in interfaceJmolAppletInterface
- Parameters:
infoType
-- Returns:
- value
-
getPropertyAsJSON
- Specified by:
getPropertyAsJSON
in interfaceJmolAppletInterface
- Parameters:
infoType
-paramInfo
-- Returns:
- value
-
loadInlineString
- Specified by:
loadInlineString
in interfaceJmolAppletInterface
-
loadInlineArray
- Specified by:
loadInlineArray
in interfaceJmolAppletInterface
-
loadDOMNode
- Specified by:
loadDOMNode
in interfaceJmolAppletInterface
-
loadInline
Deprecated.- Specified by:
loadInline
in interfaceJmolAppletInterface
- Parameters:
strModel
-- Returns:
- error or null
-
loadInline
Deprecated.- Specified by:
loadInline
in interfaceJmolAppletInterface
- Parameters:
strModel
-script
-- Returns:
- error or null
-
loadInline
Deprecated.- Specified by:
loadInline
in interfaceJmolAppletInterface
- Parameters:
strModels
-- Returns:
- error or null
-
loadInline
Deprecated.- Specified by:
loadInline
in interfaceJmolAppletInterface
- Parameters:
strModels
-script
-- Returns:
- error or null
-
output
-
setCallback
set a callback either as a function or a function name from JavaScript- Specified by:
setCallback
in interfaceJmolAppletInterface
-
setCallbackFunction
From StatusManager- Specified by:
setCallbackFunction
in interfaceJmolCallbackListener
-
consoleMessage
-
notifyEnabled
- Specified by:
notifyEnabled
in interfaceJmolCallbackListener
-
notifyCallback
- Specified by:
notifyCallback
in interfaceJmolCallbackListener
- Parameters:
type
- the callback type or null for getJsObjectInfo() -- Java applet onlydata
- type-dependent
-
sendScript
-
notifySync
-
eval
- Specified by:
eval
in interfaceJmolStatusListener
-
createImage
Description copied from interface:JmolStatusListener
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. In this way any application can have access to the WRITE command.- Specified by:
createImage
in interfaceJmolStatusListener
text_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
- Specified by:
getRegistryInfo
in interfaceJmolStatusListener
-
showUrl
- Specified by:
showUrl
in interfaceJmolStatusListener
-
resizeInnerPanel
- Specified by:
resizeInnerPanel
in interfaceJmolStatusListener
-
checkIn
-
checkOut
-
findApplets
-
notifyAudioEnded
- Specified by:
notifyAudioEnded
in interfaceJmolAppletInterface
-
setJSOptions
-
initOptions
protected void initOptions() -
getJmolParameter
-
functionXY
Description copied from interface:JmolStatusListener
for isosurface FUNCTIONXY- Specified by:
functionXY
in interfaceJmolStatusListener
- Returns:
- 2D array or null
-
functionXYZ
Description copied from interface:JmolStatusListener
for isosurface FUNCTIONXYZ- Specified by:
functionXYZ
in interfaceJmolStatusListener
- Returns:
- 3D array or null
-
doShowDocument
-
doSendCallback
-
doEval
return RAW JAVASCRIPT OBJECT, NOT A STRING- Parameters:
strEval
-- Returns:
- result, not necessarily a String
-
doShowStatus
-
getGLmolView
This method is only called by JmolGLmol applet._refresh();- Returns:
- enough data to update a WebGL view
-
openFile
possibly called from JSmolApplet.js upon start up- Parameters:
fileName
-- Returns:
- error or null
-
cacheFileByName
- Specified by:
cacheFileByName
in interfacejavajs.api.JSInterface
-
cachePut
- Specified by:
cachePut
in interfacejavajs.api.JSInterface
-
getFullName
- Specified by:
getFullName
in interfacejavajs.api.JSInterface
-