edu.kzoo.grid.gui
Class GridCreationDialog

java.lang.Object
  |
  +--edu.kzoo.grid.gui.GridCreationDialog

public class GridCreationDialog
extends java.lang.Object

Grid GUI Support Package:
A GridCreationDialog is a dialog that allows the user to construct a new grid, choosing its type (bounded or unbounded) and, if appropriate, its dimensions.

Version:
15 December 2003
Author:
Alyce Brady (based on code by Julie Zelenski)

Constructor Summary
protected GridCreationDialog(javax.swing.JFrame parent, boolean promptForGridChoice)
          Creates a dialog that allows the user to choose the type of grid to create and/or its dimensions.
 
Method Summary
static GridCreationDialog makeDimensionsDialog(javax.swing.JFrame parent)
          Creates a dialog that creates a BoundedGrid object after prompting the user for its dimensions.
static GridCreationDialog makeGridChoiceDialog(javax.swing.JFrame parent)
          Creates a dialog that allows the user to choose the type of grid to create and, if appropriate, its dimensions.
 Grid showDialog()
          Shows the modal dialog that allows the user to create a new grid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GridCreationDialog

protected GridCreationDialog(javax.swing.JFrame parent,
                             boolean promptForGridChoice)
Creates a dialog that allows the user to choose the type of grid to create and/or its dimensions.

Parameters:
parent - parent frame for the dialog
promptForGridChoice - true if dialog should prompt for choice of grid representation; false if it should always create a BoundedGrid grid
Method Detail

makeDimensionsDialog

public static GridCreationDialog makeDimensionsDialog(javax.swing.JFrame parent)
Creates a dialog that creates a BoundedGrid object after prompting the user for its dimensions.

Parameters:
parent - parent frame for the dialog
Returns:
a dialog that will prompt for bounded grid dimensions and then create the grid

makeGridChoiceDialog

public static GridCreationDialog makeGridChoiceDialog(javax.swing.JFrame parent)
Creates a dialog that allows the user to choose the type of grid to create and, if appropriate, its dimensions. The set of grid classes available to choose from depends on whether the application has registered grid classes with the GridPkgFactory. If any bounded grid classes have been registered with the GridPkgFactory, then the dialog will include them in the set of options. Otherwise, it will include BoundedGrid as its only bounded grid. Similarly, if any unbounded grid classes have been registered with the GridPkgFactory, then the dialog will include them in the set of options. Otherwise, it will include UnboundedArrayListGrid as its only unbounded grid. BoundedGrid and UnboundedArrayListGrid must explicitly be registered with the GridPkgFactory to appear along with other options from the factory.

Parameters:
parent - parent frame for the dialog
Returns:
a dialog that prompts for an Grid representation

showDialog

public Grid showDialog()
Shows the modal dialog that allows the user to create a new grid. If the dialog is dismissed by clicking the "OK" button, a new grid is created to the user's specification and returned. If "Cancel" is chosen or there is an error constructing the grid, null is returned.

Returns:
the newly created grid or null