Class JSViewer

java.lang.Object
jspecview.common.JSViewer
All Implemented Interfaces:
BytePoster, PlatformViewer

public class JSViewer extends Object implements PlatformViewer, BytePoster
This class encapsulates all general functionality of applet and app. Most methods include ScriptInterface parameter, which will be JSVAppletPrivate, JSVAppletPrivatePro, or MainFrame.
Author:
Bob Hanson hansonr@stolaf.edu
  • Field Details

    • sourceLabel

      public static final String sourceLabel
      See Also:
    • FILE_OPEN_OK

      public static final int FILE_OPEN_OK
      See Also:
    • FILE_OPEN_ALREADY

      public static final int FILE_OPEN_ALREADY
      See Also:
    • FILE_OPEN_ERROR

      public static final int FILE_OPEN_ERROR
      See Also:
    • FILE_OPEN_NO_DATA

      public static final int FILE_OPEN_NO_DATA
      See Also:
    • OVERLAY_DIALOG

      public static final int OVERLAY_DIALOG
      See Also:
    • OVERLAY_OFFSET

      public static final int OVERLAY_OFFSET
      See Also:
    • PORTRAIT

      public static final int PORTRAIT
      See Also:
    • PAGE_EXISTS

      public static final int PAGE_EXISTS
      See Also:
    • NO_SUCH_PAGE

      public static final int NO_SUCH_PAGE
      See Also:
    • si

      public ScriptInterface si
    • g2d

      public GenericGraphics g2d
    • spectraTree

      public JSVTree spectraTree
    • currentSource

      public JDXSource currentSource
    • panelNodes

      public Lst<PanelNode> panelNodes
    • parameters

      public ColorParameters parameters
    • repaintManager

      public RepaintManager repaintManager
    • selectedPanel

      public JSVPanel selectedPanel
    • mainPanel

      public JSVMainPanel mainPanel
    • properties

      public Properties properties
    • scriptQueue

      public Lst<String> scriptQueue
    • fileHelper

      public JSVFileHelper fileHelper
    • jsvpPopupMenu

      public JSVGenericPopup jsvpPopupMenu
    • loadImaginary

      public boolean loadImaginary
    • interfaceOverlaid

      public boolean interfaceOverlaid
    • autoIntegrate

      public boolean autoIntegrate
    • autoShowLegend

      public boolean autoShowLegend
    • obscureTitleFromUser

      public Boolean obscureTitleFromUser
    • allowMenu

      public boolean allowMenu
    • initialStartIndex

      public int initialStartIndex
    • initialEndIndex

      public int initialEndIndex
    • isSingleThreaded

      public boolean isSingleThreaded
    • isApplet

      public boolean isApplet
    • isJS

      public static boolean isJS
    • isSwingJS

      public static boolean isSwingJS
    • isSigned

      public boolean isSigned
    • appletName

      public String appletName
    • fullName

      public String fullName
    • syncID

      public String syncID
    • html5Applet

      public JSVAppletObject html5Applet
    • display

      public Object display
    • apiPlatform

      public GenericPlatform apiPlatform
    • jmolObject

      public static JSVToJSmolInterface jmolObject
    • nmrMaxY

      public float nmrMaxY
  • Constructor Details

    • JSViewer

      public JSViewer(ScriptInterface si, boolean isApplet, boolean isJSApplet)
      Parameters:
      si -
      isApplet -
      isJSApplet -
  • Method Details

    • setProperty

      public void setProperty(String key, String value)
    • setNode

      public void setNode(PanelNode node)
    • setPopupMenu

      public void setPopupMenu(boolean allowMenu, boolean zoomEnabled)
    • showMenu

      public void showMenu(int x, int y)
    • runScriptNow

      public boolean runScriptNow(String script)
    • checkOvelayInterface

      public boolean checkOvelayInterface(String value)
    • pd

      public PanelData pd()
    • execView

      public void execView(String value, boolean fromScript)
    • syncScript

      public void syncScript(String peakScript)
      incoming script processing of invalid input: '<'PeakAssignment file="" type="xxx"...> record from Jmol
      Parameters:
      peakScript -
    • processPeakPickEvent

      public void processPeakPickEvent(Object eventObj, boolean isApp)
      this method is called as a result of the user clicking on a peak (eventObject instanceof PeakPickEvent) or from PEAK command execution
      Parameters:
      eventObj -
      isApp -
    • sendPanelChange

      public void sendPanelChange()
    • getPropertyAsJavaObject

      public Map<String,Object> getPropertyAsJavaObject(String key)
    • getCoordinate

      public String getCoordinate()
    • getSolutionColor

      public int getSolutionColor(boolean asFitted)
    • openDataOrFile

      public int openDataOrFile(Object data, String name, Lst<Spectrum> specs, String strUrl, int firstSpec, int lastSpec, boolean isAppend, String id)
    • close

      public void close(String value)
    • execLoad

      public void execLoad(String value, String script)
    • combineSpectra

      public void combineSpectra(String name)
    • closeSource

      public void closeSource(JDXSource source)
    • setFrameAndTreeNode

      public void setFrameAndTreeNode(int i)
    • selectFrameNode

      public PanelNode selectFrameNode(JSVPanel jsvp)
    • splitSpectra

      public void splitSpectra()
    • selectedTreeNode

      public void selectedTreeNode(JSVTreeNode node)
    • dispose

      public void dispose()
    • runScript

      public void runScript(String script)
    • requestRepaint

      public void requestRepaint()
    • repaintDone

      public void repaintDone()
    • checkOverlay

      public void checkOverlay()
    • setDisplay

      public void setDisplay(Object canvas)
    • setScreenDimension

      public void setScreenDimension(int width, int height)
    • updateJS

      public void updateJS()
      for JavaScript only; this is the call to draw the spectrum
    • processMouseEvent

      public boolean processMouseEvent(int id, int x, int y, int modifiers, long time)
      called by JSmol.js mouse event
      Parameters:
      id -
      x -
      y -
      modifiers -
      time -
      Returns:
      t/f
    • processTwoPointGesture

      public void processTwoPointGesture(float[][][] touches)
    • getApplet

      public JSVAppletObject getApplet()
    • openFileAsyncSpecial

      public void openFileAsyncSpecial(String fileName, int flags)
      Parameters:
      fileName -
      flags -
    • getHeight

      public int getHeight()
    • getWidth

      public int getWidth()
    • getPlatformInterface

      public Object getPlatformInterface(String type)
    • getDialogManager

      public DialogManager getDialogManager()
    • getDialog

      public JSVDialog getDialog(Annotation.AType type, Spectrum spec)
    • getDialogPrint

      public PrintLayout getDialogPrint(boolean isJob)
    • setIRmode

      public void setIRmode(String mode)
    • getOptionFromDialog

      public int getOptionFromDialog(String[] items, String title, String label)
    • print

      public String print(String fileName)
    • export

      public String export(String type, int n)
    • postByteArray

      public String postByteArray(String fileName, byte[] bytes)
      Specified by:
      postByteArray in interface BytePoster
    • getOutputChannel

      public OC getOutputChannel(String fileName, boolean isBinary) throws Exception
      Throws:
      Exception
    • getInterface

      public static Object getInterface(String name)
    • showMessage

      public void showMessage(String msg)
    • openFileFromDialog

      public void openFileFromDialog(boolean isAppend, boolean isURL, String simulationType, String script)
    • openFile

      public void openFile(String fileName, boolean closeFirst)
      Opens and displays a file
      Parameters:
      fileName -
      closeFirst -
    • selectPanel

      public int selectPanel(JSVPanel jsvp, Lst<PanelNode> panelNodes)
    • checkAutoIntegrate

      public void checkAutoIntegrate()
    • parseInitScript

      public void parseInitScript(String params)
      Parses the JavaScript call parameters and executes them accordingly
      Parameters:
      params - String
    • getSolutionColorStr

      public String getSolutionColorStr(boolean asFit)
    • checkCommandLineForTip

      public String checkCommandLineForTip(char c, String cmd, boolean oneLineOnly)
    • checkScript

      public String checkScript(String script)