IcanGui
Class GuiMsgData

java.lang.Object
  extended by IcanGui.GuiHierarchy
      extended by IcanGui.GuiWindow
          extended by IcanGui.GuiMsgData
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.FocusListener, java.awt.event.KeyListener, java.util.EventListener

public class GuiMsgData
extends GuiWindow
implements java.awt.event.ActionListener, java.awt.event.KeyListener, java.awt.event.FocusListener

Display error, warning, and informational messages from the Output class one screen-full at a time.

Since:
1.0;
Version:
1.1.14;
Updated by Louis Handler on Jan 4, 2007, 07:50 EST (1.1.14).
Updated by Louis Handler on Dec 29, 2005, 11:43 EST (1.1.6).
Updated by Louis Handler on Jul 18, 2005, 08:47 EDT (1.1.5).
Updated by Louis Handler on Mar 25, 2005, 10:36 EST (1.1.0).
Updated by Louis Handler on Nov 10, 2004, 10:23 EST (1.0.10).
Updated by Louis Handler on Oct 25, 2004, 14:53 EDT (1.0.8).
Updated by Louis Handler on Apr 26, 2004, 15:25 EDT (1.0.6).
Updated by Louis Handler on Apr 12, 2004, 08:26 EDT.
Updated by Louis Handler on Feb 10, 2004, 10:52 EST.
Updated by Louis Handler on Jan 23, 2004, 11:37 EST.
Updated by Louis Handler on Sep 26, 2003, 11:43 EDT.
Updated by Louis Handler on Sep 26, 2003, 11:25 EDT.
Updated by Louis Handler on Sep 26, 2003, 11:01 EDT.
Updated by Louis Handler on Sep 26, 2003, 10:03 EDT.
Updated by Louis Handler on Sep 26, 2003, 09:41 EDT.
Updated by Louis Handler on Sep 26, 2003, 09:39 EDT.
Updated by Louis Handler on Sep 26, 2003, 09:29 EDT.
Updated by Louis Handler on Sep 25, 2003, 16:04 EDT.
Updated by Louis Handler on Sep 24, 2003, 12:47 EDT.
Updated by Louis Handler on Oct 7, 2002, 15:11 EDT.
Updated by Louis Handler on Aug 27, 2002, 10:35 EDT.
Updated by Louis Handler on Aug 27, 2002, 09:56 EDT.
Updated by Louis Handler on Aug 26, 2002, 10:29 EDT.
Updated by Louis Handler on Jul 27, 2000, 13:55 EDT.
Updated by Louis Handler on Mar 28, 2000, 13:37 EST.
Updated by Louis Handler on Mar 13, 2000, 14:12 EST.
Updated by Louis Handler on Feb 22, 2000, 15:20 EST.
Updated by Louis Handler on Dec 3, 1999, 09:08 EST.
Updated by Louis Handler on Jan 4, 1999, 08:50 EST.
Updated by Louis Handler on Dec 1, 1998, 09:26 EST.
Updated by Louis Handler on Nov 23, 1998, 10:42 EST.
Updated by Louis Handler on Oct 27, 1998, 14:37 EST.
Updated by Louis Handler on Aug 18, 1998, 08:00 EDT.
Updated by Matthew Der on Jun 24, 1998.
Updated by Matthew Der on Jun 24, 1998.
Updated by Louis Handler on Jun 18, 1998.
Author:
Louis Handler
See Also:
GuiWindow

Nested Class Summary
(package private)  class GuiMsgData.Madapter
          Mouse Adapter Inner Class
(package private)  class GuiMsgData.SliderAdjustmentListener
          Slider adjustment listener Inner Class
 
Field Summary
private static java.lang.String[] buttonLabels
          Labels to display on action buttons.
private  java.awt.Button[] buttons
          Array of action Buttons used to perform ICAN/JAVA processing.
private  java.awt.Font displayFont
          The font for this display contains constant-width characters, not the normally used font.
private  Output dout
          The Output used to contain the data.
