altosui: Eliminate unncessary import altosui lines
[fw/altos] / ao-tools / altosui / AltosGraphDataChooser.java
index 1bf28454b1eca7a7edebb8c3b2166686cd8179f8..d128f4d5862a4cc5f3d9bb9edea0914b60c79f64 100644 (file)
@@ -27,12 +27,6 @@ import java.util.*;
 import java.text.*;
 import java.util.prefs.*;
 
-import altosui.AltosPreferences;
-import altosui.AltosReader;
-import altosui.AltosCsvReader;
-import altosui.AltosEepromReader;
-import altosui.AltosTelemetryReader;
-
 public class AltosGraphDataChooser extends JFileChooser {
        JFrame  frame;
        String  filename;
@@ -56,7 +50,15 @@ public class AltosGraphDataChooser extends JFileChooser {
                                return null;
                        filename = file.getName();
                        try {
-                               return new AltosCsvReader(new FileReader(file));
+                if (filename.endsWith("eeprom")) {
+                    FileInputStream in = new FileInputStream(file);
+                    return new AltosDataPointReader(new AltosEepromIterable(in));
+                } else if (filename.endsWith("telem")) {
+                    FileInputStream in = new FileInputStream(file);
+                    return new AltosDataPointReader(new AltosTelemetryIterable(in));
+                } else {
+                    throw new FileNotFoundException();
+                }
                        } catch (FileNotFoundException fe) {
                                JOptionPane.showMessageDialog(frame,
                                                              filename,
@@ -71,7 +73,7 @@ public class AltosGraphDataChooser extends JFileChooser {
                frame = in_frame;
                setDialogTitle("Select Flight Record File");
                setFileFilter(new FileNameExtensionFilter("Flight data file",
-                                                         "csv"));
+                                                         "telem", "eeprom"));
                setCurrentDirectory(AltosPreferences.logdir());
        }
 }