Landmark
Class LmsReportPopup

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by Landmark.LmsReportPopup
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.ItemListener, java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

 class LmsReportPopup
extends java.awt.Frame
implements java.awt.event.ItemListener, java.awt.event.ActionListener, java.awt.event.WindowListener

The LmsReportPopup class creates and displays scrollable string text area in a popup window. Various control buttons are also provided at the bottom of the window that are dependent on the type of text area being displayed.

Edited and refactored by Greg Thornwall, SAIC.

This code was derived and refactored other Open2Dprot Java programs and from GELLAB-II landmark C language files "Version November 9, 1999".

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 Open2Dprot Mozilla and Legal files are available on http://open2dprot.sourceforge.net/

Version:
$Date: 2005/10/21 15:43:41 $ $Revision: 1.17 $
Author:
P. Lemkin (LECB/NCI), G. Thornwall (SAIC), Frederick, MD
See Also:
Open2Dprot Home

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 boolean cancelFlag
          pressed sog.
private  Landmark cs
          instance of the main class
 boolean doneFlag
          pressed sog.
 java.awt.Menu editMenu
          "Edit" pull down Menu list
private  java.awt.Button editOptionsButton
          button for "Set startup options" button
 java.awt.Menu fileMenu
          "File" pull down Menu list
 java.awt.Menu helpMenu
          "Help" pull down Menu list
private  java.awt.Button landmarkEditButton
          button for "Landmark" button
 LmsWizardPopup lmsGUI
          popup Landmark Image wizard GUI
(package private)  java.awt.MenuBar mbar
          menu bar for the frame
 MenuSupport ms
          Menu support functions using Hashtables to tack what is active
 java.lang.String[] newArgv
          new switch options
 java.io.FileWriter oFile
          File to flush and close on "Kill program" if it is not null
 java.lang.String poTitle
          popup options title
 boolean reanalyzeFlag
          pressed sog.
private  java.lang.String reportFile
           
 java.awt.Menu rSampleSubmenu
          Dynamic submenu list for "Open Rsample" the value is "OpenRsampleFile:"sample-name'"
 java.awt.Menu sampleSubmenu
          Dynamic submenu list for "Open Sample" the value is "OpenSampleFile:"sample-name'"
(package private)  java.lang.String savedMsg
          message after Saved Txt into file
(package private) static long serialVersionUID
          frame id
 boolean setNewDefaultFlag
          pressed sog.
 boolean showStatusFlag
           
 PopupOptions sog
          popup options GUI
private  java.awt.Label statusLineLabel
          Status line label
 boolean stopFlag
           
 boolean[] swOptCBvalue
          The swOptcCBvalue[0:nData-1] is used by the LmsReportPopup that in turn may call csPopupOptions.
 java.lang.String[] swOptData
          The swOptData[0:(3*nData)-1] is used by the LmsReportPopup that in turn may call PopupOptions.
 java.lang.String[] swOptValue
          The swOptValue[0:nData-1] is used by the LmsReportPopup that in turn may call csPopupOptions.
private  java.awt.TextArea textarea
          Text area GUI for main report
private  int textAreaFontSize
          font size
private  java.lang.String textFontFamily
          Text area font family
private  java.lang.String textReport
          copy of text in textArea
(package private)  java.lang.String title
          string for title of frame
 java.awt.Menu viewMenu
          "View" pull down Menu list
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
LmsReportPopup(Landmark cs)
          LmsReportPopup() - Constructor.
LmsReportPopup(Landmark cs, java.lang.String programName, java.lang.String textReport, int nRows, int nCols, java.lang.String title, java.lang.String reportFile, boolean showStatusFlag)
          LmsReportPopup() - Constructor.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          actionPerformed() - Handle button clicks
private  void addMenuTree(java.awt.Frame f, java.awt.MenuBar mbar)
          addMenuTree() - create pull down menus in menu bar
 void appendTextMsg(java.lang.String newText)
          appendTextMsg() - append text in popup window
 void cleanKillApplication(boolean saveFirstFlag)
          cleanKillApplication() - close the file if needed and do a clean kill of the application
 void clearText()
          clearText() - clear text in popup window
 void close()
          close() - close this popup and reset flags if needed
 java.lang.String getReportText()
          getReportText() - get the text from the Report popup window
 boolean getStopStatus()
          getStopStatus() - get the stop processing flag set by pressing the "Stop processing" button
 void itemStateChanged(java.awt.event.ItemEvent e)
          itemStateChanged() - handle item state changed events NOTE: need to implement radio groups here since AWT only implements radio groups for Checkboxes, and CheckboxMenuItems.
 void popupLmsWizard()
          popupLmsWizard() - popup the landmark wizard GUI.
 void positionReportWindow()
          positionReportWindow() - position report window on the screen
 void quit()
          quit() - closing down the window, get rid of the frame.
 boolean rebuildOpenSampleSubmenus()
          rebuildOpenSampleSubmenus() - rebuild the Open Rsample and Open Sample submenus from entries in the accession database.
 void setEnableButtons(boolean flag)
          setEnableButtons() - by the flag
 void setEnableMenus(boolean flag)
          setEnableMenus() - by the flag
 void setOutFileToCloseOnKill(java.io.FileWriter oFile)
          setOutFileToCloseOnKill() - set the show/hide popup status
 void setSaveAsFile(java.lang.String reportFile)
          setSaveAsFile() - set SaveAs file default file name
 void setShow(boolean showStatusFlag)
          setShow() - set the show/hide popup status
