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

Revision 2, 50.6 KB checked in by jdalbey, 10 years ago (diff)

Initial Import of project files

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