IcanGui
Class GuiIcanDataImpact

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

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

Encapsulate the behavior of GUI for ICAN/JAVA data entry of Impact data.

Since:
1.0;
Version:
1.1.14;
Updated by Louis Handler on Dec 19, 2006, 10:50 EST (1.1.14).
Updated by Louis Handler on Dec 28, 2005, 07:50 EST (1.1.6).
Updated by Louis Handler on Jun 8, 2005, 10:25 EDT (1.1.5).
Updated by Louis Handler on Dec 1, 2004, 11:32 EST (1.0.10).
Updated by Louis Handler on Dec 8, 2003, 14:36 EST.
Updated by Louis Handler on Sep 24, 2003, 10:04 EDT.
Updated by Louis Handler on Sep 24, 2003, 10:02 EDT.
Updated by Louis Handler on Sep 24, 2003, 10:01 EDT.
Updated by Louis Handler on Sep 24, 2003, 10:00 EDT.
Updated by Louis Handler on Sep 24, 2003, 08:30 EDT.
Updated by Louis Handler on Sep 24, 2003, 08:27 EDT.
Updated by Louis Handler on Sep 23, 2003, 16:00 EDT.
Updated by Louis Handler on Dec 4, 2002, 15:57 EST.
Updated by Louis Handler on Dec 4, 2002, 15:23 EST.
Updated by Louis Handler on Aug 27, 2002, 10:01 EDT.
Updated by Louis Handler on Dec 18, 2000, 14:30 EST.
Updated by Louis Handler on May 16, 2000, 08:07 EDT.
Updated by Louis Handler on Mar 28, 2000, 12:47 EST.
Updated by Louis Handler on Feb 22, 2000, 14:58 EST.
Updated by Louis Handler on Nov 16, 1999, 15:26 EST.
Updated by Louis Handler on Mar 19, 1999, 14:57 EST.
Updated by Louis Handler on Dec 1, 1998, 14:49 EST.
Updated by Louis Handler on Nov 23, 1998, 10:34 EST.
Updated by Louis Handler on Nov 6, 1998, 08:13 EST.
Updated by Louis Handler on Aug 28, 1998, 14:41 EDT.
Updated by Louis Handler on Aug 14, 1998, 15:21 EDT.
Updated by Matthew Der on Jul 13, 1998.
Updated by Louis Handler on Jul 6, 1998.
Updated by Louis Handler on Jul 2, 1998.
Updated by Louis Handler on Jul 2, 1998.
Author:
Louis Handler
See Also:
GuiWindow

Nested Class Summary
(package private)  class GuiIcanDataImpact.Madapter
          Mouse Adapter Inner Class
 
Field Summary
private static java.lang.String[] buttonLabels
          Labels to display on action buttons.
private  java.awt.Button[] buttons
          Action buttons.
private  IcanDataSet data
          ICAN/JAVA data set.
private  double[] dblImpactVar
          Values in Impact data table.
private static double EPSD
          Small number used to test the relative difference between two numbers.
private static java.lang.String[][] fieldTitles
          Titles for both Labels and TextFields in Impact data table.
private  boolean firstRun
          Variable to test for the first time the frame is displayed.
private  java.awt.GridBagConstraints gbc
          GridBag Layout constraints.
private  java.awt.GridBagLayout gbl
          GridBag Layout manager.
private static double HALF
          The number one half.
private static int iAccept
          Accept Button will verify the data and complete the processing of Impact data.
private static int iCancel
          Cancel Button will exit this screen discarding any data entered.
private static int iClear
          Clear Button will clear data entry fields.
private static int iCompute
          Compute Button will verify the data and display the missing Impact data item.
private static int iExit
          Exit Button will exit the entire program.
private  int iFocus
          Index of Focus
private static int iHelp
          Help Button will display a set of information.
private  int iLbl
          Counter/subscript for adding individual Labels into lblData[iLbl] array.
private  java.awt.TextField[] impactVar
          TextFields in which to enter Impact data.
private static int iPlot
          Plot Button will display a set of information.
private  java.awt.Label[] lblData
          Array of Labels, saved for removal later.
private static int locImpactD
          Subscript of Impact projectile diameter.
private static int locImpactF
          Subscript of Impact projectile initial velocities.
private static int locImpactM
          Subscript of Impact projectile initial mass.
private static int locImpactR
          Subscript of Impact projectile density.
