|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
tnt.gui.TnTFrame
tnt.gui.TnTImp
class TnTImp
This class defines the majority of the business logic related to the TnToolkit's GUI.
Nested Class Summary | |
---|---|
(package private) class |
TnTImp.ColorEdit
This class encapsulates an undoable change in color. |
(package private) class |
TnTImp.DeleteKeyEdit
This class encapsulates an undoable key deletion. |
(package private) class |
TnTImp.EditMappingEdit
This class encapsulates an undoable key-letter mapping. |
(package private) class |
TnTImp.MoveResizeKeyEdit
This class encapsulates an undoable key relocation or resize. |
(package private) class |
TnTImp.NewKeyEdit
This class encapsulates an undoable key creation. |
Nested classes/interfaces inherited from class tnt.gui.TnTFrame |
---|
TnTFrame.InfoPanel |
Nested classes/interfaces inherited from class javax.swing.JFrame |
---|
javax.swing.JFrame.AccessibleJFrame |
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 | |
---|---|
protected java.awt.Color |
color
The current color used to display key-button outlines on the canvas. |
protected boolean |
fileModified
A flag to indicate modifications since the last save. |
protected java.lang.String |
imageFileName
The path to the image file used in the current workspace. |
protected KeyLetterDialog |
mapping
The dialog used for key-letter mapping. |
protected ModelDefinition |
modelDef
The ModelDefinition object used to store model data. |
protected javax.swing.JFileChooser |
openFileChooser
The file chooser used for opening. |
protected ParametersDialog |
parameters
The dialog used setting metric parameters. |
protected javax.swing.JFileChooser |
saveFileChooser
The file chooser used for saving. |
protected KeyButton |
selected
The currently selected key-button, null if none. |
protected javax.swing.undo.UndoManager |
undoManager
The undo manager. |
protected Workspace |
workspace
The Workspace object used to store state data. |
protected java.io.File |
workspaceFile
A reference to the workspace file on disk. |
Fields inherited from class javax.swing.JFrame |
---|
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled |
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 javax.swing.WindowConstants |
---|
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
TnTImp()
|
Method Summary | |
---|---|
protected void |
aboutAction()
Defines action(s) to take upon selection of the "About" menu item. |
protected void |
addKeyAction(java.awt.geom.Rectangle2D.Double keyBounds)
Presents the user with a key-letter mapping dialog and creates a new KeyButton object with the selected letters and the passed
rectangular bounds. |
protected void |
calculateAction()
Displays a message dialog if any letters are not mapped. |
protected void |
clearWorkspace()
Reinitializes the workspace to a blank one. |
protected void |
deleteKeyAction()
Defines action(s) to take upon pressing the delete button. |
protected void |
editKeyAction()
Defines action(s) to take upon pressing the edit button. |
protected void |
exitAction()
Dispatches a "window closing" event. |
protected void |
exportAction()
Displays an instance of ExportDialog . |
protected void |
loadImage(javax.swing.ImageIcon i)
Sets the passed image as the canvas background image. |
protected void |
loadWorkspace(Workspace ws)
Notifies the user if the image file and/or word-frequency file are readable, calls clearWorkspace() , then recreates the
state stored in the passed Workspace object. |
void |
mouseClicked(java.awt.event.MouseEvent me)
|
void |
mouseDragged(java.awt.event.MouseEvent me)
|
void |
mouseEntered(java.awt.event.MouseEvent me)
|
void |
mouseExited(java.awt.event.MouseEvent me)
|
void |
mouseMoved(java.awt.event.MouseEvent me)
|
void |
mousePressed(java.awt.event.MouseEvent me)
|
void |
mouseReleased(java.awt.event.MouseEvent me)
|
protected boolean |
newAction()
Prompts to save unsaved work and then clears the workspace. |
protected boolean |
openAction()
Clears the current workspace by calling newAction() , then
allows the user to open an image file or a previously-stored workspace
file. |
protected void |
parameterAction()
Displays an instance of ParametersDialog . |
protected void |
redoAction()
Redoes the last action on the canvas. |
protected boolean |
saveAction()
Checks that the workspace file on disk exists and is writable. |
protected boolean |
saveAsAction()
Creates a writable file on disk and saves a reference to that file to workspaceFile . |
protected void |
setColorAction(java.awt.Color c)
Sets the outline color of the canvas. |
protected void |
setCustomColorAction()
Displays a color chooser dialog and then sets the canvas' color appropriately. |
protected void |
setSelected(int index)
Sets the selected KeyButton object to be that which
resides at the passed index in the data model.Pass -1 to deselect all. |
void |
setTitle(java.lang.String filename)
|
protected void |
undoAction()
Undoes the last action on the canvas. |
protected void |
updateState()
Saves parameters and data to and modelDef
workspace appropriately. |
protected void |
userManualAction()
Defines action(s) to take upon selection of the "User Manual" menu item. |
void |
valueChanged(javax.swing.event.ListSelectionEvent lse)
|
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 tnt.gui.TnTFrame |
---|
actionPerformed, createCanvasScrollPane, createColorMenu, createEditMenu, createFileMenu, createHelpMenu, createInfoPanel, createMetricsMenu, createStatusPanel |
Methods inherited from class javax.swing.JFrame |
---|
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update |
Methods inherited from class java.awt.Frame |
---|
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, 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, 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, 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, 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, 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 |
---|
protected boolean fileModified
protected java.awt.Color color
protected javax.swing.JFileChooser openFileChooser
protected javax.swing.JFileChooser saveFileChooser
protected KeyButton selected
protected KeyLetterDialog mapping
protected ModelDefinition modelDef
ModelDefinition
object used to store model data.
ModelDefinition
protected ParametersDialog parameters
protected java.lang.String imageFileName
protected java.io.File workspaceFile
protected javax.swing.undo.UndoManager undoManager
protected Workspace workspace
Workspace
object used to store state data.
Workspace
Constructor Detail |
---|
public TnTImp()
Method Detail |
---|
protected boolean newAction()
newAction
in class TnTFrame
true
if successful, false
otherwise.clearWorkspace()
protected boolean openAction()
newAction()
, then
allows the user to open an image file or a previously-stored workspace
file.
openAction
in class TnTFrame
true
if successful, false
otherwise.newAction()
,
loadImage(ImageIcon i)
,
loadWorkspace(Workspace ws)
protected boolean saveAction()
saveAsAction()
.
saveAction
in class TnTFrame
true
if successful, false
otherwise.saveAsAction()
protected boolean saveAsAction()
workspaceFile
.
saveAsAction
in class TnTFrame
true
if successful, false
otherwise.workspaceFile
protected void exportAction()
ExportDialog
.
exportAction
in class TnTFrame
ExportDialog
protected void exitAction()
exitAction
in class TnTFrame
windowClosing(WindowEvent we)
protected void undoAction()
undoAction
in class TnTFrame
protected void redoAction()
redoAction
in class TnTFrame
protected void setColorAction(java.awt.Color c)
setColorAction
in class TnTFrame
protected void setCustomColorAction()
setCustomColorAction
in class TnTFrame
setColorAction(Color c)
protected void parameterAction()
ParametersDialog
.
parameterAction
in class TnTFrame
parameters
protected void calculateAction()
CalculateMetricsThread
.
calculateAction
in class TnTFrame
CalculateMetrics
protected void userManualAction()
TnTFrame
userManualAction
in class TnTFrame
protected void aboutAction()
TnTFrame
aboutAction
in class TnTFrame
protected void editKeyAction()
TnTFrame
editKeyAction
in class TnTFrame
protected void deleteKeyAction()
TnTFrame
deleteKeyAction
in class TnTFrame
protected void addKeyAction(java.awt.geom.Rectangle2D.Double keyBounds)
KeyButton
object with the selected letters and the passed
rectangular bounds.
keyBounds
- the rectangular bounds outlining the new key.protected void setSelected(int index)
KeyButton
object to be that which
resides at the passed index in the data model.
index
- the index of the object to select.protected void updateState()
modelDef
workspace
appropriately.
modelDef
,
workspace
protected void clearWorkspace()
protected void loadImage(javax.swing.ImageIcon i)
i
- the background image to use.protected void loadWorkspace(Workspace ws)
clearWorkspace()
, then recreates the
state stored in the passed Workspace
object.
ws
- the Workspace
object with the state to recreate.public void setTitle(java.lang.String filename)
setTitle
in class java.awt.Frame
public void valueChanged(javax.swing.event.ListSelectionEvent lse)
valueChanged
in interface javax.swing.event.ListSelectionListener
public void mouseClicked(java.awt.event.MouseEvent me)
mouseClicked
in interface java.awt.event.MouseListener
public void mouseDragged(java.awt.event.MouseEvent me)
mouseDragged
in interface java.awt.event.MouseMotionListener
public void mouseEntered(java.awt.event.MouseEvent me)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent me)
mouseExited
in interface java.awt.event.MouseListener
public void mouseMoved(java.awt.event.MouseEvent me)
mouseMoved
in interface java.awt.event.MouseMotionListener
public void mousePressed(java.awt.event.MouseEvent me)
mousePressed
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent me)
mouseReleased
in interface java.awt.event.MouseListener
public void windowActivated(java.awt.event.WindowEvent we)
windowActivated
in interface java.awt.event.WindowListener
public void windowClosed(java.awt.event.WindowEvent we)
windowClosed
in interface java.awt.event.WindowListener
public void windowClosing(java.awt.event.WindowEvent we)
windowClosing
in interface java.awt.event.WindowListener
public void windowDeactivated(java.awt.event.WindowEvent we)
windowDeactivated
in interface java.awt.event.WindowListener
public void windowDeiconified(java.awt.event.WindowEvent we)
windowDeiconified
in interface java.awt.event.WindowListener
public void windowIconified(java.awt.event.WindowEvent we)
windowIconified
in interface java.awt.event.WindowListener
public void windowOpened(java.awt.event.WindowEvent we)
windowOpened
in interface java.awt.event.WindowListener
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |