edu.wpi.prc.tools.builder
Class ProjectBuilder

java.lang.Object
  extended by edu.wpi.prc.tools.builder.ProjectBuilder

public class ProjectBuilder
extends java.lang.Object

This class initializes and starts the GUI used by project developers to configure their projects.

Author:
James Baldassari

Field Summary
private static ProjectBuilder builderGUI
           
static java.lang.String CLIENT_CONFIG_FILE_PATH
           
static java.lang.String DEFAULT_CONFIG_DIRECTORY
           
private static java.lang.String ERROR_ICON_FILE
           
private static int ERROR_ICON_FILE_SIZE
           
private static java.lang.String ERROR_ICON_PATH
           
private  javax.swing.Icon errorIcon
           
private static java.lang.String ICON_DIRECTORY
           
private static java.lang.String INFORMATION_ICON_FILE
           
private static int INFORMATION_ICON_FILE_SIZE
           
private static java.lang.String INFORMATION_ICON_PATH
           
private  javax.swing.Icon informationIcon
           
private  boolean newProject
           
private  Project project
           
static java.lang.String SERVER_CONFIG_FILE_PATH
           
private static java.lang.String WARNING_ICON_FILE
           
private static int WARNING_ICON_FILE_SIZE
           
private static java.lang.String WARNING_ICON_PATH
           
private  javax.swing.Icon warningIcon
           
 
Constructor Summary
ProjectBuilder()
          Default constructor.
 
Method Summary
static void addWindowCloseListener(java.awt.Window component)
          Adds a window close listener for a GUI component that causes the program to exit.
static void centerComponent(javax.swing.JFrame component)
          Determines how to center a GUI component on the screen, then displays it.
 javax.swing.Icon getErrorIcon()
           
 javax.swing.Icon getInformationIcon()
          Returns the information icon to be used in notification dialogs.
 Project getProject()
           
private  void initializeIcons()
          Attempts to read in image files to create icons.
static ProjectBuilder instance()
           
 boolean isNewProject()
           
static void main(java.lang.String[] args)
          Main control of the project builder GUI.
 void setNewProject(boolean newProject)
          Sets whether the user is creating a new project or modifying an existing project.
 void setProject(Project project)
           
static void setRelativePosition(javax.swing.JFrame child, javax.swing.JFrame parent)
          Centers a child frame relative to its parent frame.
 void showErrorDialog(java.awt.Component parentComponent, java.lang.String message)
          Displays a modal error message dialog with the specified message.
 void showInformationDialog(java.awt.Component parentComponent, java.lang.String message)
          Displays a modal information message dialog with the specified message.
 void showWarningDialog(java.awt.Component parentComponent, java.lang.String message)
          Displays a modal warning message dialog with the specified message.
static void shutdown()
          Cleanly shuts down the Builder GUI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CONFIG_DIRECTORY

public static final java.lang.String DEFAULT_CONFIG_DIRECTORY
See Also:
Constant Field Values

SERVER_CONFIG_FILE_PATH

public static final java.lang.String SERVER_CONFIG_FILE_PATH

CLIENT_CONFIG_FILE_PATH

public static final java.lang.String CLIENT_CONFIG_FILE_PATH

ICON_DIRECTORY

private static final java.lang.String ICON_DIRECTORY
See Also:
Constant Field Values

ERROR_ICON_FILE

private static final java.lang.String ERROR_ICON_FILE
See Also:
Constant Field Values

ERROR_ICON_FILE_SIZE

private static final int ERROR_ICON_FILE_SIZE
See Also:
Constant Field Values

WARNING_ICON_FILE

private static final java.lang.String WARNING_ICON_FILE
See Also:
Constant Field Values

WARNING_ICON_FILE_SIZE

private static final int WARNING_ICON_FILE_SIZE
See Also:
Constant Field Values

INFORMATION_ICON_FILE

private static final java.lang.String INFORMATION_ICON_FILE
See Also:
Constant Field Values

INFORMATION_ICON_FILE_SIZE

private static final int INFORMATION_ICON_FILE_SIZE
See Also:
Constant Field Values

ERROR_ICON_PATH

private static final java.lang.String ERROR_ICON_PATH
See Also:
Constant Field Values

WARNING_ICON_PATH

private static final java.lang.String WARNING_ICON_PATH
See Also:
Constant Field Values

INFORMATION_ICON_PATH

private static final java.lang.String INFORMATION_ICON_PATH
See Also:
Constant Field Values

builderGUI

private static ProjectBuilder builderGUI

project

private Project project

newProject

private boolean newProject

errorIcon

private javax.swing.Icon errorIcon

warningIcon

private javax.swing.Icon warningIcon

informationIcon

private javax.swing.Icon informationIcon
Constructor Detail

ProjectBuilder

public ProjectBuilder()
Default constructor. Reads in images and builds icons from them.

Method Detail

initializeIcons

private void initializeIcons()
Attempts to read in image files to create icons. If there is a problem reading the files, the default Java icons are used.


getProject

public Project getProject()
Returns:
Returns the project.

setProject

public void setProject(Project project)
Parameters:
project - The project to set.

isNewProject

public boolean isNewProject()
Returns:
Returns true if the user is creating a new project, false if modifying an existing project.

getErrorIcon

public javax.swing.Icon getErrorIcon()
Returns:
Returns the error icon to be used in error dialogs.

getInformationIcon

public javax.swing.Icon getInformationIcon()
Returns the information icon to be used in notification dialogs.


setNewProject

public void setNewProject(boolean newProject)
Sets whether the user is creating a new project or modifying an existing project.

Parameters:
newProject - True if the user is creating a new project, false if modifying an existing project.

centerComponent

public static void centerComponent(javax.swing.JFrame component)
Determines how to center a GUI component on the screen, then displays it.

Parameters:
component - The component to center.

setRelativePosition

public static void setRelativePosition(javax.swing.JFrame child,
                                       javax.swing.JFrame parent)
Centers a child frame relative to its parent frame.

Parameters:
child - The child frame.
parent - The parent frame.

addWindowCloseListener

public static void addWindowCloseListener(java.awt.Window component)
Adds a window close listener for a GUI component that causes the program to exit.

Parameters:
component - The component to which to add the listener.

showErrorDialog

public void showErrorDialog(java.awt.Component parentComponent,
                            java.lang.String message)
Displays a modal error message dialog with the specified message.

Parameters:
parentComponent - The component that created this dialog.
message - The message to display.

showWarningDialog

public void showWarningDialog(java.awt.Component parentComponent,
                              java.lang.String message)
Displays a modal warning message dialog with the specified message.

Parameters:
parentComponent - The component that created this dialog.
message - The message to display.

showInformationDialog

public void showInformationDialog(java.awt.Component parentComponent,
                                  java.lang.String message)
Displays a modal information message dialog with the specified message.

Parameters:
parentComponent - The component that created this dialog.
message - The message to display.

shutdown

public static void shutdown()
Cleanly shuts down the Builder GUI.


instance

public static ProjectBuilder instance()
Returns:
Returns the singleton instance of this class.

main

public static void main(java.lang.String[] args)
Main control of the project builder GUI.

Parameters:
args - Command-line arguments.