Class Data

java.lang.Object
  extended by Data
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.MouseListener, java.util.EventListener, javax.swing.event.ChangeListener, javax.swing.event.DocumentListener

public class Data
extends java.lang.Object
implements java.awt.event.ActionListener, javax.swing.event.ChangeListener, javax.swing.event.DocumentListener, java.awt.event.MouseListener

This class handles all the User Interface and interactions with the user in the Set Editor tabs. Its purpose is to support the creation and modification of TileSets.


Field Summary
(package private)  javax.swing.JButton addButton
          Button used to add more tiles to the TileSet
(package private)  javax.swing.JCheckBox arrangementCommentCheck
          Checkbox to require arrangement comments when doing a complete arrangement save
(package private)  javax.swing.JCheckBox blankCheck
          Checkbox to allow blank tiles (and enable the blank tile options)
(package private)  javax.swing.JCheckBox blankDescCheck
          Checkbox to require a description on all blank tiles
(package private)  javax.swing.JComboBox blankList
          ComboBox containing the list of tiles with the highlighted tile to be used as the blank tile
(package private)  javax.swing.DefaultComboBoxModel blankListModel
          ComboBox Model for the blank tile combo box
(package private)  javax.swing.JCheckBox blankNameCheck
          Checkbox to require a name on all blank tiles
(package private)  javax.swing.JTextField blankNumField
          Textfield for number of blank tiles allowed
(package private)  javax.swing.SpinnerModel blankNumModel
          Spinner Model for number of blank tiles allowed
(package private)  javax.swing.JSpinner blankNumSpinner
          Spinner for number of blank tiles allowed
(package private)  javax.swing.JCheckBox blankUnlimitedCheck
          Checkbox to allow unlimited blank tiles
(package private)  java.awt.Font buttonFont
          Font used for some buttons
(package private)  javax.swing.JButton closeViewButton
          The close button on the view tile image dialog
(package private)  java.io.File curDirectory
          Keeps track of the last directory the user used to get tile images from
(package private)  javax.swing.JTextArea descText
          Description of Instructions of the TileSet
(package private)  javax.swing.JPanel dialogPanel
          Panel containing the Image of the tile the user wishes to view
(package private)  javax.swing.JTextField gridTilesHighField
          Text Field for the Grid's number of tiles high
(package private)  javax.swing.SpinnerModel gridTilesHighModel
          Spinner Model for the Grid's number of tiles high
(package private)  javax.swing.JSpinner gridTilesHighSpinner
          Spinner for the Grid's number of tiles high
(package private)  javax.swing.JTextField gridTilesWideField
          Text Field for the Grid's number of tiles wide
(package private)  javax.swing.SpinnerModel gridTilesWideModel
          Spinner Model for the Grid's number of tiles wide
(package private)  javax.swing.JSpinner gridTilesWideSpinner
          Spinner for the Grid's number of tiles wide
(package private)  javax.swing.JButton helpBlankButton
          Help button for setting the blank tile
(package private)  javax.swing.JButton helpGridSizeButton
          Help button for setting the Grid size
(package private)  javax.swing.JButton helpTileSizeButton
          Help button for setting the Tile size
(package private)  java.util.ArrayList iconListData
          List of Icons representing the tiles added to the TileSet
(package private)  javax.swing.JDialog imageDialog
          Dialog containing the panel with the tile image the user wishes to view
(package private)  java.awt.Font labelHeaderFont
          Font used for some label headers
(package private)  java.awt.Font labelRegularFont
          Font used for most regular labels
(package private)  int maxGridSize
          Maximum size of the Grid
(package private)  int maxTileSize
          Maximum allowed size of tiles in pixels
(package private)  int minGridSize
          Minimum size of the Grid
(package private)  int minTileSize
          Minimum allowed size of tiles in pixels
(package private)  javax.swing.JTextField missingNumField
          Textfield for the number of randomly removed tiles
(package private)  javax.swing.SpinnerModel missingNumModel
          Spinner Model for the number of randomly removed tiles
(package private)  javax.swing.JSpinner missingNumSpinner
          Spinner for the number of randomly removed tiles
