Warning: Can't use blame annotator:
svn blame failed on trunk/src/scriptbuilder/gui/ScriptBuilderFrame.java: ("Can't find a temporary directory: Internal error", 20014)

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

Revision 151, 124.7 KB checked in by sdanthin, 6 years ago (diff)

ScriptBuilderFrame?.form changed units menu title

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