source: tmcsimulator/trunk/src/tmcsim/simulationmanager/SimulationManagerView.java @ 459

Revision 459, 51.0 KB checked in by jdalbey, 7 years ago (diff)

addIncidentTab in SimulationManagerView? modified to be on EDT to fix #154.

Line 
1 package tmcsim.simulationmanager;
2
3import java.awt.BorderLayout;
4import java.awt.Color;
5import java.awt.Dimension;
6import java.awt.Font;
7import java.awt.event.MouseEvent;
8import java.awt.event.MouseListener;
9import java.util.TreeMap;
10
11import javax.swing.BorderFactory;
12import javax.swing.Box;
13import javax.swing.BoxLayout;
14import javax.swing.JButton;
15import javax.swing.JComboBox;
16import javax.swing.JFrame;
17import javax.swing.JLabel;
18import javax.swing.JMenu;
19import javax.swing.JMenuBar;
20import javax.swing.JMenuItem;
21import javax.swing.JOptionPane;
22import javax.swing.JPanel;
23import javax.swing.JScrollPane;
24import javax.swing.JSpinner;
25import javax.swing.JTabbedPane;
26import javax.swing.JTable;
27import javax.swing.SpinnerNumberModel;
28import javax.swing.SwingUtilities;
29import javax.swing.border.CompoundBorder;
30import javax.swing.border.EtchedBorder;
31import javax.swing.border.TitledBorder;
32import javax.swing.event.TableModelEvent;
33import javax.swing.event.TableModelListener;
34
35import tmcsim.cadmodels.CMSDiversion;
36import tmcsim.cadmodels.CMSInfo;
37import tmcsim.client.cadclientgui.data.Incident;
38import tmcsim.client.cadclientgui.data.IncidentEvent;
39import tmcsim.common.RevisionNumber;
40import tmcsim.common.ScriptException;
41import tmcsim.common.SimulationException;
42import tmcsim.common.CADEnums.PARAMICS_STATUS;
43import tmcsim.common.CADEnums.SCRIPT_STATUS;
44import tmcsim.common.TimeUtils;
45import tmcsim.simulationmanager.actions.AddIncidentAction;
46import tmcsim.simulationmanager.actions.ApplyDiversionAction;
47import tmcsim.simulationmanager.actions.ConnectToParamicsAction;
48import tmcsim.simulationmanager.actions.DeleteIncidentAction;
49import tmcsim.simulationmanager.actions.ExitAction;
50import tmcsim.simulationmanager.actions.ExportAction;
51import tmcsim.simulationmanager.actions.GotoTimeIndexAction;
52import tmcsim.simulationmanager.actions.LoadParamicsNetworkAction;
53import tmcsim.simulationmanager.actions.LoadScriptAction;
54import tmcsim.simulationmanager.actions.PauseSimulationAction;
55import tmcsim.simulationmanager.actions.RescheduleIncidentAction;
56import tmcsim.simulationmanager.actions.ResetSimulationAction;
57import tmcsim.simulationmanager.actions.StartSimulationAction;
58import tmcsim.simulationmanager.actions.TriggerIncidentAction;
59import tmcsim.simulationmanager.model.AppliedDiversionTableModel;
60import tmcsim.simulationmanager.model.IncidentListTableModel;
61import tmcsim.simulationmanager.model.IncidentTimeCellRenderer;
62import tmcsim.simulationmanager.model.IncidentTimeSpinnerModel;
63import tmcsim.simulationmanager.model.AppliedDiversionTableModel.APPLIED_DIV_COLUMNS;
64import tmcsim.simulationmanager.model.IncidentListTableModel.INCIDENT_LIST_COLUMNS;
65
66/**
67 * This class is the view component to the SimlationManager.  User
68 * interaction with the SimulationManager is handled in this object. 
69 * The data contained within the SimlationManagerModel class is
70 * displayed in the JTables contained in this class.  The view class
71 * does not validate the user input.  Exception handling
72 * takes care of error in the user input.
73 *
74 * @author Matthew Cechini
75 * @version $Revision: 1.6 $ $Date: 2006/06/06 22:52:56 $
76 */
77@SuppressWarnings("serial")
78public class SimulationManagerView extends JFrame { 
79
80    /** Default Paramics network ID */
81    private static int DEFAULT_NETWORK_ID = 1;
82
83    /** Maximum Paramics network ID (100) */
84    private static int MAX_NETWORK_ID    = 100;
85
86    /** Default directory for script loading. */
87    public static String SCRIPT_DIR      = ".";
88
89    /** Reference to the simulation manager model. */
90    private SimulationManagerModel theSimManagerModel;
91       
92    /** The Table Model for the incident list table. */
93    private IncidentListTableModel incidentListTableModel;
94   
95    /** The Table Model for the applied diversions table. */   
96    private AppliedDiversionTableModel appliedDiversionTableModel;
97   
98    /**
99     * A map of DefaultTableModel objects associated with each incident
100     * in the simulation.  Key values are the log numberes of incidents. 
101     */
102    //private TreeMap<Integer, IncidentHistoryTableModel> incidentTableMap = null;
103    private TreeMap<Integer, IncidentHistoryPanel> incidentTableMap = null;
104   
105    /** The current simulation time. */
106    private long currentSimulationTime = 0;
107   
108    /**
109     * Flag to designate whether the simulation has started. Initialized to false.
110     * Becomes true when the user presses the start button.  Becomes false again
111     * when the simulation is "reset" or another script is loaded.
112     */
113    private boolean simulationStarted = false;
114   
115    /**
116     * Flag to designate whether a connection has been made to the remote
117     * Paramics Communicator.
118     */
119    private boolean connectedToParamics = false;
120   
121   
122    /**
123     * Constructor. This class sets the local reference to the simulation manager
124     * model to the parameter object.  It then initializes all of the swing
125     * components that are used in this user interface.
126     *
127     * @param newModel The reference to the SimulationManagerModel object
128     */
129    public SimulationManagerView(SimulationManagerModel newModel) {
130        super("Simulation Manager");
131       
132        theSimManagerModel   = newModel;   
133       
134        incidentTableMap = new TreeMap<Integer, IncidentHistoryPanel>();
135       
136        initComponents();
137
138    }
139 
140    /**
141     * Method gets the model object for the SimulationManagerView class.
142     * @return SimulationManagerModel object.
143     */
144    public SimulationManagerModel getModel() {
145        return theSimManagerModel;
146    }
147   
148    /**
149     * Method returns the boolean value designating whether a current
150     * connection has been made to the Paramics Communicator.
151     *
152     * @return True if connected, false if not.
153     */
154    public Boolean isConnectedToParamics() {
155        return connectedToParamics;
156    }
157   
158    /**
159     * Method returns the boolean value designating whether the
160     * simulation has started or not.
161     *
162     * @return True if started, false if not.
163     */
164    public Boolean isSimulationStarted() {
165        return simulationStarted;
166    }
167   
168    /**
169     * Method returns the value of the current simulation time.
170     *
171     * @return Current simulation time (in seconds).
172     */
173    public Long getCurrentSimTime() {
174        return currentSimulationTime;
175    }
176   
177    /**
178     * Creates a local JTable for the event history portion of the user interface
179     * with the table model passed in as a parameter.  The table has three columns.
180     * Addition and subtraction to this table are handled in the model clas.
181     *
182     * @param logNumber Log number for this incident.
183     */ 
184    public void addIncidentTab(final Integer logNumber) {
185        // Place this code on EDT to fix defect #154
186        SwingUtilities.invokeLater(new Runnable(){public void run(){
187            IncidentHistoryPanel newHistoryPanel = new IncidentHistoryPanel();
188
189            incidentTableMap.put(logNumber, newHistoryPanel);
190
191            eventHistoryPane.addTab(String.valueOf(logNumber), newHistoryPanel);
192        }});
193    }
194   
195    /**
196     * Remove the incident tab whose log number matches the parameter.
197     *
198     * @param logNumber Incident log number.
199     */
200    public void removeIncidentTab(Integer logNumber) {
201        for(int i = 0; i < eventHistoryPane.getTabCount(); i++) {
202            if(eventHistoryPane.getTitleAt(i).compareTo(String.valueOf(logNumber)) == 0) {
203                eventHistoryPane.remove(i);
204                break; 
205            }
206        }
207    }
208   
209    /**
210     * Remove all incident tabs from the event history pane.
211     */
212    public void resetIncidentTabs() {
213        eventHistoryPane.removeAll();
214    }
215   
216    /**
217     * Method is called to add a new incident to the IncidentManagement
218     * panel.  The incident object is added to the IncidentListTableModel.
219     *
220     * @param newIncident The incident object being added to the simulation.
221     */ 
222    public void addIncident(Incident newIncident) {
223        incidentListTableModel.addIncident(newIncident);
224    }   
225   
226    /**
227     * Method starts an incident found in the IncidentListTableModel.
228     * @param logNumber Incident log number.
229     */
230    public void startIncident(Integer logNumber) {
231        incidentListTableModel.startIncident(logNumber);       
232    }   
233   
234    /**
235     * Method removes an incident by removing it from the
236     * IncidentListTableModel.  If there are no more incidents
237     * in the simulation, reset the start, pause, and reset buttons
238     * to be disabled, and enable the load script button.
239     *
240     * @param logNumber Incident log number.
241     */
242    public void removeIncident(Integer logNumber) {
243        incidentListTableModel.removeIncident(logNumber);       
244       
245        //TODO check if simulation started??   
246        if(incidentListTableModel.getRowCount() == 0 && !simulationStarted) 
247        {
248            startButton.setEnabled(false);
249            pauseButton.setEnabled(false);
250            resetButton.setEnabled(false); 
251           
252            loadScriptButton.setEnabled(true);
253        }       
254    }
255   
256    /**
257     * Method resets the current list of Incidents by clearing the
258     * IncidentListTableModel.
259     */ 
260    public void resetIncidents() {
261        incidentListTableModel.clearModelData();
262    }
263   
264    /**
265     * Method adds a new Incident event to the IncidentHistoryTableModel
266     * that corresponds to the Incident log number.  If the IncidentEvent
267     * has been received from a terminal, the tab containing the
268     * incident's table will be colored red to notify the user.
269     *
270     * @param logNumber Incident log number.
271     * @param newEvent Incident event to add.
272     */
273    public void addIncidentEvent(Integer logNumber, IncidentEvent newEvent) {
274        //IncidentHistoryTableModel historyTableModel = incidentTableMap.get(logNumber);
275        IncidentHistoryPanel historyPanel = incidentTableMap.get(logNumber);
276       
277        //historyTableModel.addEvent(logNumber, newEvent);
278        historyPanel.updateIncidentHistory(newEvent);
279    }
280   
281    /**
282     * Method is called to add a new diversion to the Diversions panel. 
283     * The CMSInfo and CMSDiversion objects are added to the
284     * AppliedDiversionTableModel, which creates its needed view data.
285     *
286     * @param theCMSInfo The CMSInfo that the new diversion corresponds to.
287     * @param theDiversion A new diversion to be applied.
288     */
289    public void addDiversion(CMSInfo theCMSInfo, CMSDiversion theDiversion) {       
290        appliedDiversionTableModel.addDiversion(theCMSInfo, theDiversion);
291    }       
292
293    /**
294     * Method is called to remove an existing diversion from the Diversions panel. 
295     * The diversion information is removed from the AppliedDiversionTableModel,
296     * which removes the corresponding row.
297     *
298     * @param theCMSInfo The CMSInfo that the new diversion corresponds to.
299     * @param theDiversion A new diversion to be applied.
300     */
301    public void removeDiversion(CMSInfo theCMSInfo, CMSDiversion theDiversion) {
302        appliedDiversionTableModel.removeDiversion(theCMSInfo, theDiversion);
303
304    }
305   
306    /**
307     * Method resets the list of diversions by clearing the
308     * AppliedDiversionTableModel.
309     */
310    public void resetDiversions() {
311        appliedDiversionTableModel.clearModelData();
312    }
313   
314    /**
315     * Build the CMS ID combo box with the list of parameter ids.
316     *
317     * @param cmsIDArray Array of cms IDs
318     */
319    public void setCMS_IDList(Object[] cmsIDArray) {
320        for(int i = 0; i < cmsIDArray.length; i++) {
321            cmsIDComboBox.addItem(cmsIDArray[i]);   
322        }
323    }
324   
325    /**
326     * Method is called by the model everytime a second has passed during the simulation.
327     * The time in the parameter is shown in the simulationClockLabel.  The parameter
328     * is formatted HH:MM:SS.
329     *
330     * @param time The new time.
331     */
332    public void tick(long time) {
333        currentSimulationTime = time;
334       
335        String newTime = TimeUtils.longToTime(currentSimulationTime);
336       
337        simulationClockLabel.setText(newTime);
338        CADClientClockLabel.setText(newTime);
339    }
340   
341    /**
342     * Method updates the simulation control and 'load script' buttons' enabled status
343     * and the status text according to the parameter SCRIPT_STATUS.
344     * The following table describes each status and the actions taken. <br>
345     *
346     *<table cellpadding="2" cellspacing="2" border="1"
347     * style="text-align: left; width: 250px;">
348     *  <tbody>
349     *    <tr>
350     *      <th>Status<br></th>
351     *      <th>Actions Taken<br></th>
352     *    </tr>
353     *    <tr>
354     *      <td>NO_SCRIPT<br></td>
355     *      <td>Set the simulation status text to a black "No Script".  Then
356     *          disable all simulation buttons.  Enable the 'Load Script' button.<br></td>
357     *    </tr>
358     *    <tr>
359     *      <td>SCRIPT_STOPPED_NOT_STARTED<br></td>
360     *      <td>Set the simulation status text to a red "Not Started".  Then
361     *          enable the 'Start' and 'Reset' buttons, and disable the 'Pause'
362     *          button. Enable the 'Load Script' button.<br></td>
363     *    </tr>
364     *    <tr>
365     *      <td>SCRIPT_STOPPED_STARTED<br></td>
366     *      <td>Set the simulation status text to a red "Paused".  Then
367     *          enable the 'Start' and 'Reset' buttons, and disable the 'Pause'
368     *          button. Enable the 'Load Script' button. Set the simulationStarted
369     *          flag to true.<br></td>
370     *    </tr>
371     *    <tr>
372     *      <td>SCRIPT_RUNNING<br></td>
373     *      <td>Set the simulation status text to a green "Running".  Then
374     *          disable the 'Start' and 'Reset' buttons, and enable the 'Pause'
375     *          button. Disable the 'Load Script' button.  Set the simulationStarted
376     *          flag to true.<br></td>
377     *    </tr>
378     *    <tr>
379     *      <td>ATMS_SYNCHRONIZATION<br></td>
380     *      <td>Set the simulation status text to an orange "Synchronizing".  Then
381     *          disable all simulation buttons and the 'Load Script' button.<br></td>
382     *    </tr>
383     *  </tbody>
384     *</table>
385     *
386     * @param status Script status value.
387     */
388    public void setScriptStatus(SCRIPT_STATUS status) {
389       
390        switch(status) {
391            case NO_SCRIPT:
392                simulationStatusText.setText("No Script");
393                simulationStatusText.setForeground(Color.BLACK);
394                   
395                startButton.setEnabled(false);
396                pauseButton.setEnabled(false);
397                resetButton.setEnabled(false);                                             
398                break;         
399               
400            case SCRIPT_STOPPED_NOT_STARTED:
401               
402                simulationStatusText.setText("Ready");
403                simulationStatusText.setForeground(Color.RED);
404                   
405                startButton.setEnabled(true);
406                pauseButton.setEnabled(false);
407                resetButton.setEnabled(true);       
408               
409                loadScriptButton.setEnabled(true);
410               
411                //simulationClockLabel.setText("0:00:00");
412                //CADClientClockLabel.setText("0:00:00");               
413                break;         
414               
415            case SCRIPT_PAUSED_STARTED:
416                simulationStatusText.setText("Paused");
417                simulationStatusText.setForeground(Color.RED);
418                   
419                startButton.setEnabled(true);
420                pauseButton.setEnabled(false);
421                resetButton.setEnabled(true);               
422                simulationStarted = true;
423
424                loadScriptButton.setEnabled(true);
425                break;
426               
427            case SCRIPT_RUNNING:
428                simulationStatusText.setText("Running");
429                simulationStatusText.setForeground(Color.GREEN.darker());
430               
431                startButton.setEnabled(false);
432                pauseButton.setEnabled(true);
433                resetButton.setEnabled(false); 
434                simulationStarted = true;
435
436                loadScriptButton.setEnabled(false);
437                break;
438            case ATMS_SYNCHRONIZATION:
439                simulationStatusText.setText("Synchronizing");
440                simulationStatusText.setForeground(Color.ORANGE);
441               
442                startButton.setEnabled(false);
443                pauseButton.setEnabled(false);
444                resetButton.setEnabled(false); 
445                simulationStarted = false;
446
447                loadScriptButton.setEnabled(false);
448                break;
449        }       
450    }
451   
452
453    /**
454     * Method updates the paramics control buttons' enabled status
455     * and the paramics status text according to the parameter PARAMICS_STATUS.
456     * The following table describes each status and the actions taken. <br>
457     *
458     *<table cellpadding="2" cellspacing="2" border="1"
459     * style="text-align: left; width: 250px;">
460     *  <tbody>
461     *    <tr>
462     *      <th>Status<br></th>
463     *      <th>Actions Taken<br></th>
464     *    </tr>
465     *    <tr>
466     *      <td>UNREACHABLE<br></td>
467     *      <td>Show a message dialog to the user notifying them that a
468     *          connection to Paramics could not be made.  Reset the
469     *          connect button to be labled 'Connect to Paramics' and
470     *          set the status text to 'Unreachable'.  Enable the connect
471     *          button and disable the network load button.  Set the connected
472     *          to paramics flag to false.<br></td>
473     *    </tr>
474     *    <tr>
475     *      <td>DROPPED<br></td>
476     *      <td>Show a message dialog to the user notifying them that the
477     *          connection to Paramics has been dropped.  Reset the
478     *          connect button to be labled 'Connect to Paramics' and
479     *          set the status text to 'Dropped'.  <br></td>
480     *    </tr>
481     *    <tr>
482     *      <td>CONNECTING<br></td>
483     *      <td>Set the status text to 'Connecting'.  Disable the connect
484     *          button and network load button.  <br></td>         
485     *    </tr>
486     *    <tr>
487     *      <td>CONNECTED<br></td>
488     *      <td>Set the connect button to be labled 'Disconnect from Paramics'
489     *          and set the status text to 'Connected'.  Enable the disconnect
490     *          button and network load button.  Set the connected to paramics flag
491     *          to true.<br></td>
492     *    </tr>
493     *    <tr>
494     *      <td>DISCONNECTED<br></td>
495     *      <td>Set the connect button to be labled 'Connect to Paramics'
496     *          and set the status text to 'Disconnected'.  Enable the connect
497     *          button and disable the network load button.  Set the connected
498     *          to paramics flag to false.<br></td>
499     *    </tr>
500     *    <tr>
501     *      <td>SENDING_NETWORK_ID<br></td>
502     *      <td>Set the status text to 'Sending Network ID'.  Disable the
503     *          network load button.<br></td>     
504     *    </tr>
505     *    <tr>
506     *      <td>WARMING<br></td>
507     *      <td>Set the status text to 'Warming'.<br></td>
508     *    </tr>
509     *    <tr>
510     *      <td>LOADING<br></td>
511     *      <td>Set the status text to 'Loading'.<br></td>
512     *    </tr>
513     *    <tr>
514     *      <td>LOADED<br></td>
515     *      <td>Get the paramics network that has been been loaded from
516     *          the model.   Set the status text to 'Network # Loaded'.
517     *          Enable the connect button and disable the network
518     *          load button<br></td>
519     *    </tr>
520     *  </tbody>
521     *</table>
522     *
523     * @param status Paramics status value.
524     */
525    public void setParamicsStatus(PARAMICS_STATUS status) {
526       
527        switch(status) {
528       
529            case UNREACHABLE:           
530                JOptionPane.showMessageDialog(this, 
531                "Unable to connect to Paramics.", 
532                "Communication Error", JOptionPane.ERROR_MESSAGE);
533       
534                connectToParamicsButton.setText("Connect to Paramics");
535                paramicsStatusInfoLabel.setText("Unreachable");
536
537                connectToParamicsButton.setEnabled(true);
538                loadParamicsNetworkButton.setEnabled(false);
539                //networkIDSpinner.setEnabled(false);       
540                connectedToParamics = false;
541               
542            break;
543            case DROPPED:
544           
545                JOptionPane.showMessageDialog(this, 
546                "      Connection to Paramics has been dropped.\n" +
547                "Restart the Paramics Communicator and reconnect.", 
548                "Communication Error", JOptionPane.ERROR_MESSAGE);
549       
550                connectToParamicsButton.setText("Connect to Paramics");
551                paramicsStatusInfoLabel.setText("Dropped");
552               
553                loadParamicsNetworkButton.setEnabled(false);
554                //networkIDSpinner.setEnabled(false);       
555                connectedToParamics = false;
556            break;         
557            case CONNECTING:
558                paramicsStatusInfoLabel.setText("Connecting");
559               
560                connectToParamicsButton.setEnabled(false);
561                loadParamicsNetworkButton.setEnabled(false);
562                //networkIDSpinner.setEnabled(true);   
563            break;
564            case CONNECTED:
565                connectToParamicsButton.setText("Disconnect from Paramics");               
566                paramicsStatusInfoLabel.setText("Connected");
567               
568                connectToParamicsButton.setEnabled(true);
569                loadParamicsNetworkButton.setEnabled(true);
570                //networkIDSpinner.setEnabled(true);   
571                connectedToParamics = true;         
572                break;         
573               
574            case DISCONNECTED:
575                connectToParamicsButton.setText("Connect to Paramics");                             
576                paramicsStatusInfoLabel.setText("Disconnected");
577
578                connectToParamicsButton.setEnabled(true);
579                loadParamicsNetworkButton.setEnabled(false);
580                //networkIDSpinner.setEnabled(false);       
581                connectedToParamics = false;
582                       
583                break; 
584            case SENDING_NETWORK_ID:
585                paramicsStatusInfoLabel.setText("Sending Network ID");
586               
587                loadParamicsNetworkButton.setEnabled(false);
588            break;     
589            case WARMING:
590                paramicsStatusInfoLabel.setText("Warming Up");
591            break;
592            case LOADING:
593                paramicsStatusInfoLabel.setText("Loading Network");
594            break;     
595            case LOADED:           
596                String network = "";
597                try {                   
598                    int networkLoaded = theSimManagerModel.getParamicsNetworkLoaded();
599                   
600                    if(networkLoaded != -1)
601                        network = String.valueOf(networkLoaded);
602                }
603                catch (SimulationException se) {
604                    SimulationExceptionHandler(se);
605                }
606               
607                paramicsStatusInfoLabel.setText("Network " + network + " Loaded");
608
609                connectToParamicsButton.setEnabled(true);
610                loadParamicsNetworkButton.setEnabled(false);
611               
612            break;
613        }   
614    }
615
616    /**
617     * Method is used to convert a String containing a time in format H:MM:SS to a long
618     * value of the number of seconds represented.
619     *
620     * @param time String containing a time in format H:MM:SS
621     * @throws StringIndexOutOfBoundsException if parameter is not in format H:MM:SS
622     * @return long Number of seconds in parameter time 
623     */
624    public static long stringTimeToLong(String time) throws StringIndexOutOfBoundsException{
625        long seconds = 0;   
626       
627        seconds =  ((long) Character.digit(time.charAt(0), 10) * 3600 +
628                        Character.digit(time.charAt(2), 10) * 600 + 
629                        Character.digit(time.charAt(3), 10) * 60 + 
630                        Character.digit(time.charAt(5), 10) * 10 +
631                        Character.digit(time.charAt(6), 10));
632
633             
634        return seconds;
635    }
636   
637    /**
638     * This method is used to disply a message dialog with the received
639     * ScriptException's information.  The possible exceptions are found in the
640     * ScriptException class information.
641     *
642     * @param se The ScriptException to display
643     * @see ScriptException
644     */
645    public void ScriptExceptionHandler(ScriptException se) {
646        JOptionPane.showMessageDialog(this, se.getMessage(), "Script Error", JOptionPane.ERROR_MESSAGE);   
647    }
648
649/**
650     * This method is used to disply a message dialog with the received
651     * SimulationException's information.  The possible exceptions are found in the
652     * SimulationException class information.
653     *
654     * @param se The SimulationException to display
655     * @see SimulationException
656     */
657    public void SimulationExceptionHandler(SimulationException se) {
658        JOptionPane.showMessageDialog(this, se.getMessage(), "Simulation Error", JOptionPane.ERROR_MESSAGE);   
659    }
660   
661
662     
663    /**
664     * Initilize the GUI swing components.
665     */ 
666    private void initComponents() {
667
668        createMenuBar();
669        createTimeAndStatus();
670        createSimulationControl();
671        createParamicsControl();
672        createIncidentManagement();
673        createCMSTrafficDiversion();
674        createAdmin();
675        createEventHistory();   
676
677        addSimulationTab();     
678
679        setMinimumSize(new Dimension(1024, 768));
680        setMaximumSize(new Dimension(1600, 1200));
681        setPreferredSize(new Dimension(1024, 768)); 
682       
683        pack();
684    }
685   
686    /**
687     * Create the menu bar components.
688     */
689    private void createMenuBar() {
690
691        gotoMenuItem = new JMenuItem(new GotoTimeIndexAction(this));   
692        exportMenuItem = new JMenuItem(new ExportAction(this));
693        exitMenuItem = new JMenuItem(new ExitAction(this));
694       
695        fileMenu = new JMenu("File");
696        fileMenu.add(gotoMenuItem);
697        fileMenu.add(exportMenuItem);
698        fileMenu.add(exitMenuItem);
699       
700        simManagerMenuBar = new JMenuBar();
701        simManagerMenuBar.add(fileMenu);
702       
703        javax.swing.JMenu helpMenu = new javax.swing.JMenu("Help");
704        javax.swing.JMenuItem aboutItem = new javax.swing.JMenuItem("About");
705
706        aboutItem.addActionListener(new java.awt.event.ActionListener(){
707            public void actionPerformed(java.awt.event.ActionEvent evt)
708            {
709                String ver = RevisionNumber.getAppVersion();
710                JOptionPane.showMessageDialog(rootPane, "Version: " + ver, "About", JOptionPane.INFORMATION_MESSAGE);
711            }
712        });
713       
714        helpMenu.add(aboutItem);
715        simManagerMenuBar.add(helpMenu);
716       
717        setJMenuBar(simManagerMenuBar);
718    }
719   
720    /**
721     * Create the time and status boxes, buttons, and listeners.
722     */
723    private void createTimeAndStatus() {
724       
725        simulationTime       = new JPanel();
726        simulationClock      = new JPanel();
727        simulationStatus     = new JLabel("Simulation Status");
728        simulationStatusText = new JLabel("No Script");
729        simulationStatusText.setName("simulationStatusText");
730        simulationStatusText.setFont(new Font("Geneva", Font.BOLD, 14));
731       
732        simulationTime.setLayout(new BorderLayout());       
733        simulationClock.setPreferredSize(new Dimension(100, 60));
734       
735        startButton = new JButton(new StartSimulationAction(this));
736       
737        pauseButton  = new JButton(new PauseSimulationAction(this));
738        resetButton = new JButton(new ResetSimulationAction(this));
739        loadScriptButton = new JButton(new LoadScriptAction(this));
740        loadScriptButton.setAlignmentX(Box.CENTER_ALIGNMENT);
741       
742        startButton.setEnabled(false);
743        pauseButton.setEnabled(false);
744        resetButton.setEnabled(false);
745
746        simulationStatusBox     = new Box(BoxLayout.Y_AXIS);       
747        simulationTimeBox       = new Box(BoxLayout.Y_AXIS);
748        simulationClockBox      = new Box(BoxLayout.X_AXIS);
749        simulationTimeButtonBox = new Box(BoxLayout.X_AXIS);
750       
751        simulationTimeButtonBox.add(loadScriptButton);
752        simulationTimeButtonBox.add(startButton);
753        simulationTimeButtonBox.add(pauseButton);
754        simulationTimeButtonBox.add(resetButton);
755//        currentScript = new JLabel(" no script loaded");
756        //currentScript.setAlignmentX(Box.LEFT_ALIGNMENT);
757//        simulationTimeButtonBox.add (currentScript);
758       
759        simulationStatus.setAlignmentX(Box.CENTER_ALIGNMENT);
760        simulationStatusText.setAlignmentX(Box.CENTER_ALIGNMENT);
761       
762        TitledBorder title = BorderFactory.createTitledBorder(
763                BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Status");
764        title.setTitleJustification(TitledBorder.LEFT);
765        simulationStatusBox.setBorder(title);
766       
767        simulationStatusBox.setMaximumSize(new Dimension(140, 60));
768        simulationStatusBox.setAlignmentX(Box.CENTER_ALIGNMENT);                   
769       
770        simulationStatusBox.add(Box.createVerticalGlue());
771        simulationStatusBox.add(simulationStatusText);
772        simulationStatusBox.add(Box.createVerticalGlue());
773       
774        scriptBox = new Box(BoxLayout.Y_AXIS);
775        scriptBox.setAlignmentX(Box.CENTER_ALIGNMENT);
776       
777        scriptBox.add(simulationStatusBox);
778        scriptBox.add(Box.createVerticalStrut(5));
779       
780        simulationClockLabel = new JLabel("0:00:00");
781        simulationClockLabel.setFont(new Font("Geneva", Font.BOLD, 70));
782        simulationClockLabel.setForeground(Color.BLACK);
783        simulationClockLabel.setBackground(Color.BLACK);
784        simulationClockBox.setForeground(Color.BLACK);
785        simulationClockBox.setBackground(Color.BLACK);
786        simulationClockBox.add(simulationClockLabel);
787        simulationClockBox.setAlignmentX(Box.CENTER_ALIGNMENT); 
788        simulationTimeButtonBox.setAlignmentX(Box.CENTER_ALIGNMENT);
789        simulationTimeBox.add(simulationClockBox);
790        simulationTimeBox.add(simulationTimeButtonBox);
791
792        simulationTimeAndStatusBox = Box.createHorizontalBox();
793        simulationTimeAndStatusBox.setAlignmentX(Box.LEFT_ALIGNMENT);
794        simulationTimeAndStatusBox.setMaximumSize(new Dimension(640, 300));
795        simulationTimeAndStatusBox.setPreferredSize(new Dimension(640, 1600));
796        simulationTimeAndStatusBox.add(Box.createHorizontalStrut(5));
797        simulationTimeAndStatusBox.add(simulationTimeBox);
798        simulationTimeAndStatusBox.add(Box.createHorizontalStrut(20));
799        simulationTimeAndStatusBox.add(scriptBox);
800        simulationTimeAndStatusBox.add(Box.createHorizontalStrut(5));
801       
802        //*** Clock for CAD Tab ***//
803        CADClientClockLabel = new JLabel("0:00:00");
804        CADClientClockLabel.setFont(new Font("Geneva", Font.BOLD, 60));
805        CADClientClockLabel.setForeground(Color.BLACK);
806        CADClientClockLabel.setBackground(Color.BLACK);
807        CADClientClockLabel.setAlignmentX(Box.CENTER_ALIGNMENT);       
808       
809    }
810   
811   
812    /**
813     * Create Simulation Control Box
814     */
815    private void createSimulationControl() {
816       
817        simulationControlBox = new Box(BoxLayout.Y_AXIS);
818        simulationControlBox.add(simulationTimeAndStatusBox);
819               
820        CompoundBorder cBorder = BorderFactory.createCompoundBorder(
821            BorderFactory.createTitledBorder(
822                BorderFactory.createRaisedBevelBorder(), "Simulation Control"),
823                BorderFactory.createEmptyBorder(5,5,5,5));
824
825       
826        simulationControlBox.setBorder(cBorder);   
827    }
828   
829    /**
830     * Create ParamicsControl Box
831     */
832    private void createParamicsControl() {
833       
834        paramicsControlBox = new Box(BoxLayout.Y_AXIS);
835        paramicsControlBox.setAlignmentX(Box.LEFT_ALIGNMENT);
836        paramicsControlBox.setMaximumSize(new Dimension(650, 150));     
837        paramicsControlBox.setMinimumSize(new Dimension(250, 95)); 
838        paramicsControlBox.setPreferredSize(new Dimension(380, 95));
839       
840        paramicsStatusBox       = new Box(BoxLayout.X_AXIS);       
841        paramicsStatusLabel     = new JLabel("Status:");
842        paramicsStatusInfoLabel = new JLabel("Unknown");
843        paramicsStatusInfoLabel.setName("paramicsStatusInfoLabel");
844        paramicsStatusBox.add(paramicsStatusLabel);
845        paramicsStatusBox.add(Box.createHorizontalStrut(10));
846        paramicsStatusBox.add(paramicsStatusInfoLabel);
847        paramicsStatusBox.add(Box.createHorizontalGlue());
848       
849        networkIDSpinner = new JSpinner(
850            new SpinnerNumberModel(DEFAULT_NETWORK_ID, 1, MAX_NETWORK_ID, 1));
851        networkIDSpinner.setEnabled(false);     
852        networkIDSpinner.setMaximumSize(new Dimension(60, 30));
853       
854        connectToParamicsButton = new JButton(new ConnectToParamicsAction(this));
855
856        loadParamicsNetworkButton = new JButton(new LoadParamicsNetworkAction(this));
857        loadParamicsNetworkButton.setEnabled(false);
858        loadParamicsNetworkButton.getAction().putValue(
859                LoadParamicsNetworkAction.NETWORK_ID_SPINNER, networkIDSpinner);
860       
861
862        paramicsButtonBox = new Box(BoxLayout.X_AXIS);
863        paramicsButtonBox.add(Box.createHorizontalGlue());
864        paramicsButtonBox.add(connectToParamicsButton);
865        paramicsButtonBox.add(Box.createHorizontalGlue());
866        paramicsButtonBox.add(loadParamicsNetworkButton);
867        paramicsButtonBox.add(Box.createHorizontalStrut(10));
868        paramicsButtonBox.add(networkIDSpinner);
869        paramicsButtonBox.add(Box.createHorizontalGlue());
870
871        paramicsControlBox.add(Box.createVerticalStrut(5));
872        paramicsControlBox.add(paramicsStatusBox);
873        paramicsControlBox.add(Box.createVerticalStrut(5));
874        paramicsControlBox.add(paramicsButtonBox); 
875        paramicsControlBox.add(Box.createVerticalStrut(5));
876               
877        CompoundBorder cBorder = BorderFactory.createCompoundBorder(
878            BorderFactory.createTitledBorder(
879                BorderFactory.createRaisedBevelBorder(), "Paramics Control"),
880                BorderFactory.createEmptyBorder(5,5,5,5));
881
882       
883        paramicsControlBox.setBorder(cBorder);     
884   
885    }   
886   
887    /**
888     * Create the Incident Management portion of the Simulation
889     * Management Box
890     */       
891    private void createIncidentManagement() {
892   
893        createIncidentListTable();
894       
895        incidentTimeModel = new IncidentTimeSpinnerModel();
896        reschedSpinner = new JSpinner(incidentTimeModel);       
897        reschedSpinner.setEnabled(false);
898        reschedSpinner.setMaximumSize(new Dimension(70,20));
899               
900       
901        triggerButton     = new JButton(new TriggerIncidentAction(this));
902        triggerButton.getAction().putValue(
903                TriggerIncidentAction.INCIDENT_LIST_TABLE, incidentListTable);
904       
905        deleteIncButton   = new JButton(new DeleteIncidentAction(this));
906        deleteIncButton.getAction().putValue(
907                DeleteIncidentAction.INCIDENT_LIST_TABLE, incidentListTable);
908   
909        reschedButton     = new JButton(new RescheduleIncidentAction(this));
910        reschedButton.getAction().putValue(
911                RescheduleIncidentAction.INCIDENT_LIST_TABLE, incidentListTable);
912        reschedButton.getAction().putValue(
913                RescheduleIncidentAction.INCIDENT_TIME_MODEL, incidentTimeModel);
914       
915        addIncidentButton = new JButton(new AddIncidentAction(this));
916       
917        timeScheduledLabel  = new JLabel("Time Scheduled: ");   
918                   
919        triggerButton.setEnabled(false);
920        deleteIncButton.setEnabled(false);
921        reschedButton.setEnabled(false);
922
923        Box temp = new Box(BoxLayout.X_AXIS);
924        temp.setAlignmentX(Box.CENTER_ALIGNMENT);       
925        temp.add(timeScheduledLabel);
926        temp.add(Box.createHorizontalStrut(10));
927        temp.add(reschedSpinner);
928        temp.add(Box.createHorizontalStrut(20));
929        temp.add(reschedButton);       
930
931        incidentManagementReSchedBox = new Box(BoxLayout.Y_AXIS);
932        incidentManagementReSchedBox.setAlignmentX(Box.CENTER_ALIGNMENT);       
933        incidentManagementReSchedBox.add(temp);     
934               
935        Box temp2 = new Box(BoxLayout.X_AXIS);
936        temp2.setAlignmentX(Box.CENTER_ALIGNMENT);
937        temp2.add(triggerButton);
938        temp2.add(Box.createHorizontalStrut(20));
939        temp2.add(deleteIncButton);
940        temp2.add(Box.createHorizontalStrut(20));
941        temp2.add(addIncidentButton);                   
942
943        incidentManagementButtonsBox = new Box(BoxLayout.Y_AXIS);
944        incidentManagementButtonsBox.setAlignmentY(Box.CENTER_ALIGNMENT);
945        incidentManagementButtonsBox.add(temp2);
946       
947        incidentManagementActionBox = new Box(BoxLayout.Y_AXIS);
948        incidentManagementActionBox.setMaximumSize(new Dimension(500, 100));
949        incidentManagementActionBox.setAlignmentX(Box.LEFT_ALIGNMENT);
950        incidentManagementActionBox.add(incidentManagementReSchedBox);     
951        incidentManagementActionBox.add(Box.createVerticalStrut(10));       
952        incidentManagementActionBox.add(incidentManagementButtonsBox);     
953
954        incidentManagementBox = new Box(BoxLayout.Y_AXIS);
955        incidentManagementBox.setAlignmentX(Box.LEFT_ALIGNMENT);
956        incidentManagementBox.setMaximumSize(new Dimension(650, 500));     
957        incidentManagementBox.setMinimumSize(new Dimension(250, 240)); 
958        incidentManagementBox.setPreferredSize(new Dimension(380, 240));
959        incidentManagementBox.add(Box.createVerticalStrut(5));
960        incidentManagementBox.add(incidentListPane);       
961        incidentManagementBox.add(Box.createVerticalStrut(10));     
962        incidentManagementBox.add(incidentManagementActionBox);         
963        incidentManagementBox.add(Box.createVerticalStrut(5));
964       
965        CompoundBorder cBorder = BorderFactory.createCompoundBorder(
966            BorderFactory.createTitledBorder(
967                BorderFactory.createRaisedBevelBorder(), "Incident Management"),
968                BorderFactory.createEmptyBorder(5,5,5,5));
969
970       
971        incidentManagementBox.setBorder(cBorder);       
972   
973    }
974   
975    private void createIncidentListTable() {
976   
977        incidentListTableModel = new IncidentListTableModel();   
978        incidentListTableModel.addTableModelListener(new TableModelListener() {
979            public void tableChanged(TableModelEvent arg0) {
980
981                boolean incidentToTrigger = false;
982               
983                for(int i = 0; i < incidentListTableModel.getRowCount(); i++) {
984                   
985                    incidentToTrigger |= (((Long)incidentListTableModel.
986                            getValueAt(i, INCIDENT_LIST_COLUMNS.SCHEDULED_COL.colNum)) != -1); 
987                }                   
988
989                triggerButton.setEnabled(incidentToTrigger);
990                deleteIncButton.setEnabled(incidentToTrigger);
991                reschedButton.setEnabled(incidentToTrigger);
992                reschedSpinner.setEnabled(incidentToTrigger);           
993               
994            }
995        });
996           
997        incidentListTable = new JTable(incidentListTableModel);     
998        incidentListTable.getTableHeader().setReorderingAllowed(false); 
999        incidentListTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
1000        incidentListTable.setDragEnabled(false);     
1001               
1002        for(int c = 0; c < incidentListTable.getColumnCount(); c++) {
1003            incidentListTable.getColumnModel().getColumn(c).setMinWidth(
1004                    incidentListTableModel.getColumnMinWidth(c));
1005            incidentListTable.getColumnModel().getColumn(c).setMaxWidth(
1006                    incidentListTableModel.getColumnMaxWidth(c));
1007            incidentListTable.getColumnModel().getColumn(c).setPreferredWidth(
1008                    incidentListTableModel.getColumnPrefWidth(c));
1009            incidentListTable.getColumnModel().getColumn(c).setResizable(true);
1010           
1011            if(c == INCIDENT_LIST_COLUMNS.SCHEDULED_COL.colNum)
1012                incidentListTable.getColumnModel().getColumn(c).setCellRenderer(
1013                        new IncidentTimeCellRenderer());
1014               
1015        }
1016
1017        incidentListPane = new JScrollPane();
1018        incidentListPane.setAlignmentX(Box.LEFT_ALIGNMENT);
1019        incidentListPane.setMaximumSize(new Dimension(650, 400));       
1020        incidentListPane.setMinimumSize(new Dimension(200, 100));   
1021        incidentListPane.setPreferredSize(new Dimension(380, 100));
1022        incidentListPane.setViewportView(incidentListTable);
1023       
1024        incidentListTable.addMouseListener(new MouseListener() {
1025            public void mouseClicked(MouseEvent e) {}
1026            public void mouseEntered(MouseEvent e) {}           
1027            public void mouseExited(MouseEvent e) {}           
1028            public void mousePressed(MouseEvent e) {}           
1029            public void mouseReleased(MouseEvent e)  {
1030                long incTime = (Long)incidentListTable.getValueAt(incidentListTable.getSelectedRow(), 
1031                        INCIDENT_LIST_COLUMNS.SCHEDULED_COL.colNum);
1032                if(incTime != -1) {
1033                    incidentTimeModel.setValue(incTime);
1034                    triggerButton.setEnabled(true);
1035                    deleteIncButton.setEnabled(true);
1036                    reschedButton.setEnabled(true);
1037                    reschedSpinner.setEnabled(true);
1038                }
1039                else {
1040                    triggerButton.setEnabled(false);
1041                    deleteIncButton.setEnabled(false);
1042                    reschedButton.setEnabled(false);
1043                    reschedSpinner.setEnabled(false);       
1044                }
1045               
1046            }           
1047        });
1048    }
1049
1050    /**
1051     * Create the cms traffic diversion box.
1052     */   
1053    private void createCMSTrafficDiversion() {
1054   
1055        cmsTrafficDiversionBox = new Box(BoxLayout.Y_AXIS);
1056        cmsTrafficDiversionBox.setAlignmentX(Box.LEFT_ALIGNMENT);
1057        cmsTrafficDiversionBox.setMaximumSize(new Dimension(650, 350));     
1058        cmsTrafficDiversionBox.setMinimumSize(new Dimension(200, 145)); 
1059        cmsTrafficDiversionBox.setPreferredSize(new Dimension(380, 250));   
1060       
1061        CompoundBorder cBorder = BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(BorderFactory.createRaisedBevelBorder(), "CMS Diversion Management"),
1062                                                                    BorderFactory.createEmptyBorder(5,5,5,5));
1063
1064        cmsTrafficDiversionBox.setBorder(cBorder);                 
1065                       
1066        appliedDiversionTableModel = new AppliedDiversionTableModel();
1067        appliedDiversionTable = new JTable(appliedDiversionTableModel);
1068        appliedDiversionTable.getTableHeader().setReorderingAllowed(false);
1069        appliedDiversionTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
1070        appliedDiversionTable.setCellSelectionEnabled(false);
1071        appliedDiversionTable.setRowSelectionAllowed(true);
1072        appliedDiversionTable.addMouseListener(new MouseListener() {
1073            public void mouseClicked(MouseEvent evt)  {
1074                if(evt.getClickCount() >= 2) {
1075                    ((ApplyDiversionAction)divertButton.getAction()).showDiversionDialog(
1076                            (String)appliedDiversionTableModel.getValueAt(
1077                                    appliedDiversionTable.getSelectedRow(),
1078                                    APPLIED_DIV_COLUMNS.CMS_ID_COL.colNum));
1079                }
1080            };
1081            public void mouseEntered(MouseEvent arg0)  {};
1082            public void mouseExited(MouseEvent arg0)   {};
1083            public void mousePressed(MouseEvent arg0)  {};
1084            public void mouseReleased(MouseEvent arg0) {};         
1085        });
1086       
1087        for(int c = 0; c < appliedDiversionTable.getColumnCount(); c++) {
1088            appliedDiversionTable.getColumnModel().getColumn(c).setMinWidth(
1089                    appliedDiversionTableModel.getColumnMinWidth(c));
1090            appliedDiversionTable.getColumnModel().getColumn(c).setMaxWidth(
1091                    appliedDiversionTableModel.getColumnMaxWidth(c));
1092            appliedDiversionTable.getColumnModel().getColumn(c).setPreferredWidth(
1093                    appliedDiversionTableModel.getColumnPrefWidth(c));
1094            appliedDiversionTable.getColumnModel().getColumn(c).setResizable(false);
1095           
1096            if(c == APPLIED_DIV_COLUMNS.APPLIED_COL.colNum) {
1097                appliedDiversionTable.getColumnModel().getColumn(c).setCellRenderer(
1098                        new IncidentTimeCellRenderer());
1099            }       
1100        }       
1101
1102        appliedDiversionPane = new JScrollPane();
1103        appliedDiversionPane.setAlignmentX(Box.CENTER_ALIGNMENT);       
1104        appliedDiversionPane.setMaximumSize(new Dimension(650, 800));       
1105        appliedDiversionPane.setMinimumSize(new Dimension(200, 75));   
1106        appliedDiversionPane.setPreferredSize(new Dimension(380,100));             
1107        appliedDiversionPane.setViewportView(appliedDiversionTable);   
1108       
1109        cmsIDComboBox = new JComboBox();
1110        cmsIDComboBox.setMaximumSize(new Dimension(40, 25));
1111       
1112        divertButton = new JButton(new ApplyDiversionAction(this));
1113        divertButton.getAction().putValue(
1114                ApplyDiversionAction.CMS_ID_COMBO_BOX, cmsIDComboBox);
1115               
1116        appliedDiversionButtonBox = new Box(BoxLayout.X_AXIS);
1117        appliedDiversionButtonBox.setAlignmentX(Box.CENTER_ALIGNMENT);
1118        appliedDiversionButtonBox.setMaximumSize(new Dimension(1010, 40));
1119        appliedDiversionButtonBox.add(Box.createGlue());
1120        appliedDiversionButtonBox.add(new JLabel("CMS ID:  "));
1121        appliedDiversionButtonBox.add(cmsIDComboBox);
1122        appliedDiversionButtonBox.add(Box.createHorizontalStrut(15));
1123        appliedDiversionButtonBox.add(divertButton);   
1124        appliedDiversionButtonBox.add(Box.createGlue());
1125
1126        cmsTrafficDiversionBox.add(Box.createVerticalStrut(5));
1127        cmsTrafficDiversionBox.add(appliedDiversionPane);       
1128        cmsTrafficDiversionBox.add(Box.createVerticalStrut(5));
1129        cmsTrafficDiversionBox.add(appliedDiversionButtonBox);     
1130        cmsTrafficDiversionBox.add(Box.createVerticalStrut(5));             
1131   
1132    }
1133       
1134    /**
1135     * Create the main admin box.
1136     */           
1137    private void createAdmin() {       
1138       
1139        adminInteractionBox = new Box(BoxLayout.Y_AXIS);
1140        adminInteractionBox.setAlignmentX(Box.LEFT_ALIGNMENT); 
1141        adminInteractionBox.setMinimumSize(new Dimension(425, 740));   
1142        adminInteractionBox.setPreferredSize(new Dimension(425, 740)); 
1143        adminInteractionBox.setMaximumSize(new Dimension(625, 1975));       
1144       
1145        adminInteractionBox.add(Box.createVerticalStrut(10));       
1146        adminInteractionBox.add(simulationControlBox);
1147        adminInteractionBox.add(Box.createVerticalStrut(10));   
1148        adminInteractionBox.add(paramicsControlBox);
1149        adminInteractionBox.add(Box.createVerticalStrut(10));   
1150        adminInteractionBox.add(incidentManagementBox);
1151        adminInteractionBox.add(Box.createVerticalStrut(10));   
1152        adminInteractionBox.add(cmsTrafficDiversionBox);       
1153        adminInteractionBox.add(Box.createVerticalStrut(10));   
1154       
1155    }
1156
1157    /**
1158     * Create the event history box.
1159     */   
1160    private void createEventHistory() {
1161   
1162        eventHistoryPane = new JTabbedPane();
1163       
1164        eventHistoryBox = new Box(BoxLayout.Y_AXIS);
1165        eventHistoryBox.setAlignmentX(Box.CENTER_ALIGNMENT);
1166        eventHistoryBox.setMinimumSize(new Dimension(525, 700));   
1167        eventHistoryBox.setPreferredSize(new Dimension(525, 700));
1168        eventHistoryBox.setMaximumSize(new Dimension(925, 1975));   
1169       
1170        eventHistoryBox.add(eventHistoryPane);
1171        eventHistoryBox.add(Box.createVerticalStrut(10));   
1172       
1173        CompoundBorder cBorder = BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(BorderFactory.createRaisedBevelBorder(), "Event History"),
1174                                                                    BorderFactory.createEmptyBorder(5,5,5,5));
1175       
1176        eventHistoryBox.setBorder(cBorder);     
1177       
1178    }
1179   
1180
1181    /**
1182     * Create the administrator tab
1183     */           
1184    private void addSimulationTab() {
1185       
1186    simulationRightSideBox = new Box(BoxLayout.Y_AXIS);             
1187        simulationRightSideBox.add(Box.createVerticalStrut(10));
1188        simulationRightSideBox.add(eventHistoryBox);
1189        simulationRightSideBox.add(Box.createVerticalStrut(10));   
1190               
1191        simulationBox = new Box(BoxLayout.X_AXIS);     
1192        simulationBox.add(Box.createHorizontalStrut(20));
1193        simulationBox.add(adminInteractionBox);
1194        simulationBox.add(Box.createHorizontalStrut(20));   
1195        simulationBox.add(simulationRightSideBox);
1196        simulationBox.add(Box.createHorizontalStrut(20));
1197               
1198        getContentPane().add(simulationBox);
1199    }   
1200   
1201    private JTabbedPane eventHistoryPane;
1202   
1203    private JScrollPane incidentListPane; 
1204    private JScrollPane appliedDiversionPane;
1205
1206    private JTable incidentListTable;
1207    private JTable appliedDiversionTable;
1208   
1209    private JPanel simulationTime;
1210    private JPanel simulationClock;
1211           
1212    private JLabel paramicsStatusLabel;
1213    private JLabel paramicsStatusInfoLabel;
1214    private JLabel simulationStatus;
1215    private JLabel simulationClockLabel;
1216    private JLabel simulationStatusText;
1217    private JLabel timeScheduledLabel;
1218    private JLabel CADClientClockLabel;
1219    private JLabel currentScript;
1220    private Box adminInteractionBox;   
1221    private Box simulationRightSideBox;
1222    private Box simulationBox;         
1223    private Box appliedDiversionButtonBox; 
1224    private Box cmsTrafficDiversionBox;     
1225    private Box eventHistoryBox;   
1226    private Box incidentManagementActionBox;
1227    private Box incidentManagementBox; 
1228    private Box incidentManagementButtonsBox;
1229    private Box incidentManagementReSchedBox;
1230    private Box scriptBox;     
1231    private Box paramicsButtonBox;
1232    private Box paramicsControlBox; 
1233    private Box paramicsStatusBox;
1234    private Box simulationTimeAndStatusBox;
1235    private Box simulationStatusBox;       
1236    private Box simulationTimeBox;
1237    private Box simulationClockBox;
1238    private Box simulationControlBox;
1239    private Box simulationTimeButtonBox;
1240
1241    private IncidentTimeSpinnerModel incidentTimeModel;
1242    private JSpinner reschedSpinner;
1243    private JSpinner networkIDSpinner;
1244   
1245    private JButton addIncidentButton;         
1246    private JButton deleteIncButton;
1247    private JButton loadScriptButton;
1248    private JButton divertButton;
1249    private JButton reschedButton;
1250    private JButton resetButton;
1251    private JButton startButton;
1252    private JButton pauseButton;
1253    private JButton triggerButton; 
1254    private JButton connectToParamicsButton;
1255    private JButton loadParamicsNetworkButton;
1256   
1257    private JComboBox cmsIDComboBox;                   
1258       
1259    private JMenuBar simManagerMenuBar;
1260    private JMenu fileMenu;
1261    private JMenuItem gotoMenuItem;
1262    private JMenuItem exportMenuItem;
1263    private JMenuItem exitMenuItem;
1264   
1265}
1266
Note: See TracBrowser for help on using the repository browser.