X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosui%2FAltosIdleMonitorUI.java;h=88779c93440295132b28ed87da472008c9a37cff;hb=99fedbf0ed42a5d4fa80f094576ca0260040ef5e;hp=462bff181a3613fa4783162d9742b2f51cde842c;hpb=cc0ea39fee73417ecd69c020d9eca723ebb2cf65;p=fw%2Faltos diff --git a/altosui/AltosIdleMonitorUI.java b/altosui/AltosIdleMonitorUI.java index 462bff18..88779c93 100644 --- a/altosui/AltosIdleMonitorUI.java +++ b/altosui/AltosIdleMonitorUI.java @@ -23,7 +23,8 @@ import javax.swing.*; import javax.swing.event.*; import java.io.*; import java.util.concurrent.*; -import org.altusmetrum.altoslib_1.*; +import java.util.Arrays; +import org.altusmetrum.altoslib_3.*; import org.altusmetrum.altosuilib_1.*; public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDisplay, AltosFontListener, AltosIdleMonitorListener, DocumentListener { @@ -37,11 +38,11 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl boolean remote; void stop_display() { - if (thread != null && thread.isAlive()) { - thread.interrupt(); + if (thread != null) { try { - thread.join(); - } catch (InterruptedException ie) {} + thread.abort(); + } catch (InterruptedException ie) { + } } thread = null; } @@ -66,21 +67,21 @@ 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); - } catch (Exception e) { - System.out.print("Show exception" + e); - } +// try { + pad.show(state, listener_state); + flightStatus.show(state, listener_state); + flightInfo.show(state, listener_state); +// } catch (Exception e) { +// System.out.print("Show exception " + e); +// } } - public void update(final AltosState state) { + public void update(final AltosState state, final AltosListenerState listener_state) { Runnable r = new Runnable() { public void run() { - show(state, 0); + show(state, listener_state); } }; SwingUtilities.invokeLater(r); @@ -92,8 +93,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) { @@ -191,7 +195,11 @@ public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDispl addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { - disconnect(); + try { + disconnect(); + } catch (Exception ex) { + System.out.println(Arrays.toString(ex.getStackTrace())); + } setVisible(false); dispose(); AltosUIPreferences.unregister_font_listener(AltosIdleMonitorUI.this);