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

Revision 83, 102.9 KB checked in by bmcguffin, 9 years ago (diff)

Fixed a bug in which adding a new incident didn't increment the counter for number of incidents, which in turn allowed incidents loaded from the palette to erroneously overwrite incidents previously created from scratch in the main window.

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