altosui: Hide flight-related tabs for telegps
authorKeith Packard <keithp@keithp.com>
Tue, 2 Apr 2013 23:48:05 +0000 (16:48 -0700)
committerKeith Packard <keithp@keithp.com>
Tue, 2 Apr 2013 23:48:05 +0000 (16:48 -0700)
Products without a flight state don't need ascent/descent/landed tabs.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosui/AltosAscent.java
altosui/AltosDescent.java
altosui/AltosFlightUI.java
altosui/AltosLanded.java

index e90e0e232003c99548bbaf7c5d84a2a7b6dab0f8..80a5b759212475b4dbe87ceb75ab770b63308d08 100644 (file)
@@ -398,6 +398,10 @@ public class AltosAscent extends JComponent implements AltosFlightDisplay {
                add(max);
        }
 
+       public String getName() {
+               return "Ascent";
+       }
+
        public AltosAscent() {
                layout = new GridBagLayout();
 
index 821e3963f976ac7ae296ee80c9df8f16bf66a898..9838f46b722f07d3c416e7ce7c82d75b72f8f6ee 100644 (file)
@@ -440,6 +440,10 @@ public class AltosDescent extends JComponent implements AltosFlightDisplay {
                        apogee.hide();
        }
 
+       public String getName() {
+               return "Descent";
+       }
+
        public AltosDescent() {
                layout = new GridBagLayout();
 
index c8faab90f4086ad31f87cdae42bf037268f27255..c04a4357f6f898bb5a54882abf7a9366cbeee76c 100644 (file)
@@ -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;
index e13229a898150dd3fcca91fded2ab52316af6593..a245dde39299c919fedca84de97e3861de3e0ae2 100644 (file)
@@ -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();