tnt.gui
Class ParametersDialog

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Dialog
                  extended by javax.swing.JDialog
                      extended by tnt.gui.ParametersDialog
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class ParametersDialog
extends javax.swing.JDialog
implements java.awt.event.ActionListener, java.awt.event.WindowListener

This dialog allows the user to set metric parameters. Note that this dialog presents and stores timing values in milliseconds, while ModelDefinition objects store timing values in seconds.

Version:
1.0 - 02/2006, 1.1 - 06/2006 (Added the default MHP timing category "Zero", which results in a performance prediction based on the traditional model.)
Author:
Steven J. Castellucci
See Also:
ModelDefinition, Workspace, Serialized Form

Nested Class Summary
(package private)  class ParametersDialog.WholeNumberVerifier
          Verifies that inputs are whole numbers.
 
Nested classes/interfaces inherited from class javax.swing.JDialog
javax.swing.JDialog.AccessibleJDialog
 
Nested classes/interfaces inherited from class java.awt.Dialog
java.awt.Dialog.AccessibleAWTDialog
 
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
protected  javax.swing.JButton browseButton
          The button that, when activated, allows the user to browse for a word-frequency file.
protected  javax.swing.JButton cancelButton
          The button that, when activated, reverts the dialog's values and hides it.
protected  javax.swing.JComboBox catComboBox
          The combo box that presents MHP categories.
protected static int EXP
          The constant used to index the expert MHP category.
protected static java.lang.String FIELD_CARD
          The name given to the panel displaying custom MHP values.
protected static int FIELD_WIDTH
          The column width of text fields.
protected  javax.swing.JFileChooser fileChooser
           
protected  javax.swing.JTextField filePathField
          The text field used to display the word-frequency file path.
protected static int H_GAP
          The magnitude of horizontal space between components.
protected static java.lang.String LABEL_CARD
          The name given to the panel displaying preset MHP values.
protected  javax.swing.JTextField leftIntField
          The (Integer-formatted) text field used to display and input the left intercept.
protected  javax.swing.JTextField leftSlopeField
          The text field used to display and input the left slope.
protected  java.lang.String[] mhp_categories
          The selectable MHP categories.
protected  java.awt.CardLayout mhpCardLayout
          A reference to the CardLayout in the MHP panel.
protected  int[][] mhpTimings
          An array of MHP timings, indexed by [category][timing].
protected  javax.swing.JPanel mhpValuesPanel
          A reference to the panel organizing MHP values -- required to manipulate its CardLayout.
protected static int NOV
          The constant used to index the novice MHP category.
protected  javax.swing.JButton okButton
          The button that, when activated, commits the dialog's values and hides it.
protected  javax.swing.JTextField rightIntField
          The text field used to display and input the right intercept.
protected  javax.swing.JTextField rightSlopeField
          The text field used to display and input the right slope.
protected static int T_C
          The constant used to index tC timings.
protected static int T_E
          The constant used to index tE timings.
protected static int T_M
          The constant used to index tM timings.
protected static int T_P
          The constant used to index tP timings.
protected static int T_S
          The constant used to index tS timings.
protected  javax.swing.JTextField tCCustom
          The text field used to display and input the custom tC value.
protected  javax.swing.JLabel tCPreset
          The label used to display preset tC timings
protected  javax.swing.JTextField tECustom
          The text field used to display and input the custom tE value.
protected  javax.swing.JLabel tEPreset
          The label used to display preset tE timings
protected  javax.swing.JTextField tMCustom
          The text field used to display and input the custom tM value.
protected  javax.swing.JTextField tMinField
          The text field used to display and input the tmin value.
protected  javax.swing.JLabel tMPreset
          The label used to display preset tM timings
protected  javax.swing.JTextField tPCustom
          The text field used to display and input the custom tP value.
protected  javax.swing.JLabel tPPreset
          The label used to display preset tP timings
protected  javax.swing.JTextField tSCustom
          The text field used to display and input the custom tS value.
protected  javax.swing.JLabel tSPreset
          The label used to display preset tS timings
protected static int TYP
          The constant used to index the typical MHP category.
protected static int US1
          The constant used to index the custom (User-Specified) MHP category.
protected static int V_GAP
          The magnitude of vertical space between components.
protected  boolean validInputs
          A flag to indicate whether or not all the inputs are valid.
protected static int ZRO
          The constant used to index the zero MHP category (i.e., disables MHP timings).
 
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ParametersDialog(java.awt.Frame owner)
          Initializes this modal dialog with default Workspace values.
ParametersDialog(java.awt.Frame owner, Workspace w)
          Initializes this dialog with value from the passed Workspace object.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent ae)
           
protected  void cancelAction()
          Reverts values and hides this dialog.
