Warning: Can't use blame annotator:
svn blame failed on trunk/src/tmcsim/simulationmanager/SimulationManagerView.java: ("Can't find a temporary directory: Internal error", 20014)

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

Revision 416, 50.8 KB checked in by jdalbey, 7 years ago (diff)

Create new ExportAction?.java for Sim Mgr and a new client, CADlogDisplay that outputs to console the current CAD log every 10 seconds.

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