Class UserInterface

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by UserInterface
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public final class UserInterface
extends javax.swing.JPanel
implements java.awt.event.ActionListener

This is responsible for creating the main user interface of the application and handling action events from the various menu options and buttons. This does not include UI for the playback controls nor does it contain the UI for the Set Editor.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
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
(package private)  javax.swing.JMenuItem aboutCLIPMenuItem
          The About Dialog Menu Item
(package private)  javax.swing.JDialog aboutDialog
          Dialog that holds the 'About this Application' info
(package private)  javax.swing.JMenuItem addBlankTileMenuItem
          The Add Blank Tile To TileBin Menu Item
(package private)  javax.swing.JButton applySetEditorButton
          The Apply button for the Set Editor dialog
(package private)  javax.swing.JTextArea arrangementComments
          The TextArea for the Arrangement Comments dialog
(package private)  javax.swing.JDialog arrangementCommentsDialog
          The Tile Arrangement Comments dialog
(package private)  javax.swing.JList availableTileSets
          The list of available pre-loaded TileSet.
(package private)  javax.swing.DefaultListModel availableTileSetsModel
          The list model for the availableTileSets
(package private)  javax.swing.JButton backButtonComments
          The Back button for the Arrangement Comments dialog
(package private)  javax.swing.JButton backUnusedTileButton
          The Back button for the Unused Tile dialog
(package private)  javax.swing.JLabel blankDescriptionLabel
          The blank tile description label of the blank tile dialog
(package private)  javax.swing.JDialog blankDialog
          The dialog for Blank Tiles
(package private)  javax.swing.JPanel blankEditor
          The panel that holds the Blank Tile dialog components
(package private)  javax.swing.JLabel blankNameLabel
          The blank tile name label of the blank tile dialog
(package private)  javax.swing.JTextArea blankTileDescription
          The description field of the blank tile dialog
(package private)  javax.swing.JTextField blankTileName
          The name field of the blank tile dialog
(package private)  javax.swing.JButton browseButton
          The Browse button for the load TileSet dialog
(package private)  javax.swing.JTextField browseTextField
          The text field associated with the browse button in the load TileSet dialog
(package private)  java.awt.Font buttonFont
          The font used for some buttons
(package private)  javax.swing.JButton cancelAddBlankButton
          The cancel button for the blank tile dialog
(package private)  javax.swing.JButton cancelButtonComments
          The Cancel button for the Arrangement Comments dialog
(package private)  javax.swing.JButton cancelLoadTileButton
          The Cancel button for the load TileSet dialog
(package private)  javax.swing.JButton cancelSetEditorButton
          The Cancel button for the Set Editor dialog
(package private)  javax.swing.JButton cancelUnusedTileButton
          The Cancel button for the Unused Tile dialog
(package private)  javax.swing.JMenuItem continueSessionMenuItem
          The Coninue Session Menu Item
(package private)  javax.swing.JPanel CPPanel
          Holds theControlPanel and spacers for playback mode
(package private)  javax.swing.JPanel cpSpacer
          A spacer for CPPanel
(package private)  javax.swing.JMenuItem createTileSetMenuItem
          The Create Tile Set Menu Item
(package private)  int curBlankTile
          The currently active blank tile
(package private)  java.io.File curDirectory
          The last directory that the use loaded or saved from
(package private)  boolean currentlySaving
          true if the user is currently in the process of saving a log
(package private)  javax.swing.JButton deleteAddBlankButton
          the delete button for the blank tile dialog
(package private)  javax.swing.JTextArea descUnusedText
          The description TextArea for the Unused Tile dialog
(package private)  javax.swing.JTabbedPane editorsTabPane
          The Tabbed Pane for the Set Editor dialog
(package private)  javax.swing.JMenuItem exitMenuItem
          The Exit Menu Item
(package private)  javax.swing.JCheckBoxMenuItem gridlinesMenuItem
          The View/Hide Gridlines Menu Item
(package private)  javax.swing.JDialog helpDialog
          The Dialog that holds theHelpPanel
(package private)  javax.swing.JMenuItem helpSystemMenuItem
          The Help System Menu Item
(package private)  javax.swing.JPanel leftSpacer
          A left spacer for the main UI
(package private)  javax.swing.JMenuItem loadTileArrangementMenuItem
          The Load Tile Arrangement Menu Item
(package private)  javax.swing.JDialog loadTileSetDialog
          The Load TileSet Dialog
(package private)  javax.swing.JMenuItem loadTileSetMenuItem
          The Load Tile Set Menu Item
(package private)  java.lang.String MainPanelName
          The name assoctiated with theMainPanel
(package private)  javax.swing.JSplitPane mainSplit
          The SplitPane that holds the theGrid and the theTileBinPanel
