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

Revision 9, 51.4 KB checked in by bokumura, 10 years ago (diff)

Added about item to help menu to SimManager?. About item contains current revision information.

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