| Revision 476,
1.1 KB
checked in by jdalbey, 7 years ago
(diff) |
|
Add unit tests for CADData.
|
| Line | |
|---|
| 1 | |
|---|
| 2 | import java.util.Vector; |
|---|
| 3 | import javax.swing.table.DefaultTableModel; |
|---|
| 4 | import tmcsim.client.cadclientgui.data.Unit; |
|---|
| 5 | /** Spike to try to fix the concurrency error that shows up intermittently |
|---|
| 6 | * as noted in ticket #87. |
|---|
| 7 | * @author jdalbey |
|---|
| 8 | */ |
|---|
| 9 | class CADDataSpike |
|---|
| 10 | { |
|---|
| 11 | DefaultTableModel unitStatusTableModel; |
|---|
| 12 | Vector<String> unitStatusHeaders; |
|---|
| 13 | Vector<Unit> units; |
|---|
| 14 | /** |
|---|
| 15 | * Accessor to the Unit Status table model |
|---|
| 16 | * |
|---|
| 17 | * @return DefaultTableModel for UnitStatus |
|---|
| 18 | */ |
|---|
| 19 | public DefaultTableModel tableForUnitStatus() |
|---|
| 20 | { |
|---|
| 21 | Vector<Object> toUnitTableVector = new Vector<Object>(); |
|---|
| 22 | |
|---|
| 23 | // build a new unit table |
|---|
| 24 | for (Unit unit: units) |
|---|
| 25 | { |
|---|
| 26 | toUnitTableVector.add(unit.toVector()); |
|---|
| 27 | } |
|---|
| 28 | // Exception occurred here: http://pastebin.com/fvifM5i8 |
|---|
| 29 | // Probably a distributed object concurrency problem. |
|---|
| 30 | // Assign the unit status table from the newly created vector |
|---|
| 31 | unitStatusTableModel |
|---|
| 32 | .setDataVector(toUnitTableVector, unitStatusHeaders); |
|---|
| 33 | // return a reference to the updated table |
|---|
| 34 | return unitStatusTableModel; |
|---|
| 35 | } |
|---|
| 36 | |
|---|
| 37 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.