(package private)  javax.swing.JCheckBox missingTilesCheck
          Checkbox to enable randomly removed tiles when the set loads
(package private)  javax.swing.JTextField nameText
          Name of the TileSet
(package private)  CLIPFrame parentFrame
          The frame that the application runs in
(package private)  javax.swing.JButton removeButton
          Button used to remove the selected tile from the TileSet
(package private)  javax.swing.JMenuItem removeSelectedTileMenuItem
          Tile list context menu option of remove the selected tile from the tile list
(package private)  javax.swing.JScrollPane rulePane
          The Scroll Pane for the first tab of the Set Editor
(package private)  javax.swing.JButton selectBlankTileButton
          Button to set the seleted tile as the blank tile
(package private)  javax.swing.JMenuItem selectBlankTileMenuItem
          Tile list context menu option to set the selected tile as the blank tile
(package private)  javax.swing.ImageIcon selectedIcon
          Image of the selected tile attached to the view dialog when the user views a tile
(package private)  javax.swing.JCheckBox sessionPrintCheck
          Checkbox to allow printing from the TileSet
(package private)  Rules setRules
          The Rules object containing the information in the Set Editor dialog
(package private)  java.awt.Font textFont
          Font used for the tile listing
(package private)  javax.swing.JTextField tileHeightField
          Textfield for the Tile's pixel height
(package private)  javax.swing.SpinnerModel tileHeightModel
          Spinner Model for the Tile's pixel height
(package private)  javax.swing.JSpinner tileHeightSpinner
          Spinner for the Tile's pixel height
(package private)  javax.swing.JList tileList
          The list of tiles added to the TileSet
(package private)  javax.swing.DefaultListModel tileListModel
          List Model for the tile listing
(package private)  int tileListNum
          Number of tiles that have been added to the TileSet
(package private)  javax.swing.JPopupMenu tileListPopup
          Popup context menu for the tile list
(package private)  javax.swing.JTextField tileWidthField
          Textfield for the Tile's pixel width
(package private)  javax.swing.SpinnerModel tileWidthModel
          Spinner Model for the Tile's pixel width
(package private)  javax.swing.JSpinner tileWidthSpinner
          Spinner for the Tile's pixel width
(package private)  javax.swing.JCheckBox unusedCheck
          Checkbox to allow unused tiles (and enable the unused tile options)
(package private)  javax.swing.JCheckBox unusedDescCheck
          Checkbox to require an explanation on all unused tiles
(package private)  javax.swing.JTextField unusedNumField
          Textfield for number of unused tiles allowed
(package private)  javax.swing.SpinnerModel unusedNumModel
          Spinner Model for the number of unused tiles allowed
(package private)  javax.swing.JSpinner unusedNumSpinner
          Spinner for number of unused tiles allowed
(package private)  javax.swing.JCheckBox unusedUnlimitedCheck
          Checkbox to allow unlimited unused tiles
(package private)  javax.swing.JMenuItem viewSelectedTileMenuItem
          Tile list context menu option to view the selected tile
(package private)  javax.swing.JButton viewTileButton
          Button used to view the image of the selected tile
 
Constructor Summary
Data(CLIPFrame parent)
          Constructor sets default values, creates a new Rules object, and sets up the fonts.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent ev)
          Action listener that recieves events when the user interacts with various controls in the three tabs of the Set Editor.
private  void AddTilesToList()
          Opens up a file dialog and allows the user to add image files to the list of tiles in the set.
 void changedUpdate(javax.swing.event.DocumentEvent ev)
          (Not Used) Extends the document listener method and used to set the apply button to enabled.
(package private)  javax.swing.JPanel createArrangementOptionsPanel()
          Creates the second tab (Advanced Options) of the Set Editor.
(package private)  javax.swing.JScrollPane createRuleEditor()
          Creates the first tab (Basic Options) of the Set Editor.
