X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=micropeak%2FMicroExport.java;h=a98140ba5970ed1dd86a20d2aa087564cd501d81;hp=219184da9472cb9de1cdd446371d2cc041609f26;hb=8c92656576aff3ceab5bead3c835d96c36098fe7;hpb=31fa139578a86821844e3e2efb1a84bdea4f1370 diff --git a/micropeak/MicroExport.java b/micropeak/MicroExport.java index 219184da..a98140ba 100644 --- a/micropeak/MicroExport.java +++ b/micropeak/MicroExport.java @@ -3,7 +3,8 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -23,14 +24,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_13.*; +import org.altusmetrum.altosuilib_13.*; 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 +83,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("%6.3f,%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,