GenericApplet
Date: 2019-10-22

org.jmol.util

## Class GenericApplet

- java.lang.Object
- - org.jmol.util.GenericApplet

- All Implemented Interfaces:
    JmolAppletInterface, JmolCallbackListener, JmolStatusListener, JmolSyncInterface
  Direct Known Subclasses:
    Jmol, Jmol

      public abstract class GenericApplet
      extends java.lang.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 and Description
    --- | ---
    `protected java.lang.Object` | `appletObject`
    `protected java.util.Map<CBK,java.lang.String>` | `callbacks`
    `protected java.lang.String` | `codeBase`
    `protected java.lang.String` | `documentBase`
    `protected boolean` | `doTranslate`
    `protected java.lang.String` | `fullName`
    `protected java.lang.Object` | `gRight`
    `protected boolean` | `haveDocumentAccess`
    `protected boolean` | `haveNotifiedError`
    `protected java.lang.String` | `htmlName`
    `protected static java.util.Map<java.lang.String,java.lang.Object>` | `htRegistry`
    `protected boolean` | `isJNLP`
    `protected boolean` | `isJS`
    `protected boolean` | `isSigned`
    `protected boolean` | `isStereoSlave`
    `protected java.lang.String` | `language`
    `private boolean` | `loading`
    `protected boolean` | `mayScript`
    `private javajs.util.SB` | `outputBuffer`
    `private static int` | `SCRIPT_CHECK`
    `private static int` | `SCRIPT_NOWAIT`
    `private static int` | `SCRIPT_WAIT`
    `protected java.lang.String` | `statusForm`
    `protected java.lang.String` | `statusText`
    `protected java.lang.String` | `statusTextarea`
    `private java.lang.String` | `syncId`
    `protected Viewer` | `viewer`
    `protected java.util.Map<java.lang.String,java.lang.Object>` | `vwrOptions`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GenericApplet()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) static void` | `checkIn(java.lang.String name, java.lang.Object applet)`
    `(package private) static void` | `checkOut(java.lang.String name)`
    `private void` | `consoleMessage(java.lang.String message)`
    `java.lang.String` | `createImage(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.
    `void` | `destroy()`
    `protected abstract java.lang.String` | `doEval(java.lang.String strEval)`
    `protected abstract float[][]` | `doFunctionXY(java.lang.String functionName, int nX, int nY)`
    `protected abstract float[][][]` | `doFunctionXYZ(java.lang.String functionName, int nX, int nY, int nZ)`
    `protected abstract java.lang.String` | `doSendCallback(java.lang.String callback, java.lang.Object[] data, java.lang.String strInfo)`
    `protected abstract void` | `doSendJsTextareaStatus(java.lang.String strInfo)`
    `protected abstract void` | `doSendJsTextStatus(java.lang.String message)`
    `protected abstract void` | `doShowDocument(java.net.URL url)`
    `protected abstract void` | `doShowStatus(java.lang.String errorMsg)`
    `java.lang.String` | `eval(java.lang.String strEval)`
    `(package private) static void` | `findApplets(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 FUNCTIONXY
    `float[][][]` | `functionXYZ(java.lang.String functionName, int nX, int nY, int nZ)` for isosurface FUNCTIONXYZ
    `java.lang.String` | `getAppletInfo()`
    `protected boolean` | `getBooleanValue(java.lang.String propertyName, boolean defaultValue)`
    `protected abstract java.lang.String` | `getJmolParameter(java.lang.String name)`
    `java.util.Map<java.lang.String,java.lang.Object>` | `getJSpecViewProperty(java.lang.String key)` JSpecView shares the JmolSyncInterface; used to get JSpecView
    `int` | `getModelIndexFromId(java.lang.String id)`
    `java.lang.Object` | `getProperty(java.lang.String infoType)`
    `java.lang.Object` | `getProperty(java.lang.String infoType, java.lang.String paramInfo)`
    `java.lang.String` | `getPropertyAsJSON(java.lang.String infoType)`
    `java.lang.String` | `getPropertyAsJSON(java.lang.String infoType, java.lang.String paramInfo)`
    `java.lang.String` | `getPropertyAsString(java.lang.String infoType)`
    `java.lang.String` | `getPropertyAsString(java.lang.String infoType, java.lang.String paramInfo)`
    `java.util.Map<java.lang.String,java.lang.Object>` | `getRegistryInfo()`
    `protected java.lang.String` | `getValue(java.lang.String propertyName, java.lang.String defaultValue)`
    `private java.lang.String` | `getValueLowerCase(java.lang.String paramName, java.lang.String defaultValue)`
    `boolean` | `handleEvent(java.awt.Event e)`
    `protected void` | `init(java.lang.Object applet)`
    `private void` | `initApplication()`
    `protected abstract void` | `initOptions()`
    `java.lang.String` | `loadDOMNode(java.lang.Object DOMNode)`
    `java.lang.String` | `loadInline(java.lang.String strModel)` Deprecated.
    `java.lang.String` | `loadInline(java.lang.String[] strModels)` Deprecated.
    `java.lang.String` | `loadInline(java.lang.String[] strModels, java.lang.String script)` Deprecated.
    `java.lang.String` | `loadInline(java.lang.String strModel, java.lang.String script)` Deprecated.
    `java.lang.String` | `loadInlineArray(java.lang.String[] strModels, java.lang.String script, boolean isAppend)`
    `java.lang.String` | `loadInlineString(java.lang.String strModel, java.lang.String script, boolean isAppend)`
    `void` | `notifyAudioEnded(java.lang.Object htParams)`
    `void` | `notifyCallback(CBK type, java.lang.Object[] data)`
    `boolean` | `notifyEnabled(CBK type)`
    `private java.lang.String` | `notifySync(java.lang.String info, java.lang.String appletName)`
    `void` | `output(java.lang.String s)`
    `void` | `register(java.lang.String id, JmolSyncInterface jsi)`
    `int[]` | `resizeInnerPanel(java.lang.String data)`
    `void` | `script(java.lang.String script)`
    `java.lang.String` | `scriptCheck(java.lang.String script)`
    `java.lang.String` | `scriptNoWait(java.lang.String script)`
    `private java.lang.String` | `scriptProcessor(java.lang.String script, java.lang.String statusParams, int processType)`
    `java.lang.String` | `scriptWait(java.lang.String script)`
    `java.lang.String` | `scriptWait(java.lang.String script, java.lang.String statusParams)`
    `java.lang.String` | `scriptWaitOutput(java.lang.String script)`
    `private java.lang.String` | `sendScript(java.lang.String script, java.lang.String appletName, boolean isSync, boolean doCallback)`
    `void` | `setCallbackFunction(java.lang.String callbackName, java.lang.String callbackFunction)`
    `private void` | `setStringProperty(java.lang.String name, java.lang.String value)`
    `private void` | `setValue(java.lang.String name, java.lang.String defaultValue)`
    `void` | `showUrl(java.lang.String urlString)`
    `void` | `syncScript(java.lang.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

    - #### htRegistry

          protected static java.util.Map<java.lang.String,java.lang.Object> htRegistry

    - #### 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 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

    - #### isJNLP

          protected boolean isJNLP

    - #### loading

          private boolean loading

    - #### syncId

          private java.lang.String syncId

    - #### outputBuffer

          private javajs.util.SB outputBuffer

  - ### Constructor Detail

    - #### GenericApplet

          public GenericApplet()

  - ### Method Detail

    - #### initOptions

          protected abstract void initOptions()

    - #### getJmolParameter

          protected abstract java.lang.String getJmolParameter(java.lang.String name)

    - #### doEval

          protected abstract java.lang.String doEval(java.lang.String strEval)

    - #### doFunctionXY

          protected abstract float[][] doFunctionXY(java.lang.String functionName,
                                                    int nX,
                                                    int nY)

    - #### doFunctionXYZ

          protected abstract float[][][] doFunctionXYZ(java.lang.String functionName,
                                                       int nX,
                                                       int nY,
                                                       int nZ)

    - #### doSendCallback

          protected abstract java.lang.String doSendCallback(java.lang.String callback,
                                                             java.lang.Object[] data,
                                                             java.lang.String strInfo)

    - #### doSendJsTextareaStatus

          protected abstract void doSendJsTextareaStatus(java.lang.String strInfo)

    - #### doSendJsTextStatus

          protected abstract void doSendJsTextStatus(java.lang.String message)

    - #### doShowDocument

          protected abstract void doShowDocument(java.net.URL url)

    - #### doShowStatus

          protected abstract void doShowStatus(java.lang.String errorMsg)

    - #### init

          protected void init(java.lang.Object applet)

    - #### initApplication

          private void initApplication()

    - #### destroy

          public void destroy()

      Specified by:
        `destroy` in interface `JmolAppletInterface`

    - #### 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)

    - #### setValue

          private void setValue(java.lang.String name,
                                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:
        `register` in interface `JmolSyncInterface`

    - #### 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:
        `getJSpecViewProperty` in interface `JmolStatusListener`
      Specified by:
        `getJSpecViewProperty` in interface `JmolSyncInterface`

    - #### syncScript

          public void syncScript(java.lang.String script)

      Specified by:
        `syncScript` in interface `JmolSyncInterface`

    - #### handleEvent

          public boolean handleEvent(java.awt.Event e)

      Specified by:
        `handleEvent` in interface `JmolAppletInterface`

    - #### getAppletInfo

          public java.lang.String getAppletInfo()

      Specified by:
        `getAppletInfo` in interface `JmolAppletInterface`

    - #### script

          public void script(java.lang.String script)

      Specified by:
        `script` in interface `JmolAppletInterface`

    - #### scriptCheck

          public java.lang.String scriptCheck(java.lang.String script)

      Specified by:
        `scriptCheck` in interface `JmolAppletInterface`

    - #### scriptNoWait

          public java.lang.String scriptNoWait(java.lang.String script)

      Specified by:
        `scriptNoWait` in interface `JmolAppletInterface`

    - #### scriptWait

          public java.lang.String scriptWait(java.lang.String script)

      Specified by:
        `scriptWait` in interface `JmolAppletInterface`

    - #### scriptWait

          public java.lang.String scriptWait(java.lang.String script,
                                             java.lang.String statusParams)

      Specified by:
        `scriptWait` in interface `JmolAppletInterface`

    - #### scriptWaitOutput

          public java.lang.String scriptWaitOutput(java.lang.String script)

      Specified by:
        `scriptWaitOutput` in interface `JmolAppletInterface`

    - #### getModelIndexFromId

          public int getModelIndexFromId(java.lang.String id)

      Specified by:
        `getModelIndexFromId` in interface `JmolAppletInterface`
      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:
        `getProperty` in interface `JmolAppletInterface`
      Parameters:
        `infoType` -
      Returns:
        value

    - #### getProperty

          public java.lang.Object getProperty(java.lang.String infoType,
                                              java.lang.String paramInfo)

      Specified by:
        `getProperty` in interface `JmolAppletInterface`
      Parameters:
        `infoType` -
        `paramInfo` -
      Returns:
        value

    - #### getPropertyAsString

          public java.lang.String getPropertyAsString(java.lang.String infoType)

      Specified by:
        `getPropertyAsString` in interface `JmolAppletInterface`
      Parameters:
        `infoType` -
      Returns:
        value

    - #### getPropertyAsString

          public java.lang.String getPropertyAsString(java.lang.String infoType,
                                                      java.lang.String paramInfo)

      Specified by:
        `getPropertyAsString` in interface `JmolAppletInterface`
      Parameters:
        `infoType` -
        `paramInfo` -
      Returns:
        value

    - #### getPropertyAsJSON

          public java.lang.String getPropertyAsJSON(java.lang.String infoType)

      Specified by:
        `getPropertyAsJSON` in interface `JmolAppletInterface`
      Parameters:
        `infoType` -
      Returns:
        value

    - #### getPropertyAsJSON

          public java.lang.String getPropertyAsJSON(java.lang.String infoType,
                                                    java.lang.String paramInfo)

      Specified by:
        `getPropertyAsJSON` in interface `JmolAppletInterface`
      Parameters:
        `infoType` -
        `paramInfo` -
      Returns:
        value

    - #### loadInlineString

          public java.lang.String loadInlineString(java.lang.String strModel,
                                                   java.lang.String script,
                                                   boolean isAppend)

      Specified by:
        `loadInlineString` in interface `JmolAppletInterface`

    - #### loadInlineArray

          public java.lang.String loadInlineArray(java.lang.String[] strModels,
                                                  java.lang.String script,
                                                  boolean isAppend)

      Specified by:
        `loadInlineArray` in interface `JmolAppletInterface`

    - #### loadDOMNode

          public java.lang.String loadDOMNode(java.lang.Object DOMNode)

      Specified by:
        `loadDOMNode` in interface `JmolAppletInterface`

    - #### loadInline

          @Deprecated
          public java.lang.String loadInline(java.lang.String strModel)

      Deprecated.
      Specified by:
        `loadInline` in interface `JmolAppletInterface`
      Parameters:
        `strModel` -
      Returns:
        error or null

    - #### loadInline

          @Deprecated
          public java.lang.String loadInline(java.lang.String strModel,
                                                         java.lang.String script)

      Deprecated.
      Specified by:
        `loadInline` in interface `JmolAppletInterface`
      Parameters:
        `strModel` -
        `script` -
      Returns:
        error or null

    - #### loadInline

          @Deprecated
          public java.lang.String loadInline(java.lang.String[] strModels)

      Deprecated.
      Specified by:
        `loadInline` in interface `JmolAppletInterface`
      Parameters:
        `strModels` -
      Returns:
        error or null

    - #### loadInline

          @Deprecated
          public java.lang.String loadInline(java.lang.String[] strModels,
                                                         java.lang.String script)

      Deprecated.
      Specified by:
        `loadInline` in interface `JmolAppletInterface`
      Parameters:
        `strModels` -
        `script` -
      Returns:
        error or null

    - #### output

          public void output(java.lang.String s)

    - #### setCallbackFunction

          public void setCallbackFunction(java.lang.String callbackName,
                                          java.lang.String callbackFunction)

      Specified by:
        `setCallbackFunction` in interface `JmolCallbackListener`

    - #### consoleMessage

          private void consoleMessage(java.lang.String message)

    - #### notifyEnabled

          public boolean notifyEnabled(CBK type)

      Specified by:
        `notifyEnabled` in interface `JmolCallbackListener`

    - #### notifyCallback

          public void notifyCallback(CBK type,
                                     java.lang.Object[] data)

      Specified by:
        `notifyCallback` in interface `JmolCallbackListener`
      Parameters:
        `type` - the callback type or null for getJsObjectInfo() -- Java applet only
        `data` - 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:
        `eval` in interface `JmolStatusListener`

    - #### functionXY

          public float[][] functionXY(java.lang.String functionName,
                                      int nX,
                                      int nY)

      Description copied from interface: `JmolStatusListener`
      for isosurface FUNCTIONXY
      Specified by:
        `functionXY` in interface `JmolStatusListener`
      Returns:
        2D array or null

    - #### functionXYZ

          public float[][][] functionXYZ(java.lang.String functionName,
                                         int nX,
                                         int nY,
                                         int nZ)

      Description copied from interface: `JmolStatusListener`
      for isosurface FUNCTIONXYZ
      Specified by:
        `functionXYZ` in interface `JmolStatusListener`
      Returns:
        3D array or null

    - #### 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: `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 interface `JmolStatusListener`
        `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

          public java.util.Map<java.lang.String,java.lang.Object> getRegistryInfo()

      Specified by:
        `getRegistryInfo` in interface `JmolStatusListener`

    - #### showUrl

          public void showUrl(java.lang.String urlString)

      Specified by:
        `showUrl` in interface `JmolStatusListener`

    - #### resizeInnerPanel

          public int[] resizeInnerPanel(java.lang.String data)

      Specified by:
        `resizeInnerPanel` in interface `JmolStatusListener`

    - #### 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:
        `notifyAudioEnded` in interface `JmolAppletInterface`