(package private)  javax.swing.JDialog minimapDialog
          The dialog that holds the MiniMapPanel
(package private)  javax.swing.JCheckBoxMenuItem minimapMenuItem
          The View/Hide Mini-Map Menu Item
(package private)  javax.swing.JMenuItem modifyTileSetMenuItem
          The Modify Tile Set Menu Item
(package private)  UserInteraction mouseInput
          CLIP's mouse input adapter attached to most of the UI components
(package private) static int NewBlankInGrid
          Defines the event of adding a blank tile to the Grid
(package private) static int NewBlankInTileBin
          Defines the event of adding a blank tile to the TileBin
(package private)  javax.swing.JButton nextButtonComments
          The Next button for the Arrangement Comments dialog
(package private)  javax.swing.JButton okLoadTileButton
          The OK button for load TileSet dialog
(package private)  javax.swing.JButton okSetEditorButton
          The OK button for the Set Editor dialog
(package private)  javax.swing.JButton okUnusedTileButton
          The OK button for the Unused Tile dialog
(package private)  javax.swing.JMenu openMenu
          The Open Menu
(package private)  CLIPFrame parentFrame
          The Frame that the application is running in
(package private)  java.util.ArrayList preloaded
          List of Rules objects defining each preloaded tile set
(package private)  javax.swing.JMenuItem printArrangementMenuItem
          The Print Tile Arrangement Menu Item
(package private)  javax.swing.JMenuItem printArrangementToFileMenuItem
          The Print Tile Arrangement To Image File Menu Item
(package private)  javax.swing.JMenu printMenu
          The Print Menu
(package private)  javax.swing.JMenuItem printTileInfoMenuItem
          The Print Additional Tile Information Menu Item
(package private)  javax.swing.JPanel rightSpacer
          A right spacer for the main UI
(package private)  javax.swing.JButton saveAddBlankButton
          The save button for the blank tile dialog
(package private)  javax.swing.JMenuItem saveCompleteArrangementMenuItem
          The Save Complete Arrangement Menu Item
(package private)  javax.swing.JMenuItem saveIncompleteArrangementMenuItem
          The Save Incomplete Arrangement Menu Item
(package private)  javax.swing.JMenu saveMenu
          The Save Menu
(package private)  int saveMoveCount
          The number of recorded moves at the last save time
private static long serialVersionUID
           
(package private)  javax.swing.JDialog setEditorDialog
          The Dialog for the Set Editor
(package private)  java.awt.Dimension SpacerSizeHorizontal
          Size of horizontal spacers
(package private)  java.awt.Dimension SpacerSizeVertical
          Size of vertical spacers
(package private)  java.awt.Font textFont
          The font used for some text
(package private)  javax.swing.JPanel theControlPanel
          The Control Panel for playback mode
(package private)  Grid theGrid
          The Grid component
(package private)  javax.swing.JScrollPane theGridScrollPane
          The scrollpane that contains theGrid
(package private)  HelpPanel theHelpPanel
          The System Help Panel: HelpPanel
(package private)  javax.swing.JPanel theMainPanel
          One of the most important panels in the program since it holds the Grid, the TileBin, and the Playback controls.
(package private)  MiniMapPanel theMiniMap
          The MiniMap Panel
(package private)  Playback thePlayback
          CLIP's playback system for playing back log files
(package private)  TileBinPanel theTileBinPanel
          The panel that holds the TileBin
(package private)  javax.swing.JRadioButtonMenuItem tileBinLeftMenuItem
          The Set TileBin on Left Menu Item
(package private)  javax.swing.JRadioButtonMenuItem tileBinRightMenuItem
          The Set TileBin on Right Menu Item
(package private)  javax.swing.JMenuItem tilesetInstructionsMenuItem
          The TileSet Instructions Menu Item
(package private)  javax.swing.ImageIcon[] tileUnusedIcons
          The array of ImageIcons that make up the tileUnusedList
(package private)  javax.swing.JList tileUnusedList
          The list of icons of the unused tiles for the Unused Tile Dialog
(package private)  int tileUnusedListPrevIndex
          The last selected index of tileUnusedList in the Unused Tile dialog
(package private)  javax.swing.JPanel topSpacer
          A top spacer for the main UI
(package private)  boolean unusedCompleted
          true if has completed the Unused Tile dialog task
(package private)  javax.swing.JDialog unusedTileDialog
          Unused Tile dialog
(package private)  int unusedTileDialogMaxHeight
          Maximum height of the Unused Tile dialog
(package private)  int unusedTileDialogMaxWidth
          Maximum width of the Unused Tile dialog
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
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
UserInterface(CLIPFrame parent, UserInteraction newMouseInput)
          The Constructor sets up the main UI components and some dialogs.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent ev)
          Handles action events on most CLIP buttons and menu items.
 void adjustSplitPaneDividerLocation()
          Adjusts the split pane divider's location by passing the call onto the TileBin's TileBin.adjustSize() method
private  void BrowseForTileSet()
          Opens a file dialog and allows the user to browse for a TileSet to load.
 void changeTileBinWidth(int newWidth)
          Changes the width of the TileBin to accomodate the number of tiles wide specified by the passed in value.
 boolean confirmLoseUnsavedWork()
          If the user has unsaved work, it prompts them if they want to continue and returns true if the user wishes to continue without saving thier work.
private  void ContinueSession()
          Allows the user to browse for a log file, load it up, skip to the end of the log, and start arranging tiles.
private  TileSet convertRulesToSet(Rules newRuleSet)
          Takes a rule set and converts it to a tile set, then returns it.
 void createAboutDialog()
          Creates the About Dialog.
 void CreateAndDisplayMiniMap()
          Creates and then displays the minimap at the upper left corner of the Grid.
 void createArrangementCommentsPanel()
          Creates the Tile Arrangement Comments Panel to be used in the arrangementCommentsDialog dialog.
 javax.swing.JPanel createBlankTilePanel()
          Creates the panel used for creating, editing, and deleting blank tiles.
(package private)  javax.swing.JPanel createEditors(javax.swing.JScrollPane rulePanel, javax.swing.JPanel extraOptionsPanel, javax.swing.JPanel tilePanel)
          Creates the Set Editor dialog.
(package private)  javax.swing.JMenu createFileMenu()
          Creates the File menu.
 void createHelpDialog()
          Creates the Help System Dialog.
(package private)  javax.swing.JMenu createHelpMenu()
          Creates the Help menu.
 javax.swing.JPanel createLoadTileSetPanel()
          Creates the panel used for the Load Tile Set dialog.
(package private)  javax.swing.JMenuBar createMenuBar()
          Creates the Menu Bar used by the CLIP application.
private  void CreateNewTileSet()
          Initializes the Set Editor to create a new tile set and then displays it.
(package private)  javax.swing.JMenu createToolsMenu()
          Creates the Tools menu.
 void createUnusedPanel()
          Creates the unused tile dialog so the user can explain why each tile in the TileBin was not included in the final tile arrangement.
(package private)  javax.swing.JMenu createViewMenu()
          Creates the View menu.
private  void DeleteBlankTile()
          Deletes the blank tile with the tileID equal to the curBlankTile.
 void displayAddBlankTileDialog(int tileID)
          Displays the blank tile dialog for the tile with the passed in tileID.
 void displayInstructions(java.lang.String title, java.lang.String message)
          Displays a special information message dialog with the passed in title and message with the message word-wrapping at 80 characters.
 void enterPlaybackMode()
          Puts the system into Playback mode.
 void enterTileArrangementMode()
          Puts the system into Tile Arrangement mode.
 void finishLoadingTileSet()
          Sets up the other components and UI to use the new TileSet that was loaded prior to calling this method.
 javax.swing.JPanel getGUI()
          Returns the user interface.
 java.awt.image.BufferedImage getPrintArrangementImage()
          Creates a cropped image of the current tile arrangement on a white background and returns it (to print or save).
private  boolean inPlaybackMode()
          Returns true if the system is in Playback mode.
private  boolean inTileArrangementMode()
          Returns true if the system is in Tile Arrangement mode.
private  void LoadPreloadedSets()
          Loads the preloaded sets into memory.
private  void LoadTileArrangement()
          User browses for a log file to load and once selected, it loads up the file and enters Playback mode.
 void loadTileSet()
          This loads a TileSet from the Load TileSet Dialog.
private  void ModifyTileSet()
          Initializes the Set Editor to modify a tile set, opens a file dialog to load a set file, then displays the editor with the set information filled in.
private  void PrintTileArrangement()
          Brings up the print dialog to print the current tile arrangement.
private  void PrintTileArrangementToFile()
          Brings up a file dialog to save an image file of the current tile arrangement.
private  void PrintTileInformation()
          Prints a page(s} with arrangement comments at the top of the first page (if needed) and unused/blank tile comments following (if needed).
private  void SaveBlankTile()
          Handles saving newly created or modified blank tiles.
private  void SaveCompleteLog()
          Customizes the save dialog prompt for the current tile set then moves on to the next step of saving the log.
private  void SaveIncompleteLog()
          Saves a log file but does not prompt user for addtional information about arrangement comments or unused tile reasonings.
 void saveTileArrangement()
          Saves a log file after prompting the user for Unused Tile reasons (if needed) and creating all needed TileSet.summaryTiles.
private  void SaveTileSet()
          Saves a tile set created or modified in the Set Editor.
 void setMiniMapSize()
          Sets the MiniMap to an appropriate size based on the current Grid size.
