java: Bump java library versions for next release
[fw/altos] / micropeak / MicroExport.java
index 06a0346..8d62ace 100644 (file)
@@ -23,14 +23,20 @@ import java.util.ArrayList;
 import java.awt.*;
 import javax.swing.*;
 import javax.swing.filechooser.FileNameExtensionFilter;
-import org.altusmetrum.AltosLib.*;
-import org.altusmetrum.altosuilib.*;
+import org.altusmetrum.altoslib_5.*;
+import org.altusmetrum.altosuilib_3.*;
 
 public class MicroExport extends JFileChooser {
 
        JFrame          frame;
        MicroData       data;
 
+       public static void export(File file, MicroData data) throws FileNotFoundException, IOException {
+               FileWriter fw = new FileWriter(file);
+               data.export(fw);
+               fw.close();
+       }
+
        public boolean runDialog() {
                int     ret;
 
@@ -76,14 +82,7 @@ public class MicroExport extends JFileChooser {
                                }
                        }
                        try {
-                               FileWriter fw = new FileWriter(file);
-                               PrintWriter pw = new PrintWriter(fw);
-                               pw.printf(" Time, Press, Height,  Speed,  Accel\n");
-                               for (MicroDataPoint point : data.points()) {
-                                       pw.printf("%5.2f,%6.0f,%7.1f,%7.2f,%7.2f\n",
-                                                 point.time, point.pressure, point.height, point.speed, point.accel);
-                               }
-                               fw.close();
+                               export(file, data);
                                return true;
                        } catch (FileNotFoundException fe) {
                                JOptionPane.showMessageDialog(frame,