# Class JSpecView

java.lang.Object
jspecview.application.JSpecView

All Implemented Interfaces:
  `ScriptInterface, JmolSyncInterface, JSVInterface`

public class JSpecView extends Object implements JSVInterface, JmolSyncInterface, ScriptInterface
The Main Class or Entry point of the JSpecView Application.

Author:
  Debbie-Ann Facey, Khari A. Bryan, Prof Robert J. Lancashire, Bob Hanson St. Olaf College hansonr@stolaf.edu

## Field Summary

Fields
Modifier and Type
Field
Description
`String`
`defaultDisplaySchemeName`
`JmolSyncInterface`
`jmol`

## Constructor Summary

Constructors
Constructor
Description
`JSpecView(boolean hasDisplay, JSVInterface jmolStatusListener)`
The entry point constructor, from Jmol's StatusListener or from the AppletPro object (via MainFrame) or from MainFrame itself.

## Method Summary

Modifier and Type
Method
Description
`void`
`exitJSpecView(boolean withDialog, Object frame)`
StatusListener (Jmol will not actually close; we will here if stand-alone)
`void`
`getDisplaySchemesProcessor(JSVInterface statusListener)`
`Map<String,Object>`
`getJSpecViewProperty(String key)`
`boolean`
`isHeadless()`
`boolean`
`isSigned()`
`static void`
`main(String[] args)`
`void`
`notifyExitingJspecView(boolean isClosing, boolean askFirst)`
From MainFrame only
`void`
`register(String appletID, JmolSyncInterface jmolStatusListener)`
called by Jmol's StatusListener to register itself, indicating to JSpecView that it needs to synchronize with it
`void`
`repaint()`
`void`
`runScript(String script)`
ScriptInterface requires this.
`boolean`
`runScriptNow(String script)`
`void`
`saveProperties(Properties properties)`
`void`
`setApplicationProperties(boolean shouldApplySpectrumDisplaySettings)`
`void`
`setCursor(int id)`
`void`
`setMainFrame(MainFrame mainFrame)`
`void`
`setProperties(Properties properties)`
`void`
`setStatusListener(JSVInterface jmolStatusListener)`
`void`
`siCheckCallbacks(String title)`
`void`
`siExecHidden(boolean b)`
`void`
`siExecScriptComplete(String msg, boolean isOK)`
`void`
`siExecSetCallback(ScriptToken st, String value)`
`void`
`siExecTest(String value)`
`JSVPanel`
`siGetNewJSVPanel(Spectrum spec)`
`JSVPanel`
`siGetNewJSVPanel2(Lst<Spectrum> specs)`
`String`
`siLoaded(String value)`
`void`
`siNewWindow(boolean isSelected, boolean fromFrame)`
`void`
`siNodeSet(PanelNode panelNode)`
`void`
`siOpenDataOrFile(Object data, String name, Lst<Spectrum> specs, String url, int firstSpec, int lastSpec, boolean isAppend, String script, String id)`
`void`
`siProcessCommand(String script)`
`void`
`siSendPanelChange()`
`void`
`siSetCurrentSource(JDXSource source)`
`void`
`siSetLoaded(String fileName, String filePath)`
`void`
`siSetMenuEnables(PanelNode node, boolean isSplit)`
`void`
`siSetPropertiesFromPreferences(JSVPanel jsvp, boolean includeMeasures)`
Sets the display properties as specified from the preferences dialog or the properties file
`void`
`siSetSelectedPanel(JSVPanel jsvp)`
`void`
`siSourceClosed(JDXSource source)`
Closes the `JDXSource` specified by source
`void`
`siSyncLoad(String filePath)`
`void`
`siUpdateBoolean(ScriptToken st, boolean TF)`
`void`
`siUpdateRecentMenus(String filePath)`
`void`
`siValidateAndRepaint(boolean isAll)`
`void`
`syncScript(String peakScript)`
`void`
`syncToJmol(String msg)`
`void`
`writeStatus(String msg)`
Writes a message to the status bar

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### defaultDisplaySchemeName

public String defaultDisplaySchemeName

### jmol

public JmolSyncInterface jmol

## Constructor Details

### JSpecView

public JSpecView(boolean hasDisplay, JSVInterface jmolStatusListener)
The entry point constructor, from Jmol's StatusListener or from the AppletPro object (via MainFrame) or from MainFrame itself.

Parameters:
  `hasDisplay` -
  `jmolStatusListener` -

## Method Details

### setMainFrame

public void setMainFrame(MainFrame mainFrame)

### isHeadless

public boolean isHeadless()

### setStatusListener

public void setStatusListener(JSVInterface jmolStatusListener)

### getDisplaySchemesProcessor

public void getDisplaySchemesProcessor(JSVInterface statusListener)

### setProperties

public void setProperties(Properties properties)

Specified by:
  `setProperties` in interface `JSVInterface`

### saveProperties

public void saveProperties(Properties properties)

Specified by:
  `saveProperties` in interface `JSVInterface`

### siOpenDataOrFile

public void siOpenDataOrFile(Object data, String name, Lst<Spectrum> specs, String url, int firstSpec, int lastSpec, boolean isAppend, String script, String id)

Specified by:
  `siOpenDataOrFile` in interface `ScriptInterface`

### siSetCurrentSource

public void siSetCurrentSource(JDXSource source)

Specified by:
  `siSetCurrentSource` in interface `ScriptInterface`

### siSetPropertiesFromPreferences