(package private)  javax.swing.JPanel createTileEditor()
          Creates the third tab (Tile Editor) of the Set Editor.
 boolean duplicateNameCheck(java.lang.String name)
          Returns true if any tiles in the tile list have the same name as the passed in String.
 void insertUpdate(javax.swing.event.DocumentEvent ev)
          (Not Used) Extends the document listener method and used to set the apply button to enabled.
 void mouseClicked(java.awt.event.MouseEvent ev)
          Unused mouseClicked Event for the Data Module
 void mouseEntered(java.awt.event.MouseEvent ev)
          Unused mouseEntered Event for the Data Module
 void mouseExited(java.awt.event.MouseEvent ev)
          Unused mouseExited Event for the Data Module
 void mousePressed(java.awt.event.MouseEvent ev)
          Mouse Event that handles viewing tile images if they were double clicked in the tile list.
 void mouseReleased(java.awt.event.MouseEvent ev)
          Mouse Event that triggers the popup menu on the Windows platform (and possibly others).
private  void RemoveSelectedTilesFromList()
          Removes the selected tile(s) from the tile list in the Set Editor Tile Tab.
 void removeUpdate(javax.swing.event.DocumentEvent ev)
          (Not Used) Extends the document listener method and used to set the apply button to enabled.
 void resetValues()
          Resets all the fields in the three tabs of the Set Editor to thier default values.
 void setValues()
          Saves all the values in the Set Editor tabs to the current Rules object in this module.
 void stateChanged(javax.swing.event.ChangeEvent ev)
          Handles stateChanged events for many controls in the three Set Editor tabs.
private  void ViewSelectedTile()
          Brings up a dialog with an image of the selected tile in the Set Editor Tile Tab's tile list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parentFrame

CLIPFrame parentFrame
The frame that the application runs in


setRules

Rules setRules
The Rules object containing the information in the Set Editor dialog


buttonFont

java.awt.Font buttonFont
Font used for some buttons


labelHeaderFont

java.awt.Font labelHeaderFont
Font used for some label headers


textFont

java.awt.Font textFont
Font used for the tile listing


labelRegularFont

java.awt.Font labelRegularFont
Font used for most regular labels


rulePane

javax.swing.JScrollPane rulePane
The Scroll Pane for the first tab of the Set Editor


nameText

javax.swing.JTextField nameText
Name of the TileSet


descText

javax.swing.JTextArea descText
Description of Instructions of the TileSet


minGridSize

final int minGridSize
Minimum size of the Grid

See Also:
Constant Field Values

maxGridSize

final int maxGridSize
Maximum size of the Grid

See Also:
Constant Field Values

gridTilesWideModel

javax.swing.SpinnerModel gridTilesWideModel
Spinner Model for the Grid's number of tiles wide


gridTilesHighModel

javax.swing.SpinnerModel gridTilesHighModel
Spinner Model for the Grid's number of tiles high


gridTilesWideField

javax.swing.JTextField gridTilesWideField
Text Field for the Grid's number of tiles wide


gridTilesHighField

javax.swing.JTextField gridTilesHighField
Text Field for the Grid's number of tiles high


gridTilesWideSpinner

javax.swing.JSpinner gridTilesWideSpinner
Spinner for the Grid's number of tiles wide


gridTilesHighSpinner

javax.swing.JSpinner gridTilesHighSpinner
Spinner for the Grid's number of tiles high


helpGridSizeButton

javax.swing.JButton helpGridSizeButton
Help button for setting the Grid size


minTileSize

final int minTileSize
Minimum allowed size of tiles in pixels

See Also:
Constant Field Values

maxTileSize

final int maxTileSize
Maximum allowed size of tiles in pixels

See Also:
Constant Field Values

tileWidthModel

javax.swing.SpinnerModel tileWidthModel
Spinner Model for the Tile's pixel width


tileHeightModel

javax.swing.SpinnerModel tileHeightModel
Spinner Model for the Tile's pixel height


tileWidthField

javax.swing.JTextField tileWidthField
Textfield for the Tile's pixel width


tileHeightField

javax.swing.JTextField tileHeightField
Textfield for the Tile's pixel height


tileWidthSpinner

javax.swing.JSpinner tileWidthSpinner
Spinner for the Tile's pixel width


tileHeightSpinner