private  void SetTileBinToLeftSide()
          Sets the TileBin to be displayed on the left side of the Grid.
private  void SetTileBinToRightSide()
          Sets the TileBin to be displayed on the right side of the Grid.
private  void SubmitArrangementComments()
          Submits tile arrangement comments from the Tile Arrangement Comments dialog and then continues the save process.
private  void SubmitUnusedTileInfo()
          Submits Unused Tile information from the Unused Tile dialog.
private  void ToggleMiniMap()
          This toggles the MiniMap on and off.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

NewBlankInTileBin

static final int NewBlankInTileBin
Defines the event of adding a blank tile to the TileBin

See Also:
Constant Field Values

NewBlankInGrid

static final int NewBlankInGrid
Defines the event of adding a blank tile to the Grid

See Also:
Constant Field Values

buttonFont

java.awt.Font buttonFont
The font used for some buttons


textFont

java.awt.Font textFont
The font used for some text


parentFrame

CLIPFrame parentFrame
The Frame that the application is running in


mouseInput

UserInteraction mouseInput
CLIP's mouse input adapter attached to most of the UI components


curDirectory

java.io.File curDirectory
The last directory that the use loaded or saved from


preloaded

java.util.ArrayList preloaded
List of Rules objects defining each preloaded tile set


openMenu

javax.swing.JMenu openMenu
The Open Menu


loadTileSetMenuItem

javax.swing.JMenuItem loadTileSetMenuItem
The Load Tile Set Menu Item


loadTileArrangementMenuItem

javax.swing.JMenuItem loadTileArrangementMenuItem
The Load Tile Arrangement Menu Item


continueSessionMenuItem

javax.swing.JMenuItem continueSessionMenuItem
The Coninue Session Menu Item


saveMenu

javax.swing.JMenu saveMenu
The Save Menu


saveCompleteArrangementMenuItem

javax.swing.JMenuItem saveCompleteArrangementMenuItem
The Save Complete Arrangement Menu Item


saveIncompleteArrangementMenuItem

javax.swing.JMenuItem saveIncompleteArrangementMenuItem
The Save Incomplete Arrangement Menu Item


printMenu

javax.swing.JMenu printMenu
The Print Menu


printArrangementMenuItem

javax.swing.JMenuItem printArrangementMenuItem
The Print Tile Arrangement Menu Item


printTileInfoMenuItem

javax.swing.JMenuItem printTileInfoMenuItem
The Print Additional Tile Information Menu Item


printArrangementToFileMenuItem

javax.swing.JMenuItem printArrangementToFileMenuItem
The Print Tile Arrangement To Image File Menu Item


exitMenuItem

javax.swing.JMenuItem exitMenuItem
The Exit Menu Item


addBlankTileMenuItem

javax.swing.JMenuItem addBlankTileMenuItem
The Add Blank Tile To TileBin Menu Item


createTileSetMenuItem

javax.swing.JMenuItem createTileSetMenuItem
The Create Tile Set Menu Item


modifyTileSetMenuItem

javax.swing.JMenuItem modifyTileSetMenuItem
The Modify Tile Set Menu Item


tileBinRightMenuItem

javax.swing.JRadioButtonMenuItem tileBinRightMenuItem
The Set TileBin on Right Menu Item


tileBinLeftMenuItem

javax.swing.JRadioButtonMenuItem tileBinLeftMenuItem
The Set TileBin on Left Menu Item


minimapMenuItem

javax.swing.JCheckBoxMenuItem minimapMenuItem
The View/Hide Mini-Map Menu Item


gridlinesMenuItem

javax.swing.JCheckBoxMenuItem gridlinesMenuItem
The View/Hide Gridlines Menu Item


tilesetInstructionsMenuItem

javax.swing.JMenuItem tilesetInstructionsMenuItem
The TileSet Instructions Menu Item


helpSystemMenuItem

javax.swing.JMenuItem helpSystemMenuItem
The Help System Menu Item


aboutCLIPMenuItem

javax.swing.JMenuItem aboutCLIPMenuItem
The About Dialog Menu Item


loadTileSetDialog

javax.swing.JDialog loadTileSetDialog
The Load TileSet Dialog


availableTileSets

javax.swing.JList availableTileSets
The list of available pre-loaded TileSet. Stores name Strings


availableTileSetsModel

javax.swing.DefaultListModel availableTileSetsModel
The list model for the availableTileSets


browseTextField

javax.swing.JTextField browseTextField
The text field associated with the browse button in the load TileSet dialog


browseButton

javax.swing.JButton browseButton
The Browse button for the load TileSet dialog


okLoadTileButton

javax.swing.JButton okLoadTileButton
The OK button for load TileSet dialog


cancelLoadTileButton

javax.swing.JButton cancelLoadTileButton
The Cancel button for the load TileSet dialog


