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

Revision 6, 50.8 KB checked in by jdalbey, 10 years ago (diff)

Multifile commit. Add version # to Paramics Communicator. Move Load button in Sim Mgr. Add several tests. Add package jars target.

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.setName("simulationStatusText");
740        simulationStatusText.setFont(new Font("Geneva", Font.BOLD, 14));
741       
742        simulationTime.setLayout(new BorderLayout());       
743        simulationClock.setPreferredSize(new Dimension(100, 60));
744       
745        startButton = new JButton(new StartSimulationAction(this));
746       
747        pauseButton  = new JButton(new PauseSimulationAction(this));
748        resetButton = new JButton(new ResetSimulationAction(this));
749        loadScriptButton = new JButton(new LoadScriptAction(this));
750        loadScriptButton.setAlignmentX(Box.CENTER_ALIGNMENT);
751       
752        startButton.setEnabled(false);
753        pauseButton.setEnabled(false);
754        resetButton.setEnabled(false);
755
756        simulationStatusBox     = new Box(BoxLayout.Y_AXIS);       
757        simulationTimeBox       = new Box(BoxLayout.Y_AXIS);
758        simulationClockBox      = new Box(BoxLayout.X_AXIS);
759        simulationTimeButtonBox = new Box(BoxLayout.X_AXIS);
760       
761        simulationTimeButtonBox.add(loadScriptButton);
762        simulationTimeButtonBox.add(startButton);
763        simulationTimeButtonBox.add(pauseButton);
764        simulationTimeButtonBox.add(resetButton);
765//        currentScript = new JLabel(" no script loaded");
766        //currentScript.setAlignmentX(Box.LEFT_ALIGNMENT);
767//        simulationTimeButtonBox.add (currentScript);
768       
769        simulationStatus.setAlignmentX(Box.CENTER_ALIGNMENT);
770        simulationStatusText.setAlignmentX(Box.CENTER_ALIGNMENT);
771       
772        TitledBorder title = BorderFactory.createTitledBorder(
773                BorderFactory.createEtchedBorder(EtchedBorder.LOWERED), "Status");
774        title.setTitleJustification(TitledBorder.LEFT);
775        simulationStatusBox.setBorder(title);
776       
777        simulationStatusBox.setMaximumSize(new Dimension(140, 60));
778        simulationStatusBox.setAlignmentX(Box.CENTER_ALIGNMENT);                   
779       
780        simulationStatusBox.add(Box.createVerticalGlue());
781        simulationStatusBox.add(simulationStatusText);
782        simulationStatusBox.add(Box.createVerticalGlue());
783       
784        scriptBox = new Box(BoxLayout.Y_AXIS);
785        scriptBox.setAlignmentX(Box.CENTER_ALIGNMENT);
786       
787        scriptBox.add(simulationStatusBox);
788        scriptBox.add(Box.createVerticalStrut(5));
789       
790        simulationClockLabel = new JLabel("0:00:00");
791        simulationClockLabel.setFont(new Font("Geneva", Font.BOLD, 70));
792        simulationClockLabel.setForeground(Color.BLACK);
793        simulationClockLabel.setBackground(Color.BLACK);
794        simulationClockBox.setForeground(Color.BLACK);
795        simulationClockBox.setBackground(Color.BLACK);
796        simulationClockBox.add(simulationClockLabel);
797        simulationClockBox.setAlignmentX(Box.CENTER_ALIGNMENT); 
798        simulationTimeButtonBox.setAlignmentX(Box.CENTER_ALIGNMENT);
799        simulationTimeBox.add(simulationClockBox);
800        simulationTimeBox.add(simulationTimeButtonBox);
801
802        simulationTimeAndStatusBox = Box.createHorizontalBox();
803        simulationTimeAndStatusBox.setAlignmentX(Box.LEFT_ALIGNMENT);
804        simulationTimeAndStatusBox.setMaximumSize(new Dimension(640, 300));
805        simulationTimeAndStatusBox.setPreferredSize(new Dimension(640, 1600));
806        simulationTimeAndStatusBox.add(Box.createHorizontalStrut(5));
807        simulationTimeAndStatusBox.add(simulationTimeBox);
808        simulationTimeAndStatusBox.add(Box.createHorizontalStrut(20));
809        simulationTimeAndStatusBox.add(scriptBox);
810        simulationTimeAndStatusBox.add(Box.createHorizontalStrut(5));
811       
812        //*** Clock for CAD Tab ***//
813        CADClientClockLabel = new JLabel("0:00:00");
814        CADClientClockLabel.setFont(new Font("Geneva", Font.BOLD, 60));
815        CADClientClockLabel.setForeground(Color.BLACK);
816        CADClientClockLabel.setBackground(Color.BLACK);
817        CADClientClockLabel.setAlignmentX(Box.CENTER_ALIGNMENT);       
818       
819    }
820   
821   
822    /**
823     * Create Simulation Control Box
824     */
825    private void createSimulationControl() {
826       
827        simulationControlBox = new Box(BoxLayout.Y_AXIS);
828        simulationControlBox.add(simulationTimeAndStatusBox);
829               
830        CompoundBorder cBorder = BorderFactory.createCompoundBorder(
831            BorderFactory.createTitledBorder(
832                BorderFactory.createRaisedBevelBorder(), "Simulation Control"),
833                BorderFactory.createEmptyBorder(5,5,5,5));
834
835       
836        simulationControlBox.setBorder(cBorder);   
837    }
838   
839    /**
840     * Create ParamicsControl Box
841     */
842    private void createParamicsControl() {
843       
844        paramicsControlBox = new Box(BoxLayout.Y_AXIS);
845        paramicsControlBox.setAlignmentX(Box.LEFT_ALIGNMENT);
846        paramicsControlBox.setMaximumSize(new Dimension(650, 150));     
847        paramicsControlBox.setMinimumSize(new Dimension(250, 95)); 
848        paramicsControlBox.setPreferredSize(new Dimension(380, 95));
849       
850        paramicsStatusBox       = new Box(BoxLayout.X_AXIS);       
851        paramicsStatusLabel     = new JLabel("Status:");
852        paramicsStatusInfoLabel = new JLabel("Unknown");
853        paramicsStatusBox.add(paramicsStatusLabel);
854        paramicsStatusBox.add(Box.createHorizontalStrut(10));
855        paramicsStatusBox.add(paramicsStatusInfoLabel);
856        paramicsStatusBox.add(Box.createHorizontalGlue());
857       
858        networkIDSpinner = new JSpinner(
859            new SpinnerNumberModel(DEFAULT_NETWORK_ID, 1, MAX_NETWORK_ID, 1));
860        networkIDSpinner.setEnabled(false);     
861        networkIDSpinner.setMaximumSize(new Dimension(60, 30));
862       
863        connectToParamicsButton = new JButton(new ConnectToParamicsAction(this));
864
865        loadParamicsNetworkButton = new JButton(new LoadParamicsNetworkAction(this));
866        loadParamicsNetworkButton.setEnabled(false);
867        loadParamicsNetworkButton.getAction().putValue(
868                LoadParamicsNetworkAction.NETWORK_ID_SPINNER, networkIDSpinner);
869       
870
871        paramicsButtonBox = new Box(BoxLayout.X_AXIS);
872        paramicsButtonBox.add(Box.createHorizontalGlue());
873        paramicsButtonBox.add(connectToParamicsButton);
874        paramicsButtonBox.add(Box.createHorizontalGlue());
875        paramicsButtonBox.add(loadParamicsNetworkButton);
876        paramicsButtonBox.add(Box.createHorizontalStrut(10));
877        paramicsButtonBox.add(networkIDSpinner);
878        paramicsButtonBox.add(Box.createHorizontalGlue());
879
880        paramicsControlBox.add(Box.createVerticalStrut(5));
881        paramicsControlBox.add(paramicsStatusBox);
882        paramicsControlBox.add(Box.createVerticalStrut(5));
883        paramicsControlBox.add(paramicsButtonBox); 
884        paramicsControlBox.add(Box.createVerticalStrut(5));
885               
886        CompoundBorder cBorder = BorderFactory.createCompoundBorder(
887            BorderFactory.createTitledBorder(
888                BorderFactory.createRaisedBevelBorder(), "Paramics Control"),
889                BorderFactory.createEmptyBorder(5,5,5,5));
890
891       
892        paramicsControlBox.setBorder(cBorder);     
893   
894    }   
895   
896    /**
897     * Create the Incident Management portion of the Simulation
898     * Management Box
899     */       
900    private void createIncidentManagement() {
901   
902        createIncidentListTable();
903       
904        incidentTimeModel = new IncidentTimeSpinnerModel();
905        reschedSpinner = new JSpinner(incidentTimeModel);       
906        reschedSpinner.setEnabled(false);
907        reschedSpinner.setMaximumSize(new Dimension(70,20));
908               
909       
910        triggerButton     = new JButton(new TriggerIncidentAction(this));
911        triggerButton.getAction().putValue(
912                TriggerIncidentAction.INCIDENT_LIST_TABLE, incidentListTable);
913       
914        deleteIncButton   = new JButton(new DeleteIncidentAction(this));
915        deleteIncButton.getAction().putValue(
916                DeleteIncidentAction.INCIDENT_LIST_TABLE, incidentListTable);
917   
918        reschedButton     = new JButton(new RescheduleIncidentAction(this));
919        reschedButton.getAction().putValue(
920                RescheduleIncidentAction.INCIDENT_LIST_TABLE, incidentListTable);
921        reschedButton.getAction().putValue(
922                RescheduleIncidentAction.INCIDENT_TIME_MODEL, incidentTimeModel);
923       
924        addIncidentButton = new JButton(new AddIncidentAction(this));
925       
926        timeScheduledLabel  = new JLabel("Time Scheduled: ");   
927                   
928        triggerButton.setEnabled(false);
929        deleteIncButton.setEnabled(false);
930        reschedButton.setEnabled(false);
931
932        Box temp = new Box(BoxLayout.X_AXIS);
933        temp.setAlignmentX(Box.CENTER_ALIGNMENT);       
934        temp.add(timeScheduledLabel);
935        temp.add(Box.createHorizontalStrut(10));
936        temp.add(reschedSpinner);
937        temp.add(Box.createHorizontalStrut(20));
938        temp.add(reschedButton);       
939
940        incidentManagementReSchedBox = new Box(BoxLayout.Y_AXIS);
941        incidentManagementReSchedBox.setAlignmentX(Box.CENTER_ALIGNMENT);       
942        incidentManagementReSchedBox.add(temp);     
943               
944        Box temp2 = new Box(BoxLayout.X_AXIS);
945        temp2.setAlignmentX(Box.CENTER_ALIGNMENT);
946        temp2.add(triggerButton);
947        temp2.add(Box.createHorizontalStrut(20));
948        temp2.add(deleteIncButton);
949        temp2.add(Box.createHorizontalStrut(20));
950        temp2.add(addIncidentButton);                   
951
952        incidentManagementButtonsBox = new Box(BoxLayout.Y_AXIS);
953        incidentManagementButtonsBox.setAlignmentY(Box.CENTER_ALIGNMENT);
954        incidentManagementButtonsBox.add(temp2);
955       
956        incidentManagementActionBox = new Box(BoxLayout.Y_AXIS);
957        incidentManagementActionBox.setMaximumSize(new Dimension(500, 100));
958        incidentManagementActionBox.setAlignmentX(Box.LEFT_ALIGNMENT);
959        incidentManagementActionBox.add(incidentManagementReSchedBox);     
960        incidentManagementActionBox.add(Box.createVerticalStrut(10));       
961        incidentManagementActionBox.add(incidentManagementButtonsBox);     
962
963        incidentManagementBox = new Box(BoxLayout.Y_AXIS);
964        incidentManagementBox.setAlignmentX(Box.LEFT_ALIGNMENT);
965        incidentManagementBox.setMaximumSize(new Dimension(650, 500));     
966        incidentManagementBox.setMinimumSize(new Dimension(250, 240)); 
967        incidentManagementBox.setPreferredSize(new Dimension(380, 240));
968        incidentManagementBox.add(Box.createVerticalStrut(5));
969        incidentManagementBox.add(incidentListPane);       
970        incidentManagementBox.add(Box.createVerticalStrut(10));     
971        incidentManagementBox.add(incidentManagementActionBox);         
972        incidentManagementBox.add(Box.createVerticalStrut(5));
973       
974        CompoundBorder cBorder = BorderFactory.createCompoundBorder(
975            BorderFactory.createTitledBorder(
976                BorderFactory.createRaisedBevelBorder(), "Incident Management"),
977                BorderFactory.createEmptyBorder(5,5,5,5));
978
979       
980        incidentManagementBox.setBorder(cBorder);       
981   
982    }
983   
984    private void createIncidentListTable() {
985   
986        incidentListTableModel = new IncidentListTableModel();   
987        incidentListTableModel.addTableModelListener(new TableModelListener() {
988            public void tableChanged(TableModelEvent arg0) {
989
990                boolean incidentToTrigger = false;
991               
992                for(int i = 0; i < incidentListTableModel.getRowCount(); i++) {
993                   
994                    incidentToTrigger |= (((Long)incidentListTableModel.
995                            getValueAt(i, INCIDENT_LIST_COLUMNS.SCHEDULED_COL.colNum)) != -1); 
996                }                   
997
998                triggerButton.setEnabled(incidentToTrigger);
999                deleteIncButton.setEnabled(incidentToTrigger);
1000                reschedButton.setEnabled(incidentToTrigger);
1001                reschedSpinner.setEnabled(incidentToTrigger);           
1002               
1003            }
1004        });
1005           
1006        incidentListTable = new JTable(incidentListTableModel);     
1007        incidentListTable.getTableHeader().setReorderingAllowed(false); 
1008        incidentListTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
1009        incidentListTable.setDragEnabled(false);     
1010               
1011        for(int c = 0; c < incidentListTable.getColumnCount(); c++) {
1012            incidentListTable.getColumnModel().getColumn(c).setMinWidth(
1013                    incidentListTableModel.getColumnMinWidth(c));
1014            incidentListTable.getColumnModel().getColumn(c).setMaxWidth(
1015                    incidentListTableModel.getColumnMaxWidth(c));
1016            incidentListTable.getColumnModel().getColumn(c).setPreferredWidth(
1017                    incidentListTableModel.getColumnPrefWidth(c));
1018            incidentListTable.getColumnModel().getColumn(c).setResizable(true);
1019           
1020            if(c == INCIDENT_LIST_COLUMNS.SCHEDULED_COL.colNum)
1021                incidentListTable.getColumnModel().getColumn(c).setCellRenderer(
1022                        new IncidentTimeCellRenderer());
1023               
1024        }
1025
1026        incidentListPane = new JScrollPane();
1027        incidentListPane.setAlignmentX(Box.LEFT_ALIGNMENT);
1028        incidentListPane.setMaximumSize(new Dimension(650, 400));       
1029        incidentListPane.setMinimumSize(new Dimension(200, 100));   
1030        incidentListPane.setPreferredSize(new Dimension(380, 100));
1031        incidentListPane.setViewportView(incidentListTable);
1032       
1033        incidentListTable.addMouseListener(new MouseListener() {
1034            public void mouseClicked(MouseEvent e) {}
1035            public void mouseEntered(MouseEvent e) {}           
1036            public void mouseExited(MouseEvent e) {}           
1037            public void mousePressed(MouseEvent e) {}           
1038            public void mouseReleased(MouseEvent e)  {
1039                long incTime = (Long)incidentListTable.getValueAt(incidentListTable.getSelectedRow(), 
1040                        INCIDENT_LIST_COLUMNS.SCHEDULED_COL.colNum);
1041                if(incTime != -1) {
1042                    incidentTimeModel.setValue(incTime);
1043                    triggerButton.setEnabled(true);
1044                    deleteIncButton.setEnabled(true);
1045                    reschedButton.setEnabled(true);
1046                    reschedSpinner.setEnabled(true);
1047                }
1048                else {
1049                    triggerButton.setEnabled(false);
1050                    deleteIncButton.setEnabled(false);
1051                    reschedButton.setEnabled(false);
1052                    reschedSpinner.setEnabled(false);       
1053                }
1054               
1055            }           
1056        });
1057    }
1058
1059    /**
1060     * Create the cms traffic diversion box.
1061     */   
1062    private void createCMSTrafficDiversion() {
1063   
1064        cmsTrafficDiversionBox = new Box(BoxLayout.Y_AXIS);
1065        cmsTrafficDiversionBox.setAlignmentX(Box.LEFT_ALIGNMENT);
1066        cmsTrafficDiversionBox.setMaximumSize(new Dimension(650, 350));     
1067        cmsTrafficDiversionBox.setMinimumSize(new Dimension(200, 145)); 
1068        cmsTrafficDiversionBox.setPreferredSize(new Dimension(380, 250));   
1069       
1070        CompoundBorder cBorder = BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(BorderFactory.createRaisedBevelBorder(), "CMS Diversion Management"),
1071                                                                    BorderFactory.createEmptyBorder(5,5,5,5));
1072
1073        cmsTrafficDiversionBox.setBorder(cBorder);                 
1074                       
1075        appliedDiversionTableModel = new AppliedDiversionTableModel();
1076        appliedDiversionTable = new JTable(appliedDiversionTableModel);
1077        appliedDiversionTable.getTableHeader().setReorderingAllowed(false);
1078        appliedDiversionTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
1079        appliedDiversionTable.setCellSelectionEnabled(false);
1080        appliedDiversionTable.setRowSelectionAllowed(true);
1081        appliedDiversionTable.addMouseListener(new MouseListener() {
1082            public void mouseClicked(MouseEvent evt)  {
1083                if(evt.getClickCount() >= 2) {
1084                    ((ApplyDiversionAction)divertButton.getAction()).showDiversionDialog(
1085                            (String)appliedDiversionTableModel.getValueAt(
1086                                    appliedDiversionTable.getSelectedRow(),
1087                                    APPLIED_DIV_COLUMNS.CMS_ID_COL.colNum));
1088                }
1089            };
1090            public void mouseEntered(MouseEvent arg0)  {};
1091            public void mouseExited(MouseEvent arg0)   {};
1092            public void mousePressed(MouseEvent arg0)  {};
1093            public void mouseReleased(MouseEvent arg0) {};         
1094        });
1095       
1096        for(int c = 0; c < appliedDiversionTable.getColumnCount(); c++) {
1097            appliedDiversionTable.getColumnModel().getColumn(c).setMinWidth(
1098                    appliedDiversionTableModel.getColumnMinWidth(c));
1099            appliedDiversionTable.getColumnModel().getColumn(c).setMaxWidth(
1100                    appliedDiversionTableModel.getColumnMaxWidth(c));
1101            appliedDiversionTable.getColumnModel().getColumn(c).setPreferredWidth(
1102                    appliedDiversionTableModel.getColumnPrefWidth(c));
1103            appliedDiversionTable.getColumnModel().getColumn(c).setResizable(false);
1104           
1105            if(c == APPLIED_DIV_COLUMNS.APPLIED_COL.colNum) {
1106                appliedDiversionTable.getColumnModel().getColumn(c).setCellRenderer(
1107                        new IncidentTimeCellRenderer());
1108            }       
1109        }       
1110
1111        appliedDiversionPane = new JScrollPane();
1112        appliedDiversionPane.setAlignmentX(Box.CENTER_ALIGNMENT);       
1113        appliedDiversionPane.setMaximumSize(new Dimension(650, 800));       
1114        appliedDiversionPane.setMinimumSize(new Dimension(200, 75));   
1115        appliedDiversionPane.setPreferredSize(new Dimension(380,100));             
1116        appliedDiversionPane.setViewportView(appliedDiversionTable);   
1117       
1118        cmsIDComboBox = new JComboBox();
1119        cmsIDComboBox.setMaximumSize(new Dimension(40, 25));
1120       
1121        divertButton = new JButton(new ApplyDiversionAction(this));
1122        divertButton.getAction().putValue(
1123                ApplyDiversionAction.CMS_ID_COMBO_BOX, cmsIDComboBox);
1124               
1125        appliedDiversionButtonBox = new Box(BoxLayout.X_AXIS);
1126        appliedDiversionButtonBox.setAlignmentX(Box.CENTER_ALIGNMENT);
1127        appliedDiversionButtonBox.setMaximumSize(new Dimension(1010, 40));
1128        appliedDiversionButtonBox.add(Box.createGlue());
1129        appliedDiversionButtonBox.add(new JLabel("CMS ID:  "));
1130        appliedDiversionButtonBox.add(cmsIDComboBox);
1131        appliedDiversionButtonBox.add(Box.createHorizontalStrut(15));
1132        appliedDiversionButtonBox.add(divertButton);   
1133        appliedDiversionButtonBox.add(Box.createGlue());
1134
1135        cmsTrafficDiversionBox.add(Box.createVerticalStrut(5));
1136        cmsTrafficDiversionBox.add(appliedDiversionPane);       
1137        cmsTrafficDiversionBox.add(Box.createVerticalStrut(5));
1138        cmsTrafficDiversionBox.add(appliedDiversionButtonBox);     
1139        cmsTrafficDiversionBox.add(Box.createVerticalStrut(5));             
1140   
1141    }
1142       
1143    /**
1144     * Create the main admin box.
1145     */           
1146    private void createAdmin() {       
1147       
1148        adminInteractionBox = new Box(BoxLayout.Y_AXIS);
1149        adminInteractionBox.setAlignmentX(Box.LEFT_ALIGNMENT); 
1150        adminInteractionBox.setMinimumSize(new Dimension(425, 740));   
1151        adminInteractionBox.setPreferredSize(new Dimension(425, 740)); 
1152        adminInteractionBox.setMaximumSize(new Dimension(625, 1975));       
1153       
1154        adminInteractionBox.add(Box.createVerticalStrut(10));       
1155        adminInteractionBox.add(simulationControlBox);
1156        adminInteractionBox.add(Box.createVerticalStrut(10));   
1157        adminInteractionBox.add(paramicsControlBox);
1158        adminInteractionBox.add(Box.createVerticalStrut(10));   
1159        adminInteractionBox.add(incidentManagementBox);
1160        adminInteractionBox.add(Box.createVerticalStrut(10));   
1161        adminInteractionBox.add(cmsTrafficDiversionBox);       
1162        adminInteractionBox.add(Box.createVerticalStrut(10));   
1163       
1164    }
1165
1166    /**
1167     * Create the event history box.
1168     */   
1169    private void createEventHistory() {
1170   
1171        eventHistoryPane = new JTabbedPane();
1172       
1173        eventHistoryBox = new Box(BoxLayout.Y_AXIS);
1174        eventHistoryBox.setAlignmentX(Box.CENTER_ALIGNMENT);
1175        eventHistoryBox.setMinimumSize(new Dimension(525, 700));   
1176        eventHistoryBox.setPreferredSize(new Dimension(525, 700));
1177        eventHistoryBox.setMaximumSize(new Dimension(925, 1975));   
1178       
1179        eventHistoryBox.add(eventHistoryPane);
1180        eventHistoryBox.add(Box.createVerticalStrut(10));   
1181       
1182        CompoundBorder cBorder = BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(BorderFactory.createRaisedBevelBorder(), "Event History"),
1183                                                                    BorderFactory.createEmptyBorder(5,5,5,5));
1184       
1185        eventHistoryBox.setBorder(cBorder);     
1186       
1187    }
1188   
1189
1190    /**
1191     * Create the administrator tab
1192     */           
1193    private void addSimulationTab() {
1194       
1195    simulationRightSideBox = new Box(BoxLayout.Y_AXIS);             
1196        simulationRightSideBox.add(Box.createVerticalStrut(10));
1197        simulationRightSideBox.add(eventHistoryBox);
1198        simulationRightSideBox.add(Box.createVerticalStrut(10));   
1199               
1200        simulationBox = new Box(BoxLayout.X_AXIS);     
1201        simulationBox.add(Box.createHorizontalStrut(20));
1202        simulationBox.add(adminInteractionBox);
1203        simulationBox.add(Box.createHorizontalStrut(20));   
1204        simulationBox.add(simulationRightSideBox);
1205        simulationBox.add(Box.createHorizontalStrut(20));
1206               
1207        getContentPane().add(simulationBox);
1208    }   
1209   
1210    private JTabbedPane eventHistoryPane;
1211   
1212    private JScrollPane incidentListPane; 
1213    private JScrollPane appliedDiversionPane;
1214
1215    private JTable incidentListTable;
1216    private JTable appliedDiversionTable;
1217   
1218    private JPanel simulationTime;
1219    private JPanel simulationClock;
1220           
1221    private JLabel paramicsStatusLabel;
1222    private JLabel paramicsStatusInfoLabel;
1223    private JLabel simulationStatus;
1224    private JLabel simulationClockLabel;
1225    private JLabel simulationStatusText;
1226    private JLabel timeScheduledLabel;
1227    private JLabel CADClientClockLabel;
1228    private JLabel currentScript;
1229    private Box adminInteractionBox;   
1230    private Box simulationRightSideBox;
1231    private Box simulationBox;         
1232    private Box appliedDiversionButtonBox; 
1233    private Box cmsTrafficDiversionBox;     
1234    private Box eventHistoryBox;   
1235    private Box incidentManagementActionBox;
1236    private Box incidentManagementBox; 
1237    private Box incidentManagementButtonsBox;
1238    private Box incidentManagementReSchedBox;
1239    private Box scriptBox;     
1240    private Box paramicsButtonBox;
1241    private Box paramicsControlBox; 
1242    private Box paramicsStatusBox;
1243    private Box simulationTimeAndStatusBox;
1244    private Box simulationStatusBox;       
1245    private Box simulationTimeBox;
1246    private Box simulationClockBox;
1247    private Box simulationControlBox;
1248    private Box simulationTimeButtonBox;
1249
1250    private IncidentTimeSpinnerModel incidentTimeModel;
1251    private JSpinner reschedSpinner;
1252    private JSpinner networkIDSpinner;
1253   
1254    private JButton addIncidentButton;         
1255    private JButton deleteIncButton;
1256    private JButton loadScriptButton;
1257    private JButton divertButton;
1258    private JButton reschedButton;
1259    private JButton resetButton;
1260    private JButton startButton;
1261    private JButton pauseButton;
1262    private JButton triggerButton; 
1263    private JButton connectToParamicsButton;
1264    private JButton loadParamicsNetworkButton;
1265   
1266    private JComboBox cmsIDComboBox;                   
1267       
1268    private JMenuBar simManagerMenuBar;
1269    private JMenu fileMenu;
1270    private JMenuItem gotoMenuItem;
1271    private JMenuItem exitMenuItem;
1272   
1273}
1274
Note: See TracBrowser for help on using the repository browser.