Warning: Can't use blame annotator:
svn blame failed on trunk/src/scriptbuilder/gui/ScriptBuilderFrame.java: ("Can't find a temporary directory: Internal error", 20014)

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

Revision 108, 105.8 KB checked in by bmcguffin, 9 years ago (diff)

Removed JSpinner "addIncidentLength" in JFrame "incidentFrame". Replaced it with a JLabel "labelIncidentLength" which reports the incident length in minutes, but which does not allow the user to directly edit the incident length.

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