blankDialog

javax.swing.JDialog blankDialog
The dialog for Blank Tiles


blankEditor

javax.swing.JPanel blankEditor
The panel that holds the Blank Tile dialog components


blankNameLabel

javax.swing.JLabel blankNameLabel
The blank tile name label of the blank tile dialog


blankDescriptionLabel

javax.swing.JLabel blankDescriptionLabel
The blank tile description label of the blank tile dialog


blankTileName

javax.swing.JTextField blankTileName
The name field of the blank tile dialog


blankTileDescription

javax.swing.JTextArea blankTileDescription
The description field of the blank tile dialog


saveAddBlankButton

javax.swing.JButton saveAddBlankButton
The save button for the blank tile dialog


cancelAddBlankButton

javax.swing.JButton cancelAddBlankButton
The cancel button for the blank tile dialog


deleteAddBlankButton

javax.swing.JButton deleteAddBlankButton
the delete button for the blank tile dialog


curBlankTile

int curBlankTile
The currently active blank tile


arrangementCommentsDialog

javax.swing.JDialog arrangementCommentsDialog
The Tile Arrangement Comments dialog


arrangementComments

javax.swing.JTextArea arrangementComments
The TextArea for the Arrangement Comments dialog


backButtonComments

javax.swing.JButton backButtonComments
The Back button for the Arrangement Comments dialog


nextButtonComments

javax.swing.JButton nextButtonComments
The Next button for the Arrangement Comments dialog


cancelButtonComments

javax.swing.JButton cancelButtonComments
The Cancel button for the Arrangement Comments dialog


unusedTileDialog

javax.swing.JDialog unusedTileDialog
Unused Tile dialog


okUnusedTileButton

javax.swing.JButton okUnusedTileButton
The OK button for the Unused Tile dialog


cancelUnusedTileButton

javax.swing.JButton cancelUnusedTileButton
The Cancel button for the Unused Tile dialog


backUnusedTileButton

javax.swing.JButton backUnusedTileButton
The Back button for the Unused Tile dialog


descUnusedText

javax.swing.JTextArea descUnusedText
The description TextArea for the Unused Tile dialog


tileUnusedList

javax.swing.JList tileUnusedList
The list of icons of the unused tiles for the Unused Tile Dialog


tileUnusedIcons

javax.swing.ImageIcon[] tileUnusedIcons
The array of ImageIcons that make up the tileUnusedList


unusedTileDialogMaxWidth

final int unusedTileDialogMaxWidth
Maximum width of the Unused Tile dialog

See Also:
Constant Field Values

unusedTileDialogMaxHeight

final int unusedTileDialogMaxHeight
Maximum height of the Unused Tile dialog

See Also:
Constant Field Values

tileUnusedListPrevIndex

int tileUnusedListPrevIndex
The last selected index of tileUnusedList in the Unused Tile dialog


unusedCompleted

boolean unusedCompleted
true if has completed the Unused Tile dialog task


setEditorDialog

javax.swing.JDialog setEditorDialog
The Dialog for the Set Editor


editorsTabPane

javax.swing.JTabbedPane editorsTabPane
The Tabbed Pane for the Set Editor dialog


okSetEditorButton

javax.swing.JButton okSetEditorButton
The OK button for the Set Editor dialog


cancelSetEditorButton

javax.swing.JButton cancelSetEditorButton
The Cancel button for the Set Editor dialog


applySetEditorButton

javax.swing.JButton applySetEditorButton
The Apply button for the Set Editor dialog


minimapDialog

javax.swing.JDialog minimapDialog
The dialog that holds the MiniMapPanel


theMiniMap

MiniMapPanel theMiniMap
The MiniMap Panel


helpDialog

javax.swing.JDialog helpDialog
The Dialog that holds theHelpPanel


theHelpPanel

HelpPanel theHelpPanel
The System Help Panel: HelpPanel


aboutDialog

javax.swing.JDialog aboutDialog
Dialog that holds the 'About this Application' info


thePlayback

Playback thePlayback
CLIP's playback system for playing back log files


theControlPanel

javax.swing.JPanel theControlPanel
The Control Panel for playback mode


CPPanel

javax.swing.JPanel CPPanel
Holds theControlPanel and spacers for playback mode


cpSpacer

javax.swing.JPanel cpSpacer
A spacer for CPPanel


SpacerSizeVertical

final java.awt.Dimension SpacerSizeVertical
Size of vertical spacers


SpacerSizeHorizontal

final java.awt.Dimension SpacerSizeHorizontal
Size of horizontal spacers


leftSpacer

javax.swing.JPanel leftSpacer
A left spacer for the main UI


rightSpacer

javax.swing.JPanel rightSpacer
A right spacer for the main UI


topSpacer

javax.swing.JPanel topSpacer
A top spacer for the main UI


