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

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

Removed most of the panels and buttons from the Script Builder frame. Left those same components in Incident Editor Frame, from which the dropdown menu at the top was removed.

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