Class JSViewer
java.lang.Object
jspecview.common.JSViewer
- All Implemented Interfaces:
BytePoster, PlatformViewer
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 Summary
FieldsModifier and TypeFieldDescriptionbooleanbooleanbooleanstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intbooleanintintbooleanbooleanbooleanstatic booleanbooleanbooleanstatic booleanstatic JSVToJSmolInterfacebooleanfloatstatic final intstatic final intstatic final intstatic final intstatic final intstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionJSViewer(ScriptInterface si, boolean isApplet, boolean isJSApplet, boolean hasDisplay) -
Method Summary
Modifier and TypeMethodDescriptionvoidadvanceSpectrumBy(int n) voidcheckCommandLineForTip(char c, String cmd, boolean oneLineOnly) booleancheckOvelayInterface(String value) voidcheckScript(String script) voidvoidcloseSource(JDXSource source) voidcombineSpectra(String name) voiddispose()voidvoidgetDialog(Annotation.AType type, Spectrum spec) intstatic ObjectgetInterface(String name) intgetOptionFromDialog(String[] items, String title, String label) getOutputChannel(String fileName, boolean isBinary) getPlatformInterface(String type) getPrintLayout(boolean isJob) intgetSolutionColor(boolean asFitted) getSolutionColorStr(boolean asFit) intgetWidth()intopenDataOrFile(Object data, String name, Lst<Spectrum> specs, String strUrl, int firstSpec, int lastSpec, boolean isAppend, String id) voidOpens and displays a filevoidopenFileAsyncSpecial(String fileName, int flags) booleanopenFileFromDialog(boolean isAppend, boolean isURL, String simulationType, String script) voidparseInitScript(String params) Parses the JavaScript call parameters and executes them accordinglypd()postByteArray(String fileName, byte[] bytes) voidprocessKeyEvent(Object event) booleanprocessMouseEvent(int id, int x, int y, int modifiers, long time) called by JSmol.js mouse eventvoidprocessPeakPickEvent(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 executionvoidprocessTwoPointGesture(float[][][] touches) voidvoidvoidbooleanrunScriptNow(String script) voidselectedTreeNode(JSVTreeNode node) selectFrameNode(JSVPanel jsvp) intselectPanel(JSVPanel jsvp, Lst<PanelNode> panelNodes) From (AwtMainPanel or JsMainPanel).setSelectedPanelvoidvoidsetCreatingImage(boolean isSaving) voidsetDisplay(Object canvas) voidsetFrameAndTreeNode(int i) voidvoidvoidsetParentFrame(JFrame parentFrame) voidsetPopupMenu(boolean allowMenu, boolean zoomEnabled) voidsetProperty(String key, String value) voidsetRecentSimulation(String name) voidsetScreenDimension(int width, int height) voidshowMenu(int x, int y) voidshowMessage(String msg) voidvoidsyncScript(String peakScript) / Jmol sychronizationvoidupdateJS()for JavaScript only; this is the call to draw the spectrum
-
Field Details
-
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:
-
PDF_PAGE_EXISTS
public static final int PDF_PAGE_EXISTS- See Also:
-
PDF_NO_SUCH_PAGE
public static final int PDF_NO_SUCH_PAGE- See Also:
-
DEFAULT_WIDTH
public static final int DEFAULT_WIDTH- See Also:
-
DEFAULT_HEIGHT
public static final int DEFAULT_HEIGHT- See Also:
-
si
-
g2d
-
spectraTree
-
currentSource
-
panelNodes
-
parameters
-
repaintManager
-
selectedPanel
-
mainPanel
-
properties
-
scriptQueue
-
fileHelper
-
jsvpPopupMenu
-
isEmbedded
public boolean isEmbedded -
loadImaginary
public boolean loadImaginary -
interfaceOverlaid
public boolean interfaceOverlaid -
autoIntegrate
public boolean autoIntegrate -
autoShowLegend
public boolean autoShowLegend -
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
-
fullName
-
syncID
-
html5Applet
-
display
-
apiPlatform
-
hasDisplay
public boolean hasDisplay -
jsmolObject
-
peakInfoModelSentToJmol
-
nmrMaxY
public float nmrMaxY -
recentSimulation
-
-
Constructor Details
-
JSViewer
- Parameters:
si-isApplet-isJSApplet-hasDisplay-
-
-
Method Details
-
setParentFrame
-
setProperty
-
setNode
-
setPopupMenu
public void setPopupMenu(boolean allowMenu, boolean zoomEnabled) -
showMenu
public void showMenu(int x, int y) -
runScriptNow
-
checkOvelayInterface
-
pd
-
execView
-
sendPanelChange
public void sendPanelChange() -
getPropertyAsJavaObject
-
getCoordinate
-
getSolutionColor
public int getSolutionColor(boolean asFitted) -
openDataOrFile
-
close
-
execLoad
-
combineSpectra
-
closeSource
-
setFrameAndTreeNode
public void setFrameAndTreeNode(int i) -
selectFrameNode
-
splitSpectra
public void splitSpectra() -
selectedTreeNode
-
dispose
public void dispose() -
runScript
-
requestRepaint
public void requestRepaint() -
repaintDone
public void repaintDone() -
checkOverlay
public void checkOverlay() -
setDisplay
-
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) -
processKeyEvent
-
getApplet
-
openFileAsyncSpecial
- Parameters:
fileName-flags-
-
getHeight
public int getHeight() -
getWidth
public int getWidth() -
getPlatformInterface
-
getDialogManager
-
getDialog
-
getPrintLayout
-
setIRmode
-
getOptionFromDialog
-
print
-
export
-
postByteArray
- Specified by:
postByteArrayin interfaceBytePoster- Parameters:
fileName-bytes-- Returns:
- null or a Java exception message if there is an error; otherwise "OK" and a message
-
getOutputChannel
-
getInterface
-
showMessage
-
openFileFromDialog
-
openFile
Opens and displays a file- Parameters:
fileName-closeFirst-
-
selectPanel
-
checkAutoIntegrate
public void checkAutoIntegrate() -
parseInitScript
Parses the JavaScript call parameters and executes them accordingly- Parameters:
params- String
-
getSolutionColorStr
-
checkCommandLineForTip
-
checkScript
-
setRecentSimulation
-
setCreatingImage
public void setCreatingImage(boolean isSaving) -
advanceSpectrumBy
public void advanceSpectrumBy(int n) -
processPeakPickEvent
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-
-
syncScript
/ Jmol sychronization
-