summaryrefslogtreecommitdiff
path: root/ao-tools/altosui/AltosFlightUI.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-11-09 23:34:32 -0800
committerKeith Packard <keithp@keithp.com>2010-11-09 23:34:32 -0800
commitb0d31910da592e2f67c47c8fc3e15ce8135d5094 (patch)
tree4caabe69247596dced4dc84063322b091e60b379 /ao-tools/altosui/AltosFlightUI.java
parent22d00785188a880700cd372528189a7a15278da9 (diff)
altosui: Add ascent, descent and landed tabs
This completes the set of tabs for in-flight status information. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ao-tools/altosui/AltosFlightUI.java')
-rw-r--r--ao-tools/altosui/AltosFlightUI.java52
1 files changed, 52 insertions, 0 deletions
diff --git a/ao-tools/altosui/AltosFlightUI.java b/ao-tools/altosui/AltosFlightUI.java
index a7caf7e9..558b0395 100644
--- a/ao-tools/altosui/AltosFlightUI.java
+++ b/ao-tools/altosui/AltosFlightUI.java
@@ -41,10 +41,30 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
JTabbedPane pane;
AltosPad pad;
+ AltosAscent ascent;
+ AltosDescent descent;
+ AltosLanded landed;
private AltosStatusTable flightStatus;
private AltosInfoTable flightInfo;
+ static final int tab_pad = 1;
+ static final int tab_ascent = 2;
+ static final int tab_descent = 3;
+ static final int tab_landed = 4;
+
+ int cur_tab = 0;
+
+ int which_tab(AltosState state) {
+ if (state.state < Altos.ao_flight_boost)
+ return tab_pad;
+ if (state.state <= Altos.ao_flight_coast)
+ return tab_ascent;
+ if (state.state <= Altos.ao_flight_main)
+ return tab_descent;
+ return tab_landed;
+ }
+
public int width() {
return flightInfo.width();
}
@@ -69,11 +89,34 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
public void reset() {
pad.reset();
+ ascent.reset();
+ descent.reset();
+ landed.reset();
flightInfo.clear();
}
public void show(AltosState state, int crc_errors) {
+ int tab = which_tab(state);
pad.show(state, crc_errors);
+ ascent.show(state, crc_errors);
+ descent.show(state, crc_errors);
+ landed.show(state, crc_errors);
+ if (tab != cur_tab) {
+ switch (tab) {
+ case tab_pad:
+ pane.setSelectedComponent(pad);
+ break;
+ case tab_ascent:
+ pane.setSelectedComponent(ascent);
+ break;
+ case tab_descent:
+ pane.setSelectedComponent(descent);
+ break;
+ case tab_landed:
+ pane.setSelectedComponent(landed);
+ }
+ cur_tab = tab;
+ }
flightStatus.set(state);
flightInfo.show(state, crc_errors);
}
@@ -98,6 +141,15 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
pad = new AltosPad();
pane.add("Launch Pad", pad);
+ ascent = new AltosAscent();
+ pane.add("Ascent", ascent);
+
+ descent = new AltosDescent();
+ pane.add("Descent", descent);
+
+ landed = new AltosLanded();
+ pane.add("Landed", landed);
+
flightInfo = new AltosInfoTable();
pane.add("Table", flightInfo.box());