Changeset 475 in tmcsimulator for trunk/src/tmcsim/client/cadclientgui/screens
- Timestamp:
- 08/23/2019 01:49:50 PM (7 years ago)
- Location:
- trunk/src/tmcsim/client/cadclientgui/screens
- Files:
-
- 3 edited
-
AssignedIncidents.java (modified) (5 diffs)
-
CADMenu.java (modified) (2 diffs)
-
UnitStatus.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/tmcsim/client/cadclientgui/screens/AssignedIncidents.java
r445 r475 122 122 return new JLabel("?"); 123 123 } 124 124 // Assign a color to the auxiliary units column, labeled "Unit/s" 125 125 comp.setForeground(Color.BLACK); 126 126 comp.setBackground(Color.CYAN); 127 127 if (assignedIncidentsTable.getModel().getColumnName(column).equals("Unit/s")) 128 { //4 is the column for "Unit/s"128 { 129 129 //System.out.println("Diagnostic: in AssignedIncidents.prepareRenderer()"); //Commenting this line breaks the client 130 130 comp.setBackground(Color.BLACK); … … 134 134 // get the unit name from the table JD 135 135 String unitname = (String) assignedIncidentsTable.getValueAt(row, primaryColumn); 136 // Validate that unitname isn't blank 137 if (!unitname.equals("")) 136 // Validate that unitname isn't blank ... I think the reason this happens intermittently 137 // is a race condition in refreshTable() that resulted in blank unitname. 138 if (unitname != null && unitname.length() > 0) 138 139 { 139 140 // Fetch the unit's current status from server … … 155 156 } 156 157 } 158 else 159 { 160 System.out.println("Blank unitname found in AssignedIncidents prepareRenderer."); 161 } 157 162 } catch (RemoteException e) 158 163 { 159 e.printStackTrace();164 System.out.println("RemoteException in AssignedIncidents prepareRenderer: "+ e.getMessage()); 160 165 } 161 166 } … … 592 597 public void refreshTable() 593 598 { 594 599 //only update info if resize not in progress 595 600 if (assignedIncidentsTable.getTableHeader().getResizingColumn() == null) 596 {//only update info if resize not in progress 601 { 602 // Note the odd comment in legacy code in prepare renderer: 603 // "//Commenting this line breaks the client" 604 // Maybe because the sout accidentally solves a concurrency problem, slowing down 605 // the prepare Renderer until the RMI call can complete. 606 int index = assignedIncidentsTable.getSelectedRow(); 607 int[] columnWidths = new int[20]; 608 List<? extends SortKey> keys = assignedIncidentsTable.getRowSorter().getSortKeys(); 609 for (int i = 0; i < assignedIncidentsTable.getColumnCount(); i++) 610 { 611 columnWidths[i] = assignedIncidentsTable.getColumnModel().getColumn(i).getWidth(); 612 } 613 614 // Update the model here 597 615 try 598 616 { 599 int index = assignedIncidentsTable.getSelectedRow();600 int[] columnWidths = new int[20];601 List<? extends SortKey> keys = assignedIncidentsTable.getRowSorter().getSortKeys();602 for (int i = 0; i < assignedIncidentsTable.getColumnCount(); i++)603 {604 columnWidths[i] = assignedIncidentsTable.getColumnModel().getColumn(i).getWidth();605 }606 607 617 assignedIncidentsTable.setModel(ScreenManager.theCoordinator.getCadDataTable(CADDataEnums.TABLE.ASSIGNED_INCIDENTS)); 608 609 for (int i = 0; i < assignedIncidentsTable.getColumnCount(); i++)610 {611 assignedIncidentsTable.getColumnModel().getColumn(i).setPreferredWidth(columnWidths[i]);612 }613 assignedIncidentsTable.getRowSorter().setSortKeys(keys);614 assignedIncidentsTable.getSelectionModel().setSelectionInterval(index, index);615 618 } catch (RemoteException ex) 616 619 { … … 618 621 System.out.println(ex.getMessage()); 619 622 } 623 624 for (int i = 0; i < assignedIncidentsTable.getColumnCount(); i++) 625 { 626 assignedIncidentsTable.getColumnModel().getColumn(i).setPreferredWidth(columnWidths[i]); 627 } 628 assignedIncidentsTable.getRowSorter().setSortKeys(keys); 629 assignedIncidentsTable.getSelectionModel().setSelectionInterval(index, index); 630 620 631 revalidate(); 621 632 repaint(); -
trunk/src/tmcsim/client/cadclientgui/screens/CADMenu.java
r59 r475 28 28 import javax.swing.JFrame; 29 29 import javax.swing.JLabel; 30 import tmcsim.common.RevisionNumber; 30 31 31 32 /** … … 80 81 81 82 getContentPane().add(mainPanel); 82 setTitle("Inform CAD ");83 setTitle("Inform CAD ("+RevisionNumber.getAppVersion()+")"); 83 84 // Load an image for the task bar icon --JD 84 85 // First try to get the image from a local file -
trunk/src/tmcsim/client/cadclientgui/screens/UnitStatus.java
r458 r475 165 165 } 166 166 167 // Set the cell colors depending on the unit's status 167 168 int unitNumColumn = 2; 168 169 try 169 170 { 170 switch (ScreenManager.theCoordinator 171 .getCadDataUnitStatus((String) unitStatusTable 172 .getValueAt(row, unitNumColumn))) 171 String unitNum = (String) unitStatusTable.getValueAt(row, unitNumColumn); 172 173 UnitStatusEnums status = ScreenManager.theCoordinator 174 .getCadDataUnitStatus(unitNum); 175 switch (status) 173 176 { 174 177 case Assignable: … … 1088 1091 unitStatusTable.getSelectionModel().setSelectionInterval(index, index); 1089 1092 }}); 1090 1093 // Perhaps these aren't needed since changing the model should cause auto repaint. 1091 1094 revalidate(); 1092 1095 repaint();
Note: See TracChangeset
for help on using the changeset viewer.
