Changeset 416 in tmcsimulator for trunk/src/tmcsim/client
- Timestamp:
- 06/18/2019 10:56:55 AM (7 years ago)
- File:
-
- 1 copied
-
trunk/src/tmcsim/client/CADlogDisplay.java (copied) (copied from trunk/src/tmcsim/client/ClockClient.java) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/tmcsim/client/CADlogDisplay.java
r64 r416 8 8 import java.rmi.server.UnicastRemoteObject; 9 9 import java.util.Properties; 10 import java.util.Vector; 10 11 import java.util.concurrent.TimeUnit; 11 12 import java.util.logging.Level; … … 15 16 import javax.swing.Timer; 16 17 import javax.swing.UIManager; 18 import javax.swing.table.DefaultTableModel; 19 import tmcsim.client.cadclientgui.data.Incident; 20 import tmcsim.client.cadclientgui.enums.CADDataEnums.INC_TABLE; 17 21 import tmcsim.common.SimulationException; 18 22 import tmcsim.interfaces.CADClientInterface; … … 20 24 21 25 /** 22 * C lockClient shows the simulation clock time. It operates as a client of the26 * CADlogDisplays shows the current CAD log for all incidents. It operates as a client of the 23 27 * CAD server, using RMI to poll the server every second for the current 24 * simulation clock time.28 * list of incidents and associated comments/notes table. 25 29 * 26 30 * @author jdalbey 27 31 */ 28 public class C lockClientextends UnicastRemoteObject implements32 public class CADlogDisplay extends UnicastRemoteObject implements 29 33 CADClientInterface 30 34 { … … 82 86 private CADClientInterface client = this; 83 87 private static final String CONFIG_FILE_NAME = "cad_client_config.properties"; 84 private final static int ONE_SECOND = 1000;88 private final static int TEN_SECONDS = 10000; 85 89 86 90 /** … … 91 95 * file containing configuration data. 92 96 */ 93 public C lockClient(String propertiesFile) throws SimulationException,97 public CADlogDisplay(String propertiesFile) throws SimulationException, 94 98 RemoteException 95 99 { … … 102 106 cadClientProp.getProperty(PROPERTIES.CAD_RMI_PORT.name).trim()); 103 107 104 theView = new ClockView();105 theView.setVisible(true);108 //theView = new ClockView(); 109 //theView.setVisible(true); 106 110 107 111 // Create a timer that fetches the simulation time every second. 108 Timer timer = new Timer( ONE_SECOND, new ActionListener()112 Timer timer = new Timer(TEN_SECONDS, new ActionListener() 109 113 { 110 114 public void actionPerformed(ActionEvent e) … … 112 116 try 113 117 { 114 long simtime = theCoorInt.getCurrentSimulationTime(); 115 theView.updateTime("" + formatInterval(simtime)); 118 Vector<Incident> incList = theCoorInt.getIncidentList(); 119 StringBuffer sb = new StringBuffer(); 120 121 for (Incident incident: incList) 122 { 123 // DefaultTableModel noteTable = (DefaultTableModel) theCoorInt.getCadDataIncidentTable(INC_TABLE.COMMENTS_NOTES, incident.getLogNum()); 124 // Output noteTable 125 sb.append("Incident # " + incident.logNum + "\n"); 126 // Retrieve the table of comments/notes the users created 127 DefaultTableModel notesTable = incident.getCommentsNotesTable(); 128 // Retrieve the notes chronologically (Most recent is in first row) 129 for (int row=notesTable.getRowCount()-1; row >=0; row--) 130 { 131 // Combine the fields into one export entry 132 sb.append(notesTable.getValueAt(row,1) + " "); // time 133 String initials = (String) notesTable.getValueAt(row,2); // initials 134 // If there are no user intials, it's a scripted item 135 if (initials.length() == 0) 136 { 137 initials = "Script"; 138 } 139 sb.append(initials + " "); 140 sb.append(notesTable.getValueAt(row,4) + "\n"); // notes 141 } 142 } 143 System.out.println(sb); 144 //long simtime = theCoorInt.getCurrentSimulationTime(); 145 //theView.updateTime("" + formatInterval(simtime)); 116 146 } catch (RemoteException ex) 117 147 { 118 Logger.getLogger(C lockClient.class.getName()).log(Level.SEVERE, null, ex);148 Logger.getLogger(CADlogDisplay.class.getName()).log(Level.SEVERE, null, ex); 119 149 } 120 150 } … … 245 275 { 246 276 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 247 new C lockClient(System.getProperty("CONFIG_DIR") + System.getProperty("file.separator") + CONFIG_FILE_NAME);277 new CADlogDisplay(System.getProperty("CONFIG_DIR") + System.getProperty("file.separator") + CONFIG_FILE_NAME); 248 278 249 279 } catch (Exception e)
Note: See TracChangeset
for help on using the changeset viewer.
