altoslib/altosui: Carry receiver status around in AltosListenerState
[fw/altos] / altosui / AltosIdleMonitorUI.java
index 462bff181a3613fa4783162d9742b2f51cde842c..1ef30f0a29a17dcd7db0a7e70932b9d305ca989b 100644 (file)
@@ -37,11 +37,8 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl
        boolean                 remote;
 
        void stop_display() {
-               if (thread != null && thread.isAlive()) {
-                       thread.interrupt();
-                       try {
-                               thread.join();
-                       } catch (InterruptedException ie) {}
+               if (thread != null) {
+                       thread.abort();
                }
                thread = null;
        }
@@ -66,12 +63,12 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl
 
        AltosFlightStatusUpdate status_update;
 
-       public void show(AltosState state, int crc_errors) {
+       public void show(AltosState state, AltosListenerState listener_state) {
                status_update.saved_state = state;
                try {
-                       pad.show(state, crc_errors);
-                       flightStatus.show(state, crc_errors);
-                       flightInfo.show(state, crc_errors);
+                       pad.show(state, listener_state);
+                       flightStatus.show(state, listener_state);
+                       flightInfo.show(state, listener_state);
                } catch (Exception e) {
                        System.out.print("Show exception" + e);
                }
@@ -80,7 +77,7 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl
        public void update(final AltosState state) {
                Runnable r = new Runnable() {
                                public void run() {
-                                       show(state, 0);
+                                       show(state, null);
                                }
                        };
                SwingUtilities.invokeLater(r);
@@ -92,8 +89,11 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl
 
        /* DocumentListener interface methods */
        public void changedUpdate(DocumentEvent e) {
-               if (callsign_value != null)
-                       AltosUIPreferences.set_callsign(callsign_value.getText());
+               if (callsign_value != null) {
+                       String  callsign = callsign_value.getText();
+                       thread.set_callsign(callsign);
+                       AltosUIPreferences.set_callsign(callsign);
+               }
        }
 
        public void insertUpdate(DocumentEvent e) {