Changeset 432 in tmcsimulator for trunk/src/tmcsim/client/CADlogDisplay.java
- Timestamp:
- 07/07/2019 11:13:00 AM (7 years ago)
- File:
-
- 1 edited
-
trunk/src/tmcsim/client/CADlogDisplay.java (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/tmcsim/client/CADlogDisplay.java
r425 r432 4 4 import java.awt.event.ActionListener; 5 5 import java.io.FileInputStream; 6 import java.io.FileWriter; 7 import java.io.PrintWriter; 6 8 import java.rmi.Naming; 7 9 import java.rmi.RemoteException; … … 38 40 private static Logger cadClientLogger = Logger.getLogger("tmcsim.client"); 39 41 40 @Override 41 public void refresh() throws RemoteException 42 { 43 throw new UnsupportedOperationException("Not supported yet."); 44 } 42 private static final String CONFIG_FILE_NAME = "cad_client_config.properties"; 43 private static final String LOG_FILE_NAME = "CADcomments.log"; 44 private final static int TEN_SECONDS = 10000; 45 45 46 46 /** … … 82 82 */ 83 83 private CADClientInterface client = this; 84 private static final String CONFIG_FILE_NAME = "cad_client_config.properties"; 85 private final static int TEN_SECONDS = 10000; 84 /* 85 * PrintWriter handle for sending log to a file 86 */ 87 private PrintWriter writer; 86 88 87 89 /** … … 103 105 cadClientProp.getProperty(PROPERTIES.CAD_RMI_PORT.name).trim()); 104 106 105 //theView = new ClockView();106 //theView.setVisible(true);107 108 107 // Create a timer that fetches the simulation time every second. 109 108 Timer timer = new Timer(TEN_SECONDS, new ActionListener() 110 109 { 111 public void actionPerformed(ActionEvent e )110 public void actionPerformed(ActionEvent evt) 112 111 { 113 112 try 114 113 { 115 114 Vector<Incident> incList = theCoorInt.getIncidentList(); 116 StringBuffer sb= new StringBuffer();115 StringBuffer output = new StringBuffer(); 117 116 118 117 for (Incident incident: incList) … … 120 119 // DefaultTableModel noteTable = (DefaultTableModel) theCoorInt.getCadDataIncidentTable(INC_TABLE.COMMENTS_NOTES, incident.getLogNum()); 121 120 // Output noteTable 122 sb.append("Incident # " + incident.logNum + "\n");123 121 // Retrieve the table of comments/notes the users created 124 122 DefaultTableModel notesTable = incident.getCommentsNotesTable(); … … 127 125 { 128 126 // Combine the fields into one export entry 129 sb.append(notesTable.getValueAt(row,1) + " "); // time130 String initials = (String) notesTable.getValueAt(row,2); // initials127 //sb.append(notesTable.getValueAt(row,1) + " "); // time 128 String initials = (String) notesTable.getValueAt(row,2); // user initials 131 129 // If there are user intials, include this item. 132 // Zero length initials mean it's a scripted item 130 // Zero length initials mean it's a scripted item, ignore it. 133 131 if (initials.length() > 0) 134 { 135 sb.append(initials + " "); 136 sb.append(notesTable.getValueAt(row,4) + "\n"); // notes 132 {//CAD Log Entry, Incident #187, Sharon: REQUEST EXTRA ANCHOVIES 133 output.append("CAD log entry, "); 134 output.append("Incident #" + incident.logNum + ", "); 135 output.append(initials + ": "); 136 output.append(notesTable.getValueAt(row,4) + "\n"); // notes 137 137 } 138 138 } 139 139 } 140 System.out.println(sb); 140 System.out.print(output); 141 // Write output to a file 142 try 143 { 144 writer = new PrintWriter(new FileWriter(LOG_FILE_NAME)); 145 writer.print(output); 146 writer.close(); 147 } catch (Exception exc) { 148 exc.printStackTrace(); 149 } 150 141 151 //long simtime = theCoorInt.getCurrentSimulationTime(); 142 152 //theView.updateTime("" + formatInterval(simtime)); … … 256 266 } 257 267 268 @Override 269 public void refresh() throws RemoteException 270 { 271 throw new UnsupportedOperationException("Not supported yet."); 272 } 273 258 274 /** 259 275 * Construct the CADClient with the properties file path, either from the
Note: See TracChangeset
for help on using the changeset viewer.