theMainPanel

javax.swing.JPanel theMainPanel
One of the most important panels in the program since it holds the Grid, the TileBin, and the Playback controls.


MainPanelName

final java.lang.String MainPanelName
The name assoctiated with theMainPanel

See Also:
Constant Field Values

theGrid

Grid theGrid
The Grid component


theGridScrollPane

javax.swing.JScrollPane theGridScrollPane
The scrollpane that contains theGrid


theTileBinPanel

TileBinPanel theTileBinPanel
The panel that holds the TileBin


mainSplit

javax.swing.JSplitPane mainSplit
The SplitPane that holds the theGrid and the theTileBinPanel


saveMoveCount

int saveMoveCount
The number of recorded moves at the last save time


currentlySaving

boolean currentlySaving
true if the user is currently in the process of saving a log

Constructor Detail

UserInterface

public UserInterface(CLIPFrame parent,
                     UserInteraction newMouseInput)
The Constructor sets up the main UI components and some dialogs.

Parameters:
parent - The frame the application runs in
newMouseInput - CLIPs mouse adapter to attach to the UI components
Method Detail

getGUI

public javax.swing.JPanel getGUI()
Returns the user interface. Should only be called after the constructor is called.

Returns:
The panel containing the Grid, TileBinPanel, and the Playback controls.
See Also:
theMainPanel

CreateAndDisplayMiniMap

public void CreateAndDisplayMiniMap()
Creates and then displays the minimap at the upper left corner of the Grid.

See Also:
MiniMapPanel

createMenuBar

javax.swing.JMenuBar createMenuBar()
Creates the Menu Bar used by the CLIP application.

Returns:
A menu bar containing the File, Tools, View, and Help menus

LoadPreloadedSets

private void LoadPreloadedSets()
Loads the preloaded sets into memory. It first attempts to load the set from the running jar file. If it fails, it tries to load the sets from the directory. The reason for trying both methods is that usually the app will be ran from a jar file but during testing and coding, the app was often run directly from the compiler (Eclipse) and we needed preloaded sets. This save a lot of time and effort to use the preloaded sets directly from the compiler without the need to compiler and run a jar file.

This fills the availableTileSetsModel and the preloaded vars with preloaded set information.

See Also:
availableTileSetsModel, preloaded

createLoadTileSetPanel

public javax.swing.JPanel createLoadTileSetPanel()
Creates the panel used for the Load Tile Set dialog. It is also responsible for loading the preloaded sets found in this panel.

Returns:
The panel used for the Load Tile Set dialog
See Also:
LoadPreloadedSets()

createEditors

javax.swing.JPanel createEditors(javax.swing.JScrollPane rulePanel,
                                 javax.swing.JPanel extraOptionsPanel,
                                 javax.swing.JPanel tilePanel)
Creates the Set Editor dialog.

Parameters:
rulePanel - Panel with the basic set rules
extraOptionsPanel - Panel with the advanced features
tilePanel - Panel dealing with the addition and removal of tiles
Returns:
The Panel holding the components of the Set Editor dialog

createBlankTilePanel

public javax.swing.JPanel createBlankTilePanel()
Creates the panel used for creating, editing, and deleting blank tiles.

Returns:
The panel for the blank tile dialog

displayAddBlankTileDialog

public void displayAddBlankTileDialog(int tileID)
Displays the blank tile dialog for the tile with the passed in tileID. TileID can also be set to NewBlankInGrid or NewBlankInTileBin to set up the dialog as an add blank tile dialog rather than an edit dialog.

Parameters:
tileID - ID of the blank tile to edit. NewBlankInGrid or NewBlankInTileBin to edit blank tiles.
See Also:
SaveBlankTile(), DeleteBlankTile()

createHelpDialog

public void createHelpDialog()
Creates the Help System Dialog.


createAboutDialog

public void createAboutDialog()
Creates the About Dialog.


createFileMenu

javax.swing.JMenu createFileMenu()
Creates the File menu.

Returns:
The File Menu

createToolsMenu

javax.swing.JMenu createToolsMenu()
Creates the Tools menu.

Returns:
The Tools Menu

createViewMenu

javax.swing.JMenu createViewMenu()
Creates the View menu.

Returns:
The View Menu

createHelpMenu

javax.swing.JMenu createHelpMenu()
Creates the Help menu.

Returns:
The Help Menu

loadTileSet

public void loadTileSet()
This loads a TileSet from the Load TileSet Dialog. It checks to see if they selected a preloaded set from the list. If not, it checks to see if the browse box contains a path to a set. It loads a Rules file and then converts it to a TileSet with the convertRulesToSet(Rules) method. It then finishes loading the set with the finishLoadingTileSet() method and enabling/disabling menu options. It also displays the set instructions if they exist. Calling this method also puts the system in Tile Arrangement mode with the enterTileArrangementMode() method.

