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

Revision 189, 125.9 KB checked in by sdanthin, 6 years ago (diff)

IncidentPaletteFrame?.java changed behavior of create new in the incident selector to show the incidentFrame window instead of just bringing up the IncidentEditorFrame? itself
ScriptBuilderFrame?.java created separate method to bring up the IncidentFrame? window so that it can be shown/initialized outside of ScriptBuilderFrame? scope

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