Skip to content

Commit

Permalink
Map states to names
Browse files Browse the repository at this point in the history
  • Loading branch information
ajayyy committed Nov 7, 2020
1 parent 5164186 commit c33e552
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
33 changes: 33 additions & 0 deletions src/uorocketry/basestation/DataHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,39 @@ public void updateTableUIWithData(JTable table, String[] labels) {
String dataText = data[i].getFormattedString();
if (hiddenDataTypes.contains(types[i])) dataText = "Hidden Data";

// Hardcode for now TODO: Move this into config
if (i == data.length - 1 && labels[i].toLowerCase().contains("state")) {
switch (dataText) {
case "0":
dataText = "Init";
break;
case "1":
dataText = "Wait For Init";
break;
case "2":
dataText = "Wait For Launch";
break;
case "3":
dataText = "Powered Flight";
break;
case "4":
dataText = "Coast";
break;
case "5":
dataText = "Descent Phase 1";
break;
case "6":
dataText = "Descent Phase 2";
break;
case "7":
dataText = "Ground";
break;
case "8":
dataText = "Max States";
break;
}
}

// Set data
tableModel.setValueAt(dataText, i, 1);
}
Expand Down
2 changes: 1 addition & 1 deletion src/uorocketry/basestation/Window.java
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public void addJTable(int tableIndex, JSONObject dataSet) {

// Adjust width
dataTable.getColumnModel().getColumn(0).setPreferredWidth(130);
dataTable.getColumnModel().getColumn(1).setPreferredWidth(100);
dataTable.getColumnModel().getColumn(1).setPreferredWidth(130);

dataTable.setFont(new Font("Arial", Font.PLAIN, 15));

Expand Down

0 comments on commit c33e552

Please sign in to comment.