See Also:
Rules, convertRulesToSet(Rules), finishLoadingTileSet(), enterTileArrangementMode(), displayInstructions(String, String)

BrowseForTileSet

private void BrowseForTileSet()
Opens a file dialog and allows the user to browse for a TileSet to load. It sets the browseTextField of the Load Tile Dialog but does not actually load the set.

See Also:
browseTextField

finishLoadingTileSet

public void finishLoadingTileSet()
Sets up the other components and UI to use the new TileSet that was loaded prior to calling this method. This should be called after a new TileSet is loaded. It loads the tiles into the TileBin. It changes the size of the Grid to the Set's grid size. It sets the size of the minimap. Lastly, it adjusts the Split Pane and UI to support the new set.

See Also:
TileBin.LoadTileSet(TileSet), Grid.changeGridSize(Dimension), Grid.setTileSet(TileSet), adjustSplitPaneDividerLocation(), setMiniMapSize()

convertRulesToSet

private TileSet convertRulesToSet(Rules newRuleSet)
Takes a rule set and converts it to a tile set, then returns it.

Parameters:
newRuleSet - The Rules object to convert to a TileSet
Returns:
The TileSet created from the Rules object
See Also:
Rules, TileSet

enterTileArrangementMode

public void enterTileArrangementMode()
Puts the system into Tile Arrangement mode. In Tile Arrangement mode, the user is allowed to save, the control panel is not visible, and moves are recorded by the UserInteraction object.

See Also:
CLIPFrame.Mode, UserInteraction.beginTileArrangement()

enterPlaybackMode

public void enterPlaybackMode()
Puts the system into Playback mode. In Playback mode, the control panel is visible and most options related to arranging tiles are disabled.

See Also:
CLIPFrame.Mode, Playback.beginPlayback()

setMiniMapSize

public void setMiniMapSize()
Sets the MiniMap to an appropriate size based on the current Grid size.

See Also:
MiniMapPanel, Grid

inTileArrangementMode

private boolean inTileArrangementMode()
Returns true if the system is in Tile Arrangement mode.

Returns:
true if the system is in Tile Arrangement mode.
See Also:
CLIPFrame.Mode

inPlaybackMode

private boolean inPlaybackMode()
Returns true if the system is in Playback mode.

Returns:
true if the system is in Playback mode.
See Also:
CLIPFrame.Mode

SaveBlankTile

private void SaveBlankTile()
Handles saving newly created or modified blank tiles. The curBlankTile variable must be set before entering this function. If it is set to an existing blank tile's ID, then it saves the changes (if any) to that tile. If it is set to either NewBlankInGrid or NewBlankInTileBin then it creates an new blank tile in the appropriate place. The information for the blank tiles is pulled from the Blank Tile Dialog components. This function also calls the necessary functions to record the action in the Record object.

See Also:
curBlankTile, NewBlankInGrid, NewBlankInTileBin, displayAddBlankTileDialog(int), Record.recordAddBlankTile(int, String, String), Record.recordAddBlankTileToGrid(int, String, String, int, int), Record.recordEditBlankTile(int, String, String, String, String)

DeleteBlankTile

private void DeleteBlankTile()
Deletes the blank tile with the tileID equal to the curBlankTile. This value must be set before calling this method. Also records the deletion of the tile in the move list.

See Also:
curBlankTile, displayAddBlankTileDialog(int), Record.recordRemoveBlankTile(int, int, String, String, int, int)

SaveTileSet

private void SaveTileSet()
Saves a tile set created or modified in the Set Editor. This pulls information from the Data object and outputs a Rules file.

See Also:
Data, Rules

LoadTileArrangement

private void LoadTileArrangement()
User browses for a log file to load and once selected, it loads up the file and enters Playback mode.

See Also:
Playback.loadLogFile(String), Playback.beginPlayback(), enterPlaybackMode()

ContinueSession

private void ContinueSession()
Allows the user to browse for a log file, load it up, skip to the end of the log, and start arranging tiles. This leaves the system in Tile Arrangement mode. It borrows functionality from the Playback system. It also records a 'load log' entry in the Record object.

See Also:
enterTileArrangementMode(), Playback, Record.recordLoadLog(long, long)

SaveIncompleteLog

private void SaveIncompleteLog()
Saves a log file but does not prompt user for addtional information about arrangement comments or unused tile reasonings.

See Also:
Record.saveLog(String)

SaveCompleteLog

private void SaveCompleteLog()
Customizes the save dialog prompt for the current tile set then moves on to the next step of saving the log. If no information is required, it goes directly to saveTileArrangement(). If arrangement comments or unused tile reasons are required and they apply, then those dialogs are displayed first (with arrangement comments being the first if both are needed).