public void siSetPropertiesFromPreferences(JSVPanel jsvp, boolean includeMeasures)
Sets the display properties as specified from the preferences dialog or the properties file

Specified by:
  `siSetPropertiesFromPreferences` in interface `ScriptInterface`
Parameters:
  `jsvp` - the display panel

### siProcessCommand

public void siProcessCommand(String script)

Specified by:
  `siProcessCommand` in interface `ScriptInterface`

### siSetSelectedPanel

public void siSetSelectedPanel(JSVPanel jsvp)

Specified by:
  `siSetSelectedPanel` in interface `ScriptInterface`

### siSendPanelChange

public void siSendPanelChange()

Specified by:
  `siSendPanelChange` in interface `ScriptInterface`

### siSyncLoad

public void siSyncLoad(String filePath)

Specified by:
  `siSyncLoad` in interface `ScriptInterface`

### siValidateAndRepaint

public void siValidateAndRepaint(boolean isAll)

Specified by:
  `siValidateAndRepaint` in interface `ScriptInterface`

### siExecHidden

public void siExecHidden(boolean b)

Specified by:
  `siExecHidden` in interface `ScriptInterface`

### siLoaded

public String siLoaded(String value)

Specified by:
  `siLoaded` in interface `ScriptInterface`

### siExecScriptComplete

public void siExecScriptComplete(String msg, boolean isOK)

Specified by:
  `siExecScriptComplete` in interface `ScriptInterface`

### siExecSetCallback

public void siExecSetCallback(ScriptToken st, String value)

Specified by:
  `siExecSetCallback` in interface `ScriptInterface`

### siUpdateBoolean

public void siUpdateBoolean(ScriptToken st, boolean TF)

Specified by:
  `siUpdateBoolean` in interface `ScriptInterface`

### siCheckCallbacks

public void siCheckCallbacks(String title)

Specified by:
  `siCheckCallbacks` in interface `ScriptInterface`

### siNodeSet

public void siNodeSet(PanelNode panelNode)

Specified by:
  `siNodeSet` in interface `ScriptInterface`

### siSourceClosed

public void siSourceClosed(JDXSource source)
Closes the `JDXSource` specified by source

Specified by:
  `siSourceClosed` in interface `ScriptInterface`
Parameters:
  `source` - the `JDXSource`

### siSetLoaded

public void siSetLoaded(String fileName, String filePath)

Specified by:
  `siSetLoaded` in interface `ScriptInterface`

### siUpdateRecentMenus

public void siUpdateRecentMenus(String filePath)

Specified by:
  `siUpdateRecentMenus` in interface `ScriptInterface`

### siSetMenuEnables

public void siSetMenuEnables(PanelNode node, boolean isSplit)

Specified by:
  `siSetMenuEnables` in interface `ScriptInterface`

### siGetNewJSVPanel

public JSVPanel siGetNewJSVPanel(Spectrum spec)

Specified by:
  `siGetNewJSVPanel` in interface `ScriptInterface`

### siGetNewJSVPanel2

public JSVPanel siGetNewJSVPanel2(Lst<Spectrum> specs)

Specified by:
  `siGetNewJSVPanel2` in interface `ScriptInterface`

### siExecTest

public void siExecTest(String value)

Specified by:
  `siExecTest` in interface `ScriptInterface`

### siNewWindow

public void siNewWindow(boolean isSelected, boolean fromFrame)

Specified by:
  `siNewWindow` in interface `ScriptInterface`

### repaint

public void repaint()

Specified by:
  `repaint` in interface `ScriptInterface`

### setCursor

public void setCursor(int id)

Specified by:
  `setCursor` in interface `ScriptInterface`

### isSigned

public boolean isSigned()

Specified by:
  `isSigned` in interface `ScriptInterface`

### setApplicationProperties

public void setApplicationProperties(boolean shouldApplySpectrumDisplaySettings)

### main

public static void main(String[] args)

### register

public void register(String appletID, JmolSyncInterface jmolStatusListener)
called by Jmol's StatusListener to register itself, indicating to JSpecView that it needs to synchronize with it

Specified by:
  `register` in interface `JmolSyncInterface`

### getJSpecViewProperty

public Map<String,Object> getJSpecViewProperty(String key)

Specified by:
  `getJSpecViewProperty` in interface `JmolSyncInterface`

### syncScript

public void syncScript(String peakScript)

Specified by:
  `syncScript` in interface `JmolSyncInterface`

### runScript

public void runScript(String script)
ScriptInterface requires this. In the applet, this would be queued

Specified by:
  `runScript` in interface `JSVInterface`
Specified by:
  `runScript` in interface `ScriptInterface`

### writeStatus

public void writeStatus(String msg)
Writes a message to the status bar

Specified by:
  `writeStatus` in interface `ScriptInterface`
Parameters:
  `msg` - the message

### syncToJmol

public void syncToJmol(String msg)

Specified by:
  `syncToJmol` in interface `JSVInterface`
Specified by:
  `syncToJmol` in interface `ScriptInterface`

### runScriptNow

public boolean runScriptNow(String script)

Specified by:
  `runScriptNow` in interface `ScriptInterface`

### notifyExitingJspecView

public void notifyExitingJspecView(boolean isClosing, boolean askFirst)
From MainFrame only

Parameters:
  `isClosing` -
  `askFirst` -

### exitJSpecView

public void exitJSpecView(boolean withDialog, Object frame)
StatusListener (Jmol will not actually close; we will here if stand-alone)

Specified by:
  `exitJSpecView` in interface `JSVInterface`