Changeset 210 in tmcsimulator
- Timestamp:
- 11/02/2017 12:32:10 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
-
src/tmcsim/application.properties (modified) (1 diff)
-
src/tmcsim/cadsimulator/CADServer.java (modified) (4 diffs)
-
src/tmcsim/cadsimulator/managers/TrafficModelManager.java (modified) (4 diffs)
-
src/tmcsim/cadsimulator/viewer/CADServerViewer.java (modified) (8 diffs)
-
src/tmcsim/cadsimulator/viewer/TrafficModelViewPanel.form (added)
-
src/tmcsim/cadsimulator/viewer/TrafficModelViewPanel.java (added)
-
test/tmcsim/cadsimulator/SystemTest.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/tmcsim/application.properties
r209 r210 3 3 Application.revision=208 4 4 5 Application.buildnumber=6 85 Application.buildnumber=69 -
trunk/src/tmcsim/cadsimulator/CADServer.java
r206 r210 21 21 import tmcsim.cadsimulator.managers.SimulationClockManager; 22 22 import tmcsim.cadsimulator.managers.TrafficModelManager; 23 import tmcsim.cadsimulator.managers.TrafficModelViewer;24 23 import tmcsim.cadsimulator.viewer.model.CADSimulatorState; 25 24 import tmcsim.common.SimulationException; … … 178 177 */ 179 178 protected static TrafficModelManager theTrafficMgr = null; 180 private TrafficModelViewer trafficView = null;181 179 182 180 /** … … 259 257 CAD_PROPERTIES.TRAFFICMGR_PROP_FILE.name), 260 258 theCoordinator); 261 t rafficView = new TrafficModelViewer(theTrafficMgr);262 theTrafficMgr.addObserver(trafficView);259 theTrafficMgr.addObserver(theViewer); 260 theTrafficMgr.run(); 263 261 264 262 theMediaMgr = new MediaManager( … … 315 313 316 314 theViewer.setVisible(true); 317 trafficView.setVisible(true);318 319 315 320 316 } -
trunk/src/tmcsim/cadsimulator/managers/TrafficModelManager.java
r206 r210 76 76 */ 77 77 private Properties props = null; 78 79 /** 80 * The Coordinator object from which we obtain the simulation clock. 81 */ 82 private Coordinator theCoordinator; 83 78 84 /** 79 85 * Highways in traffic network … … 95 101 private String currentClock = ""; 96 102 97 /** 98 * GUI for this driver 99 */ 100 //private TrafficModelViewer theView; 101 103 102 104 /** 103 105 * Constructor. Loads the Properties file and initializes the 104 * ATMSCommunicator with the parsed data.106 * highway network model. 105 107 * 106 108 * @param propertiesFile Target file path of properties file. … … 118 120 props.getProperty(PROPERTIES.FEPSIM_IP_ADDR.name), 119 121 8080); 120 122 this.theCoordinator = theCoordinator; 123 } 124 /** 125 * Load the traffic events and start processing the event queue. 126 * Usage: addObserver must be called before calling run. 127 */ 128 public void run() 129 { 121 130 loadEvents(); 122 131 … … 378 387 } 379 388 380 /**381 * Construct the CADClient with the properties file path, either from the382 * command line arguments or default.383 *384 * @param args Command line arguments.385 */386 public static void main(String[] args) throws RemoteException387 {388 final String CONFIG_FILE_NAME = "traffic_model_config.properties";389 if (System.getProperty("CONFIG_DIR") == null)390 {391 System.setProperty("CONFIG_DIR", "config");392 }393 CADSimulatorState theModel = new CADSimulatorState();394 Coordinator theCoordinator = new Coordinator(theModel);395 try396 {397 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());398 TrafficModelManager mgr = new TrafficModelManager(System.getProperty("CONFIG_DIR") + System.getProperty("file.separator") + CONFIG_FILE_NAME,399 theCoordinator);400 TrafficModelViewer view = new TrafficModelViewer(mgr);401 view.setVisible(true);402 mgr.addObserver(view);403 }404 catch (Exception e)405 {406 logger.logp(Level.SEVERE, "SimulationManager", "Main",407 "Error initializing application.");408 409 JOptionPane.showMessageDialog(new JWindow(), e.getMessage(),410 "Error - Program Exiting", JOptionPane.ERROR_MESSAGE);411 412 System.exit(-1);413 }414 415 }416 389 class WriteToConsoleThread extends Thread 417 390 { -
trunk/src/tmcsim/cadsimulator/viewer/CADServerViewer.java
r124 r210 18 18 import javax.swing.JTabbedPane; 19 19 import javax.swing.KeyStroke; 20 import tmcsim.cadsimulator.managers.TrafficModelManager; 20 21 import tmcsim.cadsimulator.viewer.actions.ExitAction; 21 22 import tmcsim.cadsimulator.viewer.model.CADMediaStatus; … … 35 36 public class CADServerViewer extends JFrame implements CADViewer 36 37 { 38 private JTabbedPane cadSimTabbedPane; 39 private JMenuBar menubar; 40 private JMenu fileMenu; 41 private JMenuItem exitMenuItem; 37 42 38 43 /** … … 48 53 */ 49 54 private ConfigStatusPanel configPanel; 50 55 /* 56 * Panel to display Traffic Model Event Queue 57 */ 58 private TrafficModelViewPanel trafficPanel; 59 51 60 /** 52 61 * Constructor. … … 133 142 mediaPanel = new MediaStatusPanel(); 134 143 configPanel = new ConfigStatusPanel(); 144 trafficPanel = new TrafficModelViewPanel(); 135 145 136 146 cadSimTabbedPane = new JTabbedPane(); … … 138 148 cadSimTabbedPane.addTab("Media", mediaPanel); 139 149 cadSimTabbedPane.addTab("Config", configPanel); 150 cadSimTabbedPane.addTab("Traffic", trafficPanel); 140 151 141 152 add(cadSimTabbedPane); … … 153 164 154 165 javax.swing.JMenu helpMenu = new javax.swing.JMenu("Help"); 155 javax.swing.JMenuItem aboutItem = new javax.swing.JMenuItem("About");156 166 157 aboutItem.addActionListener(new java.awt.event.ActionListener()158 {159 public void actionPerformed(java.awt.event.ActionEvent evt)160 {161 String ver = "";//RevisionNumber.getString();162 JOptionPane.showMessageDialog(rootPane, "Version: " + ver, "About", JOptionPane.INFORMATION_MESSAGE);163 }164 });165 helpMenu.add(aboutItem);166 167 menubar.add(helpMenu); 167 168 … … 173 174 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 174 175 } 175 private JTabbedPane cadSimTabbedPane;176 private JMenuBar menubar;177 private JMenu fileMenu;178 private JMenuItem exitMenuItem;179 176 180 177 @Override … … 189 186 mediaPanel.refresh(obs); 190 187 } 188 if (obs instanceof TrafficModelManager) 189 { 190 trafficPanel.update(obs, obj); 191 } 191 192 } 192 193 } -
trunk/test/tmcsim/cadsimulator/SystemTest.java
r123 r210 62 62 63 63 // Check CAD Simulator appears with no script and nothing connected 64 assertTrue("Title bar incorrect", cadwindow.getTitle().trim().startsWith("CAD S imulator"));64 assertTrue("Title bar incorrect", cadwindow.getTitle().trim().startsWith("CAD Server")); 65 65 Panel mainPanel = cadwindow.getPanel("contentPane"); 66 66 TextBox txtStatus = mainPanel.getTextBox("simulationStatus");
Note: See TracChangeset
for help on using the changeset viewer.
