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

Revision 365, 50.6 KB checked in by jdalbey, 7 years ago (diff)

RevisionNumber?.java, SimulationManagerView?.java : Fix defect #119

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