source: tmcsimulator-scriptbuilder/trunk/src/scriptbuilder/gui/ScriptBuilderFrame.java @ 163

Revision 163, 126.9 KB checked in by sdanthin, 6 years ago (diff)

ScriptBuilderFrame?.java wrote out some comments of what I thought a color picker could be made from, but not currently implemented.

Line 
1/*
2 * ScriptBuilderFrame.java
3 *
4 * Created on May 8, 2010, 12:01:46 PM
5 */
6package scriptbuilder.gui;
7
8import java.awt.Adjustable;
9import java.awt.Color;
10import java.awt.Desktop;
11import java.awt.event.AdjustmentEvent;
12import java.awt.event.AdjustmentListener;
13import java.awt.event.KeyEvent;
14import java.awt.event.KeyListener;
15import java.awt.event.WindowAdapter;
16import java.awt.event.WindowEvent;
17import java.awt.event.ActionEvent;
18import java.awt.event.ActionListener;
19import java.io.File;
20import java.io.FileInputStream;
21import java.io.IOException;
22import java.io.FileNotFoundException;
23import java.io.InputStream;
24import java.net.URI;
25import java.net.URISyntaxException;
26import java.net.URL;
27import java.util.Observable;
28import java.util.Observer;
29import java.util.Properties;
30import java.util.Random;
31import java.util.Scanner;
32import java.util.logging.Level;
33import java.util.logging.Logger;
34import javax.swing.DefaultListModel;
35import javax.swing.JFileChooser;
36import javax.swing.JOptionPane;
37import javax.swing.SwingConstants;
38import javax.swing.UIManager;
39import javax.swing.UnsupportedLookAndFeelException;
40import javax.swing.event.ChangeEvent;
41import javax.swing.JColorChooser;
42import javax.swing.colorchooser.AbstractColorChooserPanel;
43import javax.swing.JPanel;
44import scriptbuilder.gui.panels.IncidentTimelinePanel;
45import scriptbuilder.structures.ScriptEvent;
46import scriptbuilder.structures.ScriptEvent.ScriptEventType;
47import scriptbuilder.structures.ScriptIncident;
48import scriptbuilder.structures.ScriptIncident.IncidentFocusedEvent;
49import scriptbuilder.structures.ScriptIncident.SliceChangedEvent;
50import scriptbuilder.structures.SimulationScript;
51import scriptbuilder.structures.TimeSlice;
52import scriptbuilder.structures.events.I_ScriptEvent;
53import scriptbuilder.structures.CadData;
54
55/**
56 * GUI for the script builder. Contains all panels and editor elements. Performs
57 * updates to reflect script model, which it observes.
58 *
59 * @author Greg Eddington
60 * @author Bryan McGuffin
61 */
62public class ScriptBuilderFrame extends javax.swing.JFrame implements Observer
63{
64    private final static String kUnitsFilename = "resources/units_template.xml";
65    /**
66     * The script model.
67     */
68    private SimulationScript script;
69    /**
70     * The current type of selected event.
71     */
72    public ScriptEventType currentEventType;
73    /**
74     * True if we are currently editing an incident.
75     */
76    private boolean editingIncident;
77    /**
78     * Index of the previous incident.
79     */
80    private int oldIncidentIndex;
81
82    /**
83     * Get the script currently in use.
84     *
85     * @return the script model object
86     */
87    public SimulationScript getScript()
88    {
89        return script;
90    }
91
92    /**
93     * Listener for the scroll pane.
94     */
95    class MyAdjustmentListener implements AdjustmentListener
96    {
97
98        /**
99         * If the incident timeline is scrolled horizontally, the timestamp
100         * panel is updated to reflect it.
101         *
102         * @param evt the adjustment event
103         */
104        @Override
105        public void adjustmentValueChanged(AdjustmentEvent evt)
106        {
107            if (evt.getAdjustable().getOrientation() == Adjustable.HORIZONTAL)
108            {
109                timeStampScrollPane.getHorizontalScrollBar()
110                        .setValue(timelinesScrollPane.getHorizontalScrollBar().getValue());
111            }
112            else
113            {
114                // Event from vertical scrollbar
115            }
116
117            repaint();
118        }
119    }
120
121    /**
122     * Listener for key presses. Used for hotkeys for different event types.
123     */
124    private class TimelineKeyListener implements KeyListener
125    {
126
127        /**
128         * If a hotkey is pressed, select that type of event.
129         *
130         * @param e the key event
131         */
132        @Override
133        public void keyPressed(KeyEvent e)
134        {
135            repaint();
136        }
137
138        /**
139         * Take no action upon key release.
140         *
141         * @param e the key event
142         */
143        @Override
144        public void keyReleased(KeyEvent e)
145        {
146        }
147
148        /**
149         * Take no action upon key release.
150         *
151         * @param e the key event
152         */
153        @Override
154        public void keyTyped(KeyEvent e)
155        {
156        }
157    }
158
159    /**
160     * Constructor. Prep new script model, initialize the GUI, and add listeners
161     * for all buttons.
162     */
163    public ScriptBuilderFrame()
164    {
165        script = new SimulationScript();
166        script.addObserver(this);
167        initComponents();
168        loadCHPunits();
169        addCustomListeners();
170        //add to listener helper method
171       
172       
173       
174        //We don't currently want the button to be present in this window
175        btnAddTime.setVisible(false);
176        this.update(null, script);
177
178        // Hack to refresh the zoom
179        /*
180         zoomSlider.setValue(zoomSlider.getValue() - 1);
181         zoomSlider.setValue(zoomSlider.getValue() + 1);
182         */
183        // Set listener for scroll pane
184       
185       
186        AdjustmentListener listener = new MyAdjustmentListener();
187        timelinesScrollPane.getHorizontalScrollBar().addAdjustmentListener(listener);
188        timelinesScrollPane.getVerticalScrollBar().addAdjustmentListener(listener);
189        repaint();
190
191    }
192    /** Load the template file of standard CHP units into the script.
193     *  These units generally appear before any script events.
194     */
195    private void loadCHPunits()
196    {
197        // Read the file of CHP unit names
198        // This works within NetBeans or it can be run from the Jar file.
199        URL url = this.getClass().getResource("/"+kUnitsFilename);
200        InputStream inStream;
201        try {
202            inStream = url.openStream();
203            script.loadUnitsFromFile(inStream);
204        } catch (IOException ex) {
205            Logger.getLogger(ScriptBuilderFrame.class.getName()).log(Level.SEVERE, null, ex);
206        }   
207    }
208    /**
209     * Put all custom non-generated listeners in this method
210     */
211    private void addCustomListeners(){
212
213
214
215        //listener for window closing
216        this.addWindowListener(new WindowAdapter(){
217            @Override
218            public void windowClosing(WindowEvent e)
219            {
220                //System.out.println("Window is closing!" + saved);
221
222                if(!script.saved){
223                    //System.out.println("window was not saved!");
224                    Object[] options = {"Yes","No","Cancel"};
225                    int result = JOptionPane.showOptionDialog(null,"Would you like to save changes before exiting?",
226                            "Exit",
227                            JOptionPane.YES_NO_CANCEL_OPTION,
228                            JOptionPane.QUESTION_MESSAGE,
229                            null,
230                            options,
231                            options[2]);
232                    switch (result){
233                        //should save script then close
234                        case 0:
235                            fileSaveActionPerformed(null);
236                            //System.exit(0);
237                            break;
238                        // should just exit
239                        case 1:
240                            System.exit(0);
241                            break;
242                        // should do nothing
243                        case 2:
244                            break;
245                        default:
246                            break;
247                    }
248                   
249                   
250                   
251                }else{
252                    //should close current window since it is saved already
253                    System.exit(0);
254                }
255            }
256        });
257    }
258
259    /**
260     * Update the GUI to reflect the model. If the script changed, update all
261     * the incident panels. If a timeslice changed, add any new events to the
262     * model. If an incident gained focus, update the incident info screen to
263     * display its details.
264     *
265     * @param o The observed object
266     * @param arg Either the script model or an incident event, depending on who
267     * called this update
268     */
269    @Override
270    public void update(Observable o, Object arg)
271    {
272        checkNeedsSave();
273        if (arg instanceof SimulationScript)
274        {
275           
276            script = (SimulationScript) arg;
277
278            //If we don't have exactly 10 events something is wrong
279            if (script.incidents.size() != 10)
280            {
281                return;
282            }
283
284            //Call update on major panels
285            timelineTickPanel.update(script);
286            timeStampPanel.update(script);
287
288            //Call update on all timeline panels
289            incidentTimelinePanel1.timelinePanelUpdate(script.incidents.get(0));
290            incidentTimelinePanel2.timelinePanelUpdate(script.incidents.get(1));
291            incidentTimelinePanel3.timelinePanelUpdate(script.incidents.get(2));
292            incidentTimelinePanel4.timelinePanelUpdate(script.incidents.get(3));
293            incidentTimelinePanel5.timelinePanelUpdate(script.incidents.get(4));
294            incidentTimelinePanel6.timelinePanelUpdate(script.incidents.get(5));
295            incidentTimelinePanel7.timelinePanelUpdate(script.incidents.get(6));
296            incidentTimelinePanel8.timelinePanelUpdate(script.incidents.get(7));
297            incidentTimelinePanel9.timelinePanelUpdate(script.incidents.get(8));
298            incidentTimelinePanel10.timelinePanelUpdate(script.incidents.get(9));
299
300            //Cal update on number panels
301            incidentNumberPanel1.update(script.incidents.get(0));
302            incidentNumberPanel2.update(script.incidents.get(1));
303            incidentNumberPanel3.update(script.incidents.get(2));
304            incidentNumberPanel4.update(script.incidents.get(3));
305            incidentNumberPanel5.update(script.incidents.get(4));
306            incidentNumberPanel6.update(script.incidents.get(5));
307            incidentNumberPanel7.update(script.incidents.get(6));
308            incidentNumberPanel8.update(script.incidents.get(7));
309            incidentNumberPanel9.update(script.incidents.get(8));
310            incidentNumberPanel10.update(script.incidents.get(9));
311
312            /**
313             * DefaultComboBoxModel model = new DefaultComboBoxModel(); for
314             * (ScriptIncident i : script.incidents) { if (i != null)
315             * model.addElement(i); } gotoIncident.setModel(model);*
316             */
317           
318            this.setPreferredSize(this.getSize());
319            pack();
320           
321        }
322        //Mouse has changed focus to a different timeslice
323        else if (arg instanceof SliceChangedEvent)
324        {
325            TimeSlice slice = ((SliceChangedEvent) arg).slice;
326
327            DefaultListModel model = new DefaultListModel();
328            for (I_ScriptEvent e : slice.events)
329            {
330                model.addElement(e);
331            }
332           
333           
334           
335        }
336        //Mouse has changed focus to a different incident timeline panel
337        else if (arg instanceof IncidentFocusedEvent)
338        {
339            ScriptIncident i = ((IncidentFocusedEvent) arg).incident;
340
341            //gotoIncident.setSelectedItem(i);
342           
343        }
344
345        //Regardless of update type, refresh window by doing these things:
346        //Enable "+15:00" button if script is not empty
347        btnAddTime.setEnabled(script != null && script.numberOfIncidents > 0);
348
349        //enable zoom slider if script is not empty
350        zoomSlider.setEnabled(script != null && script.numberOfIncidents > 0);
351
352        //scale the zoom slider such that the most zoomed-out point allows the
353        //entire script to be visible at once
354       
355        //todo: interpret these two calls and make them so that they are more accurate to fit the entire window at once
356        zoomSlider.setMinimum(((timelineTickPanel.getVisibleRect().width - 20)
357                * ScriptBuilderGuiConstants.HORIZONTAL_TICK_RESOLUTION)
358                / Math.max(script.absoluteLength(), ScriptBuilderGuiConstants.TICK_TIMELINE_SMALLEST_LENGTH));
359        zoomSlider.setMaximum(zoomSlider.getMinimum() + 20);
360       
361        repaint();
362    }
363
364    /**
365     * This method is called from within the constructor to initialize the form.
366     * WARNING: Do NOT modify this code. The content of this method is always
367     * regenerated by the Form Editor.
368     */
369    @SuppressWarnings("unchecked")
370    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
371    private void initComponents() {
372
373        incidentPopupMenu = new javax.swing.JPopupMenu();
374        popupDeleteIncident = new javax.swing.JMenuItem();
375        eventPopupMenu = new javax.swing.JPopupMenu();
376        cadEvent = new javax.swing.JMenuItem();
377        jMenuItem2 = new javax.swing.JMenuItem();
378        radioEvent = new javax.swing.JMenuItem();
379        jMenuItem4 = new javax.swing.JMenuItem();
380        jMenuItem5 = new javax.swing.JMenuItem();
381        jMenuItem6 = new javax.swing.JMenuItem();
382        cadEventFrame = new javax.swing.JFrame();
383        labelCADEntry = new javax.swing.JLabel();
384        radioEventFrame = new javax.swing.JFrame();
385        labelRadioType = new javax.swing.JLabel();
386        labelRadioMessage = new javax.swing.JLabel();
387        radioTypeComboBox = new javax.swing.JComboBox();
388        radioMessageScrollPane = new javax.swing.JScrollPane();
389        radioMessage = new javax.swing.JTextArea();
390        okButton = new javax.swing.JButton();
391        cancelButton = new javax.swing.JButton();
392        eventListPopupMenu = new javax.swing.JPopupMenu();
393        editEventList = new javax.swing.JMenuItem();
394        deleteEventList = new javax.swing.JMenuItem();
395        incidentFrame = new javax.swing.JFrame();
396        labelIncidentNumber = new javax.swing.JLabel();
397        labelIncidentName = new javax.swing.JLabel();
398        labelIncidentColor = new javax.swing.JLabel();
399        labelIncidentDescription = new javax.swing.JLabel();
400        incidentPropertiesScrollPane = new javax.swing.JScrollPane();
401        addIncidentDescription = new javax.swing.JTextArea();
402        incidentOkButton = new javax.swing.JButton();
403        incidentCancelButton = new javax.swing.JButton();
404        addIncidentNumber = new javax.swing.JSpinner();
405        addIncidentName = new javax.swing.JTextField();
406        labelIncidentLength = new javax.swing.JLabel();
407        labelIncidentStart = new javax.swing.JLabel();
408        addIncidentStart = new javax.swing.JSpinner();
409        btnChooseColor = new javax.swing.JButton();
410        incidentColorField = new javax.swing.JTextField();
411        txtIncidentLength = new javax.swing.JLabel();
412        jLabel1 = new javax.swing.JLabel();
413        addIncidentLocation = new javax.swing.JTextField();
414        jLabel2 = new javax.swing.JLabel();
415        addIncidentType = new javax.swing.JTextField();
416        addNoiseFrame = new javax.swing.JFrame();
417        labelRadioChatter = new javax.swing.JLabel();
418        radioChatterSlider = new javax.swing.JSlider();
419        laneClosuresSlider = new javax.swing.JSlider();
420        labelLaneClosures = new javax.swing.JLabel();
421        TMCALSlider = new javax.swing.JSlider();
422        labelTMCALLogs = new javax.swing.JLabel();
423        txtNoiseDescription = new javax.swing.JTextArea();
424        backgroundNoiseSlider = new javax.swing.JSlider();
425        labelBackgroundNoise = new javax.swing.JLabel();
426        minorEventsSlider = new javax.swing.JSlider();
427        labelMinorEvents = new javax.swing.JLabel();
428        btnCancelNoise = new javax.swing.JButton();
429        btnGenerateNoise = new javax.swing.JButton();
430        labelLeastFreq = new javax.swing.JLabel();
431        labelMostFreq = new javax.swing.JLabel();
432        incidentColorChooser = new javax.swing.JColorChooser();
433        timelinesScrollPane = new javax.swing.JScrollPane();
434        timelineTickPanel = new scriptbuilder.gui.panels.TimelineTickPanel();
435        incidentTimelinePanel1 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
436        incidentTimelinePanel2 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
437        incidentTimelinePanel8 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
438        incidentTimelinePanel3 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
439        incidentTimelinePanel6 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
440        incidentTimelinePanel5 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
441        incidentTimelinePanel4 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
442        incidentTimelinePanel7 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
443        incidentTimelinePanel10 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
444        incidentTimelinePanel9 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
445        incidentNumberPanel1 = new scriptbuilder.gui.panels.IncidentNumberPanel();
446        incidentNumberPanel2 = new scriptbuilder.gui.panels.IncidentNumberPanel();
447        incidentNumberPanel3 = new scriptbuilder.gui.panels.IncidentNumberPanel();
448        incidentNumberPanel4 = new scriptbuilder.gui.panels.IncidentNumberPanel();
449        incidentNumberPanel5 = new scriptbuilder.gui.panels.IncidentNumberPanel();
450        incidentNumberPanel6 = new scriptbuilder.gui.panels.IncidentNumberPanel();
451        incidentNumberPanel7 = new scriptbuilder.gui.panels.IncidentNumberPanel();
452        incidentNumberPanel8 = new scriptbuilder.gui.panels.IncidentNumberPanel();
453        incidentNumberPanel9 = new scriptbuilder.gui.panels.IncidentNumberPanel();
454        incidentNumberPanel10 = new scriptbuilder.gui.panels.IncidentNumberPanel();
455        zoomSlider = new javax.swing.JSlider();
456        zoomInIcon = new javax.swing.JLabel();
457        zoomOutIcon = new javax.swing.JLabel();
458        timeStampScrollPane = new javax.swing.JScrollPane();
459        timeStampPanel = new scriptbuilder.gui.panels.TimeStampPanel();
460        btnAddTime = new javax.swing.JButton();
461        scriptBuilderMenuBar = new javax.swing.JMenuBar();
462        fileMenu = new javax.swing.JMenu();
463        fileNew = new javax.swing.JMenuItem();
464        jSeparator1 = new javax.swing.JPopupMenu.Separator();
465        fileOpen = new javax.swing.JMenuItem();
466        jSeparator2 = new javax.swing.JPopupMenu.Separator();
467        fileSave = new javax.swing.JMenuItem();
468        fileSaveAs = new javax.swing.JMenuItem();
469        generateMenu = new javax.swing.JMenu();
470        generateNotebooks = new javax.swing.JMenuItem();
471        generateWebNotebook = new javax.swing.JMenuItem();
472        generateScorecards = new javax.swing.JMenuItem();
473        generateOrganizationChart = new javax.swing.JMenuItem();
474        jSeparator3 = new javax.swing.JPopupMenu.Separator();
475        generateProjectRequirements = new javax.swing.JMenuItem();
476        incidentMenu = new javax.swing.JMenu();
477        newIncident = new javax.swing.JMenuItem();
478        deleteIncident = new javax.swing.JMenuItem();
479        deleteIncident1 = new javax.swing.JMenuItem();
480        jSeparator4 = new javax.swing.JPopupMenu.Separator();
481        saveIncident = new javax.swing.JMenuItem();
482        loadIncident = new javax.swing.JMenuItem();
483        generateNoiseMenu = new javax.swing.JMenu();
484        generateNoiseOption = new javax.swing.JMenuItem();
485        helpMenu1 = new javax.swing.JMenu();
486        loadUnits = new javax.swing.JMenuItem();
487        helpMenu = new javax.swing.JMenu();
488        helpTutorial = new javax.swing.JMenuItem();
489        helpAbout = new javax.swing.JMenuItem();
490
491        popupDeleteIncident.setText("Delete Incident...");
492        popupDeleteIncident.addActionListener(new java.awt.event.ActionListener() {
493            public void actionPerformed(java.awt.event.ActionEvent evt) {
494                popupDeleteIncidentActionPerformed(evt);
495            }
496        });
497        incidentPopupMenu.add(popupDeleteIncident);
498
499        cadEvent.setText("CAD Event");
500        cadEvent.addMouseListener(new java.awt.event.MouseAdapter() {
501            public void mousePressed(java.awt.event.MouseEvent evt) {
502                cadEventMousePressed(evt);
503            }
504            public void mouseReleased(java.awt.event.MouseEvent evt) {
505                cadEventMouseReleased(evt);
506            }
507        });
508        cadEvent.addActionListener(new java.awt.event.ActionListener() {
509            public void actionPerformed(java.awt.event.ActionEvent evt) {
510                cadEventActionPerformed(evt);
511            }
512        });
513        eventPopupMenu.add(cadEvent);
514
515        jMenuItem2.setText("Paramics Event");
516        eventPopupMenu.add(jMenuItem2);
517
518        radioEvent.setText("Radio Event");
519        radioEvent.addMouseListener(new java.awt.event.MouseAdapter() {
520            public void mousePressed(java.awt.event.MouseEvent evt) {
521                radioEventMousePressed(evt);
522            }
523        });
524        eventPopupMenu.add(radioEvent);
525
526        jMenuItem4.setText("Telephone Event");
527        eventPopupMenu.add(jMenuItem4);
528
529        jMenuItem5.setText("Video Event");
530        eventPopupMenu.add(jMenuItem5);
531
532        jMenuItem6.setText("Evaluation Event");
533        eventPopupMenu.add(jMenuItem6);
534
535        cadEventFrame.setMinimumSize(new java.awt.Dimension(400, 300));
536
537        labelCADEntry.setText("CAD Entry");
538
539        javax.swing.GroupLayout cadEventFrameLayout = new javax.swing.GroupLayout(cadEventFrame.getContentPane());
540        cadEventFrame.getContentPane().setLayout(cadEventFrameLayout);
541        cadEventFrameLayout.setHorizontalGroup(
542            cadEventFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
543            .addGroup(cadEventFrameLayout.createSequentialGroup()
544                .addContainerGap()
545                .addComponent(labelCADEntry, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
546                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
547        );
548        cadEventFrameLayout.setVerticalGroup(
549            cadEventFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
550            .addGroup(cadEventFrameLayout.createSequentialGroup()
551                .addContainerGap()
552                .addComponent(labelCADEntry)
553                .addContainerGap(1357, Short.MAX_VALUE))
554        );
555
556        radioEventFrame.setTitle("Add Radio Event");
557        radioEventFrame.setMinimumSize(new java.awt.Dimension(400, 300));
558
559        labelRadioType.setText("Radio Type:");
560
561        labelRadioMessage.setText("Radio Message:");
562
563        radioTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "TMT", "Maintanence" }));
564
565        radioMessageScrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
566
567        radioMessage.setColumns(20);
568        radioMessage.setLineWrap(true);
569        radioMessage.setRows(5);
570        radioMessage.setWrapStyleWord(true);
571        radioMessageScrollPane.setViewportView(radioMessage);
572
573        okButton.setText("OK");
574        okButton.addActionListener(new java.awt.event.ActionListener() {
575            public void actionPerformed(java.awt.event.ActionEvent evt) {
576                okButtonActionPerformed(evt);
577            }
578        });
579
580        cancelButton.setText("Cancel");
581        cancelButton.addActionListener(new java.awt.event.ActionListener() {
582            public void actionPerformed(java.awt.event.ActionEvent evt) {
583                cancelButtonActionPerformed(evt);
584            }
585        });
586
587        javax.swing.GroupLayout radioEventFrameLayout = new javax.swing.GroupLayout(radioEventFrame.getContentPane());
588        radioEventFrame.getContentPane().setLayout(radioEventFrameLayout);
589        radioEventFrameLayout.setHorizontalGroup(
590            radioEventFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
591            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, radioEventFrameLayout.createSequentialGroup()
592                .addContainerGap()
593                .addGroup(radioEventFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
594                    .addComponent(radioMessageScrollPane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)
595                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, radioEventFrameLayout.createSequentialGroup()
596                        .addComponent(labelRadioType)
597                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
598                        .addComponent(radioTypeComboBox, 0, 312, Short.MAX_VALUE))
599                    .addComponent(labelRadioMessage, javax.swing.GroupLayout.Alignment.LEADING)
600                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, radioEventFrameLayout.createSequentialGroup()
601                        .addComponent(cancelButton)
602                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 246, Short.MAX_VALUE)
603                        .addComponent(okButton, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)))
604                .addContainerGap())
605        );
606        radioEventFrameLayout.setVerticalGroup(
607            radioEventFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
608            .addGroup(radioEventFrameLayout.createSequentialGroup()
609                .addContainerGap()
610                .addGroup(radioEventFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
611                    .addComponent(labelRadioType)
612                    .addComponent(radioTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
613                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
614                .addComponent(labelRadioMessage)
615                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
616                .addComponent(radioMessageScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 198, Short.MAX_VALUE)
617                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
618                .addGroup(radioEventFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
619                    .addComponent(okButton)
620                    .addComponent(cancelButton))
621                .addContainerGap())
622        );
623
624        editEventList.setText("Edit...");
625        editEventList.addActionListener(new java.awt.event.ActionListener() {
626            public void actionPerformed(java.awt.event.ActionEvent evt) {
627                editEventListActionPerformed(evt);
628            }
629        });
630        eventListPopupMenu.add(editEventList);
631
632        deleteEventList.setText("Delete...");
633        eventListPopupMenu.add(deleteEventList);
634
635        incidentFrame.setTitle("Incident");
636        incidentFrame.setMinimumSize(new java.awt.Dimension(400, 400));
637
638        labelIncidentNumber.setText("Incident Number: ");
639
640        labelIncidentName.setText("Incident Name:");
641
642        labelIncidentColor.setText("Incident Color: ");
643
644        labelIncidentDescription.setText("Incident Description:");
645
646        incidentPropertiesScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
647        incidentPropertiesScrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
648
649        addIncidentDescription.setColumns(20);
650        addIncidentDescription.setLineWrap(true);
651        addIncidentDescription.setRows(5);
652        addIncidentDescription.setWrapStyleWord(true);
653        incidentPropertiesScrollPane.setViewportView(addIncidentDescription);
654
655        incidentOkButton.setText("OK");
656        incidentOkButton.addActionListener(new java.awt.event.ActionListener() {
657            public void actionPerformed(java.awt.event.ActionEvent evt) {
658                incidentOkButtonActionPerformed(evt);
659            }
660        });
661
662        incidentCancelButton.setText("Cancel");
663        incidentCancelButton.addActionListener(new java.awt.event.ActionListener() {
664            public void actionPerformed(java.awt.event.ActionEvent evt) {
665                incidentCancelButtonActionPerformed(evt);
666            }
667        });
668
669        addIncidentNumber.setModel(new javax.swing.SpinnerNumberModel(101, 101, null, 1));
670
671        addIncidentName.addActionListener(new java.awt.event.ActionListener() {
672            public void actionPerformed(java.awt.event.ActionEvent evt) {
673                addIncidentNameActionPerformed(evt);
674            }
675        });
676
677        labelIncidentLength.setText("Incident Length in Minutes: ");
678
679        labelIncidentStart.setText("Incident Start Time in Minutes:");
680
681        addIncidentStart.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1));
682
683        btnChooseColor.setText("Choose...");
684        btnChooseColor.addActionListener(new java.awt.event.ActionListener() {
685            public void actionPerformed(java.awt.event.ActionEvent evt) {
686                btnChooseColorActionPerformed(evt);
687            }
688        });
689
690        incidentColorField.setEditable(false);
691        incidentColorField.setBackground(new java.awt.Color(0, 0, 0));
692
693        txtIncidentLength.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
694        txtIncidentLength.setText("0");
695        txtIncidentLength.setToolTipText("");
696
697        jLabel1.setText("Incident Location:");
698
699        addIncidentLocation.addActionListener(new java.awt.event.ActionListener() {
700            public void actionPerformed(java.awt.event.ActionEvent evt) {
701                addIncidentLocationActionPerformed(evt);
702            }
703        });
704
705        jLabel2.setText("Incident Type:");
706
707        javax.swing.GroupLayout incidentFrameLayout = new javax.swing.GroupLayout(incidentFrame.getContentPane());
708        incidentFrame.getContentPane().setLayout(incidentFrameLayout);
709        incidentFrameLayout.setHorizontalGroup(
710            incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
711            .addGroup(incidentFrameLayout.createSequentialGroup()
712                .addContainerGap()
713                .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
714                    .addComponent(incidentPropertiesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 322, Short.MAX_VALUE)
715                    .addGroup(incidentFrameLayout.createSequentialGroup()
716                        .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
717                            .addComponent(labelIncidentNumber)
718                            .addComponent(labelIncidentName)
719                            .addComponent(labelIncidentColor))
720                        .addGap(66, 66, 66)
721                        .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
722                            .addComponent(addIncidentName, javax.swing.GroupLayout.DEFAULT_SIZE, 199, Short.MAX_VALUE)
723                            .addComponent(addIncidentNumber, javax.swing.GroupLayout.DEFAULT_SIZE, 199, Short.MAX_VALUE)
724                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, incidentFrameLayout.createSequentialGroup()
725                                .addComponent(incidentColorField, javax.swing.GroupLayout.DEFAULT_SIZE, 97, Short.MAX_VALUE)
726                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
727                                .addComponent(btnChooseColor, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE))))
728                    .addGroup(incidentFrameLayout.createSequentialGroup()
729                        .addComponent(incidentCancelButton)
730                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 188, Short.MAX_VALUE)
731                        .addComponent(incidentOkButton, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE))
732                    .addGroup(incidentFrameLayout.createSequentialGroup()
733                        .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
734                            .addComponent(labelIncidentStart)
735                            .addComponent(labelIncidentLength))
736                        .addGap(18, 18, 18)
737                        .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
738                            .addGroup(incidentFrameLayout.createSequentialGroup()
739                                .addGap(6, 6, 6)
740                                .addComponent(txtIncidentLength, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
741                                .addGap(22, 22, 22))
742                            .addComponent(addIncidentStart, javax.swing.GroupLayout.DEFAULT_SIZE, 158, Short.MAX_VALUE)))
743                    .addGroup(incidentFrameLayout.createSequentialGroup()
744                        .addComponent(jLabel2)
745                        .addGap(93, 93, 93)
746                        .addComponent(addIncidentType))
747                    .addGroup(incidentFrameLayout.createSequentialGroup()
748                        .addComponent(labelIncidentDescription)
749                        .addGap(0, 0, Short.MAX_VALUE))
750                    .addGroup(incidentFrameLayout.createSequentialGroup()
751                        .addComponent(jLabel1)
752                        .addGap(69, 69, 69)
753                        .addComponent(addIncidentLocation)))
754                .addContainerGap())
755        );
756        incidentFrameLayout.setVerticalGroup(
757            incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
758            .addGroup(incidentFrameLayout.createSequentialGroup()
759                .addContainerGap()
760                .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
761                    .addComponent(labelIncidentNumber)
762                    .addComponent(addIncidentNumber, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
763                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
764                .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
765                    .addComponent(labelIncidentName)
766                    .addComponent(addIncidentName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
767                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
768                .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
769                    .addComponent(labelIncidentColor)
770                    .addComponent(btnChooseColor)
771                    .addComponent(incidentColorField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
772                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
773                .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
774                    .addComponent(jLabel1)
775                    .addComponent(addIncidentLocation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
776                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
777                .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
778                    .addComponent(jLabel2)
779                    .addComponent(addIncidentType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
780                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
781                .addComponent(labelIncidentDescription)
782                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
783                .addComponent(incidentPropertiesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 130, Short.MAX_VALUE)
784                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
785                .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
786                    .addComponent(addIncidentStart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
787                    .addComponent(labelIncidentStart))
788                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
789                .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
790                    .addComponent(labelIncidentLength)
791                    .addComponent(txtIncidentLength))
792                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
793                .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
794                    .addComponent(incidentCancelButton)
795                    .addComponent(incidentOkButton))
796                .addContainerGap())
797        );
798
799        addNoiseFrame.setTitle("Generate Noise");
800        addNoiseFrame.setMinimumSize(new java.awt.Dimension(395, 315));
801        addNoiseFrame.setResizable(false);
802
803        labelRadioChatter.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
804        labelRadioChatter.setText("Radio Chatter: ");
805
806        labelLaneClosures.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
807        labelLaneClosures.setText("Lane Closures:");
808
809        labelTMCALLogs.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
810        labelTMCALLogs.setText("TMCAL Logs:");
811
812        txtNoiseDescription.setEditable(false);
813        txtNoiseDescription.setColumns(20);
814        txtNoiseDescription.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
815        txtNoiseDescription.setLineWrap(true);
816        txtNoiseDescription.setRows(5);
817        txtNoiseDescription.setText("Noise events will be randomly generated for the simulation with frequencies based on the control selections made below");
818        txtNoiseDescription.setWrapStyleWord(true);
819        txtNoiseDescription.setAutoscrolls(false);
820        txtNoiseDescription.setBorder(null);
821        txtNoiseDescription.setDisabledTextColor(new java.awt.Color(0, 0, 0));
822        txtNoiseDescription.setFocusable(false);
823        txtNoiseDescription.setOpaque(false);
824
825        labelBackgroundNoise.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
826        labelBackgroundNoise.setText("Background Noise: ");
827
828        labelMinorEvents.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
829        labelMinorEvents.setText("Minor Events:");
830
831        btnCancelNoise.setText("Cancel");
832        btnCancelNoise.addActionListener(new java.awt.event.ActionListener() {
833            public void actionPerformed(java.awt.event.ActionEvent evt) {
834                btnCancelNoiseActionPerformed(evt);
835            }
836        });
837
838        btnGenerateNoise.setText("Generate");
839        btnGenerateNoise.addActionListener(new java.awt.event.ActionListener() {
840            public void actionPerformed(java.awt.event.ActionEvent evt) {
841                btnGenerateNoiseActionPerformed(evt);
842            }
843        });
844
845        labelLeastFreq.setText("Least Frequent");
846
847        labelMostFreq.setText("Most Frequent");
848
849        javax.swing.GroupLayout addNoiseFrameLayout = new javax.swing.GroupLayout(addNoiseFrame.getContentPane());
850        addNoiseFrame.getContentPane().setLayout(addNoiseFrameLayout);
851        addNoiseFrameLayout.setHorizontalGroup(
852            addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
853            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, addNoiseFrameLayout.createSequentialGroup()
854                .addContainerGap(21, Short.MAX_VALUE)
855                .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
856                    .addComponent(txtNoiseDescription, javax.swing.GroupLayout.Alignment.LEADING)
857                    .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
858                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, addNoiseFrameLayout.createSequentialGroup()
859                            .addComponent(btnCancelNoise)
860                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
861                            .addComponent(btnGenerateNoise))
862                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, addNoiseFrameLayout.createSequentialGroup()
863                            .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
864                                .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
865                                    .addComponent(labelBackgroundNoise)
866                                    .addComponent(labelLaneClosures, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
867                                    .addComponent(labelTMCALLogs, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
868                                    .addComponent(labelRadioChatter, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE))
869                                .addComponent(labelMinorEvents, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE))
870                            .addGap(4, 4, 4)
871                            .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
872                                .addComponent(radioChatterSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)
873                                .addComponent(laneClosuresSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)
874                                .addComponent(TMCALSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)
875                                .addComponent(minorEventsSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)
876                                .addComponent(backgroundNoiseSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)
877                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, addNoiseFrameLayout.createSequentialGroup()
878                                    .addComponent(labelLeastFreq)
879                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
880                                    .addComponent(labelMostFreq))))))
881                .addGap(20, 20, 20))
882        );
883        addNoiseFrameLayout.setVerticalGroup(
884            addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
885            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, addNoiseFrameLayout.createSequentialGroup()
886                .addContainerGap()
887                .addComponent(txtNoiseDescription, javax.swing.GroupLayout.DEFAULT_SIZE, 39, Short.MAX_VALUE)
888                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
889                .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
890                    .addComponent(labelMostFreq)
891                    .addComponent(labelLeastFreq))
892                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
893                .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
894                    .addComponent(labelRadioChatter, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
895                    .addComponent(radioChatterSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
896                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
897                .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
898                    .addComponent(labelLaneClosures, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
899                    .addComponent(laneClosuresSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))
900                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
901                .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
902                    .addComponent(labelTMCALLogs)
903                    .addComponent(TMCALSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
904                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
905                .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
906                    .addComponent(backgroundNoiseSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
907                    .addComponent(labelBackgroundNoise, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))
908                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
909                .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
910                    .addComponent(minorEventsSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
911                    .addComponent(labelMinorEvents))
912                .addGap(18, 18, 18)
913                .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
914                    .addComponent(btnCancelNoise)
915                    .addComponent(btnGenerateNoise))
916                .addContainerGap())
917        );
918
919        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
920        setTitle("Script Builder");
921        setBounds(new java.awt.Rectangle(0, 23, 800, 700));
922        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
923        setMinimumSize(new java.awt.Dimension(800, 700));
924
925        timelinesScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
926        timelinesScrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
927        timelinesScrollPane.setFocusCycleRoot(true);
928        timelinesScrollPane.setFocusTraversalPolicyProvider(true);
929        timelinesScrollPane.setPreferredSize(new java.awt.Dimension(72000, 1341));
930        timelinesScrollPane.setWheelScrollingEnabled(false);
931
932        timelineTickPanel.setMaximumSize(new java.awt.Dimension(7200, 32767));
933        timelineTickPanel.setMinimumSize(new java.awt.Dimension(7200, 0));
934        timelineTickPanel.setPreferredSize(new java.awt.Dimension(7200, 1317));
935
936        incidentTimelinePanel1.setMaximumSize(new java.awt.Dimension(32767, 100));
937        incidentTimelinePanel1.setOpaque(false);
938        incidentTimelinePanel1.setPreferredSize(new java.awt.Dimension(691, 100));
939
940        javax.swing.GroupLayout incidentTimelinePanel1Layout = new javax.swing.GroupLayout(incidentTimelinePanel1);
941        incidentTimelinePanel1.setLayout(incidentTimelinePanel1Layout);
942        incidentTimelinePanel1Layout.setHorizontalGroup(
943            incidentTimelinePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
944            .addGap(0, 691, Short.MAX_VALUE)
945        );
946        incidentTimelinePanel1Layout.setVerticalGroup(
947            incidentTimelinePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
948            .addGap(0, 100, Short.MAX_VALUE)
949        );
950
951        incidentTimelinePanel2.setOpaque(false);
952
953        javax.swing.GroupLayout incidentTimelinePanel2Layout = new javax.swing.GroupLayout(incidentTimelinePanel2);
954        incidentTimelinePanel2.setLayout(incidentTimelinePanel2Layout);
955        incidentTimelinePanel2Layout.setHorizontalGroup(
956            incidentTimelinePanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
957            .addGap(0, 0, Short.MAX_VALUE)
958        );
959        incidentTimelinePanel2Layout.setVerticalGroup(
960            incidentTimelinePanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
961            .addGap(0, 0, Short.MAX_VALUE)
962        );
963
964        incidentTimelinePanel8.setOpaque(false);
965
966        javax.swing.GroupLayout incidentTimelinePanel8Layout = new javax.swing.GroupLayout(incidentTimelinePanel8);
967        incidentTimelinePanel8.setLayout(incidentTimelinePanel8Layout);
968        incidentTimelinePanel8Layout.setHorizontalGroup(
969            incidentTimelinePanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
970            .addGap(0, 0, Short.MAX_VALUE)
971        );
972        incidentTimelinePanel8Layout.setVerticalGroup(
973            incidentTimelinePanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
974            .addGap(0, 0, Short.MAX_VALUE)
975        );
976
977        incidentTimelinePanel3.setOpaque(false);
978
979        javax.swing.GroupLayout incidentTimelinePanel3Layout = new javax.swing.GroupLayout(incidentTimelinePanel3);
980        incidentTimelinePanel3.setLayout(incidentTimelinePanel3Layout);
981        incidentTimelinePanel3Layout.setHorizontalGroup(
982            incidentTimelinePanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
983            .addGap(0, 0, Short.MAX_VALUE)
984        );
985        incidentTimelinePanel3Layout.setVerticalGroup(
986            incidentTimelinePanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
987            .addGap(0, 0, Short.MAX_VALUE)
988        );
989
990        incidentTimelinePanel6.setOpaque(false);
991
992        javax.swing.GroupLayout incidentTimelinePanel6Layout = new javax.swing.GroupLayout(incidentTimelinePanel6);
993        incidentTimelinePanel6.setLayout(incidentTimelinePanel6Layout);
994        incidentTimelinePanel6Layout.setHorizontalGroup(
995            incidentTimelinePanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
996            .addGap(0, 0, Short.MAX_VALUE)
997        );
998        incidentTimelinePanel6Layout.setVerticalGroup(
999            incidentTimelinePanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1000            .addGap(0, 0, Short.MAX_VALUE)
1001        );
1002
1003        incidentTimelinePanel5.setOpaque(false);
1004
1005        javax.swing.GroupLayout incidentTimelinePanel5Layout = new javax.swing.GroupLayout(incidentTimelinePanel5);
1006        incidentTimelinePanel5.setLayout(incidentTimelinePanel5Layout);
1007        incidentTimelinePanel5Layout.setHorizontalGroup(
1008            incidentTimelinePanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1009            .addGap(0, 0, Short.MAX_VALUE)
1010        );
1011        incidentTimelinePanel5Layout.setVerticalGroup(
1012            incidentTimelinePanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1013            .addGap(0, 0, Short.MAX_VALUE)
1014        );
1015
1016        incidentTimelinePanel4.setOpaque(false);
1017
1018        javax.swing.GroupLayout incidentTimelinePanel4Layout = new javax.swing.GroupLayout(incidentTimelinePanel4);
1019        incidentTimelinePanel4.setLayout(incidentTimelinePanel4Layout);
1020        incidentTimelinePanel4Layout.setHorizontalGroup(
1021            incidentTimelinePanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1022            .addGap(0, 0, Short.MAX_VALUE)
1023        );
1024        incidentTimelinePanel4Layout.setVerticalGroup(
1025            incidentTimelinePanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1026            .addGap(0, 0, Short.MAX_VALUE)
1027        );
1028
1029        incidentTimelinePanel7.setOpaque(false);
1030
1031        javax.swing.GroupLayout incidentTimelinePanel7Layout = new javax.swing.GroupLayout(incidentTimelinePanel7);
1032        incidentTimelinePanel7.setLayout(incidentTimelinePanel7Layout);
1033        incidentTimelinePanel7Layout.setHorizontalGroup(
1034            incidentTimelinePanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1035            .addGap(0, 0, Short.MAX_VALUE)
1036        );
1037        incidentTimelinePanel7Layout.setVerticalGroup(
1038            incidentTimelinePanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1039            .addGap(0, 0, Short.MAX_VALUE)
1040        );
1041
1042        incidentTimelinePanel10.setOpaque(false);
1043
1044        javax.swing.GroupLayout incidentTimelinePanel10Layout = new javax.swing.GroupLayout(incidentTimelinePanel10);
1045        incidentTimelinePanel10.setLayout(incidentTimelinePanel10Layout);
1046        incidentTimelinePanel10Layout.setHorizontalGroup(
1047            incidentTimelinePanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1048            .addGap(0, 0, Short.MAX_VALUE)
1049        );
1050        incidentTimelinePanel10Layout.setVerticalGroup(
1051            incidentTimelinePanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1052            .addGap(0, 0, Short.MAX_VALUE)
1053        );
1054
1055        incidentTimelinePanel9.setOpaque(false);
1056
1057        javax.swing.GroupLayout incidentTimelinePanel9Layout = new javax.swing.GroupLayout(incidentTimelinePanel9);
1058        incidentTimelinePanel9.setLayout(incidentTimelinePanel9Layout);
1059        incidentTimelinePanel9Layout.setHorizontalGroup(
1060            incidentTimelinePanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1061            .addGap(0, 0, Short.MAX_VALUE)
1062        );
1063        incidentTimelinePanel9Layout.setVerticalGroup(
1064            incidentTimelinePanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1065            .addGap(0, 0, Short.MAX_VALUE)
1066        );
1067
1068        incidentNumberPanel1.setOpaque(false);
1069
1070        javax.swing.GroupLayout incidentNumberPanel1Layout = new javax.swing.GroupLayout(incidentNumberPanel1);
1071        incidentNumberPanel1.setLayout(incidentNumberPanel1Layout);
1072        incidentNumberPanel1Layout.setHorizontalGroup(
1073            incidentNumberPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1074            .addGap(0, 0, Short.MAX_VALUE)
1075        );
1076        incidentNumberPanel1Layout.setVerticalGroup(
1077            incidentNumberPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1078            .addGap(0, 0, Short.MAX_VALUE)
1079        );
1080
1081        incidentNumberPanel2.setOpaque(false);
1082
1083        javax.swing.GroupLayout incidentNumberPanel2Layout = new javax.swing.GroupLayout(incidentNumberPanel2);
1084        incidentNumberPanel2.setLayout(incidentNumberPanel2Layout);
1085        incidentNumberPanel2Layout.setHorizontalGroup(
1086            incidentNumberPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1087            .addGap(0, 0, Short.MAX_VALUE)
1088        );
1089        incidentNumberPanel2Layout.setVerticalGroup(
1090            incidentNumberPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1091            .addGap(0, 0, Short.MAX_VALUE)
1092        );
1093
1094        incidentNumberPanel3.setOpaque(false);
1095
1096        javax.swing.GroupLayout incidentNumberPanel3Layout = new javax.swing.GroupLayout(incidentNumberPanel3);
1097        incidentNumberPanel3.setLayout(incidentNumberPanel3Layout);
1098        incidentNumberPanel3Layout.setHorizontalGroup(
1099            incidentNumberPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1100            .addGap(0, 0, Short.MAX_VALUE)
1101        );
1102        incidentNumberPanel3Layout.setVerticalGroup(
1103            incidentNumberPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1104            .addGap(0, 0, Short.MAX_VALUE)
1105        );
1106
1107        incidentNumberPanel4.setOpaque(false);
1108
1109        javax.swing.GroupLayout incidentNumberPanel4Layout = new javax.swing.GroupLayout(incidentNumberPanel4);
1110        incidentNumberPanel4.setLayout(incidentNumberPanel4Layout);
1111        incidentNumberPanel4Layout.setHorizontalGroup(
1112            incidentNumberPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1113            .addGap(0, 0, Short.MAX_VALUE)
1114        );
1115        incidentNumberPanel4Layout.setVerticalGroup(
1116            incidentNumberPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1117            .addGap(0, 0, Short.MAX_VALUE)
1118        );
1119
1120        incidentNumberPanel5.setOpaque(false);
1121
1122        javax.swing.GroupLayout incidentNumberPanel5Layout = new javax.swing.GroupLayout(incidentNumberPanel5);
1123        incidentNumberPanel5.setLayout(incidentNumberPanel5Layout);
1124        incidentNumberPanel5Layout.setHorizontalGroup(
1125            incidentNumberPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1126            .addGap(0, 0, Short.MAX_VALUE)
1127        );
1128        incidentNumberPanel5Layout.setVerticalGroup(
1129            incidentNumberPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1130            .addGap(0, 0, Short.MAX_VALUE)
1131        );
1132
1133        incidentNumberPanel6.setOpaque(false);
1134
1135        javax.swing.GroupLayout incidentNumberPanel6Layout = new javax.swing.GroupLayout(incidentNumberPanel6);
1136        incidentNumberPanel6.setLayout(incidentNumberPanel6Layout);
1137        incidentNumberPanel6Layout.setHorizontalGroup(
1138            incidentNumberPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1139            .addGap(0, 0, Short.MAX_VALUE)
1140        );
1141        incidentNumberPanel6Layout.setVerticalGroup(
1142            incidentNumberPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1143            .addGap(0, 0, Short.MAX_VALUE)
1144        );
1145
1146        incidentNumberPanel7.setOpaque(false);
1147
1148        javax.swing.GroupLayout incidentNumberPanel7Layout = new javax.swing.GroupLayout(incidentNumberPanel7);
1149        incidentNumberPanel7.setLayout(incidentNumberPanel7Layout);
1150        incidentNumberPanel7Layout.setHorizontalGroup(
1151            incidentNumberPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1152            .addGap(0, 0, Short.MAX_VALUE)
1153        );
1154        incidentNumberPanel7Layout.setVerticalGroup(
1155            incidentNumberPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1156            .addGap(0, 0, Short.MAX_VALUE)
1157        );
1158
1159        incidentNumberPanel8.setOpaque(false);
1160
1161        javax.swing.GroupLayout incidentNumberPanel8Layout = new javax.swing.GroupLayout(incidentNumberPanel8);
1162        incidentNumberPanel8.setLayout(incidentNumberPanel8Layout);
1163        incidentNumberPanel8Layout.setHorizontalGroup(
1164            incidentNumberPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1165            .addGap(0, 0, Short.MAX_VALUE)
1166        );
1167        incidentNumberPanel8Layout.setVerticalGroup(
1168            incidentNumberPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1169            .addGap(0, 0, Short.MAX_VALUE)
1170        );
1171
1172        incidentNumberPanel9.setOpaque(false);
1173
1174        javax.swing.GroupLayout incidentNumberPanel9Layout = new javax.swing.GroupLayout(incidentNumberPanel9);
1175        incidentNumberPanel9.setLayout(incidentNumberPanel9Layout);
1176        incidentNumberPanel9Layout.setHorizontalGroup(
1177            incidentNumberPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1178            .addGap(0, 0, Short.MAX_VALUE)
1179        );
1180        incidentNumberPanel9Layout.setVerticalGroup(
1181            incidentNumberPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1182            .addGap(0, 0, Short.MAX_VALUE)
1183        );
1184
1185        incidentNumberPanel10.setOpaque(false);
1186
1187        javax.swing.GroupLayout incidentNumberPanel10Layout = new javax.swing.GroupLayout(incidentNumberPanel10);
1188        incidentNumberPanel10.setLayout(incidentNumberPanel10Layout);
1189        incidentNumberPanel10Layout.setHorizontalGroup(
1190            incidentNumberPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1191            .addGap(0, 0, Short.MAX_VALUE)
1192        );
1193        incidentNumberPanel10Layout.setVerticalGroup(
1194            incidentNumberPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1195            .addGap(0, 0, Short.MAX_VALUE)
1196        );
1197
1198        javax.swing.GroupLayout timelineTickPanelLayout = new javax.swing.GroupLayout(timelineTickPanel);
1199        timelineTickPanel.setLayout(timelineTickPanelLayout);
1200        timelineTickPanelLayout.setHorizontalGroup(
1201            timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1202            .addGroup(timelineTickPanelLayout.createSequentialGroup()
1203                .addContainerGap()
1204                .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
1205                    .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1206                        .addComponent(incidentNumberPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1207                        .addComponent(incidentNumberPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1208                    .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1209                        .addComponent(incidentNumberPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1210                        .addComponent(incidentNumberPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1211                        .addComponent(incidentNumberPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1212                        .addComponent(incidentNumberPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1213                        .addComponent(incidentNumberPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1214                        .addComponent(incidentNumberPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1215                        .addComponent(incidentNumberPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1216                    .addComponent(incidentNumberPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1217                .addGap(10, 10, 10)
1218                .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1219                    .addComponent(incidentTimelinePanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
1220                    .addComponent(incidentTimelinePanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1221                    .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
1222                        .addComponent(incidentTimelinePanel5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
1223                        .addComponent(incidentTimelinePanel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1224                    .addComponent(incidentTimelinePanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1225                    .addComponent(incidentTimelinePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1226                    .addComponent(incidentTimelinePanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1227                    .addComponent(incidentTimelinePanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1228                    .addComponent(incidentTimelinePanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1229                    .addComponent(incidentTimelinePanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1230                .addGap(190, 190, 190))
1231        );
1232        timelineTickPanelLayout.setVerticalGroup(
1233            timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1234            .addGroup(timelineTickPanelLayout.createSequentialGroup()
1235                .addContainerGap()
1236                .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1237                    .addComponent(incidentNumberPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1238                    .addComponent(incidentTimelinePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1239                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1240                .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1241                    .addGroup(timelineTickPanelLayout.createSequentialGroup()
1242                        .addComponent(incidentNumberPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1243                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1244                        .addComponent(incidentNumberPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1245                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1246                        .addComponent(incidentNumberPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1247                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1248                        .addComponent(incidentNumberPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1249                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1250                        .addComponent(incidentNumberPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1251                    .addGroup(timelineTickPanelLayout.createSequentialGroup()
1252                        .addComponent(incidentTimelinePanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1253                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1254                        .addComponent(incidentTimelinePanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1255                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1256                        .addComponent(incidentTimelinePanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1257                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1258                        .addComponent(incidentTimelinePanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1259                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1260                        .addComponent(incidentTimelinePanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
1261                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1262                .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1263                    .addComponent(incidentTimelinePanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1264                    .addComponent(incidentNumberPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1265                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1266                .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1267                    .addGroup(timelineTickPanelLayout.createSequentialGroup()
1268                        .addComponent(incidentTimelinePanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1269                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1270                        .addComponent(incidentTimelinePanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1271                    .addGroup(timelineTickPanelLayout.createSequentialGroup()
1272                        .addComponent(incidentNumberPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1273                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1274                        .addComponent(incidentNumberPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
1275                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1276                .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1277                    .addComponent(incidentNumberPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1278                    .addComponent(incidentTimelinePanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1279                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
1280        );
1281
1282        timelinesScrollPane.setViewportView(timelineTickPanel);
1283
1284        zoomSlider.setMaximum(22);
1285        zoomSlider.setMinimum(4);
1286        zoomSlider.setValue(4);
1287        zoomSlider.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
1288        zoomSlider.setFocusable(false);
1289        zoomSlider.addChangeListener(new javax.swing.event.ChangeListener() {
1290            public void stateChanged(javax.swing.event.ChangeEvent evt) {
1291                zoomSliderStateChanged(evt);
1292            }
1293        });
1294
1295        zoomInIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/ZoomIn.png"))); // NOI18N
1296        zoomInIcon.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
1297        zoomInIcon.addMouseListener(new java.awt.event.MouseAdapter() {
1298            public void mouseClicked(java.awt.event.MouseEvent evt) {
1299                zoomInIconMouseClicked(evt);
1300            }
1301        });
1302
1303        zoomOutIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/ZoomOut.png"))); // NOI18N
1304        zoomOutIcon.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
1305        zoomOutIcon.addMouseListener(new java.awt.event.MouseAdapter() {
1306            public void mouseClicked(java.awt.event.MouseEvent evt) {
1307                zoomOutIconMouseClicked(evt);
1308            }
1309        });
1310
1311        timeStampScrollPane.setBorder(null);
1312        timeStampScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
1313        timeStampScrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
1314
1315        javax.swing.GroupLayout timeStampPanelLayout = new javax.swing.GroupLayout(timeStampPanel);
1316        timeStampPanel.setLayout(timeStampPanelLayout);
1317        timeStampPanelLayout.setHorizontalGroup(
1318            timeStampPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1319            .addGap(0, 0, Short.MAX_VALUE)
1320        );
1321        timeStampPanelLayout.setVerticalGroup(
1322            timeStampPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1323            .addGap(0, 0, Short.MAX_VALUE)
1324        );
1325
1326        timeStampScrollPane.setViewportView(timeStampPanel);
1327
1328        btnAddTime.setText("+15:00");
1329        btnAddTime.addActionListener(new java.awt.event.ActionListener() {
1330            public void actionPerformed(java.awt.event.ActionEvent evt) {
1331                btnAddTimeActionPerformed(evt);
1332            }
1333        });
1334
1335        scriptBuilderMenuBar.addAncestorListener(new javax.swing.event.AncestorListener() {
1336            public void ancestorMoved(javax.swing.event.AncestorEvent evt) {
1337            }
1338            public void ancestorAdded(javax.swing.event.AncestorEvent evt) {
1339                scriptBuilderMenuBarAncestorAdded(evt);
1340            }
1341            public void ancestorRemoved(javax.swing.event.AncestorEvent evt) {
1342            }
1343        });
1344
1345        fileMenu.setText("File");
1346        fileMenu.setMargin(new java.awt.Insets(0, 10, 0, 10));
1347        fileMenu.addActionListener(new java.awt.event.ActionListener() {
1348            public void actionPerformed(java.awt.event.ActionEvent evt) {
1349                fileMenuActionPerformed(evt);
1350            }
1351        });
1352
1353        fileNew.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
1354        fileNew.setText("New");
1355        fileNew.addActionListener(new java.awt.event.ActionListener() {
1356            public void actionPerformed(java.awt.event.ActionEvent evt) {
1357                fileNewActionPerformed(evt);
1358            }
1359        });
1360        fileMenu.add(fileNew);
1361        fileMenu.add(jSeparator1);
1362
1363        fileOpen.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
1364        fileOpen.setText("Open...");
1365        fileOpen.addActionListener(new java.awt.event.ActionListener() {
1366            public void actionPerformed(java.awt.event.ActionEvent evt) {
1367                fileOpenActionPerformed(evt);
1368            }
1369        });
1370        fileMenu.add(fileOpen);
1371        fileMenu.add(jSeparator2);
1372
1373        fileSave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
1374        fileSave.setText("Save");
1375        fileSave.addActionListener(new java.awt.event.ActionListener() {
1376            public void actionPerformed(java.awt.event.ActionEvent evt) {
1377                fileSaveActionPerformed(evt);
1378            }
1379        });
1380        fileMenu.add(fileSave);
1381
1382        fileSaveAs.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
1383        fileSaveAs.setText("Save as...");
1384        fileSaveAs.addActionListener(new java.awt.event.ActionListener() {
1385            public void actionPerformed(java.awt.event.ActionEvent evt) {
1386                fileSaveAsActionPerformed(evt);
1387            }
1388        });
1389        fileMenu.add(fileSaveAs);
1390
1391        scriptBuilderMenuBar.add(fileMenu);
1392
1393        generateMenu.setLabel("Generate");
1394        generateMenu.setMargin(new java.awt.Insets(0, 10, 0, 10));
1395
1396        generateNotebooks.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
1397        generateNotebooks.setText("Generate Notebooks...");
1398        generateNotebooks.addActionListener(new java.awt.event.ActionListener() {
1399            public void actionPerformed(java.awt.event.ActionEvent evt) {
1400                generateNotebooksActionPerformed(evt);
1401            }
1402        });
1403        generateMenu.add(generateNotebooks);
1404
1405        generateWebNotebook.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_W, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
1406        generateWebNotebook.setText("Generate Web Notebook...");
1407        generateWebNotebook.addActionListener(new java.awt.event.ActionListener() {
1408            public void actionPerformed(java.awt.event.ActionEvent evt) {
1409                generateWebNotebookActionPerformed(evt);
1410            }
1411        });
1412        generateMenu.add(generateWebNotebook);
1413
1414        generateScorecards.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
1415        generateScorecards.setText("Generate Scorecards...");
1416        generateScorecards.addActionListener(new java.awt.event.ActionListener() {
1417            public void actionPerformed(java.awt.event.ActionEvent evt) {
1418                generateScorecardsActionPerformed(evt);
1419            }
1420        });
1421        generateMenu.add(generateScorecards);
1422
1423        generateOrganizationChart.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
1424        generateOrganizationChart.setText("Generate D14 TMC Org Chart...");
1425        generateOrganizationChart.addActionListener(new java.awt.event.ActionListener() {
1426            public void actionPerformed(java.awt.event.ActionEvent evt) {
1427                generateOrganizationChartActionPerformed(evt);
1428            }
1429        });
1430        generateMenu.add(generateOrganizationChart);
1431        generateMenu.add(jSeparator3);
1432
1433        generateProjectRequirements.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
1434        generateProjectRequirements.setText("Generate Project Worklist...");
1435        generateProjectRequirements.addActionListener(new java.awt.event.ActionListener() {
1436            public void actionPerformed(java.awt.event.ActionEvent evt) {
1437                generateProjectRequirementsActionPerformed(evt);
1438            }
1439        });
1440        generateMenu.add(generateProjectRequirements);
1441
1442        scriptBuilderMenuBar.add(generateMenu);
1443
1444        incidentMenu.setText("Incidents");
1445        incidentMenu.setMargin(new java.awt.Insets(0, 10, 0, 10));
1446
1447        newIncident.setText("New Incident...");
1448        newIncident.addActionListener(new java.awt.event.ActionListener() {
1449            public void actionPerformed(java.awt.event.ActionEvent evt) {
1450                newIncidentActionPerformed(evt);
1451            }
1452        });
1453        incidentMenu.add(newIncident);
1454
1455        deleteIncident.setText("Delete Incident");
1456        deleteIncident.addActionListener(new java.awt.event.ActionListener() {
1457            public void actionPerformed(java.awt.event.ActionEvent evt) {
1458                deleteIncidentActionPerformed(evt);
1459            }
1460        });
1461        incidentMenu.add(deleteIncident);
1462
1463        deleteIncident1.setText("Edit Incident...");
1464        deleteIncident1.addActionListener(new java.awt.event.ActionListener() {
1465            public void actionPerformed(java.awt.event.ActionEvent evt) {
1466                incidentDetailsActionPerformed(evt);
1467            }
1468        });
1469        incidentMenu.add(deleteIncident1);
1470        incidentMenu.add(jSeparator4);
1471
1472        saveIncident.setText("Save Incident...");
1473        saveIncident.addActionListener(new java.awt.event.ActionListener() {
1474            public void actionPerformed(java.awt.event.ActionEvent evt) {
1475                saveIncidentActionPerformed(evt);
1476            }
1477        });
1478        incidentMenu.add(saveIncident);
1479
1480        loadIncident.setText("Load Incident...");
1481        loadIncident.addActionListener(new java.awt.event.ActionListener() {
1482            public void actionPerformed(java.awt.event.ActionEvent evt) {
1483                loadIncidentActionPerformed(evt);
1484            }
1485        });
1486        incidentMenu.add(loadIncident);
1487
1488        scriptBuilderMenuBar.add(incidentMenu);
1489
1490        generateNoiseMenu.setText("Noise");
1491
1492        generateNoiseOption.setText("Generate Noise...");
1493        generateNoiseOption.addActionListener(new java.awt.event.ActionListener() {
1494            public void actionPerformed(java.awt.event.ActionEvent evt) {
1495                generateNoiseOptionActionPerformed(evt);
1496            }
1497        });
1498        generateNoiseMenu.add(generateNoiseOption);
1499
1500        scriptBuilderMenuBar.add(generateNoiseMenu);
1501
1502        helpMenu1.setText("Unit");
1503        helpMenu1.setMargin(new java.awt.Insets(0, 10, 0, 10));
1504
1505        loadUnits.setText("Load Additional Units");
1506        loadUnits.addActionListener(new java.awt.event.ActionListener() {
1507            public void actionPerformed(java.awt.event.ActionEvent evt) {
1508                loadUnitsActionPerformed(evt);
1509            }
1510        });
1511        helpMenu1.add(loadUnits);
1512
1513        scriptBuilderMenuBar.add(helpMenu1);
1514
1515        helpMenu.setText("Help");
1516        helpMenu.setMargin(new java.awt.Insets(0, 10, 0, 10));
1517
1518        helpTutorial.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0));
1519        helpTutorial.setText("Tutorial...");
1520        helpTutorial.addActionListener(new java.awt.event.ActionListener() {
1521            public void actionPerformed(java.awt.event.ActionEvent evt) {
1522                helpTutorialActionPerformed(evt);
1523            }
1524        });
1525        helpMenu.add(helpTutorial);
1526
1527        helpAbout.setText("About...");
1528        helpAbout.addActionListener(new java.awt.event.ActionListener() {
1529            public void actionPerformed(java.awt.event.ActionEvent evt) {
1530                helpAboutActionPerformed(evt);
1531            }
1532        });
1533        helpMenu.add(helpAbout);
1534
1535        scriptBuilderMenuBar.add(helpMenu);
1536
1537        setJMenuBar(scriptBuilderMenuBar);
1538
1539        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
1540        getContentPane().setLayout(layout);
1541        layout.setHorizontalGroup(
1542            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1543            .addGroup(layout.createSequentialGroup()
1544                .addContainerGap()
1545                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1546                    .addComponent(timelinesScrollPane, 0, 0, Short.MAX_VALUE)
1547                    .addComponent(timeStampScrollPane)
1548                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
1549                        .addGap(0, 604, Short.MAX_VALUE)
1550                        .addComponent(zoomOutIcon)
1551                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1552                        .addComponent(zoomSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
1553                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1554                        .addComponent(zoomInIcon)
1555                        .addGap(18, 18, 18)
1556                        .addComponent(btnAddTime)
1557                        .addGap(21, 21, 21)))
1558                .addContainerGap())
1559        );
1560        layout.setVerticalGroup(
1561            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1562            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
1563                .addContainerGap()
1564                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
1565                    .addComponent(zoomOutIcon)
1566                    .addComponent(zoomSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1567                    .addComponent(zoomInIcon)
1568                    .addComponent(btnAddTime))
1569                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1570                .addComponent(timeStampScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
1571                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1572                .addComponent(timelinesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1289, Short.MAX_VALUE)
1573                .addContainerGap())
1574        );
1575
1576        pack();
1577    }// </editor-fold>//GEN-END:initComponents
1578
1579    /**
1580     * Scale the timeline width based on zoom slider position.
1581     *
1582     * @param evt the state change event
1583     */
1584    private void zoomSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_zoomSliderStateChanged
1585        //Changing the zoom level always refreshes the window
1586        ScriptBuilderGuiConstants.PIXEL_WIDTH_PER_HORIZONTAL_TICK = zoomSlider.getValue();
1587        this.update(script, script);
1588        pack();
1589        repaint();
1590    }//GEN-LAST:event_zoomSliderStateChanged
1591
1592    private void cadEventMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cadEventMousePressed
1593    }//GEN-LAST:event_cadEventMousePressed
1594
1595    private void radioEventMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_radioEventMousePressed
1596    }//GEN-LAST:event_radioEventMousePressed
1597
1598    private void cadEventMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cadEventMouseReleased
1599    }//GEN-LAST:event_cadEventMouseReleased
1600
1601    private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
1602    }//GEN-LAST:event_okButtonActionPerformed
1603
1604    /**
1605     * If cancel button is pressed, close radio event editor
1606     *
1607     * @param evt the button press event
1608     */
1609    private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
1610        radioMessage.setText("");
1611        radioTypeComboBox.setSelectedIndex(0);
1612        radioEventFrame.setVisible(false);
1613    }//GEN-LAST:event_cancelButtonActionPerformed
1614
1615    private void editEventListActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editEventListActionPerformed
1616    }//GEN-LAST:event_editEventListActionPerformed
1617
1618    /**
1619     * Executed when the "OK" button is pressed on the Incident editor. If
1620     * incident is new, and is valid, adds it to the model and updates. If
1621     * editing existing incident, verifies changes are valid and applies them.
1622     * Then closes editor window.
1623     *
1624     * @param evt the button press event
1625     */
1626    private void incidentOkButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_incidentOkButtonActionPerformed
1627        if (!editingIncident)//adding new incident
1628        {
1629            boolean found = false;
1630            int indx = 0;
1631            // ALERT: Wacky logic follows
1632            // Examine all the incidents contained in this script
1633            for (ScriptIncident inci : script.incidents)
1634            {
1635                // If this spot in the list of incidents hasn't been assigned yet
1636                if (inci == null)
1637                {
1638                    found = true;
1639                    break;
1640                }
1641                ++indx;
1642                // Does the new incident number match an existing one?
1643                if (inci.number == (Integer) addIncidentNumber.getValue())
1644                {
1645                    JOptionPane.showMessageDialog(this, "Incident number already in use.",
1646                            "Unable to Create Incident", JOptionPane.ERROR_MESSAGE);
1647                    incidentFrame.setVisible(true);
1648                    return;
1649                }
1650            }
1651            // We examined all incidents and there wasn't an empty slot
1652            if (!found)
1653            {
1654                JOptionPane.showMessageDialog(this, "Script already has the max number of incidents.",
1655                        "Unable to Create Incident", JOptionPane.ERROR_MESSAGE);
1656                incidentFrame.setVisible(true);
1657                // ALERT: exit from middle of method
1658                return;
1659            }
1660
1661            // We found a spot for the new incident
1662            script.incidents.remove(indx); // remove the null incident placeholder
1663            SimulationScript.incidentColors[indx] = selectedColor;
1664            // Add the new incident to the list
1665            //todo: need to add new data to the ScriptIncident Object here
1666            script.incidents.add(indx,
1667                    new ScriptIncident(SimulationScript.incidentColors[indx],
1668                            (Integer) addIncidentNumber.getValue(), addIncidentName.getText(), addIncidentDescription.getText(),
1669                            script,0));
1670           
1671            script.incidents.get(indx).setOffset((Integer) addIncidentStart.getValue() * 60);
1672            script.incidents.get(indx).insertCadData((Integer) addIncidentStart.getValue(), new CadData(addIncidentType.getText(),addIncidentLocation.getText()));
1673            script.numberOfIncidents++;
1674           
1675            IncidentEditorFrame editor = new IncidentEditorFrame(script.incidents.get(indx), this);
1676
1677            editor.setVisible(true);
1678        }
1679        else//editing existing incident
1680        {
1681            //adjust incident color
1682            script.incidents.get(oldIncidentIndex).color = selectedColor;
1683            //adjust incident name
1684            script.incidents.get(oldIncidentIndex).name = addIncidentName.getText();
1685            //adjust incident description
1686            script.incidents.get(oldIncidentIndex).description = addIncidentDescription.getText();
1687            //change offset of incident
1688            script.incidents.get(oldIncidentIndex).setOffset(((int) addIncidentStart.getValue()) * 60);
1689           
1690            script.incidents.get(oldIncidentIndex).insertCadData((int) addIncidentStart.getValue() * 60, new CadData(addIncidentType.getText(),addIncidentLocation.getText()));
1691            //update incident number, if it was changed
1692            if ((int) addIncidentNumber.getValue() == script.incidents.get(oldIncidentIndex).number
1693                    || !scriptContainsLogNum(script, (int) addIncidentNumber.getValue()))
1694            {
1695                script.incidents.get(oldIncidentIndex).number = (int) addIncidentNumber.getValue();
1696            }
1697            else//if the updated value conflicts with an existing inc number,
1698            //the inc number update fails
1699            {
1700                JOptionPane.showMessageDialog(this, "Incident number already in use.",
1701                        "Unable To Alter Incident Detail", JOptionPane.ERROR_MESSAGE);
1702            }
1703        }
1704
1705        //close this frame
1706        incidentFrame.setVisible(false);
1707        this.update(script, script);
1708        repaint();
1709    }//GEN-LAST:event_incidentOkButtonActionPerformed
1710    /**
1711     * Calling this will check to see if the model has been updated.
1712     * @param save indicated whether or not the file needs to be saved
1713     */
1714    private void checkNeedsSave(){
1715       
1716        if(!script.saved){
1717            changeFrameTitle("*");
1718        }else{
1719            changeFrameTitle("");
1720        }
1721    }
1722    /**
1723     *
1724     * @param ext changes title by putting ext after current title.
1725     */
1726    private void changeFrameTitle(String ext){
1727        String t = "Script Builder: ";
1728        if (script.saveFile == null)
1729        {
1730            t += "untitled1.xml";
1731        }
1732        else
1733        {
1734            t += script.saveFile.getName();
1735        }
1736        t+= ext;
1737        this.setTitle(t);
1738    }
1739    /**
1740     *
1741     * Determine if the given incident number is already present in the script.
1742     *
1743     * @param script the current simulation script
1744     * @param num the incident log number to check
1745     * @return true if one of the existing incidents in the script uses that log
1746     * number
1747     */
1748    private boolean scriptContainsLogNum(SimulationScript script, int num)
1749    {
1750        for (ScriptIncident incident : script.incidents)
1751        {
1752            if (incident != null && incident.number == num)
1753            {
1754                return true;
1755            }
1756        }
1757        return false;
1758    }
1759
1760    /**
1761     * Closes editor window upon click of cancel button.
1762     *
1763     * @param evt the button press event
1764     */
1765    private void incidentCancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_incidentCancelButtonActionPerformed
1766        incidentFrame.setVisible(false);
1767    }//GEN-LAST:event_incidentCancelButtonActionPerformed
1768
1769    /**
1770     * Opens incident editor window and preps for addition of new incident, upon
1771     * click of "New Incident" menu option.
1772     *
1773     * @param evt the button press event
1774     */
1775    private void newIncidentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newIncidentActionPerformed
1776        editingIncident = false;
1777
1778        addIncidentName.setText("");
1779        int newLogNum = 100;
1780        boolean found = false;
1781        while (!found)
1782        {
1783            newLogNum++;
1784            if (!scriptContainsLogNum(script, newLogNum))
1785            {
1786                found = true;
1787                for (ScriptIncident incident : script.incidents)
1788                {
1789                    if (incident != null && incident.number == newLogNum)
1790                    {
1791                        found = false;
1792                    }
1793                }
1794            }
1795        }
1796
1797        addIncidentNumber.setValue(newLogNum);
1798        addIncidentStart.setValue(0);
1799        txtIncidentLength.setText("0");
1800        incidentColorField.setBackground(Color.BLACK);
1801        String colStr = "" + Integer.toHexString(Color.BLACK.getRed())
1802                + Integer.toHexString(Color.BLACK.getGreen())
1803                + Integer.toHexString(Color.BLACK.getBlue());
1804        incidentColorField.setText(colStr);
1805        selectedColor = Color.BLACK;
1806        addIncidentDescription.setText("");
1807        addIncidentLocation.setText("");
1808        addIncidentType.setText("");
1809
1810        incidentFrame.setVisible(true);
1811    }//GEN-LAST:event_newIncidentActionPerformed
1812
1813    private void fileMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileMenuActionPerformed
1814    }//GEN-LAST:event_fileMenuActionPerformed
1815
1816    /**
1817     * Upon click of "Open file" menu option, opens a window to load a new .sim
1818     * file.
1819     *
1820     * @param evt the button press event
1821     */
1822    private void fileOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileOpenActionPerformed
1823        JFileChooser fc = new JFileChooser();
1824
1825        //Search for .xml files
1826        fc.setFileFilter(new ExtensionFileFilter("Simulation Script XML (.xml)",
1827                new String[]
1828                {
1829                    "xml"
1830                }));
1831        if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
1832        {
1833            //make a new script and load it with values from the selected file
1834            script = new SimulationScript();
1835            script.loadScriptFromFile(fc.getSelectedFile());
1836            script.saveFile = fc.getSelectedFile();
1837        }
1838       
1839        this.update(script, script);
1840        //zoom out all the way so that the whole imported script is visible
1841        zoomSlider.setValue(zoomSlider.getMinimum());
1842        repaint();
1843    }//GEN-LAST:event_fileOpenActionPerformed
1844
1845    /**
1846     * Upon click of "Save as" menu option, opens a window to choose a .sim file
1847     * to save this as.
1848     *
1849     * @param evt the button press event
1850     */
1851    private void fileSaveAsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileSaveAsActionPerformed
1852        JFileChooser fc = new JFileChooser();
1853        boolean wasNull = false;
1854        if (script.saveFile == null)
1855        {
1856            wasNull = true;
1857            String fName = "untitled";
1858            int untitledCount = 1;
1859            while (new File("" + fName + untitledCount + ".xml").exists())
1860            {
1861                untitledCount++;
1862            }
1863            script.saveFile = new File("" + fName + untitledCount + ".xml");
1864           
1865        }
1866
1867        fc.setSelectedFile(script.saveFile);
1868        fc.setFileFilter(new ExtensionFileFilter("Simulation Script XML (.xml)",
1869                new String[]
1870                {
1871                    "xml"
1872                }));
1873
1874        if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION)
1875        {
1876            String filename = fc.getSelectedFile().toString();
1877            if (!filename.endsWith(".xml"))
1878            {
1879                filename += ".xml";
1880
1881            }
1882            script.saveScriptToFile(new File(filename));
1883            script.saveFile = new File(filename);
1884           
1885        }
1886        else
1887        {
1888            if (wasNull)
1889            {
1890                script.saveFile = null;
1891            }
1892        }
1893       
1894        this.update(script, 0);
1895    }//GEN-LAST:event_fileSaveAsActionPerformed
1896
1897    /**
1898     * Upon click of "Save" menu option, opens a window to choose a .sim file to
1899     * save this as.
1900     *
1901     * @param evt the button press event
1902     */
1903    private void fileSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileSaveActionPerformed
1904        //If the script has never been saved before, we need to name or create a
1905        //file in which to save it
1906        if (script.saveFile == null)
1907        {
1908            fileSaveAsActionPerformed(evt);
1909        }
1910        //Otherwise, just save to the previously selected save spot
1911        else
1912        {
1913           
1914            script.saveScriptToFile(script.saveFile);
1915        }
1916        //TODO: TEST TO MAKE SURE THIS DOES NOT CREATE BADDIES
1917        this.update(script, 0);
1918    }//GEN-LAST:event_fileSaveActionPerformed
1919
1920    /**
1921     * Allow this window to refresh itself, after a different window loses
1922     * focus.
1923     */
1924    public void returnFocus()
1925    {
1926        zoomSlider.setValue(zoomSlider.getMinimum());
1927        zoomSliderStateChanged(new ChangeEvent(script));
1928    }
1929
1930    /**
1931     * Set up the incident details/properties window so that it reflects the
1932     * values of the selected incident. Then, make the window visible.
1933     *
1934     * @param i the incident to be represented by this details window
1935     */
1936    public void incidentDetailsScreen(ScriptIncident i)
1937    {
1938        editingIncident = true;
1939        oldIncidentIndex = script.incidents.indexOf(i);
1940
1941        addIncidentName.setText(i.name);
1942        addIncidentNumber.setValue(i.number);
1943        addIncidentLocation.setText(i.getCadData(i.offset).Header_FullLoc);
1944        addIncidentType.setText(i.getCadData(i.offset).Header_Type);
1945        addIncidentStart.setValue(i.offset / 60);
1946        txtIncidentLength.setText("" + (i.length / 60));
1947        txtIncidentLength.setHorizontalTextPosition(SwingConstants.RIGHT);
1948        //addIncidentLength.setValue(i.length / 60);
1949        incidentColorField.setBackground(i.color);
1950        String colStr = "" + Integer.toHexString(i.color.getRed())
1951                + Integer.toHexString(i.color.getGreen())
1952                + Integer.toHexString(i.color.getBlue());
1953        incidentColorField.setText(colStr);
1954        selectedColor = i.color;
1955        addIncidentDescription.setText(i.description);
1956
1957        incidentFrame.setVisible(true);
1958    }
1959
1960    /**
1961     * Brings up the noise generation screen upon click of the "Generate Noise"
1962     * menu option.
1963     *
1964     * @param evt the button press event
1965     */
1966    private void generateNoiseOptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateNoiseOptionActionPerformed
1967        addNoiseFrame.setVisible(true);
1968    }//GEN-LAST:event_generateNoiseOptionActionPerformed
1969
1970    /**
1971     * Hides the noise generation screen upon click of the "Cancel" button.
1972     *
1973     * @param evt the button press event
1974     */
1975    private void btnCancelNoiseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelNoiseActionPerformed
1976        addNoiseFrame.setVisible(false);
1977    }//GEN-LAST:event_btnCancelNoiseActionPerformed
1978
1979    /**
1980     * Generates random noise upon click of the "Generate" button, then hides
1981     * the noise generation screen.
1982     *
1983     * @param evt the button press event
1984     */
1985    private void btnGenerateNoiseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGenerateNoiseActionPerformed
1986        Random rng = new Random();
1987        ScriptEventType[] eventTypes = ScriptEventType.values();
1988
1989        /*This feature has not yet been implemented. Show a message and just return.*/
1990        if (true)
1991        {
1992            JOptionPane.showMessageDialog(this, "This feature has not yet been implemented.\n",
1993                    "Feature not implemented", JOptionPane.INFORMATION_MESSAGE);
1994
1995            return;
1996        }
1997
1998        /* For prototyping purpose, ignore the sliders and average their values */
1999        int total = radioChatterSlider.getValue() + laneClosuresSlider.getValue() + TMCALSlider.getValue() + minorEventsSlider.getValue() + backgroundNoiseSlider.getValue();
2000        total /= 5;
2001
2002        for (int i = 0; i < script.incidents.get(9).slices.size(); i++)
2003        {
2004            script.incidents.get(9).slices.get(i).events.clear();
2005        }
2006
2007        for (int i = 0; i < total; i++)
2008        {
2009            int n = rng.nextInt();
2010            int s = rng.nextInt();
2011            int e = rng.nextInt();
2012            if (n < 0)
2013            {
2014                n *= -1;
2015            }
2016            if (s < 0)
2017            {
2018                s *= -1;
2019            }
2020            if (e < 0)
2021            {
2022                e *= -1;
2023            }
2024
2025            script.incidents.get(9).slices.get(s % (script.incidents.get(9).slices.size())).addEvent(ScriptEvent.factoryByType(eventTypes[e % eventTypes.length]));
2026        }
2027
2028        addNoiseFrame.setVisible(false);
2029
2030        this.update(script, script);
2031        repaint();
2032}//GEN-LAST:event_btnGenerateNoiseActionPerformed
2033
2034    /**
2035     * Allow the user to pick an incident from a dropdown, then save it to an
2036     * XML file.
2037     *
2038     * @param evt the button press event
2039     */
2040    private void saveIncidentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveIncidentActionPerformed
2041        Object[] incidentList = script.incidents.toArray();
2042        String input = "";
2043        ScriptIncident inc = null;
2044
2045        //Pick the incident to save
2046        Object result = JOptionPane.showInputDialog(
2047                this,
2048                "Select Incident:",
2049                "Save Incident",
2050                JOptionPane.PLAIN_MESSAGE,
2051                null,
2052                incidentList,
2053                script.incidents.get(0));
2054        if (result == null)
2055        {
2056            return;
2057        }
2058        input = result.toString();
2059        int i = 0;
2060        for (ScriptIncident incident : script.incidents)
2061        {
2062            if (incident == null)
2063            {
2064                continue;
2065            }
2066            if (incident.toString().equals(input))
2067            {
2068                inc = incident;
2069            }
2070        }
2071
2072        if (inc == null)
2073        {
2074            return;
2075        }
2076
2077        String fs = System.getProperty("file.separator");
2078        //Pick the file to save it to
2079        JFileChooser fc = new JFileChooser();
2080        fc.setSelectedFile(new File("" + System.getProperty("user.dir") + fs + "Incidents" + fs + "inc_" + inc.number + ".xml"));
2081        fc.setFileFilter(new ExtensionFileFilter("Script Incident (.xml)", new String[]
2082        {
2083            "xml"
2084        }));
2085        if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION)
2086        {
2087            String filename = fc.getSelectedFile().toString();
2088            if (!filename.endsWith(".xml"))
2089            {
2090                filename += ".xml";
2091
2092            }
2093            inc.saveIncidentToFile(new File(filename));
2094        }
2095    }//GEN-LAST:event_saveIncidentActionPerformed
2096
2097    /**
2098     * Bring up the incident palette for loading of new incidents.
2099     *
2100     * @param evt the menu click event
2101     */
2102    private void loadIncidentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadIncidentActionPerformed
2103        new IncidentPaletteFrame(script, this).setVisible(true);
2104        zoomSlider.setValue(zoomSlider.getMinimum());
2105    }//GEN-LAST:event_loadIncidentActionPerformed
2106
2107    //Unsupported as of 2017/09/05
2108    private void generateProjectRequirementsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateProjectRequirementsActionPerformed
2109        JFileChooser fc = new JFileChooser();
2110        fc.setFileFilter(new ExtensionFileFilter("Portable Document Format (.pdf)", new String[]
2111        {
2112            "pdf"
2113        }));
2114        fc.setSelectedFile(new File("Requirements.pdf"));
2115        fc.showSaveDialog(this);
2116        /*This feature has not yet been implemented. Show a message and just return.*/
2117        if (true)
2118        {
2119            JOptionPane.showMessageDialog(this, "This feature has not yet been implemented.\n",
2120                    "Feature not implemented", JOptionPane.INFORMATION_MESSAGE);
2121
2122            return;
2123        }
2124    }//GEN-LAST:event_generateProjectRequirementsActionPerformed
2125
2126    //Unsupported as of 2017/09/05
2127    private void generateNotebooksActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateNotebooksActionPerformed
2128        JFileChooser fc = new JFileChooser();
2129        fc.setFileFilter(new ExtensionFileFilter("Portable Document Format (.pdf)", new String[]
2130        {
2131            "pdf"
2132        }));
2133        fc.setSelectedFile(new File("Notebooks.pdf"));
2134        fc.showSaveDialog(this);
2135        /*This feature has not yet been implemented. Show a message and just return.*/
2136        if (true)
2137        {
2138            JOptionPane.showMessageDialog(this, "This feature has not yet been implemented.\n",
2139                    "Feature not implemented", JOptionPane.INFORMATION_MESSAGE);
2140
2141            return;
2142        }
2143    }//GEN-LAST:event_generateNotebooksActionPerformed
2144
2145    //Unsupported as of 2017/09/05
2146    private void generateScorecardsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateScorecardsActionPerformed
2147        JFileChooser fc = new JFileChooser();
2148        fc.setFileFilter(new ExtensionFileFilter("Portable Document Format (.pdf)", new String[]
2149        {
2150            "pdf"
2151        }));
2152        fc.setSelectedFile(new File("Scorecards.pdf"));
2153        fc.showSaveDialog(this);
2154        /*This feature has not yet been implemented. Show a message and just return.*/
2155        if (true)
2156        {
2157            JOptionPane.showMessageDialog(this, "This feature has not yet been implemented.\n",
2158                    "Feature not implemented", JOptionPane.INFORMATION_MESSAGE);
2159
2160            return;
2161        }
2162    }//GEN-LAST:event_generateScorecardsActionPerformed
2163
2164    //Unsupported as of 2017/09/05
2165    private void generateOrganizationChartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateOrganizationChartActionPerformed
2166        JFileChooser fc = new JFileChooser();
2167        fc.setFileFilter(new ExtensionFileFilter("Portable Document Format (.pdf)", new String[]
2168        {
2169            "pdf"
2170        }));
2171        fc.setSelectedFile(new File("OrganizationChart.pdf"));
2172        fc.showSaveDialog(this);
2173        /*This feature has not yet been implemented. Show a message and just return.*/
2174        if (true)
2175        {
2176            JOptionPane.showMessageDialog(this, "This feature has not yet been implemented.\n",
2177                    "Feature not implemented", JOptionPane.INFORMATION_MESSAGE);
2178
2179            return;
2180        }
2181    }//GEN-LAST:event_generateOrganizationChartActionPerformed
2182
2183    /**
2184     * Increases zoom level upon click of the "Zoom in" icon.
2185     *
2186     * @param evt the mouse event
2187     */
2188    private void zoomInIconMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_zoomInIconMouseClicked
2189        if (script != null && script.numberOfIncidents > 0)
2190        {
2191            zoomSlider.setValue(zoomSlider.getValue() >= 22 ? 22 : zoomSlider.getValue() + 1);
2192        }
2193    }//GEN-LAST:event_zoomInIconMouseClicked
2194
2195    /**
2196     * Decreases zoom level upon click of the "Zoom out" icon.
2197     *
2198     * @param evt the mouse event
2199     */
2200    private void zoomOutIconMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_zoomOutIconMouseClicked
2201        if (script != null && script.numberOfIncidents > 0)
2202        {
2203            zoomSlider.setValue(zoomSlider.getValue() <= 4 ? 4 : zoomSlider.getValue() - 1);
2204        }
2205    }//GEN-LAST:event_zoomOutIconMouseClicked
2206    private Color selectedColor = Color.BLACK;
2207
2208    private void btnChooseColorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnChooseColorActionPerformed
2209        //For whatever reason, this causes the incident properties frame to be hidden
2210        //this needs to be changed to edit only a certain number of colors, perhaps only the colors that are specified by java.awt.Color
2211       
2212        Color newColor = incidentColorChooser.showDialog(this, "Incident Color", incidentColorField.getBackground());
2213//        Color newColor = Color.BLUE;
2214//        JColorChooser chooser = (new JColorChooser(incidentColorField.getBackground()));
2215//        AbstractColorChooserPanel[] panels = chooser.getChooserPanels();
2216//        for(AbstractColorChooserPanel panel:panels)
2217//        {
2218//            System.out.println(panel.getDisplayName());
2219//        }
2220//        chooser.setPreviewPanel(new JPanel());
2221//               JColorChooser.createDialog(
2222//                   this.getParent(),
2223//                   "Choose an Incident Color",
2224//                   true,
2225//                   chooser,null,null 
2226//                ).setVisible(true);
2227        if (newColor != null)
2228        {
2229            //If the user selected a color, apply it to the properties frame
2230            selectedColor = newColor;
2231            incidentColorField.setBackground(newColor);
2232            String colStr = "" + Integer.toHexString(newColor.getRed())
2233                    + Integer.toHexString(newColor.getGreen())
2234                    + Integer.toHexString(newColor.getBlue());
2235            incidentColorField.setText(colStr);
2236        }
2237        //Return focus to the properties frame
2238        incidentFrame.setVisible(true);
2239    }//GEN-LAST:event_btnChooseColorActionPerformed
2240
2241    /* Help > About simply displays the current SVN revision number so
2242     * the user can determine which version of the source code was used to
2243     * build the executable she is running.
2244     */
2245    private void helpAboutActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_helpAboutActionPerformed
2246    {//GEN-HEADEREND:event_helpAboutActionPerformed
2247        JOptionPane.showMessageDialog(rootPane, "Revision: " + getAppVersion(), "About", JOptionPane.INFORMATION_MESSAGE);
2248    }//GEN-LAST:event_helpAboutActionPerformed
2249
2250    /**
2251     * Replaces the current script with a new, blank script.
2252     *
2253     * @param evt the menu selection event
2254     */
2255    private void fileNewActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_fileNewActionPerformed
2256    {//GEN-HEADEREND:event_fileNewActionPerformed
2257        script = new SimulationScript();
2258        loadCHPunits();
2259        script.update();
2260        this.update(null, script);
2261        repaint();
2262    }//GEN-LAST:event_fileNewActionPerformed
2263
2264    /**
2265     * Allows the user to delete an incident from the current script.
2266     *
2267     * @param evt the menu selection event
2268     */
2269    private void deleteIncidentActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_deleteIncidentActionPerformed
2270    {//GEN-HEADEREND:event_deleteIncidentActionPerformed
2271        Object[] incidentList = script.incidents.toArray();
2272        String input = "";
2273        ScriptIncident inc = null;
2274        //Choose the incident to be deleted
2275        Object result = JOptionPane.showInputDialog(
2276                this,
2277                "Select Incident:",
2278                "Delete Incident",
2279                JOptionPane.PLAIN_MESSAGE,
2280                null,
2281                incidentList,
2282                script.incidents.get(0));
2283
2284        if (result != null)
2285        {
2286            input = result.toString();
2287            for (ScriptIncident incident : script.incidents)
2288            {
2289                if (incident == null)
2290                {
2291                    continue;
2292                }
2293                if (incident.toString().equals(input))
2294                {
2295                    inc = incident;
2296                }
2297            }
2298
2299            //Allow user to verify deletion before proceeding
2300            if (inc != null)
2301            {
2302                int confirm = JOptionPane.showConfirmDialog(this,
2303                        "Are you sure you want to delete " + inc.toString() + "?");
2304                if (confirm == JOptionPane.YES_OPTION)
2305                {
2306                    //Remove the incident and replace it with a null placeholder
2307                    script.incidents.remove(inc);
2308                    script.incidents.add(null);
2309                    script.numberOfIncidents--;
2310                   
2311                }
2312            }
2313        }
2314        //since delete is the only method in this class that actually edits the data model, needs .update()
2315        script.update();
2316        //Refresh
2317        this.update(script, script);
2318       
2319       
2320        repaint();
2321    }//GEN-LAST:event_deleteIncidentActionPerformed
2322    /**
2323     * Add 15 minutes to the end of the visible timeline.
2324     *
2325     * @param evt the button press event.
2326     */
2327    private void btnAddTimeActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnAddTimeActionPerformed
2328    {//GEN-HEADEREND:event_btnAddTimeActionPerformed
2329        IncidentTimelinePanel.requestedScriptBuilderFillerTime += IncidentTimelinePanel.FILLER_INTERVAL_SECONDS;
2330        this.update(script, script);
2331    }//GEN-LAST:event_btnAddTimeActionPerformed
2332
2333    private void cadEventActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_cadEventActionPerformed
2334    {//GEN-HEADEREND:event_cadEventActionPerformed
2335        /*This feature has not yet been implemented. Show a message and just return.*/
2336        if (true)
2337        {
2338            JOptionPane.showMessageDialog(this, "This feature has not yet been implemented.\n",
2339                    "Feature not implemented", JOptionPane.INFORMATION_MESSAGE);
2340
2341            return;
2342        }
2343    }//GEN-LAST:event_cadEventActionPerformed
2344
2345    private void generateWebNotebookActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_generateWebNotebookActionPerformed
2346    {//GEN-HEADEREND:event_generateWebNotebookActionPerformed
2347        /*This feature has not yet been implemented. Show a message and just return.*/
2348        if (true)
2349        {
2350            JOptionPane.showMessageDialog(this, "This feature has not yet been implemented.\n",
2351                    "Feature not implemented", JOptionPane.INFORMATION_MESSAGE);
2352
2353            return;
2354        }
2355    }//GEN-LAST:event_generateWebNotebookActionPerformed
2356
2357    private void helpTutorialActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_helpTutorialActionPerformed
2358    {//GEN-HEADEREND:event_helpTutorialActionPerformed
2359        final String quickStartURL = "http://git.tokomak.net:8888/wiki/ScriptBuilder_QuickStart";
2360
2361        if (Desktop.isDesktopSupported())
2362        {
2363            Desktop dt = Desktop.getDesktop();
2364            if (dt.isSupported(Desktop.Action.BROWSE))
2365            {
2366                try
2367                {
2368                    URI uri = new URI(quickStartURL);
2369                    dt.browse(uri);
2370                }
2371                catch (Exception e)
2372                {
2373                }
2374            }
2375        }
2376// TODO add your handling code here:
2377    }//GEN-LAST:event_helpTutorialActionPerformed
2378
2379    private void addIncidentLocationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addIncidentLocationActionPerformed
2380        // TODO add your handling code here:
2381    }//GEN-LAST:event_addIncidentLocationActionPerformed
2382
2383    private void addIncidentNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addIncidentNameActionPerformed
2384        // TODO add your handling code here:
2385    }//GEN-LAST:event_addIncidentNameActionPerformed
2386
2387    private void incidentDetailsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_incidentDetailsActionPerformed
2388        // TODO add your handling code here:
2389        Object[] incidentList = script.incidents.toArray();
2390        ScriptIncident i = (ScriptIncident) JOptionPane.showInputDialog(
2391                this,
2392                "Select Incident:",
2393                "Edit Incident",
2394                JOptionPane.PLAIN_MESSAGE,
2395                null,
2396                incidentList,
2397                script.incidents.get(0));
2398
2399        // If a valid incident was selected
2400        if (i != null)
2401        {
2402            editingIncident = true;
2403            oldIncidentIndex = script.incidents.indexOf(i);
2404
2405            addIncidentName.setText(i.name);
2406            addIncidentNumber.setValue(i.number);
2407           
2408            addIncidentLocation.setText(i.getCadData(i.offset).Header_FullLoc);
2409            addIncidentType.setText(i.getCadData(i.offset).Header_Type);
2410            addIncidentStart.setValue(i.offset / 60);
2411            //addIncidentLength.setValue(i.length / 60);
2412            incidentColorField.setBackground(i.color);
2413            selectedColor = i.color;
2414            addIncidentDescription.setText(i.description);
2415
2416            incidentFrame.setVisible(true);
2417        }
2418    }//GEN-LAST:event_incidentDetailsActionPerformed
2419
2420    private void popupDeleteIncidentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_popupDeleteIncidentActionPerformed
2421        // TODO add your handling code here:
2422    }//GEN-LAST:event_popupDeleteIncidentActionPerformed
2423
2424    private void loadUnitsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadUnitsActionPerformed
2425        // TODO: needs to have testing performed
2426        JFileChooser fc = new JFileChooser();
2427
2428        //Search for .xml files
2429        fc.setFileFilter(new ExtensionFileFilter("Simulation Script XML (.xml)",
2430                new String[]
2431                {
2432                    "xml"
2433                }));
2434        if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
2435        {
2436            InputStream is = null;
2437            try {
2438                // create an input stream from the selected file
2439                File pf = fc.getSelectedFile();
2440                is = new FileInputStream(pf);
2441                //load script with units from the selected file
2442                script.loadUnitsFromFile(is);
2443            } catch (FileNotFoundException ex) {
2444                Logger.getLogger(ScriptBuilderFrame.class.getName()).log(Level.SEVERE, null, ex);
2445            } finally {
2446                try {
2447                    is.close();
2448                } catch (IOException ex) {
2449                    Logger.getLogger(ScriptBuilderFrame.class.getName()).log(Level.SEVERE, null, ex);
2450                }
2451            }
2452        }
2453    }//GEN-LAST:event_loadUnitsActionPerformed
2454
2455    private void scriptBuilderMenuBarAncestorAdded(javax.swing.event.AncestorEvent evt) {//GEN-FIRST:event_scriptBuilderMenuBarAncestorAdded
2456        //loads in the initial unit file
2457//        String fileName = "units.xml";
2458//       
2459//        File f = new File(fileName);
2460//       
2461//        script.loadUnitsFromFile(f);
2462    }//GEN-LAST:event_scriptBuilderMenuBarAncestorAdded
2463
2464    /**
2465     * Read the version number from the application properties. The file
2466     * 'application.properties' is generated by build.xml.
2467     *
2468     * @return a version string obtained from application.properties file, or
2469     * "Version: unknown" if an IOerror prevents us from reading the file.
2470     */
2471    private String getAppVersion()
2472    {
2473        String propfilename = "/scriptbuilder/gui/application.properties";
2474        String propKey = "Application.revision";
2475        String version = "unknown";
2476        // Load the application properties (created by build.xml)
2477        try
2478        {
2479            Properties props = new Properties();
2480            props.load(this.getClass().getResourceAsStream(propfilename));
2481            version = (String) props.get(propKey);
2482        }
2483        catch (IOException ex)
2484        {
2485            Logger.getLogger("scriptbuilder.gui").log(Level.SEVERE,
2486                    "ScriptBuilderFrame.getAppVersion()."
2487                    + " IOError reading " + propfilename);
2488        }
2489        catch (NullPointerException npe)
2490        {
2491            Logger.getLogger("scriptbuilder.gui").log(Level.SEVERE,
2492                    "ScriptBuilderFrame.getAppVersion().load."
2493                    + " Missing file: " + propfilename);
2494        }
2495        return version;
2496    }
2497
2498    /**
2499     * Runs the script builder. This is the main method for the whole program.
2500     *
2501     * @param args the command line arguments
2502     */
2503    public static void main(String args[])
2504    {
2505        try
2506        {
2507            UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
2508        }
2509        catch (Exception ex)
2510        {
2511            //Apparently we don't do any special exception processing
2512        }
2513
2514        try
2515        {
2516            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
2517        }
2518        catch (Exception ex)
2519        {
2520            //Apparently we don't do any special exception processing
2521        }
2522
2523        java.awt.EventQueue.invokeLater(
2524                new Runnable()
2525                {
2526                    public void run()
2527                    {
2528                        new ScriptBuilderFrame().setVisible(true);
2529                    }
2530                });
2531    }
2532    // Variables declaration - do not modify//GEN-BEGIN:variables
2533    private javax.swing.JSlider TMCALSlider;
2534    private javax.swing.JTextArea addIncidentDescription;
2535    private javax.swing.JTextField addIncidentLocation;
2536    private javax.swing.JTextField addIncidentName;
2537    private javax.swing.JSpinner addIncidentNumber;
2538    private javax.swing.JSpinner addIncidentStart;
2539    private javax.swing.JTextField addIncidentType;
2540    private javax.swing.JFrame addNoiseFrame;
2541    private javax.swing.JSlider backgroundNoiseSlider;
2542    private javax.swing.JButton btnAddTime;
2543    private javax.swing.JButton btnCancelNoise;
2544    private javax.swing.JButton btnChooseColor;
2545    private javax.swing.JButton btnGenerateNoise;
2546    private javax.swing.JMenuItem cadEvent;
2547    private javax.swing.JFrame cadEventFrame;
2548    private javax.swing.JButton cancelButton;
2549    private javax.swing.JMenuItem deleteEventList;
2550    private javax.swing.JMenuItem deleteIncident;
2551    private javax.swing.JMenuItem deleteIncident1;
2552    private javax.swing.JMenuItem editEventList;
2553    private javax.swing.JPopupMenu eventListPopupMenu;
2554    private javax.swing.JPopupMenu eventPopupMenu;
2555    private javax.swing.JMenu fileMenu;
2556    private javax.swing.JMenuItem fileNew;
2557    private javax.swing.JMenuItem fileOpen;
2558    private javax.swing.JMenuItem fileSave;
2559    private javax.swing.JMenuItem fileSaveAs;
2560    private javax.swing.JMenu generateMenu;
2561    private javax.swing.JMenu generateNoiseMenu;
2562    private javax.swing.JMenuItem generateNoiseOption;
2563    private javax.swing.JMenuItem generateNotebooks;
2564    private javax.swing.JMenuItem generateOrganizationChart;
2565    private javax.swing.JMenuItem generateProjectRequirements;
2566    private javax.swing.JMenuItem generateScorecards;
2567    private javax.swing.JMenuItem generateWebNotebook;
2568    private javax.swing.JMenuItem helpAbout;
2569    private javax.swing.JMenu helpMenu;
2570    private javax.swing.JMenu helpMenu1;
2571    private javax.swing.JMenuItem helpTutorial;
2572    private javax.swing.JButton incidentCancelButton;
2573    private javax.swing.JColorChooser incidentColorChooser;
2574    private javax.swing.JTextField incidentColorField;
2575    private javax.swing.JFrame incidentFrame;
2576    private javax.swing.JMenu incidentMenu;
2577    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel1;
2578    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel10;
2579    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel2;
2580    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel3;
2581    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel4;
2582    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel5;
2583    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel6;
2584    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel7;
2585    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel8;
2586    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel9;
2587    private javax.swing.JButton incidentOkButton;
2588    private javax.swing.JPopupMenu incidentPopupMenu;
2589    private javax.swing.JScrollPane incidentPropertiesScrollPane;
2590    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel1;
2591    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel10;
2592    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel2;
2593    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel3;
2594    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel4;
2595    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel5;
2596    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel6;
2597    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel7;
2598    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel8;
2599    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel9;
2600    private javax.swing.JLabel jLabel1;
2601    private javax.swing.JLabel jLabel2;
2602    private javax.swing.JMenuItem jMenuItem2;
2603    private javax.swing.JMenuItem jMenuItem4;
2604    private javax.swing.JMenuItem jMenuItem5;
2605    private javax.swing.JMenuItem jMenuItem6;
2606    private javax.swing.JPopupMenu.Separator jSeparator1;
2607    private javax.swing.JPopupMenu.Separator jSeparator2;
2608    private javax.swing.JPopupMenu.Separator jSeparator3;
2609    private javax.swing.JPopupMenu.Separator jSeparator4;
2610    private javax.swing.JLabel labelBackgroundNoise;
2611    private javax.swing.JLabel labelCADEntry;
2612    private javax.swing.JLabel labelIncidentColor;
2613    private javax.swing.JLabel labelIncidentDescription;
2614    private javax.swing.JLabel labelIncidentLength;
2615    private javax.swing.JLabel labelIncidentName;
2616    private javax.swing.JLabel labelIncidentNumber;
2617    private javax.swing.JLabel labelIncidentStart;
2618    private javax.swing.JLabel labelLaneClosures;
2619    private javax.swing.JLabel labelLeastFreq;
2620    private javax.swing.JLabel labelMinorEvents;
2621    private javax.swing.JLabel labelMostFreq;
2622    private javax.swing.JLabel labelRadioChatter;
2623    private javax.swing.JLabel labelRadioMessage;
2624    private javax.swing.JLabel labelRadioType;
2625    private javax.swing.JLabel labelTMCALLogs;
2626    private javax.swing.JSlider laneClosuresSlider;
2627    private javax.swing.JMenuItem loadIncident;
2628    private javax.swing.JMenuItem loadUnits;
2629    private javax.swing.JSlider minorEventsSlider;
2630    private javax.swing.JMenuItem newIncident;
2631    private javax.swing.JButton okButton;
2632    private javax.swing.JMenuItem popupDeleteIncident;
2633    private javax.swing.JSlider radioChatterSlider;
2634    private javax.swing.JMenuItem radioEvent;
2635    private javax.swing.JFrame radioEventFrame;
2636    private javax.swing.JTextArea radioMessage;
2637    private javax.swing.JScrollPane radioMessageScrollPane;
2638    private javax.swing.JComboBox radioTypeComboBox;
2639    private javax.swing.JMenuItem saveIncident;
2640    private javax.swing.JMenuBar scriptBuilderMenuBar;
2641    private scriptbuilder.gui.panels.TimeStampPanel timeStampPanel;
2642    private javax.swing.JScrollPane timeStampScrollPane;
2643    private scriptbuilder.gui.panels.TimelineTickPanel timelineTickPanel;
2644    private javax.swing.JScrollPane timelinesScrollPane;
2645    private javax.swing.JLabel txtIncidentLength;
2646    private javax.swing.JTextArea txtNoiseDescription;
2647    private javax.swing.JLabel zoomInIcon;
2648    private javax.swing.JLabel zoomOutIcon;
2649    private javax.swing.JSlider zoomSlider;
2650    // End of variables declaration//GEN-END:variables
2651}
Note: See TracBrowser for help on using the repository browser.