Changeset 310 in tmcsimulator for trunk/src/tmcsim/client/cadclientgui
- Timestamp:
- 03/13/2019 10:07:54 AM (7 years ago)
- Location:
- trunk/src/tmcsim/client/cadclientgui
- Files:
-
- 3 edited
-
data/CADData.java (modified) (1 diff)
-
data/Incident.java (modified) (1 diff)
-
screens/IncidentViewer.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/tmcsim/client/cadclientgui/data/CADData.java
r66 r310 155 155 incidents = incident; 156 156 } 157 157 /** 158 * Add a single new incident to the list of incidents. Fixes #102 159 * @param incident a single new incident to be added 160 * @author jdalbey 161 */ 162 public void addIncident(Incident incident) 163 { 164 incidents.add(incident); 165 } 166 158 167 /** 159 168 * Returns the specified unitNum -
trunk/src/tmcsim/client/cadclientgui/data/Incident.java
r59 r310 263 263 264 264 public Long getIncidentLength() { 265 if (eventList.size() == 0) return 0L; 265 266 return eventList.lastElement().secondsToOccurInIncident 266 267 - eventList.firstElement().secondsToOccurInIncident; -
trunk/src/tmcsim/client/cadclientgui/screens/IncidentViewer.java
r288 r310 387 387 private void saveComment(String commentMsg) 388 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 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 } 411 410 } 412 // JD Add a mouselistener to the comments table to display a single cell 413 // contents in a popup 414 // public MouseListener newCommentsTableCellListener() 415 // { 416 // return new MouseListener() 417 // { 418 // public void mousePressed(MouseEvent event) 419 // { 420 // } 421 // 422 // public void mouseReleased(MouseEvent event) 423 // { 424 // } 425 // 426 // public void mouseEntered(MouseEvent event) 427 // { 428 // } 429 // 430 // public void mouseExited(MouseEvent event) 431 // { 432 // } 433 // 434 // public void mouseClicked(MouseEvent event) 435 // { 436 // Point point = event.getPoint(); 437 // int row, column; 438 // row = commentsNotesTable.rowAtPoint(point); 439 // column = commentsNotesTable.columnAtPoint(point); 440 // // See if the click was in column 4 (the comment column) 441 // if (column == 4) 442 // { 443 // JOptionPane.showMessageDialog(null, getWrappedText((String) commentsNotesTable.getValueAt(row, column)), 444 // "Comment/Note Text", JOptionPane.INFORMATION_MESSAGE); 445 // } 446 // 447 // } 448 // }; 449 // } 411 450 412 private void initControllers() 451 413 { … … 461 423 } 462 424 463 /**464 * A custom renderer that sets a tool tip with the wrapped comment. JD465 */466 // Obsolete JD467 // class LineWrapRenderer extends DefaultTableCellRenderer468 // {469 // public final static int kSegmentsize = 60;470 //471 // protected void setValue(Object value)472 // {473 // String comment = (String) value;474 // setText(comment);475 // // Wrap long comments in a tooltip476 // setToolTipText(getWrappedText(comment));477 // }478 // }479 //480 // private String getWrappedText(String stringToWrap)481 // {482 // int limit = stringToWrap.length() / LineWrapRenderer.kSegmentsize;483 // StringBuilder toolTip = new StringBuilder("<html>");484 // for (int jumper = 0; jumper <= limit; jumper++)485 // {486 // toolTip.append(stringToWrap.substring(jumper * LineWrapRenderer.kSegmentsize, Math.min((jumper + 1) * LineWrapRenderer.kSegmentsize, stringToWrap.length())));487 // toolTip.append("<br>"); // Use html break to cause a line break488 // }489 // toolTip.append("</html>");490 // return toolTip.toString();491 // }492 425 private void initLayout() 493 426 {
Note: See TracChangeset
for help on using the changeset viewer.
