From: Keith Packard Date: Tue, 2 Apr 2013 23:48:05 +0000 (-0700) Subject: altosui: Hide flight-related tabs for telegps X-Git-Tag: altosdroid_v1.2-1~33 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=907cc6c50755c0d19b93c15678d6f3022a6ee10b altosui: Hide flight-related tabs for telegps Products without a flight state don't need ascent/descent/landed tabs. Signed-off-by: Keith Packard --- diff --git a/altosui/AltosAscent.java b/altosui/AltosAscent.java index e90e0e23..80a5b759 100644 --- a/altosui/AltosAscent.java +++ b/altosui/AltosAscent.java @@ -398,6 +398,10 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay { add(max); } + public String getName() { + return "Ascent"; + } + public AltosAscent() { layout = new GridBagLayout(); diff --git a/altosui/AltosDescent.java b/altosui/AltosDescent.java index 821e3963..9838f46b 100644 --- a/altosui/AltosDescent.java +++ b/altosui/AltosDescent.java @@ -440,6 +440,10 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay { apogee.hide(); } + public String getName() { + return "Descent"; + } + public AltosDescent() { layout = new GridBagLayout(); diff --git a/altosui/AltosFlightUI.java b/altosui/AltosFlightUI.java index c8faab90..c04a4357 100644 --- a/altosui/AltosFlightUI.java +++ b/altosui/AltosFlightUI.java @@ -39,6 +39,7 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay, A AltosSiteMap sitemap; boolean has_map; boolean has_companion; + boolean has_state; private AltosFlightStatus flightStatus; private AltosInfoTable flightInfo; @@ -102,9 +103,21 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay, A JComponent tab = which_tab(state); try { pad.show(state, crc_errors); + + if (state.state != Altos.ao_flight_startup) { + if (!has_state) { + pane.setTitleAt(0, "Launch Pad"); + pane.add(ascent, 1); + pane.add(descent, 2); + pane.add(landed, 3); + has_state = true; + } + } + ascent.show(state, crc_errors); descent.show(state, crc_errors); landed.show(state, crc_errors); + if (tab != cur_tab) { if (cur_tab == pane.getSelectedComponent()) { pane.setSelectedComponent(tab); @@ -260,22 +273,18 @@ public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay, A pane = new JTabbedPane(); pad = new AltosPad(); - pane.add("Launch Pad", pad); + pane.add("Status", pad); ascent = new AltosAscent(); - pane.add("Ascent", ascent); - descent = new AltosDescent(); - pane.add("Descent", descent); - landed = new AltosLanded(reader); - pane.add("Landed", landed); flightInfo = new AltosInfoTable(); pane.add("Table", new JScrollPane(flightInfo)); companion = new AltosCompanionInfo(); has_companion = false; + has_state = false; sitemap = new AltosSiteMap(); has_map = false; diff --git a/altosui/AltosLanded.java b/altosui/AltosLanded.java index e13229a8..a245dde3 100644 --- a/altosui/AltosLanded.java +++ b/altosui/AltosLanded.java @@ -271,6 +271,10 @@ public class AltosLanded extends JComponent implements AltosFlightDisplay, Actio } } + public String getName() { + return "Landed"; + } + public AltosLanded(AltosFlightReader in_reader) { layout = new GridBagLayout();