altosui: Try to get dialogs to look a little better
[fw/altos] / altosui / AltosFlightUI.java
index c31e02bf095ad695267444027da9481e90112ed3..abe08a182a04d4e6cae8deaf6b1bdad6779cfeea 100644 (file)
@@ -39,8 +39,10 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
        AltosAscent     ascent;
        AltosDescent    descent;
        AltosLanded     landed;
+       AltosCompanionInfo      companion;
        AltosSiteMap    sitemap;
        boolean         has_map;
+       boolean         has_companion;
 
        private AltosFlightStatus flightStatus;
        private AltosInfoTable flightInfo;
@@ -96,7 +98,20 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
                }
                flightStatus.show(state, crc_errors);
                flightInfo.show(state, crc_errors);
-               if (state.gps != null) {
+
+               if (state.data.companion != null) {
+                       if (!has_companion) {
+                               pane.add("Companion", companion);
+                               has_companion= true;
+                       }
+                       companion.show(state, crc_errors);
+               } else {
+                       if (has_companion) {
+                               pane.remove(companion);
+                               has_companion = false;
+                       }
+               }
+               if (state.gps != null && state.gps.connected) {
                        if (!has_map) {
                                pane.add("Site Map", sitemap);
                                has_map = true;
@@ -157,7 +172,10 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
                        });
                        c.gridx = 0;
                        c.gridy = 0;
+                       c.weightx = 0;
+                       c.weighty = 0;
                        c.insets = new Insets(3, 3, 3, 3);
+                       c.fill = GridBagConstraints.NONE;
                        c.anchor = GridBagConstraints.WEST;
                        bag.add (frequencies, c);
 
@@ -171,6 +189,8 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
                                telemetry = Altos.ao_telemetry_standard;
                        telemetries.setSelectedIndex(telemetry - 1);
                        telemetries.setMaximumRowCount(Altos.ao_telemetry_max);
+                       telemetries.setPreferredSize(null);
+                       telemetries.revalidate();
                        telemetries.addActionListener(new ActionListener() {
                                        public void actionPerformed(ActionEvent e) {
                                                int telemetry = telemetries.getSelectedIndex() + 1;
@@ -180,6 +200,8 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
                                });
                        c.gridx = 1;
                        c.gridy = 0;
+                       c.weightx = 0;
+                       c.weighty = 0;
                        c.fill = GridBagConstraints.NONE;
                        c.anchor = GridBagConstraints.WEST;
                        bag.add (telemetries, c);
@@ -210,12 +232,15 @@ public class AltosFlightUI extends JFrame implements AltosFlightDisplay {
                descent = new AltosDescent();
                pane.add("Descent", descent);
 
-               landed = new AltosLanded();
+               landed = new AltosLanded(reader);
                pane.add("Landed", landed);
 
                flightInfo = new AltosInfoTable();
                pane.add("Table", new JScrollPane(flightInfo));
 
+               companion = new AltosCompanionInfo();
+               has_companion = false;
+
                sitemap = new AltosSiteMap();
                has_map = false;