Changeset 288 in tmcsimulator
- Timestamp:
- 03/02/2019 09:24:47 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/tmcsim/client/cadclientgui/screens/IncidentViewer.java
r59 r288 296 296 public void actionPerformed(ActionEvent arg0) 297 297 { 298 String commentMsg = upperCommentBox.getText().trim(); 299 // If any text was entered in upper comment box 300 if (commentMsg.length() > 0) 301 { 302 /*save text from comment box */ 303 saveComment(commentMsg.toUpperCase()); 304 // Clear the text before closing 305 upperCommentBox.setText(""); 306 } 298 307 close(); 299 308 } … … 358 367 public void actionPerformed(ActionEvent arg0) 359 368 { 360 DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy"); 361 DateFormat timeFormat = new SimpleDateFormat("HH:mm:ss"); 362 String[] fields = 363 { 364 dateFormat.format(new Date()), 365 timeFormat.format(new Date()), 366 ScreenManager.getUserName(), // Put username in "Initials" column 367 "", // "Block" is left blank for now 368 commentsNotesField.getText().toUpperCase() // JD 369 }; 370 try 371 { 372 ScreenManager.theCoordinator.addCadDataIncidentTable( 373 INC_TABLE.COMMENTS_NOTES, incidentId, fields); 374 ((DefaultTableModel) commentsNotesTable.getModel()).insertRow(0, fields);//JD 375 //((DefaultTableModel) commentsNotesTable.getModel()).addRow(fields); 376 } catch (RemoteException e) 377 { 378 e.printStackTrace(); 379 } 369 // pull the text from the text area and go save it 370 saveComment(commentsNotesField.getText().toUpperCase()); 380 371 381 372 commentsNotesField.setText(""); … … 388 379 }; 389 380 } 390 381 382 /** There are two comment fields on the form so this method performs 383 * the save actions that are common to both fields. 384 * @author jdalbey 385 * @param commentMsg the text of the comment to be saved. 386 */ 387 private void saveComment(String commentMsg) 388 { 389 DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy"); 390 DateFormat timeFormat = new SimpleDateFormat("HH:mm:ss"); 391 // prepare fields to be added to comment table 392 String[] fields = 393 { 394 dateFormat.format(new Date()), 395 timeFormat.format(new Date()), 396 ScreenManager.getUserName(), // Put username in "Initials" column 397 "", // "Block" is left blank for now 398 commentMsg 399 }; 400 try 401 { 402 // insert a new row in the comment table 403 ScreenManager.theCoordinator.addCadDataIncidentTable( 404 INC_TABLE.COMMENTS_NOTES, incidentId, fields); 405 ((DefaultTableModel) commentsNotesTable.getModel()).insertRow(0, fields); 406 } catch (RemoteException e) 407 { 408 e.printStackTrace(); 409 } 410 411 } 391 412 // JD Add a mouselistener to the comments table to display a single cell 392 413 // contents in a popup … … 1479 1500 1480 1501 jScrollPane11.setViewportView(dataFieldsTable); 1502 jScrollPane2.setViewportView(upperCommentBox); 1481 1503 1482 1504 dataFieldsLabel.setText("Data Fields"); … … 2413 2435 private javax.swing.JTextField userDataTimeField; 2414 2436 private javax.swing.JTextField userDataTimeStampField; 2437 private javax.swing.JTextArea upperCommentBox = new javax.swing.JTextArea(); 2415 2438 // End of variables declaration//GEN-END:variables 2416 2439 }
Note: See TracChangeset
for help on using the changeset viewer.
