Seg2Dgel
Class Sg2reportPopup

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 Seg2Dgel.Sg2reportPopup
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 Sg2reportPopup
extends java.awt.Frame
implements java.awt.event.ItemListener, java.awt.event.ActionListener, java.awt.event.WindowListener

Class Sg2reportPopup 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.

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/23 12:44:55 $ $Revision: 1.25 $
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  Seg2Dgel 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
(package private)  java.awt.MenuBar mbar
          menu bar for the frame
(package private) static java.awt.CheckboxMenuItem miVMaddHistCB
          "Add histogram to Image Viewer" checkbox
 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
 java.awt.Menu quantifyMenu
          "Quantify" pull down Menu list
 boolean reanalyzeFlag
          pressed sog.
private  java.lang.String reportFile
           
private  java.awt.Button resegmentButton
          button for "Segment" button
(package private)  java.lang.String savedMsg
          message after Saved Txt into file
(package private) static long serialVersionUID
          frame id
 boolean setNewDefaultFlag
          pressed sog.
private  java.awt.Button showImagesButton
          button for "Image viewer" button
 boolean showStatusFlag
           
 Sg2showImage sig
          popup Image viewer GUI
 PopupOptions sog
          popup options GUI
private  java.awt.Label statusLineLabel
          Status line label
 boolean stopFlag
           
private  java.awt.Button stopSegmentationButton
          stop segmenting button only active if segmenting
 boolean[] swOptCBvalue
          The swOptcCBvalue[0:nData-1] is used by the Sg2reportPopup that in turn may call Sg2optionsPopup.
 java.lang.String[] swOptData
          The swOptData[0:(3*nData)-1] is used by the Sg2reportPopup that in turn may call Sg2optionsPopup.
 java.lang.String[] swOptValue
          The swOptValue[0:nData-1] is used by the Sg2reportPopup that in turn may call Sg2optionsPopup.
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
Sg2reportPopup(Seg2Dgel cs, java.lang.String programName, java.lang.String textReport, int nRows, int nCols, java.lang.String title, java.lang.String reportFile, boolean showStatusFlag)
          Sg2reportPopup() - 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()
          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 segmentation" 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 positionReportWindow()
          positionReportWindow() - position report window on the screen
 void quit()
          quit() - closing down the window, get rid of the frame.
 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 Sg2OptionsPopup 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 Seg2Dgel 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


quantifyMenu

public java.awt.Menu quantifyMenu
"Quantify" pull down Menu list


helpMenu

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


ms

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


miVMaddHistCB

static java.awt.CheckboxMenuItem miVMaddHistCB
"Add histogram to Image Viewer" checkbox


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


resegmentButton

private java.awt.Button resegmentButton
button for "Segment" button


showImagesButton

private java.awt.Button showImagesButton
button for "Image viewer" button


stopSegmentationButton

private java.awt.Button stopSegmentationButton
stop segmenting button only active if segmenting


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 Sg2reportPopup that in turn may call Sg2optionsPopup. 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 Sg2reportPopup that in turn may call Sg2optionsPopup. 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 Sg2reportPopup that in turn may call Sg2optionsPopup. It contains String values of associated switch data.


sig

public Sg2showImage sig
popup Image viewer 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

Sg2reportPopup

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

Parameters:
sg2 - 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 "Seg2Dprot-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

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 segmentation" 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()
cleanKillApplication() - close the file if needed and do a clean kill of the application


showPopupOptionWindow

private boolean showPopupOptionWindow(java.lang.String poTitle)
showPopupOptionWindow() - popup options window using the Sg2OptionsPopup 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 Sg2reportPopup 
        that in turn may call Sg2optionsPopup. 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 Sg2reportPopup 
        that in turn may call Sg2optionsPopup. It contains boolean values
        of switch data use for Checkboxes.
 cs.switchOptValue[0:nData-1] is used by the Sg2reportPopup 
        that in turn may call Sg2optionsPopup. 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 oFile if it was 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