+ 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);
+ if (save.runDialog())
+ SetName(data.name);
+ }
+
+ private void Export() {
+ if (data == null) {
+ no_data();
+ return;
+ }
+ MicroExport export = new MicroExport (this, data);
+ export.runDialog();
+ }
+
+ private static void CommandGraph(File file) {
+ MicroPeak m = new MicroPeak();
+ m.OpenFile(file);
+ }
+
+ private static void CommandExport(File file) {
+ try {
+ MicroData d = ReadFile(file);
+ if (d != null) {
+ File csv = new File(AltosLib.replace_extension(file.getPath(), ".csv"));
+ try {
+ System.out.printf ("Export \"%s\" to \"%s\"\n", file.getPath(), csv.getPath());
+ MicroExport.export(csv, d);
+ } catch (FileNotFoundException fe) {
+ System.err.printf("Cannot create file \"%s\" (%s)\n", csv.getName(), fe.getMessage());
+ } catch (IOException ie) {
+ System.err.printf("Cannot write file \"%s\" (%s)\n", csv.getName(), ie.getMessage());
+ }
+ }
+ } catch (IOException ie) {
+ System.err.printf("Cannot read file \"%s\" (%s)\n", file.getName(), ie.getMessage());
+ }
+ }
+
+ private void Close() {
+ setVisible(false);
+ dispose();
+ --number_of_windows;
+ if (number_of_windows == 0)