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

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

Revision 177, 126.3 KB checked in by jdalbey, 6 years ago (diff)

ScriptBuilderFrame?.java Remove color chooser widget from New Incident panel and replace with a simple combo box.

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