protected  javax.swing.JPanel createButtonPanel()
          Creates the layout to display "OK" and "Cancel" buttons.
protected  javax.swing.JPanel createFilePanel()
          Creates the layout to display and specify the word-frequency file path.
protected  javax.swing.JPanel createFittsPanel()
          Creates the layout to display and specify Fitts' Law coefficient.
protected  javax.swing.JPanel createMHPPanel()
          Creates the layout to display and specify MHP timings.
 java.lang.String getWordFreqFile()
          Returns a String representing the path to the word-frequency file.
protected  void iniFileChooser()
          Initializes the file chooser.
protected  void iniMHPTimings()
          Initializes preset MHP timings.
 void loadFromWorkspace(Workspace w)
          Loads parameter values from the passed object.
 boolean okPressed()
          Returns true iff the user closed this dialog by pressing the "OK" button.
 ModelDefinition saveToModelDefinition(ModelDefinition m)
          Saves applicable data values to a ModelDefinition object.
 Workspace saveToWorkspace(Workspace w)
          Saves applicable data values to a Workspace object.
 void setVisible(boolean b)
           
 void windowActivated(java.awt.event.WindowEvent we)
           
 void windowClosed(java.awt.event.WindowEvent we)
           
 void windowClosing(java.awt.event.WindowEvent we)
           
 void windowDeactivated(java.awt.event.WindowEvent we)
           
 void windowDeiconified(java.awt.event.WindowEvent we)
           
 void windowIconified(java.awt.event.WindowEvent we)
           
 void windowOpened(java.awt.event.WindowEvent we)
           
 
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Dialog
addNotify, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setResizable, setTitle, setUndecorated, show
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, finalize, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, 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, remove, 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, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

H_GAP

protected static final int H_GAP
The magnitude of horizontal space between components.

See Also:
Constant Field Values

V_GAP

protected static final int V_GAP
The magnitude of vertical space between components.

See Also:
Constant Field Values

FIELD_WIDTH

protected static final int FIELD_WIDTH
The column width of text fields.

See Also:
Constant Field Values

LABEL_CARD

protected static final java.lang.String LABEL_CARD
The name given to the panel displaying preset MHP values. Used when manipulating the CardLayout in the MHP timing panel.

See Also:
Constant Field Values

FIELD_CARD

protected static final java.lang.String FIELD_CARD
The name given to the panel displaying custom MHP values. Used when manipulating the CardLayout in the MHP timing panel.

See Also:
Constant Field Values

ZRO

protected static final int ZRO
The constant used to index the zero MHP category (i.e., disables MHP timings).

See Also:
Constant Field Values

EXP

protected static final int EXP
The constant used to index the expert MHP category.

See Also:
Constant Field Values

TYP

protected static final int TYP
The constant used to index the typical MHP category.

See Also:
Constant Field Values

NOV

protected static final int NOV
The constant used to index the novice MHP category.

See Also:
Constant Field Values

US1

protected static final int US1
The constant used to index the custom (User-Specified) MHP category.

See Also:
Constant Field Values

T_E

protected static final int T_E
The constant used to index tE timings.

See Also:
Constant Field Values

T_P

protected static final int T_P
The constant used to index tP timings.

See Also:
Constant Field Values

T_M

protected static final int T_M
The constant used to index tM timings.

See Also:
Constant Field Values

T_C

protected static final int T_C
The constant used to index tC timings.

See Also:
Constant Field Values

T_S

protected static final int T_S
The constant used to index tS timings.

See Also:
Constant Field Values

validInputs

protected boolean validInputs
A flag to indicate whether or not all the inputs are valid.


mhpCardLayout

protected java.awt.CardLayout mhpCardLayout
A reference to the CardLayout in the MHP panel.


mhp_categories

protected java.lang.String[] mhp_categories
The selectable MHP categories.


mhpTimings

protected int[][] mhpTimings
An array of MHP timings, indexed by [category][timing].


browseButton

protected javax.swing.JButton browseButton
The button that, when activated, allows the user to browse for a word-frequency file.


cancelButton

protected javax.swing.JButton cancelButton
The button that, when activated, reverts the dialog's values and hides it.


okButton

protected javax.swing.JButton okButton
The button that, when activated, commits the dialog's values and hides it.


catComboBox

protected javax.swing.JComboBox catComboBox
The combo box that presents MHP categories.


fileChooser

protected javax.swing.JFileChooser fileChooser

tEPreset

protected javax.swing.JLabel tEPreset
The label used to display preset tE timings


tPPreset

protected javax.swing.JLabel tPPreset
The label used to display preset tP timings


tMPreset

protected javax.swing.JLabel tMPreset
The label used to display preset tM timings


tCPreset

protected javax.swing.JLabel tCPreset
The label used to display preset tC timings


