/*
 * ScriptBuilderFrame.java
 *
 * Created on May 8, 2010, 12:01:46 PM
 */
package scriptbuilder.gui;

import java.awt.Adjustable;
import java.awt.Color;
import java.awt.Desktop;
import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Observable;
import java.util.Observer;
import java.util.Properties;
import java.util.Random;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListModel;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.event.ChangeEvent;
import javax.swing.JColorChooser;
import javax.swing.colorchooser.AbstractColorChooserPanel;
import javax.swing.JPanel;
import scriptbuilder.gui.panels.IncidentTimelinePanel;
import scriptbuilder.structures.ScriptEvent;
import scriptbuilder.structures.ScriptEvent.ScriptEventType;
import scriptbuilder.structures.ScriptIncident;
import scriptbuilder.structures.ScriptIncident.IncidentFocusedEvent;
import scriptbuilder.structures.ScriptIncident.SliceChangedEvent;
import scriptbuilder.structures.SimulationScript;
import scriptbuilder.structures.TimeSlice;
import scriptbuilder.structures.events.I_ScriptEvent;
import scriptbuilder.structures.CadData;

/**
 * GUI for the script builder. Contains all panels and editor elements. Performs
 * updates to reflect script model, which it observes.
 *
 * @author Greg Eddington
 * @author Bryan McGuffin
 */
public class ScriptBuilderFrame extends javax.swing.JFrame implements Observer
{
    private final static String kUnitsFilename = "resources/units_template.xml";
    /**
     * The script model.
     */
    private SimulationScript script;
    /**
     * The current type of selected event.
     */
    public ScriptEventType currentEventType;
    /**
     * True if we are currently editing an incident.
     */
    private boolean editingIncident;
    /**
     * Index of the previous incident.
     */
    private int oldIncidentIndex;
    /**
     * incident color
     */
    private Color selectedColor;

    /**
     * Get the script currently in use.
     *
     * @return the script model object
     */
    public SimulationScript getScript()
    {
        return script;
    }

    /**
     * Listener for the scroll pane.
     */
    class MyAdjustmentListener implements AdjustmentListener
    {

        /**
         * If the incident timeline is scrolled horizontally, the timestamp
         * panel is updated to reflect it.
         *
         * @param evt the adjustment event
         */
        @Override
        public void adjustmentValueChanged(AdjustmentEvent evt)
        {
            if (evt.getAdjustable().getOrientation() == Adjustable.HORIZONTAL)
            {
                timeStampScrollPane.getHorizontalScrollBar()
                        .setValue(timelinesScrollPane.getHorizontalScrollBar().getValue());
            }
            else
            {
                // Event from vertical scrollbar
            }

            repaint();
        }
    }

    /**
     * Listener for key presses. Used for hotkeys for different event types.
     */
    private class TimelineKeyListener implements KeyListener
    {

        /**
         * If a hotkey is pressed, select that type of event.
         *
         * @param e the key event
         */
        @Override
        public void keyPressed(KeyEvent e)
        {
            repaint();
        }

        /**
         * Take no action upon key release.
         *
         * @param e the key event
         */
        @Override
        public void keyReleased(KeyEvent e)
        {
        }

        /**
         * Take no action upon key release.
         *
         * @param e the key event
         */
        @Override
        public void keyTyped(KeyEvent e)
        {
        }
    }

    /**
     * Constructor. Prep new script model, initialize the GUI, and add listeners
     * for all buttons.
     */
    public ScriptBuilderFrame()
    {
        script = new SimulationScript();
        script.addObserver(this);
        initComponents();
        loadCHPunits();
        addCustomListeners();
        //add to listener helper method
        
        
        
        //We don't currently want the button to be present in this window
        btnAddTime.setVisible(false);
        this.update(null, script);

        // Hack to refresh the zoom
        /*
         zoomSlider.setValue(zoomSlider.getValue() - 1);
         zoomSlider.setValue(zoomSlider.getValue() + 1);
         */
        // Set listener for scroll pane
        
        
        AdjustmentListener listener = new MyAdjustmentListener();
        timelinesScrollPane.getHorizontalScrollBar().addAdjustmentListener(listener);
        timelinesScrollPane.getVerticalScrollBar().addAdjustmentListener(listener);
        repaint();

    }
    /** Load the template file of standard CHP units into the script.
     *  These units generally appear before any script events.
     */
    private void loadCHPunits()
    {
        // Read the file of CHP unit names
        // This works within NetBeans or it can be run from the Jar file.
        URL url = this.getClass().getResource("/"+kUnitsFilename);
        InputStream inStream;
        try {
            inStream = url.openStream();
            script.loadUnitsFromFile(inStream);
        } catch (IOException ex) {
            Logger.getLogger(ScriptBuilderFrame.class.getName()).log(Level.SEVERE, null, ex);
        }   
    }
    /**
     * Put all custom non-generated listeners in this method
     */
    private void addCustomListeners(){



        //listener for window closing
        this.addWindowListener(new WindowAdapter(){
            @Override
            public void windowClosing(WindowEvent e)
            {
                //System.out.println("Window is closing!" + saved);

                if(!script.saved){
                    //System.out.println("window was not saved!");
                    Object[] options = {"Yes","No","Cancel"};
                    int result = JOptionPane.showOptionDialog(null,"Would you like to save changes before exiting?",
                            "Exit",
                            JOptionPane.YES_NO_CANCEL_OPTION,
                            JOptionPane.QUESTION_MESSAGE,
                            null,
                            options,
                            options[2]);
                    switch (result){
                        //should save script then close
                        case 0:
                            fileSaveActionPerformed(null);
                            //System.exit(0);
                            break;
                        // should just exit
                        case 1:
                            System.exit(0);
                            break;
                        // should do nothing
                        case 2:
                            break;
                        default:
                            break;
                    }
                    
                    
                    
                }else{
                    //should close current window since it is saved already
                    System.exit(0);
                }
            }
        });
    }