private static int locImpactV
          Subscript of Impact projectile initial velocities.
private static int maxLbl
          Size to initialize lblData[maxLbl] to.
private  GuiIcanDataImpact.Madapter myMadapter
          Mouse Adapter to handle mouse entering window for the first time and right clicks.
private static int nButtons
          Number of action buttons.
private static int[] nextDown
          Array of indexes used to get to the next component.
private static int[] nextLeft
          Array of indexes used to get to the next component.
private static int[] nextRight
          Array of indexes used to get to the next component.
private static int[] nextUp
          Array of indexes used to get to the next component.
private static int nImpactVar
          Number of different kinds of Impact variables in user's Impact data table.
private static double ONE
          The number one.
private  java.awt.Panel panelFrame
          The Panel that contains the data to be displayed within a scrolling frame.
private  java.awt.Panel panelUser
          Panel containing user's Impact data table.
private  java.awt.Component saveCompFocus
          Component to set focus to.
private  java.awt.ScrollPane scrollFrame
          The scrolling frame in which the data is displayed.
private  java.awt.Label theTitle
          Label containing the description/title of the ICAN/JAVA run.
 
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
GuiIcanDataImpact()
          Constructor creates window to display buttons and text entry fields.
 
Method Summary
private  boolean acceptImpact(boolean testAll)
          Check whether Impact data is valid.
 void actionPerformed(java.awt.event.ActionEvent evt)
          Detect Action Events and process accordingly.
private  void addIcanDataUser()
          Add a set of Impact input data per ply.
 void changeGuiUnits()
          Change units on GUI for this class.
private  void fillInData()
          Fill in any missing data when 2 out of three are given: diameter, density, and mass.
 void focusGained(java.awt.event.FocusEvent evt)
          Find The TextField with Focus if Focus Is Gained
 void focusLost(java.awt.event.FocusEvent evt)
          Does Nothing
private  double getDiameter()
          Get diameter from data, either directly from the input field or computed from the density and the mass.
private  ImpactDataItem getImpactData()
          Get Impact data.
 java.lang.String getMaterial(int iPly)
          Get materials used in this ply.
 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.
protected  void initMe()
          Create window to display buttons and text entry fields.
 void keyPressed(java.awt.event.KeyEvent evt)
          Does Nothing
 void keyReleased(java.awt.event.KeyEvent evt)
          Process Key Release to detect the arrow Keys
 void keyTyped(java.awt.event.KeyEvent evt)
          Does Nothing
private  void PlotImpactSnapshot()
          Plot snapshot of impact projectile and laminate, at initial impact, showing the plies.
 void presetData()
          Set title and other ICAN/JAVA data.
 void remove()
          Dispose of any components required before disposing of parent.
private  void saveData()
          Save Impact data.
private  void setClearData()
          Clear text data entry fields.
 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

data

private IcanDataSet data
ICAN/JAVA data set.


panelUser

private java.awt.Panel panelUser
Panel containing user's Impact data table.


gbl

private java.awt.GridBagLayout gbl
GridBag Layout manager.


gbc

private java.awt.GridBagConstraints gbc
GridBag Layout constraints.


theTitle

private java.awt.Label theTitle
Label containing the description/title of the ICAN/JAVA run.


fieldTitles

private static final java.lang.String[][] fieldTitles
Titles for both Labels and TextFields in Impact data table.


nImpactVar

private static final int nImpactVar
Number of different kinds of Impact variables in user's Impact data table.


locImpactD

private static final int locImpactD
Subscript of Impact projectile diameter.

See Also:
Constant Field Values

locImpactR

private static final int locImpactR
Subscript of Impact projectile density.

See Also:
Constant Field Values

locImpactM

private static final int locImpactM
Subscript of Impact projectile initial mass.

See Also:
Constant Field Values

locImpactF

private static final int locImpactF
Subscript of Impact projectile initial velocities.

See Also:
Constant Field Values

locImpactV

private static final int locImpactV
Subscript of Impact projectile initial velocities.

See Also:
Constant Field Values

dblImpactVar

private double[] dblImpactVar
Values in Impact data table. The Impact data is comprised of projectile: diameter, density or mass, friction, and initial velocities.


impactVar

private java.awt.TextField[] impactVar
TextFields in which to enter Impact data. The Impact data is comprised of projectile: diameter, density or mass, and initial velocities.


maxLbl

private static final int maxLbl
Size to initialize lblData[maxLbl] to.