javax.swing.JSpinner tileHeightSpinner
Spinner for the Tile's pixel height


helpTileSizeButton

javax.swing.JButton helpTileSizeButton
Help button for setting the Tile size


blankNumModel

javax.swing.SpinnerModel blankNumModel
Spinner Model for number of blank tiles allowed


blankNumField

javax.swing.JTextField blankNumField
Textfield for number of blank tiles allowed


blankNumSpinner

javax.swing.JSpinner blankNumSpinner
Spinner for number of blank tiles allowed


blankUnlimitedCheck

javax.swing.JCheckBox blankUnlimitedCheck
Checkbox to allow unlimited blank tiles


blankNameCheck

javax.swing.JCheckBox blankNameCheck
Checkbox to require a name on all blank tiles


blankDescCheck

javax.swing.JCheckBox blankDescCheck
Checkbox to require a description on all blank tiles


blankCheck

javax.swing.JCheckBox blankCheck
Checkbox to allow blank tiles (and enable the blank tile options)


unusedNumModel

javax.swing.SpinnerModel unusedNumModel
Spinner Model for the number of unused tiles allowed


unusedNumField

javax.swing.JTextField unusedNumField
Textfield for number of unused tiles allowed


unusedNumSpinner

javax.swing.JSpinner unusedNumSpinner
Spinner for number of unused tiles allowed


unusedUnlimitedCheck

javax.swing.JCheckBox unusedUnlimitedCheck
Checkbox to allow unlimited unused tiles


unusedDescCheck

javax.swing.JCheckBox unusedDescCheck
Checkbox to require an explanation on all unused tiles


unusedCheck

javax.swing.JCheckBox unusedCheck
Checkbox to allow unused tiles (and enable the unused tile options)


missingNumModel

javax.swing.SpinnerModel missingNumModel
Spinner Model for the number of randomly removed tiles


missingNumField

javax.swing.JTextField missingNumField
Textfield for the number of randomly removed tiles


missingNumSpinner

javax.swing.JSpinner missingNumSpinner
Spinner for the number of randomly removed tiles


missingTilesCheck

javax.swing.JCheckBox missingTilesCheck
Checkbox to enable randomly removed tiles when the set loads


arrangementCommentCheck

javax.swing.JCheckBox arrangementCommentCheck
Checkbox to require arrangement comments when doing a complete arrangement save


sessionPrintCheck

javax.swing.JCheckBox sessionPrintCheck
Checkbox to allow printing from the TileSet


selectBlankTileButton

javax.swing.JButton selectBlankTileButton
Button to set the seleted tile as the blank tile


tileListPopup

javax.swing.JPopupMenu tileListPopup
Popup context menu for the tile list


selectBlankTileMenuItem

javax.swing.JMenuItem selectBlankTileMenuItem
Tile list context menu option to set the selected tile as the blank tile


viewSelectedTileMenuItem

javax.swing.JMenuItem viewSelectedTileMenuItem
Tile list context menu option to view the selected tile


removeSelectedTileMenuItem

javax.swing.JMenuItem removeSelectedTileMenuItem
Tile list context menu option of remove the selected tile from the tile list


tileListModel

javax.swing.DefaultListModel tileListModel
List Model for the tile listing


tileList

javax.swing.JList tileList
The list of tiles added to the TileSet


selectedIcon

javax.swing.ImageIcon selectedIcon
Image of the selected tile attached to the view dialog when the user views a tile


iconListData

java.util.ArrayList iconListData
List of Icons representing the tiles added to the TileSet


addButton

javax.swing.JButton addButton
Button used to add more tiles to the TileSet


removeButton

javax.swing.JButton removeButton
Button used to remove the selected tile from the TileSet


viewTileButton

javax.swing.JButton viewTileButton
Button used to view the image of the selected tile


tileListNum

int tileListNum
Number of tiles that have been added to the TileSet


blankList

javax.swing.JComboBox blankList
ComboBox containing the list of tiles with the highlighted tile to be used as the blank tile


blankListModel

javax.swing.DefaultComboBoxModel blankListModel
ComboBox Model for the blank tile combo box


helpBlankButton

