Class RtestBase

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--RtestBase
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.event.ItemListener, java.awt.MenuContainer, java.io.Serializable, java.awt.event.WindowListener
Direct Known Subclasses:
Rtest

public abstract class RtestBase
extends java.awt.Frame
implements java.awt.event.ItemListener, java.awt.event.ActionListener, java.awt.event.WindowListener

Class RtestBase - evaluate R scripts with data supplied from Client program via the MJAReval API. Each R analysis is defined by a R LayOut (RLO). Each RLO is saved in an internal RLO database managed by the mjaReval MJA class. These specify the evaluation environment for the .R script when evaluated by R. The R program is then run as a separate process using a System.exec()

NOTE: this base class is used to create Rtest.java class that implements the declared abstract methods using application dependent methods.

When executed, an R script is allowed to generate multiple output files that may include the following format templateValues: text, tab-delimited text, PDF, JPG, etc. There may be also multiple data input files requested by the R script. These are generated by mjaReval class methods as specified by the RLO database entry. Note: during R execution, all files are read and written from the {project}/Temp directory, the R current working directory. They may be copied to or from this directory from or to other directories as required.


  • data is exported from MAExplorer to tab-delimited data files {Project}/Temp/. These will then be read by R when your script is evaluated.
  • The output of R is saved to any number of files into {project}/Temp and then moved to {Project}/Report/ where they may then be displayed or read by MAExplorer if required.
  • The .R scripts are shared with all instances of MAExplorer and are kept in {MAExplorer installation}/R/
  • The startup script is generated by an mjaReval method and placed in the {project}/Temp directory where it will be used by a System.exec() call.

    This example is under construction, but can serve as a model of some the Open Java API interface and writing a simple MAEPlugin.

    This work was produced by Peter Lemkin of the National Cancer Institute, an agency of the United States Government. As a work of the United States Government there is no associated copyright. It is offered as open source software under the Mozilla Public License (version 1.1) subject to the limitations noted in the accompanying LEGAL file. This notice must be included with the code. The MAExplorer Mozilla and Legal files are available on http://maexplorer.sourceforge.net/.

    Version:
    $Date: 2003/06/18 19:10:37 $ $Revision: 1.80 $
    Author:
    P. Lemkin (NCI-Frederick); G. Thornwall (SAIC-Frederick); W.G. Alvord and Lubomirski (CSS/DMS/NCI-Frederick), Frederick, MD; S. Sundaram, SRA/BIMAS/CIT-NIH.
    See Also:
    MAExplorer Home, Reval, MJAReval, Serialized Form

    Inner classes inherited from class java.awt.Frame
    java.awt.Frame.AccessibleAWTFrame
     
    Inner classes inherited from class java.awt.Window
    java.awt.Window.AccessibleAWTWindow
     
    Inner classes inherited from class java.awt.Container
    java.awt.Container.AccessibleAWTContainer
     
    Inner classes inherited from class java.awt.Component
    java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock
     
    Field Summary
    private  boolean appendTextFlag
              Flag for append text and resetting cursor to end of TextArea
    private static java.lang.String BANNER
               
    private  java.awt.Panel buttonPanel
              button control panel
    private  java.awt.Button clearReportButton
              "Clear report" to clear the text area
    private  java.lang.String clientBrowserTitle
              Client current browser title for this database
    private  java.lang.String clientDatabase
              Client current database
    (package private)  java.lang.String clientName
              Name of the client
    (package private)  java.lang.String clientPrefixName
              Prefix Name of the client
    private  java.lang.String clientPrjPath
              Client current project path.
    private  java.awt.Button closeButton
              "Close" window button
    (package private) static boolean CONSOLE_FLAG
              Debug flags
    private  java.awt.Color dataBkgrd
              Text data report background color that may be changed
    private  java.awt.Color dataColor
              Text data report foreground color that may be changed
    private  java.awt.TextField dataTF
              Text data report line
    private static java.lang.String DATE
               
    (package private) static boolean DBUG_APPEND_REPORT
               
    (package private)  boolean DBUG_FLAG
               
    private  java.awt.Checkbox dbugCheckbox
              dbug checkbox toggles output being appended to reportText window
    (package private)  boolean dbugFlag
              Flag set debugging - toggled by dbugbox if DBUG_FLAG is set
    (package private) static int DEF_MAX_ANALSYSES
              Maximum # scripts (may grow over time)
    private  java.awt.Button deleteRLOButton
              "Delete RLO" window button
    private  java.awt.Button editRLOButton
              "Edit RLO" to edit existing RLO
    (package private) static java.lang.String EPILOGUE_END
              fixed epilogue end string
    (package private) static java.lang.String EPILOGUE_START
              fixed epilogue start string
    private  java.awt.Button evalButton
              "Evaluate" window button
    (package private)  java.lang.String fileSep
               
    private  boolean guiReadyFlag
              set if GUI is ready for action!
    private  java.awt.Button helpButton
              "Help Msg" window button
    private  java.lang.String helpMsg
              Help text
    private  java.awt.Panel inputPanel
              input panel to hold scriptChoice
    private  java.awt.TextField inputTF
              Text input data line
    (package private)  boolean isWindowsFlag
              Flag set if running on a Windows computer
    (package private)  java.lang.String javaHome
               
    private static int MIN_WINDOW_HEIGHT
               
    private static int MIN_WINDOW_WIDTH
              MIN size of scrollable Canvas
    (package private)  MJAReval mjaReval
              instance of Reval
    (package private)  MJAReval mr
               
    private  java.awt.Color msgBkgrd
              Text message background color that may be changed
    private  java.awt.Color msgColor
              Text message foreground color that may be changed
    (package private)  java.awt.Font msgFont
              fonts for labeling subtitle for each panel in image
    private  java.awt.TextField msgTF
              Text message report line
    (package private)  int nAnalyses
              The total number of analyses in the RLO database
    private  int nCols
              # of columns size of text area for reporting
    (package private)  int nDemoAnalyses
              The number of "Demo" analyses in the RLO database.
    (package private) static boolean NEVER
              Debug flags
    private  java.awt.Button newRLOButton
              "New RLO" to create new RLO
    private  int nRows
              # of rows size of text area for reporting
    (package private)  java.lang.String osName
               
    private  PopupEditRscript pe
               
    private  int preferredHeight
              preferred height size of frame
    private  int preferredWidth
              preferred width size of frame
    (package private) static java.lang.String PROLOGUE_END
              fixed prologue end string
    (package private) static java.lang.String PROLOGUE_START
              fixed prologue start string
    (package private)  java.lang.String reportText
              text for TextArea
    private  java.awt.TextArea reportTextArea
              Text area to draw reportText that is returned from performing the eval of the .R script
    private static java.lang.String REVISION
               
    (package private)  RgenDemo rgd
              R demo code generator
    (package private)  Rtest rt
               
    private  java.awt.Button saveAllDemoRLOsButton
              Save All Demo RLOs button if "Show Demo RLOs" is set.
    private  java.awt.Button saveasButton
              "SaveAs" window button
    private  boolean saveReportAsTextFileFlag
              Flag enabled if doing "SaveAs"
    private  java.awt.Choice scriptChoice
              Choice to select an R script to use from analysis[0:nAnalyses-1].
    private  java.awt.Checkbox showDemoRLOsCheckbox
              Show Demo RLOs checkbox toggles showDemoRLOsFlag.
    private  boolean showDemoRLOsFlag
              Flag show Demo RLOs in menu - toggled by showDemoRLOsCheckbox
    private  java.awt.Button showPlotsButton
              "Show generated plot(s)" window button
    private  java.awt.Button showRLOButton
              "Show RLO" window button
    private  java.awt.Button showRscriptButton
              "Show R script" current R script button
    (package private)  java.lang.String spaces
              Spaces
    (package private)  java.awt.Font titleFont
              fonts for labeling full image title etc.
    private  java.awt.Panel topPanel
              top panel holding the buttonPanel and the msgTA TextField
    (package private)  java.lang.String userDir
               
    private static java.lang.String VERSION
               
     
    Fields inherited from class java.awt.Frame
    base, CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, frameSerializedDataVersion, HAND_CURSOR, icon, ICONIFIED, mbManagement, menuBar, MOVE_CURSOR, N_RESIZE_CURSOR, nameCounter, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, ownedWindows, resizable, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, serialVersionUID, state, SW_RESIZE_CURSOR, TEXT_CURSOR, title, W_RESIZE_CURSOR, WAIT_CURSOR, weakThis
     
    Fields inherited from class java.awt.Window
    active, dbg, focusMgr, inputContext, inputContextLock, OPENED, ownedWindowList, showWithParent, warningString, windowListener, windowSerializedDataVersion
     
    Fields inherited from class java.awt.Container
    component, containerListener, containerSerializedDataVersion, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, printing, printingThreads
     
    Fields inherited from class java.awt.Component
    accessibleContext, actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y
     
    Fields inherited from interface java.awt.image.ImageObserver
    ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
     
    Constructor Summary
    RtestBase(MJAReval mjaReval, java.lang.String clientName, java.lang.String clientPrefixName, java.lang.String clientPrjPath, java.lang.String clientBrowserTitle, java.lang.String clientDatabase)
              RtestBase() - Constructor
     
    Method Summary
     void actionPerformed(java.awt.event.ActionEvent e)
              actionPerformed() - Handle Control panel button clicks
    (package private)  void appendReport(java.lang.String msg, boolean appendToRptFlag)
              appendReport() - add text to report text area
    private  boolean buildGUI()
              buildGUI() - build the graphical user interface
     void close(int exitCode)
              close() - exit with specified exit code.
    (package private) abstract  java.lang.String cvtSpacesToUnderscores(java.lang.String str)
              cvtSpacesToUnderscores() - replace spaces and other illegal file name characters with '_' chars to make file names highly portable.
    : space( ) ; " { } < > = , ? \ / % * ! @ & | ' ` \t
    (package private) abstract  void displayPDF(java.lang.String pdfFile)
              displayPDF() - Display PDF file in adobe, for use in stand-alone.
    (package private) abstract  void displayURL(java.lang.String urlStr)
              displayURL() - Display URL file in system Web browser, for use in stand-alone mode.
    private  void drawReportText(java.awt.Graphics g)
              drawReportText() - repaint report.
     java.lang.String extractUserRscript(java.lang.String completeRscript)
              extractUserRscript() - extract user R script from center of complete.
    (package private)  java.lang.String genEpilogue()
              genEpilogue() - generate epilogue R script to write data commands to put R created data into Temp/ folder for reading by MAExplorer when required by actions in the RLO specification.
    (package private)  java.lang.String genPrologue()
              genPrologue() - generate prologue R script to read data commands.
    (package private) abstract  java.lang.String[] getListOfMenuStubNames()
              getListOfMenuStubNames() - get list of menu stub names
     java.awt.Dimension getPreferredSize()
              getPreferredSize() - get the preferred size
    (package private)  int getUseGenRbit(int genRmethod)
              getUseGenRbit() - lookup the use R_GENR_xxxx bit specified by method
     boolean handleEvent(java.awt.Event evt)
              handleEvent() - process special events
    private  boolean initializeDataAndGUI()
              initializeDataAndGUI() - build the GUI, then repaint to build the initial display.
     boolean initRtest(Rtest rt)
              initRtest() - initialize the Rtest popup and create the GUI
     void itemStateChanged(java.awt.event.ItemEvent e)
              itemStateChanged() - handle item state changed eventsms.
     void paint(java.awt.Graphics g)
              paint() - repaint full scrolled text area.
    (package private) abstract  void popupAlertMsg(java.lang.String title, java.lang.String msg, int nRows, int nCols)
              popupAlertMsg() - popup alert message in a scrollable text area.
    (package private) abstract  java.lang.String readTextFromFile(java.lang.String fileName, java.lang.String loadingMsg)
              readTextFromFile() - read text from text file.
    (package private)  void rebuildScriptChoices()
              rebuildScriptChoices() - rebuild the R script choices pull-down menu from the menuNames[] data.
    (package private) abstract  java.lang.String rmvRtnChars(java.lang.String str)
              rmvRtnChars() - remove return chars.
    private  void saveTextReport(java.lang.String textFileName)
              saveTextReport() - Saves reportText to file
    private  void showCurrentRplots()
              showCurrentRplots() - show plots generated if any with last R eval.
    (package private)  void showData(java.lang.String data, java.awt.Color fgColor, java.awt.Color bgColor)
              showData() - draw data in GUI data line
    (package private)  void showGuiMsg(java.lang.String msg, java.awt.Color fgColor, java.awt.Color bgColor)
              showGuiMsg() - draw text in GUI message line
    (package private) abstract  void showMsg(java.lang.String msg)
              showMsg() - display message in client GUI
     void update(java.awt.Graphics g)
              update() - update window
     void updateCurGene(int mid)
              updateCurGene() - update any data since current gene has changed.
     void updateFilter()
              updateFilter() - update any dependent data since Filter has changed.
     void updateLabels()
              updateLabels() - update any dependent data since global labels have changed.
     void updateSlider()
              updateSlider() - update any dependent data sincea threshold slider has changed.
     void windowActivated(java.awt.event.WindowEvent e)
               
     void windowClosed(java.awt.event.WindowEvent e)
               
     void windowClosing(java.awt.event.WindowEvent e)
              windowClosing() - close down the window.
     void windowDeactivated(java.awt.event.WindowEvent e)
               
     void windowDeiconified(java.awt.event.WindowEvent e)
               
     void windowIconified(java.awt.event.WindowEvent e)
               
     void windowOpened(java.awt.event.WindowEvent e)
               
    (package private) abstract  boolean writeTextToFile(java.lang.String textFileName, java.lang.String textReport)
              writeTextToFile() - save text string as text file.
     
    Methods inherited from class java.awt.Frame
    , addNotify, addToFrameList, constructComponentName, finalize, getAccessibleContext, getCursorType, getFrames, getIconImage, getMenuBar, getState, getTitle, initIDs, isResizable, paramString, postProcessKeyEvent, readObject, remove, removeFromFrameList, removeNotify, setCursor, setIconImage, setMenuBar, setResizable, setState, setTitle, writeObject
     
    Methods inherited from class java.awt.Window
    addOwnedWindow, addWindowListener, adjustListeningChildren, applyResourceBundle, applyResourceBundle, connectOwnedWindow, dispatchEventImpl, dispose, eventEnabled, getFocusOwner, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, hide, isActive, isShowing, nextFocus, ownedInit, pack, postEvent, postWindowEvent, preProcessKeyEvent, processEvent, processWindowEvent, removeOwnedWindow, removeWindowListener, resetGC, setCursor, setFocusOwner, setWarningString, show, toBack, toFront, transferFocus
     
    Methods inherited from class java.awt.Container
    add, add, add, add, add, addContainerListener, addImpl, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventToSelf, doLayout, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getMouseEventTarget, getWindow, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, numListening, paintComponents, paintHeavyweightComponents, postsOldMouseEvents, preferredSize, print, printComponents, printHeavyweightComponents, processContainerEvent, proxyEnableEvents, proxyRequestFocus, remove, remove, removeAll, removeContainerListener, setFont, setLayout, validate, validateTree
     
    Methods inherited from class java.awt.Component
    action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus
     
    Methods inherited from class java.lang.Object
    clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
     
    Methods inherited from interface java.awt.MenuContainer
    getFont, postEvent
     

    Field Detail

    DATE

    private static final java.lang.String DATE

    REVISION

    private static final java.lang.String REVISION

    VERSION

    private static final java.lang.String VERSION

    BANNER

    private static final java.lang.String BANNER

    DEF_MAX_ANALSYSES

    static final int DEF_MAX_ANALSYSES
    Maximum # scripts (may grow over time)

    CONSOLE_FLAG

    static final boolean CONSOLE_FLAG
    Debug flags

    NEVER

    static final boolean NEVER
    Debug flags

    MIN_WINDOW_WIDTH

    private static final int MIN_WINDOW_WIDTH
    MIN size of scrollable Canvas

    MIN_WINDOW_HEIGHT

    private static final int MIN_WINDOW_HEIGHT

    DBUG_APPEND_REPORT

    static final boolean DBUG_APPEND_REPORT

    PROLOGUE_START

    static final java.lang.String PROLOGUE_START
    fixed prologue start string

    PROLOGUE_END

    static final java.lang.String PROLOGUE_END
    fixed prologue end string

    EPILOGUE_START

    static final java.lang.String EPILOGUE_START
    fixed epilogue start string

    EPILOGUE_END

    static final java.lang.String EPILOGUE_END
    fixed epilogue end string

    DBUG_FLAG

    final boolean DBUG_FLAG

    rt

    Rtest rt

    mjaReval

    MJAReval mjaReval
    instance of Reval

    mr

    MJAReval mr

    rgd

    RgenDemo rgd
    R demo code generator

    nAnalyses

    int nAnalyses
    The total number of analyses in the RLO database

    nDemoAnalyses

    int nDemoAnalyses
    The number of "Demo" analyses in the RLO database. Demo analyses use the generated .R script options specified by genRbits.

    clientName

    java.lang.String clientName
    Name of the client

    clientPrefixName

    java.lang.String clientPrefixName
    Prefix Name of the client

    clientPrjPath

    private java.lang.String clientPrjPath
    Client current project path. This path will hold the Temp/ and Report/ directories. E.g., "../MAE" startup for MAExplorer client

    clientBrowserTitle

    private java.lang.String clientBrowserTitle
    Client current browser title for this database

    clientDatabase

    private java.lang.String clientDatabase
    Client current database

    javaHome

    java.lang.String javaHome

    osName

    java.lang.String osName

    fileSep

    java.lang.String fileSep

    userDir

    java.lang.String userDir

    isWindowsFlag

    boolean isWindowsFlag
    Flag set if running on a Windows computer

    dbugFlag

    boolean dbugFlag
    Flag set debugging - toggled by dbugbox if DBUG_FLAG is set

    guiReadyFlag

    private boolean guiReadyFlag
    set if GUI is ready for action!

    showDemoRLOsFlag

    private boolean showDemoRLOsFlag
    Flag show Demo RLOs in menu - toggled by showDemoRLOsCheckbox

    appendTextFlag

    private boolean appendTextFlag
    Flag for append text and resetting cursor to end of TextArea

    preferredHeight

    private int preferredHeight
    preferred height size of frame

    preferredWidth

    private int preferredWidth
    preferred width size of frame

    nRows

    private int nRows
    # of rows size of text area for reporting

    nCols

    private int nCols
    # of columns size of text area for reporting

    spaces

    java.lang.String spaces
    Spaces

    saveReportAsTextFileFlag

    private boolean saveReportAsTextFileFlag
    Flag enabled if doing "SaveAs"

    titleFont

    java.awt.Font titleFont
    fonts for labeling full image title etc.

    msgFont

    java.awt.Font msgFont
    fonts for labeling subtitle for each panel in image

    topPanel

    private java.awt.Panel topPanel
    top panel holding the buttonPanel and the msgTA TextField

    inputPanel

    private java.awt.Panel inputPanel
    input panel to hold scriptChoice

    buttonPanel

    private java.awt.Panel buttonPanel
    button control panel

    saveAllDemoRLOsButton

    private java.awt.Button saveAllDemoRLOsButton
    Save All Demo RLOs button if "Show Demo RLOs" is set. This generates all RLO/DemoRscript*.rlo and R/DemoRscript*.R files for later use by Client next time it starts up.

    evalButton

    private java.awt.Button evalButton
    "Evaluate" window button

    showPlotsButton

    private java.awt.Button showPlotsButton
    "Show generated plot(s)" window button

    showRscriptButton

    private java.awt.Button showRscriptButton
    "Show R script" current R script button

    clearReportButton

    private java.awt.Button clearReportButton
    "Clear report" to clear the text area

    saveasButton

    private java.awt.Button saveasButton
    "SaveAs" window button

    closeButton

    private java.awt.Button closeButton
    "Close" window button

    newRLOButton

    private java.awt.Button newRLOButton
    "New RLO" to create new RLO

    editRLOButton

    private java.awt.Button editRLOButton
    "Edit RLO" to edit existing RLO

    showRLOButton

    private java.awt.Button showRLOButton
    "Show RLO" window button

    deleteRLOButton

    private java.awt.Button deleteRLOButton
    "Delete RLO" window button

    helpButton

    private java.awt.Button helpButton
    "Help Msg" window button

    showDemoRLOsCheckbox

    private java.awt.Checkbox showDemoRLOsCheckbox
    Show Demo RLOs checkbox toggles showDemoRLOsFlag. This controls the entries in the scriptChoice list.

    dbugCheckbox

    private java.awt.Checkbox dbugCheckbox
    dbug checkbox toggles output being appended to reportText window

    msgTF

    private java.awt.TextField msgTF
    Text message report line

    msgColor

    private java.awt.Color msgColor
    Text message foreground color that may be changed

    msgBkgrd

    private java.awt.Color msgBkgrd
    Text message background color that may be changed

    dataTF

    private java.awt.TextField dataTF
    Text data report line

    dataColor

    private java.awt.Color dataColor
    Text data report foreground color that may be changed

    dataBkgrd

    private java.awt.Color dataBkgrd
    Text data report background color that may be changed

    inputTF

    private java.awt.TextField inputTF
    Text input data line

    reportTextArea

    private java.awt.TextArea reportTextArea
    Text area to draw reportText that is returned from performing the eval of the .R script

    reportText

    java.lang.String reportText
    text for TextArea

    helpMsg

    private java.lang.String helpMsg
    Help text

    scriptChoice

    private java.awt.Choice scriptChoice
    Choice to select an R script to use from analysis[0:nAnalyses-1]. The current script is in curAnalysis

    pe

    private PopupEditRscript pe
    Constructor Detail

    RtestBase

    public RtestBase(MJAReval mjaReval,
                     java.lang.String clientName,
                     java.lang.String clientPrefixName,
                     java.lang.String clientPrjPath,
                     java.lang.String clientBrowserTitle,
                     java.lang.String clientDatabase)
    RtestBase() - Constructor
    Parameters:
    mjaReval - is the Reval API
    clientName - is the string name of the client program
    clientPrefixName - for the client
    clientPrjPath - path of the client's project directory
    clientBrowserTitle - to place a top of the window
    clientDatabase - name of the database
    Method Detail

    initRtest

    public boolean initRtest(Rtest rt)
    initRtest() - initialize the Rtest popup and create the GUI
    Parameters:
    rt - is the Rtest instance
    Returns:
    true if succeed
    See Also:
    initializeDataAndGUI(), showData(java.lang.String, java.awt.Color, java.awt.Color), showGuiMsg(java.lang.String, java.awt.Color, java.awt.Color)

    getPreferredSize

    public java.awt.Dimension getPreferredSize()
    getPreferredSize() - get the preferred size
    Overrides:
    getPreferredSize in class java.awt.Container
    Returns:
    preferred size of window

    initializeDataAndGUI

    private boolean initializeDataAndGUI()
    initializeDataAndGUI() - build the GUI, then repaint to build the initial display.
    See Also:
    appendReport(java.lang.String, boolean), buildGUI(), #setupAllBasePaths, showGuiMsg(java.lang.String, java.awt.Color, java.awt.Color), #setupProcessCheckboxesStates, #setupClientDemoRLOdb, MJAReval.getListofRLOmenuNames(), MJAReval.getNbrAnalyses(), MJAReval.setupAllBasePaths(java.lang.String), PopupEditRscript.setupGenRcheckboxesStates()

    buildGUI

    private boolean buildGUI()
    buildGUI() - build the graphical user interface
    Returns:
    true if suceed
    See Also:
    PopupEditRscript

    rebuildScriptChoices

    void rebuildScriptChoices()
    rebuildScriptChoices() - rebuild the R script choices pull-down menu from the menuNames[] data. This should be called whenever the menuNames[] is changed.

    drawReportText

    private void drawReportText(java.awt.Graphics g)
    drawReportText() - repaint report.
    See Also:
    saveTextReport(java.lang.String)

    paint

    public void paint(java.awt.Graphics g)
    paint() - repaint full scrolled text area.
    Overrides:
    paint in class java.awt.Container
    See Also:
    drawReportText(java.awt.Graphics)

    update

    public void update(java.awt.Graphics g)
    update() - update window
    Overrides:
    update in class java.awt.Container

    appendReport

    void appendReport(java.lang.String msg,
                      boolean appendToRptFlag)
    appendReport() - add text to report text area
    Parameters:
    msg - to be printed
    appendToRptFlag - to append msg to reportText as well

    showGuiMsg

    void showGuiMsg(java.lang.String msg,
                    java.awt.Color fgColor,
                    java.awt.Color bgColor)
    showGuiMsg() - draw text in GUI message line

    showData

    void showData(java.lang.String data,
                  java.awt.Color fgColor,
                  java.awt.Color bgColor)
    showData() - draw data in GUI data line

    showCurrentRplots

    private void showCurrentRplots()
    showCurrentRplots() - show plots generated if any with last R eval. If there were not plots generated with the last Eval, then it is a no-op. Just say so in the msg area
    See Also:
    MJAReval#getCurrentRLO, MJAReval.getOutputDataFileNames(), MJAReval.getOutputDataTypes(), MJAReval.getReportBasePath(), MJAUtil#displayPDF, MJAUtil#displayURL, appendReport(java.lang.String, boolean), showGuiMsg(java.lang.String, java.awt.Color, java.awt.Color)

    saveTextReport

    private void saveTextReport(java.lang.String textFileName)
    saveTextReport() - Saves reportText to file
    See Also:
    MJAreport.writeTextToFile(java.lang.String, java.lang.String), showGuiMsg(java.lang.String, java.awt.Color, java.awt.Color)

    handleEvent

    public boolean handleEvent(java.awt.Event evt)
    handleEvent() - process special events
    Overrides:
    handleEvent in class java.awt.Component

    actionPerformed

    public void actionPerformed(java.awt.event.ActionEvent e)
    actionPerformed() - Handle Control panel button clicks
    Specified by:
    actionPerformed in interface java.awt.event.ActionListener
    See Also:
    MJAReval.getCurrentRLOid(), MJAReval.getInputRscriptFileName(), MJAReval.getRscriptBasePath(), MJAReval.runRscriptWithR(), MJAutil.cvtSpacesToUnderscores(java.lang.String), MJAreport#readTextToFile, PopupEditRscript.editRLO(int), PopupEditRscript.newRLO(), appendReport(java.lang.String, boolean), saveTextReport(java.lang.String), showCurrentRplots(), showGuiMsg(java.lang.String, java.awt.Color, java.awt.Color)

    itemStateChanged

    public void itemStateChanged(java.awt.event.ItemEvent e)
    itemStateChanged() - handle item state changed eventsms.
    Specified by:
    itemStateChanged in interface java.awt.event.ItemListener
    Parameters:
    e - is ItemEvent
    See Also:
    MJAReval.clearProcessBit(int), MJAReval.getListofRLOmenuNames(), MJAReval.setProcessBit(int), MJAReval.setCurrentRLO(int), PopupEditRscript.resetEditRLObuttons(boolean), PopupEditRscript.changeWizardMenuMode(boolean), PopupEditRscript.setupGenRcheckboxesStates(), PopupEditRscript.setupProcessCheckboxesStates()

    windowClosing

    public void windowClosing(java.awt.event.WindowEvent e)
    windowClosing() - close down the window.
    Specified by:
    windowClosing in interface java.awt.event.WindowListener

    windowOpened

    public void windowOpened(java.awt.event.WindowEvent e)
    Specified by:
    windowOpened in interface java.awt.event.WindowListener

    windowActivated

    public void windowActivated(java.awt.event.WindowEvent e)
    Specified by:
    windowActivated in interface java.awt.event.WindowListener

    windowClosed

    public void windowClosed(java.awt.event.WindowEvent e)
    Specified by:
    windowClosed in interface java.awt.event.WindowListener

    windowDeactivated

    public void windowDeactivated(java.awt.event.WindowEvent e)
    Specified by:
    windowDeactivated in interface java.awt.event.WindowListener

    windowDeiconified

    public void windowDeiconified(java.awt.event.WindowEvent e)
    Specified by:
    windowDeiconified in interface java.awt.event.WindowListener

    windowIconified

    public void windowIconified(java.awt.event.WindowEvent e)
    Specified by:
    windowIconified in interface java.awt.event.WindowListener

    updateCurGene

    public void updateCurGene(int mid)
    updateCurGene() - update any data since current gene has changed. This is invoked from the PopupRegistry.
    [NOTE] could do re-eval of the .R script if there is a gene dependence.
    Parameters:
    mid - is the MID (Master Gene ID) that is the new current gene.

    updateFilter

    public void updateFilter()
    updateFilter() - update any dependent data since Filter has changed. This is invoked from the PopupRegistry.
    [NOTE] could do re-eval of .R script if there is a Filter dependence.

    updateSlider

    public void updateSlider()
    updateSlider() - update any dependent data sincea threshold slider has changed. This is invoked from the PopupRegistry.
    [NOTE] could do re-eval of .R script if there is a slider dependence.

    updateLabels

    public void updateLabels()
    updateLabels() - update any dependent data since global labels have changed. This is invoked from the PopupRegistry.
    [NOTE] could do re-eval of the .R script if there is a data label (i.e. class names, X, Y, E, condition, OCL names) dependence.

    close

    public void close(int exitCode)
    close() - exit with specified exit code.

    genPrologue

    java.lang.String genPrologue()
    genPrologue() - generate prologue R script to read data commands. Generate the Rscript. It calls genClientReaderPrologue() to generate the code.
    Returns:
    Rscript if OK, else null. Then sMsg contains error message
    See Also:
    #genClientReaderPrologue

    genEpilogue

    java.lang.String genEpilogue()
    genEpilogue() - generate epilogue R script to write data commands to put R created data into Temp/ folder for reading by MAExplorer when required by actions in the RLO specification.

    If tabDelimReportFile exists and an objAction is specified, then it will write out the following R object with write.table().

    It calls genClientEpilogue() to generate the code.

    Returns:
    Rscript if OK, else null. Then sMsg contains error message
    See Also:
    #genClientEpilogue

    extractUserRscript

    public java.lang.String extractUserRscript(java.lang.String completeRscript)
    extractUserRscript() - extract user R script from center of complete.
     R script. It is defined as the code between
       PROLOGUE_END
     and
       EPILOGUE_START
    
    If no template code is there, just return what is there.
    Parameters:
    completeRscript - is complete R script with (prologue, userRscript,epilogue)
    Returns:
    user R script from complete R script

    getUseGenRbit

    int getUseGenRbit(int genRmethod)
    getUseGenRbit() - lookup the use R_GENR_xxxx bit specified by method
    Parameters:
    genRmethod - to lookup
    Returns:
    useGenR bit

    showMsg

    abstract void showMsg(java.lang.String msg)
    showMsg() - display message in client GUI
    Parameters:
    msg - message to display

    readTextFromFile

    abstract java.lang.String readTextFromFile(java.lang.String fileName,
                                               java.lang.String loadingMsg)
    readTextFromFile() - read text from text file.
    Parameters:
    fileName - full path name of text file
    loadingMsg - to display while loading, null if no message
    Returns:
    text if suceed else null

    writeTextToFile

    abstract boolean writeTextToFile(java.lang.String textFileName,
                                     java.lang.String textReport)
    writeTextToFile() - save text string as text file.
    Parameters:
    textFileName - full path name of text file
    textReport - text to save in file
    Returns:
    true if succeed.

    popupAlertMsg

    abstract void popupAlertMsg(java.lang.String title,
                                java.lang.String msg,
                                int nRows,
                                int nCols)
    popupAlertMsg() - popup alert message in a scrollable text area. Press close to continue. If the auto popdown is set (Edit menu | Preferences submenut) then popdown the window after a timeout else it requires manually pressing the Close button.
    Parameters:
    title - is the optional title for the popup window
    msg - is the message for the popup window
    nRows - is the # of rows for the popup window, 20 if specify 0
    nCols - is the # of columns for the popup window, 80 if specify 0

    displayURL

    abstract void displayURL(java.lang.String urlStr)
    displayURL() - Display URL file in system Web browser, for use in stand-alone mode. This assumes that you have added the proper plugin to your browser for this data if required.
     Examples:
     displayURL("http://www.javaworld.com")
     displayURL("file://c:\\docs\\index.html")
     displayURL("file:///user/joe/index.html");
     displayURL("file:///user/joe/image.xml");
     displayURL("file:///user/joe/iimage.svg");
    
    Under Unix, the system browser is hard-coded to be 'netscape'. Netscape must be in your PATH for this to work.
    Under Windows, this will bring up the default browser under windows, usually either Netscape or Microsoft IE. The default browser is determined by the OS. adapted from : http://www.javaworld.com/javaworld/javatips/jw-javatip66_p.html NOTE: param url the file's url(the url must start with either "http://" or"file://").
    Parameters:
    urlStr - to display in popup browser
    Returns:
    false if error.

    displayPDF

    abstract void displayPDF(java.lang.String pdfFile)
    displayPDF() - Display PDF file in adobe, for use in stand-alone. Under Unix, the system browser is hard-coded to be 'Acrobat'. Acrobat must be in your PATH for this to work. Under Windows, this will bring up Acrobat (if installed). adapted from : http://www.javaworld.com/javaworld/javatips/jw-javatip66_p.html
    Parameters:
    pdfFile - file to display in Adobe Acrobat
    Returns:
    false if error.

    cvtSpacesToUnderscores

    abstract java.lang.String cvtSpacesToUnderscores(java.lang.String str)
    cvtSpacesToUnderscores() - replace spaces and other illegal file name characters with '_' chars to make file names highly portable.
    : space( ) ; " { } < > = , ? \ / % * ! @ & | ' ` \t
    Parameters:
    str - to be converted
    Returns:
    converted string

    rmvRtnChars

    abstract java.lang.String rmvRtnChars(java.lang.String str)
    rmvRtnChars() - remove return chars. Map '\r' or "\r\n" to '\n' chars.
    Parameters:
    String - str to process
    Returns:
    String with '\r' removed.

    getListOfMenuStubNames

    abstract java.lang.String[] getListOfMenuStubNames()
    getListOfMenuStubNames() - get list of menu stub names
    Returns:
    list of Menu Stub Names