private  boolean duringSelectStart
          Switch to distinguish between a click to set a location and a click to set a selected area.
private static int endCount
          Number of retries before warning about trying to go farther than either end of the data.
private  boolean firstRun
          Variable to test for the first time the frame is displayed.
private static int iCancel
          Button to close this window and continue with ICAN/JAVA processing.
private static int iExit
          Button to exit the ICAN/JAVA program.
private static int iHelp
          Button to display help screen.
private  int[] includeLine
          Line numbers in original data to include.
private  int indLine
          Display ending line number + 1.
private static int iPrintAll
          Button to display a print dialog to print all the data.
private static int iPrintScr
          Button to display a print dialog to print the current window.
private static int iPrintSel
          Button to display a print dialog to print the selected data.
private static int iSave
          Button to display a save dialog to save the data to a file.
private static int iSearch
          Button to display a search dialog to find and highlight the given string.
private  int istLine
          Display starting line number.
private static int iswMenu
          Subscript of "Select Start" in sMenu and miMenu to switch to "Select End".
private  int[] lengths
          Cumulative length to beginning of each line.
private  int[] levels
          Pointer to current menu in level from which sublevel begins.
private  int lineOff
          Line at which mouse is released or shift-click.
private  int lineOn
          Line at which mouse is pressed.
private  int linesPer
          Number of lines per screenful of data.
private  int maxCol
          Length of longest line.
private static int maxCount
          Maximum number of retries before warning about trying to go farther than either end of the data.
private static int maxLevels
          Maximum number of levels in menu structure.
private  int maxPixelCharHeight
          Height of each character in pixels.
private  int maxPixelLineLength
          Length of longest line in Pixels.
private  java.awt.MenuItem[] miMenu
          Array of menu items created from the table of menu string items.
private  java.awt.Menu[] mMenu
          Array of menus created from the table of menu string items.
private  java.awt.TextArea msgArea
          This is the TextArea that contains the output data.
private static int nButtons
          Number of action Buttons/Labels.
private  int nLines
          Number of lines available for display.
private static int nMenuItem
          Number of items in the table of menu string items.
private static int nShortcutKey
          Number of shortcut keys; i.e., the number of alphabetic characters on the standard English keyboard.
private  java.awt.Panel panelFrame
          The Panel, that contains the TextArea, that contains the output data to be displayed within a scrolling frame.
private  int posnOff
          Position within line at which mouse is released or shift-click.
private  int posnOn
          Position within line at which mouse is pressed.
private  java.awt.Component saveCompFocus
          Current component.
private  java.awt.ScrollPane scrollFrame
          This is the ScrollPane, that contains the Panel, that contains the TextArea, that contains the output data.
private static int[] shortcutKey
          Shortcut keys for corresponding letters (alphabetic characters).
private static java.lang.String[] shortcutKeyAlpha
          Letters (alphabetic characters) in table for shortcut keys.
private  java.awt.Scrollbar sliderEast
          This is the Scrollbar that may be used to manage the TextArea.
private  java.awt.Scrollbar sliderWest
          This is the Scrollbar that may be used to manage the TextArea.
private static java.lang.String[][] sMenu
          Array of Strings to be used as Labels for Menu.
private static int svCol
          Column within line svLine at which the search string was found.
private static int svLine
          Line number of the line in which the search string was found.
private static int svSrchCount
          Search string counter.
private static java.lang.String svStr
          Search string.
private static java.awt.Toolkit tkit
          Use the default Toolkit to access Font metrics.
private  boolean turnOn
          An area of text has been selected and may be used to print selection.
private  IcanWait wait
          Instance of wait screen used to show/remove in different methods.
 
Fields inherited from class IcanGui.GuiWindow
frameTitle, whatAmI, windowFrame
 
