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

Revision 106, 104.7 KB checked in by bmcguffin, 9 years ago (diff)

Fixed a bug which prevented the length of an incident from being properly preserved whenever the offset of the incident was changed.

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