private  boolean showPopupOptionWindow(java.lang.String poTitle)
          showPopupOptionWindow() - popup options window using the csPopupOptions GUI.
 void updateReportStatusLine(java.lang.String msg)
          updateReportStatusLine() - clear text in popup window
 void updateText(java.lang.String newText)
          updateText() - update text in popup window
 void updateTitle(java.lang.String title)
          updateTitle() - update title in popup window
 boolean waitForUserClose()
          waitForUserClose)() wait for user to press "Close" application.
 void windowActivated(java.awt.event.WindowEvent e)
           
 void windowClosed(java.awt.event.WindowEvent e)
           
 void windowClosing(java.awt.event.WindowEvent e)
          windowClosing() - closing down the window, get rid of the frame.
 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)
           
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getAccessibleContext, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, paramString, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, 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, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

serialVersionUID

static final long serialVersionUID
frame id

See Also:
Constant Field Values

cs

private Landmark cs
instance of the main class


title

java.lang.String title
string for title of frame


mbar

java.awt.MenuBar mbar
menu bar for the frame


fileMenu

public java.awt.Menu fileMenu
"File" pull down Menu list


editMenu

public java.awt.Menu editMenu
"Edit" pull down Menu list


viewMenu

public java.awt.Menu viewMenu
"View" pull down Menu list


helpMenu

public java.awt.Menu helpMenu
"Help" pull down Menu list


rSampleSubmenu

public java.awt.Menu rSampleSubmenu
Dynamic submenu list for "Open Rsample" the value is "OpenRsampleFile:"sample-name'"


sampleSubmenu

public java.awt.Menu sampleSubmenu
Dynamic submenu list for "Open Sample" the value is "OpenSampleFile:"sample-name'"


ms

public MenuSupport ms
Menu support functions using Hashtables to tack what is active


savedMsg

java.lang.String savedMsg
message after Saved Txt into file


textReport

private java.lang.String textReport
copy of text in textArea


reportFile

private java.lang.String reportFile

textarea

private java.awt.TextArea textarea
Text area GUI for main report


textAreaFontSize

private int textAreaFontSize
font size


textFontFamily

private java.lang.String textFontFamily
Text area font family


editOptionsButton

private java.awt.Button editOptionsButton
button for "Set startup options" button


landmarkEditButton

private java.awt.Button landmarkEditButton
button for "Landmark" button


statusLineLabel

private java.awt.Label statusLineLabel
Status line label


showStatusFlag

public boolean showStatusFlag

stopFlag

public boolean stopFlag

oFile

public java.io.FileWriter oFile
File to flush and close on "Kill program" if it is not null


sog

public PopupOptions sog
popup options GUI


newArgv

public java.lang.String[] newArgv
new switch options


poTitle

public java.lang.String poTitle
popup options title


swOptData

public java.lang.String[] swOptData
The swOptData[0:(3*nData)-1] is used by the LmsReportPopup that in turn may call PopupOptions. It contains triples of (prompt,user, helpStr) data. If the prompt data has a "-", then make a CheckBox, else it is a Label with the prompt data. If it is a CheckBox, use default value false if it starts with "-no" else true. The 2nd arg of the pair is the user data. If the user data is not null, then make a TextField with this user data on the right else make an empty Label.


swOptCBvalue

public boolean[] swOptCBvalue
The swOptcCBvalue[0:nData-1] is used by the LmsReportPopup that in turn may call csPopupOptions. It contains boolean values of switch data use for Checkboxes.


swOptValue

public java.lang.String[] swOptValue
The swOptValue[0:nData-1] is used by the LmsReportPopup that in turn may call csPopupOptions. It contains String values of associated switch data.


lmsGUI

public LmsWizardPopup lmsGUI
popup Landmark Image wizard GUI


setNewDefaultFlag

public boolean setNewDefaultFlag
pressed sog. "Set new default"


reanalyzeFlag

public boolean reanalyzeFlag
pressed sog. "Reanalyze"


doneFlag

public boolean doneFlag
pressed sog. "Done"


cancelFlag

public boolean cancelFlag
pressed sog. "Cancel"

Constructor Detail

LmsReportPopup

public LmsReportPopup(Landmark cs)
LmsReportPopup() - Constructor. placeholder instance

Parameters:
cs - is an instance of the main class

LmsReportPopup

public LmsReportPopup(Landmark cs,
                      java.lang.String programName,
                      java.lang.String textReport,
                      int nRows,
                      int nCols,
                      java.lang.String title,
                      java.lang.String reportFile,
                      boolean showStatusFlag)
LmsReportPopup() - Constructor. Display Report Window control panel GUI.