Fields inherited from class IcanGui.GuiHierarchy
IDO_ICAN_DATA, IDO_ICAN_DATA_BOOLEANS, IDO_ICAN_DATA_DAMPING, IDO_ICAN_DATA_IMPACT, IDO_ICAN_DATA_LOADS, IDO_ICAN_DATA_MATERIAL, IDO_ICAN_DATA_OUTPUTS, IDO_ICAN_DATA_PLOT_IMPACT, IDO_ICAN_DATA_PLOTPL, IDO_ICAN_DATA_PLY, IDO_ICAN_DATA_PROCESS, IDO_ICAN_DATA_REACTION, IDO_ICAN_DATA_SLICE, IDO_ICAN_DATA_SLICE_TABLE, IDO_ICAN_DATA_VVI, IDO_ICAN_DATA_VVR, IDO_ICAN_ELECTRICAL_CYCLIC_LOADS, IDO_ICAN_ELECTRICAL_STATIC_LOADS, IDO_ICAN_EXPERT, IDO_ICAN_HYGRAL_CYCLIC_LOADS, IDO_ICAN_HYGRAL_STATIC_LOADS, IDO_ICAN_MECH_CYCLIC_LOADS, IDO_ICAN_MECH_STATIC_DISPLACEMENTS, IDO_ICAN_MECH_STATIC_LOADS, IDO_ICAN_MORE_LOADS, IDO_ICAN_PROMPT, IDO_ICAN_RATE_LOADS, IDO_ICAN_THERMAL_CYCLIC_LOADS, IDO_ICAN_THERMAL_STATIC_LOADS, IDO_MAIN, IDO_MDB_DATA_MFIM, IDO_MDB_DATA_START, IDO_MDB_PROMPT, IDO_MSG_DATA, NDO
 
Constructor Summary
GuiMsgData()
          Constructor creates window to display text area containing messages.
GuiMsgData(boolean noWindow)
          Constructor measures data for printing or saving.
GuiMsgData(boolean noWindow, Output dout)
          Constructor measures data for printing or saving.
GuiMsgData(java.lang.String startString)
          Constructor creates window to display text area containing messages but just after a line containing a series of dollar signs and the given character string.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent evt)
          Detect Action Events and process them accordingly
 void adjustLine(int dLine)
          Adjust TextArea for line-up or line-down.
 void adjustPage(int nPages)
          Adjust TextArea for page-up or page-down.
 void changeGuiUnits()
          Change units on GUI for this class.
 void checkRange()
          Check range for viewable lines and adjust if necessary.
private  void clearMsgData()
          Clear messages from display area.
private  void displayMsgData()
          Display message data from dout, lines istLine up to indLine.
 void focusGained(java.awt.event.FocusEvent evt)
          Listens for Events when a component gains focus.
 void focusLost(java.awt.event.FocusEvent evt)
          Does Nothing.
 java.lang.String getName()
          Get class name.
 void helpMe()
          Display help message.
 void helpMe(java.awt.Component target)
          Display help message for a specified component.
private  void highlightSelectedText()
          Highlight selected text, if visible.
protected  void initMe()
          Create window containing text area to display messages.
 void keyPressed(java.awt.event.KeyEvent evt)
          Makes sure that arrow keys are not processed twice.
 void keyReleased(java.awt.event.KeyEvent evt)
          Detects when the following keys are released Tab, up arrow, down arrow, enter, shift+tab, alt+right, alt+left, F1
 void keyTyped(java.awt.event.KeyEvent evt)
          Does Nothing
 boolean measureLines()
          Measure data to display.
private  boolean measureLines(java.lang.String startString)
          Measure data to display starting with the given string.
 void paintMe(java.awt.PrintJob job)
          Paint text to Graphics area for printing.
 void presetData()
          Set title and other ICAN/JAVA data.
private  void printAll()
          Print contents of TextArea.
private  void printSelection()
          Print selected contents of TextArea.
 void remove()
          Dispose of any components required before disposing of parent.
 void saveMe(IcanFrame windowFrameX)
          Save contents of TextArea to a file.
 void searchAny()
          Search the data on the screen for the next occurrence of a given character string.
private  void searchForString()
          Search the data on the screen for the next occurrence of a given character string.