lblData

private java.awt.Label[] lblData
Array of Labels, saved for removal later.


iLbl

private int iLbl
Counter/subscript for adding individual Labels into lblData[iLbl] array.


iAccept

private static final int iAccept
Accept Button will verify the data and complete the processing of Impact data.

See Also:
Constant Field Values

iCompute

private static final int iCompute
Compute Button will verify the data and display the missing Impact data item. The missing item must be one of: diameter, density, or mass.

See Also:
Constant Field Values

iCancel

private static final int iCancel
Cancel Button will exit this screen discarding any data entered.

See Also:
Constant Field Values

iClear

private static final int iClear
Clear Button will clear data entry fields.

See Also:
Constant Field Values

iExit

private static final int iExit
Exit Button will exit the entire program. To exit just this screen, see Accept or Cancel.

See Also:
Constant Field Values

iHelp

private static final int iHelp
Help Button will display a set of information.

See Also:
Constant Field Values

iPlot

private static final int iPlot
Plot Button will display a set of information.

See Also:
Constant Field Values

buttonLabels

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


nButtons

private static final int nButtons
Number of action buttons.


buttons

private java.awt.Button[] buttons
Action buttons.


scrollFrame

private java.awt.ScrollPane scrollFrame
The scrolling frame in which the data is displayed.


panelFrame

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


myMadapter

private GuiIcanDataImpact.Madapter myMadapter
Mouse Adapter to handle mouse entering window for the first time and right clicks.


saveCompFocus

private java.awt.Component saveCompFocus
Component to set focus to.


iFocus

private int iFocus
Index of Focus


nextRight

private static final int[] nextRight
Array of indexes used to get to the next component. The index of the next component is the value of the array with the index of the current component as a subscript.


nextLeft

private static final int[] nextLeft
Array of indexes used to get to the next component. The index of the next component is the value of the array with the index of the current component as a subscript.


nextDown

private static final int[] nextDown
Array of indexes used to get to the next component. The index of the next component is the value of the array with the index of the current component as a subscript.


nextUp

private static final int[] nextUp
Array of indexes used to get to the next component. The index of the next component is the value of the array with the index of the current component as a subscript.


firstRun

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


EPSD

private static final double EPSD
Small number used to test the relative difference between two numbers. If the relative difference between two numbers is less than this constant, the numbers are considered to be the same, differing only by round-off.

See Also:
Constant Field Values

HALF

private static final double HALF
The number one half.

See Also:
Constant Field Values

ONE

private static final double ONE
The number one.

See Also:
Constant Field Values
Constructor Detail

GuiIcanDataImpact

public GuiIcanDataImpact()
Constructor creates window to display buttons and text entry fields.

Method Detail

initMe

protected void initMe()
Create window to display buttons and text entry fields.

Specified by:
initMe in class GuiWindow

addIcanDataUser

private void addIcanDataUser()
Add a set of Impact input data per ply.


remove

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


actionPerformed

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

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

keyPressed

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

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)
Process Key Release to detect the arrow Keys

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

focusGained

public void focusGained(java.awt.event.FocusEvent evt)
Find The TextField with Focus if Focus Is Gained

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.

setClearData

private void setClearData()
Clear text data entry fields.


presetData

public void presetData()
Set title and other ICAN/JAVA data. If ICAN/JAVA data initialized, use it to initialize the Impact inputs.

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.

getImpactData

private ImpactDataItem getImpactData()
Get Impact data.

Returns:
Impact data.

saveData

private void saveData()
Save Impact data.


acceptImpact

private boolean acceptImpact(boolean testAll)
Check whether Impact data is valid.

Parameters:
testAll - True, if all data must be entered; else, false, if velocity is ignored.
Returns:
True, if Impact data is valid; else, false.

fillInData

private void fillInData()
Fill in any missing data when 2 out of three are given: diameter, density, and mass.


getDiameter

private double getDiameter()
Get diameter from data, either directly from the input field or computed from the density and the mass.


PlotImpactSnapshot

private void PlotImpactSnapshot()
Plot snapshot of impact projectile and laminate, at initial impact, showing the plies.


getMaterial

public java.lang.String getMaterial(int iPly)
Get materials used in this ply. Concatenate primary and secondary if both exist. Separate fiber or particle material code from matrix or binder or interphase material code with a slash.

Parameters:
iPly - Ply subscript.
Returns:
Material used in the specified ply.

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.