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

Revision 91, 106.9 KB checked in by bmcguffin, 9 years ago (diff)

Added functionality for popup menu options: "Events", "Properties", "Delete".

Fixed a bug where closing the properties window without altering the incident number would display an error message.

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        }
1522        else//editing existing incident
1523        {
1524//            //what the hell?
1525//            ScriptIncident backup = script.incidents.get(oldIncidentIndex);
1526//            script.incidents.remove(oldIncidentIndex);
1527//            script.incidents.add(oldIncidentIndex, null);
1528//
1529//            for (ScriptIncident i : script.incidents)
1530//            {
1531//                if (i != null && i.number == (Integer) addIncidentNumber.getValue())
1532//                {
1533//                    script.incidents.remove(oldIncidentIndex);
1534//                    script.incidents.add(oldIncidentIndex, backup);
1535//                    JOptionPane.showMessageDialog(this, "Incident number already in use.",
1536//                            "Unable to Create Incident", JOptionPane.ERROR_MESSAGE);
1537//                    incidentFrame.setVisible(true);
1538//                    return;
1539//                }
1540//            }
1541//
1542//            //ugh why do it like this
1543//            script.incidents.remove(oldIncidentIndex);
1544//            SimulationScript.incidentColors[oldIncidentIndex] = selectedColor;
1545//            script.incidents.add(oldIncidentIndex,
1546//                    new ScriptIncident(SimulationScript.incidentColors[oldIncidentIndex],
1547//                            (Integer) addIncidentNumber.getValue(), addIncidentName.getText(), addIncidentDescription.getText(),
1548//                            script));
1549//            script.incidents.get(oldIncidentIndex).length = (Integer) addIncidentLength.getValue() * 60;
1550//            script.incidents.get(oldIncidentIndex).slices = backup.slices;
1551//            script.incidents.get(oldIncidentIndex).offset = backup.offset;
1552//            script.incidents.get(oldIncidentIndex).setOffset((Integer) addIncidentStart.getValue() * 60);
1553
1554            script.incidents.get(oldIncidentIndex).color = selectedColor;
1555            script.incidents.get(oldIncidentIndex).name = addIncidentName.getText();
1556            script.incidents.get(oldIncidentIndex).description = addIncidentDescription.getText();
1557            script.incidents.get(oldIncidentIndex).setOffset(((int) addIncidentStart.getValue()) * 60);
1558            if ((int) addIncidentNumber.getValue() == script.incidents.get(oldIncidentIndex).number
1559                    || !scriptContainsLogNum(script, (int) addIncidentNumber.getValue()))
1560            {
1561                script.incidents.get(oldIncidentIndex).number = (int) addIncidentNumber.getValue();
1562            }
1563            else
1564            {
1565                JOptionPane.showMessageDialog(this, "Incident number already in use.",
1566                        "Unable To Alter Incident Detail", JOptionPane.ERROR_MESSAGE);
1567            }
1568        }
1569
1570        incidentFrame.setVisible(false);
1571        this.update(script, script);
1572        repaint();
1573    }//GEN-LAST:event_incidentOkButtonActionPerformed
1574
1575    private boolean scriptContainsLogNum(SimulationScript script, int num)
1576    {
1577        for (ScriptIncident incident : script.incidents)
1578        {
1579            if (incident != null && incident.number == num)
1580            {
1581                return true;
1582            }
1583        }
1584        return false;
1585    }
1586
1587    /**
1588     * Closes editor window upon click of cancel button.
1589     *
1590     * @param evt the button press event
1591     */
1592    private void incidentCancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_incidentCancelButtonActionPerformed
1593        incidentFrame.setVisible(false);
1594    }//GEN-LAST:event_incidentCancelButtonActionPerformed
1595
1596    /**
1597     * Opens incident editor window and preps for addition of new incident, upon
1598     * click of "New Incident" menu option.
1599     *
1600     * @param evt the button press event
1601     */
1602    private void newIncidentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newIncidentActionPerformed
1603        editingIncident = false;
1604
1605        addIncidentName.setText("");
1606        addIncidentNumber.setValue(101);
1607        addIncidentStart.setValue(0);
1608        addIncidentLength.setValue(0);
1609        incidentColorField.setBackground(Color.BLACK);
1610        selectedColor = Color.BLACK;
1611        addIncidentDescription.setText("");
1612
1613        incidentFrame.setVisible(true);
1614    }//GEN-LAST:event_newIncidentActionPerformed
1615
1616    private void fileMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileMenuActionPerformed
1617    }//GEN-LAST:event_fileMenuActionPerformed
1618
1619    /**
1620     * Upon click of "Open file" menu option, opens a window to load a new .sim
1621     * file.
1622     *
1623     * @param evt the button press event
1624     */
1625    private void fileOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileOpenActionPerformed
1626        JFileChooser fc = new JFileChooser();
1627
1628        fc.setFileFilter(new ExtensionFileFilter("Simulation Script XML (.xml)",
1629                new String[]
1630                {
1631                    "xml"
1632                }));
1633        if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
1634        {
1635            script = new SimulationScript();
1636            System.out.println(fc.getSelectedFile().getName());
1637            script.loadScriptFromFile(fc.getSelectedFile());
1638            script.saveFile = fc.getSelectedFile();
1639        }
1640        this.update(script, script);
1641        zoomSlider.setValue(zoomSlider.getMinimum());
1642        repaint();
1643    }//GEN-LAST:event_fileOpenActionPerformed
1644
1645    /**
1646     * Upon click of "Save as" menu option, opens a window to choose a .sim file
1647     * to save this as.
1648     *
1649     * @param evt the button press event
1650     */
1651    private void fileSaveAsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileSaveAsActionPerformed
1652        JFileChooser fc = new JFileChooser();
1653
1654        fc.setFileFilter(new ExtensionFileFilter("Simulation Script XML (.xml)",
1655                new String[]
1656                {
1657                    "xml"
1658                }));
1659
1660        if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION)
1661        {
1662            script.saveScriptToFile(fc.getSelectedFile());
1663            script.saveFile = fc.getSelectedFile();
1664        }
1665    }//GEN-LAST:event_fileSaveAsActionPerformed
1666
1667    /**
1668     * Upon click of "Save" menu option, opens a window to choose a .sim file to
1669     * save this as.
1670     *
1671     * @param evt the button press event
1672     */
1673    private void fileSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileSaveActionPerformed
1674        if (script.saveFile == null)
1675        {
1676            fileSaveAsActionPerformed(evt);
1677        }
1678        else
1679        {
1680            script.saveScriptToFile(script.saveFile);
1681        }
1682    }//GEN-LAST:event_fileSaveActionPerformed
1683
1684    /**
1685     * Upon click of "Edit incident" menu option, brings up a dropdown menu of
1686     * all existing incidents. Once an incident is selected, opens incident
1687     * editor window with that event's details loaded.
1688     *
1689     * @param evt the button press event
1690     */
1691    private void incidentDetailsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_incidentDetailsActionPerformed
1692        Object[] incidentList = script.incidents.toArray();
1693        ScriptIncident i = (ScriptIncident) JOptionPane.showInputDialog(
1694                this,
1695                "Select Incident:",
1696                "Edit Incident",
1697                JOptionPane.PLAIN_MESSAGE,
1698                null,
1699                incidentList,
1700                script.incidents.get(0));
1701
1702        // If a valid incident was selected
1703        if (i != null)
1704        {
1705            incidentDetailsScreen(i);
1706        }
1707    }//GEN-LAST:event_incidentDetailsActionPerformed
1708
1709    public void incidentDetailsScreen(ScriptIncident i)
1710    {
1711        editingIncident = true;
1712        oldIncidentIndex = script.incidents.indexOf(i);
1713
1714        addIncidentName.setText(i.name);
1715        addIncidentNumber.setValue(i.number);
1716        addIncidentStart.setValue(i.offset / 60);
1717        addIncidentLength.setValue(i.length / 60);
1718        incidentColorField.setBackground(i.color);
1719        selectedColor = i.color;
1720        addIncidentDescription.setText(i.description);
1721
1722        incidentFrame.setVisible(true);
1723    }
1724
1725    /**
1726     * Brings up the noise generation screen upon click of the "Generate Noise"
1727     * menu option.
1728     *
1729     * @param evt the button press event
1730     */
1731    private void generateNoiseOptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateNoiseOptionActionPerformed
1732        addNoiseFrame.setVisible(true);
1733    }//GEN-LAST:event_generateNoiseOptionActionPerformed
1734
1735    /**
1736     * Hides the noise generation screen upon click of the "Cancel" button.
1737     *
1738     * @param evt the button press event
1739     */
1740    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
1741        addNoiseFrame.setVisible(false);
1742    }//GEN-LAST:event_jButton1ActionPerformed
1743
1744    /**
1745     * Generates random noise upon click of the "OK" button, then hides the
1746     * noise generation screen.
1747     *
1748     * @param evt the button press event
1749     */
1750    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
1751        Random rng = new Random();
1752        ScriptEventType[] eventTypes = ScriptEventType.values();
1753
1754        /* For prototyping purpose, ignore the sliders and average their values */
1755        int total = jSlider1.getValue() + jSlider2.getValue() + jSlider3.getValue() + jSlider5.getValue() + jSlider4.getValue();
1756        total /= 5;
1757
1758        for (int i = 0; i < script.incidents.get(9).slices.size(); i++)
1759        {
1760            script.incidents.get(9).slices.get(i).events.clear();
1761        }
1762
1763        for (int i = 0; i < total; i++)
1764        {
1765            int n = rng.nextInt();
1766            int s = rng.nextInt();
1767            int e = rng.nextInt();
1768            if (n < 0)
1769            {
1770                n *= -1;
1771            }
1772            if (s < 0)
1773            {
1774                s *= -1;
1775            }
1776            if (e < 0)
1777            {
1778                e *= -1;
1779            }
1780
1781            script.incidents.get(9).slices.get(s % (script.incidents.get(9).slices.size())).addEvent(ScriptEvent.factoryByType(eventTypes[e % eventTypes.length]));
1782        }
1783
1784        addNoiseFrame.setVisible(false);
1785
1786        this.update(script, script);
1787        repaint();
1788}//GEN-LAST:event_jButton2ActionPerformed
1789
1790    /**
1791     * Allow the user to pick an incident from a dropdown, then save it to an
1792     * XML file.
1793     *
1794     * @param evt the button press event
1795     */
1796    private void saveIncidentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveIncidentActionPerformed
1797        Object[] incidentList = script.incidents.toArray();
1798        String input = "";
1799        ScriptIncident inc = null;
1800        Object result = JOptionPane.showInputDialog(
1801                this,
1802                "Select Incident:",
1803                "Save Incident",
1804                JOptionPane.PLAIN_MESSAGE,
1805                null,
1806                incidentList,
1807                script.incidents.get(0));
1808
1809        System.out.println("RESULT = " + result.toString());
1810
1811        input = result.toString();
1812
1813        System.out.println("INPUT = " + input);
1814
1815        int i = 0;
1816        for (ScriptIncident incident : script.incidents)
1817        {
1818            if (incident == null)
1819            {
1820                continue;
1821            }
1822            System.out.println((++i) + ": " + incident.toString());
1823            if (incident.toString().equals(input))
1824            {
1825                inc = incident;
1826            }
1827        }
1828
1829        if (inc == null)
1830        {
1831            System.out.println("DIDN'T FIND ANYTHING");
1832            return;
1833        }
1834
1835        JFileChooser fc = new JFileChooser();
1836        fc.setFileFilter(new ExtensionFileFilter("Script Incident (.xml)", new String[]
1837        {
1838            "xml"
1839        }));
1840        if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION)
1841        {
1842            inc.saveIncidentToFile(fc.getSelectedFile());
1843        }
1844    }//GEN-LAST:event_saveIncidentActionPerformed
1845
1846    private void loadIncidentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadIncidentActionPerformed
1847        new IncidentPaletteFrame(script, this).setVisible(true);
1848        zoomSlider.setValue(zoomSlider.getMinimum());
1849    }//GEN-LAST:event_loadIncidentActionPerformed
1850
1851    private void generateProjectRequirementsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateProjectRequirementsActionPerformed
1852        JFileChooser fc = new JFileChooser();
1853        fc.setFileFilter(new ExtensionFileFilter("Portable Document Format (.pdf)", new String[]
1854        {
1855            "pdf"
1856        }));
1857        fc.setSelectedFile(new File("Requirements.pdf"));
1858        fc.showSaveDialog(this);
1859    }//GEN-LAST:event_generateProjectRequirementsActionPerformed
1860
1861    private void generateNotebooksActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateNotebooksActionPerformed
1862        JFileChooser fc = new JFileChooser();
1863        fc.setFileFilter(new ExtensionFileFilter("Portable Document Format (.pdf)", new String[]
1864        {
1865            "pdf"
1866        }));
1867        fc.setSelectedFile(new File("Notebooks.pdf"));
1868        fc.showSaveDialog(this);
1869    }//GEN-LAST:event_generateNotebooksActionPerformed
1870
1871    private void generateScorecardsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateScorecardsActionPerformed
1872        JFileChooser fc = new JFileChooser();
1873        fc.setFileFilter(new ExtensionFileFilter("Portable Document Format (.pdf)", new String[]
1874        {
1875            "pdf"
1876        }));
1877        fc.setSelectedFile(new File("Scorecards.pdf"));
1878        fc.showSaveDialog(this);
1879    }//GEN-LAST:event_generateScorecardsActionPerformed
1880
1881    private void generateOrganizationChartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateOrganizationChartActionPerformed
1882        JFileChooser fc = new JFileChooser();
1883        fc.setFileFilter(new ExtensionFileFilter("Portable Document Format (.pdf)", new String[]
1884        {
1885            "pdf"
1886        }));
1887        fc.setSelectedFile(new File("OrganizationChart.pdf"));
1888        fc.showSaveDialog(this);
1889    }//GEN-LAST:event_generateOrganizationChartActionPerformed
1890
1891    /**
1892     * Increases zoom level upon click of the "Zoom in" icon.
1893     *
1894     * @param evt the mouse event
1895     */
1896    private void zoomInIconMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_zoomInIconMouseClicked
1897        zoomSlider.setValue(zoomSlider.getValue() >= 21 ? 21 : zoomSlider.getValue() + 1);
1898    }//GEN-LAST:event_zoomInIconMouseClicked
1899
1900    /**
1901     * Decreases zoom level upon click of the "Zoom out" icon.
1902     *
1903     * @param evt the mouse event
1904     */
1905    private void zoomOutIconMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_zoomOutIconMouseClicked
1906        zoomSlider.setValue(zoomSlider.getValue() <= 5 ? 5 : zoomSlider.getValue() - 1);
1907    }//GEN-LAST:event_zoomOutIconMouseClicked
1908    private Color selectedColor = Color.BLACK;
1909
1910    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
1911        Color newColor = incidentColorChooser.showDialog(this, "Incident Color", incidentColorField.getBackground());
1912        if (newColor != null)
1913        {
1914            System.out.println("New color is " + newColor.toString());
1915            selectedColor = newColor;
1916            incidentColorField.setBackground(newColor);
1917        }
1918        incidentFrame.setVisible(true);
1919    }//GEN-LAST:event_jButton3ActionPerformed
1920
1921    /* Help > About simply displays the current SVN revision number so
1922     * the user can determine which version of the source code was used to
1923     * build the executable she is running.
1924     */
1925    private void helpAboutActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_helpAboutActionPerformed
1926    {//GEN-HEADEREND:event_helpAboutActionPerformed
1927        JOptionPane.showMessageDialog(rootPane, "Revision: " + getAppVersion(), "About", JOptionPane.INFORMATION_MESSAGE);
1928    }//GEN-LAST:event_helpAboutActionPerformed
1929
1930    private void fileNewActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_fileNewActionPerformed
1931    {//GEN-HEADEREND:event_fileNewActionPerformed
1932        script = new SimulationScript();
1933        script.update();
1934        this.update(null, script);
1935        repaint();
1936    }//GEN-LAST:event_fileNewActionPerformed
1937
1938    private void editIncidentActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_editIncidentActionPerformed
1939    {//GEN-HEADEREND:event_editIncidentActionPerformed
1940        Object[] incidentList = script.incidents.toArray();
1941        String input = "";
1942        ScriptIncident inc = null;
1943        Object result = JOptionPane.showInputDialog(
1944                this,
1945                "Select Incident:",
1946                "Save Incident",
1947                JOptionPane.PLAIN_MESSAGE,
1948                null,
1949                incidentList,
1950                script.incidents.get(0));
1951
1952        if (result != null)
1953        {
1954            input = result.toString();
1955            int i = 0;
1956            for (ScriptIncident incident : script.incidents)
1957            {
1958                if (incident == null)
1959                {
1960                    continue;
1961                }
1962                System.out.println((++i) + ": " + incident.toString());
1963                if (incident.toString().equals(input))
1964                {
1965                    inc = incident;
1966                }
1967            }
1968
1969            if (inc != null)
1970            {
1971                IncidentEditorFrame editor = new IncidentEditorFrame(inc);
1972                script.addObserver(editor);
1973                editor.setVisible(true);
1974            }
1975        }
1976        this.update(script, script);
1977        repaint();
1978    }//GEN-LAST:event_editIncidentActionPerformed
1979
1980    private void deleteIncidentActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_deleteIncidentActionPerformed
1981    {//GEN-HEADEREND:event_deleteIncidentActionPerformed
1982        Object[] incidentList = script.incidents.toArray();
1983        String input = "";
1984        ScriptIncident inc = null;
1985        Object result = JOptionPane.showInputDialog(
1986                this,
1987                "Select Incident:",
1988                "Delete Incident",
1989                JOptionPane.PLAIN_MESSAGE,
1990                null,
1991                incidentList,
1992                script.incidents.get(0));
1993
1994        if (result != null)
1995        {
1996            input = result.toString();
1997            int incidentIndex = 0;
1998            for (ScriptIncident incident : script.incidents)
1999            {
2000                incidentIndex++;
2001                if (incident == null)
2002                {
2003                    continue;
2004                }
2005                if (incident.toString().equals(input))
2006                {
2007                    inc = incident;
2008                }
2009            }
2010
2011            if (inc != null)
2012            {
2013                int confirm = JOptionPane.showConfirmDialog(this,
2014                        "Are you sure you want to delete " + inc.toString() + "?");
2015                if (confirm == JOptionPane.YES_OPTION)
2016                {
2017                    script.incidents.remove(inc);
2018                    script.incidents.add(null);
2019                }
2020            }
2021        }
2022        this.update(script, script);
2023        repaint();
2024    }//GEN-LAST:event_deleteIncidentActionPerformed
2025
2026    /**
2027     * Read the version number from the application properties. The file
2028     * 'application.properties' is generated by build.xml.
2029     *
2030     * @return a version string obtained from application.properties file, or
2031     * "Version: unknown" if an IOerror prevents us from reading the file.
2032     */
2033    private String getAppVersion()
2034    {
2035        String propfilename = "/scriptbuilder/gui/application.properties";
2036        String propKey = "Application.revision";
2037        String version = "unknown";
2038        // Load the application properties (created by build.xml)
2039        try
2040        {
2041            Properties props = new Properties();
2042            props.load(this.getClass().getResourceAsStream(propfilename));
2043            version = (String) props.get(propKey);
2044        }
2045        catch (IOException ex)
2046        {
2047            Logger.getLogger("scriptbuilder.gui").log(Level.SEVERE,
2048                    "ScriptBuilderFrame.getAppVersion()."
2049                    + " IOError reading " + propfilename);
2050        }
2051        catch (NullPointerException npe)
2052        {
2053            Logger.getLogger("scriptbuilder.gui").log(Level.SEVERE,
2054                    "ScriptBuilderFrame.getAppVersion().load."
2055                    + " Missing file: " + propfilename);
2056        }
2057        return version;
2058    }
2059
2060    /**
2061     * Runs the script builder.
2062     *
2063     * @param args the command line arguments
2064     */
2065    public static void main(String args[])
2066    {
2067        try
2068        {
2069            UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
2070        }
2071        catch (ClassNotFoundException ex)
2072        {
2073        }
2074        catch (InstantiationException ex)
2075        {
2076        }
2077        catch (IllegalAccessException ex)
2078        {
2079        }
2080        catch (UnsupportedLookAndFeelException ex)
2081        {
2082        }
2083
2084        try
2085        {
2086            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
2087        }
2088        catch (ClassNotFoundException ex)
2089        {
2090        }
2091        catch (InstantiationException ex)
2092        {
2093        }
2094        catch (IllegalAccessException ex)
2095        {
2096        }
2097        catch (UnsupportedLookAndFeelException ex)
2098        {
2099        }
2100
2101        java.awt.EventQueue.invokeLater(
2102                new Runnable()
2103                {
2104                    public void run()
2105                    {
2106                        new ScriptBuilderFrame().setVisible(true);
2107                    }
2108                });
2109    }
2110    // Variables declaration - do not modify//GEN-BEGIN:variables
2111    private javax.swing.JTextArea addIncidentDescription;
2112    private javax.swing.JSpinner addIncidentLength;
2113    private javax.swing.JTextField addIncidentName;
2114    private javax.swing.JSpinner addIncidentNumber;
2115    private javax.swing.JSpinner addIncidentStart;
2116    private javax.swing.JFrame addNoiseFrame;
2117    private javax.swing.JMenuItem cadEvent;
2118    private javax.swing.JFrame cadEventFrame;
2119    private javax.swing.JButton cancelButton;
2120    private javax.swing.JMenuItem deleteEventList;
2121    private javax.swing.JMenuItem deleteIncident;
2122    private javax.swing.JMenuItem editEventList;
2123    private javax.swing.JMenuItem editIncident;
2124    private javax.swing.JPopupMenu eventListPopupMenu;
2125    private javax.swing.JPopupMenu eventPopupMenu;
2126    private javax.swing.JMenu fileMenu;
2127    private javax.swing.JMenuItem fileNew;
2128    private javax.swing.JMenuItem fileOpen;
2129    private javax.swing.JMenuItem fileSave;
2130    private javax.swing.JMenuItem fileSaveAs;
2131    private javax.swing.JMenu generateMenu;
2132    private javax.swing.JMenu generateNoiseMenu;
2133    private javax.swing.JMenuItem generateNoiseOption;
2134    private javax.swing.JMenuItem generateNotebooks;
2135    private javax.swing.JMenuItem generateOrganizationChart;
2136    private javax.swing.JMenuItem generateProjectRequirements;
2137    private javax.swing.JMenuItem generateScorecards;
2138    private javax.swing.JMenuItem helpAbout;
2139    private javax.swing.JMenu helpMenu;
2140    private javax.swing.JMenuItem helpTutorial;
2141    private javax.swing.JButton incidentCancelButton;
2142    private javax.swing.JColorChooser incidentColorChooser;
2143    private javax.swing.JTextField incidentColorField;
2144    private javax.swing.JMenuItem incidentDetails;
2145    private javax.swing.JFrame incidentFrame;
2146    private javax.swing.JMenu incidentMenu;
2147    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel1;
2148    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel10;
2149    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel2;
2150    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel3;
2151    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel4;
2152    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel5;
2153    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel6;
2154    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel7;
2155    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel8;
2156    private scriptbuilder.gui.panels.IncidentNumberPanel incidentNumberPanel9;
2157    private javax.swing.JButton incidentOkButton;
2158    private javax.swing.JPopupMenu incidentPopupMenu;
2159    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel1;
2160    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel10;
2161    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel2;
2162    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel3;
2163    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel4;
2164    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel5;
2165    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel6;
2166    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel7;
2167    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel8;
2168    private scriptbuilder.gui.panels.IncidentTimelinePanel incidentTimelinePanel9;
2169    private javax.swing.JButton jButton1;
2170    private javax.swing.JButton jButton2;
2171    private javax.swing.JButton jButton3;
2172    private javax.swing.JLabel jLabel10;
2173    private javax.swing.JLabel jLabel11;
2174    private javax.swing.JLabel jLabel12;
2175    private javax.swing.JLabel jLabel13;
2176    private javax.swing.JLabel jLabel14;
2177    private javax.swing.JLabel jLabel15;
2178    private javax.swing.JLabel jLabel16;
2179    private javax.swing.JLabel jLabel17;
2180    private javax.swing.JLabel jLabel20;
2181    private javax.swing.JLabel jLabel21;
2182    private javax.swing.JLabel jLabel5;
2183    private javax.swing.JLabel jLabel6;
2184    private javax.swing.JLabel jLabel7;
2185    private javax.swing.JLabel jLabel8;
2186    private javax.swing.JLabel jLabel9;
2187    private javax.swing.JMenuItem jMenuItem2;
2188    private javax.swing.JMenuItem jMenuItem3;
2189    private javax.swing.JMenuItem jMenuItem4;
2190    private javax.swing.JMenuItem jMenuItem5;
2191    private javax.swing.JMenuItem jMenuItem6;
2192    private javax.swing.JScrollPane jScrollPane1;
2193    private javax.swing.JPopupMenu.Separator jSeparator1;
2194    private javax.swing.JPopupMenu.Separator jSeparator2;
2195    private javax.swing.JPopupMenu.Separator jSeparator3;
2196    private javax.swing.JPopupMenu.Separator jSeparator4;
2197    private javax.swing.JSlider jSlider1;
2198    private javax.swing.JSlider jSlider2;
2199    private javax.swing.JSlider jSlider3;
2200    private javax.swing.JSlider jSlider4;
2201    private javax.swing.JSlider jSlider5;
2202    private javax.swing.JTextArea jTextArea1;
2203    private javax.swing.JMenuItem loadIncident;
2204    private javax.swing.JMenuItem newIncident;
2205    private javax.swing.JButton okButton;
2206    private javax.swing.JMenuItem popupDeleteIncident;
2207    private javax.swing.JMenuItem radioEvent;
2208    private javax.swing.JFrame radioEventFrame;
2209    private javax.swing.JTextArea radioMessage;
2210    private javax.swing.JScrollPane radioMessageScrollPane;
2211    private javax.swing.JComboBox radioTypeComboBox;
2212    private javax.swing.JLabel radioTypeLabel;
2213    private javax.swing.JMenuItem saveIncident;
2214    private javax.swing.JMenuBar scriptBuilderMenuBar;
2215    private scriptbuilder.gui.panels.TimeStampPanel timeStampPanel;
2216    private javax.swing.JScrollPane timeStampScrollPane;
2217    private scriptbuilder.gui.panels.TimelineTickPanel timelineTickPanel;
2218    private javax.swing.JScrollPane timelinesScrollPane;
2219    private javax.swing.JLabel zoomInIcon;
2220    private javax.swing.JLabel zoomOutIcon;
2221    private javax.swing.JSlider zoomSlider;
2222    // End of variables declaration//GEN-END:variables
2223}
Note: See TracBrowser for help on using the repository browser.