private  void searchMe()
          Obtain the search string to search the data on the screen for the next occurrence of a given character string.
 void setCompFocus()
          Set focus to some component.
 void setCompFocus(java.awt.Component cFocus)
          Set focus in current class/frame.
 
Methods inherited from class IcanGui.GuiWindow
addGB, askExit, askQuestion, showMessageInfo
 
Methods inherited from class IcanGui.GuiHierarchy
changeAllGuiUnits, exitGui, getCurrent, getFrame, getFrame, getGuiWindowClass, getGuiWindowClass, hideMe, initHierarchy, setCurrent, setNextUp, showMe
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dout

private Output dout
The Output used to contain the data.


scrollFrame

private java.awt.ScrollPane scrollFrame
This is the ScrollPane, that contains the Panel, that contains the TextArea, that contains the output data.


panelFrame

private java.awt.Panel panelFrame
The Panel, that contains the TextArea, that contains the output data to be displayed within a scrolling frame.


msgArea

private java.awt.TextArea msgArea
This is the TextArea that contains the output data.


sliderWest

private java.awt.Scrollbar sliderWest
This is the Scrollbar that may be used to manage the TextArea. This slider appears on the left of the TextArea containing the output.

See Also:
msgArea

sliderEast

private java.awt.Scrollbar sliderEast
This is the Scrollbar that may be used to manage the TextArea. This slider appears on the right of the TextArea containing the output.

See Also:
msgArea

sMenu

private static final java.lang.String[][] sMenu
Array of Strings to be used as Labels for Menu.
1. Text of menu or menu item.
2. Type of menu in menubar.
3. "M" for menu, "H" for help menu (must be at top level), "I" for menu item, "-" for separator, "." for end of menu items in this menu.
4. Shortcut key, if used; else, "-".


nMenuItem

private static final int nMenuItem
Number of items in the table of menu string items.


iswMenu

private static int iswMenu
Subscript of "Select Start" in sMenu and miMenu to switch to "Select End". Subscript in sMenu and mimenu whose contents is "Select Start" initially and after "Select End" is chosen. Subscript in sMenu and mimenu whose contents is "Select End" after "Select Start" is chosen.


duringSelectStart

private boolean duringSelectStart
Switch to distinguish between a click to set a location and a click to set a selected area. True, if "Select Start" has been clicked and the next mouse click completes the selection of the area.


miMenu

private java.awt.MenuItem[] miMenu
Array of menu items created from the table of menu string items.

See Also:
sMenu

shortcutKeyAlpha

private static final java.lang.String[] shortcutKeyAlpha
Letters (alphabetic characters) in table for shortcut keys. Key used is combination of control (Ctrl) key and the letter indicated.

See Also:
shortcutKey

shortcutKey

private static final int[] shortcutKey
Shortcut keys for corresponding letters (alphabetic characters). Key used is combination of control (Ctrl) key and the letter indicated.

See Also:
shortcutKeyAlpha

nShortcutKey

private static final int nShortcutKey
Number of shortcut keys; i.e., the number of alphabetic characters on the standard English keyboard.


maxLevels

private static final int maxLevels
Maximum number of levels in menu structure.

See Also:
Constant Field Values

levels

private int[] levels
Pointer to current menu in level from which sublevel begins. Menu items are associated with this menu. This is used only within initMe() and could be moved down into initMe().


mMenu

private java.awt.Menu[] mMenu
Array of menus created from the table of menu string items.

See Also:
sMenu

buttonLabels

private static final java.lang.String[] buttonLabels
Labels to display on action buttons.


nButtons

private static final int nButtons
Number of action Buttons/Labels.


buttons

private java.awt.Button[] buttons
Array of action Buttons used to perform ICAN/JAVA processing.


iCancel

private static final int iCancel
Button to close this window and continue with ICAN/JAVA processing.

See Also:
Constant Field Values

iExit

private static final int iExit
Button to exit the ICAN/JAVA program.

See Also:
Constant Field Values

iHelp

private static final int iHelp
Button to display help screen.

See Also:
Constant Field Values

iPrintScr

private static final int iPrintScr
Button to display a print dialog to print the current window.

