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

Revision 95, 107.0 KB checked in by bmcguffin, 9 years ago (diff)

When the "new incident" properties screen is closed, the relevant incident editor window opens. This allows the user to add events immediately after creating a new incident.

Line 
1/*
2 * ScriptBuilderFrame.java
3 *
4 * Created on May 8, 2010, 12:01:46 PM
5 */
6package scriptbuilder.gui;
7
8import java.awt.Adjustable;
9import java.awt.Color;
10import java.awt.event.AdjustmentEvent;
11import java.awt.event.AdjustmentListener;
12import java.awt.event.KeyEvent;
13import java.awt.event.KeyListener;
14import java.io.File;
15import java.io.IOException;
16import java.util.Observable;
17import java.util.Observer;
18import java.util.Properties;
19import java.util.Random;
20import java.util.logging.Level;
21import java.util.logging.Logger;
22import javax.swing.DefaultListModel;
23import javax.swing.JFileChooser;
24import javax.swing.JOptionPane;
25import javax.swing.UIManager;
26import javax.swing.UnsupportedLookAndFeelException;
27import scriptbuilder.structures.ScriptEvent;
28import scriptbuilder.structures.ScriptEvent.ScriptEventType;
29import scriptbuilder.structures.ScriptIncident;
30import scriptbuilder.structures.ScriptIncident.IncidentFocusedEvent;
31import scriptbuilder.structures.ScriptIncident.SliceChangedEvent;
32import scriptbuilder.structures.SimulationScript;
33import scriptbuilder.structures.TimeSlice;
34import scriptbuilder.structures.events.I_ScriptEvent;
35
36/**
37 * GUI for the script builder. Contains all panels and editor elements. Performs
38 * updates to reflect script model, which it observes.
39 *
40 * @author Greg Eddington
41 * @author Bryan McGuffin
42 */
43public class ScriptBuilderFrame extends javax.swing.JFrame implements Observer
44{
45
46    /**
47     * The script model.
48     */
49    private SimulationScript script;
50    /**
51     * The current type of selected event.
52     */
53    public ScriptEventType currentEventType;
54    /**
55     * True if we are currently editing an incident.
56     */
57    private boolean editingIncident;
58    /**
59     * Index of the previous incident.
60     */
61    private int oldIncidentIndex;
62
63    /**
64     * Get the script currently in use.
65     *
66     * @return the script model object
67     */
68    public SimulationScript getScript()
69    {
70        return script;
71    }
72
73    /**
74     * Listener for the scroll pane.
75     */
76    class MyAdjustmentListener implements AdjustmentListener
77    {
78
79        /**
80         * If the incident timeline is scrolled horizontally, the timestamp
81         * panel is updated to reflect it.
82         *
83         * @param evt the adjustment event
84         */
85        @Override
86        public void adjustmentValueChanged(AdjustmentEvent evt)
87        {
88            if (evt.getAdjustable().getOrientation() == Adjustable.HORIZONTAL)
89            {
90                timeStampScrollPane.getHorizontalScrollBar()
91                        .setValue(timelinesScrollPane.getHorizontalScrollBar().getValue());
92            }
93            else
94            {
95                // Event from vertical scrollbar
96            }
97
98            repaint();
99        }
100    }
101
102    /**
103     * Listener for key presses. Used for hotkeys for different event types.
104     */
105    private class TimelineKeyListener implements KeyListener
106    {
107
108        /**
109         * If a hotkey is pressed, select that type of event.
110         *
111         * @param e the key event
112         */
113        @Override
114        public void keyPressed(KeyEvent e)
115        {
116            repaint();
117        }
118
119        /**
120         * Take no action upon key release.
121         *
122         * @param e the key event
123         */
124        @Override
125        public void keyReleased(KeyEvent e)
126        {
127        }
128
129        /**
130         * Take no action upon key release.
131         *
132         * @param e the key event
133         */
134        @Override
135        public void keyTyped(KeyEvent e)
136        {
137        }
138    }
139
140    /**
141     * Constructor. Prep new script model, initialize the GUI, and add listeners
142     * for all buttons.
143     */
144    public ScriptBuilderFrame()
145    {
146        script = new SimulationScript();
147        script.addObserver(this);
148        initComponents();
149        this.update(null, script);
150
151        // Hack to refresh the zoom
152        /*
153         zoomSlider.setValue(zoomSlider.getValue() - 1);
154         zoomSlider.setValue(zoomSlider.getValue() + 1);
155         */
156        // Set listener for scroll pane
157        AdjustmentListener listener = new MyAdjustmentListener();
158        timelinesScrollPane.getHorizontalScrollBar().addAdjustmentListener(listener);
159        timelinesScrollPane.getVerticalScrollBar().addAdjustmentListener(listener);
160        repaint();
161    }
162
163    /**
164     * Update the GUI to reflect the model. If the script changed, update all
165     * the incident panels. If a timeslice changed, add any new events to the
166     * model. If an incident gained focus, update the incident info screen to
167     * display its details.
168     *
169     * @param o The observed object
170     * @param arg Either the script model or an incident event, depending on who
171     * called this update
172     */
173    @Override
174    public void update(Observable o, Object arg)
175    {
176        if (arg instanceof SimulationScript)
177        {
178            script = (SimulationScript) arg;
179
180            if (script.incidents.size() != 10)
181            {
182                return;
183            }
184
185            timelineTickPanel.update(script);
186            timeStampPanel.update(script);
187
188            incidentTimelinePanel1.timelinePanelUpdate(script.incidents.get(0));
189            incidentTimelinePanel2.timelinePanelUpdate(script.incidents.get(1));
190            incidentTimelinePanel3.timelinePanelUpdate(script.incidents.get(2));
191            incidentTimelinePanel4.timelinePanelUpdate(script.incidents.get(3));
192            incidentTimelinePanel5.timelinePanelUpdate(script.incidents.get(4));
193            incidentTimelinePanel6.timelinePanelUpdate(script.incidents.get(5));
194            incidentTimelinePanel7.timelinePanelUpdate(script.incidents.get(6));
195            incidentTimelinePanel8.timelinePanelUpdate(script.incidents.get(7));
196            incidentTimelinePanel9.timelinePanelUpdate(script.incidents.get(8));
197            incidentTimelinePanel10.timelinePanelUpdate(script.incidents.get(9));
198
199            incidentNumberPanel1.update(script.incidents.get(0));
200            incidentNumberPanel2.update(script.incidents.get(1));
201            incidentNumberPanel3.update(script.incidents.get(2));
202            incidentNumberPanel4.update(script.incidents.get(3));
203            incidentNumberPanel5.update(script.incidents.get(4));
204            incidentNumberPanel6.update(script.incidents.get(5));
205            incidentNumberPanel7.update(script.incidents.get(6));
206            incidentNumberPanel8.update(script.incidents.get(7));
207            incidentNumberPanel9.update(script.incidents.get(8));
208            incidentNumberPanel10.update(script.incidents.get(9));
209
210            /**
211             * DefaultComboBoxModel model = new DefaultComboBoxModel(); for
212             * (ScriptIncident i : script.incidents) { if (i != null)
213             * model.addElement(i); } gotoIncident.setModel(model);*
214             */
215            this.setPreferredSize(this.getSize());
216            pack();
217        }
218        else if (arg instanceof SliceChangedEvent)
219        {
220            TimeSlice slice = ((SliceChangedEvent) arg).slice;
221
222            DefaultListModel model = new DefaultListModel();
223            for (I_ScriptEvent e : slice.events)
224            {
225                model.addElement(e);
226            }
227        }
228        else if (arg instanceof IncidentFocusedEvent)
229        {
230            ScriptIncident i = ((IncidentFocusedEvent) arg).incident;
231
232            //gotoIncident.setSelectedItem(i);
233        }
234
235        zoomSlider.setMinimum(((timelineTickPanel.getVisibleRect().width - 20)
236                * ScriptBuilderGuiConstants.HORIZONTAL_TICK_RESOLUTION)
237                / Math.max(script.absoluteLength(), ScriptBuilderGuiConstants.TICK_TIMELINE_SMALLEST_LENGTH));
238        zoomSlider.setMaximum(zoomSlider.getMinimum() + 20);
239        repaint();
240    }
241
242    /**
243     * This method is called from within the constructor to initialize the form.
244     * WARNING: Do NOT modify this code. The content of this method is always
245     * regenerated by the Form Editor.
246     */
247    @SuppressWarnings("unchecked")
248    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
249    private void initComponents()
250    {
251
252        incidentPopupMenu = new javax.swing.JPopupMenu();
253        popupDeleteIncident = new javax.swing.JMenuItem();
254        eventPopupMenu = new javax.swing.JPopupMenu();
255        cadEvent = new javax.swing.JMenuItem();
256        jMenuItem2 = new javax.swing.JMenuItem();
257        radioEvent = new javax.swing.JMenuItem();
258        jMenuItem4 = new javax.swing.JMenuItem();
259        jMenuItem5 = new javax.swing.JMenuItem();
260        jMenuItem6 = new javax.swing.JMenuItem();
261        cadEventFrame = new javax.swing.JFrame();
262        jLabel5 = new javax.swing.JLabel();
263        radioEventFrame = new javax.swing.JFrame();
264        radioTypeLabel = new javax.swing.JLabel();
265        jLabel7 = new javax.swing.JLabel();
266        radioTypeComboBox = new javax.swing.JComboBox();
267        radioMessageScrollPane = new javax.swing.JScrollPane();
268        radioMessage = new javax.swing.JTextArea();
269        okButton = new javax.swing.JButton();
270        cancelButton = new javax.swing.JButton();
271        eventListPopupMenu = new javax.swing.JPopupMenu();
272        editEventList = new javax.swing.JMenuItem();
273        deleteEventList = new javax.swing.JMenuItem();
274        incidentFrame = new javax.swing.JFrame();
275        jLabel6 = new javax.swing.JLabel();
276        jLabel8 = new javax.swing.JLabel();
277        jLabel9 = new javax.swing.JLabel();
278        jLabel10 = new javax.swing.JLabel();
279        jScrollPane1 = new javax.swing.JScrollPane();
280        addIncidentDescription = new javax.swing.JTextArea();
281        incidentOkButton = new javax.swing.JButton();
282        incidentCancelButton = new javax.swing.JButton();
283        addIncidentNumber = new javax.swing.JSpinner();
284        addIncidentName = new javax.swing.JTextField();
285        jLabel11 = new javax.swing.JLabel();
286        addIncidentLength = new javax.swing.JSpinner();
287        jLabel12 = new javax.swing.JLabel();
288        addIncidentStart = new javax.swing.JSpinner();
289        jButton3 = new javax.swing.JButton();
290        incidentColorField = new javax.swing.JTextField();
291        addNoiseFrame = new javax.swing.JFrame();
292        jLabel13 = new javax.swing.JLabel();
293        jSlider1 = new javax.swing.JSlider();
294        jSlider2 = new javax.swing.JSlider();
295        jLabel14 = new javax.swing.JLabel();
296        jSlider3 = new javax.swing.JSlider();
297        jLabel15 = new javax.swing.JLabel();
298        jTextArea1 = new javax.swing.JTextArea();
299        jSlider4 = new javax.swing.JSlider();
300        jLabel16 = new javax.swing.JLabel();
301        jSlider5 = new javax.swing.JSlider();
302        jLabel17 = new javax.swing.JLabel();
303        jButton1 = new javax.swing.JButton();
304        jButton2 = new javax.swing.JButton();
305        jLabel20 = new javax.swing.JLabel();
306        jLabel21 = new javax.swing.JLabel();
307        incidentColorChooser = new javax.swing.JColorChooser();
308        timelinesScrollPane = new javax.swing.JScrollPane();
309        timelineTickPanel = new scriptbuilder.gui.panels.TimelineTickPanel();
310        incidentTimelinePanel1 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
311        incidentTimelinePanel2 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
312        incidentTimelinePanel8 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
313        incidentTimelinePanel3 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
314        incidentTimelinePanel6 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
315        incidentTimelinePanel5 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
316        incidentTimelinePanel4 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
317        incidentTimelinePanel7 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
318        incidentTimelinePanel10 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
319        incidentTimelinePanel9 = new scriptbuilder.gui.panels.IncidentTimelinePanel();
320        incidentNumberPanel1 = new scriptbuilder.gui.panels.IncidentNumberPanel();
321        incidentNumberPanel2 = new scriptbuilder.gui.panels.IncidentNumberPanel();
322        incidentNumberPanel3 = new scriptbuilder.gui.panels.IncidentNumberPanel();
323        incidentNumberPanel4 = new scriptbuilder.gui.panels.IncidentNumberPanel();
324        incidentNumberPanel5 = new scriptbuilder.gui.panels.IncidentNumberPanel();
325        incidentNumberPanel6 = new scriptbuilder.gui.panels.IncidentNumberPanel();
326        incidentNumberPanel7 = new scriptbuilder.gui.panels.IncidentNumberPanel();
327        incidentNumberPanel8 = new scriptbuilder.gui.panels.IncidentNumberPanel();
328        incidentNumberPanel9 = new scriptbuilder.gui.panels.IncidentNumberPanel();
329        incidentNumberPanel10 = new scriptbuilder.gui.panels.IncidentNumberPanel();
330        zoomSlider = new javax.swing.JSlider();
331        zoomInIcon = new javax.swing.JLabel();
332        zoomOutIcon = new javax.swing.JLabel();
333        timeStampScrollPane = new javax.swing.JScrollPane();
334        timeStampPanel = new scriptbuilder.gui.panels.TimeStampPanel();
335        scriptBuilderMenuBar = new javax.swing.JMenuBar();
336        fileMenu = new javax.swing.JMenu();
337        fileNew = new javax.swing.JMenuItem();
338        jSeparator1 = new javax.swing.JPopupMenu.Separator();
339        fileOpen = new javax.swing.JMenuItem();
340        jSeparator2 = new javax.swing.JPopupMenu.Separator();
341        fileSave = new javax.swing.JMenuItem();
342        fileSaveAs = new javax.swing.JMenuItem();
343        generateMenu = new javax.swing.JMenu();
344        generateNotebooks = new javax.swing.JMenuItem();
345        jMenuItem3 = new javax.swing.JMenuItem();
346        generateScorecards = new javax.swing.JMenuItem();
347        generateOrganizationChart = new javax.swing.JMenuItem();
348        jSeparator3 = new javax.swing.JPopupMenu.Separator();
349        generateProjectRequirements = new javax.swing.JMenuItem();
350        incidentMenu = new javax.swing.JMenu();
351        newIncident = new javax.swing.JMenuItem();
352        editIncident = new javax.swing.JMenuItem();
353        incidentDetails = new javax.swing.JMenuItem();
354        deleteIncident = 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
1324        deleteIncident.setText("Delete Incident");
1325        deleteIncident.addActionListener(new java.awt.event.ActionListener()
1326        {
1327            public void actionPerformed(java.awt.event.ActionEvent evt)
1328            {
1329                deleteIncidentActionPerformed(evt);
1330            }
1331        });
1332        incidentMenu.add(deleteIncident);
1333        incidentMenu.add(jSeparator4);
1334
1335        saveIncident.setText("Save Incident...");
1336        saveIncident.addActionListener(new java.awt.event.ActionListener()
1337        {
1338            public void actionPerformed(java.awt.event.ActionEvent evt)
1339            {
1340                saveIncidentActionPerformed(evt);
1341            }
1342        });
1343        incidentMenu.add(saveIncident);
1344
1345        loadIncident.setText("Load Incident...");
1346        loadIncident.addActionListener(new java.awt.event.ActionListener()
1347        {
1348            public void actionPerformed(java.awt.event.ActionEvent evt)
1349            {
1350                loadIncidentActionPerformed(evt);
1351            }
1352        });
1353        incidentMenu.add(loadIncident);
1354
1355        scriptBuilderMenuBar.add(incidentMenu);
1356
1357        generateNoiseMenu.setText("Noise");
1358
1359        generateNoiseOption.setText("Generate Noise...");
1360        generateNoiseOption.addActionListener(new java.awt.event.ActionListener()
1361        {
1362            public void actionPerformed(java.awt.event.ActionEvent evt)
1363            {
1364                generateNoiseOptionActionPerformed(evt);
1365            }
1366        });
1367        generateNoiseMenu.add(generateNoiseOption);
1368
1369        scriptBuilderMenuBar.add(generateNoiseMenu);
1370
1371        helpMenu.setText("Help");
1372        helpMenu.setMargin(new java.awt.Insets(0, 10, 0, 10));
1373
1374        helpTutorial.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0));
1375        helpTutorial.setText("Tutorial...");
1376        helpMenu.add(helpTutorial);
1377
1378        helpAbout.setText("About...");
1379        helpAbout.addActionListener(new java.awt.event.ActionListener()
1380        {
1381            public void actionPerformed(java.awt.event.ActionEvent evt)
1382            {
1383                helpAboutActionPerformed(evt);
1384            }
1385        });
1386        helpMenu.add(helpAbout);
1387
1388        scriptBuilderMenuBar.add(helpMenu);
1389
1390        setJMenuBar(scriptBuilderMenuBar);
1391
1392        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
1393        getContentPane().setLayout(layout);
1394        layout.setHorizontalGroup(
1395            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1396            .addGroup(layout.createSequentialGroup()
1397                .addContainerGap()
1398                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1399                    .addComponent(timelinesScrollPane, 0, 0, Short.MAX_VALUE)
1400                    .addComponent(timeStampScrollPane)
1401                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
1402                        .addGap(0, 597, Short.MAX_VALUE)
1403                        .addComponent(zoomOutIcon)
1404                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1405                        .addComponent(zoomSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
1406                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1407                        .addComponent(zoomInIcon)
1408                        .addGap(136, 136, 136)))
1409                .addContainerGap())
1410        );
1411        layout.setVerticalGroup(
1412            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
1413            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
1414                .addContainerGap()
1415                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
1416                    .addComponent(zoomOutIcon)
1417                    .addComponent(zoomSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
1418                    .addComponent(zoomInIcon))
1419                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1420                .addComponent(timeStampScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
1421                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
1422                .addComponent(timelinesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1289, Short.MAX_VALUE)
1423                .addContainerGap())
1424        );
1425
1426        pack();
1427    }// </editor-fold>//GEN-END:initComponents
1428
1429    /**
1430     * Scale the timeline width based on zoom slider position.
1431     *
1432     * @param evt the state change event
1433     */
1434    private void zoomSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_zoomSliderStateChanged
1435        ScriptBuilderGuiConstants.PIXEL_WIDTH_PER_HORIZONTAL_TICK = zoomSlider.getValue();
1436        this.update(script, script);
1437        pack();
1438        repaint();
1439    }//GEN-LAST:event_zoomSliderStateChanged
1440
1441    private void cadEventMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cadEventMousePressed
1442    }//GEN-LAST:event_cadEventMousePressed
1443
1444    private void radioEventMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_radioEventMousePressed
1445    }//GEN-LAST:event_radioEventMousePressed
1446
1447    private void cadEventMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cadEventMouseReleased
1448    }//GEN-LAST:event_cadEventMouseReleased
1449
1450    private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
1451    }//GEN-LAST:event_okButtonActionPerformed
1452
1453    /**
1454     * If cancel button is pressed, close radio event editor
1455     *
1456     * @param evt the button press event
1457     */
1458    private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
1459        radioMessage.setText("");
1460        radioTypeComboBox.setSelectedIndex(0);
1461        radioEventFrame.setVisible(false);
1462    }//GEN-LAST:event_cancelButtonActionPerformed
1463
1464    private void editEventListActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editEventListActionPerformed
1465    }//GEN-LAST:event_editEventListActionPerformed
1466
1467    /**
1468     * Executed when the "OK" button is pressed on the Incident editor. If
1469     * incident is new, and is valid, adds it to the model and updates. If
1470     * editing existing incident, verifies changes are valid and applies them.
1471     * Then closes editor window.
1472     *
1473     * @param evt the button press event
1474     */
1475    private void incidentOkButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_incidentOkButtonActionPerformed
1476        if (!editingIncident)//adding new incident
1477        {
1478            boolean found = false;
1479            int indx = 0;
1480            // ALERT: Wacky logic follows
1481            // Examine all the incidents contained in this script
1482            for (ScriptIncident inci : script.incidents)
1483            {
1484                // If this spot in the list of incidents hasn't been assigned yet
1485                if (inci == null)
1486                {
1487                    found = true;
1488                    break;
1489                }
1490                ++indx;
1491                // Does the new incident number match an existing one?
1492                if (inci.number == (Integer) addIncidentNumber.getValue())
1493                {
1494                    JOptionPane.showMessageDialog(this, "Incident number already in use.",
1495                            "Unable to Create Incident", JOptionPane.ERROR_MESSAGE);
1496                    incidentFrame.setVisible(true);
1497                    return;
1498                }
1499            }
1500            // We examined all incidents and there wasn't an empty slot
1501            if (!found)
1502            {
1503                JOptionPane.showMessageDialog(this, "Script already has the max number of incidents.",
1504                        "Unable to Create Incident", JOptionPane.ERROR_MESSAGE);
1505                incidentFrame.setVisible(true);
1506                // ALERT: exit from middle of method
1507                return;
1508            }
1509
1510            // We found a spot for the new incident
1511            script.incidents.remove(indx); // remove the null incident placeholder
1512            SimulationScript.incidentColors[indx] = selectedColor;
1513            // Add the new incident to the list
1514            script.incidents.add(indx,
1515                    new ScriptIncident(SimulationScript.incidentColors[indx],
1516                            (Integer) addIncidentNumber.getValue(), addIncidentName.getText(), addIncidentDescription.getText(),
1517                            script));
1518            script.incidents.get(indx).length = (Integer) addIncidentLength.getValue() * 60;
1519            script.incidents.get(indx).setOffset((Integer) addIncidentStart.getValue() * 60);
1520            script.numberOfIncidents++;
1521            new IncidentEditorFrame(script.incidents.get(indx)).setVisible(true);
1522        }
1523        else//editing existing incident
1524        {
1525//            //what the hell?
1526//            ScriptIncident backup = script.incidents.get(oldIncidentIndex);
1527//            script.incidents.remove(oldIncidentIndex);
1528//            script.incidents.add(oldIncidentIndex, null);
1529//
1530//            for (ScriptIncident i : script.incidents)
1531//            {
1532//                if (i != null && i.number == (Integer) addIncidentNumber.getValue())
1533//                {
1534//                    script.incidents.remove(oldIncidentIndex);
1535//                    script.incidents.add(oldIncidentIndex, backup);
1536//                    JOptionPane.showMessageDialog(this, "Incident number already in use.",
1537//                            "Unable to Create Incident", JOptionPane.ERROR_MESSAGE);
1538//                    incidentFrame.setVisible(true);
1539//                    return;
1540//                }
1541//            }
1542//
1543//            //ugh why do it like this
1544//            script.incidents.remove(oldIncidentIndex);
1545//            SimulationScript.incidentColors[oldIncidentIndex] = selectedColor;
1546//            script.incidents.add(oldIncidentIndex,
1547//                    new ScriptIncident(SimulationScript.incidentColors[oldIncidentIndex],
1548//                            (Integer) addIncidentNumber.getValue(), addIncidentName.getText(), addIncidentDescription.getText(),
1549//                            script));
1550//            script.incidents.get(oldIncidentIndex).length = (Integer) addIncidentLength.getValue() * 60;
1551//            script.incidents.get(oldIncidentIndex).slices = backup.slices;
1552//            script.incidents.get(oldIncidentIndex).offset = backup.offset;
1553//            script.incidents.get(oldIncidentIndex).setOffset((Integer) addIncidentStart.getValue() * 60);
1554
1555            script.incidents.get(oldIncidentIndex).color = selectedColor;
1556            script.incidents.get(oldIncidentIndex).name = addIncidentName.getText();
1557            script.incidents.get(oldIncidentIndex).description = addIncidentDescription.getText();
1558            script.incidents.get(oldIncidentIndex).setOffset(((int) addIncidentStart.getValue()) * 60);
1559            if ((int) addIncidentNumber.getValue() == script.incidents.get(oldIncidentIndex).number
1560                    || !scriptContainsLogNum(script, (int) addIncidentNumber.getValue()))
1561            {
1562                script.incidents.get(oldIncidentIndex).number = (int) addIncidentNumber.getValue();
1563            }
1564            else
1565            {
1566                JOptionPane.showMessageDialog(this, "Incident number already in use.",
1567                        "Unable To Alter Incident Detail", JOptionPane.ERROR_MESSAGE);
1568            }
1569        }
1570
1571        incidentFrame.setVisible(false);
1572        this.update(script, script);
1573        repaint();
1574    }//GEN-LAST:event_incidentOkButtonActionPerformed
1575
1576    private boolean scriptContainsLogNum(SimulationScript script, int num)
1577    {
1578        for (ScriptIncident incident : script.incidents)
1579        {
1580            if (incident != null && incident.number == num)
1581            {
1582                return true;
1583            }
1584        }
1585        return false;
1586    }
1587
1588    /**
1589     * Closes editor window upon click of cancel button.
1590     *
1591     * @param evt the button press event
1592     */
1593    private void incidentCancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_incidentCancelButtonActionPerformed
1594        incidentFrame.setVisible(false);
1595    }//GEN-LAST:event_incidentCancelButtonActionPerformed
1596
1597    /**
1598     * Opens incident editor window and preps for addition of new incident, upon
1599     * click of "New Incident" menu option.
1600     *
1601     * @param evt the button press event
1602     */
1603    private void newIncidentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newIncidentActionPerformed
1604        editingIncident = false;
1605
1606        addIncidentName.setText("");
1607        addIncidentNumber.setValue(101);
1608        addIncidentStart.setValue(0);
1609        addIncidentLength.setValue(0);
1610        incidentColorField.setBackground(Color.BLACK);
1611        selectedColor = Color.BLACK;
1612        addIncidentDescription.setText("");
1613
1614        incidentFrame.setVisible(true);
1615    }//GEN-LAST:event_newIncidentActionPerformed
1616
1617    private void fileMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileMenuActionPerformed
1618    }//GEN-LAST:event_fileMenuActionPerformed
1619
1620    /**
1621     * Upon click of "Open file" menu option, opens a window to load a new .sim
1622     * file.
1623     *
1624     * @param evt the button press event
1625     */
1626    private void fileOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileOpenActionPerformed
1627        JFileChooser fc = new JFileChooser();
1628
1629        fc.setFileFilter(new ExtensionFileFilter("Simulation Script XML (.xml)",
1630                new String[]
1631                {
1632                    "xml"
1633                }));
1634        if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
1635        {
1636            script = new SimulationScript();
1637            System.out.println(fc.getSelectedFile().getName());
1638            script.loadScriptFromFile(fc.getSelectedFile());
1639            script.saveFile = fc.getSelectedFile();
1640        }
1641        this.update(script, script);
1642        zoomSlider.setValue(zoomSlider.getMinimum());
1643        repaint();
1644    }//GEN-LAST:event_fileOpenActionPerformed
1645
1646    /**
1647     * Upon click of "Save as" menu option, opens a window to choose a .sim file
1648     * to save this as.
1649     *
1650     * @param evt the button press event
1651     */
1652    private void fileSaveAsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileSaveAsActionPerformed
1653        JFileChooser fc = new JFileChooser();
1654
1655        fc.setFileFilter(new ExtensionFileFilter("Simulation Script XML (.xml)",
1656                new String[]
1657                {
1658                    "xml"
1659                }));
1660
1661        if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION)
1662        {
1663            script.saveScriptToFile(fc.getSelectedFile());
1664            script.saveFile = fc.getSelectedFile();
1665        }
1666    }//GEN-LAST:event_fileSaveAsActionPerformed
1667
1668    /**
1669     * Upon click of "Save" menu option, opens a window to choose a .sim file to
1670     * save this as.
1671     *
1672     * @param evt the button press event
1673     */
1674    private void fileSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileSaveActionPerformed
1675        if (script.saveFile == null)
1676        {
1677            fileSaveAsActionPerformed(evt);
1678        }
1679        else
1680        {
1681            script.saveScriptToFile(script.saveFile);
1682        }
1683    }//GEN-LAST:event_fileSaveActionPerformed
1684
1685    /**
1686     * Upon click of "Edit incident" menu option, brings up a dropdown menu of
1687     * all existing incidents. Once an incident is selected, opens incident
1688     * editor window with that event's details loaded.
1689     *
1690     * @param evt the button press event
1691     */
1692    private void incidentDetailsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_incidentDetailsActionPerformed
1693        Object[] incidentList = script.incidents.toArray();
1694        ScriptIncident i = (ScriptIncident) JOptionPane.showInputDialog(
1695                this,
1696                "Select Incident:",
1697                "Edit Incident",
1698                JOptionPane.PLAIN_MESSAGE,
1699                null,
1700                incidentList,
1701                script.incidents.get(0));
1702
1703        // If a valid incident was selected
1704        if (i != null)
1705        {
1706            incidentDetailsScreen(i);
1707        }
1708    }//GEN-LAST:event_incidentDetailsActionPerformed
1709
1710    public void incidentDetailsScreen(ScriptIncident i)
1711    {
1712        editingIncident = true;
1713        oldIncidentIndex = script.incidents.indexOf(i);
1714
1715        addIncidentName.setText(i.name);
1716        addIncidentNumber.setValue(i.number);
1717        addIncidentStart.setValue(i.offset / 60);
1718        addIncidentLength.setValue(i.length / 60);
1719        incidentColorField.setBackground(i.color);
1720        selectedColor = i.color;
1721        addIncidentDescription.setText(i.description);
1722
1723        incidentFrame.setVisible(true);
1724    }
1725
1726    /**
1727     * Brings up the noise generation screen upon click of the "Generate Noise"
1728     * menu option.
1729     *
1730     * @param evt the button press event
1731     */
1732    private void generateNoiseOptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateNoiseOptionActionPerformed
1733        addNoiseFrame.setVisible(true);
1734    }//GEN-LAST:event_generateNoiseOptionActionPerformed
1735
1736    /**
1737     * Hides the noise generation screen upon click of the "Cancel" button.
1738     *
1739     * @param evt the button press event
1740     */
1741    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
1742        addNoiseFrame.setVisible(false);
1743    }//GEN-LAST:event_jButton1ActionPerformed
1744
1745    /**
1746     * Generates random noise upon click of the "OK" button, then hides the
1747     * noise generation screen.
1748     *
1749     * @param evt the button press event
1750     */
1751    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
1752        Random rng = new Random();
1753        ScriptEventType[] eventTypes = ScriptEventType.values();
1754
1755        /* For prototyping purpose, ignore the sliders and average their values */
1756        int total = jSlider1.getValue() + jSlider2.getValue() + jSlider3.getValue() + jSlider5.getValue() + jSlider4.getValue();
1757        total /= 5;
1758
1759        for (int i = 0; i < script.incidents.get(9).slices.size(); i++)
1760        {
1761            script.incidents.get(9).slices.get(i).events.clear();
1762        }
1763
1764        for (int i = 0; i < total; i++)
1765        {
1766            int n = rng.nextInt();
1767            int s = rng.nextInt();
1768            int e = rng.nextInt();
1769            if (n < 0)
1770            {
1771                n *= -1;
1772            }
1773            if (s < 0)
1774            {
1775                s *= -1;
1776            }
1777            if (e < 0)
1778            {
1779                e *= -1;
1780            }
1781
1782            script.incidents.get(9).slices.get(s % (script.incidents.get(9).slices.size())).addEvent(ScriptEvent.factoryByType(eventTypes[e % eventTypes.length]));
1783        }
1784
1785        addNoiseFrame.setVisible(false);
1786
1787        this.update(script, script);
1788        repaint();
1789}//GEN-LAST:event_jButton2ActionPerformed
1790
1791    /**
1792     * Allow the user to pick an incident from a dropdown, then save it to an
1793     * XML file.
1794     *
1795     * @param evt the button press event
1796     */
1797    private void saveIncidentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveIncidentActionPerformed
1798        Object[] incidentList = script.incidents.toArray();
1799        String input = "";
1800        ScriptIncident inc = null;
1801        Object result = JOptionPane.showInputDialog(
1802                this,
1803                "Select Incident:",
1804                "Save Incident",
1805                JOptionPane.PLAIN_MESSAGE,
1806                null,
1807                incidentList,
1808                script.incidents.get(0));
1809
1810        System.out.println("RESULT = " + result.toString());
1811
1812        input = result.toString();
1813
1814        System.out.println("INPUT = " + input);
1815
1816        int i = 0;
1817        for (ScriptIncident incident : script.incidents)
1818        {
1819            if (incident == null)
1820            {
1821                continue;
1822            }
1823            System.out.println((++i) + ": " + incident.toString());
1824            if (incident.toString().equals(input))
1825            {
1826                inc = incident;
1827            }
1828        }
1829
1830        if (inc == null)
1831        {
1832            System.out.println("DIDN'T FIND ANYTHING");
1833            return;
1834        }
1835
1836        JFileChooser fc = new JFileChooser();
1837        fc.setFileFilter(new ExtensionFileFilter("Script Incident (.xml)", new String[]
1838        {
1839            "xml"
1840        }));
1841        if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION)
1842        {
1843            inc.saveIncidentToFile(fc.getSelectedFile());
1844        }
1845    }//GEN-LAST:event_saveIncidentActionPerformed
1846
1847    private void loadIncidentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadIncidentActionPerformed
1848        new IncidentPaletteFrame(script, this).setVisible(true);
1849        zoomSlider.setValue(zoomSlider.getMinimum());
1850    }//GEN-LAST:event_loadIncidentActionPerformed
1851
1852    private void generateProjectRequirementsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateProjectRequirementsActionPerformed
1853        JFileChooser fc = new JFileChooser();
1854        fc.setFileFilter(new ExtensionFileFilter("Portable Document Format (.pdf)", new String[]
1855        {
1856            "pdf"
1857        }));
1858        fc.setSelectedFile(new File("Requirements.pdf"));
1859        fc.showSaveDialog(this);
1860    }//GEN-LAST:event_generateProjectRequirementsActionPerformed
1861
1862    private void generateNotebooksActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateNotebooksActionPerformed
1863        JFileChooser fc = new JFileChooser();
1864        fc.setFileFilter(new ExtensionFileFilter("Portable Document Format (.pdf)", new String[]
1865        {
1866            "pdf"
1867        }));
1868        fc.setSelectedFile(new File("Notebooks.pdf"));
1869        fc.showSaveDialog(this);
1870    }//GEN-LAST:event_generateNotebooksActionPerformed
1871
1872    private void generateScorecardsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateScorecardsActionPerformed
1873        JFileChooser fc = new JFileChooser();
1874        fc.setFileFilter(new ExtensionFileFilter("Portable Document Format (.pdf)", new String[]
1875        {
1876            "pdf"
1877        }));
1878        fc.setSelectedFile(new File("Scorecards.pdf"));
1879        fc.showSaveDialog(this);
1880    }//GEN-LAST:event_generateScorecardsActionPerformed
1881
1882    private void generateOrganizationChartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateOrganizationChartActionPerformed
1883        JFileChooser fc = new JFileChooser();
1884        fc.setFileFilter(new ExtensionFileFilter("Portable Document Format (.pdf)", new String[]
1885        {
1886            "pdf"
1887        }));
1888        fc.setSelectedFile(new File("OrganizationChart.pdf"));
1889        fc.showSaveDialog(this);
1890    }//GEN-LAST:event_generateOrganizationChartActionPerformed
1891
1892    /**
1893     * Increases zoom level upon click of the "Zoom in" icon.
1894     *
1895     * @param evt the mouse event
1896     */
1897    private void zoomInIconMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_zoomInIconMouseClicked
1898        zoomSlider.setValue(zoomSlider.getValue() >= 21 ? 21 : zoomSlider.getValue() + 1);
1899    }//GEN-LAST:event_zoomInIconMouseClicked
1900
1901    /**
1902     * Decreases zoom level upon click of the "Zoom out" icon.
1903     *
1904     * @param evt the mouse event
1905     */
1906    private void zoomOutIconMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_zoomOutIconMouseClicked
1907        zoomSlider.setValue(zoomSlider.getValue() <= 5 ? 5 : zoomSlider.getValue() - 1);
1908    }//GEN-LAST:event_zoomOutIconMouseClicked
1909    private Color selectedColor = Color.BLACK;
1910
1911    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
1912        Color newColor = incidentColorChooser.showDialog(this, "Incident Color", incidentColorField.getBackground());
1913        if (newColor != null)
1914        {
1915            System.out.println("New color is " + newColor.toString());
1916            selectedColor = newColor;
1917            incidentColorField.setBackground(newColor);
1918        }
1919        incidentFrame.setVisible(true);
1920    }//GEN-LAST:event_jButton3ActionPerformed
1921
1922    /* Help > About simply displays the current SVN revision number so
1923     * the user can determine which version of the source code was used to
1924     * build the executable she is running.
1925     */
1926    private void helpAboutActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_helpAboutActionPerformed
1927    {//GEN-HEADEREND:event_helpAboutActionPerformed
1928        JOptionPane.showMessageDialog(rootPane, "Revision: " + getAppVersion(), "About", JOptionPane.INFORMATION_MESSAGE);
1929    }//GEN-LAST:event_helpAboutActionPerformed
1930
1931    private void fileNewActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_fileNewActionPerformed
1932    {//GEN-HEADEREND:event_fileNewActionPerformed
1933        script = new SimulationScript();
1934        script.update();
1935        this.update(null, script);
1936        repaint();
1937    }//GEN-LAST:event_fileNewActionPerformed
1938
1939    private void editIncidentActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_editIncidentActionPerformed
1940    {//GEN-HEADEREND:event_editIncidentActionPerformed
1941        Object[] incidentList = script.incidents.toArray();
1942        String input = "";
1943        ScriptIncident inc = null;
1944        Object result = JOptionPane.showInputDialog(
1945                this,
1946                "Select Incident:",
1947                "Save Incident",
1948                JOptionPane.PLAIN_MESSAGE,
1949                null,
1950                incidentList,
1951                script.incidents.get(0));
1952
1953        if (result != null)
1954        {
1955            input = result.toString();
1956            int i = 0;
1957            for (ScriptIncident incident : script.incidents)
1958            {
1959                if (incident == null)
1960                {
1961                    continue;
1962                }
1963                System.out.println((++i) + ": " + incident.toString());
1964                if (incident.toString().equals(input))
1965                {
1966                    inc = incident;
1967                }
1968            }
1969
1970            if (inc != null)
1971            {
1972                IncidentEditorFrame editor = new IncidentEditorFrame(inc);
1973                script.addObserver(editor);
1974                editor.setVisible(true);
1975            }
1976        }
1977        this.update(script, script);
1978        repaint();
1979    }//GEN-LAST:event_editIncidentActionPerformed
1980
1981    private void deleteIncidentActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_deleteIncidentActionPerformed
1982    {//GEN-HEADEREND:event_deleteIncidentActionPerformed
1983        Object[] incidentList = script.incidents.toArray();
1984        String input = "";
1985        ScriptIncident inc = null;
1986        Object result = JOptionPane.showInputDialog(
1987                this,
1988                "Select Incident:",
1989                "Delete Incident",
1990                JOptionPane.PLAIN_MESSAGE,
1991                null,
1992                incidentList,
1993                script.incidents.get(0));
1994
1995        if (result != null)
1996        {
1997            input = result.toString();
1998            int incidentIndex = 0;
1999            for (ScriptIncident incident : script.incidents)
2000            {
2001                incidentIndex++;
2002                if (incident == null)
2003                {
2004                    continue;
2005                }
2006                if (incident.toString().equals(input))
2007                {
2008                    inc = incident;
2009                }
2010            }
2011
2012            if (inc != null)
2013            {
2014                int confirm = JOptionPane.showConfirmDialog(this,
2015                        "Are you sure you want to delete " + inc.toString() + "?");
2016                if (confirm == JOptionPane.YES_OPTION)
2017                {
2018                    script.incidents.remove(inc);
2019                    script.incidents.add(null);
2020                }
2021            }
2022        }
2023        this.update(script, script);
2024        repaint();
2025    }//GEN-LAST:event_deleteIncidentActionPerformed
2026
2027    /**
2028     * Read the version number from the application properties. The file
2029     * 'application.properties' is generated by build.xml.
2030     *
2031     * @return a version string obtained from application.properties file, or
2032     * "Version: unknown" if an IOerror prevents us from reading the file.
2033     */
2034    private String getAppVersion()
2035    {
2036        String propfilename = "/scriptbuilder/gui/application.properties";
2037        String propKey = "Application.revision";
2038        String version = "unknown";
2039        // Load the application properties (created by build.xml)
2040        try
2041        {
2042            Properties props = new Properties();
2043            props.load(this.getClass().getResourceAsStream(propfilename));
2044            version = (String) props.get(propKey);
2045        }
2046        catch (IOException ex)
2047        {
2048            Logger.getLogger("scriptbuilder.gui").log(Level.SEVERE,
2049                    "ScriptBuilderFrame.getAppVersion()."
2050                    + " IOError reading " + propfilename);
2051        }
2052        catch (NullPointerException npe)
2053        {
2054            Logger.getLogger("scriptbuilder.gui").log(Level.SEVERE,
2055                    "ScriptBuilderFrame.getAppVersion().load."
2056                    + " Missing file: " + propfilename);
2057        }
2058        return version;
2059    }
2060
2061    /**
2062     * Runs the script builder.
2063     *
2064     * @param args the command line arguments
2065     */
2066    public static void main(String args[])
2067    {
2068        try
2069        {
2070            UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
2071        }
2072        catch (ClassNotFoundException ex)
2073        {
2074        }
2075        catch (InstantiationException ex)
2076        {
2077        }
2078        catch (IllegalAccessException ex)
2079        {
2080        }
2081        catch (UnsupportedLookAndFeelException ex)
2082        {
2083        }
2084
2085        try
2086        {
2087            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
2088        }
2089        catch (ClassNotFoundException ex)
2090        {
2091        }
2092        catch (InstantiationException ex)
2093        {
2094        }
2095        catch (IllegalAccessException ex)
2096        {
2097        }
2098        catch (UnsupportedLookAndFeelException ex)
2099        {
2100        }
2101
2102        java.awt.EventQueue.invokeLater(
2103                new Runnable()
2104                {
2105                    public void run()
2106                    {
2107                        new ScriptBuilderFrame().setVisible(true);
2108                    }
2109                });
2110    }
2111    // Variables declaration - do not modify//GEN-BEGIN:variables
2112    private javax.swing.JTextArea addIncidentDescription;
2113    private javax.swing.JSpinner addIncidentLength;
2114    private javax.swing.JTextField addIncidentName;
2115    private javax.swing.JSpinner addIncidentNumber;
2116    private javax.swing.JSpinner addIncidentStart;
2117    private javax.swing.JFrame addNoiseFrame;
2118    private javax.swing.JMenuItem cadEvent;
2119    private javax.swing.JFrame cadEventFrame;
2120    private javax.swing.JButton cancelButton;
2121    private javax.swing.JMenuItem deleteEventList;
2122    private javax.swing.JMenuItem deleteIncident;
2123    private javax.swing.JMenuItem editEventList;
2124    private javax.swing.JMenuItem editIncident;
2125    private javax.swing.JPopupMenu eventListPopupMenu;
2126    private javax.swing.JPopupMenu eventPopupMenu;
2127    private javax.swing.JMenu fileMenu;
2128    private javax.swing.JMenuItem fileNew;
2129    private javax.swing.JMenuItem fileOpen;
2130    private javax.swing.JMenuItem fileSave;
2131    private javax.swing.JMenuItem fileSaveAs;
2132    private javax.swing.JMenu generateMenu;
2133    private javax.swing.JMenu generateNoiseMenu;
2134    private javax.swing.JMenuItem generateNoiseOption;
2135    private javax.swing.JMenuItem generateNotebooks;
2136    private javax.swing.JMenuItem generateOrganizationChart;
2137    private javax.swing.JMenuItem generateProjectRequirements;
2138    private javax.swing.JMenuItem generateScorecards;
2139    private javax.swing.JMenuItem helpAbout;
2140    private javax.swing.JMenu helpMenu;
2141    private javax.swing.JMenuItem helpTutorial;
2142    private javax.swing.JButton incidentCancelButton;
2143    private javax.swing.JColorChooser incidentColorChooser;
2144    private javax.swing.JTextField incidentColorField;
2145    private javax.swing.JMenuItem incidentDetails;
2146    private javax.swing.JFrame incidentFrame;
2147    private javax.swing.JMenu incidentMenu;
2148    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel1;
2149    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel10;
2150    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel2;
2151    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel3;
2152    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel4;
2153    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel5;
2154    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel6;
2155    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel7;
2156    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel8;
2157    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel9;
2158    private javax.swing.JButton incidentOkButton;
2159    private javax.swing.JPopupMenu incidentPopupMenu;
2160    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel1;
2161    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel10;
2162    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel2;
2163    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel3;
2164    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel4;
2165    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel5;
2166    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel6;
2167    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel7;
2168    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel8;
2169    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel9;
2170    private javax.swing.JButton jButton1;
2171    private javax.swing.JButton jButton2;
2172    private javax.swing.JButton jButton3;
2173    private javax.swing.JLabel jLabel10;
2174    private javax.swing.JLabel jLabel11;
2175    private javax.swing.JLabel jLabel12;
2176    private javax.swing.JLabel jLabel13;
2177    private javax.swing.JLabel jLabel14;
2178    private javax.swing.JLabel jLabel15;
2179    private javax.swing.JLabel jLabel16;
2180    private javax.swing.JLabel jLabel17;
2181    private javax.swing.JLabel jLabel20;
2182    private javax.swing.JLabel jLabel21;
2183    private javax.swing.JLabel jLabel5;
2184    private javax.swing.JLabel jLabel6;
2185    private javax.swing.JLabel jLabel7;
2186    private javax.swing.JLabel jLabel8;
2187    private javax.swing.JLabel jLabel9;
2188    private javax.swing.JMenuItem jMenuItem2;
2189    private javax.swing.JMenuItem jMenuItem3;
2190    private javax.swing.JMenuItem jMenuItem4;
2191    private javax.swing.JMenuItem jMenuItem5;
2192    private javax.swing.JMenuItem jMenuItem6;
2193    private javax.swing.JScrollPane jScrollPane1;
2194    private javax.swing.JPopupMenu.Separator jSeparator1;
2195    private javax.swing.JPopupMenu.Separator jSeparator2;
2196    private javax.swing.JPopupMenu.Separator jSeparator3;
2197    private javax.swing.JPopupMenu.Separator jSeparator4;
2198    private javax.swing.JSlider jSlider1;
2199    private javax.swing.JSlider jSlider2;
2200    private javax.swing.JSlider jSlider3;
2201    private javax.swing.JSlider jSlider4;
2202    private javax.swing.JSlider jSlider5;
2203    private javax.swing.JTextArea jTextArea1;
2204    private javax.swing.JMenuItem loadIncident;
2205    private javax.swing.JMenuItem newIncident;
2206    private javax.swing.JButton okButton;
2207    private javax.swing.JMenuItem popupDeleteIncident;
2208    private javax.swing.JMenuItem radioEvent;
2209    private javax.swing.JFrame radioEventFrame;
2210    private javax.swing.JTextArea radioMessage;
2211    private javax.swing.JScrollPane radioMessageScrollPane;
2212    private javax.swing.JComboBox radioTypeComboBox;
2213    private javax.swing.JLabel radioTypeLabel;
2214    private javax.swing.JMenuItem saveIncident;
2215    private javax.swing.JMenuBar scriptBuilderMenuBar;
2216    private scriptbuilder.gui.panels.TimeStampPanel timeStampPanel;
2217    private javax.swing.JScrollPane timeStampScrollPane;
2218    private scriptbuilder.gui.panels.TimelineTickPanel timelineTickPanel;
2219    private javax.swing.JScrollPane timelinesScrollPane;
2220    private javax.swing.JLabel zoomInIcon;
2221    private javax.swing.JLabel zoomOutIcon;
2222    private javax.swing.JSlider zoomSlider;
2223    // End of variables declaration//GEN-END:variables
2224}
Note: See TracBrowser for help on using the repository browser.