telegps: Add preferences dialog
[fw/altos] / altosui / AltosScanUI.java
index 14b523108b2900795576a953a3b8b4fa2db23e6f..1f1f59ad1166dc0942bed57aa983e3be434e12d0 100644 (file)
@@ -25,8 +25,8 @@ import java.io.*;
 import java.util.*;
 import java.text.*;
 import java.util.concurrent.*;
-import org.altusmetrum.AltosLib.*;
-import org.altusmetrum.altosuilib.*;
+import org.altusmetrum.altoslib_4.*;
+import org.altusmetrum.altosuilib_2.*;
 
 class AltosScanResult {
        String          callsign;
@@ -34,9 +34,9 @@ class AltosScanResult {
        int             flight;
        AltosFrequency  frequency;
        int             telemetry;
-       
+
        boolean interrupted = false;
-       
+
        public String toString() {
                return String.format("%-9.9s serial %-4d flight %-4d (%s %s)",
                                     callsign, serial, flight, frequency.toShortString(), Altos.telemetry_name(telemetry));
@@ -75,8 +75,8 @@ class AltosScanResult {
        }
 }
 
-class AltosScanResults extends LinkedList<AltosScanResult> implements ListModel {
-       
+class AltosScanResults extends LinkedList<AltosScanResult> implements ListModel<AltosScanResult> {
+
        LinkedList<ListDataListener>    listeners = new LinkedList<ListDataListener>();
 
        void changed(ListDataEvent de) {
@@ -107,7 +107,7 @@ class AltosScanResults extends LinkedList<AltosScanResult> implements ListModel
        public void addListDataListener(ListDataListener l) {
                listeners.add(l);
        }
-       
+
        public void removeListDataListener(ListDataListener l) {
                listeners.remove(l);
        }
@@ -129,7 +129,7 @@ public class AltosScanUI
        AltosDevice                     device;
        AltosConfigData                 config_data;
        AltosTelemetryReader            reader;
-       private JList                   list;
+       private JList<AltosScanResult>  list;
        private JLabel                  scanning_label;
        private JLabel                  frequency_label;
        private JLabel                  telemetry_label;
@@ -184,13 +184,13 @@ public class AltosScanUI
                        try {
                                for (;;) {
                                        try {
-                                               AltosRecord     record = reader.read();
-                                               if (record == null)
+                                               AltosState      state = reader.read();
+                                               if (state == null)
                                                        continue;
-                                               if ((record.seen & AltosRecord.seen_flight) != 0) {
-                                                       final AltosScanResult   result = new AltosScanResult(record.callsign,
-                                                                                                    record.serial,
-                                                                                                    record.flight,
+                                               if (state.flight != AltosLib.MISSING) {
+                                                       final AltosScanResult   result = new AltosScanResult(state.callsign,
+                                                                                                    state.serial,
+                                                                                                    state.flight,
                                                                                                     frequencies[frequency_index],
                                                                                                     telemetry);
                                                        Runnable r = new Runnable() {
@@ -221,12 +221,12 @@ public class AltosScanUI
        void set_telemetry() {
                reader.set_telemetry(telemetry);
        }
-       
+
        void set_frequency() throws InterruptedException, TimeoutException {
                reader.set_frequency(frequencies[frequency_index].frequency);
                reader.reset();
        }
-       
+
        void next() throws InterruptedException, TimeoutException {
                reader.set_monitor(false);
                Thread.sleep(100);
@@ -402,7 +402,7 @@ public class AltosScanUI
                scanning_label = new JLabel("Scanning:");
                frequency_label = new JLabel("");
                telemetry_label = new JLabel("");
-               
+
                set_label();
 
                c.fill = GridBagConstraints.HORIZONTAL;
@@ -434,8 +434,8 @@ public class AltosScanUI
                }
 
                int     y_offset = 3 + (Altos.ao_telemetry_max - Altos.ao_telemetry_min + 1);
-                               
-               list = new JList(results) {
+
+               list = new JList<AltosScanResult>(results) {
                                //Subclass JList to workaround bug 4832765, which can cause the
                                //scroll pane to not let the user easily scroll up to the beginning
                                //of the list.  An alternative would be to set the unitIncrement
@@ -548,4 +548,4 @@ public class AltosScanUI
 
                setVisible(true);
        }
-}
\ No newline at end of file
+}