See Also:
Constant Field Values

iPrintSel

private static final int iPrintSel
Button to display a print dialog to print the selected data.

See Also:
Constant Field Values

iPrintAll

private static final int iPrintAll
Button to display a print dialog to print all the data.

See Also:
Constant Field Values

iSave

private static final int iSave
Button to display a save dialog to save the data to a file.

See Also:
Constant Field Values

iSearch

private static final int iSearch
Button to display a search dialog to find and highlight the given string.

See Also:
Constant Field Values

displayFont

private java.awt.Font displayFont
The font for this display contains constant-width characters, not the normally used font.


tkit

private static java.awt.Toolkit tkit
Use the default Toolkit to access Font metrics.


maxCol

private int maxCol
Length of longest line.


linesPer

private int linesPer
Number of lines per screenful of data.


nLines

private int nLines
Number of lines available for display.


istLine

private int istLine
Display starting line number.


indLine

private int indLine
Display ending line number + 1. Allows looping while the line number is less than this number.


maxPixelLineLength

private int maxPixelLineLength
Length of longest line in Pixels.


maxPixelCharHeight

private int maxPixelCharHeight
Height of each character in pixels.


svLine

private static int svLine
Line number of the line in which the search string was found.


svCol

private static int svCol
Column within line svLine at which the search string was found.


svStr

private static java.lang.String svStr
Search string.


svSrchCount

private static int svSrchCount
Search string counter.


lengths

private int[] lengths
Cumulative length to beginning of each line. Used to compute character at which page starts and ends.


includeLine

private int[] includeLine
Line numbers in original data to include.


turnOn

private boolean turnOn
An area of text has been selected and may be used to print selection.


lineOn

private int lineOn
Line at which mouse is pressed.


posnOn

private int posnOn
Position within line at which mouse is pressed.


lineOff

private int lineOff
Line at which mouse is released or shift-click.


posnOff

private int posnOff
Position within line at which mouse is released or shift-click.


endCount

private static int endCount
Number of retries before warning about trying to go farther than either end of the data. Only occurs after trying maxCount times.

See Also:
maxCount

maxCount

private static final int maxCount
Maximum number of retries before warning about trying to go farther than either end of the data.

See Also:
endCount, Constant Field Values

wait

private IcanWait wait
Instance of wait screen used to show/remove in different methods.


firstRun

private boolean firstRun
Variable to test for the first time the frame is displayed. Used to set focus on entry.


saveCompFocus

private java.awt.Component saveCompFocus
Current component.

Constructor Detail

GuiMsgData

public GuiMsgData()
Constructor creates window to display text area containing messages.


GuiMsgData

public GuiMsgData(java.lang.String startString)
Constructor creates window to display text area containing messages but just after a line containing a series of dollar signs and the given character string.

Parameters:
startString - String at which display starts. Display ends at 20 dollar signs ($).

GuiMsgData

public GuiMsgData(boolean noWindow)
Constructor measures data for printing or saving. Constructor does NOT create window to display text area containing messages.

Parameters:
noWindow - Used for its distinguished signature as well as eliminating the work of setting up some potentially large arrays. True, if omit measuring each line. Used to save all the Output data to a file. False, if measure each line. Used to save part of Output data to a file or displaying the data

GuiMsgData

public GuiMsgData(boolean noWindow,
                  Output dout)
Constructor measures data for printing or saving. Constructor does NOT create window to display text area containing messages.

Parameters:
noWindow - Used for its distinguished signature as well as eliminating the work of setting up some potentially large arrays. True, if omit measuring each line. Used to save all the Output data to a file. False, if measure each line. Used to save part of Output data to a file or displaying the data
dout - Instance of Output: Output.out or Output.err or Output.jrn
Method Detail

initMe

protected void initMe()
Create window containing text area to display messages.

Specified by:
initMe in class GuiWindow

measureLines

public boolean measureLines()
Measure data to display.


measureLines

private boolean measureLines(java.lang.String startString)
Measure data to display starting with the given string. The given string must appear in the data to be displayed, on a line also containing 20 dollor signs.

