view
Class CreateEnvDialog

java.lang.Object
  extended by view.CreateEnvDialog

public class CreateEnvDialog
extends java.lang.Object

Dialog to create new environment.

Author:
Mathias Ricken

Nested Class Summary
private  class CreateEnvDialog.AddEnvChoice
          Nested class for adding an environment.
private static class CreateEnvDialog.ConcreteEnvChoice
          Nested class for choosing an environment.
private static interface CreateEnvDialog.IEnvChoice
          Nested interface for environment choices.
 
Field Summary
private  javax.swing.JDialog _dialog
          Environment dialog.
private  IEnvAdapter _envAdapter
          Adpapter to the model for dealing with environments.
private  javax.swing.JComboBox _envChooser
          Combobox containing the different choices for the environment.
private  AEnvFactory _envFactory
          Environment factory to be used for creating the environment.
private  javax.swing.JButton[] _optButtons
          Array of buttons on the dialog.
private  javax.swing.JPanel _optionsPanel
          Panel for the environment options.
private static int CANCEL_BUTTON
          Constant to access the cancel button in _optButtons.
private static int CREATE_BUTTON
          Constant to access the create button in _optButtons.
 
Constructor Summary
CreateEnvDialog(javax.swing.JFrame parent, IEnvAdapter ea)
          Creates a new CreateEnvDialog and all its controls.
 
Method Summary
private  void addEnvSettings(AEnvFactory factory)
          Add environment factory to dialog.
private  void cancelClicked()
          Callback when user clicks cancel button.
private  void envChosen()
          Callback when user selects new environment class choice from combo box.
private  javax.swing.JOptionPane makeOptionsPanel()
          Build options dialog.
private  void okClicked()
          Callback when user clicks ok button.
private  void removeEnvSettings()
          Remove environment settings from dialog.
 AEnvFactory showDialog()
          Show the modal dialog that allows the user to create a new environment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_envFactory

private AEnvFactory _envFactory
Environment factory to be used for creating the environment. This acts both as the factory and as the GUI panel with the environment settings.


_envChooser

private javax.swing.JComboBox _envChooser
Combobox containing the different choices for the environment.


_dialog

private javax.swing.JDialog _dialog
Environment dialog. This component contains everything else.


_optButtons

private javax.swing.JButton[] _optButtons
Array of buttons on the dialog.


CREATE_BUTTON

private static final int CREATE_BUTTON
Constant to access the create button in _optButtons.

See Also:
Constant Field Values

CANCEL_BUTTON

private static final int CANCEL_BUTTON
Constant to access the cancel button in _optButtons.

See Also:
Constant Field Values

_optionsPanel

private javax.swing.JPanel _optionsPanel
Panel for the environment options. Contains the environment factory.


_envAdapter

private IEnvAdapter _envAdapter
Adpapter to the model for dealing with environments.

Constructor Detail

CreateEnvDialog

public CreateEnvDialog(javax.swing.JFrame parent,
                       IEnvAdapter ea)
Creates a new CreateEnvDialog and all its controls.

Parameters:
parent - parent frame for the dialog
ea - environment adapter
Method Detail

showDialog

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

Returns:
the newly created Environment or null

removeEnvSettings

private void removeEnvSettings()
Remove environment settings from dialog.


addEnvSettings

private void addEnvSettings(AEnvFactory factory)
Add environment factory to dialog.

Parameters:
factory - factory to add

envChosen

private void envChosen()
Callback when user selects new environment class choice from combo box.


cancelClicked

private void cancelClicked()
Callback when user clicks cancel button.


okClicked

private void okClicked()
Callback when user clicks ok button.


makeOptionsPanel

private javax.swing.JOptionPane makeOptionsPanel()
Build options dialog.

Returns:
options pane