Parameters:
cs - is an instance of the main class
programName - name of the program
textReport - is initial text string for buffer.
nRows - is maximum size of window
nCols, - is maximum size of window
title - of the window
String - reportFile is default SAVE AS .txt file.Default "Landmark-Report.txt"
showStatusFlag - to show (true), hide(false).
Method Detail

addMenuTree

private void addMenuTree(java.awt.Frame f,
                         java.awt.MenuBar mbar)
addMenuTree() - create pull down menus in menu bar

Parameters:
f - is frame
mbar - is MenuBar

setEnableButtons

public void setEnableButtons(boolean flag)
setEnableButtons() - by the flag

Parameters:
flag - to set enable buttons

setEnableMenus

public void setEnableMenus(boolean flag)
setEnableMenus() - by the flag

Parameters:
flag - to set enable menus

rebuildOpenSampleSubmenus

public boolean rebuildOpenSampleSubmenus()
rebuildOpenSampleSubmenus() - rebuild the Open Rsample and Open Sample submenus from entries in the accession database. Dynamic submenu list for "Open Rsample" the value is "OpenRsampleFile:"sample-name'" Dynamic submenu list for "Open Sample" the value is "OpenSampleFile:"sample-name'"

Parameters:
true - if suceed

positionReportWindow

public void positionReportWindow()
positionReportWindow() - position report window on the screen


setOutFileToCloseOnKill

public void setOutFileToCloseOnKill(java.io.FileWriter oFile)
setOutFileToCloseOnKill() - set the show/hide popup status

Parameters:
oFile - to flush and close if use Kill command.

setShow

public void setShow(boolean showStatusFlag)
setShow() - set the show/hide popup status

Parameters:
showStatusFlag - to show (true), hide(false).

getStopStatus

public boolean getStopStatus()
getStopStatus() - get the stop processing flag set by pressing the "Stop processing" button

Returns:
true if "Stop" button had been pressed.

updateReportStatusLine

public void updateReportStatusLine(java.lang.String msg)
updateReportStatusLine() - clear text in popup window

Parameters:
msg - to display

clearText

public void clearText()
clearText() - clear text in popup window


getReportText

public java.lang.String getReportText()
getReportText() - get the text from the Report popup window

Returns:
text report

updateText

public void updateText(java.lang.String newText)
updateText() - update text in popup window

Parameters:
newText - is string to copy into text window

appendTextMsg

public void appendTextMsg(java.lang.String newText)
appendTextMsg() - append text in popup window

Parameters:
newText - is string to append into text window

updateTitle

public void updateTitle(java.lang.String title)
updateTitle() - update title in popup window

Parameters:
title - is new title.

setSaveAsFile

public void setSaveAsFile(java.lang.String reportFile)
setSaveAsFile() - set SaveAs file default file name

Parameters:
title - is new title.

close

public void close()
close() - close this popup and reset flags if needed


cleanKillApplication

public void cleanKillApplication(boolean saveFirstFlag)
cleanKillApplication() - close the file if needed and do a clean kill of the application

Parameters:
saveFirstFlag - to save any open first first.

showPopupOptionWindow

private boolean showPopupOptionWindow(java.lang.String poTitle)
showPopupOptionWindow() - popup options window using the csPopupOptions GUI.
 This uses a new instance of the data contained in data created
 by cs.ini.initSwitchOptionsData(). The data is:

  cs.switchOptData[0:(3*nData)-1] is used by the LmsReportPopup 
        that in turn may call csPopupOptions. It contains triples of 
        (optionPrompt, guiBuilderSpec, helpStr) data. If the prompt 
        data has a "-", then make a CheckBox (swOptcCBvalue), 
        else it is a Label with the prompt data. 
        If the user data is not null, then make a TextField with 
        this user (swOptValue) data on the right else make an empty 
        Label.
 cs.switchOptCBvalue[0:nData-1] is used by the LmsReportPopup 
        that in turn may call csPopupOptions. It contains boolean values
        of switch data use for Checkboxes.
 cs.switchOptValue[0:nData-1] is used by the LmsReportPopup 
        that in turn may call csPopupOptions. It contains String 
        text values of associated switch data arguments.

Parameters:
poTitle - for popup options GUI
Returns:
true if open the window.

waitForUserClose

public boolean waitForUserClose()
waitForUserClose)() wait for user to press "Close" application. Close databases if any were still open.

Returns:
true if continue with the application

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed() - Handle button clicks

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - is action evet

quit

public void quit()
quit() - closing down the window, get rid of the frame.

See Also:
close()

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent e)
itemStateChanged() - handle item state changed events NOTE: need to implement radio groups here since AWT only implements radio groups for Checkboxes, and CheckboxMenuItems.

Specified by:
itemStateChanged in interface java.awt.event.ItemListener
Parameters:
e - is ItemEvent

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
windowClosing() - closing down the window, get rid of the frame.

Specified by:
windowClosing in interface java.awt.event.WindowListener
Parameters:
e - is window closing event
See Also:
close()

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

popupLmsWizard

public void popupLmsWizard()
popupLmsWizard() - popup the landmark wizard GUI.