    /**
     * Update the GUI to reflect the model. If the script changed, update all
     * the incident panels. If a timeslice changed, add any new events to the
     * model. If an incident gained focus, update the incident info screen to
     * display its details.
     *
     * @param o The observed object
     * @param arg Either the script model or an incident event, depending on who
     * called this update
     */
    @Override
    public void update(Observable o, Object arg)
    {
        checkNeedsSave();
        if (arg instanceof SimulationScript)
        {
            
            script = (SimulationScript) arg;

            //If we don't have exactly 10 events something is wrong
            if (script.incidents.size() != 10)
            {
                return;
            }

            //Call update on major panels
            timelineTickPanel.update(script);
            timeStampPanel.update(script);

            //Call update on all timeline panels
            incidentTimelinePanel1.timelinePanelUpdate(script.incidents.get(0));
            incidentTimelinePanel2.timelinePanelUpdate(script.incidents.get(1));
            incidentTimelinePanel3.timelinePanelUpdate(script.incidents.get(2));
            incidentTimelinePanel4.timelinePanelUpdate(script.incidents.get(3));
            incidentTimelinePanel5.timelinePanelUpdate(script.incidents.get(4));
            incidentTimelinePanel6.timelinePanelUpdate(script.incidents.get(5));
            incidentTimelinePanel7.timelinePanelUpdate(script.incidents.get(6));
            incidentTimelinePanel8.timelinePanelUpdate(script.incidents.get(7));
            incidentTimelinePanel9.timelinePanelUpdate(script.incidents.get(8));
            incidentTimelinePanel10.timelinePanelUpdate(script.incidents.get(9));

            //Cal update on number panels
            incidentNumberPanel1.update(script.incidents.get(0));
            incidentNumberPanel2.update(script.incidents.get(1));
            incidentNumberPanel3.update(script.incidents.get(2));
            incidentNumberPanel4.update(script.incidents.get(3));
            incidentNumberPanel5.update(script.incidents.get(4));
            incidentNumberPanel6.update(script.incidents.get(5));
            incidentNumberPanel7.update(script.incidents.get(6));
            incidentNumberPanel8.update(script.incidents.get(7));
            incidentNumberPanel9.update(script.incidents.get(8));
            incidentNumberPanel10.update(script.incidents.get(9));

            /**
             * DefaultComboBoxModel model = new DefaultComboBoxModel(); for
             * (ScriptIncident i : script.incidents) { if (i != null)
             * model.addElement(i); } gotoIncident.setModel(model);*
             */
            
            this.setPreferredSize(this.getSize());
            pack();
            
        }
        //Mouse has changed focus to a different timeslice
        else if (arg instanceof SliceChangedEvent)
        {
            TimeSlice slice = ((SliceChangedEvent) arg).slice;

            DefaultListModel model = new DefaultListModel();
            for (I_ScriptEvent e : slice.events)
            {
                model.addElement(e);
            }
            
            
            
        }
        //Mouse has changed focus to a different incident timeline panel 
        else if (arg instanceof IncidentFocusedEvent)
        {
            ScriptIncident i = ((IncidentFocusedEvent) arg).incident;

            //gotoIncident.setSelectedItem(i);
            
        }

        //Regardless of update type, refresh window by doing these things:
        //Enable "+15:00" button if script is not empty
        btnAddTime.setEnabled(script != null && script.numberOfIncidents > 0);

        //enable zoom slider if script is not empty
        zoomSlider.setEnabled(script != null && script.numberOfIncidents > 0);

        //scale the zoom slider such that the most zoomed-out point allows the
        //entire script to be visible at once
        
        //todo: interpret these two calls and make them so that they are more accurate to fit the entire window at once
        zoomSlider.setMinimum(((timelineTickPanel.getVisibleRect().width - 20)
                * ScriptBuilderGuiConstants.HORIZONTAL_TICK_RESOLUTION)
                / Math.max(script.absoluteLength(), ScriptBuilderGuiConstants.TICK_TIMELINE_SMALLEST_LENGTH));
        zoomSlider.setMaximum(zoomSlider.getMinimum() + 20);
        
        repaint();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        incidentPopupMenu = new javax.swing.JPopupMenu();
        popupDeleteIncident = new javax.swing.JMenuItem();
        eventPopupMenu = new javax.swing.JPopupMenu();
        cadEvent = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        radioEvent = new javax.swing.JMenuItem();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenuItem5 = new javax.swing.JMenuItem();
        jMenuItem6 = new javax.swing.JMenuItem();
        cadEventFrame = new javax.swing.JFrame();
        labelCADEntry = new javax.swing.JLabel();
        radioEventFrame = new javax.swing.JFrame();
        labelRadioType = new javax.swing.JLabel();
        labelRadioMessage = new javax.swing.JLabel();
        radioTypeComboBox = new javax.swing.JComboBox();
        radioMessageScrollPane = new javax.swing.JScrollPane();
        radioMessage = new javax.swing.JTextArea();
        okButton = new javax.swing.JButton();
        cancelButton = new javax.swing.JButton();
        eventListPopupMenu = new javax.swing.JPopupMenu();
        editEventList = new javax.swing.JMenuItem();
        deleteEventList = new javax.swing.JMenuItem();
        incidentFrame = new javax.swing.JFrame();
        labelIncidentNumber = new javax.swing.JLabel();
        labelIncidentName = new javax.swing.JLabel();
        labelIncidentColor = new javax.swing.JLabel();
        labelIncidentDescription = new javax.swing.JLabel();
        incidentPropertiesScrollPane = new javax.swing.JScrollPane();
        addIncidentDescription = new javax.swing.JTextArea();
        incidentOkButton = new javax.swing.JButton();
        incidentCancelButton = new javax.swing.JButton();
        addIncidentNumber = new javax.swing.JSpinner();
        addIncidentName = new javax.swing.JTextField();
        labelIncidentLength = new javax.swing.JLabel();
        labelIncidentStart = new javax.swing.JLabel();
        addIncidentStart = new javax.swing.JSpinner();
        incidentColorField = new javax.swing.JTextField();
        txtIncidentLength = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        addIncidentLocation = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        addIncidentType = new javax.swing.JTextField();
        colorComboBox = new javax.swing.JComboBox<>();
        addNoiseFrame = new javax.swing.JFrame();
        labelRadioChatter = new javax.swing.JLabel();
        radioChatterSlider = new javax.swing.JSlider();
        laneClosuresSlider = new javax.swing.JSlider();
        labelLaneClosures = new javax.swing.JLabel();
        TMCALSlider = new javax.swing.JSlider();
        labelTMCALLogs = new javax.swing.JLabel();
        txtNoiseDescription = new javax.swing.JTextArea();
        backgroundNoiseSlider = new javax.swing.JSlider();
        labelBackgroundNoise = new javax.swing.JLabel();
        minorEventsSlider = new javax.swing.JSlider();
        labelMinorEvents = new javax.swing.JLabel();
        btnCancelNoise = new javax.swing.JButton();
        btnGenerateNoise = new javax.swing.JButton();
        labelLeastFreq = new javax.swing.JLabel();
        labelMostFreq = new javax.swing.JLabel();
        incidentColorChooser = new javax.swing.JColorChooser();
        timelinesScrollPane = new javax.swing.JScrollPane();
        timelineTickPanel = new scriptbuilder.gui.panels.TimelineTickPanel();
        incidentTimelinePanel1 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
        incidentTimelinePanel2 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
        incidentTimelinePanel8 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
        incidentTimelinePanel3 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
        incidentTimelinePanel6 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
        incidentTimelinePanel5 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
        incidentTimelinePanel4 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
        incidentTimelinePanel7 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
        incidentTimelinePanel10 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
        incidentTimelinePanel9 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
        incidentNumberPanel1 = new scriptbuilder.gui.panels.IncidentNumberPanel();
        incidentNumberPanel2 = new scriptbuilder.gui.panels.IncidentNumberPanel();
        incidentNumberPanel3 = new scriptbuilder.gui.panels.IncidentNumberPanel();
        incidentNumberPanel4 = new scriptbuilder.gui.panels.IncidentNumberPanel();
        incidentNumberPanel5 = new scriptbuilder.gui.panels.IncidentNumberPanel();
        incidentNumberPanel6 = new scriptbuilder.gui.panels.IncidentNumberPanel();
        incidentNumberPanel7 = new scriptbuilder.gui.panels.IncidentNumberPanel();
        incidentNumberPanel8 = new scriptbuilder.gui.panels.IncidentNumberPanel();
        incidentNumberPanel9 = new scriptbuilder.gui.panels.IncidentNumberPanel();
        incidentNumberPanel10 = new scriptbuilder.gui.panels.IncidentNumberPanel();
        zoomSlider = new javax.swing.JSlider();
        zoomInIcon = new javax.swing.JLabel();
        zoomOutIcon = new javax.swing.JLabel();
        timeStampScrollPane = new javax.swing.JScrollPane();
        timeStampPanel = new scriptbuilder.gui.panels.TimeStampPanel();
        btnAddTime = new javax.swing.JButton();
        scriptBuilderMenuBar = new javax.swing.JMenuBar();
        fileMenu = new javax.swing.JMenu();
        fileNew = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        fileOpen = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JPopupMenu.Separator();
        fileSave = new javax.swing.JMenuItem();
        fileSaveAs = new javax.swing.JMenuItem();
        generateMenu = new javax.swing.JMenu();
        generateNotebooks = new javax.swing.JMenuItem();
        generateWebNotebook = new javax.swing.JMenuItem();
        generateScorecards = new javax.swing.JMenuItem();
        generateOrganizationChart = new javax.swing.JMenuItem();
        jSeparator3 = new javax.swing.JPopupMenu.Separator();
        generateProjectRequirements = new javax.swing.JMenuItem();
        incidentMenu = new javax.swing.JMenu();
        newIncident = new javax.swing.JMenuItem();
        deleteIncident = new javax.swing.JMenuItem();
        deleteIncident1 = new javax.swing.JMenuItem();
        jSeparator4 = new javax.swing.JPopupMenu.Separator();
        saveIncident = new javax.swing.JMenuItem();
        loadIncident = new javax.swing.JMenuItem();
        generateNoiseMenu = new javax.swing.JMenu();
        generateNoiseOption = new javax.swing.JMenuItem();
        helpMenu1 = new javax.swing.JMenu();
        loadUnits = new javax.swing.JMenuItem();
        helpMenu = new javax.swing.JMenu();
        helpTutorial = new javax.swing.JMenuItem();
        helpAbout = new javax.swing.JMenuItem();

        popupDeleteIncident.setText("Delete Incident...");
        popupDeleteIncident.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                popupDeleteIncidentActionPerformed(evt);
            }
        });
        incidentPopupMenu.add(popupDeleteIncident);

        cadEvent.setText("CAD Event");
        cadEvent.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                cadEventMousePressed(evt);
            }
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                cadEventMouseReleased(evt);
            }
        });
        cadEvent.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cadEventActionPerformed(evt);
            }
        });
        eventPopupMenu.add(cadEvent);

        jMenuItem2.setText("Paramics Event");
        eventPopupMenu.add(jMenuItem2);

        radioEvent.setText("Radio Event");
        radioEvent.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                radioEventMousePressed(evt);
            }
        });
        eventPopupMenu.add(radioEvent);

        jMenuItem4.setText("Telephone Event");
        eventPopupMenu.add(jMenuItem4);

        jMenuItem5.setText("Video Event");
        eventPopupMenu.add(jMenuItem5);

        jMenuItem6.setText("Evaluation Event");
        eventPopupMenu.add(jMenuItem6);

        cadEventFrame.setMinimumSize(new java.awt.Dimension(400, 300));

        labelCADEntry.setText("CAD Entry");

        javax.swing.GroupLayout cadEventFrameLayout = new javax.swing.GroupLayout(cadEventFrame.getContentPane());
        cadEventFrame.getContentPane().setLayout(cadEventFrameLayout);
        cadEventFrameLayout.setHorizontalGroup(
            cadEventFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(cadEventFrameLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(labelCADEntry, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        cadEventFrameLayout.setVerticalGroup(
            cadEventFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(cadEventFrameLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(labelCADEntry)
                .addContainerGap(1357, Short.MAX_VALUE))
        );

        radioEventFrame.setTitle("Add Radio Event");
        radioEventFrame.setMinimumSize(new java.awt.Dimension(400, 300));

        labelRadioType.setText("Radio Type:");

        labelRadioMessage.setText("Radio Message:");

        radioTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "TMT", "Maintanence" }));

        radioMessageScrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

        radioMessage.setColumns(20);
        radioMessage.setLineWrap(true);
        radioMessage.setRows(5);
        radioMessage.setWrapStyleWord(true);
        radioMessageScrollPane.setViewportView(radioMessage);

        okButton.setText("OK");
        okButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                okButtonActionPerformed(evt);
            }
        });

        cancelButton.setText("Cancel");
        cancelButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout radioEventFrameLayout = new javax.swing.GroupLayout(radioEventFrame.getContentPane());
        radioEventFrame.getContentPane().setLayout(radioEventFrameLayout);
        radioEventFrameLayout.setHorizontalGroup(
            radioEventFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, radioEventFrameLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(radioEventFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(radioMessageScrollPane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, radioEventFrameLayout.createSequentialGroup()
                        .addComponent(labelRadioType)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(radioTypeComboBox, 0, 312, Short.MAX_VALUE))
                    .addComponent(labelRadioMessage, javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, radioEventFrameLayout.createSequentialGroup()
                        .addComponent(cancelButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 246, Short.MAX_VALUE)
                        .addComponent(okButton, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        radioEventFrameLayout.setVerticalGroup(
            radioEventFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(radioEventFrameLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(radioEventFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelRadioType)
                    .addComponent(radioTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(labelRadioMessage)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(radioMessageScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 198, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(radioEventFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(okButton)
                    .addComponent(cancelButton))
                .addContainerGap())
        );

        editEventList.setText("Edit...");
        editEventList.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                editEventListActionPerformed(evt);
            }
        });
        eventListPopupMenu.add(editEventList);

        deleteEventList.setText("Delete...");
        eventListPopupMenu.add(deleteEventList);

        incidentFrame.setTitle("Incident Properties");
        incidentFrame.setMinimumSize(new java.awt.Dimension(400, 400));

        labelIncidentNumber.setText("Incident Number: ");

        labelIncidentName.setText("Incident Name:");

        labelIncidentColor.setText("Incident Color: ");

        labelIncidentDescription.setText("Incident Description:");

        incidentPropertiesScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        incidentPropertiesScrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

        addIncidentDescription.setColumns(20);
        addIncidentDescription.setLineWrap(true);
        addIncidentDescription.setRows(5);
        addIncidentDescription.setWrapStyleWord(true);
        incidentPropertiesScrollPane.setViewportView(addIncidentDescription);

        incidentOkButton.setText("OK");
        incidentOkButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                incidentOkButtonActionPerformed(evt);
            }
        });

        incidentCancelButton.setText("Cancel");
        incidentCancelButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                incidentCancelButtonActionPerformed(evt);
            }
        });

        addIncidentNumber.setModel(new javax.swing.SpinnerNumberModel(101, 101, null, 1));

        addIncidentName.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addIncidentNameActionPerformed(evt);
            }
        });

        labelIncidentLength.setText("Incident Length in Minutes: ");

        labelIncidentStart.setText("Incident Start Time in Minutes:");

        addIncidentStart.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1));

        incidentColorField.setEditable(false);
        incidentColorField.setBackground(new java.awt.Color(0, 0, 0));

        txtIncidentLength.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        txtIncidentLength.setText("0");
        txtIncidentLength.setToolTipText("");

        jLabel1.setText("Incident Location:");

        addIncidentLocation.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addIncidentLocationActionPerformed(evt);
            }
        });

        jLabel2.setText("Incident Type:");

        colorComboBox.setModel(new DefaultComboBoxModel(SimulationScript.colorNames));
        colorComboBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                colorSelectedHandler(evt);
            }
        });

        javax.swing.GroupLayout incidentFrameLayout = new javax.swing.GroupLayout(incidentFrame.getContentPane());
        incidentFrame.getContentPane().setLayout(incidentFrameLayout);
        incidentFrameLayout.setHorizontalGroup(
            incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(incidentFrameLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(incidentPropertiesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 322, Short.MAX_VALUE)
                    .addGroup(incidentFrameLayout.createSequentialGroup()
                        .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(labelIncidentNumber)
                            .addComponent(labelIncidentName)
                            .addComponent(labelIncidentColor))
                        .addGap(66, 66, 66)
                        .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(addIncidentName, javax.swing.GroupLayout.DEFAULT_SIZE, 199, Short.MAX_VALUE)
                            .addComponent(addIncidentNumber, javax.swing.GroupLayout.DEFAULT_SIZE, 199, Short.MAX_VALUE)
                            .addGroup(incidentFrameLayout.createSequentialGroup()
                                .addComponent(incidentColorField, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(colorComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                    .addGroup(incidentFrameLayout.createSequentialGroup()
                        .addComponent(incidentCancelButton)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 188, Short.MAX_VALUE)
                        .addComponent(incidentOkButton, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(incidentFrameLayout.createSequentialGroup()
                        .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(labelIncidentStart)
                            .addComponent(labelIncidentLength))
                        .addGap(18, 18, 18)
                        .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(incidentFrameLayout.createSequentialGroup()
                                .addGap(6, 6, 6)
                                .addComponent(txtIncidentLength, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addGap(22, 22, 22))
                            .addComponent(addIncidentStart, javax.swing.GroupLayout.DEFAULT_SIZE, 158, Short.MAX_VALUE)))
                    .addGroup(incidentFrameLayout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addGap(93, 93, 93)
                        .addComponent(addIncidentType))
                    .addGroup(incidentFrameLayout.createSequentialGroup()
                        .addComponent(labelIncidentDescription)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(incidentFrameLayout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addGap(69, 69, 69)
                        .addComponent(addIncidentLocation)))
                .addContainerGap())
        );
        incidentFrameLayout.setVerticalGroup(
            incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(incidentFrameLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelIncidentNumber)
                    .addComponent(addIncidentNumber, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelIncidentName)
                    .addComponent(addIncidentName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelIncidentColor)
                    .addComponent(incidentColorField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(colorComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(addIncidentLocation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(addIncidentType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(labelIncidentDescription)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(incidentPropertiesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 132, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(addIncidentStart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelIncidentStart))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelIncidentLength)
                    .addComponent(txtIncidentLength))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(incidentCancelButton)
                    .addComponent(incidentOkButton))
                .addContainerGap())
        );

        addNoiseFrame.setTitle("Generate Noise");
        addNoiseFrame.setMinimumSize(new java.awt.Dimension(395, 315));
        addNoiseFrame.setResizable(false);

        labelRadioChatter.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        labelRadioChatter.setText("Radio Chatter: ");

        labelLaneClosures.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        labelLaneClosures.setText("Lane Closures:");

        labelTMCALLogs.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        labelTMCALLogs.setText("TMCAL Logs:");

        txtNoiseDescription.setEditable(false);
        txtNoiseDescription.setColumns(20);
        txtNoiseDescription.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        txtNoiseDescription.setLineWrap(true);
        txtNoiseDescription.setRows(5);
        txtNoiseDescription.setText("Noise events will be randomly generated for the simulation with frequencies based on the control selections made below");
        txtNoiseDescription.setWrapStyleWord(true);
        txtNoiseDescription.setAutoscrolls(false);
        txtNoiseDescription.setBorder(null);
        txtNoiseDescription.setDisabledTextColor(new java.awt.Color(0, 0, 0));
        txtNoiseDescription.setFocusable(false);
        txtNoiseDescription.setOpaque(false);

        labelBackgroundNoise.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        labelBackgroundNoise.setText("Background Noise: ");

        labelMinorEvents.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        labelMinorEvents.setText("Minor Events:");

        btnCancelNoise.setText("Cancel");
        btnCancelNoise.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelNoiseActionPerformed(evt);
            }
        });

        btnGenerateNoise.setText("Generate");
        btnGenerateNoise.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnGenerateNoiseActionPerformed(evt);
            }
        });

        labelLeastFreq.setText("Least Frequent");

        labelMostFreq.setText("Most Frequent");

        javax.swing.GroupLayout addNoiseFrameLayout = new javax.swing.GroupLayout(addNoiseFrame.getContentPane());
        addNoiseFrame.getContentPane().setLayout(addNoiseFrameLayout);
        addNoiseFrameLayout.setHorizontalGroup(
            addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, addNoiseFrameLayout.createSequentialGroup()
                .addContainerGap(21, Short.MAX_VALUE)
                .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(txtNoiseDescription, javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, addNoiseFrameLayout.createSequentialGroup()
                            .addComponent(btnCancelNoise)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(btnGenerateNoise))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, addNoiseFrameLayout.createSequentialGroup()
                            .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(labelBackgroundNoise)
                                    .addComponent(labelLaneClosures, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(labelTMCALLogs, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(labelRadioChatter, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addComponent(labelMinorEvents, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGap(4, 4, 4)
                            .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(radioChatterSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(laneClosuresSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(TMCALSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(minorEventsSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(backgroundNoiseSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, addNoiseFrameLayout.createSequentialGroup()
                                    .addComponent(labelLeastFreq)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(labelMostFreq))))))
                .addGap(20, 20, 20))
        );
        addNoiseFrameLayout.setVerticalGroup(
            addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, addNoiseFrameLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(txtNoiseDescription, javax.swing.GroupLayout.DEFAULT_SIZE, 39, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(labelMostFreq)
                    .addComponent(labelLeastFreq))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(labelRadioChatter, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(radioChatterSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(labelLaneClosures, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(laneClosuresSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(labelTMCALLogs)
                    .addComponent(TMCALSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(backgroundNoiseSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelBackgroundNoise, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(minorEventsSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelMinorEvents))
                .addGap(18, 18, 18)
                .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnCancelNoise)
                    .addComponent(btnGenerateNoise))
                .addContainerGap())
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setTitle("Script Builder");
        setBounds(new java.awt.Rectangle(0, 23, 800, 700));
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        setMinimumSize(new java.awt.Dimension(800, 700));

        timelinesScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        timelinesScrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
        timelinesScrollPane.setFocusCycleRoot(true);
        timelinesScrollPane.setFocusTraversalPolicyProvider(true);
        timelinesScrollPane.setPreferredSize(new java.awt.Dimension(72000, 1341));
        timelinesScrollPane.setWheelScrollingEnabled(false);

        timelineTickPanel.setMaximumSize(new java.awt.Dimension(7200, 32767));
        timelineTickPanel.setMinimumSize(new java.awt.Dimension(7200, 0));
        timelineTickPanel.setPreferredSize(new java.awt.Dimension(7200, 1317));

        incidentTimelinePanel1.setMaximumSize(new java.awt.Dimension(32767, 100));
        incidentTimelinePanel1.setOpaque(false);
        incidentTimelinePanel1.setPreferredSize(new java.awt.Dimension(691, 100));

        javax.swing.GroupLayout incidentTimelinePanel1Layout = new javax.swing.GroupLayout(incidentTimelinePanel1);
        incidentTimelinePanel1.setLayout(incidentTimelinePanel1Layout);
        incidentTimelinePanel1Layout.setHorizontalGroup(
            incidentTimelinePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 691, Short.MAX_VALUE)
        );
        incidentTimelinePanel1Layout.setVerticalGroup(
            incidentTimelinePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );

        incidentTimelinePanel2.setOpaque(false);

        javax.swing.GroupLayout incidentTimelinePanel2Layout = new javax.swing.GroupLayout(incidentTimelinePanel2);
        incidentTimelinePanel2.setLayout(incidentTimelinePanel2Layout);
        incidentTimelinePanel2Layout.setHorizontalGroup(
            incidentTimelinePanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        incidentTimelinePanel2Layout.setVerticalGroup(
            incidentTimelinePanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        incidentTimelinePanel8.setOpaque(false);

        javax.swing.GroupLayout incidentTimelinePanel8Layout = new javax.swing.GroupLayout(incidentTimelinePanel8);
        incidentTimelinePanel8.setLayout(incidentTimelinePanel8Layout);
        incidentTimelinePanel8Layout.setHorizontalGroup(
            incidentTimelinePanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        incidentTimelinePanel8Layout.setVerticalGroup(
            incidentTimelinePanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        incidentTimelinePanel3.setOpaque(false);

        javax.swing.GroupLayout incidentTimelinePanel3Layout = new javax.swing.GroupLayout(incidentTimelinePanel3);
        incidentTimelinePanel3.setLayout(incidentTimelinePanel3Layout);
        incidentTimelinePanel3Layout.setHorizontalGroup(
            incidentTimelinePanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        incidentTimelinePanel3Layout.setVerticalGroup(
            incidentTimelinePanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        incidentTimelinePanel6.setOpaque(false);

        javax.swing.GroupLayout incidentTimelinePanel6Layout = new javax.swing.GroupLayout(incidentTimelinePanel6);
        incidentTimelinePanel6.setLayout(incidentTimelinePanel6Layout);
        incidentTimelinePanel6Layout.setHorizontalGroup(
            incidentTimelinePanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        incidentTimelinePanel6Layout.setVerticalGroup(
            incidentTimelinePanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        incidentTimelinePanel5.setOpaque(false);

        javax.swing.GroupLayout incidentTimelinePanel5Layout = new javax.swing.GroupLayout(incidentTimelinePanel5);
        incidentTimelinePanel5.setLayout(incidentTimelinePanel5Layout);
        incidentTimelinePanel5Layout.setHorizontalGroup(
            incidentTimelinePanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        incidentTimelinePanel5Layout.setVerticalGroup(
            incidentTimelinePanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        incidentTimelinePanel4.setOpaque(false);

        javax.swing.GroupLayout incidentTimelinePanel4Layout = new javax.swing.GroupLayout(incidentTimelinePanel4);
        incidentTimelinePanel4.setLayout(incidentTimelinePanel4Layout);
        incidentTimelinePanel4Layout.setHorizontalGroup(
            incidentTimelinePanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        incidentTimelinePanel4Layout.setVerticalGroup(
            incidentTimelinePanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        incidentTimelinePanel7.setOpaque(false);

        javax.swing.GroupLayout incidentTimelinePanel7Layout = new javax.swing.GroupLayout(incidentTimelinePanel7);
        incidentTimelinePanel7.setLayout(incidentTimelinePanel7Layout);
        incidentTimelinePanel7Layout.setHorizontalGroup(
            incidentTimelinePanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        incidentTimelinePanel7Layout.setVerticalGroup(
            incidentTimelinePanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        incidentTimelinePanel10.setOpaque(false);

        javax.swing.GroupLayout incidentTimelinePanel10Layout = new javax.swing.GroupLayout(incidentTimelinePanel10);
        incidentTimelinePanel10.setLayout(incidentTimelinePanel10Layout);
        incidentTimelinePanel10Layout.setHorizontalGroup(
            incidentTimelinePanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        incidentTimelinePanel10Layout.setVerticalGroup(
            incidentTimelinePanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        incidentTimelinePanel9.setOpaque(false);

        javax.swing.GroupLayout incidentTimelinePanel9Layout = new javax.swing.GroupLayout(incidentTimelinePanel9);
        incidentTimelinePanel9.setLayout(incidentTimelinePanel9Layout);
        incidentTimelinePanel9Layout.setHorizontalGroup(
            incidentTimelinePanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        incidentTimelinePanel9Layout.setVerticalGroup(
            incidentTimelinePanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        incidentNumberPanel1.setOpaque(false);

        javax.swing.GroupLayout incidentNumberPanel1Layout = new javax.swing.GroupLayout(incidentNumberPanel1);
        incidentNumberPanel1.setLayout(incidentNumberPanel1Layout);
        incidentNumberPanel1Layout.setHorizontalGroup(
            incidentNumberPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        incidentNumberPanel1Layout.setVerticalGroup(
            incidentNumberPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        incidentNumberPanel2.setOpaque(false);

        javax.swing.GroupLayout incidentNumberPanel2Layout = new javax.swing.GroupLayout(incidentNumberPanel2);
        incidentNumberPanel2.setLayout(incidentNumberPanel2Layout);
        incidentNumberPanel2Layout.setHorizontalGroup(
            incidentNumberPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        incidentNumberPanel2Layout.setVerticalGroup(
            incidentNumberPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        incidentNumberPanel3.setOpaque(false);

        javax.swing.GroupLayout incidentNumberPanel3Layout = new javax.swing.GroupLayout(incidentNumberPanel3);
        incidentNumberPanel3.setLayout(incidentNumberPanel3Layout);
        incidentNumberPanel3Layout.setHorizontalGroup(
            incidentNumberPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        incidentNumberPanel3Layout.setVerticalGroup(
            incidentNumberPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        incidentNumberPanel4.setOpaque(false);

        javax.swing.GroupLayout incidentNumberPanel4Layout = new javax.swing.GroupLayout(incidentNumberPanel4);
        incidentNumberPanel4.setLayout(incidentNumberPanel4Layout);
        incidentNumberPanel4Layout.setHorizontalGroup(
            incidentNumberPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        incidentNumberPanel4Layout.setVerticalGroup(
            incidentNumberPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        incidentNumberPanel5.setOpaque(false);

        javax.swing.GroupLayout incidentNumberPanel5Layout = new javax.swing.GroupLayout(incidentNumberPanel5);
        incidentNumberPanel5.setLayout(incidentNumberPanel5Layout);
        incidentNumberPanel5Layout.setHorizontalGroup(
            incidentNumberPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        incidentNumberPanel5Layout.setVerticalGroup(
            incidentNumberPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        incidentNumberPanel6.setOpaque(false);

        javax.swing.GroupLayout incidentNumberPanel6Layout = new javax.swing.GroupLayout(incidentNumberPanel6);
        incidentNumberPanel6.setLayout(incidentNumberPanel6Layout);
        incidentNumberPanel6Layout.setHorizontalGroup(
            incidentNumberPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        incidentNumberPanel6Layout.setVerticalGroup(
            incidentNumberPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        incidentNumberPanel7.setOpaque(false);

        javax.swing.GroupLayout incidentNumberPanel7Layout = new javax.swing.GroupLayout(incidentNumberPanel7);
        incidentNumberPanel7.setLayout(incidentNumberPanel7Layout);
        incidentNumberPanel7Layout.setHorizontalGroup(
            incidentNumberPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        incidentNumberPanel7Layout.setVerticalGroup(
            incidentNumberPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        incidentNumberPanel8.setOpaque(false);

        javax.swing.GroupLayout incidentNumberPanel8Layout = new javax.swing.GroupLayout(incidentNumberPanel8);
        incidentNumberPanel8.setLayout(incidentNumberPanel8Layout);
        incidentNumberPanel8Layout.setHorizontalGroup(
            incidentNumberPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        incidentNumberPanel8Layout.setVerticalGroup(
            incidentNumberPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        incidentNumberPanel9.setOpaque(false);

        javax.swing.GroupLayout incidentNumberPanel9Layout = new javax.swing.GroupLayout(incidentNumberPanel9);
        incidentNumberPanel9.setLayout(incidentNumberPanel9Layout);
        incidentNumberPanel9Layout.setHorizontalGroup(
            incidentNumberPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        incidentNumberPanel9Layout.setVerticalGroup(
            incidentNumberPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        incidentNumberPanel10.setOpaque(false);

        javax.swing.GroupLayout incidentNumberPanel10Layout = new javax.swing.GroupLayout(incidentNumberPanel10);
        incidentNumberPanel10.setLayout(incidentNumberPanel10Layout);
        incidentNumberPanel10Layout.setHorizontalGroup(
            incidentNumberPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        incidentNumberPanel10Layout.setVerticalGroup(
            incidentNumberPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout timelineTickPanelLayout = new javax.swing.GroupLayout(timelineTickPanel);
        timelineTickPanel.setLayout(timelineTickPanelLayout);
        timelineTickPanelLayout.setHorizontalGroup(
            timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(timelineTickPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(incidentNumberPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(incidentNumberPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(incidentNumberPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(incidentNumberPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(incidentNumberPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(incidentNumberPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(incidentNumberPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(incidentNumberPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(incidentNumberPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(incidentNumberPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(10, 10, 10)
                .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(incidentTimelinePanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(incidentTimelinePanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(incidentTimelinePanel5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(incidentTimelinePanel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(incidentTimelinePanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(incidentTimelinePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(incidentTimelinePanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(incidentTimelinePanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(incidentTimelinePanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(incidentTimelinePanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(190, 190, 190))
        );
        timelineTickPanelLayout.setVerticalGroup(
            timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(timelineTickPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(incidentNumberPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(incidentTimelinePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(timelineTickPanelLayout.createSequentialGroup()
                        .addComponent(incidentNumberPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(incidentNumberPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(incidentNumberPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(incidentNumberPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(incidentNumberPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(timelineTickPanelLayout.createSequentialGroup()
                        .addComponent(incidentTimelinePanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(incidentTimelinePanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(incidentTimelinePanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(incidentTimelinePanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(incidentTimelinePanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(incidentTimelinePanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(incidentNumberPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(timelineTickPanelLayout.createSequentialGroup()
                        .addComponent(incidentTimelinePanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(incidentTimelinePanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(timelineTickPanelLayout.createSequentialGroup()
                        .addComponent(incidentNumberPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(incidentNumberPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(incidentNumberPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(incidentTimelinePanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        timelinesScrollPane.setViewportView(timelineTickPanel);

        zoomSlider.setMaximum(22);
        zoomSlider.setMinimum(4);
        zoomSlider.setValue(4);
        zoomSlider.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        zoomSlider.setFocusable(false);
        zoomSlider.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                zoomSliderStateChanged(evt);
            }
        });

        zoomInIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/ZoomIn.png"))); // NOI18N
        zoomInIcon.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        zoomInIcon.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                zoomInIconMouseClicked(evt);
            }
        });

        zoomOutIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/ZoomOut.png"))); // NOI18N
        zoomOutIcon.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        zoomOutIcon.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                zoomOutIconMouseClicked(evt);
            }
        });

        timeStampScrollPane.setBorder(null);
        timeStampScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        timeStampScrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);

        javax.swing.GroupLayout timeStampPanelLayout = new javax.swing.GroupLayout(timeStampPanel);
        timeStampPanel.setLayout(timeStampPanelLayout);
        timeStampPanelLayout.setHorizontalGroup(
            timeStampPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        timeStampPanelLayout.setVerticalGroup(
            timeStampPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        timeStampScrollPane.setViewportView(timeStampPanel);

        btnAddTime.setText("+15:00");
        btnAddTime.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddTimeActionPerformed(evt);
            }
        });

        scriptBuilderMenuBar.addAncestorListener(new javax.swing.event.AncestorListener() {
            public void ancestorMoved(javax.swing.event.AncestorEvent evt) {
            }
            public void ancestorAdded(javax.swing.event.AncestorEvent evt) {
                scriptBuilderMenuBarAncestorAdded(evt);
            }
            public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
            }
        });

        fileMenu.setText("Scenarios");
        fileMenu.setMargin(new java.awt.Insets(0, 10, 0, 10));
        fileMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fileMenuActionPerformed(evt);
            }
        });

        fileNew.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        fileNew.setText("New");
        fileNew.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fileNewActionPerformed(evt);
            }
        });
        fileMenu.add(fileNew);
        fileMenu.add(jSeparator1);

        fileOpen.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        fileOpen.setText("Open...");
        fileOpen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fileOpenActionPerformed(evt);
            }
        });
        fileMenu.add(fileOpen);
        fileMenu.add(jSeparator2);

        fileSave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
        fileSave.setText("Save");
        fileSave.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fileSaveActionPerformed(evt);
            }
        });
        fileMenu.add(fileSave);

        fileSaveAs.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        fileSaveAs.setText("Save as...");
        fileSaveAs.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fileSaveAsActionPerformed(evt);
            }
        });
        fileMenu.add(fileSaveAs);

        scriptBuilderMenuBar.add(fileMenu);

        generateMenu.setLabel("Generate");
        generateMenu.setMargin(new java.awt.Insets(0, 10, 0, 10));

        generateNotebooks.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        generateNotebooks.setText("Generate Notebooks...");
        generateNotebooks.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                generateNotebooksActionPerformed(evt);
            }
        });
        generateMenu.add(generateNotebooks);

        generateWebNotebook.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_W, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        generateWebNotebook.setText("Generate Web Notebook...");
        generateWebNotebook.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                generateWebNotebookActionPerformed(evt);
            }
        });
        generateMenu.add(generateWebNotebook);

        generateScorecards.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        generateScorecards.setText("Generate Scorecards...");
        generateScorecards.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                generateScorecardsActionPerformed(evt);
            }
        });
        generateMenu.add(generateScorecards);

        generateOrganizationChart.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        generateOrganizationChart.setText("Generate D14 TMC Org Chart...");
        generateOrganizationChart.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                generateOrganizationChartActionPerformed(evt);
            }
        });
        generateMenu.add(generateOrganizationChart);
        generateMenu.add(jSeparator3);

        generateProjectRequirements.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        generateProjectRequirements.setText("Generate Project Worklist...");
        generateProjectRequirements.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                generateProjectRequirementsActionPerformed(evt);
            }
        });
        generateMenu.add(generateProjectRequirements);

        scriptBuilderMenuBar.add(generateMenu);

        incidentMenu.setText("Incidents");
        incidentMenu.setMargin(new java.awt.Insets(0, 10, 0, 10));

        newIncident.setText("New Incident...");
        newIncident.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                newIncidentActionPerformed(evt);
            }
        });
        incidentMenu.add(newIncident);

        deleteIncident.setText("Delete Incident");
        deleteIncident.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deleteIncidentActionPerformed(evt);
            }
        });
        incidentMenu.add(deleteIncident);

        deleteIncident1.setText("Edit Incident...");
        deleteIncident1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                incidentDetailsActionPerformed(evt);
            }
        });
        incidentMenu.add(deleteIncident1);
        incidentMenu.add(jSeparator4);

        saveIncident.setText("Save Incident...");
        saveIncident.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                saveIncidentActionPerformed(evt);
            }
        });
        incidentMenu.add(saveIncident);

        loadIncident.setText("Load Incident...");
        loadIncident.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                loadIncidentActionPerformed(evt);
            }
        });
        incidentMenu.add(loadIncident);

        scriptBuilderMenuBar.add(incidentMenu);

        generateNoiseMenu.setText("Noise");

        generateNoiseOption.setText("Generate Noise...");
        generateNoiseOption.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                generateNoiseOptionActionPerformed(evt);
            }
        });
        generateNoiseMenu.add(generateNoiseOption);

        scriptBuilderMenuBar.add(generateNoiseMenu);

        helpMenu1.setText("Unit");
        helpMenu1.setMargin(new java.awt.Insets(0, 10, 0, 10));

        loadUnits.setText("Load Additional Units");
        loadUnits.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                loadUnitsActionPerformed(evt);
            }
        });
        helpMenu1.add(loadUnits);

        scriptBuilderMenuBar.add(helpMenu1);

        helpMenu.setText("Help");
        helpMenu.setMargin(new java.awt.Insets(0, 10, 0, 10));

        helpTutorial.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0));
        helpTutorial.setText("Tutorial...");
        helpTutorial.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                helpTutorialActionPerformed(evt);
            }
        });
        helpMenu.add(helpTutorial);

        helpAbout.setText("About...");
        helpAbout.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                helpAboutActionPerformed(evt);
            }
        });
        helpMenu.add(helpAbout);

        scriptBuilderMenuBar.add(helpMenu);

        setJMenuBar(scriptBuilderMenuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(timelinesScrollPane, 0, 0, Short.MAX_VALUE)
                    .addComponent(timeStampScrollPane)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(0, 604, Short.MAX_VALUE)
                        .addComponent(zoomOutIcon)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(zoomSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(zoomInIcon)
                        .addGap(18, 18, 18)
                        .addComponent(btnAddTime)
                        .addGap(21, 21, 21)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(zoomOutIcon)
                    .addComponent(zoomSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(zoomInIcon)
                    .addComponent(btnAddTime))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(timeStampScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(timelinesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1289, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * Scale the timeline width based on zoom slider position.
     *
     * @param evt the state change event
     */
    private void zoomSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_zoomSliderStateChanged
        //Changing the zoom level always refreshes the window
        ScriptBuilderGuiConstants.PIXEL_WIDTH_PER_HORIZONTAL_TICK = zoomSlider.getValue();
        this.update(script, script);
        pack();
        repaint();
    }//GEN-LAST:event_zoomSliderStateChanged

    private void cadEventMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cadEventMousePressed
    }//GEN-LAST:event_cadEventMousePressed

    private void radioEventMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_radioEventMousePressed
    }//GEN-LAST:event_radioEventMousePressed

    private void cadEventMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cadEventMouseReleased
    }//GEN-LAST:event_cadEventMouseReleased

    private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
    }//GEN-LAST:event_okButtonActionPerformed

    /**
     * If cancel button is pressed, close radio event editor
     *
     * @param evt the button press event
     */
    private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
        radioMessage.setText("");
        radioTypeComboBox.setSelectedIndex(0);
        radioEventFrame.setVisible(false);
    }//GEN-LAST:event_cancelButtonActionPerformed

    private void editEventListActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editEventListActionPerformed
    }//GEN-LAST:event_editEventListActionPerformed

    /**
     * Executed when the "OK" button is pressed on the Incident properties window. If
     * incident is new, and is valid, adds it to the model and updates. If
     * editing existing incident, verifies changes are valid and applies them.
     * Then closes editor window.
     *
     * @param evt the button press event
     */
    private void incidentOkButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_incidentOkButtonActionPerformed
        if (!editingIncident)//adding new incident
        {
            boolean found = false;
            int indx = 0;
            // ALERT: Wacky logic follows
            // Examine all the incidents contained in this script
            for (ScriptIncident inci : script.incidents)
            {
                // If this spot in the list of incidents hasn't been assigned yet
                if (inci == null)
                {
                    found = true;
                    break;
                }
                ++indx;
                // Does the new incident number match an existing one?
                if (inci.number == (Integer) addIncidentNumber.getValue())
                {
                    JOptionPane.showMessageDialog(this, "Incident number already in use.",
                            "Unable to Create Incident", JOptionPane.ERROR_MESSAGE);
                    incidentFrame.setVisible(true);
                    return;
                }
            }
            // We examined all incidents and there wasn't an empty slot
            if (!found)
            {
                JOptionPane.showMessageDialog(this, "Script already has the max number of incidents.",
                        "Unable to Create Incident", JOptionPane.ERROR_MESSAGE);
                incidentFrame.setVisible(true);
                // ALERT: exit from middle of method
                return;
            }

            // We found a spot for the new incident
            script.incidents.remove(indx); // remove the null incident placeholder
            SimulationScript.incidentColors[indx] = selectedColor;
            // Add the new incident to the list
            //todo: need to add new data to the ScriptIncident Object here
            script.incidents.add(indx,
                    new ScriptIncident(SimulationScript.incidentColors[indx],
                            (Integer) addIncidentNumber.getValue(), addIncidentName.getText(), addIncidentDescription.getText(),
                            script,0));
            
            script.incidents.get(indx).setOffset((Integer) addIncidentStart.getValue() * 60);
            //following line may need *60?
            script.incidents.get(indx).insertCadData((Integer) addIncidentStart.getValue() * 60, new CadData(addIncidentType.getText(),addIncidentLocation.getText()));
            script.numberOfIncidents++;
            
            IncidentEditorFrame editor = new IncidentEditorFrame(script.incidents.get(indx), this);

            editor.setVisible(true);
        }
        else//editing existing incident
        {
            //adjust incident color
            script.incidents.get(oldIncidentIndex).color = selectedColor;
            //adjust incident name
            script.incidents.get(oldIncidentIndex).name = addIncidentName.getText();
            //adjust incident description
            script.incidents.get(oldIncidentIndex).description = addIncidentDescription.getText();
            //change offset of incident
            script.incidents.get(oldIncidentIndex).setOffset(((int) addIncidentStart.getValue()) * 60);
            
            script.incidents.get(oldIncidentIndex).insertCadData((int) addIncidentStart.getValue() * 60, new CadData(addIncidentType.getText(),addIncidentLocation.getText()));
            //update incident number, if it was changed
            if ((int) addIncidentNumber.getValue() == script.incidents.get(oldIncidentIndex).number
                    || !scriptContainsLogNum(script, (int) addIncidentNumber.getValue()))
            {
                script.incidents.get(oldIncidentIndex).number = (int) addIncidentNumber.getValue();
            }
            else//if the updated value conflicts with an existing inc number,
            //the inc number update fails
            {
                JOptionPane.showMessageDialog(this, "Incident number already in use.",
                        "Unable To Alter Incident Detail", JOptionPane.ERROR_MESSAGE);
            }
        }

        //close this frame
        incidentFrame.setVisible(false);
        this.update(script, script);
        repaint();
    }//GEN-LAST:event_incidentOkButtonActionPerformed
    /**
     * Calling this will check to see if the model has been updated. 
     * @param save indicated whether or not the file needs to be saved
     */
    private void checkNeedsSave(){
        
        if(!script.saved){
            changeFrameTitle("*");
        }else{
            changeFrameTitle("");
        }
    }
    /**
     * 
     * @param ext changes title by putting ext after current title. 
     */
    private void changeFrameTitle(String ext){
        String t = "Script Builder: ";
        if (script.saveFile == null)
        {
            t += "untitled1.xml";
        }
        else
        {
            t += script.saveFile.getName();
        }
        t+= ext;
        this.setTitle(t);
    }
    /**
     * 
     * Determine if the given incident number is already present in the script.
     *
     * @param script the current simulation script
     * @param num the incident log number to check
     * @return true if one of the existing incidents in the script uses that log
     * number
     */
    private boolean scriptContainsLogNum(SimulationScript script, int num)
    {
        for (ScriptIncident incident : script.incidents)
        {
            if (incident != null && incident.number == num)
            {
                return true;
            }
        }
        return false;
    }

    /**
     * Closes editor window upon click of cancel button.
     *
     * @param evt the button press event
     */
    private void incidentCancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_incidentCancelButtonActionPerformed
        incidentFrame.setVisible(false);
    }//GEN-LAST:event_incidentCancelButtonActionPerformed

    /**
     * Opens incident editor window and preps for addition of new incident, upon
     * click of "New Incident" menu option.
     *
     * @param evt the button press event
     */
    private void newIncidentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newIncidentActionPerformed
        openIncidentCreateWindow();
    }//GEN-LAST:event_newIncidentActionPerformed

    public void openIncidentCreateWindow()
    {
        editingIncident = false;
        addIncidentName.setText("");
        int newLogNum = 100;
        boolean found = false;
        while (!found)
        {
            newLogNum++;
            if (!scriptContainsLogNum(script, newLogNum))
            {
                found = true;
                for (ScriptIncident incident : script.incidents)
                {
                    if (incident != null && incident.number == newLogNum)
                    {
                        found = false;
                    }
                }
            }
        }

        addIncidentNumber.setValue(newLogNum);
        addIncidentStart.setValue(0);
        txtIncidentLength.setText("0");
        selectedColor = SimulationScript.incidentColors[0];
        incidentColorField.setBackground(selectedColor);
        colorComboBox.setSelectedIndex(0);
        addIncidentDescription.setText("");
        addIncidentLocation.setText("");
        addIncidentType.setText("");

        incidentFrame.setVisible(true);
    }
    private void fileMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileMenuActionPerformed
    }//GEN-LAST:event_fileMenuActionPerformed

    /**
     * Upon click of "Open file" menu option, opens a window to load a new .sim
     * file.
     *
     * @param evt the button press event
     */
    private void fileOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileOpenActionPerformed
        JFileChooser fc = new JFileChooser();

        //Search for .xml files
        fc.setFileFilter(new ExtensionFileFilter("Simulation Script XML (.xml)",
                new String[]
                {
                    "xml"
                }));
        if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
        {
            //make a new script and load it with values from the selected file
            script = new SimulationScript();
            script.loadScriptFromFile(fc.getSelectedFile());
        }
        
        this.update(script, script);
        //zoom out all the way so that the whole imported script is visible
        zoomSlider.setValue(zoomSlider.getMinimum());
        repaint();
    }//GEN-LAST:event_fileOpenActionPerformed

    /**
     * Upon click of "Save as" menu option, opens a window to choose a .sim file
     * to save this as.
     *
     * @param evt the button press event
     */
    private void fileSaveAsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileSaveAsActionPerformed
        JFileChooser fc = new JFileChooser();
        boolean wasNull = false;
        if (script.saveFile == null)
        {
            wasNull = true;
            String fName = "untitled";
            int untitledCount = 1;
            while (new File("" + fName + untitledCount + ".xml").exists())
            {
                untitledCount++;
            }
            script.saveFile = new File("" + fName + untitledCount + ".xml");
            
        }

        fc.setSelectedFile(script.saveFile);
        fc.setFileFilter(new ExtensionFileFilter("Simulation Script XML (.xml)",
                new String[]
                {
                    "xml"
                }));

        if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION)
        {
            String filename = fc.getSelectedFile().toString();
            if (!filename.endsWith(".xml"))
            {
                filename += ".xml";

            }
            script.saveScriptToFile(new File(filename));
            script.saveFile = new File(filename);
            
        }
        else
        {
            if (wasNull)
            {
                script.saveFile = null;
            }
        }
        
        this.update(script, 0);
    }//GEN-LAST:event_fileSaveAsActionPerformed

    /**
     * Upon click of "Save" menu option, opens a window to choose a .sim file to
     * save this as.
     *
     * @param evt the button press event
     */
    private void fileSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileSaveActionPerformed
        //If the script has never been saved before, we need to name or create a 
        //file in which to save it
        if (script.saveFile == null)
        {
            fileSaveAsActionPerformed(evt);
        }
        //Otherwise, just save to the previously selected save spot
        else
        {
            
            script.saveScriptToFile(script.saveFile);
        }
        //TODO: TEST TO MAKE SURE THIS DOES NOT CREATE BADDIES
        this.update(script, 0);
    }//GEN-LAST:event_fileSaveActionPerformed

    /**
     * Allow this window to refresh itself, after a different window loses
     * focus.
     */
    public void returnFocus()
    {
        zoomSlider.setValue(zoomSlider.getMinimum());
        zoomSliderStateChanged(new ChangeEvent(script));
    }

    /**
     * Set up the incident details/properties window so that it reflects the
     * values of the selected incident. Then, make the window visible.
     *
     * @param i the incident to be represented by this details window
     */
    public void incidentDetailsScreen(ScriptIncident i)
    {
        editingIncident = true;
        oldIncidentIndex = script.incidents.indexOf(i);

        addIncidentName.setText(i.name);
        addIncidentNumber.setValue(i.number);
        addIncidentLocation.setText(i.getCadData(i.offset).Header_FullLoc);
        addIncidentType.setText(i.getCadData(i.offset).Header_Type);
        addIncidentStart.setValue(i.offset / 60);
        txtIncidentLength.setText("" + (i.length / 60));
        txtIncidentLength.setHorizontalTextPosition(SwingConstants.RIGHT);
        //addIncidentLength.setValue(i.length / 60);
        incidentColorField.setBackground(i.color);
        colorComboBox.setSelectedIndex(SimulationScript.lookupColor(i.color));
        selectedColor = i.color;
        addIncidentDescription.setText(i.description);

        incidentFrame.setVisible(true);
    }

    /**
     * Brings up the noise generation screen upon click of the "Generate Noise"
     * menu option.
     *
     * @param evt the button press event
     */
    private void generateNoiseOptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateNoiseOptionActionPerformed
        addNoiseFrame.setVisible(true);
    }//GEN-LAST:event_generateNoiseOptionActionPerformed

    /**
     * Hides the noise generation screen upon click of the "Cancel" button.
     *
     * @param evt the button press event
     */
    private void btnCancelNoiseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelNoiseActionPerformed
        addNoiseFrame.setVisible(false);
    }//GEN-LAST:event_btnCancelNoiseActionPerformed

    /**
     * Generates random noise upon click of the "Generate" button, then hides
     * the noise generation screen.
     *
     * @param evt the button press event
     */
    private void btnGenerateNoiseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGenerateNoiseActionPerformed
        Random rng = new Random();
        ScriptEventType[] eventTypes = ScriptEventType.values();

        /*This feature has not yet been implemented. Show a message and just return.*/
        if (true)
        {
            JOptionPane.showMessageDialog(this, "This feature has not yet been implemented.\n",
                    "Feature not implemented", JOptionPane.INFORMATION_MESSAGE);

            return;
        }

        /* For prototyping purpose, ignore the sliders and average their values */
        int total = radioChatterSlider.getValue() + laneClosuresSlider.getValue() + TMCALSlider.getValue() + minorEventsSlider.getValue() + backgroundNoiseSlider.getValue();
        total /= 5;

        for (int i = 0; i < script.incidents.get(9).slices.size(); i++)
        {
            script.incidents.get(9).slices.get(i).events.clear();
        }

        for (int i = 0; i < total; i++)
        {
            int n = rng.nextInt();
            int s = rng.nextInt();
            int e = rng.nextInt();
            if (n < 0)
            {
                n *= -1;
            }
            if (s < 0)
            {
                s *= -1;
            }
            if (e < 0)
            {
                e *= -1;
            }

            script.incidents.get(9).slices.get(s % (script.incidents.get(9).slices.size())).addEvent(ScriptEvent.factoryByType(eventTypes[e % eventTypes.length]));
        }

        addNoiseFrame.setVisible(false);

        this.update(script, script);
        repaint();
}//GEN-LAST:event_btnGenerateNoiseActionPerformed

    /**
     * Allow the user to pick an incident from a dropdown, then save it to an
     * XML file.
     *
     * @param evt the button press event
     */
    private void saveIncidentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveIncidentActionPerformed
        Object[] incidentList = script.incidents.toArray();
        String input = "";
        ScriptIncident inc = null;

        //Pick the incident to save
        Object result = JOptionPane.showInputDialog(
                this,
                "Select Incident:",
                "Save Incident",
                JOptionPane.PLAIN_MESSAGE,
                null,
                incidentList,
                script.incidents.get(0));
        if (result == null)
        {
            return;
        }
        input = result.toString();
        int i = 0;
        for (ScriptIncident incident : script.incidents)
        {
            if (incident == null)
            {
                continue;
            }
            if (incident.toString().equals(input))
            {
                inc = incident;
            }
        }

        if (inc == null)
        {
            return;
        }

        String fs = System.getProperty("file.separator");
        //Pick the file to save it to
        JFileChooser fc = new JFileChooser();
        fc.setSelectedFile(new File("" + System.getProperty("user.dir") + fs + "Incidents" + fs + "inc_" + inc.number + ".xml"));
        fc.setFileFilter(new ExtensionFileFilter("Script Incident (.xml)", new String[]
        {
            "xml"
        }));
        if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION)
        {
            String filename = fc.getSelectedFile().toString();
            if (!filename.endsWith(".xml"))
            {
                filename += ".xml";

            }
            inc.saveIncidentToFile(new File(filename));
        }
    }//GEN-LAST:event_saveIncidentActionPerformed

    /**
     * Bring up the incident palette for loading of new incidents.
     *
     * @param evt the menu click event
     */
    private void loadIncidentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadIncidentActionPerformed
        new IncidentPaletteFrame(script, this).setVisible(true);
        zoomSlider.setValue(zoomSlider.getMinimum());
    }//GEN-LAST:event_loadIncidentActionPerformed

    //Unsupported as of 2017/09/05
    private void generateProjectRequirementsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateProjectRequirementsActionPerformed
        JFileChooser fc = new JFileChooser();
        fc.setFileFilter(new ExtensionFileFilter("Portable Document Format (.pdf)", new String[]
        {
            "pdf"
        }));
        fc.setSelectedFile(new File("Requirements.pdf"));
        fc.showSaveDialog(this);
        /*This feature has not yet been implemented. Show a message and just return.*/
        if (true)
        {
            JOptionPane.showMessageDialog(this, "This feature has not yet been implemented.\n",
                    "Feature not implemented", JOptionPane.INFORMATION_MESSAGE);

            return;
        }
    }//GEN-LAST:event_generateProjectRequirementsActionPerformed

    //Unsupported as of 2017/09/05
    private void generateNotebooksActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateNotebooksActionPerformed
        JFileChooser fc = new JFileChooser();
        fc.setFileFilter(new ExtensionFileFilter("Portable Document Format (.pdf)", new String[]
        {
            "pdf"
        }));
        fc.setSelectedFile(new File("Notebooks.pdf"));
        fc.showSaveDialog(this);
        /*This feature has not yet been implemented. Show a message and just return.*/
        if (true)
        {
            JOptionPane.showMessageDialog(this, "This feature has not yet been implemented.\n",
                    "Feature not implemented", JOptionPane.INFORMATION_MESSAGE);

            return;
        }
    }//GEN-LAST:event_generateNotebooksActionPerformed

    //Unsupported as of 2017/09/05
    private void generateScorecardsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateScorecardsActionPerformed
        JFileChooser fc = new JFileChooser();
        fc.setFileFilter(new ExtensionFileFilter("Portable Document Format (.pdf)", new String[]
        {
            "pdf"
        }));
        fc.setSelectedFile(new File("Scorecards.pdf"));
        fc.showSaveDialog(this);
        /*This feature has not yet been implemented. Show a message and just return.*/
        if (true)
        {
            JOptionPane.showMessageDialog(this, "This feature has not yet been implemented.\n",
                    "Feature not implemented", JOptionPane.INFORMATION_MESSAGE);

            return;
        }
    }//GEN-LAST:event_generateScorecardsActionPerformed

    //Unsupported as of 2017/09/05
    private void generateOrganizationChartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateOrganizationChartActionPerformed
        JFileChooser fc = new JFileChooser();
        fc.setFileFilter(new ExtensionFileFilter("Portable Document Format (.pdf)", new String[]
        {
            "pdf"
        }));
        fc.setSelectedFile(new File("OrganizationChart.pdf"));
        fc.showSaveDialog(this);
        /*This feature has not yet been implemented. Show a message and just return.*/
        if (true)
        {
            JOptionPane.showMessageDialog(this, "This feature has not yet been implemented.\n",
                    "Feature not implemented", JOptionPane.INFORMATION_MESSAGE);

            return;
        }
    }//GEN-LAST:event_generateOrganizationChartActionPerformed

    /**
     * Increases zoom level upon click of the "Zoom in" icon.
     *
     * @param evt the mouse event
     */
    private void zoomInIconMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_zoomInIconMouseClicked
        if (script != null && script.numberOfIncidents > 0)
        {
            zoomSlider.setValue(zoomSlider.getValue() >= 22 ? 22 : zoomSlider.getValue() + 1);
        }
    }//GEN-LAST:event_zoomInIconMouseClicked

    /**
     * Decreases zoom level upon click of the "Zoom out" icon.
     *
     * @param evt the mouse event
     */
    private void zoomOutIconMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_zoomOutIconMouseClicked
        if (script != null && script.numberOfIncidents > 0)
        {
            zoomSlider.setValue(zoomSlider.getValue() <= 4 ? 4 : zoomSlider.getValue() - 1);
        }
    }//GEN-LAST:event_zoomOutIconMouseClicked


    /* Help > About simply displays the current SVN revision number so
     * the user can determine which version of the source code was used to
     * build the executable she is running.
     */
    private void helpAboutActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_helpAboutActionPerformed
    {//GEN-HEADEREND:event_helpAboutActionPerformed
        JOptionPane.showMessageDialog(rootPane, "Revision: " + getAppVersion(), "About", JOptionPane.INFORMATION_MESSAGE);
    }//GEN-LAST:event_helpAboutActionPerformed

    /**
     * Replaces the current script with a new, blank script.
     *
     * @param evt the menu selection event
     */
    private void fileNewActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_fileNewActionPerformed
    {//GEN-HEADEREND:event_fileNewActionPerformed
        if(!script.saved)
        {
                int confirm = JOptionPane.showConfirmDialog(this,
                        "Previous scenario is NOT saved. Continue with creating a new scenario?","Warning",JOptionPane.YES_NO_OPTION);
                if (confirm == JOptionPane.YES_OPTION)
                {
                    createNewScript();
                }            
        }else
        {
            createNewScript();
        }
            
    }//GEN-LAST:event_fileNewActionPerformed

    private void createNewScript()
    {
        script = new SimulationScript();
        loadCHPunits();
        script.update();
        this.update(null, script);
        repaint();
    }
    /**
     * Allows the user to delete an incident from the current script.
     *
     * @param evt the menu selection event
     */
    private void deleteIncidentActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_deleteIncidentActionPerformed
    {//GEN-HEADEREND:event_deleteIncidentActionPerformed
        Object[] incidentList = script.incidents.toArray();
        String input = "";
        ScriptIncident inc = null;
        //Choose the incident to be deleted
        Object result = JOptionPane.showInputDialog(
                this,
                "Select Incident:",
                "Delete Incident",
                JOptionPane.PLAIN_MESSAGE,
                null,
                incidentList,
                script.incidents.get(0));

        if (result != null)
        {
            input = result.toString();
            for (ScriptIncident incident : script.incidents)
            {
                if (incident == null)
                {
                    continue;
                }
                if (incident.toString().equals(input))
                {
                    inc = incident;
                }
            }

            //Allow user to verify deletion before proceeding
            if (inc != null)
            {
                int confirm = JOptionPane.showConfirmDialog(this,
                        "Are you sure you want to delete " + inc.toString() + "?");
                if (confirm == JOptionPane.YES_OPTION)
                {
                    //Remove the incident and replace it with a null placeholder
                    script.incidents.remove(inc);
                    script.incidents.add(null);
                    script.numberOfIncidents--;
                    
                }
            }
        }
        //since delete is the only method in this class that actually edits the data model, needs .update()
        script.update();
        //Refresh
        this.update(script, script);
        
        
        repaint();
    }//GEN-LAST:event_deleteIncidentActionPerformed
    /**
     * Add 15 minutes to the end of the visible timeline.
     *
     * @param evt the button press event.
     */
    private void btnAddTimeActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnAddTimeActionPerformed
    {//GEN-HEADEREND:event_btnAddTimeActionPerformed
        IncidentTimelinePanel.requestedScriptBuilderFillerTime += IncidentTimelinePanel.FILLER_INTERVAL_SECONDS;
        this.update(script, script);
    }//GEN-LAST:event_btnAddTimeActionPerformed

    private void cadEventActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_cadEventActionPerformed
    {//GEN-HEADEREND:event_cadEventActionPerformed
        /*This feature has not yet been implemented. Show a message and just return.*/
        if (true)
        {
            JOptionPane.showMessageDialog(this, "This feature has not yet been implemented.\n",
                    "Feature not implemented", JOptionPane.INFORMATION_MESSAGE);

            return;
        }
    }//GEN-LAST:event_cadEventActionPerformed

    private void generateWebNotebookActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_generateWebNotebookActionPerformed
    {//GEN-HEADEREND:event_generateWebNotebookActionPerformed
        /*This feature has not yet been implemented. Show a message and just return.*/
        if (true)
        {
            JOptionPane.showMessageDialog(this, "This feature has not yet been implemented.\n",
                    "Feature not implemented", JOptionPane.INFORMATION_MESSAGE);

            return;
        }
    }//GEN-LAST:event_generateWebNotebookActionPerformed

    private void helpTutorialActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_helpTutorialActionPerformed
    {//GEN-HEADEREND:event_helpTutorialActionPerformed
        final String quickStartURL = "http://git.tokomak.net:8888/wiki/ScriptBuilder_QuickStart";

        if (Desktop.isDesktopSupported())
        {
            Desktop dt = Desktop.getDesktop();
            if (dt.isSupported(Desktop.Action.BROWSE))
            {
                try
                {
                    URI uri = new URI(quickStartURL);
                    dt.browse(uri);
                }
                catch (Exception e)
                {
                }
            }
        }
// TODO add your handling code here:
    }//GEN-LAST:event_helpTutorialActionPerformed

    private void addIncidentLocationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addIncidentLocationActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_addIncidentLocationActionPerformed

    private void addIncidentNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addIncidentNameActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_addIncidentNameActionPerformed

    private void incidentDetailsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_incidentDetailsActionPerformed
        Object[] incidentList = script.incidents.toArray();
        ScriptIncident i = (ScriptIncident) JOptionPane.showInputDialog(
                this,
                "Select Incident:",
                "Edit Incident",
                JOptionPane.PLAIN_MESSAGE,
                null,
                incidentList,
                script.incidents.get(0));

        // If a valid incident was selected
        if (i != null)
        {
            editingIncident = true;
            oldIncidentIndex = script.incidents.indexOf(i);

            addIncidentName.setText(i.name);
            addIncidentNumber.setValue(i.number);
            
            addIncidentLocation.setText(i.getCadData(i.offset).Header_FullLoc);
            addIncidentType.setText(i.getCadData(i.offset).Header_Type);
            addIncidentStart.setValue(i.offset / 60);
            //addIncidentLength.setValue(i.length / 60);
            incidentColorField.setBackground(i.color);
            colorComboBox.setSelectedIndex(SimulationScript.lookupColor(i.color));
            selectedColor = i.color;
            addIncidentDescription.setText(i.description);

            incidentFrame.setVisible(true);
        }
    }//GEN-LAST:event_incidentDetailsActionPerformed

    private void popupDeleteIncidentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_popupDeleteIncidentActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_popupDeleteIncidentActionPerformed

    private void loadUnitsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadUnitsActionPerformed
        // TODO: needs to have testing performed
        JFileChooser fc = new JFileChooser();

        //Search for .xml files
        fc.setFileFilter(new ExtensionFileFilter("Simulation Script XML (.xml)",
                new String[]
                {
                    "xml"
                }));
        if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
        {
            InputStream is = null;
            try {
                // create an input stream from the selected file
                File pf = fc.getSelectedFile();
                is = new FileInputStream(pf);
                //load script with units from the selected file
                script.loadUnitsFromFile(is);
            } catch (FileNotFoundException ex) {
                Logger.getLogger(ScriptBuilderFrame.class.getName()).log(Level.SEVERE, null, ex);
            } finally {
                try {
                    is.close();
                } catch (IOException ex) {
                    Logger.getLogger(ScriptBuilderFrame.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
    }//GEN-LAST:event_loadUnitsActionPerformed

    private void scriptBuilderMenuBarAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_scriptBuilderMenuBarAncestorAdded
        //loads in the initial unit file
//        String fileName = "units.xml";
//        
//        File f = new File(fileName);
//        
//        script.loadUnitsFromFile(f);
    }//GEN-LAST:event_scriptBuilderMenuBarAncestorAdded
/** Handle a user selection in the incident color combo box.
 * @author jdalbey
 */
    private void colorSelectedHandler(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_colorSelectedHandler
        // Save the chosen color
        int index = colorComboBox.getSelectedIndex();
        selectedColor = SimulationScript.incidentColors[index];
        incidentColorField.setBackground(selectedColor);
    }//GEN-LAST:event_colorSelectedHandler


    /**
     * Read the version number from the application properties. The file
     * 'application.properties' is generated by build.xml.
     *
     * @return a version string obtained from application.properties file, or
     * "Version: unknown" if an IOerror prevents us from reading the file.
     */
    private String getAppVersion()
    {
        String propfilename = "/scriptbuilder/gui/application.properties";
        String propKey = "Application.revision";
        String version = "unknown";
        // Load the application properties (created by build.xml)
        try
        {
            Properties props = new Properties();
            props.load(this.getClass().getResourceAsStream(propfilename));
            version = (String) props.get(propKey);
        }
        catch (IOException ex)
        {
            Logger.getLogger("scriptbuilder.gui").log(Level.SEVERE,
                    "ScriptBuilderFrame.getAppVersion()."
                    + " IOError reading " + propfilename);
        }
        catch (NullPointerException npe)
        {
            Logger.getLogger("scriptbuilder.gui").log(Level.SEVERE,
                    "ScriptBuilderFrame.getAppVersion().load."
                    + " Missing file: " + propfilename);
        }
        return version;
    }

    /**
     * Runs the script builder. This is the main method for the whole program.
     *
     * @param args the command line arguments
     */
    public static void main(String args[])
    {
        try
        {
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
            //UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            //UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
        }
        catch (Exception ex)
        {
            //Apparently we don't do any special exception processing
        }

        try
        {
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        }
        catch (Exception ex)
        {
            //Apparently we don't do any special exception processing
        }

        java.awt.EventQueue.invokeLater(
                new Runnable()
                {
                    public void run()
                    {
                        new ScriptBuilderFrame().setVisible(true);
                    }
                });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JSlider TMCALSlider;
    private javax.swing.JTextArea addIncidentDescription;
    private javax.swing.JTextField addIncidentLocation;
    private javax.swing.JTextField addIncidentName;
    private javax.swing.JSpinner addIncidentNumber;
    private javax.swing.JSpinner addIncidentStart;
    private javax.swing.JTextField addIncidentType;
    private javax.swing.JFrame addNoiseFrame;
    private javax.swing.JSlider backgroundNoiseSlider;
    private javax.swing.JButton btnAddTime;
    private javax.swing.JButton btnCancelNoise;
    private javax.swing.JButton btnGenerateNoise;
    private javax.swing.JMenuItem cadEvent;
    private javax.swing.JFrame cadEventFrame;
    private javax.swing.JButton cancelButton;
    private javax.swing.JComboBox<String> colorComboBox;
    private javax.swing.JMenuItem deleteEventList;
    private javax.swing.JMenuItem deleteIncident;
    private javax.swing.JMenuItem deleteIncident1;
    private javax.swing.JMenuItem editEventList;
    private javax.swing.JPopupMenu eventListPopupMenu;
    private javax.swing.JPopupMenu eventPopupMenu;
    private javax.swing.JMenu fileMenu;
    private javax.swing.JMenuItem fileNew;
    private javax.swing.JMenuItem fileOpen;
    private javax.swing.JMenuItem fileSave;
    private javax.swing.JMenuItem fileSaveAs;
    private javax.swing.JMenu generateMenu;
    private javax.swing.JMenu generateNoiseMenu;
    private javax.swing.JMenuItem generateNoiseOption;
    private javax.swing.JMenuItem generateNotebooks;
    private javax.swing.JMenuItem generateOrganizationChart;
    private javax.swing.JMenuItem generateProjectRequirements;
    private javax.swing.JMenuItem generateScorecards;
    private javax.swing.JMenuItem generateWebNotebook;
    private javax.swing.JMenuItem helpAbout;
    private javax.swing.JMenu helpMenu;
    private javax.swing.JMenu helpMenu1;
    private javax.swing.JMenuItem helpTutorial;
    private javax.swing.JButton incidentCancelButton;
    private javax.swing.JColorChooser incidentColorChooser;
    private javax.swing.JTextField incidentColorField;
    private javax.swing.JFrame incidentFrame;
    private javax.swing.JMenu incidentMenu;
    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel1;
    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel10;
    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel2;
    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel3;
    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel4;
    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel5;
    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel6;
    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel7;
    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel8;
    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel9;
    private javax.swing.JButton incidentOkButton;
    private javax.swing.JPopupMenu incidentPopupMenu;
    private javax.swing.JScrollPane incidentPropertiesScrollPane;
    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel1;
    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel10;
    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel2;
    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel3;
    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel4;
    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel5;
    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel6;
    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel7;
    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel8;
    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel9;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JMenuItem jMenuItem6;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JPopupMenu.Separator jSeparator2;
    private javax.swing.JPopupMenu.Separator jSeparator3;
    private javax.swing.JPopupMenu.Separator jSeparator4;
    private javax.swing.JLabel labelBackgroundNoise;
    private javax.swing.JLabel labelCADEntry;
    private javax.swing.JLabel labelIncidentColor;
    private javax.swing.JLabel labelIncidentDescription;
    private javax.swing.JLabel labelIncidentLength;
    private javax.swing.JLabel labelIncidentName;
    private javax.swing.JLabel labelIncidentNumber;
    private javax.swing.JLabel labelIncidentStart;
    private javax.swing.JLabel labelLaneClosures;
    private javax.swing.JLabel labelLeastFreq;
    private javax.swing.JLabel labelMinorEvents;
    private javax.swing.JLabel labelMostFreq;
    private javax.swing.JLabel labelRadioChatter;
    private javax.swing.JLabel labelRadioMessage;
    private javax.swing.JLabel labelRadioType;
    private javax.swing.JLabel labelTMCALLogs;
    private javax.swing.JSlider laneClosuresSlider;
    private javax.swing.JMenuItem loadIncident;
    private javax.swing.JMenuItem loadUnits;
    private javax.swing.JSlider minorEventsSlider;
    private javax.swing.JMenuItem newIncident;
    private javax.swing.JButton okButton;
    private javax.swing.JMenuItem popupDeleteIncident;
    private javax.swing.JSlider radioChatterSlider;
    private javax.swing.JMenuItem radioEvent;
    private javax.swing.JFrame radioEventFrame;
    private javax.swing.JTextArea radioMessage;
    private javax.swing.JScrollPane radioMessageScrollPane;
    private javax.swing.JComboBox radioTypeComboBox;
    private javax.swing.JMenuItem saveIncident;
    private javax.swing.JMenuBar scriptBuilderMenuBar;
    private scriptbuilder.gui.panels.TimeStampPanel timeStampPanel;
    private javax.swing.JScrollPane timeStampScrollPane;
    private scriptbuilder.gui.panels.TimelineTickPanel timelineTickPanel;
    private javax.swing.JScrollPane timelinesScrollPane;
    private javax.swing.JLabel txtIncidentLength;
    private javax.swing.JTextArea txtNoiseDescription;
    private javax.swing.JLabel zoomInIcon;
    private javax.swing.JLabel zoomOutIcon;
    private javax.swing.JSlider zoomSlider;
    // End of variables declaration//GEN-END:variables
}
