diff options
| author | Keith Packard <keithp@keithp.com> | 2013-01-02 11:44:32 -0800 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2013-01-02 11:44:32 -0800 | 
| commit | 2c423d9287c6b9ea7233f5e3430682cb1c865da1 (patch) | |
| tree | b46944e638d21c27121cedd4a784767eb55f3eee /micropeak/MicroPeak.java | |
| parent | 93d640de65a1ecedfef89c96521c21632f96f372 (diff) | |
micropeak: Add CSV export
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'micropeak/MicroPeak.java')
| -rw-r--r-- | micropeak/MicroPeak.java | 22 | 
1 files changed, 20 insertions, 2 deletions
| diff --git a/micropeak/MicroPeak.java b/micropeak/MicroPeak.java index 544f3ae0..f2f09a10 100644 --- a/micropeak/MicroPeak.java +++ b/micropeak/MicroPeak.java @@ -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); | 
