Changeset 475 in tmcsimulator for trunk/src/tmcsim
- Timestamp:
- 08/23/2019 01:49:50 PM (7 years ago)
- Location:
- trunk/src/tmcsim
- Files:
-
- 6 edited
-
application.properties (modified) (1 diff)
-
cadsimulator/Coordinator.java (modified) (1 diff)
-
client/cadclientgui/data/CADData.java (modified) (1 diff)
-
client/cadclientgui/screens/AssignedIncidents.java (modified) (5 diffs)
-
client/cadclientgui/screens/CADMenu.java (modified) (2 diffs)
-
client/cadclientgui/screens/UnitStatus.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/tmcsim/application.properties
r471 r475 1 # Mon, 29 Jul 2019 14:47:09-07001 #Wed, 21 Aug 2019 15:21:51 -0700 2 2 3 Application.revision=47 03 Application.revision=473 4 4 5 Application.buildnumber=1 775 Application.buildnumber=196 -
trunk/src/tmcsim/cadsimulator/Coordinator.java
r471 r475 144 144 * Constructor. Call UnicastRemoteObject constructor and call 145 145 * initializeSimulation. 146 * @param simTimeFilename name ofthe file where the simulation clock time is written147 * @param commentLogname name offile where CADcommentLog is written146 * @param simTimeFilename path to the file where the simulation clock time is written 147 * @param commentLogname path to the file where CADcommentLog is written 148 148 * @throws RemoteException 149 149 */ -
trunk/src/tmcsim/client/cadclientgui/data/CADData.java
r310 r475 231 231 232 232 /** 233 * Sends all the objects for UnitStatus233 * Accessor to the Unit Status table model 234 234 * 235 235 * @return DefaultTableModel for UnitStatus 236 236 */ 237 synchronized 237 238 public DefaultTableModel tableForUnitStatus() 238 239 { 239 toUnitTableVector.clear(); 240 for (int i = 0; i < units.size(); i++) 241 { 242 toUnitTableVector.add(units.get(i).toVector()); 240 Vector<Object> toUnitTableVector = new Vector<Object>(); 241 242 // build a new unit table 243 for (Unit unit: units) 244 { 245 toUnitTableVector.add(unit.toVector()); 243 246 } 244 247 // Exception occurred here: http://pastebin.com/fvifM5i8 248 // Probably a distributed object concurrency problem. 249 // Assign the unit status table from the newly created vector 245 250 unitStatusTableModel 246 251 .setDataVector(toUnitTableVector, unitStatusHeaders); 252 // return a reference to the updated table 247 253 return unitStatusTableModel; 248 254 } 249 250 255 /** 251 256 * Sends all the objects for AssignedIncidents -
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.
