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

Revision 158, 125.9 KB checked in by jdalbey, 6 years ago (diff)

ScriptBuilderFrame?.java added new helper method loadCHPunits(). SimulationScript?.java changed load units method to accept an InputStream? instead of a File.

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