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

Revision 87, 104.8 KB checked in by bmcguffin, 9 years ago (diff)

Fixed a bug in which editing an incident in the incident details screen, and then clicking the "OK" button, caused the incident's events to be deleted.

Fixed a bug in which attempting to select a new color for the incident, and then clicking the "OK" button on the color selection palette, caused the incident details screen and the color selection palette to both close without applying changes.

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.event.AdjustmentEvent;
11import java.awt.event.AdjustmentListener;
12import java.awt.event.KeyEvent;
13import java.awt.event.KeyListener;
14import java.io.File;
15import java.io.IOException;
16import java.util.Observable;
17import java.util.Observer;
18import java.util.Properties;
19import java.util.Random;
20import java.util.logging.Level;
21import java.util.logging.Logger;
22import javax.swing.DefaultListModel;
23import javax.swing.JFileChooser;
24import javax.swing.JOptionPane;
25import javax.swing.UIManager;
26import javax.swing.UnsupportedLookAndFeelException;
27import scriptbuilder.structures.ScriptEvent;
28import scriptbuilder.structures.ScriptEvent.ScriptEventType;
29import scriptbuilder.structures.ScriptIncident;
30import scriptbuilder.structures.ScriptIncident.IncidentFocusedEvent;
31import scriptbuilder.structures.ScriptIncident.SliceChangedEvent;
32import scriptbuilder.structures.SimulationScript;
33import scriptbuilder.structures.TimeSlice;
34import scriptbuilder.structures.events.I_ScriptEvent;
35
36/**
37 * GUI for the script builder. Contains all panels and editor elements. Performs
38 * updates to reflect script model, which it observes.
39 *
40 * @author Greg Eddington
41 * @author Bryan McGuffin
42 */
43public class ScriptBuilderFrame extends javax.swing.JFrame implements Observer
44{
45
46    /**
47     * The script model.
48     */
49    private SimulationScript script;
50    /**
51     * The current type of selected event.
52     */
53    public ScriptEventType currentEventType;
54    /**
55     * True if we are currently editing an incident.
56     */
57    private boolean editingIncident;
58    /**
59     * Index of the previous incident.
60     */
61    private int oldIncidentIndex;
62
63    /**
64     * Get the script currently in use.
65     *
66     * @return the script model object
67     */
68    public SimulationScript getScript()
69    {
70        return script;
71    }
72
73    /**
74     * Listener for the scroll pane.
75     */
76    class MyAdjustmentListener implements AdjustmentListener
77    {
78
79        /**
80         * If the incident timeline is scrolled horizontally, the timestamp
81         * panel is updated to reflect it.
82         *
83         * @param evt the adjustment event
84         */
85        @Override
86        public void adjustmentValueChanged(AdjustmentEvent evt)
87        {
88            if (evt.getAdjustable().getOrientation() == Adjustable.HORIZONTAL)
89            {
90                timeStampScrollPane.getHorizontalScrollBar()
91                        .setValue(timelinesScrollPane.getHorizontalScrollBar().getValue());
92            }
93            else
94            {
95                // Event from vertical scrollbar
96            }
97
98            repaint();
99        }
100    }
101
102    /**
103     * Listener for key presses. Used for hotkeys for different event types.
104     */
105    private class TimelineKeyListener implements KeyListener
106    {
107
108        /**
109         * If a hotkey is pressed, select that type of event.
110         *
111         * @param e the key event
112         */
113        @Override
114        public void keyPressed(KeyEvent e)
115        {
116            repaint();
117        }
118
119        /**
120         * Take no action upon key release.
121         *
122         * @param e the key event
123         */
124        @Override
125        public void keyReleased(KeyEvent e)
126        {
127        }
128
129        /**
130         * Take no action upon key release.
131         *
132         * @param e the key event
133         */
134        @Override
135        public void keyTyped(KeyEvent e)
136        {
137        }
138    }
139
140    /**
141     * Constructor. Prep new script model, initialize the GUI, and add listeners
142     * for all buttons.
143     */
144    public ScriptBuilderFrame()
145    {
146        script = new SimulationScript();
147        script.addObserver(this);
148        initComponents();
149        this.update(null, script);
150
151        // Hack to refresh the zoom
152        /*
153         zoomSlider.setValue(zoomSlider.getValue() - 1);
154         zoomSlider.setValue(zoomSlider.getValue() + 1);
155         */
156        // Set listener for scroll pane
157        AdjustmentListener listener = new MyAdjustmentListener();
158        timelinesScrollPane.getHorizontalScrollBar().addAdjustmentListener(listener);
159        timelinesScrollPane.getVerticalScrollBar().addAdjustmentListener(listener);
160    }
161
162    /**
163     * Update the GUI to reflect the model. If the script changed, update all
164     * the incident panels. If a timeslice changed, add any new events to the
165     * model. If an incident gained focus, update the incident info screen to
166     * display its details.
167     *
168     * @param o The observed object
169     * @param arg Either the script model or an incident event, depending on who
170     * called this update
171     */
172    @Override
173    public void update(Observable o, Object arg)
174    {
175        if (arg instanceof SimulationScript)
176        {
177            script = (SimulationScript) arg;
178
179            if (script.incidents.size() != 10)
180            {
181                return;
182            }
183
184            timelineTickPanel.update(script);
185            timeStampPanel.update(script);
186
187            incidentTimelinePanel1.timelinePanelUpdate(script.incidents.get(0));
188            incidentTimelinePanel2.timelinePanelUpdate(script.incidents.get(1));
189            incidentTimelinePanel3.timelinePanelUpdate(script.incidents.get(2));
190            incidentTimelinePanel4.timelinePanelUpdate(script.incidents.get(3));
191            incidentTimelinePanel5.timelinePanelUpdate(script.incidents.get(4));
192            incidentTimelinePanel6.timelinePanelUpdate(script.incidents.get(5));
193            incidentTimelinePanel7.timelinePanelUpdate(script.incidents.get(6));
194            incidentTimelinePanel8.timelinePanelUpdate(script.incidents.get(7));
195            incidentTimelinePanel9.timelinePanelUpdate(script.incidents.get(8));
196            incidentTimelinePanel10.timelinePanelUpdate(script.incidents.get(9));
197
198            incidentNumberPanel1.update(script.incidents.get(0));
199            incidentNumberPanel2.update(script.incidents.get(1));
200            incidentNumberPanel3.update(script.incidents.get(2));
201            incidentNumberPanel4.update(script.incidents.get(3));
202            incidentNumberPanel5.update(script.incidents.get(4));
203            incidentNumberPanel6.update(script.incidents.get(5));
204            incidentNumberPanel7.update(script.incidents.get(6));
205            incidentNumberPanel8.update(script.incidents.get(7));
206            incidentNumberPanel9.update(script.incidents.get(8));
207            incidentNumberPanel10.update(script.incidents.get(9));
208
209            /**
210             * DefaultComboBoxModel model = new DefaultComboBoxModel(); for
211             * (ScriptIncident i : script.incidents) { if (i != null)
212             * model.addElement(i); } gotoIncident.setModel(model);*
213             */
214            this.setPreferredSize(this.getSize());
215            pack();
216        }
217        else if (arg instanceof SliceChangedEvent)
218        {
219            TimeSlice slice = ((SliceChangedEvent) arg).slice;
220
221            DefaultListModel model = new DefaultListModel();
222            for (I_ScriptEvent e : slice.events)
223            {
224                model.addElement(e);
225            }
226        }
227        else if (arg instanceof IncidentFocusedEvent)
228        {
229            ScriptIncident i = ((IncidentFocusedEvent) arg).incident;
230
231            //gotoIncident.setSelectedItem(i);
232        }
233
234        zoomSlider.setMinimum(((timelineTickPanel.getVisibleRect().width - 20)
235                * ScriptBuilderGuiConstants.HORIZONTAL_TICK_RESOLUTION)
236                / Math.max(script.absoluteLength(), ScriptBuilderGuiConstants.TICK_TIMELINE_SMALLEST_LENGTH));
237        zoomSlider.setMaximum(zoomSlider.getMinimum() + 20);
238    }
239
240    /**
241     * This method is called from within the constructor to initialize the form.
242     * WARNING: Do NOT modify this code. The content of this method is always
243     * regenerated by the Form Editor.
244     */
245    @SuppressWarnings("unchecked")
246    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
247    private void initComponents()
248    {
249
250        incidentPopupMenu = new javax.swing.JPopupMenu();
251        popupDeleteIncident = new javax.swing.JMenuItem();
252        eventPopupMenu = new javax.swing.JPopupMenu();
253        cadEvent = new javax.swing.JMenuItem();
254        jMenuItem2 = new javax.swing.JMenuItem();
255        radioEvent = new javax.swing.JMenuItem();
256        jMenuItem4 = new javax.swing.JMenuItem();
257        jMenuItem5 = new javax.swing.JMenuItem();
258        jMenuItem6 = new javax.swing.JMenuItem();
259        cadEventFrame = new javax.swing.JFrame();
260        jLabel5 = new javax.swing.JLabel();
261        radioEventFrame = new javax.swing.JFrame();
262        radioTypeLabel = new javax.swing.JLabel();
263        jLabel7 = new javax.swing.JLabel();
264        radioTypeComboBox = new javax.swing.JComboBox();
265        radioMessageScrollPane = new javax.swing.JScrollPane();
266        radioMessage = new javax.swing.JTextArea();
267        okButton = new javax.swing.JButton();
268        cancelButton = new javax.swing.JButton();
269        eventListPopupMenu = new javax.swing.JPopupMenu();
270        editEventList = new javax.swing.JMenuItem();
271        deleteEventList = new javax.swing.JMenuItem();
272        incidentFrame = new javax.swing.JFrame();
273        jLabel6 = new javax.swing.JLabel();
274        jLabel8 = new javax.swing.JLabel();
275        jLabel9 = new javax.swing.JLabel();
276        jLabel10 = new javax.swing.JLabel();
277        jScrollPane1 = new javax.swing.JScrollPane();
278        addIncidentDescription = new javax.swing.JTextArea();
279        incidentOkButton = new javax.swing.JButton();
280        incidentCancelButton = new javax.swing.JButton();
281        addIncidentNumber = new javax.swing.JSpinner();
282        addIncidentName = new javax.swing.JTextField();
283        jLabel11 = new javax.swing.JLabel();
284        addIncidentLength = new javax.swing.JSpinner();
285        jLabel12 = new javax.swing.JLabel();
286        addIncidentStart = new javax.swing.JSpinner();
287        jButton3 = new javax.swing.JButton();
288        incidentColorField = new javax.swing.JTextField();
289        addNoiseFrame = new javax.swing.JFrame();
290        jLabel13 = new javax.swing.JLabel();
291        jSlider1 = new javax.swing.JSlider();
292        jSlider2 = new javax.swing.JSlider();
293        jLabel14 = new javax.swing.JLabel();
294        jSlider3 = new javax.swing.JSlider();
295        jLabel15 = new javax.swing.JLabel();
296        jTextArea1 = new javax.swing.JTextArea();
297        jSlider4 = new javax.swing.JSlider();
298        jLabel16 = new javax.swing.JLabel();
299        jSlider5 = new javax.swing.JSlider();
300        jLabel17 = new javax.swing.JLabel();
301        jButton1 = new javax.swing.JButton();
302        jButton2 = new javax.swing.JButton();
303        jLabel20 = new javax.swing.JLabel();
304        jLabel21 = new javax.swing.JLabel();
305        incidentColorChooser = new javax.swing.JColorChooser();
306        timelinesScrollPane = new javax.swing.JScrollPane();
307        timelineTickPanel = new scriptbuilder.gui.panels.TimelineTickPanel();
308        incidentTimelinePanel1 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
309        incidentTimelinePanel2 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
310        incidentTimelinePanel8 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
311        incidentTimelinePanel3 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
312        incidentTimelinePanel6 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
313        incidentTimelinePanel5 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
314        incidentTimelinePanel4 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
315        incidentTimelinePanel7 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
316        incidentTimelinePanel10 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
317        incidentTimelinePanel9 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
318        incidentNumberPanel1 = new scriptbuilder.gui.panels.IncidentNumberPanel();
319        incidentNumberPanel2 = new scriptbuilder.gui.panels.IncidentNumberPanel();
320        incidentNumberPanel3 = new scriptbuilder.gui.panels.IncidentNumberPanel();
321        incidentNumberPanel4 = new scriptbuilder.gui.panels.IncidentNumberPanel();
322        incidentNumberPanel5 = new scriptbuilder.gui.panels.IncidentNumberPanel();
323        incidentNumberPanel6 = new scriptbuilder.gui.panels.IncidentNumberPanel();
324        incidentNumberPanel7 = new scriptbuilder.gui.panels.IncidentNumberPanel();
325        incidentNumberPanel8 = new scriptbuilder.gui.panels.IncidentNumberPanel();
326        incidentNumberPanel9 = new scriptbuilder.gui.panels.IncidentNumberPanel();
327        incidentNumberPanel10 = new scriptbuilder.gui.panels.IncidentNumberPanel();
328        zoomSlider = new javax.swing.JSlider();
329        zoomInIcon = new javax.swing.JLabel();
330        zoomOutIcon = new javax.swing.JLabel();
331        timeStampScrollPane = new javax.swing.JScrollPane();
332        timeStampPanel = new scriptbuilder.gui.panels.TimeStampPanel();
333        scriptBuilderMenuBar = new javax.swing.JMenuBar();
334        fileMenu = new javax.swing.JMenu();
335        fileNew = new javax.swing.JMenuItem();
336        jSeparator1 = new javax.swing.JPopupMenu.Separator();
337        fileOpen = new javax.swing.JMenuItem();
338        jSeparator2 = new javax.swing.JPopupMenu.Separator();
339        fileSave = new javax.swing.JMenuItem();
340        fileSaveAs = new javax.swing.JMenuItem();
341        generateMenu = new javax.swing.JMenu();
342        generateNotebooks = new javax.swing.JMenuItem();
343        jMenuItem3 = new javax.swing.JMenuItem();
344        generateScorecards = new javax.swing.JMenuItem();
345        generateOrganizationChart = new javax.swing.JMenuItem();
346        jSeparator3 = new javax.swing.JPopupMenu.Separator();
347        generateProjectRequirements = new javax.swing.JMenuItem();
348        incidentMenu = new javax.swing.JMenu();
349        newIncident = new javax.swing.JMenuItem();
350        editIncident = new javax.swing.JMenuItem();
351        incidentDetails = new javax.swing.JMenuItem();
352        jSeparator4 = new javax.swing.JPopupMenu.Separator();
353        saveIncident = new javax.swing.JMenuItem();
354        loadIncident = new javax.swing.JMenuItem();
355        generateNoiseMenu = new javax.swing.JMenu();
356        generateNoiseOption = new javax.swing.JMenuItem();
357        helpMenu = new javax.swing.JMenu();
358        helpTutorial = new javax.swing.JMenuItem();
359        helpAbout = new javax.swing.JMenuItem();
360
361        popupDeleteIncident.setText("Delete Incident...");
362        incidentPopupMenu.add(popupDeleteIncident);
363
364        cadEvent.setText("CAD Event");
365        cadEvent.addMouseListener(new java.awt.event.MouseAdapter()
366        {
367            public void mousePressed(java.awt.event.MouseEvent evt)
368            {
369                cadEventMousePressed(evt);
370            }
371            public void mouseReleased(java.awt.event.MouseEvent evt)
372            {
373                cadEventMouseReleased(evt);
374            }
375        });
376        eventPopupMenu.add(cadEvent);
377
378        jMenuItem2.setText("Paramics Event");
379        eventPopupMenu.add(jMenuItem2);
380
381        radioEvent.setText("Radio Event");
382        radioEvent.addMouseListener(new java.awt.event.MouseAdapter()
383        {
384            public void mousePressed(java.awt.event.MouseEvent evt)
385            {
386                radioEventMousePressed(evt);
387            }
388        });
389        eventPopupMenu.add(radioEvent);
390
391        jMenuItem4.setText("Telephone Event");
392        eventPopupMenu.add(jMenuItem4);
393
394        jMenuItem5.setText("Video Event");
395        eventPopupMenu.add(jMenuItem5);
396
397        jMenuItem6.setText("Evaluation Event");
398        eventPopupMenu.add(jMenuItem6);
399
400        cadEventFrame.setMinimumSize(new java.awt.Dimension(400, 300));
401
402        jLabel5.setText("CAD Entry");
403
404        javax.swing.GroupLayout cadEventFrameLayout = new javax.swing.GroupLayout(cadEventFrame.getContentPane());
405        cadEventFrame.getContentPane().setLayout(cadEventFrameLayout);
406        cadEventFrameLayout.setHorizontalGroup(
407            cadEventFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
408            .addGroup(cadEventFrameLayout.createSequentialGroup()
409                .addContainerGap()
410                .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
411                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
412        );
413        cadEventFrameLayout.setVerticalGroup(
414            cadEventFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
415            .addGroup(cadEventFrameLayout.createSequentialGroup()
416                .addContainerGap()
417                .addComponent(jLabel5)
418                .addContainerGap(1357, Short.MAX_VALUE))
419        );
420
421        radioEventFrame.setTitle("Add Radio Event");
422        radioEventFrame.setMinimumSize(new java.awt.Dimension(400, 300));
423
424        radioTypeLabel.setText("Radio Type:");
425
426        jLabel7.setText("Radio Message:");
427
428        radioTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "TMT", "Maintanence" }));
429
430        radioMessageScrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
431
432        radioMessage.setColumns(20);
433        radioMessage.setLineWrap(true);
434        radioMessage.setRows(5);
435        radioMessage.setWrapStyleWord(true);
436        radioMessageScrollPane.setViewportView(radioMessage);
437
438        okButton.setText("OK");
439        okButton.addActionListener(new java.awt.event.ActionListener()
440        {
441            public void actionPerformed(java.awt.event.ActionEvent evt)
442            {
443                okButtonActionPerformed(evt);
444            }
445        });
446
447        cancelButton.setText("Cancel");
448        cancelButton.addActionListener(new java.awt.event.ActionListener()
449        {
450            public void actionPerformed(java.awt.event.ActionEvent evt)
451            {
452                cancelButtonActionPerformed(evt);
453            }
454        });
455
456        javax.swing.GroupLayout radioEventFrameLayout = new javax.swing.GroupLayout(radioEventFrame.getContentPane());
457        radioEventFrame.getContentPane().setLayout(radioEventFrameLayout);
458        radioEventFrameLayout.setHorizontalGroup(
459            radioEventFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
460            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, radioEventFrameLayout.createSequentialGroup()
461                .addContainerGap()
462                .addGroup(radioEventFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
463                    .addComponent(radioMessageScrollPane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)
464                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, radioEventFrameLayout.createSequentialGroup()
465                        .addComponent(radioTypeLabel)
466                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
467                        .addComponent(radioTypeComboBox, 0, 312, Short.MAX_VALUE))
468                    .addComponent(jLabel7, javax.swing.GroupLayout.Alignment.LEADING)
469                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, radioEventFrameLayout.createSequentialGroup()
470                        .addComponent(cancelButton)
471                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 246, Short.MAX_VALUE)
472                        .addComponent(okButton, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)))
473                .addContainerGap())
474        );
475        radioEventFrameLayout.setVerticalGroup(
476            radioEventFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
477            .addGroup(radioEventFrameLayout.createSequentialGroup()
478                .addContainerGap()
479                .addGroup(radioEventFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
480                    .addComponent(radioTypeLabel)
481                    .addComponent(radioTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
482                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
483                .addComponent(jLabel7)
484                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
485                .addComponent(radioMessageScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 198, Short.MAX_VALUE)
486                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
487                .addGroup(radioEventFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
488                    .addComponent(okButton)
489                    .addComponent(cancelButton))
490                .addContainerGap())
491        );
492
493        editEventList.setText("Edit...");
494        editEventList.addActionListener(new java.awt.event.ActionListener()
495        {
496            public void actionPerformed(java.awt.event.ActionEvent evt)
497            {
498                editEventListActionPerformed(evt);
499            }
500        });
501        eventListPopupMenu.add(editEventList);
502
503        deleteEventList.setText("Delete...");
504        eventListPopupMenu.add(deleteEventList);
505
506        incidentFrame.setTitle("Incident");
507        incidentFrame.setMinimumSize(new java.awt.Dimension(400, 400));
508
509        jLabel6.setText("Incident Number: ");
510
511        jLabel8.setText("Incident Name:");
512
513        jLabel9.setText("Incident Color: ");
514
515        jLabel10.setText("Incident Description:");
516
517        jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
518        jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
519
520        addIncidentDescription.setColumns(20);
521        addIncidentDescription.setLineWrap(true);
522        addIncidentDescription.setRows(5);
523        addIncidentDescription.setWrapStyleWord(true);
524        jScrollPane1.setViewportView(addIncidentDescription);
525
526        incidentOkButton.setText("OK");
527        incidentOkButton.addActionListener(new java.awt.event.ActionListener()
528        {
529            public void actionPerformed(java.awt.event.ActionEvent evt)
530            {
531                incidentOkButtonActionPerformed(evt);
532            }
533        });
534
535        incidentCancelButton.setText("Cancel");
536        incidentCancelButton.addActionListener(new java.awt.event.ActionListener()
537        {
538            public void actionPerformed(java.awt.event.ActionEvent evt)
539            {
540                incidentCancelButtonActionPerformed(evt);
541            }
542        });
543
544        addIncidentNumber.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(101), Integer.valueOf(101), null, Integer.valueOf(1)));
545
546        jLabel11.setText("Incident Length in Minutes: ");
547
548        addIncidentLength.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1)));
549
550        jLabel12.setText("Incident Start Time in Minutes:");
551
552        addIncidentStart.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1)));
553
554        jButton3.setText("Choose...");
555        jButton3.addActionListener(new java.awt.event.ActionListener()
556        {
557            public void actionPerformed(java.awt.event.ActionEvent evt)
558            {
559                jButton3ActionPerformed(evt);
560            }
561        });
562
563        incidentColorField.setEditable(false);
564        incidentColorField.setBackground(new java.awt.Color(0, 0, 0));
565
566        javax.swing.GroupLayout incidentFrameLayout = new javax.swing.GroupLayout(incidentFrame.getContentPane());
567        incidentFrame.getContentPane().setLayout(incidentFrameLayout);
568        incidentFrameLayout.setHorizontalGroup(
569            incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
570            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, incidentFrameLayout.createSequentialGroup()
571                .addContainerGap()
572                .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
573                    .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 322, Short.MAX_VALUE)
574                    .addComponent(jLabel10, javax.swing.GroupLayout.Alignment.LEADING)
575                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, incidentFrameLayout.createSequentialGroup()
576                        .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
577                            .addComponent(jLabel6)
578                            .addComponent(jLabel8)
579                            .addComponent(jLabel9))
580                        .addGap(18, 18, 18)
581                        .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
582                            .addComponent(addIncidentName, javax.swing.GroupLayout.DEFAULT_SIZE, 218, Short.MAX_VALUE)
583                            .addComponent(addIncidentNumber, javax.swing.GroupLayout.DEFAULT_SIZE, 218, Short.MAX_VALUE)
584                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, incidentFrameLayout.createSequentialGroup()
585                                .addComponent(incidentColorField, javax.swing.GroupLayout.DEFAULT_SIZE, 119, Short.MAX_VALUE)
586                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
587                                .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE))))
588                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, incidentFrameLayout.createSequentialGroup()
589                        .addComponent(incidentCancelButton)
590                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 188, Short.MAX_VALUE)
591                        .addComponent(incidentOkButton, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE))
592                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, incidentFrameLayout.createSequentialGroup()
593                        .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
594                            .addComponent(jLabel12)
595                            .addComponent(jLabel11))
596                        .addGap(18, 18, 18)
597                        .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
598                            .addComponent(addIncidentStart, javax.swing.GroupLayout.DEFAULT_SIZE, 158, Short.MAX_VALUE)
599                            .addComponent(addIncidentLength, javax.swing.GroupLayout.DEFAULT_SIZE, 158, Short.MAX_VALUE))))
600                .addContainerGap())
601        );
602        incidentFrameLayout.setVerticalGroup(
603            incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
604            .addGroup(incidentFrameLayout.createSequentialGroup()
605                .addContainerGap()
606                .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
607                    .addComponent(jLabel6)
608                    .addComponent(addIncidentNumber, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
609                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
610                .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
611                    .addComponent(jLabel8)
612                    .addComponent(addIncidentName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
613                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
614                .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
615                    .addComponent(jLabel9)
616                    .addComponent(jButton3)
617                    .addComponent(incidentColorField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
618                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
619                .addComponent(jLabel10)
620                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
621                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 106, Short.MAX_VALUE)
622                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
623                .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
624                    .addComponent(addIncidentStart, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
625                    .addComponent(jLabel12))
626                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
627                .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
628                    .addComponent(addIncidentLength, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
629                    .addComponent(jLabel11))
630                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
631                .addGroup(incidentFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
632                    .addComponent(incidentCancelButton)
633                    .addComponent(incidentOkButton))
634                .addContainerGap())
635        );
636
637        addNoiseFrame.setTitle("Generate Noise");
638        addNoiseFrame.setMinimumSize(new java.awt.Dimension(395, 315));
639        addNoiseFrame.setResizable(false);
640
641        jLabel13.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
642        jLabel13.setText("Radio Chatter: ");
643
644        jLabel14.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
645        jLabel14.setText("Lane Closures:");
646
647        jLabel15.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
648        jLabel15.setText("TMCAL Logs:");
649
650        jTextArea1.setEditable(false);
651        jTextArea1.setColumns(20);
652        jTextArea1.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
653        jTextArea1.setLineWrap(true);
654        jTextArea1.setRows(5);
655        jTextArea1.setText("Noise events will be randomly generated for the simulation with frequencies based on the control selections made below");
656        jTextArea1.setWrapStyleWord(true);
657        jTextArea1.setAutoscrolls(false);
658        jTextArea1.setBorder(null);
659        jTextArea1.setDisabledTextColor(new java.awt.Color(0, 0, 0));
660        jTextArea1.setFocusable(false);
661        jTextArea1.setOpaque(false);
662
663        jLabel16.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
664        jLabel16.setText("Background Noise: ");
665
666        jLabel17.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
667        jLabel17.setText("Minor Events:");
668
669        jButton1.setText("Cancel");
670        jButton1.addActionListener(new java.awt.event.ActionListener()
671        {
672            public void actionPerformed(java.awt.event.ActionEvent evt)
673            {
674                jButton1ActionPerformed(evt);
675            }
676        });
677
678        jButton2.setText("Generate");
679        jButton2.addActionListener(new java.awt.event.ActionListener()
680        {
681            public void actionPerformed(java.awt.event.ActionEvent evt)
682            {
683                jButton2ActionPerformed(evt);
684            }
685        });
686
687        jLabel20.setText("Least Frequent");
688
689        jLabel21.setText("Most Frequent");
690
691        javax.swing.GroupLayout addNoiseFrameLayout = new javax.swing.GroupLayout(addNoiseFrame.getContentPane());
692        addNoiseFrame.getContentPane().setLayout(addNoiseFrameLayout);
693        addNoiseFrameLayout.setHorizontalGroup(
694            addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
695            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, addNoiseFrameLayout.createSequentialGroup()
696                .addContainerGap(21, Short.MAX_VALUE)
697                .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
698                    .addComponent(jTextArea1, javax.swing.GroupLayout.Alignment.LEADING)
699                    .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
700                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, addNoiseFrameLayout.createSequentialGroup()
701                            .addComponent(jButton1)
702                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
703                            .addComponent(jButton2))
704                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, addNoiseFrameLayout.createSequentialGroup()
705                            .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
706                                .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
707                                    .addComponent(jLabel16)
708                                    .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
709                                    .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
710                                    .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE))
711                                .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE))
712                            .addGap(4, 4, 4)
713                            .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
714                                .addComponent(jSlider1, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)
715                                .addComponent(jSlider2, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)
716                                .addComponent(jSlider3, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)
717                                .addComponent(jSlider5, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)
718                                .addComponent(jSlider4, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)
719                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, addNoiseFrameLayout.createSequentialGroup()
720                                    .addComponent(jLabel20)
721                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
722                                    .addComponent(jLabel21))))))
723                .addGap(20, 20, 20))
724        );
725        addNoiseFrameLayout.setVerticalGroup(
726            addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
727            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, addNoiseFrameLayout.createSequentialGroup()
728                .addContainerGap()
729                .addComponent(jTextArea1, javax.swing.GroupLayout.DEFAULT_SIZE, 39, Short.MAX_VALUE)
730                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
731                .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
732                    .addComponent(jLabel21)
733                    .addComponent(jLabel20))
734                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
735                .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
736                    .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
737                    .addComponent(jSlider1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
738                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
739                .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
740                    .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
741                    .addComponent(jSlider2, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))
742                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
743                .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
744                    .addComponent(jLabel15)
745                    .addComponent(jSlider3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
746                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
747                .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
748                    .addComponent(jSlider4, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
749                    .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))
750                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
751                .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
752                    .addComponent(jSlider5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
753                    .addComponent(jLabel17))
754                .addGap(18, 18, 18)
755                .addGroup(addNoiseFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
756                    .addComponent(jButton1)
757                    .addComponent(jButton2))
758                .addContainerGap())
759        );
760
761        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
762        setTitle("Script Builder");
763        setBounds(new java.awt.Rectangle(0, 23, 800, 700));
764        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
765        setMinimumSize(new java.awt.Dimension(800, 700));
766
767        timelinesScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
768        timelinesScrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
769        timelinesScrollPane.setFocusCycleRoot(true);
770        timelinesScrollPane.setFocusTraversalPolicyProvider(true);
771        timelinesScrollPane.setPreferredSize(new java.awt.Dimension(72000, 1341));
772        timelinesScrollPane.setWheelScrollingEnabled(false);
773
774        timelineTickPanel.setMaximumSize(new java.awt.Dimension(7200, 32767));
775        timelineTickPanel.setMinimumSize(new java.awt.Dimension(7200, 0));
776        timelineTickPanel.setPreferredSize(new java.awt.Dimension(7200, 1317));
777
778        incidentTimelinePanel1.setMaximumSize(new java.awt.Dimension(32767, 100));
779        incidentTimelinePanel1.setOpaque(false);
780        incidentTimelinePanel1.setPreferredSize(new java.awt.Dimension(691, 100));
781
782        javax.swing.GroupLayout incidentTimelinePanel1Layout = new javax.swing.GroupLayout(incidentTimelinePanel1);
783        incidentTimelinePanel1.setLayout(incidentTimelinePanel1Layout);
784        incidentTimelinePanel1Layout.setHorizontalGroup(
785            incidentTimelinePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
786            .addGap(0, 691, Short.MAX_VALUE)
787        );
788        incidentTimelinePanel1Layout.setVerticalGroup(
789            incidentTimelinePanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
790            .addGap(0, 100, Short.MAX_VALUE)
791        );
792
793        incidentTimelinePanel2.setOpaque(false);
794
795        javax.swing.GroupLayout incidentTimelinePanel2Layout = new javax.swing.GroupLayout(incidentTimelinePanel2);
796        incidentTimelinePanel2.setLayout(incidentTimelinePanel2Layout);
797        incidentTimelinePanel2Layout.setHorizontalGroup(
798            incidentTimelinePanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
799            .addGap(0, 0, Short.MAX_VALUE)
800        );
801        incidentTimelinePanel2Layout.setVerticalGroup(
802            incidentTimelinePanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
803            .addGap(0, 0, Short.MAX_VALUE)
804        );
805
806        incidentTimelinePanel8.setOpaque(false);
807
808        javax.swing.GroupLayout incidentTimelinePanel8Layout = new javax.swing.GroupLayout(incidentTimelinePanel8);
809        incidentTimelinePanel8.setLayout(incidentTimelinePanel8Layout);
810        incidentTimelinePanel8Layout.setHorizontalGroup(
811            incidentTimelinePanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
812            .addGap(0, 0, Short.MAX_VALUE)
813        );
814        incidentTimelinePanel8Layout.setVerticalGroup(
815            incidentTimelinePanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
816            .addGap(0, 0, Short.MAX_VALUE)
817        );
818
819        incidentTimelinePanel3.setOpaque(false);
820
821        javax.swing.GroupLayout incidentTimelinePanel3Layout = new javax.swing.GroupLayout(incidentTimelinePanel3);
822        incidentTimelinePanel3.setLayout(incidentTimelinePanel3Layout);
823        incidentTimelinePanel3Layout.setHorizontalGroup(
824            incidentTimelinePanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
825            .addGap(0, 0, Short.MAX_VALUE)
826        );
827        incidentTimelinePanel3Layout.setVerticalGroup(
828            incidentTimelinePanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
829            .addGap(0, 0, Short.MAX_VALUE)
830        );
831
832        incidentTimelinePanel6.setOpaque(false);
833
834        javax.swing.GroupLayout incidentTimelinePanel6Layout = new javax.swing.GroupLayout(incidentTimelinePanel6);
835        incidentTimelinePanel6.setLayout(incidentTimelinePanel6Layout);
836        incidentTimelinePanel6Layout.setHorizontalGroup(
837            incidentTimelinePanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
838            .addGap(0, 0, Short.MAX_VALUE)
839        );
840        incidentTimelinePanel6Layout.setVerticalGroup(
841            incidentTimelinePanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
842            .addGap(0, 0, Short.MAX_VALUE)
843        );
844
845        incidentTimelinePanel5.setOpaque(false);
846
847        javax.swing.GroupLayout incidentTimelinePanel5Layout = new javax.swing.GroupLayout(incidentTimelinePanel5);
848        incidentTimelinePanel5.setLayout(incidentTimelinePanel5Layout);
849        incidentTimelinePanel5Layout.setHorizontalGroup(
850            incidentTimelinePanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
851            .addGap(0, 0, Short.MAX_VALUE)
852        );
853        incidentTimelinePanel5Layout.setVerticalGroup(
854            incidentTimelinePanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
855            .addGap(0, 0, Short.MAX_VALUE)
856        );
857
858        incidentTimelinePanel4.setOpaque(false);
859
860        javax.swing.GroupLayout incidentTimelinePanel4Layout = new javax.swing.GroupLayout(incidentTimelinePanel4);
861        incidentTimelinePanel4.setLayout(incidentTimelinePanel4Layout);
862        incidentTimelinePanel4Layout.setHorizontalGroup(
863            incidentTimelinePanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
864            .addGap(0, 0, Short.MAX_VALUE)
865        );
866        incidentTimelinePanel4Layout.setVerticalGroup(
867            incidentTimelinePanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
868            .addGap(0, 0, Short.MAX_VALUE)
869        );
870
871        incidentTimelinePanel7.setOpaque(false);
872
873        javax.swing.GroupLayout incidentTimelinePanel7Layout = new javax.swing.GroupLayout(incidentTimelinePanel7);
874        incidentTimelinePanel7.setLayout(incidentTimelinePanel7Layout);
875        incidentTimelinePanel7Layout.setHorizontalGroup(
876            incidentTimelinePanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
877            .addGap(0, 0, Short.MAX_VALUE)
878        );
879        incidentTimelinePanel7Layout.setVerticalGroup(
880            incidentTimelinePanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
881            .addGap(0, 0, Short.MAX_VALUE)
882        );
883
884        incidentTimelinePanel10.setOpaque(false);
885
886        javax.swing.GroupLayout incidentTimelinePanel10Layout = new javax.swing.GroupLayout(incidentTimelinePanel10);
887        incidentTimelinePanel10.setLayout(incidentTimelinePanel10Layout);
888        incidentTimelinePanel10Layout.setHorizontalGroup(
889            incidentTimelinePanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
890            .addGap(0, 0, Short.MAX_VALUE)
891        );
892        incidentTimelinePanel10Layout.setVerticalGroup(
893            incidentTimelinePanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
894            .addGap(0, 0, Short.MAX_VALUE)
895        );
896
897        incidentTimelinePanel9.setOpaque(false);
898
899        javax.swing.GroupLayout incidentTimelinePanel9Layout = new javax.swing.GroupLayout(incidentTimelinePanel9);
900        incidentTimelinePanel9.setLayout(incidentTimelinePanel9Layout);
901        incidentTimelinePanel9Layout.setHorizontalGroup(
902            incidentTimelinePanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
903            .addGap(0, 0, Short.MAX_VALUE)
904        );
905        incidentTimelinePanel9Layout.setVerticalGroup(
906            incidentTimelinePanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
907            .addGap(0, 0, Short.MAX_VALUE)
908        );
909
910        incidentNumberPanel1.setOpaque(false);
911
912        javax.swing.GroupLayout incidentNumberPanel1Layout = new javax.swing.GroupLayout(incidentNumberPanel1);
913        incidentNumberPanel1.setLayout(incidentNumberPanel1Layout);
914        incidentNumberPanel1Layout.setHorizontalGroup(
915            incidentNumberPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
916            .addGap(0, 0, Short.MAX_VALUE)
917        );
918        incidentNumberPanel1Layout.setVerticalGroup(
919            incidentNumberPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
920            .addGap(0, 0, Short.MAX_VALUE)
921        );
922
923        incidentNumberPanel2.setOpaque(false);
924
925        javax.swing.GroupLayout incidentNumberPanel2Layout = new javax.swing.GroupLayout(incidentNumberPanel2);
926        incidentNumberPanel2.setLayout(incidentNumberPanel2Layout);
927        incidentNumberPanel2Layout.setHorizontalGroup(
928            incidentNumberPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
929            .addGap(0, 0, Short.MAX_VALUE)
930        );
931        incidentNumberPanel2Layout.setVerticalGroup(
932            incidentNumberPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
933            .addGap(0, 0, Short.MAX_VALUE)
934        );
935
936        incidentNumberPanel3.setOpaque(false);
937
938        javax.swing.GroupLayout incidentNumberPanel3Layout = new javax.swing.GroupLayout(incidentNumberPanel3);
939        incidentNumberPanel3.setLayout(incidentNumberPanel3Layout);
940        incidentNumberPanel3Layout.setHorizontalGroup(
941            incidentNumberPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
942            .addGap(0, 0, Short.MAX_VALUE)
943        );
944        incidentNumberPanel3Layout.setVerticalGroup(
945            incidentNumberPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
946            .addGap(0, 0, Short.MAX_VALUE)
947        );
948
949        incidentNumberPanel4.setOpaque(false);
950
951        javax.swing.GroupLayout incidentNumberPanel4Layout = new javax.swing.GroupLayout(incidentNumberPanel4);
952        incidentNumberPanel4.setLayout(incidentNumberPanel4Layout);
953        incidentNumberPanel4Layout.setHorizontalGroup(
954            incidentNumberPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
955            .addGap(0, 0, Short.MAX_VALUE)
956        );
957        incidentNumberPanel4Layout.setVerticalGroup(
958            incidentNumberPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
959            .addGap(0, 0, Short.MAX_VALUE)
960        );
961
962        incidentNumberPanel5.setOpaque(false);
963
964        javax.swing.GroupLayout incidentNumberPanel5Layout = new javax.swing.GroupLayout(incidentNumberPanel5);
965        incidentNumberPanel5.setLayout(incidentNumberPanel5Layout);
966        incidentNumberPanel5Layout.setHorizontalGroup(
967            incidentNumberPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
968            .addGap(0, 0, Short.MAX_VALUE)
969        );
970        incidentNumberPanel5Layout.setVerticalGroup(
971            incidentNumberPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
972            .addGap(0, 0, Short.MAX_VALUE)
973        );
974
975        incidentNumberPanel6.setOpaque(false);
976
977        javax.swing.GroupLayout incidentNumberPanel6Layout = new javax.swing.GroupLayout(incidentNumberPanel6);
978        incidentNumberPanel6.setLayout(incidentNumberPanel6Layout);
979        incidentNumberPanel6Layout.setHorizontalGroup(
980            incidentNumberPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
981            .addGap(0, 0, Short.MAX_VALUE)
982        );
983        incidentNumberPanel6Layout.setVerticalGroup(
984            incidentNumberPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
985            .addGap(0, 0, Short.MAX_VALUE)
986        );
987
988        incidentNumberPanel7.setOpaque(false);
989
990        javax.swing.GroupLayout incidentNumberPanel7Layout = new javax.swing.GroupLayout(incidentNumberPanel7);
991        incidentNumberPanel7.setLayout(incidentNumberPanel7Layout);
992        incidentNumberPanel7Layout.setHorizontalGroup(
993            incidentNumberPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
994            .addGap(0, 0, Short.MAX_VALUE)
995        );
996        incidentNumberPanel7Layout.setVerticalGroup(
997            incidentNumberPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
998            .addGap(0, 0, Short.MAX_VALUE)
999        );
1000
1001        incidentNumberPanel8.setOpaque(false);
1002
1003        javax.swing.GroupLayout incidentNumberPanel8Layout = new javax.swing.GroupLayout(incidentNumberPanel8);
1004        incidentNumberPanel8.setLayout(incidentNumberPanel8Layout);
1005        incidentNumberPanel8Layout.setHorizontalGroup(
1006            incidentNumberPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1007            .addGap(0, 0, Short.MAX_VALUE)
1008        );
1009        incidentNumberPanel8Layout.setVerticalGroup(
1010            incidentNumberPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1011            .addGap(0, 0, Short.MAX_VALUE)
1012        );
1013
1014        incidentNumberPanel9.setOpaque(false);
1015
1016        javax.swing.GroupLayout incidentNumberPanel9Layout = new javax.swing.GroupLayout(incidentNumberPanel9);
1017        incidentNumberPanel9.setLayout(incidentNumberPanel9Layout);
1018        incidentNumberPanel9Layout.setHorizontalGroup(
1019            incidentNumberPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1020            .addGap(0, 0, Short.MAX_VALUE)
1021        );
1022        incidentNumberPanel9Layout.setVerticalGroup(
1023            incidentNumberPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1024            .addGap(0, 0, Short.MAX_VALUE)
1025        );
1026
1027        incidentNumberPanel10.setOpaque(false);
1028
1029        javax.swing.GroupLayout incidentNumberPanel10Layout = new javax.swing.GroupLayout(incidentNumberPanel10);
1030        incidentNumberPanel10.setLayout(incidentNumberPanel10Layout);
1031        incidentNumberPanel10Layout.setHorizontalGroup(
1032            incidentNumberPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1033            .addGap(0, 0, Short.MAX_VALUE)
1034        );
1035        incidentNumberPanel10Layout.setVerticalGroup(
1036            incidentNumberPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1037            .addGap(0, 0, Short.MAX_VALUE)
1038        );
1039
1040        javax.swing.GroupLayout timelineTickPanelLayout = new javax.swing.GroupLayout(timelineTickPanel);
1041        timelineTickPanel.setLayout(timelineTickPanelLayout);
1042        timelineTickPanelLayout.setHorizontalGroup(
1043            timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1044            .addGroup(timelineTickPanelLayout.createSequentialGroup()
1045                .addContainerGap()
1046                .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
1047                    .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1048                        .addComponent(incidentNumberPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1049                        .addComponent(incidentNumberPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1050                    .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1051                        .addComponent(incidentNumberPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1052                        .addComponent(incidentNumberPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1053                        .addComponent(incidentNumberPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1054                        .addComponent(incidentNumberPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1055                        .addComponent(incidentNumberPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1056                        .addComponent(incidentNumberPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1057                        .addComponent(incidentNumberPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1058                    .addComponent(incidentNumberPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1059                .addGap(10, 10, 10)
1060                .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1061                    .addComponent(incidentTimelinePanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
1062                    .addComponent(incidentTimelinePanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1063                    .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
1064                        .addComponent(incidentTimelinePanel5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
1065                        .addComponent(incidentTimelinePanel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1066                    .addComponent(incidentTimelinePanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1067                    .addComponent(incidentTimelinePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1068                    .addComponent(incidentTimelinePanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1069                    .addComponent(incidentTimelinePanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1070                    .addComponent(incidentTimelinePanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1071                    .addComponent(incidentTimelinePanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1072                .addGap(190, 190, 190))
1073        );
1074        timelineTickPanelLayout.setVerticalGroup(
1075            timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1076            .addGroup(timelineTickPanelLayout.createSequentialGroup()
1077                .addContainerGap()
1078                .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1079                    .addComponent(incidentNumberPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1080                    .addComponent(incidentTimelinePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1081                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1082                .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1083                    .addGroup(timelineTickPanelLayout.createSequentialGroup()
1084                        .addComponent(incidentNumberPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1085                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1086                        .addComponent(incidentNumberPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1087                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1088                        .addComponent(incidentNumberPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1089                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1090                        .addComponent(incidentNumberPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1091                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1092                        .addComponent(incidentNumberPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1093                    .addGroup(timelineTickPanelLayout.createSequentialGroup()
1094                        .addComponent(incidentTimelinePanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1095                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1096                        .addComponent(incidentTimelinePanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1097                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1098                        .addComponent(incidentTimelinePanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1099                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1100                        .addComponent(incidentTimelinePanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1101                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1102                        .addComponent(incidentTimelinePanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
1103                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1104                .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1105                    .addComponent(incidentTimelinePanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1106                    .addComponent(incidentNumberPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1107                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1108                .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1109                    .addGroup(timelineTickPanelLayout.createSequentialGroup()
1110                        .addComponent(incidentTimelinePanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1111                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1112                        .addComponent(incidentTimelinePanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1113                    .addGroup(timelineTickPanelLayout.createSequentialGroup()
1114                        .addComponent(incidentNumberPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1115                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1116                        .addComponent(incidentNumberPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
1117                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1118                .addGroup(timelineTickPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1119                    .addComponent(incidentNumberPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1120                    .addComponent(incidentTimelinePanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
1121                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
1122        );
1123
1124        timelinesScrollPane.setViewportView(timelineTickPanel);
1125
1126        zoomSlider.setMaximum(22);
1127        zoomSlider.setMinimum(4);
1128        zoomSlider.setValue(4);
1129        zoomSlider.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
1130        zoomSlider.setFocusable(false);
1131        zoomSlider.addChangeListener(new javax.swing.event.ChangeListener()
1132        {
1133            public void stateChanged(javax.swing.event.ChangeEvent evt)
1134            {
1135                zoomSliderStateChanged(evt);
1136            }
1137        });
1138
1139        zoomInIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/ZoomIn.png"))); // NOI18N
1140        zoomInIcon.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
1141        zoomInIcon.addMouseListener(new java.awt.event.MouseAdapter()
1142        {
1143            public void mouseClicked(java.awt.event.MouseEvent evt)
1144            {
1145                zoomInIconMouseClicked(evt);
1146            }
1147        });
1148
1149        zoomOutIcon.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/ZoomOut.png"))); // NOI18N
1150        zoomOutIcon.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
1151        zoomOutIcon.addMouseListener(new java.awt.event.MouseAdapter()
1152        {
1153            public void mouseClicked(java.awt.event.MouseEvent evt)
1154            {
1155                zoomOutIconMouseClicked(evt);
1156            }
1157        });
1158
1159        timeStampScrollPane.setBorder(null);
1160        timeStampScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
1161        timeStampScrollPane.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
1162
1163        javax.swing.GroupLayout timeStampPanelLayout = new javax.swing.GroupLayout(timeStampPanel);
1164        timeStampPanel.setLayout(timeStampPanelLayout);
1165        timeStampPanelLayout.setHorizontalGroup(
1166            timeStampPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1167            .addGap(0, 0, Short.MAX_VALUE)
1168        );
1169        timeStampPanelLayout.setVerticalGroup(
1170            timeStampPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1171            .addGap(0, 0, Short.MAX_VALUE)
1172        );
1173
1174        timeStampScrollPane.setViewportView(timeStampPanel);
1175
1176        fileMenu.setText("File");
1177        fileMenu.setMargin(new java.awt.Insets(0, 10, 0, 10));
1178        fileMenu.addActionListener(new java.awt.event.ActionListener()
1179        {
1180            public void actionPerformed(java.awt.event.ActionEvent evt)
1181            {
1182                fileMenuActionPerformed(evt);
1183            }
1184        });
1185
1186        fileNew.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
1187        fileNew.setText("New");
1188        fileNew.addActionListener(new java.awt.event.ActionListener()
1189        {
1190            public void actionPerformed(java.awt.event.ActionEvent evt)
1191            {
1192                fileNewActionPerformed(evt);
1193            }
1194        });
1195        fileMenu.add(fileNew);
1196        fileMenu.add(jSeparator1);
1197
1198        fileOpen.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
1199        fileOpen.setText("Open...");
1200        fileOpen.addActionListener(new java.awt.event.ActionListener()
1201        {
1202            public void actionPerformed(java.awt.event.ActionEvent evt)
1203            {
1204                fileOpenActionPerformed(evt);
1205            }
1206        });
1207        fileMenu.add(fileOpen);
1208        fileMenu.add(jSeparator2);
1209
1210        fileSave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
1211        fileSave.setText("Save");
1212        fileSave.addActionListener(new java.awt.event.ActionListener()
1213        {
1214            public void actionPerformed(java.awt.event.ActionEvent evt)
1215            {
1216                fileSaveActionPerformed(evt);
1217            }
1218        });
1219        fileMenu.add(fileSave);
1220
1221        fileSaveAs.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
1222        fileSaveAs.setText("Save as...");
1223        fileSaveAs.addActionListener(new java.awt.event.ActionListener()
1224        {
1225            public void actionPerformed(java.awt.event.ActionEvent evt)
1226            {
1227                fileSaveAsActionPerformed(evt);
1228            }
1229        });
1230        fileMenu.add(fileSaveAs);
1231
1232        scriptBuilderMenuBar.add(fileMenu);
1233
1234        generateMenu.setLabel("Generate");
1235        generateMenu.setMargin(new java.awt.Insets(0, 10, 0, 10));
1236
1237        generateNotebooks.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
1238        generateNotebooks.setText("Generate Notebooks...");
1239        generateNotebooks.addActionListener(new java.awt.event.ActionListener()
1240        {
1241            public void actionPerformed(java.awt.event.ActionEvent evt)
1242            {
1243                generateNotebooksActionPerformed(evt);
1244            }
1245        });
1246        generateMenu.add(generateNotebooks);
1247
1248        jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_W, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
1249        jMenuItem3.setText("Generate Web Notebook...");
1250        generateMenu.add(jMenuItem3);
1251
1252        generateScorecards.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
1253        generateScorecards.setText("Generate Scorecards...");
1254        generateScorecards.addActionListener(new java.awt.event.ActionListener()
1255        {
1256            public void actionPerformed(java.awt.event.ActionEvent evt)
1257            {
1258                generateScorecardsActionPerformed(evt);
1259            }
1260        });
1261        generateMenu.add(generateScorecards);
1262
1263        generateOrganizationChart.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
1264        generateOrganizationChart.setText("Generate D14 TMC Org Chart...");
1265        generateOrganizationChart.addActionListener(new java.awt.event.ActionListener()
1266        {
1267            public void actionPerformed(java.awt.event.ActionEvent evt)
1268            {
1269                generateOrganizationChartActionPerformed(evt);
1270            }
1271        });
1272        generateMenu.add(generateOrganizationChart);
1273        generateMenu.add(jSeparator3);
1274
1275        generateProjectRequirements.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
1276        generateProjectRequirements.setText("Generate Project Worklist...");
1277        generateProjectRequirements.addActionListener(new java.awt.event.ActionListener()
1278        {
1279            public void actionPerformed(java.awt.event.ActionEvent evt)
1280            {
1281                generateProjectRequirementsActionPerformed(evt);
1282            }
1283        });
1284        generateMenu.add(generateProjectRequirements);
1285
1286        scriptBuilderMenuBar.add(generateMenu);
1287
1288        incidentMenu.setText("Incidents");
1289        incidentMenu.setMargin(new java.awt.Insets(0, 10, 0, 10));
1290
1291        newIncident.setText("New Incident...");
1292        newIncident.addActionListener(new java.awt.event.ActionListener()
1293        {
1294            public void actionPerformed(java.awt.event.ActionEvent evt)
1295            {
1296                newIncidentActionPerformed(evt);
1297            }
1298        });
1299        incidentMenu.add(newIncident);
1300
1301        editIncident.setText("Edit Incident...");
1302        editIncident.addActionListener(new java.awt.event.ActionListener()
1303        {
1304            public void actionPerformed(java.awt.event.ActionEvent evt)
1305            {
1306                editIncidentActionPerformed(evt);
1307            }
1308        });
1309        incidentMenu.add(editIncident);
1310
1311        incidentDetails.setText("Incident Details...");
1312        incidentDetails.addActionListener(new java.awt.event.ActionListener()
1313        {
1314            public void actionPerformed(java.awt.event.ActionEvent evt)
1315            {
1316                incidentDetailsActionPerformed(evt);
1317            }
1318        });
1319        incidentMenu.add(incidentDetails);
1320        incidentMenu.add(jSeparator4);
1321
1322        saveIncident.setText("Save Incident...");
1323        saveIncident.addActionListener(new java.awt.event.ActionListener()
1324        {
1325            public void actionPerformed(java.awt.event.ActionEvent evt)
1326            {
1327                saveIncidentActionPerformed(evt);
1328            }
1329        });
1330        incidentMenu.add(saveIncident);
1331
1332        loadIncident.setText("Load Incident...");
1333        loadIncident.addActionListener(new java.awt.event.ActionListener()
1334        {
1335            public void actionPerformed(java.awt.event.ActionEvent evt)
1336            {
1337                loadIncidentActionPerformed(evt);
1338            }
1339        });
1340        incidentMenu.add(loadIncident);
1341
1342        scriptBuilderMenuBar.add(incidentMenu);
1343
1344        generateNoiseMenu.setText("Noise");
1345
1346        generateNoiseOption.setText("Generate Noise...");
1347        generateNoiseOption.addActionListener(new java.awt.event.ActionListener()
1348        {
1349            public void actionPerformed(java.awt.event.ActionEvent evt)
1350            {
1351                generateNoiseOptionActionPerformed(evt);
1352            }
1353        });
1354        generateNoiseMenu.add(generateNoiseOption);
1355
1356        scriptBuilderMenuBar.add(generateNoiseMenu);
1357
1358        helpMenu.setText("Help");
1359        helpMenu.setMargin(new java.awt.Insets(0, 10, 0, 10));
1360
1361        helpTutorial.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0));
1362        helpTutorial.setText("Tutorial...");
1363        helpMenu.add(helpTutorial);
1364
1365        helpAbout.setText("About...");
1366        helpAbout.addActionListener(new java.awt.event.ActionListener()
1367        {
1368            public void actionPerformed(java.awt.event.ActionEvent evt)
1369            {
1370                helpAboutActionPerformed(evt);
1371            }
1372        });
1373        helpMenu.add(helpAbout);
1374
1375        scriptBuilderMenuBar.add(helpMenu);
1376
1377        setJMenuBar(scriptBuilderMenuBar);
1378
1379        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
1380        getContentPane().setLayout(layout);
1381        layout.setHorizontalGroup(
1382            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1383            .addGroup(layout.createSequentialGroup()
1384                .addContainerGap()
1385                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1386                    .addComponent(timelinesScrollPane, 0, 0, Short.MAX_VALUE)
1387                    .addComponent(timeStampScrollPane)
1388                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
1389                        .addGap(0, 597, Short.MAX_VALUE)
1390                        .addComponent(zoomOutIcon)
1391                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1392                        .addComponent(zoomSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
1393                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1394                        .addComponent(zoomInIcon)
1395                        .addGap(136, 136, 136)))
1396                .addContainerGap())
1397        );
1398        layout.setVerticalGroup(
1399            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1400            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
1401                .addContainerGap()
1402                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
1403                    .addComponent(zoomOutIcon)
1404                    .addComponent(zoomSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1405                    .addComponent(zoomInIcon))
1406                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1407                .addComponent(timeStampScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
1408                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1409                .addComponent(timelinesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1289, Short.MAX_VALUE)
1410                .addContainerGap())
1411        );
1412
1413        pack();
1414    }// </editor-fold>//GEN-END:initComponents
1415
1416    /**
1417     * Scale the timeline width based on zoom slider position.
1418     *
1419     * @param evt the state change event
1420     */
1421    private void zoomSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_zoomSliderStateChanged
1422        ScriptBuilderGuiConstants.PIXEL_WIDTH_PER_HORIZONTAL_TICK = zoomSlider.getValue();
1423        this.update(script, script);
1424        pack();
1425        repaint();
1426    }//GEN-LAST:event_zoomSliderStateChanged
1427
1428    private void cadEventMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cadEventMousePressed
1429    }//GEN-LAST:event_cadEventMousePressed
1430
1431    private void radioEventMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_radioEventMousePressed
1432    }//GEN-LAST:event_radioEventMousePressed
1433
1434    private void cadEventMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cadEventMouseReleased
1435    }//GEN-LAST:event_cadEventMouseReleased
1436
1437    private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
1438    }//GEN-LAST:event_okButtonActionPerformed
1439
1440    /**
1441     * If cancel button is pressed, close radio event editor
1442     *
1443     * @param evt the button press event
1444     */
1445    private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
1446        radioMessage.setText("");
1447        radioTypeComboBox.setSelectedIndex(0);
1448        radioEventFrame.setVisible(false);
1449    }//GEN-LAST:event_cancelButtonActionPerformed
1450
1451    private void editEventListActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editEventListActionPerformed
1452    }//GEN-LAST:event_editEventListActionPerformed
1453
1454    /**
1455     * Executed when the "OK" button is pressed on the Incident editor. If
1456     * incident is new, and is valid, adds it to the model and updates. If
1457     * editing existing incident, verifies changes are valid and applies them.
1458     * Then closes editor window.
1459     *
1460     * @param evt the button press event
1461     */
1462    private void incidentOkButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_incidentOkButtonActionPerformed
1463        if (!editingIncident)//adding new incident
1464        {
1465            boolean found = false;
1466            int indx = 0;
1467            // ALERT: Wacky logic follows
1468            // Examine all the incidents contained in this script
1469            for (ScriptIncident inci : script.incidents)
1470            {
1471                // If this spot in the list of incidents hasn't been assigned yet
1472                if (inci == null)
1473                {
1474                    found = true;
1475                    break;
1476                }
1477                ++indx;
1478                // Does the new incident number match an existing one?
1479                if (inci.number == (Integer) addIncidentNumber.getValue())
1480                {
1481                    JOptionPane.showMessageDialog(this, "Incident number already in use.",
1482                            "Unable to Create Incident", JOptionPane.ERROR_MESSAGE);
1483                    incidentFrame.setVisible(true);
1484                    return;
1485                }
1486            }
1487            // We examined all incidents and there wasn't an empty slot
1488            if (!found)
1489            {
1490                JOptionPane.showMessageDialog(this, "Script already has the max number of incidents.",
1491                        "Unable to Create Incident", JOptionPane.ERROR_MESSAGE);
1492                incidentFrame.setVisible(true);
1493                // ALERT: exit from middle of method
1494                return;
1495            }
1496
1497            // We found a spot for the new incident
1498            script.incidents.remove(indx); // remove the null incident placeholder
1499            SimulationScript.incidentColors[indx] = selectedColor;
1500            // Add the new incident to the list
1501            script.incidents.add(indx,
1502                    new ScriptIncident(SimulationScript.incidentColors[indx],
1503                            (Integer) addIncidentNumber.getValue(), addIncidentName.getText(), addIncidentDescription.getText(),
1504                            script));
1505            script.incidents.get(indx).length = (Integer) addIncidentLength.getValue() * 60;
1506            script.incidents.get(indx).setOffset((Integer) addIncidentStart.getValue() * 60);
1507            script.numberOfIncidents++;
1508        }
1509        else//editing existing incident
1510        {
1511//            //what the hell?
1512//            ScriptIncident backup = script.incidents.get(oldIncidentIndex);
1513//            script.incidents.remove(oldIncidentIndex);
1514//            script.incidents.add(oldIncidentIndex, null);
1515//
1516//            for (ScriptIncident i : script.incidents)
1517//            {
1518//                if (i != null && i.number == (Integer) addIncidentNumber.getValue())
1519//                {
1520//                    script.incidents.remove(oldIncidentIndex);
1521//                    script.incidents.add(oldIncidentIndex, backup);
1522//                    JOptionPane.showMessageDialog(this, "Incident number already in use.",
1523//                            "Unable to Create Incident", JOptionPane.ERROR_MESSAGE);
1524//                    incidentFrame.setVisible(true);
1525//                    return;
1526//                }
1527//            }
1528//
1529//            //ugh why do it like this
1530//            script.incidents.remove(oldIncidentIndex);
1531//            SimulationScript.incidentColors[oldIncidentIndex] = selectedColor;
1532//            script.incidents.add(oldIncidentIndex,
1533//                    new ScriptIncident(SimulationScript.incidentColors[oldIncidentIndex],
1534//                            (Integer) addIncidentNumber.getValue(), addIncidentName.getText(), addIncidentDescription.getText(),
1535//                            script));
1536//            script.incidents.get(oldIncidentIndex).length = (Integer) addIncidentLength.getValue() * 60;
1537//            script.incidents.get(oldIncidentIndex).slices = backup.slices;
1538//            script.incidents.get(oldIncidentIndex).offset = backup.offset;
1539//            script.incidents.get(oldIncidentIndex).setOffset((Integer) addIncidentStart.getValue() * 60);
1540
1541            script.incidents.get(oldIncidentIndex).color = selectedColor;
1542            script.incidents.get(oldIncidentIndex).name = addIncidentName.getText();
1543            script.incidents.get(oldIncidentIndex).description = addIncidentDescription.getText();
1544            script.incidents.get(oldIncidentIndex).setOffset(((int) addIncidentStart.getValue()) * 60);
1545            if (!scriptContainsLogNum(script, (int) addIncidentNumber.getValue()))
1546            {
1547                script.incidents.get(oldIncidentIndex).number = (int) addIncidentNumber.getValue();
1548            }
1549            else
1550            {
1551                JOptionPane.showMessageDialog(this, "Incident number already in use.",
1552                        "Unable To Alter Incident Detail", JOptionPane.ERROR_MESSAGE);
1553            }
1554        }
1555
1556        incidentFrame.setVisible(false);
1557        update(script, script);
1558        repaint();
1559    }//GEN-LAST:event_incidentOkButtonActionPerformed
1560
1561    private boolean scriptContainsLogNum(SimulationScript script, int num)
1562    {
1563        for (ScriptIncident incident : script.incidents)
1564        {
1565            if (incident != null && incident.number == num)
1566            {
1567                return true;
1568            }
1569        }
1570        return false;
1571    }
1572
1573    /**
1574     * Closes editor window upon click of cancel button.
1575     *
1576     * @param evt the button press event
1577     */
1578    private void incidentCancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_incidentCancelButtonActionPerformed
1579        incidentFrame.setVisible(false);
1580    }//GEN-LAST:event_incidentCancelButtonActionPerformed
1581
1582    /**
1583     * Opens incident editor window and preps for addition of new incident, upon
1584     * click of "New Incident" menu option.
1585     *
1586     * @param evt the button press event
1587     */
1588    private void newIncidentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newIncidentActionPerformed
1589        editingIncident = false;
1590
1591        addIncidentName.setText("");
1592        addIncidentNumber.setValue(101);
1593        addIncidentStart.setValue(0);
1594        addIncidentLength.setValue(0);
1595        incidentColorField.setBackground(Color.BLACK);
1596        selectedColor = Color.BLACK;
1597        addIncidentDescription.setText("");
1598
1599        incidentFrame.setVisible(true);
1600    }//GEN-LAST:event_newIncidentActionPerformed
1601
1602    private void fileMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileMenuActionPerformed
1603    }//GEN-LAST:event_fileMenuActionPerformed
1604
1605    /**
1606     * Upon click of "Open file" menu option, opens a window to load a new .sim
1607     * file.
1608     *
1609     * @param evt the button press event
1610     */
1611    private void fileOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileOpenActionPerformed
1612        JFileChooser fc = new JFileChooser();
1613
1614        fc.setFileFilter(new ExtensionFileFilter("Simulation Script XML (.xml)",
1615                new String[]
1616                {
1617                    "xml"
1618                }));
1619        if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
1620        {
1621            script = new SimulationScript();
1622            System.out.println(fc.getSelectedFile().getName());
1623            script.loadScriptFromFile(fc.getSelectedFile());
1624            script.saveFile = fc.getSelectedFile();
1625        }
1626        update(script, script);
1627        zoomSlider.setValue(zoomSlider.getMinimum());
1628        repaint();
1629    }//GEN-LAST:event_fileOpenActionPerformed
1630
1631    /**
1632     * Upon click of "Save as" menu option, opens a window to choose a .sim file
1633     * to save this as.
1634     *
1635     * @param evt the button press event
1636     */
1637    private void fileSaveAsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileSaveAsActionPerformed
1638        JFileChooser fc = new JFileChooser();
1639
1640        fc.setFileFilter(new ExtensionFileFilter("Simulation Script XML (.xml)",
1641                new String[]
1642                {
1643                    "xml"
1644                }));
1645
1646        if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION)
1647        {
1648            script.saveScriptToFile(fc.getSelectedFile());
1649            script.saveFile = fc.getSelectedFile();
1650        }
1651    }//GEN-LAST:event_fileSaveAsActionPerformed
1652
1653    /**
1654     * Upon click of "Save" menu option, opens a window to choose a .sim file to
1655     * save this as.
1656     *
1657     * @param evt the button press event
1658     */
1659    private void fileSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileSaveActionPerformed
1660        if (script.saveFile == null)
1661        {
1662            fileSaveAsActionPerformed(evt);
1663        }
1664        else
1665        {
1666            script.saveScriptToFile(script.saveFile);
1667        }
1668    }//GEN-LAST:event_fileSaveActionPerformed
1669
1670    /**
1671     * Upon click of "Edit incident" menu option, brings up a dropdown menu of
1672     * all existing incidents. Once an incident is selected, opens incident
1673     * editor window with that event's details loaded.
1674     *
1675     * @param evt the button press event
1676     */
1677    private void incidentDetailsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_incidentDetailsActionPerformed
1678        Object[] incidentList = script.incidents.toArray();
1679        ScriptIncident i = (ScriptIncident) JOptionPane.showInputDialog(
1680                this,
1681                "Select Incident:",
1682                "Edit Incident",
1683                JOptionPane.PLAIN_MESSAGE,
1684                null,
1685                incidentList,
1686                script.incidents.get(0));
1687
1688        // If a valid incident was selected
1689        if (i != null)
1690        {
1691            editingIncident = true;
1692            oldIncidentIndex = script.incidents.indexOf(i);
1693
1694            addIncidentName.setText(i.name);
1695            addIncidentNumber.setValue(i.number);
1696            addIncidentStart.setValue(i.offset / 60);
1697            addIncidentLength.setValue(i.length / 60);
1698            incidentColorField.setBackground(i.color);
1699            selectedColor = i.color;
1700            addIncidentDescription.setText(i.description);
1701
1702            incidentFrame.setVisible(true);
1703        }
1704    }//GEN-LAST:event_incidentDetailsActionPerformed
1705
1706    /**
1707     * Brings up the noise generation screen upon click of the "Generate Noise"
1708     * menu option.
1709     *
1710     * @param evt the button press event
1711     */
1712    private void generateNoiseOptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateNoiseOptionActionPerformed
1713        addNoiseFrame.setVisible(true);
1714    }//GEN-LAST:event_generateNoiseOptionActionPerformed
1715
1716    /**
1717     * Hides the noise generation screen upon click of the "Cancel" button.
1718     *
1719     * @param evt the button press event
1720     */
1721    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
1722        addNoiseFrame.setVisible(false);
1723    }//GEN-LAST:event_jButton1ActionPerformed
1724
1725    /**
1726     * Generates random noise upon click of the "OK" button, then hides the
1727     * noise generation screen.
1728     *
1729     * @param evt the button press event
1730     */
1731    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
1732        Random rng = new Random();
1733        ScriptEventType[] eventTypes = ScriptEventType.values();
1734
1735        /* For prototyping purpose, ignore the sliders and average their values */
1736        int total = jSlider1.getValue() + jSlider2.getValue() + jSlider3.getValue() + jSlider5.getValue() + jSlider4.getValue();
1737        total /= 5;
1738
1739        for (int i = 0; i < script.incidents.get(9).slices.size(); i++)
1740        {
1741            script.incidents.get(9).slices.get(i).events.clear();
1742        }
1743
1744        for (int i = 0; i < total; i++)
1745        {
1746            int n = rng.nextInt();
1747            int s = rng.nextInt();
1748            int e = rng.nextInt();
1749            if (n < 0)
1750            {
1751                n *= -1;
1752            }
1753            if (s < 0)
1754            {
1755                s *= -1;
1756            }
1757            if (e < 0)
1758            {
1759                e *= -1;
1760            }
1761
1762            script.incidents.get(9).slices.get(s % (script.incidents.get(9).slices.size())).addEvent(ScriptEvent.factoryByType(eventTypes[e % eventTypes.length]));
1763        }
1764
1765        addNoiseFrame.setVisible(false);
1766
1767        update(script, script);
1768}//GEN-LAST:event_jButton2ActionPerformed
1769
1770    /**
1771     * Allow the user to pick an incident from a dropdown, then save it to an
1772     * XML file.
1773     *
1774     * @param evt the button press event
1775     */
1776    private void saveIncidentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveIncidentActionPerformed
1777        Object[] incidentList = script.incidents.toArray();
1778        String input = "";
1779        ScriptIncident inc = null;
1780        Object result = JOptionPane.showInputDialog(
1781                this,
1782                "Select Incident:",
1783                "Save Incident",
1784                JOptionPane.PLAIN_MESSAGE,
1785                null,
1786                incidentList,
1787                script.incidents.get(0));
1788
1789        System.out.println("RESULT = " + result.toString());
1790
1791        input = result.toString();
1792
1793        System.out.println("INPUT = " + input);
1794
1795        int i = 0;
1796        for (ScriptIncident incident : script.incidents)
1797        {
1798            if (incident == null)
1799            {
1800                continue;
1801            }
1802            System.out.println((++i) + ": " + incident.toString());
1803            if (incident.toString().equals(input))
1804            {
1805                inc = incident;
1806            }
1807        }
1808
1809        if (inc == null)
1810        {
1811            System.out.println("DIDN'T FIND ANYTHING");
1812            return;
1813        }
1814
1815        JFileChooser fc = new JFileChooser();
1816        fc.setFileFilter(new ExtensionFileFilter("Script Incident (.xml)", new String[]
1817        {
1818            "xml"
1819        }));
1820        if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION)
1821        {
1822            inc.saveIncidentToFile(fc.getSelectedFile());
1823        }
1824    }//GEN-LAST:event_saveIncidentActionPerformed
1825
1826    private void loadIncidentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadIncidentActionPerformed
1827        new IncidentPaletteFrame(script, this).setVisible(true);
1828        zoomSlider.setValue(zoomSlider.getMinimum());
1829    }//GEN-LAST:event_loadIncidentActionPerformed
1830
1831    private void generateProjectRequirementsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateProjectRequirementsActionPerformed
1832        JFileChooser fc = new JFileChooser();
1833        fc.setFileFilter(new ExtensionFileFilter("Portable Document Format (.pdf)", new String[]
1834        {
1835            "pdf"
1836        }));
1837        fc.setSelectedFile(new File("Requirements.pdf"));
1838        fc.showSaveDialog(this);
1839    }//GEN-LAST:event_generateProjectRequirementsActionPerformed
1840
1841    private void generateNotebooksActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateNotebooksActionPerformed
1842        JFileChooser fc = new JFileChooser();
1843        fc.setFileFilter(new ExtensionFileFilter("Portable Document Format (.pdf)", new String[]
1844        {
1845            "pdf"
1846        }));
1847        fc.setSelectedFile(new File("Notebooks.pdf"));
1848        fc.showSaveDialog(this);
1849    }//GEN-LAST:event_generateNotebooksActionPerformed
1850
1851    private void generateScorecardsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateScorecardsActionPerformed
1852        JFileChooser fc = new JFileChooser();
1853        fc.setFileFilter(new ExtensionFileFilter("Portable Document Format (.pdf)", new String[]
1854        {
1855            "pdf"
1856        }));
1857        fc.setSelectedFile(new File("Scorecards.pdf"));
1858        fc.showSaveDialog(this);
1859    }//GEN-LAST:event_generateScorecardsActionPerformed
1860
1861    private void generateOrganizationChartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateOrganizationChartActionPerformed
1862        JFileChooser fc = new JFileChooser();
1863        fc.setFileFilter(new ExtensionFileFilter("Portable Document Format (.pdf)", new String[]
1864        {
1865            "pdf"
1866        }));
1867        fc.setSelectedFile(new File("OrganizationChart.pdf"));
1868        fc.showSaveDialog(this);
1869    }//GEN-LAST:event_generateOrganizationChartActionPerformed
1870
1871    /**
1872     * Increases zoom level upon click of the "Zoom in" icon.
1873     *
1874     * @param evt the mouse event
1875     */
1876    private void zoomInIconMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_zoomInIconMouseClicked
1877        zoomSlider.setValue(zoomSlider.getValue() >= 21 ? 21 : zoomSlider.getValue() + 1);
1878    }//GEN-LAST:event_zoomInIconMouseClicked
1879
1880    /**
1881     * Decreases zoom level upon click of the "Zoom out" icon.
1882     *
1883     * @param evt the mouse event
1884     */
1885    private void zoomOutIconMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_zoomOutIconMouseClicked
1886        zoomSlider.setValue(zoomSlider.getValue() <= 5 ? 5 : zoomSlider.getValue() - 1);
1887    }//GEN-LAST:event_zoomOutIconMouseClicked
1888    private Color selectedColor = Color.BLACK;
1889
1890    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
1891        Color newColor = incidentColorChooser.showDialog(this, "Incident Color", incidentColorField.getBackground());
1892        if (newColor != null)
1893        {
1894            System.out.println("New color is " + newColor.toString());
1895            selectedColor = newColor;
1896            incidentColorField.setBackground(newColor);
1897        }
1898        incidentFrame.setVisible(true);
1899    }//GEN-LAST:event_jButton3ActionPerformed
1900
1901    /* Help > About simply displays the current SVN revision number so
1902     * the user can determine which version of the source code was used to
1903     * build the executable she is running.
1904     */
1905    private void helpAboutActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_helpAboutActionPerformed
1906    {//GEN-HEADEREND:event_helpAboutActionPerformed
1907        JOptionPane.showMessageDialog(rootPane, "Revision: " + getAppVersion(), "About", JOptionPane.INFORMATION_MESSAGE);
1908    }//GEN-LAST:event_helpAboutActionPerformed
1909
1910    private void fileNewActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_fileNewActionPerformed
1911    {//GEN-HEADEREND:event_fileNewActionPerformed
1912        script = new SimulationScript();
1913        script.update();
1914        update(null, script);
1915        repaint();
1916    }//GEN-LAST:event_fileNewActionPerformed
1917
1918    private void editIncidentActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_editIncidentActionPerformed
1919    {//GEN-HEADEREND:event_editIncidentActionPerformed
1920        Object[] incidentList = script.incidents.toArray();
1921        String input = "";
1922        ScriptIncident inc = null;
1923        Object result = JOptionPane.showInputDialog(
1924                this,
1925                "Select Incident:",
1926                "Save Incident",
1927                JOptionPane.PLAIN_MESSAGE,
1928                null,
1929                incidentList,
1930                script.incidents.get(0));
1931
1932        if (result != null)
1933        {
1934            System.out.println("RESULT = " + result.toString());
1935
1936            input = result.toString();
1937
1938            System.out.println("INPUT = " + input);
1939
1940            int i = 0;
1941            for (ScriptIncident incident : script.incidents)
1942            {
1943                if (incident == null)
1944                {
1945                    continue;
1946                }
1947                System.out.println((++i) + ": " + incident.toString());
1948                if (incident.toString().equals(input))
1949                {
1950                    inc = incident;
1951                }
1952            }
1953
1954            if (inc != null)
1955            {
1956                IncidentEditorFrame editor = new IncidentEditorFrame(inc);
1957                script.addObserver(editor);
1958                editor.setVisible(true);
1959            }
1960        }
1961        update(script, script);
1962    }//GEN-LAST:event_editIncidentActionPerformed
1963
1964    /**
1965     * Read the version number from the application properties. The file
1966     * 'application.properties' is generated by build.xml.
1967     *
1968     * @return a version string obtained from application.properties file, or
1969     * "Version: unknown" if an IOerror prevents us from reading the file.
1970     */
1971    private String getAppVersion()
1972    {
1973        String propfilename = "/scriptbuilder/gui/application.properties";
1974        String propKey = "Application.revision";
1975        String version = "unknown";
1976        // Load the application properties (created by build.xml)
1977        try
1978        {
1979            Properties props = new Properties();
1980            props.load(this.getClass().getResourceAsStream(propfilename));
1981            version = (String) props.get(propKey);
1982        }
1983        catch (IOException ex)
1984        {
1985            Logger.getLogger("scriptbuilder.gui").log(Level.SEVERE,
1986                    "ScriptBuilderFrame.getAppVersion()."
1987                    + " IOError reading " + propfilename);
1988        }
1989        catch (NullPointerException npe)
1990        {
1991            Logger.getLogger("scriptbuilder.gui").log(Level.SEVERE,
1992                    "ScriptBuilderFrame.getAppVersion().load."
1993                    + " Missing file: " + propfilename);
1994        }
1995        return version;
1996    }
1997
1998    /**
1999     * Runs the script builder.
2000     *
2001     * @param args the command line arguments
2002     */
2003    public static void main(String args[])
2004    {
2005        try
2006        {
2007            UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
2008        }
2009        catch (ClassNotFoundException ex)
2010        {
2011        }
2012        catch (InstantiationException ex)
2013        {
2014        }
2015        catch (IllegalAccessException ex)
2016        {
2017        }
2018        catch (UnsupportedLookAndFeelException ex)
2019        {
2020        }
2021
2022        try
2023        {
2024            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
2025        }
2026        catch (ClassNotFoundException ex)
2027        {
2028        }
2029        catch (InstantiationException ex)
2030        {
2031        }
2032        catch (IllegalAccessException ex)
2033        {
2034        }
2035        catch (UnsupportedLookAndFeelException ex)
2036        {
2037        }
2038
2039        java.awt.EventQueue.invokeLater(
2040                new Runnable()
2041                {
2042                    public void run()
2043                    {
2044                        new ScriptBuilderFrame().setVisible(true);
2045                    }
2046                });
2047    }
2048    // Variables declaration - do not modify//GEN-BEGIN:variables
2049    private javax.swing.JTextArea addIncidentDescription;
2050    private javax.swing.JSpinner addIncidentLength;
2051    private javax.swing.JTextField addIncidentName;
2052    private javax.swing.JSpinner addIncidentNumber;
2053    private javax.swing.JSpinner addIncidentStart;
2054    private javax.swing.JFrame addNoiseFrame;
2055    private javax.swing.JMenuItem cadEvent;
2056    private javax.swing.JFrame cadEventFrame;
2057    private javax.swing.JButton cancelButton;
2058    private javax.swing.JMenuItem deleteEventList;
2059    private javax.swing.JMenuItem editEventList;
2060    private javax.swing.JMenuItem editIncident;
2061    private javax.swing.JPopupMenu eventListPopupMenu;
2062    private javax.swing.JPopupMenu eventPopupMenu;
2063    private javax.swing.JMenu fileMenu;
2064    private javax.swing.JMenuItem fileNew;
2065    private javax.swing.JMenuItem fileOpen;
2066    private javax.swing.JMenuItem fileSave;
2067    private javax.swing.JMenuItem fileSaveAs;
2068    private javax.swing.JMenu generateMenu;
2069    private javax.swing.JMenu generateNoiseMenu;
2070    private javax.swing.JMenuItem generateNoiseOption;
2071    private javax.swing.JMenuItem generateNotebooks;
2072    private javax.swing.JMenuItem generateOrganizationChart;
2073    private javax.swing.JMenuItem generateProjectRequirements;
2074    private javax.swing.JMenuItem generateScorecards;
2075    private javax.swing.JMenuItem helpAbout;
2076    private javax.swing.JMenu helpMenu;
2077    private javax.swing.JMenuItem helpTutorial;
2078    private javax.swing.JButton incidentCancelButton;
2079    private javax.swing.JColorChooser incidentColorChooser;
2080    private javax.swing.JTextField incidentColorField;
2081    private javax.swing.JMenuItem incidentDetails;
2082    private javax.swing.JFrame incidentFrame;
2083    private javax.swing.JMenu incidentMenu;
2084    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel1;
2085    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel10;
2086    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel2;
2087    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel3;
2088    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel4;
2089    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel5;
2090    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel6;
2091    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel7;
2092    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel8;
2093    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel9;
2094    private javax.swing.JButton incidentOkButton;
2095    private javax.swing.JPopupMenu incidentPopupMenu;
2096    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel1;
2097    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel10;
2098    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel2;
2099    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel3;
2100    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel4;
2101    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel5;
2102    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel6;
2103    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel7;
2104    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel8;
2105    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel9;
2106    private javax.swing.JButton jButton1;
2107    private javax.swing.JButton jButton2;
2108    private javax.swing.JButton jButton3;
2109    private javax.swing.JLabel jLabel10;
2110    private javax.swing.JLabel jLabel11;
2111    private javax.swing.JLabel jLabel12;
2112    private javax.swing.JLabel jLabel13;
2113    private javax.swing.JLabel jLabel14;
2114    private javax.swing.JLabel jLabel15;
2115    private javax.swing.JLabel jLabel16;
2116    private javax.swing.JLabel jLabel17;
2117    private javax.swing.JLabel jLabel20;
2118    private javax.swing.JLabel jLabel21;
2119    private javax.swing.JLabel jLabel5;
2120    private javax.swing.JLabel jLabel6;
2121    private javax.swing.JLabel jLabel7;
2122    private javax.swing.JLabel jLabel8;
2123    private javax.swing.JLabel jLabel9;
2124    private javax.swing.JMenuItem jMenuItem2;
2125    private javax.swing.JMenuItem jMenuItem3;
2126    private javax.swing.JMenuItem jMenuItem4;
2127    private javax.swing.JMenuItem jMenuItem5;
2128    private javax.swing.JMenuItem jMenuItem6;
2129    private javax.swing.JScrollPane jScrollPane1;
2130    private javax.swing.JPopupMenu.Separator jSeparator1;
2131    private javax.swing.JPopupMenu.Separator jSeparator2;
2132    private javax.swing.JPopupMenu.Separator jSeparator3;
2133    private javax.swing.JPopupMenu.Separator jSeparator4;
2134    private javax.swing.JSlider jSlider1;
2135    private javax.swing.JSlider jSlider2;
2136    private javax.swing.JSlider jSlider3;
2137    private javax.swing.JSlider jSlider4;
2138    private javax.swing.JSlider jSlider5;
2139    private javax.swing.JTextArea jTextArea1;
2140    private javax.swing.JMenuItem loadIncident;
2141    private javax.swing.JMenuItem newIncident;
2142    private javax.swing.JButton okButton;
2143    private javax.swing.JMenuItem popupDeleteIncident;
2144    private javax.swing.JMenuItem radioEvent;
2145    private javax.swing.JFrame radioEventFrame;
2146    private javax.swing.JTextArea radioMessage;
2147    private javax.swing.JScrollPane radioMessageScrollPane;
2148    private javax.swing.JComboBox radioTypeComboBox;
2149    private javax.swing.JLabel radioTypeLabel;
2150    private javax.swing.JMenuItem saveIncident;
2151    private javax.swing.JMenuBar scriptBuilderMenuBar;
2152    private scriptbuilder.gui.panels.TimeStampPanel timeStampPanel;
2153    private javax.swing.JScrollPane timeStampScrollPane;
2154    private scriptbuilder.gui.panels.TimelineTickPanel timelineTickPanel;
2155    private javax.swing.JScrollPane timelinesScrollPane;
2156    private javax.swing.JLabel zoomInIcon;
2157    private javax.swing.JLabel zoomOutIcon;
2158    private javax.swing.JSlider zoomSlider;
2159    // End of variables declaration//GEN-END:variables
2160}
Note: See TracBrowser for help on using the repository browser.