tSPreset

protected javax.swing.JLabel tSPreset
The label used to display preset tS timings


mhpValuesPanel

protected javax.swing.JPanel mhpValuesPanel
A reference to the panel organizing MHP values -- required to manipulate its CardLayout.


filePathField

protected javax.swing.JTextField filePathField
The text field used to display the word-frequency file path.


leftIntField

protected javax.swing.JTextField leftIntField
The (Integer-formatted) text field used to display and input the left intercept.


leftSlopeField

protected javax.swing.JTextField leftSlopeField
The text field used to display and input the left slope.


rightIntField

protected javax.swing.JTextField rightIntField
The text field used to display and input the right intercept.


rightSlopeField

protected javax.swing.JTextField rightSlopeField
The text field used to display and input the right slope.


tMinField

protected javax.swing.JTextField tMinField
The text field used to display and input the tmin value.


tECustom

protected javax.swing.JTextField tECustom
The text field used to display and input the custom tE value.


tPCustom

protected javax.swing.JTextField tPCustom
The text field used to display and input the custom tP value.


tMCustom

protected javax.swing.JTextField tMCustom
The text field used to display and input the custom tM value.


tCCustom

protected javax.swing.JTextField tCCustom
The text field used to display and input the custom tC value.


tSCustom

protected javax.swing.JTextField tSCustom
The text field used to display and input the custom tS value.

Constructor Detail

ParametersDialog

public ParametersDialog(java.awt.Frame owner)
Initializes this modal dialog with default Workspace values.

Parameters:
owner - this dialog's parent frame.

ParametersDialog

public ParametersDialog(java.awt.Frame owner,
                        Workspace w)
Initializes this dialog with value from the passed Workspace object.

Parameters:
owner - this dialog's parent frame.
w - the Workspace whose values should be used.
Method Detail

iniMHPTimings

protected void iniMHPTimings()
Initializes preset MHP timings. When overriding this method, use the following excerpt as a guide:
                mhp_categories[EXP] = "Expert";
                mhp_categories[TYP] = "Typical";
                mhp_categories[NOV] = "Novice";
                mhp_categories[US1] = "Custom";

                mhpTimings[EXP][T_E] = 70;
                mhpTimings[EXP][T_P] = 50;
                mhpTimings[EXP][T_M] = 30;
                mhpTimings[EXP][T_C] = 25;
                mhpTimings[EXP][T_S] = 36;
                ...
                


iniFileChooser

protected void iniFileChooser()
Initializes the file chooser. Sets the initial directory to be the one specified in the workspace (if valid) and sets the file filter appropriately


createFilePanel

protected javax.swing.JPanel createFilePanel()
Creates the layout to display and specify the word-frequency file path.


createFittsPanel

protected javax.swing.JPanel createFittsPanel()
Creates the layout to display and specify Fitts' Law coefficient.


createMHPPanel

protected javax.swing.JPanel createMHPPanel()
Creates the layout to display and specify MHP timings.


createButtonPanel

protected javax.swing.JPanel createButtonPanel()
Creates the layout to display "OK" and "Cancel" buttons.


cancelAction

protected void cancelAction()
Reverts values and hides this dialog.


getWordFreqFile

public java.lang.String getWordFreqFile()
Returns a String representing the path to the word-frequency file.

Returns:
the path to the word-frequency file.

okPressed

public boolean okPressed()
Returns true iff the user closed this dialog by pressing the "OK" button.

Returns:
true iff the user pressed the "OK" button.

saveToModelDefinition

public ModelDefinition saveToModelDefinition(ModelDefinition m)
Saves applicable data values to a ModelDefinition object. Note that this dialog presents and stores timing values in milliseconds, while ModelDefinition objects store timing values in seconds.

Parameters:
m - the ModelDefinition object to which to save applicable data values.
Returns:
a ModelDefinition object with the saved data.
See Also:
ModelDefinition

loadFromWorkspace

public void loadFromWorkspace(Workspace w)
Loads parameter values from the passed object.

Parameters:
w - the Workspace whose values should be used.

saveToWorkspace

public Workspace saveToWorkspace(Workspace w)
Saves applicable data values to a Workspace object.

Parameters:
w - the Workspace object to which to save applicable data values.
Returns:
a Workspace object with the saved data.

setVisible

public void setVisible(boolean b)
Overrides:
setVisible in class java.awt.Component

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ae)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

windowActivated

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

windowClosed

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

windowClosing

public void windowClosing(java.awt.event.WindowEvent we)
Specified by:
windowClosing in interface java.awt.event.WindowListener

windowDeactivated

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

windowDeiconified

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

windowIconified

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

windowOpened

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


Copyright © 2006 Steven Castellucci and Scott MacKenzie. All Rights Reserved.