javax.swing.JButton helpBlankButton
Help button for setting the blank tile


dialogPanel

javax.swing.JPanel dialogPanel
Panel containing the Image of the tile the user wishes to view


imageDialog

javax.swing.JDialog imageDialog
Dialog containing the panel with the tile image the user wishes to view


closeViewButton

javax.swing.JButton closeViewButton
The close button on the view tile image dialog


curDirectory

java.io.File curDirectory
Keeps track of the last directory the user used to get tile images from

Constructor Detail

Data

public Data(CLIPFrame parent)
Constructor sets default values, creates a new Rules object, and sets up the fonts.

Parameters:
parent - The frame the application runs in
Method Detail

resetValues

public void resetValues()
Resets all the fields in the three tabs of the Set Editor to thier default values.


setValues

public void setValues()
Saves all the values in the Set Editor tabs to the current Rules object in this module.


duplicateNameCheck

public boolean duplicateNameCheck(java.lang.String name)
Returns true if any tiles in the tile list have the same name as the passed in String.

Parameters:
name - Name to check for duplicates of in the tile list
Returns:
true if the name was found in the tile list
See Also:
tileListModel

AddTilesToList

private void AddTilesToList()
Opens up a file dialog and allows the user to add image files to the list of tiles in the set. If the tile doesn't match the set tile size, the system prompts the user if they wish to change the tile size but it only does so when no tiles are in the tile list. If a tile with a duplicate name is added, it prompts the user to change the name. It also displays a list of un-added tiles in the event that the user tries to add tiles that don't match the tile size but there are already tiles in the list.


RemoveSelectedTilesFromList

private void RemoveSelectedTilesFromList()
Removes the selected tile(s) from the tile list in the Set Editor Tile Tab.


ViewSelectedTile

private void ViewSelectedTile()
Brings up a dialog with an image of the selected tile in the Set Editor Tile Tab's tile list.


changedUpdate

public void changedUpdate(javax.swing.event.DocumentEvent ev)
(Not Used) Extends the document listener method and used to set the apply button to enabled.

Specified by:
changedUpdate in interface javax.swing.event.DocumentListener

insertUpdate

public void insertUpdate(javax.swing.event.DocumentEvent ev)
(Not Used) Extends the document listener method and used to set the apply button to enabled.

Specified by:
insertUpdate in interface javax.swing.event.DocumentListener

removeUpdate

public void removeUpdate(javax.swing.event.DocumentEvent ev)
(Not Used) Extends the document listener method and used to set the apply button to enabled.

Specified by:
removeUpdate in interface javax.swing.event.DocumentListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent ev)
Unused mouseClicked Event for the Data Module

Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent ev)
Unused mouseEntered Event for the Data Module

Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent ev)
Unused mouseExited Event for the Data Module

Specified by:
mouseExited in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent ev)
Mouse Event that handles viewing tile images if they were double clicked in the tile list. This also triggers the popup menu on the Mac platform (and possible others).

Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent ev)
Mouse Event that triggers the popup menu on the Windows platform (and possibly others).

Specified by:
mouseReleased in interface java.awt.event.MouseListener

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent ev)
Handles stateChanged events for many controls in the three Set Editor tabs. It determines which control caused the event and then acts accordingly.

Specified by:
stateChanged in interface javax.swing.event.ChangeListener
Parameters:
ev - The ChangeEvent

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ev)
Action listener that recieves events when the user interacts with various controls in the three tabs of the Set Editor. It determines the source of these events and then acts accordingly.

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

createRuleEditor

javax.swing.JScrollPane createRuleEditor()
Creates the first tab (Basic Options) of the Set Editor.

Returns:
Scroll Pane containing the contents of the first Set Editor tab

createArrangementOptionsPanel

javax.swing.JPanel createArrangementOptionsPanel()
Creates the second tab (Advanced Options) of the Set Editor.

Returns:
Panel containing the components of the second Set Editor tab

createTileEditor

javax.swing.JPanel createTileEditor()
Creates the third tab (Tile Editor) of the Set Editor.

Returns:
Panel containing the components of the third Set Editor tab