Parameters:
startString - String at which display starts. Display ends at 20 dollar signs ($).

displayMsgData

private void displayMsgData()
Display message data from dout, lines istLine up to indLine.


clearMsgData

private void clearMsgData()
Clear messages from display area.


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent evt)
Detect Action Events and process them accordingly

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
evt - Action event.

checkRange

public void checkRange()
Check range for viewable lines and adjust if necessary.


keyPressed

public void keyPressed(java.awt.event.KeyEvent evt)
Makes sure that arrow keys are not processed twice.

Specified by:
keyPressed in interface java.awt.event.KeyListener
Parameters:
evt - Key event.

keyTyped

public void keyTyped(java.awt.event.KeyEvent evt)
Does Nothing

Specified by:
keyTyped in interface java.awt.event.KeyListener
Parameters:
evt - Key event.

keyReleased

public void keyReleased(java.awt.event.KeyEvent evt)
Detects when the following keys are released Tab, up arrow, down arrow, enter, shift+tab, alt+right, alt+left, F1

Specified by:
keyReleased in interface java.awt.event.KeyListener
Parameters:
evt - Key event.

focusGained

public void focusGained(java.awt.event.FocusEvent evt)
Listens for Events when a component gains focus.

Specified by:
focusGained in interface java.awt.event.FocusListener
Parameters:
evt - Focus event.

focusLost

public void focusLost(java.awt.event.FocusEvent evt)
Does Nothing.

Specified by:
focusLost in interface java.awt.event.FocusListener
Parameters:
evt - Focus event.

helpMe

public void helpMe()
Display help message.


helpMe

public void helpMe(java.awt.Component target)
Display help message for a specified component.

Specified by:
helpMe in class GuiWindow
Parameters:
target - Component for which help is desired.

presetData

public void presetData()
Set title and other ICAN/JAVA data.

Specified by:
presetData in class GuiWindow

setCompFocus

public void setCompFocus()
Set focus to some component. Normally used when entering this screen after show().

Specified by:
setCompFocus in class GuiHierarchy

setCompFocus

public void setCompFocus(java.awt.Component cFocus)
Set focus in current class/frame.

Specified by:
setCompFocus in class GuiHierarchy
Parameters:
cFocus - Component to save to reset later.

adjustPage

public void adjustPage(int nPages)
Adjust TextArea for page-up or page-down.

Parameters:
nPages - Greater than zero for that many pages down; else, less than zero for that many pages up.

adjustLine

public void adjustLine(int dLine)
Adjust TextArea for line-up or line-down.

Parameters:
dLine - Greater than zero for that many lines down; else, less than zero for that many lines up.

remove

public void remove()
Dispose of any components required before disposing of parent.


printAll

private void printAll()
Print contents of TextArea.


printSelection

private void printSelection()
Print selected contents of TextArea.


paintMe

public void paintMe(java.awt.PrintJob job)
Paint text to Graphics area for printing.

Parameters:
job - Printer context.

saveMe

public void saveMe(IcanFrame windowFrameX)
Save contents of TextArea to a file.

Parameters:
windowFrameX - IcanFrame (Frame) owner required by dialog. This may be called from elsewhere and its IcanFrame must be specified.

searchAny

public void searchAny()
Search the data on the screen for the next occurrence of a given character string. This is used for "search again" using F3.


searchMe

private void searchMe()
Obtain the search string to search the data on the screen for the next occurrence of a given character string. This is used for "new search" or "search again".


searchForString

private void searchForString()
Search the data on the screen for the next occurrence of a given character string. This is used for "new search" or "search again".


highlightSelectedText

private void highlightSelectedText()
Highlight selected text, if visible.


changeGuiUnits

public void changeGuiUnits()
Change units on GUI for this class. Invoked when user changes units.

Specified by:
changeGuiUnits in class GuiWindow

getName

public java.lang.String getName()
Get class name.

Specified by:
getName in class GuiWindow
Returns:
Class name.