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

Revision 658, 51.0 KB checked in by jdalbey, 4 years ago (diff)

Replace hard-code scenario folder name in Simulation Manager with config property.

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