See Also:
saveTileArrangement()

PrintTileArrangement

private void PrintTileArrangement()
Brings up the print dialog to print the current tile arrangement. The printed arrangement is cropped so all tiles are included but no excess grid is included.

See Also:
getPrintArrangementImage(), Print2DPrinterJob

PrintTileInformation

private void PrintTileInformation()
Prints a page(s} with arrangement comments at the top of the first page (if needed) and unused/blank tile comments following (if needed). This happens by arrangeing these things on a panel(s) in a frame and then painting the panel(s) to an image array. This array is then set to the print dialog and multiple pages are printed if needed.

See Also:
Print2DPrinterJob

PrintTileArrangementToFile

private void PrintTileArrangementToFile()
Brings up a file dialog to save an image file of the current tile arrangement. The arrangement is cropped so all tiles are included but no excess grid is included. Defaults to a 'png' extension.

See Also:
getPrintArrangementImage()

CreateNewTileSet

private void CreateNewTileSet()
Initializes the Set Editor to create a new tile set and then displays it.


ModifyTileSet

private void ModifyTileSet()
Initializes the Set Editor to modify a tile set, opens a file dialog to load a set file, then displays the editor with the set information filled in.


SetTileBinToLeftSide

private void SetTileBinToLeftSide()
Sets the TileBin to be displayed on the left side of the Grid. It creates a new mainSplit in the process.


SetTileBinToRightSide

private void SetTileBinToRightSide()
Sets the TileBin to be displayed on the right side of the Grid. It creates a new mainSplit in the process.


ToggleMiniMap

private void ToggleMiniMap()
This toggles the MiniMap on and off. The MiniMap always appears in the upper left corner of the viewable Grid.

See Also:
MiniMapPanel, setMiniMapSize()

SubmitUnusedTileInfo

private void SubmitUnusedTileInfo()
Submits Unused Tile information from the Unused Tile dialog. Should only be called when the user clicks the save button in the Unused Tile Dialog. Creates SummaryEntries in the current TileSet's SummaryTiles list.

See Also:
unusedTileDialog, TileSet.summaryTiles, SummaryEntry

SubmitArrangementComments

private void SubmitArrangementComments()
Submits tile arrangement comments from the Tile Arrangement Comments dialog and then continues the save process. This should only be called from the save/next button of the arrangementCommentsDialog.

See Also:
arrangementCommentsDialog, saveTileArrangement()

adjustSplitPaneDividerLocation

public void adjustSplitPaneDividerLocation()
Adjusts the split pane divider's location by passing the call onto the TileBin's TileBin.adjustSize() method

See Also:
TileBin.adjustSize()

createArrangementCommentsPanel

public void createArrangementCommentsPanel()
Creates the Tile Arrangement Comments Panel to be used in the arrangementCommentsDialog dialog.


createUnusedPanel

public void createUnusedPanel()
Creates the unused tile dialog so the user can explain why each tile in the TileBin was not included in the final tile arrangement.


saveTileArrangement

public void saveTileArrangement()
Saves a log file after prompting the user for Unused Tile reasons (if needed) and creating all needed TileSet.summaryTiles.

See Also:
createUnusedPanel(), TileSet.summaryTiles, SummaryEntry, Record.saveLog(String)

changeTileBinWidth

public void changeTileBinWidth(int newWidth)
Changes the width of the TileBin to accomodate the number of tiles wide specified by the passed in value.

Parameters:
newWidth - Number of tiles for the TileBin to display per row
See Also:
TileBin, mainSplit

confirmLoseUnsavedWork

public boolean confirmLoseUnsavedWork()
If the user has unsaved work, it prompts them if they want to continue and returns true if the user wishes to continue without saving thier work.

Returns:
true to continue without saving work false otherwise.

displayInstructions

public void displayInstructions(java.lang.String title,
                                java.lang.String message)
Displays a special information message dialog with the passed in title and message with the message word-wrapping at 80 characters. Used to display set instructions since we cant predict if the set creater will use return characters in thier instruction message.

Parameters:
title - Title of the message dialog
message - Message to display in the message dialog
See Also:
WrappingJOptionPane

getPrintArrangementImage

public java.awt.image.BufferedImage getPrintArrangementImage()
Creates a cropped image of the current tile arrangement on a white background and returns it (to print or save). The image is cropped at the upper-left-most tile to the bottom-right-most tile so all tiles are shown without any excess grid space. The background is white and gridlines are drawn if they are enabled in the Grid.

Returns:
The cropped image of the arrangement on a white background
See Also:
TileSet.getTileBoundsInGrid(), Grid.drawTiles(Graphics2D, int, int)

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ev)
Handles action events on most CLIP buttons and menu items. Determines the source of the event and acts accordingly.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
ev - The ActionEvent