altosui: Add tab UI with 'pad' mode.
[fw/altos] / ao-tools / altosui / AltosFlightUI.java
index 84ba9dca5c1902fdf3f9eef7118563748f8458ed..a7caf7e9620d9f504f5d673a0e3a5b1779734993 100644 (file)
@@ -28,7 +28,7 @@ import java.text.*;
 import java.util.prefs.*;
 import java.util.concurrent.LinkedBlockingQueue;
 
-public class AltosFlightUI extends JFrame {
+public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
        String[] statusNames = { "Height (m)", "State", "RSSI (dBm)", "Speed (m/s)" };
        Object[][] statusData = { { "0", "pad", "-50", "0" } };
 
@@ -37,6 +37,11 @@ public class AltosFlightUI extends JFrame {
        AltosDisplayThread      thread;
 
        private Box vbox;
+
+       JTabbedPane     pane;
+
+       AltosPad        pad;
+
        private AltosStatusTable flightStatus;
        private AltosInfoTable flightInfo;
 
@@ -62,6 +67,17 @@ public class AltosFlightUI extends JFrame {
                stop_display();
        }
 
+       public void reset() {
+               pad.reset();
+               flightInfo.clear();
+       }
+
+       public void show(AltosState state, int crc_errors) {
+               pad.show(state, crc_errors);
+               flightStatus.set(state);
+               flightInfo.show(state, crc_errors);
+       }
+
        public AltosFlightUI(AltosVoice in_voice, AltosFlightReader in_reader, final int serial) {
                voice = in_voice;
                reader = in_reader;
@@ -77,8 +93,15 @@ public class AltosFlightUI extends JFrame {
                vbox = new Box (BoxLayout.Y_AXIS);
                vbox.add(flightStatus);
 
+               pane = new JTabbedPane();
+
+               pad = new AltosPad();
+               pane.add("Launch Pad", pad);
+
                flightInfo = new AltosInfoTable();
-               vbox.add(flightInfo.box());
+               pane.add("Table", flightInfo.box());
+
+               vbox.add(pane);
 
                this.add(vbox);
 
@@ -117,7 +140,7 @@ public class AltosFlightUI extends JFrame {
 
                this.setVisible(true);
 
-               thread = new AltosDisplayThread(this, voice, flightStatus, flightInfo, reader);
+               thread = new AltosDisplayThread(this, voice, this, reader);
 
                thread.start();
        }