altosui: Mark data 'Age' in monitor idle UI too
[fw/altos] / altosui / AltosIdleMonitorUI.java
index 988a797c963a85cdad456e530d16286983fd7fdc..dbac2d332c5fbbf84812fc18549e3e806ea3b667 100644 (file)
@@ -255,7 +255,7 @@ class AltosIdleMonitor extends Thread {
        }
 }
 
-public class AltosIdleMonitorUI extends JFrame implements AltosFlightDisplay {
+public class AltosIdleMonitorUI extends AltosFrame implements AltosFlightDisplay, AltosFontListener {
        AltosDevice             device;
        JTabbedPane             pane;
        AltosPad                pad;
@@ -289,7 +289,14 @@ public class AltosIdleMonitorUI extends JFrame implements AltosFlightDisplay {
                flightInfo.set_font();
        }
 
+       public void font_size_changed(int font_size) {
+               set_font();
+       }
+
+       AltosFlightStatusUpdate status_update;
+
        public void show(AltosState state, int crc_errors) {
+               status_update.saved_state = state;
                try {
                        pad.show(state, crc_errors);
                        flightStatus.show(state, crc_errors);
@@ -377,12 +384,16 @@ public class AltosIdleMonitorUI extends JFrame implements AltosFlightDisplay {
                bag.add(pane, c);
 
                setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
+
+               AltosPreferences.register_font_listener(this);
+
                addWindowListener(new WindowAdapter() {
                                @Override
                                public void windowClosing(WindowEvent e) {
                                        disconnect();
                                        setVisible(false);
                                        dispose();
+                                       AltosPreferences.unregister_font_listener(AltosIdleMonitorUI.this);
                                }
                        });
 
@@ -391,6 +402,10 @@ public class AltosIdleMonitorUI extends JFrame implements AltosFlightDisplay {
 
                thread = new AltosIdleMonitor(this, device, remote);
 
+               status_update = new AltosFlightStatusUpdate(flightStatus);
+
+               new javax.swing.Timer(100, status_update).start();
+
                thread.start();
        }
 }