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

Revision 85, 103.4 KB checked in by jdalbey, 9 years ago (diff)

ScriptBuilderFrame? - added explanatory comments in incidentOkButtonActionPerformed method.

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