micropeak: Add CSV export
[fw/altos] / micropeak / MicroPeak.java
index 17eae2288f9c6d24f0656b97e6f5c2a5842eac53..f2f09a10df27c96370ca58585c25c1e8934e33af 100644 (file)
@@ -91,7 +91,7 @@ public class MicroPeak extends MicroFrame implements ActionListener, ItemListene
        }
 
        private void Preferences() {
-               new AltosConfigureUI(this);
+               new AltosUIConfigure(this);
        }
 
        private void DownloadData() {
@@ -101,12 +101,15 @@ public class MicroPeak extends MicroFrame implements ActionListener, ItemListene
                        new MicroDownload(this, device);
        }
 
-       private void Save() {
-               if (data == null) {
+       private void no_data() {
                        JOptionPane.showMessageDialog(this,
                                                      "No data available",
                                                      "No data",
                                                      JOptionPane.INFORMATION_MESSAGE);
+       }
+       private void Save() {
+               if (data == null) {
+                       no_data();
                        return;
                }
                MicroSave       save = new MicroSave (this, data);
@@ -114,6 +117,15 @@ public class MicroPeak extends MicroFrame implements ActionListener, ItemListene
                        SetName(data.name);
        }
        
+       private void Export() {
+               if (data == null) {
+                       no_data();
+                       return;
+               }
+               MicroExport     export = new MicroExport (this, data);
+               export.runDialog();
+       }
+
        private void Close() {
                setVisible(false);
                dispose();
@@ -131,6 +143,8 @@ public class MicroPeak extends MicroFrame implements ActionListener, ItemListene
                        SelectFile();
                else if ("Download".equals(ev.getActionCommand()))
                        DownloadData();
+               else if ("Export".equals(ev.getActionCommand()))
+                       Export();
                else if ("Preferences".equals(ev.getActionCommand()))
                        Preferences();
                else if ("Save a Copy".equals(ev.getActionCommand()))
@@ -169,6 +183,10 @@ public class MicroPeak extends MicroFrame implements ActionListener, ItemListene
                fileMenu.add(saveAction);
                saveAction.addActionListener(this);
 
+               JMenuItem exportAction = new JMenuItem("Export");
+               fileMenu.add(exportAction);
+               exportAction.addActionListener(this);
+
                JMenuItem preferencesAction = new JMenuItem("Preferences");
                fileMenu.add(preferencesAction);
                preferencesAction.addActionListener(this);