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

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

SimulationScript?.java modified to catch exception caused when external DTD not found during load xml and display helpful message to user. Fixes #240.

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