diff options
74 files changed, 265 insertions, 566 deletions
| diff --git a/altoslib/AltosPreferences.java b/altoslib/AltosPreferences.java index 0e7b2bd3..a82ea3f6 100644 --- a/altoslib/AltosPreferences.java +++ b/altoslib/AltosPreferences.java @@ -19,11 +19,10 @@ package org.altusmetrum.AltosLib;  import java.io.*;  import java.util.*; -import java.util.prefs.*;  import javax.swing.filechooser.FileSystemView;  public class AltosPreferences { -	public static Preferences preferences; +	public static AltosPreferencesBackend backend = null;  	/* logdir preference name */  	public final static String logdirPreference = "LOGDIR"; @@ -100,13 +99,10 @@ public class AltosPreferences {  	public static AltosFrequency[] load_common_frequencies() {  		AltosFrequency[] frequencies = null;  		boolean	existing = false; -		try { -			existing = preferences.nodeExists(common_frequencies_node_name); -		} catch (BackingStoreException be) { -			existing = false; -		} +		existing = backend.nodeExists(common_frequencies_node_name); +  		if (existing) { -			Preferences	node = preferences.node(common_frequencies_node_name); +			AltosPreferencesBackend	node = backend.node(common_frequencies_node_name);  			int		count = node.getInt(frequency_count, 0);  			frequencies = new AltosFrequency[count]; @@ -115,7 +111,7 @@ public class AltosPreferences {  				String	description;  				frequency = node.getDouble(String.format(frequency_format, i), 0.0); -				description = node.get(String.format(description_format, i), null); +				description = node.getString(String.format(description_format, i), null);  				frequencies[i] = new AltosFrequency(frequency, description);  			}  		} else { @@ -129,23 +125,23 @@ public class AltosPreferences {  	}  	public static void save_common_frequencies(AltosFrequency[] frequencies) { -		Preferences	node = preferences.node(common_frequencies_node_name); +		AltosPreferencesBackend	node = backend.node(common_frequencies_node_name);  		node.putInt(frequency_count, frequencies.length);  		for (int i = 0; i < frequencies.length; i++) {  			node.putDouble(String.format(frequency_format, i), frequencies[i].frequency); -			node.put(String.format(description_format, i), frequencies[i].description); +			node.putString(String.format(description_format, i), frequencies[i].description);  		}  	}  	public static int launcher_serial;  	public static int launcher_channel; -	public static void init() { -		preferences = Preferences.userRoot().node("/org/altusmetrum/altosui"); +	public static void init(AltosPreferencesBackend in_backend) { +		backend = in_backend;  		/* Initialize logdir from preferences */ -		String logdir_string = preferences.get(logdirPreference, null); +		String logdir_string = backend.getString(logdirPreference, null);  		if (logdir_string != null)  			logdir = new File(logdir_string);  		else { @@ -162,17 +158,17 @@ public class AltosPreferences {  		telemetries = new Hashtable<Integer,Integer>(); -		voice = preferences.getBoolean(voicePreference, true); +		voice = backend.getBoolean(voicePreference, true); -		callsign = preferences.get(callsignPreference,"N0CALL"); +		callsign = backend.getString(callsignPreference,"N0CALL"); -		scanning_telemetry = preferences.getInt(scanningTelemetryPreference,(1 << AltosLib.ao_telemetry_standard)); +		scanning_telemetry = backend.getInt(scanningTelemetryPreference,(1 << AltosLib.ao_telemetry_standard)); -		launcher_serial = preferences.getInt(launcherSerialPreference, 0); +		launcher_serial = backend.getInt(launcherSerialPreference, 0); -		launcher_channel = preferences.getInt(launcherChannelPreference, 0); +		launcher_channel = backend.getInt(launcherChannelPreference, 0); -		String firmwaredir_string = preferences.get(firmwaredirPreference, null); +		String firmwaredir_string = backend.getString(firmwaredirPreference, null);  		if (firmwaredir_string != null)  			firmwaredir = new File(firmwaredir_string);  		else @@ -180,65 +176,51 @@ public class AltosPreferences {  		common_frequencies = load_common_frequencies(); -		AltosConvert.imperial_units = preferences.getBoolean(unitsPreference, false); +		AltosConvert.imperial_units = backend.getBoolean(unitsPreference, false);  	} -	static { init(); } -  	public static void flush_preferences() { -		try { -			preferences.flush(); -		} catch (BackingStoreException ee) { -/* -			if (component != null) -				JOptionPane.showMessageDialog(component, -							      preferences.absolutePath(), -							      "Cannot save prefernces", -							      JOptionPane.ERROR_MESSAGE); -			else -*/ -				System.err.printf("Cannot save preferences\n"); -		} +		backend.flush();  	}  	public static void set_logdir(File new_logdir) { -		synchronized (preferences) { +		synchronized (backend) {  			logdir = new_logdir;  			mapdir = new File(logdir, "maps");  			if (!mapdir.exists())  				mapdir.mkdirs(); -			preferences.put(logdirPreference, logdir.getPath()); +			backend.putString(logdirPreference, logdir.getPath());  			flush_preferences();  		}  	}  	public static File logdir() { -		synchronized (preferences) { +		synchronized (backend) {  			return logdir;  		}  	}  	public static File mapdir() { -		synchronized (preferences) { +		synchronized (backend) {  			return mapdir;  		}  	}  	public static void set_frequency(int serial, double new_frequency) { -		synchronized (preferences) { +		synchronized (backend) {  			frequencies.put(serial, new_frequency); -			preferences.putDouble(String.format(frequencyPreferenceFormat, serial), new_frequency); +			backend.putDouble(String.format(frequencyPreferenceFormat, serial), new_frequency);  			flush_preferences();  		}  	}  	public static double frequency(int serial) { -		synchronized (preferences) { +		synchronized (backend) {  			if (frequencies.containsKey(serial))  				return frequencies.get(serial); -			double frequency = preferences.getDouble(String.format(frequencyPreferenceFormat, serial), 0); +			double frequency = backend.getDouble(String.format(frequencyPreferenceFormat, serial), 0);  			if (frequency == 0.0) { -				int channel = preferences.getInt(String.format(channelPreferenceFormat, serial), 0); +				int channel = backend.getInt(String.format(channelPreferenceFormat, serial), 0);  				frequency = AltosConvert.radio_channel_to_frequency(channel);  			}  			frequencies.put(serial, frequency); @@ -247,122 +229,122 @@ public class AltosPreferences {  	}  	public static void set_telemetry(int serial, int new_telemetry) { -		synchronized (preferences) { +		synchronized (backend) {  			telemetries.put(serial, new_telemetry); -			preferences.putInt(String.format(telemetryPreferenceFormat, serial), new_telemetry); +			backend.putInt(String.format(telemetryPreferenceFormat, serial), new_telemetry);  			flush_preferences();  		}  	}  	public static int telemetry(int serial) { -		synchronized (preferences) { +		synchronized (backend) {  			if (telemetries.containsKey(serial))  				return telemetries.get(serial); -			int telemetry = preferences.getInt(String.format(telemetryPreferenceFormat, serial), -							   AltosLib.ao_telemetry_standard); +			int telemetry = backend.getInt(String.format(telemetryPreferenceFormat, serial), +						   AltosLib.ao_telemetry_standard);  			telemetries.put(serial, telemetry);  			return telemetry;  		}  	}  	public static void set_scanning_telemetry(int new_scanning_telemetry) { -		synchronized (preferences) { +		synchronized (backend) {  			scanning_telemetry = new_scanning_telemetry; -			preferences.putInt(scanningTelemetryPreference, scanning_telemetry); +			backend.putInt(scanningTelemetryPreference, scanning_telemetry);  			flush_preferences();  		}  	}  	public static int scanning_telemetry() { -		synchronized (preferences) { +		synchronized (backend) {  			return scanning_telemetry;  		}  	}  	public static void set_voice(boolean new_voice) { -		synchronized (preferences) { +		synchronized (backend) {  			voice = new_voice; -			preferences.putBoolean(voicePreference, voice); +			backend.putBoolean(voicePreference, voice);  			flush_preferences();  		}  	}  	public static boolean voice() { -		synchronized (preferences) { +		synchronized (backend) {  			return voice;  		}  	}  	public static void set_callsign(String new_callsign) { -		synchronized(preferences) { +		synchronized(backend) {  			callsign = new_callsign; -			preferences.put(callsignPreference, callsign); +			backend.putString(callsignPreference, callsign);  			flush_preferences();  		}  	}  	public static String callsign() { -		synchronized(preferences) { +		synchronized(backend) {  			return callsign;  		}  	}  	public static void set_firmwaredir(File new_firmwaredir) { -		synchronized (preferences) { +		synchronized (backend) {  			firmwaredir = new_firmwaredir; -			preferences.put(firmwaredirPreference, firmwaredir.getPath()); +			backend.putString(firmwaredirPreference, firmwaredir.getPath());  			flush_preferences();  		}  	}  	public static File firmwaredir() { -		synchronized (preferences) { +		synchronized (backend) {  			return firmwaredir;  		}  	}  	public static void set_launcher_serial(int new_launcher_serial) { -		synchronized (preferences) { +		synchronized (backend) {  			launcher_serial = new_launcher_serial; -			preferences.putInt(launcherSerialPreference, launcher_serial); +			backend.putInt(launcherSerialPreference, launcher_serial);  			flush_preferences();  		}  	}  	public static int launcher_serial() { -		synchronized (preferences) { +		synchronized (backend) {  			return launcher_serial;  		}  	}  	public static void set_launcher_channel(int new_launcher_channel) { -		synchronized (preferences) { +		synchronized (backend) {  			launcher_channel = new_launcher_channel; -			preferences.putInt(launcherChannelPreference, launcher_channel); +			backend.putInt(launcherChannelPreference, launcher_channel);  			flush_preferences();  		}  	}  	public static int launcher_channel() { -		synchronized (preferences) { +		synchronized (backend) {  			return launcher_channel;  		}  	} -	public static Preferences bt_devices() { -		synchronized (preferences) { -			return preferences.node("bt_devices"); +	public static AltosPreferencesBackend bt_devices() { +		synchronized (backend) { +			return backend.node("bt_devices");  		}  	}  	public static AltosFrequency[] common_frequencies() { -		synchronized (preferences) { +		synchronized (backend) {  			return common_frequencies;  		}  	}  	public static void set_common_frequencies(AltosFrequency[] frequencies) { -		synchronized(preferences) { +		synchronized(backend) {  			common_frequencies = frequencies;  			save_common_frequencies(frequencies);  			flush_preferences(); @@ -388,15 +370,15 @@ public class AltosPreferences {  	}  	public static boolean imperial_units() { -		synchronized(preferences) { +		synchronized(backend) {  			return AltosConvert.imperial_units;  		}  	}  	public static void set_imperial_units(boolean imperial_units) { -		synchronized (preferences) { +		synchronized (backend) {  			AltosConvert.imperial_units = imperial_units; -			preferences.putBoolean(unitsPreference, imperial_units); +			backend.putBoolean(unitsPreference, imperial_units);  			flush_preferences();  		}  	} diff --git a/altoslib/AltosPreferencesBackend.java b/altoslib/AltosPreferencesBackend.java new file mode 100644 index 00000000..3fc4b0aa --- /dev/null +++ b/altoslib/AltosPreferencesBackend.java @@ -0,0 +1,41 @@ +/* + * Copyright © 2010 Mike Beattie <mike@ethernal.org> + * + * 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. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +package org.altusmetrum.AltosLib; + +public interface AltosPreferencesBackend { + +	public String  getString(String key, String def); +	public void    putString(String key, String value); + +	public int     getInt(String key, int def); +	public void    putInt(String key, int value); + +	public double  getDouble(String key, double def); +	public void    putDouble(String key, double value); + +	public boolean getBoolean(String key, boolean def); +	public void    putBoolean(String key, boolean value); + +	public boolean nodeExists(String key); +	public AltosPreferencesBackend node(String key); + +	public String[] keys(); +	public void    remove(String key); + +	public void    flush(); +} diff --git a/altoslib/Makefile.am b/altoslib/Makefile.am index a9f810f9..b56d8af1 100644 --- a/altoslib/Makefile.am +++ b/altoslib/Makefile.am @@ -42,6 +42,7 @@ AltosLib_JAVA = \  	$(SRC)/AltosOrderedMegaRecord.java \  	$(SRC)/AltosParse.java \  	$(SRC)/AltosPreferences.java \ +	$(SRC)/AltosPreferencesBackend.java \  	$(SRC)/AltosRecordCompanion.java \  	$(SRC)/AltosRecordIterable.java \  	$(SRC)/AltosRecord.java \ diff --git a/altosui/Altos.java b/altosui/Altos.java index cd17a93e..98af26bc 100644 --- a/altosui/Altos.java +++ b/altosui/Altos.java @@ -18,10 +18,6 @@  package altosui;  import java.awt.*; -import java.util.*; -import java.text.*; -import java.nio.charset.Charset; -  import libaltosJNI.*;  import org.altusmetrum.AltosLib.*; diff --git a/altosui/AltosAscent.java b/altosui/AltosAscent.java index 3fe517aa..007c74ec 100644 --- a/altosui/AltosAscent.java +++ b/altosui/AltosAscent.java @@ -18,15 +18,7 @@  package altosui;  import java.awt.*; -import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*; -import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.LinkedBlockingQueue;  import org.altusmetrum.AltosLib.*;  public class AltosAscent extends JComponent implements AltosFlightDisplay { diff --git a/altosui/AltosBTDevice.java b/altosui/AltosBTDevice.java index 5e353fdd..03e7cbec 100644 --- a/altosui/AltosBTDevice.java +++ b/altosui/AltosBTDevice.java @@ -16,8 +16,6 @@   */  package altosui; -import java.lang.*; -import java.util.*;  import libaltosJNI.*;  public class AltosBTDevice extends altos_bt_device implements AltosDevice { @@ -79,11 +77,13 @@ public class AltosBTDevice extends altos_bt_device implements AltosDevice {  		return libaltos.altos_bt_open(this);  	} +	/*  	private boolean isAltusMetrum() {  		if (getName().startsWith(Altos.bt_product_telebt))  			return true;  		return false;  	} +	*/  	public boolean matchProduct(int want_product) { diff --git a/altosui/AltosBTDeviceIterator.java b/altosui/AltosBTDeviceIterator.java index 58ed86d5..4be5edf5 100644 --- a/altosui/AltosBTDeviceIterator.java +++ b/altosui/AltosBTDeviceIterator.java @@ -16,7 +16,6 @@   */  package altosui; -import java.lang.*;  import java.util.*;  import libaltosJNI.*; diff --git a/altosui/AltosBTKnown.java b/altosui/AltosBTKnown.java index 6a8e53cb..ae04ac8c 100644 --- a/altosui/AltosBTKnown.java +++ b/altosui/AltosBTKnown.java @@ -16,21 +16,19 @@   */  package altosui; -import java.lang.*;  import java.util.*; -import libaltosJNI.*; -import java.util.prefs.*; +import org.altusmetrum.AltosLib.*;  public class AltosBTKnown implements Iterable<AltosBTDevice> {  	LinkedList<AltosBTDevice>	devices = new LinkedList<AltosBTDevice>(); -	Preferences			bt_pref = AltosUIPreferences.bt_devices(); +	AltosPreferencesBackend		bt_pref = AltosUIPreferences.bt_devices();  	private String get_address(String name) { -		return bt_pref.get(name, ""); +		return bt_pref.getString(name, "");  	}  	private void set_address(String name, String addr) { -		bt_pref.put(name, addr); +		bt_pref.putString(name, addr);  	}  	private void remove(String name) { @@ -45,7 +43,6 @@ public class AltosBTKnown implements Iterable<AltosBTDevice> {  				String	addr = get_address(name);  				devices.add(new AltosBTDevice(name, addr));  			} -		} catch (BackingStoreException be) {  		} catch (IllegalStateException ie) {  		}  	} diff --git a/altosui/AltosBTManage.java b/altosui/AltosBTManage.java index aeb964bb..9a28d72b 100644 --- a/altosui/AltosBTManage.java +++ b/altosui/AltosBTManage.java @@ -20,18 +20,9 @@ package altosui;  import java.awt.*;  import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*; -import javax.swing.event.*;  import javax.swing.plaf.basic.*; -import java.io.*;  import java.util.*; -import java.text.*; -import java.util.prefs.*;  import java.util.concurrent.*; -import org.altusmetrum.AltosLib.*; - -import libaltosJNI.*;  public class AltosBTManage extends AltosDialog implements ActionListener, Iterable<AltosBTDevice> {  	LinkedBlockingQueue<AltosBTDevice> found_devices; diff --git a/altosui/AltosCSV.java b/altosui/AltosCSV.java index c876d9ca..f8cc1ed6 100644 --- a/altosui/AltosCSV.java +++ b/altosui/AltosCSV.java @@ -17,9 +17,7 @@  package altosui; -import java.lang.*;  import java.io.*; -import java.text.*;  import java.util.*;  import org.altusmetrum.AltosLib.*; diff --git a/altosui/AltosCSVUI.java b/altosui/AltosCSVUI.java index 2702668b..1d024086 100644 --- a/altosui/AltosCSVUI.java +++ b/altosui/AltosCSVUI.java @@ -20,13 +20,7 @@ package altosui;  import java.awt.*;  import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*;  import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.LinkedBlockingQueue;  import org.altusmetrum.AltosLib.*;  public class AltosCSVUI diff --git a/altosui/AltosChannelMenu.java b/altosui/AltosChannelMenu.java index 0249a0bd..f90a11c0 100644 --- a/altosui/AltosChannelMenu.java +++ b/altosui/AltosChannelMenu.java @@ -17,17 +17,8 @@  package altosui; -import java.awt.*;  import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*; -import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.LinkedBlockingQueue; -import org.altusmetrum.AltosLib.*;  public class AltosChannelMenu extends JComboBox implements ActionListener {  	int				channel; diff --git a/altosui/AltosCompanionInfo.java b/altosui/AltosCompanionInfo.java index 4ba8fe98..f2019438 100644 --- a/altosui/AltosCompanionInfo.java +++ b/altosui/AltosCompanionInfo.java @@ -18,15 +18,7 @@  package altosui;  import java.awt.*; -import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*; -import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.LinkedBlockingQueue;  import org.altusmetrum.AltosLib.*;  public class AltosCompanionInfo extends JTable { diff --git a/altosui/AltosConfig.java b/altosui/AltosConfig.java index cae41858..44e5a3fa 100644 --- a/altosui/AltosConfig.java +++ b/altosui/AltosConfig.java @@ -17,20 +17,12 @@  package altosui; -import java.awt.*;  import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*;  import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*;  import java.util.concurrent.*;  import org.altusmetrum.AltosLib.*; -import libaltosJNI.*; -  public class AltosConfig implements ActionListener {  	class int_ref { @@ -510,11 +502,6 @@ public class AltosConfig implements ActionListener {  									    device.toShortString()),  							      "Device in use",  							      JOptionPane.ERROR_MESSAGE); -			} catch (IOException ee) { -				JOptionPane.showMessageDialog(owner, -							      device.toShortString(), -							      ee.getLocalizedMessage(), -							      JOptionPane.ERROR_MESSAGE);  			}  		}  	} diff --git a/altosui/AltosConfigFreqUI.java b/altosui/AltosConfigFreqUI.java index 7958a21c..918748f7 100644 --- a/altosui/AltosConfigFreqUI.java +++ b/altosui/AltosConfigFreqUI.java @@ -20,15 +20,7 @@ package altosui;  import java.awt.*;  import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*; -import javax.swing.event.*; -import javax.swing.plaf.basic.*; -import java.io.*;  import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.*;  import org.altusmetrum.AltosLib.*;  class AltosEditFreqUI extends AltosDialog implements ActionListener { diff --git a/altosui/AltosConfigTD.java b/altosui/AltosConfigTD.java index 71d628b3..e7b9b81f 100644 --- a/altosui/AltosConfigTD.java +++ b/altosui/AltosConfigTD.java @@ -17,19 +17,11 @@  package altosui; -import java.awt.*;  import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*;  import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*;  import java.util.concurrent.*; -import libaltosJNI.*; -  import org.altusmetrum.AltosLib.*;  public class AltosConfigTD implements ActionListener { @@ -345,11 +337,6 @@ public class AltosConfigTD implements ActionListener {  									    device.toShortString()),  							      "Device in use",  							      JOptionPane.ERROR_MESSAGE); -			} catch (IOException ee) { -				JOptionPane.showMessageDialog(owner, -							      device.toShortString(), -							      ee.getLocalizedMessage(), -							      JOptionPane.ERROR_MESSAGE);  			}  		}  	} diff --git a/altosui/AltosConfigTDUI.java b/altosui/AltosConfigTDUI.java index f2058f69..532a49fa 100644 --- a/altosui/AltosConfigTDUI.java +++ b/altosui/AltosConfigTDUI.java @@ -20,17 +20,7 @@ package altosui;  import java.awt.*;  import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*;  import javax.swing.event.*; -import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.LinkedBlockingQueue; - -import libaltosJNI.*; -  import org.altusmetrum.AltosLib.*;  public class AltosConfigTDUI diff --git a/altosui/AltosConfigUI.java b/altosui/AltosConfigUI.java index 62394fa6..dd34a9cf 100644 --- a/altosui/AltosConfigUI.java +++ b/altosui/AltosConfigUI.java @@ -20,18 +20,9 @@ package altosui;  import java.awt.*;  import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*;  import javax.swing.event.*; -import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.LinkedBlockingQueue;  import org.altusmetrum.AltosLib.*; -import libaltosJNI.*; -  public class AltosConfigUI  	extends AltosDialog  	implements ActionListener, ItemListener, DocumentListener @@ -750,12 +741,12 @@ public class AltosConfigUI  	}  	public void set_flight_log_max_limit(int flight_log_max_limit) { -		boolean	any_added = false; +		//boolean	any_added = false;  		flight_log_max_value.removeAllItems();  		for (int i = 0; i < flight_log_max_values.length; i++) {  			if (Integer.parseInt(flight_log_max_values[i]) < flight_log_max_limit){  				flight_log_max_value.addItem(flight_log_max_values[i]); -				any_added = true; +				//any_added = true;  			}  		}  		flight_log_max_value.addItem(String.format("%d", flight_log_max_limit)); diff --git a/altosui/AltosConfigureUI.java b/altosui/AltosConfigureUI.java index 249fc35a..c576b052 100644 --- a/altosui/AltosConfigureUI.java +++ b/altosui/AltosConfigureUI.java @@ -21,16 +21,7 @@ import java.awt.*;  import java.awt.event.*;  import java.beans.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*;  import javax.swing.event.*; -import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.LinkedBlockingQueue; -import javax.swing.plaf.basic.*; -import org.altusmetrum.AltosLib.*;  class DelegatingRenderer implements ListCellRenderer { @@ -297,6 +288,7 @@ public class AltosConfigureUI  		c.anchor = GridBagConstraints.WEST;  		pane.add(new JLabel("Look & feel"), c); +		/*  		class LookAndFeelRenderer extends BasicComboBoxRenderer implements ListCellRenderer {  			public LookAndFeelRenderer() { @@ -315,6 +307,7 @@ public class AltosConfigureUI  				return this;  			}  		} +		*/  		final UIManager.LookAndFeelInfo[] look_and_feels = UIManager.getInstalledLookAndFeels(); diff --git a/altosui/AltosDataChooser.java b/altosui/AltosDataChooser.java index 4bd51c39..4d2f321e 100644 --- a/altosui/AltosDataChooser.java +++ b/altosui/AltosDataChooser.java @@ -17,15 +17,9 @@  package altosui; -import java.awt.*; -import java.awt.event.*;  import javax.swing.*;  import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*;  import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*;  import org.altusmetrum.AltosLib.*;  public class AltosDataChooser extends JFileChooser { diff --git a/altosui/AltosDataPointReader.java b/altosui/AltosDataPointReader.java index 821b0771..2316cf97 100644 --- a/altosui/AltosDataPointReader.java +++ b/altosui/AltosDataPointReader.java @@ -4,8 +4,6 @@  package altosui; -import java.io.IOException; -import java.text.ParseException;  import java.lang.UnsupportedOperationException;  import java.util.NoSuchElementException;  import java.util.Iterator; diff --git a/altosui/AltosDebug.java b/altosui/AltosDebug.java index 23e38bc0..16b10c3a 100644 --- a/altosui/AltosDebug.java +++ b/altosui/AltosDebug.java @@ -17,13 +17,7 @@  package altosui; -import java.lang.*;  import java.io.*; -import java.util.concurrent.*; -import java.util.*; -import org.altusmetrum.AltosLib.*; - -import libaltosJNI.*;  public class AltosDebug extends AltosSerial { diff --git a/altosui/AltosDescent.java b/altosui/AltosDescent.java index 2fe7d544..e9ff590b 100644 --- a/altosui/AltosDescent.java +++ b/altosui/AltosDescent.java @@ -18,15 +18,7 @@  package altosui;  import java.awt.*; -import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*; -import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.LinkedBlockingQueue;  import org.altusmetrum.AltosLib.*;  public class AltosDescent extends JComponent implements AltosFlightDisplay { diff --git a/altosui/AltosDevice.java b/altosui/AltosDevice.java index 1b5c1a91..d1bc5fd7 100644 --- a/altosui/AltosDevice.java +++ b/altosui/AltosDevice.java @@ -16,8 +16,6 @@   */  package altosui; -import java.lang.*; -import java.util.*;  import libaltosJNI.*;  public interface AltosDevice { diff --git a/altosui/AltosDeviceDialog.java b/altosui/AltosDeviceDialog.java index fa9d0013..0aeadae6 100644 --- a/altosui/AltosDeviceDialog.java +++ b/altosui/AltosDeviceDialog.java @@ -17,12 +17,9 @@  package altosui; -import java.lang.*; -import java.util.*;  import javax.swing.*;  import java.awt.*;  import java.awt.event.*; -import libaltosJNI.*;  public class AltosDeviceDialog extends AltosDialog implements ActionListener { diff --git a/altosui/AltosDialog.java b/altosui/AltosDialog.java index ff38c3e4..eac371aa 100644 --- a/altosui/AltosDialog.java +++ b/altosui/AltosDialog.java @@ -20,16 +20,6 @@ package altosui;  import java.awt.*;  import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*; -import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.*; -import org.altusmetrum.AltosLib.*; - -import libaltosJNI.*;  class AltosDialogListener extends WindowAdapter {  	public void windowClosing (WindowEvent e) { diff --git a/altosui/AltosDisplayThread.java b/altosui/AltosDisplayThread.java index cf69c414..f7a1d03e 100644 --- a/altosui/AltosDisplayThread.java +++ b/altosui/AltosDisplayThread.java @@ -18,15 +18,9 @@  package altosui;  import java.awt.*; -import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*;  import java.io.*; -import java.util.*;  import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.LinkedBlockingQueue;  import org.altusmetrum.AltosLib.*;  public class AltosDisplayThread extends Thread { @@ -228,7 +222,7 @@ public class AltosDisplayThread extends Thread {  	public void run() {  		boolean		interrupted = false; -		String		line; +		//String		line;  		AltosState	state = null;  		AltosState	old_state = null;  		boolean		told; diff --git a/altosui/AltosEepromDelete.java b/altosui/AltosEepromDelete.java index 73f3a00f..b0459bb6 100644 --- a/altosui/AltosEepromDelete.java +++ b/altosui/AltosEepromDelete.java @@ -17,20 +17,12 @@  package altosui; -import java.awt.*;  import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*;  import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*;  import java.util.concurrent.*;  import org.altusmetrum.AltosLib.*; -import libaltosJNI.*; -  public class AltosEepromDelete implements Runnable {  	AltosEepromList		flights;  	Thread			eeprom_thread; diff --git a/altosui/AltosEepromDownload.java b/altosui/AltosEepromDownload.java index 65cac7bd..a8cb24ff 100644 --- a/altosui/AltosEepromDownload.java +++ b/altosui/AltosEepromDownload.java @@ -17,20 +17,14 @@  package altosui; -import java.awt.*;  import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*;  import java.io.*;  import java.util.*;  import java.text.*; -import java.util.prefs.*;  import java.util.concurrent.*;  import org.altusmetrum.AltosLib.*; -import libaltosJNI.*; -  public class AltosEepromDownload implements Runnable {  	JFrame			frame; @@ -113,7 +107,7 @@ public class AltosEepromDownload implements Runnable {  		extension = "eeprom";  		set_serial(flights.config_data.serial); -		for (int i = 0; i < eechunk.chunk_size && !done; i += AltosEepromRecord.record_length) { +		for (int i = 0; i < AltosEepromChunk.chunk_size && !done; i += AltosEepromRecord.record_length) {  			try {  				AltosEepromRecord r = new AltosEepromRecord(eechunk, i);  				if (r.cmd == Altos.AO_LOG_FLIGHT) @@ -220,7 +214,7 @@ public class AltosEepromDownload implements Runnable {  		boolean	any_valid = false;  		extension = "science"; -		for (int i = 0; i < eechunk.chunk_size && !done; i += AltosEepromTeleScience.record_length) { +		for (int i = 0; i < AltosEepromChunk.chunk_size && !done; i += AltosEepromTeleScience.record_length) {  			try {  				AltosEepromTeleScience r = new AltosEepromTeleScience(eechunk, i);  				if (r.type == AltosEepromTeleScience.AO_LOG_TELESCIENCE_START) { @@ -273,7 +267,7 @@ public class AltosEepromDownload implements Runnable {  		extension = "mega";  		set_serial(flights.config_data.serial); -		for (int i = 0; i < eechunk.chunk_size && !done; i += AltosEepromMega.record_length) { +		for (int i = 0; i < AltosEepromChunk.chunk_size && !done; i += AltosEepromMega.record_length) {  			try {  				AltosEepromMega r = new AltosEepromMega(eechunk, i);  				if (r.cmd == Altos.AO_LOG_FLIGHT) diff --git a/altosui/AltosEepromList.java b/altosui/AltosEepromList.java index 6a656215..f9bd2748 100644 --- a/altosui/AltosEepromList.java +++ b/altosui/AltosEepromList.java @@ -17,20 +17,12 @@  package altosui; -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*;  import java.io.*;  import java.util.*;  import java.text.*; -import java.util.prefs.*;  import java.util.concurrent.*;  import org.altusmetrum.AltosLib.*; -import libaltosJNI.*; -  /*   * Temporary structure to hold the list of stored flights;   * each of these will be queried in turn to generate more diff --git a/altosui/AltosEepromManage.java b/altosui/AltosEepromManage.java index 563c90b3..b8de77da 100644 --- a/altosui/AltosEepromManage.java +++ b/altosui/AltosEepromManage.java @@ -17,20 +17,12 @@  package altosui; -import java.awt.*;  import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*;  import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*;  import java.util.concurrent.*;  import org.altusmetrum.AltosLib.*; -import libaltosJNI.*; -  public class AltosEepromManage implements ActionListener {  	JFrame			frame; @@ -161,7 +153,7 @@ public class AltosEepromManage implements ActionListener {  						      ee.getLocalizedMessage(),  						      JOptionPane.ERROR_MESSAGE);  		} else if (e instanceof TimeoutException) { -			TimeoutException te = (TimeoutException) e; +			//TimeoutException te = (TimeoutException) e;  			JOptionPane.showMessageDialog(frame,  						      String.format("Communications failed with \"%s\"",  								    device.toShortString()), @@ -202,7 +194,7 @@ public class AltosEepromManage implements ActionListener {  	public AltosEepromManage(JFrame given_frame) { -		boolean	running = false; +		//boolean	running = false;  		frame = given_frame;  		device = AltosDeviceDialog.show(frame, Altos.product_any); diff --git a/altosui/AltosEepromMonitor.java b/altosui/AltosEepromMonitor.java index 75643442..251344e9 100644 --- a/altosui/AltosEepromMonitor.java +++ b/altosui/AltosEepromMonitor.java @@ -20,14 +20,6 @@ package altosui;  import java.awt.*;  import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*; -import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.LinkedBlockingQueue; -import org.altusmetrum.AltosLib.*;  public class AltosEepromMonitor extends AltosDialog { diff --git a/altosui/AltosEepromSelect.java b/altosui/AltosEepromSelect.java index 4ad78896..d8b8693d 100644 --- a/altosui/AltosEepromSelect.java +++ b/altosui/AltosEepromSelect.java @@ -17,16 +17,10 @@  package altosui; -import java.lang.*; -import java.util.*;  import javax.swing.*;  import javax.swing.border.*;  import java.awt.*;  import java.awt.event.*; -import libaltosJNI.libaltos; -import libaltosJNI.altos_device; -import libaltosJNI.SWIGTYPE_p_altos_file; -import libaltosJNI.SWIGTYPE_p_altos_list;  import org.altusmetrum.AltosLib.*;  class AltosEepromItem implements ActionListener { @@ -57,7 +51,7 @@ class AltosEepromItem implements ActionListener {  }  public class AltosEepromSelect extends AltosDialog implements ActionListener { -	private JList			list; +	//private JList			list;  	private JFrame			frame;  	JButton				ok;  	JButton				cancel; diff --git a/altosui/AltosFlash.java b/altosui/AltosFlash.java index bd0c8a50..313af70b 100644 --- a/altosui/AltosFlash.java +++ b/altosui/AltosFlash.java @@ -17,17 +17,9 @@  package altosui; -import java.awt.*;  import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*;  import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.LinkedBlockingQueue; -import org.altusmetrum.AltosLib.*;  public class AltosFlash {  	File		file; diff --git a/altosui/AltosFlashUI.java b/altosui/AltosFlashUI.java index 66991d10..f8c24b16 100644 --- a/altosui/AltosFlashUI.java +++ b/altosui/AltosFlashUI.java @@ -21,13 +21,8 @@ import java.awt.*;  import java.awt.event.*;  import javax.swing.*;  import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*;  import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*;  import java.util.concurrent.*; -import org.altusmetrum.AltosLib.*;  public class AltosFlashUI  	extends AltosDialog @@ -291,7 +286,7 @@ public class AltosFlashUI  		if (!select_source_file())  			return;  		build_dialog(); -		flash_task	f = new flash_task(this); +		//flash_task	f = new flash_task(this);  	}  	static void show(JFrame frame) { diff --git a/altosui/AltosFlightInfoTableModel.java b/altosui/AltosFlightInfoTableModel.java index 77969a89..249f6497 100644 --- a/altosui/AltosFlightInfoTableModel.java +++ b/altosui/AltosFlightInfoTableModel.java @@ -17,17 +17,7 @@  package altosui; -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter;  import javax.swing.table.*; -import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.LinkedBlockingQueue; -import org.altusmetrum.AltosLib.*;  public class AltosFlightInfoTableModel extends AbstractTableModel {  	final static private String[] columnNames = {"Field", "Value"}; diff --git a/altosui/AltosFlightStats.java b/altosui/AltosFlightStats.java index ab094c80..e48cb608 100644 --- a/altosui/AltosFlightStats.java +++ b/altosui/AltosFlightStats.java @@ -17,16 +17,7 @@  package altosui; -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*;  import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.*;  import org.altusmetrum.AltosLib.*;  public class AltosFlightStats { diff --git a/altosui/AltosFlightStatsTable.java b/altosui/AltosFlightStatsTable.java index 87ba6aa8..1e0b94fa 100644 --- a/altosui/AltosFlightStatsTable.java +++ b/altosui/AltosFlightStatsTable.java @@ -18,15 +18,7 @@  package altosui;  import java.awt.*; -import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*; -import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.*;  import org.altusmetrum.AltosLib.*;  public class AltosFlightStatsTable extends JComponent { diff --git a/altosui/AltosFlightStatus.java b/altosui/AltosFlightStatus.java index 6a351004..b97c8dc6 100644 --- a/altosui/AltosFlightStatus.java +++ b/altosui/AltosFlightStatus.java @@ -18,15 +18,7 @@  package altosui;  import java.awt.*; -import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*; -import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.LinkedBlockingQueue;  import org.altusmetrum.AltosLib.*;  public class AltosFlightStatus extends JComponent implements AltosFlightDisplay { diff --git a/altosui/AltosFlightStatusTableModel.java b/altosui/AltosFlightStatusTableModel.java index c2cf8cd1..56ad7e6f 100644 --- a/altosui/AltosFlightStatusTableModel.java +++ b/altosui/AltosFlightStatusTableModel.java @@ -14,7 +14,7 @@   * with this program; if not, write to the Free Software Foundation, Inc.,   * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.   */ - +/*  package altosui;  import java.awt.*; @@ -65,3 +65,4 @@ public class AltosFlightStatusTableModel extends AbstractTableModel {  		setValueAt(String.format("%1.0f", AltosConvert.speed(speed)), 3);  	}  } +*/
\ No newline at end of file diff --git a/altosui/AltosFlightStatusUpdate.java b/altosui/AltosFlightStatusUpdate.java index d70fc7f8..bef39e8d 100644 --- a/altosui/AltosFlightStatusUpdate.java +++ b/altosui/AltosFlightStatusUpdate.java @@ -17,16 +17,7 @@  package altosui; -import java.awt.*;  import java.awt.event.*; -import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*; -import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.*;  import org.altusmetrum.AltosLib.*;  public class AltosFlightStatusUpdate implements ActionListener { diff --git a/altosui/AltosFlightUI.java b/altosui/AltosFlightUI.java index 600d8acc..533b1951 100644 --- a/altosui/AltosFlightUI.java +++ b/altosui/AltosFlightUI.java @@ -20,12 +20,6 @@ package altosui;  import java.awt.*;  import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*; -import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*;  import java.util.concurrent.*;  import org.altusmetrum.AltosLib.*; diff --git a/altosui/AltosFrame.java b/altosui/AltosFrame.java index 338b363e..731a29b4 100644 --- a/altosui/AltosFrame.java +++ b/altosui/AltosFrame.java @@ -20,16 +20,7 @@ package altosui;  import java.awt.*;  import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*; -import java.io.*;  import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.*; -import org.altusmetrum.AltosLib.*; - -import libaltosJNI.*;  class AltosFrameListener extends WindowAdapter {  	public void windowClosing (WindowEvent e) { diff --git a/altosui/AltosFreqList.java b/altosui/AltosFreqList.java index 1bbc97c6..4edf088c 100644 --- a/altosui/AltosFreqList.java +++ b/altosui/AltosFreqList.java @@ -17,16 +17,7 @@  package altosui; -import java.awt.*; -import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*; -import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.LinkedBlockingQueue;  import org.altusmetrum.AltosLib.*;  public class AltosFreqList extends JComboBox { diff --git a/altosui/AltosGraph.java b/altosui/AltosGraph.java index 54d2bb0b..fbcefd61 100644 --- a/altosui/AltosGraph.java +++ b/altosui/AltosGraph.java @@ -8,7 +8,6 @@ import java.io.*;  import org.jfree.chart.JFreeChart;  import org.jfree.chart.ChartUtilities; -import org.altusmetrum.AltosLib.*;  abstract class AltosGraph {      public String filename; diff --git a/altosui/AltosGraphTime.java b/altosui/AltosGraphTime.java index 0955f6e6..75e536c5 100644 --- a/altosui/AltosGraphTime.java +++ b/altosui/AltosGraphTime.java @@ -4,16 +4,10 @@  package altosui; -import java.lang.*; -import java.io.*; -import java.util.concurrent.*;  import java.util.*; -import java.text.*;  import java.awt.Color;  import java.util.ArrayList;  import java.util.HashMap; -import org.altusmetrum.AltosLib.*; -  import org.jfree.chart.ChartUtilities;  import org.jfree.chart.JFreeChart;  import org.jfree.chart.axis.AxisLocation; diff --git a/altosui/AltosGraphUI.java b/altosui/AltosGraphUI.java index edde1307..cb8e3d20 100644 --- a/altosui/AltosGraphUI.java +++ b/altosui/AltosGraphUI.java @@ -8,17 +8,11 @@ import java.io.*;  import java.util.ArrayList;  import java.awt.*; -import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*;  import org.altusmetrum.AltosLib.*;  import org.jfree.chart.ChartPanel; -import org.jfree.chart.ChartUtilities;  import org.jfree.chart.JFreeChart; -import org.jfree.chart.axis.AxisLocation; -import org.jfree.ui.ApplicationFrame;  import org.jfree.ui.RefineryUtilities;  public class AltosGraphUI extends AltosFrame  @@ -28,9 +22,9 @@ public class AltosGraphUI extends AltosFrame      static final private Color red = new Color(194,31,31);      static final private Color green = new Color(31,194,31);      static final private Color blue = new Color(31,31,194); -    static final private Color black = new Color(31,31,31); +    //static final private Color black = new Color(31,31,31);      static final private Color yellow = new Color(194,194,31); -    static final private Color cyan = new Color(31,194,194); +    //static final private Color cyan = new Color(31,194,194);      static final private Color magenta = new Color(194,31,194);      static private class OverallGraphs { @@ -100,7 +94,7 @@ public class AltosGraphUI extends AltosFrame                  }              }; -        AltosGraphTime.Element e_pad    = new AltosGraphTime.StateMarker(Altos.ao_flight_pad, "Pad"); +        //AltosGraphTime.Element e_pad    = new AltosGraphTime.StateMarker(Altos.ao_flight_pad, "Pad");          AltosGraphTime.Element e_boost  = new AltosGraphTime.StateMarker(Altos.ao_flight_boost, "Boost");          AltosGraphTime.Element e_fast   = new AltosGraphTime.StateMarker(Altos.ao_flight_fast, "Fast");          AltosGraphTime.Element e_coast  = new AltosGraphTime.StateMarker(Altos.ao_flight_coast, "Coast"); @@ -149,7 +143,8 @@ public class AltosGraphUI extends AltosFrame              return graphs;          }      } -     + +    /*      static private class AscentGraphs extends OverallGraphs {          protected AltosGraphTime myAltosGraphTime(String suffix) {              return (new AltosGraphTime("Ascent " + suffix) { @@ -164,7 +159,9 @@ public class AltosGraphUI extends AltosFrame                .addElement(e_coast);          }      } -     +    */ + +    /*      static private class DescentGraphs extends OverallGraphs {          protected AltosGraphTime myAltosGraphTime(String suffix) {              return (new AltosGraphTime("Descent " + suffix) { @@ -179,13 +176,12 @@ public class AltosGraphUI extends AltosFrame              // ((XYGraph)graph[8]).ymin = new Double(-50);          }      } +    */  	public AltosGraphUI(AltosRecordIterable records, String name) throws InterruptedException, IOException {  		super(String.format("Altos Graph %s", name));  		AltosDataPointReader reader = new AltosDataPointReader (records); -		if (reader == null) -			return;  		if (reader.has_accel)  		    init(reader, records, 0); @@ -229,11 +225,13 @@ public class AltosGraphUI extends AltosFrame          return createGraphsWhich(data, which).get(0);      } +    /*      private static ArrayList<AltosGraph> createGraphs(              Iterable<AltosDataPoint> data)      {          return createGraphsWhich(data, -1);      } +    */      private static ArrayList<AltosGraph> createGraphsWhich(              Iterable<AltosDataPoint> data, int which) diff --git a/altosui/AltosHexfile.java b/altosui/AltosHexfile.java index d52b46c3..56875f53 100644 --- a/altosui/AltosHexfile.java +++ b/altosui/AltosHexfile.java @@ -17,13 +17,9 @@  package altosui; -import java.lang.*;  import java.io.*; -import java.util.concurrent.LinkedBlockingQueue;  import java.util.LinkedList; -import java.util.Iterator;  import java.util.Arrays; -import org.altusmetrum.AltosLib.*;  class HexFileInputStream extends PushbackInputStream {  	public int line; @@ -48,7 +44,7 @@ class HexFileInputStream extends PushbackInputStream {  	}  } -class HexRecord implements Comparable { +class HexRecord implements Comparable<Object> {  	public int	address;  	public int	type;  	public byte	checksum; diff --git a/altosui/AltosIdleMonitorUI.java b/altosui/AltosIdleMonitorUI.java index 510579c5..6f696009 100644 --- a/altosui/AltosIdleMonitorUI.java +++ b/altosui/AltosIdleMonitorUI.java @@ -20,12 +20,7 @@ package altosui;  import java.awt.*;  import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*;  import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*;  import java.util.concurrent.*;  import org.altusmetrum.AltosLib.*; diff --git a/altosui/AltosIgniteUI.java b/altosui/AltosIgniteUI.java index 78eba8e6..ec331259 100644 --- a/altosui/AltosIgniteUI.java +++ b/altosui/AltosIgniteUI.java @@ -20,13 +20,8 @@ package altosui;  import java.awt.*;  import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*; -import javax.swing.event.*;  import java.io.*; -import java.util.*;  import java.text.*; -import java.util.prefs.*;  import java.util.concurrent.*;  import org.altusmetrum.AltosLib.*; diff --git a/altosui/AltosInfoTable.java b/altosui/AltosInfoTable.java index c1400976..86e02ab1 100644 --- a/altosui/AltosInfoTable.java +++ b/altosui/AltosInfoTable.java @@ -18,15 +18,8 @@  package altosui;  import java.awt.*; -import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter;  import javax.swing.table.*; -import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.LinkedBlockingQueue;  import org.altusmetrum.AltosLib.*;  public class AltosInfoTable extends JTable { @@ -92,9 +85,9 @@ public class AltosInfoTable extends JTable {  	}  	void info_add_deg(int col, String name, double v, int pos, int neg) { -		int	c = pos; +		//int	c = pos;  		if (v < 0) { -			c = neg; +			//c = neg;  			v = -v;  		}  		double	deg = Math.floor(v); @@ -152,6 +145,7 @@ public class AltosInfoTable extends JTable {  			info_add_row(1, "GPS height", "%6.0f", state.gps_height);  			/* The SkyTraq GPS doesn't report these values */ +			/*  			if (false) {  				info_add_row(1, "GPS ground speed", "%8.1f m/s %3d°",  					     state.gps.ground_speed, @@ -161,6 +155,8 @@ public class AltosInfoTable extends JTable {  				info_add_row(1, "GPS error", "%6d m(h)%3d m(v)",  					     state.gps.h_error, state.gps.v_error);  			} +			*/ +  			info_add_row(1, "GPS hdop", "%8.1f", state.gps.hdop);  			if (state.npad > 0) { @@ -191,7 +187,7 @@ public class AltosInfoTable extends JTable {  				       state.gps.hour,  				       state.gps.minute,  				       state.gps.second); -			int	nsat_vis = 0; +			//int	nsat_vis = 0;  			int	c;  			if (state.gps.cc_gps_sat == null) diff --git a/altosui/AltosKML.java b/altosui/AltosKML.java index 73a5ae53..57339b19 100644 --- a/altosui/AltosKML.java +++ b/altosui/AltosKML.java @@ -17,10 +17,7 @@  package altosui; -import java.lang.*;  import java.io.*; -import java.text.*; -import java.util.*;  import org.altusmetrum.AltosLib.*;  public class AltosKML implements AltosWriter { diff --git a/altosui/AltosLanded.java b/altosui/AltosLanded.java index 68efae8d..57c2d476 100644 --- a/altosui/AltosLanded.java +++ b/altosui/AltosLanded.java @@ -20,13 +20,7 @@ package altosui;  import java.awt.*;  import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*;  import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.LinkedBlockingQueue;  import org.altusmetrum.AltosLib.*;  public class AltosLanded extends JComponent implements AltosFlightDisplay, ActionListener { diff --git a/altosui/AltosLaunch.java b/altosui/AltosLaunch.java index 0e493b91..de19221e 100644 --- a/altosui/AltosLaunch.java +++ b/altosui/AltosLaunch.java @@ -20,12 +20,6 @@ package altosui;  import java.io.*;  import java.util.concurrent.*;  import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*; -import javax.swing.event.*; -import org.altusmetrum.AltosLib.*;  public class AltosLaunch {  	AltosDevice	device; diff --git a/altosui/AltosLaunchUI.java b/altosui/AltosLaunchUI.java index 44481544..39b986c0 100644 --- a/altosui/AltosLaunchUI.java +++ b/altosui/AltosLaunchUI.java @@ -20,15 +20,9 @@ package altosui;  import java.awt.*;  import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*; -import javax.swing.event.*;  import java.io.*; -import java.util.*;  import java.text.*; -import java.util.prefs.*;  import java.util.concurrent.*; -import org.altusmetrum.AltosLib.*;  class FireButton extends JButton {  	protected void processMouseEvent(MouseEvent e) { diff --git a/altosui/AltosLed.java b/altosui/AltosLed.java index 1358cd48..93064f1e 100644 --- a/altosui/AltosLed.java +++ b/altosui/AltosLed.java @@ -17,17 +17,7 @@  package altosui; -import java.awt.*; -import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*; -import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.LinkedBlockingQueue; -import org.altusmetrum.AltosLib.*;  public class AltosLed extends JLabel {  	ImageIcon	on, off; diff --git a/altosui/AltosLights.java b/altosui/AltosLights.java index 8bd9e7de..7ad22f3e 100644 --- a/altosui/AltosLights.java +++ b/altosui/AltosLights.java @@ -18,16 +18,7 @@  package altosui;  import java.awt.*; -import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*; -import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.LinkedBlockingQueue; -import org.altusmetrum.AltosLib.*;  public class AltosLights extends JComponent { diff --git a/altosui/AltosPad.java b/altosui/AltosPad.java index 947c7540..2d9c8323 100644 --- a/altosui/AltosPad.java +++ b/altosui/AltosPad.java @@ -18,15 +18,7 @@  package altosui;  import java.awt.*; -import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*; -import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.LinkedBlockingQueue;  import org.altusmetrum.AltosLib.*;  public class AltosPad extends JComponent implements AltosFlightDisplay { diff --git a/altosui/AltosRomconfig.java b/altosui/AltosRomconfig.java index 0a283e51..55056b5e 100644 --- a/altosui/AltosRomconfig.java +++ b/altosui/AltosRomconfig.java @@ -17,7 +17,6 @@  package altosui;  import java.io.*; -import org.altusmetrum.AltosLib.*;  public class AltosRomconfig {  	public boolean	valid; diff --git a/altosui/AltosRomconfigUI.java b/altosui/AltosRomconfigUI.java index 306b8623..d4a5ef6d 100644 --- a/altosui/AltosRomconfigUI.java +++ b/altosui/AltosRomconfigUI.java @@ -20,14 +20,6 @@ package altosui;  import java.awt.*;  import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*; -import javax.swing.event.*; -import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*; -import org.altusmetrum.AltosLib.*;  public class AltosRomconfigUI  	extends AltosDialog diff --git a/altosui/AltosScanUI.java b/altosui/AltosScanUI.java index 9da1290f..2a6e140a 100644 --- a/altosui/AltosScanUI.java +++ b/altosui/AltosScanUI.java @@ -20,13 +20,10 @@ package altosui;  import java.awt.*;  import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*;  import javax.swing.event.*;  import java.io.*;  import java.util.*;  import java.text.*; -import java.util.prefs.*;  import java.util.concurrent.*;  import org.altusmetrum.AltosLib.*; diff --git a/altosui/AltosSerial.java b/altosui/AltosSerial.java index 6cee1609..771fdd5d 100644 --- a/altosui/AltosSerial.java +++ b/altosui/AltosSerial.java @@ -21,16 +21,10 @@  package altosui; -import java.lang.*;  import java.io.*; -import java.util.concurrent.*;  import java.util.*; -import java.text.*;  import java.awt.*; -import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*;  import org.altusmetrum.AltosLib.*;  import libaltosJNI.*; diff --git a/altosui/AltosSiteMap.java b/altosui/AltosSiteMap.java index b57edcab..3ea4d0fd 100644 --- a/altosui/AltosSiteMap.java +++ b/altosui/AltosSiteMap.java @@ -18,19 +18,10 @@  package altosui;  import java.awt.*; -import java.awt.image.*; -import java.awt.event.*;  import javax.swing.*; -import javax.swing.event.MouseInputAdapter; -import javax.imageio.ImageIO; -import javax.swing.table.*;  import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*;  import java.lang.Math;  import java.awt.geom.Point2D; -import java.awt.geom.Line2D;  import java.util.concurrent.*;  import org.altusmetrum.AltosLib.*; @@ -61,11 +52,13 @@ public class AltosSiteMap extends JScrollPane implements AltosFlightDisplay {  	// based on google js  	//  http://maps.gstatic.com/intl/en_us/mapfiles/api-3/2/10/main.js  	// search for fromLatLngToPoint and fromPointToLatLng +	/*  	private static Point2D.Double pt(LatLng latlng, int zoom) {  		double scale_x = 256/360.0 * Math.pow(2, zoom);  		double scale_y = 256/(2.0*Math.PI) * Math.pow(2, zoom);  		return pt(latlng, scale_x, scale_y);  	} +	*/  	private static Point2D.Double pt(LatLng latlng,  					 double scale_x, double scale_y) @@ -108,9 +101,11 @@ public class AltosSiteMap extends JScrollPane implements AltosFlightDisplay {  	private LatLng latlng(double x, double y) {  		return latlng(new Point2D.Double(x,y), scale_x, scale_y);  	} +	/*  	private LatLng latlng(Point2D.Double pt) {  		return latlng(pt, scale_x, scale_y);  	} +	*/  	ConcurrentHashMap<Point,AltosSiteMapTile> mapTiles = new ConcurrentHashMap<Point,AltosSiteMapTile>();  	Point2D.Double centre; @@ -190,8 +185,8 @@ public class AltosSiteMap extends JScrollPane implements AltosFlightDisplay {  		AltosSiteMap asm = new AltosSiteMap(true);  		asm.centre = asm.getBaseLocation(lat, lng); -		Point2D.Double p = new Point2D.Double(); -		Point2D.Double p2; +		//Point2D.Double p = new Point2D.Double(); +		//Point2D.Double p2;  		int dx = -w/2, dy = -h/2;  		for (int y = dy; y < h+dy; y++) {  			for (int x = dx; x < w+dx; x++) { @@ -426,7 +421,7 @@ public class AltosSiteMap extends JScrollPane implements AltosFlightDisplay {  	public AltosSiteMap(int in_radius) {  		radius = in_radius; -		GrabNDrag scroller = new GrabNDrag(comp); +		//GrabNDrag scroller = new GrabNDrag(comp);  		comp.setLayout(layout); diff --git a/altosui/AltosSiteMapCache.java b/altosui/AltosSiteMapCache.java index f729a298..617ed4a9 100644 --- a/altosui/AltosSiteMapCache.java +++ b/altosui/AltosSiteMapCache.java @@ -17,19 +17,11 @@  package altosui; -import java.awt.*; -import java.awt.image.*; -import java.awt.event.*;  import javax.swing.*;  import javax.imageio.ImageIO; -import javax.swing.table.*;  import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*;  import java.net.URL;  import java.net.URLConnection; -import org.altusmetrum.AltosLib.*;  public class AltosSiteMapCache extends JLabel {  	public static boolean fetchMap(File file, String url) { diff --git a/altosui/AltosSiteMapPreload.java b/altosui/AltosSiteMapPreload.java index 676b0790..33849c66 100644 --- a/altosui/AltosSiteMapPreload.java +++ b/altosui/AltosSiteMapPreload.java @@ -18,22 +18,14 @@  package altosui;  import java.awt.*; -import java.awt.image.*;  import java.awt.event.*;  import javax.swing.*; -import javax.swing.event.MouseInputAdapter; -import javax.imageio.ImageIO; -import javax.swing.table.*;  import java.io.*;  import java.util.*;  import java.text.*; -import java.util.prefs.*;  import java.lang.Math; -import java.awt.geom.Point2D; -import java.awt.geom.Line2D;  import java.net.URL;  import java.net.URLConnection; -import org.altusmetrum.AltosLib.*;  class AltosMapPos extends Box {  	AltosUI		owner; @@ -184,7 +176,7 @@ class AltosSites extends Thread {  	public void run() {  		try {  			URLConnection uc = url.openConnection(); -			int length = uc.getContentLength(); +			//int length = uc.getContentLength();  			InputStreamReader in_stream = new InputStreamReader(uc.getInputStream(), Altos.unicode_set);  			BufferedReader in = new BufferedReader(in_stream); diff --git a/altosui/AltosSiteMapTile.java b/altosui/AltosSiteMapTile.java index 34550219..e9d4a20b 100644 --- a/altosui/AltosSiteMapTile.java +++ b/altosui/AltosSiteMapTile.java @@ -19,15 +19,7 @@ package altosui;  import java.awt.*;  import java.awt.image.*; -import java.awt.event.*;  import javax.swing.*; -import javax.imageio.ImageIO; -import javax.swing.table.*; -import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.lang.Math;  import java.awt.geom.Point2D;  import java.awt.geom.Line2D;  import org.altusmetrum.AltosLib.*; diff --git a/altosui/AltosUI.java b/altosui/AltosUI.java index c1a66b83..b5cbefe7 100644 --- a/altosui/AltosUI.java +++ b/altosui/AltosUI.java @@ -20,17 +20,10 @@ package altosui;  import java.awt.*;  import java.awt.event.*;  import javax.swing.*; -import javax.swing.filechooser.FileNameExtensionFilter; -import javax.swing.table.*;  import java.io.*; -import java.util.*; -import java.text.*; -import java.util.prefs.*;  import java.util.concurrent.*;  import org.altusmetrum.AltosLib.*; -import libaltosJNI.*; -  public class AltosUI extends AltosFrame {  	public AltosVoice voice = new AltosVoice(); @@ -94,7 +87,7 @@ public class AltosUI extends AltosFrame {  		c.weighty = 1;  		b = new JButton(label); -		Dimension ps = b.getPreferredSize(); +		//Dimension ps = b.getPreferredSize();  		gridbag.setConstraints(b, c);  		add(b, c); @@ -448,7 +441,7 @@ public class AltosUI extends AltosFrame {  			return null;  		}  		AltosRecordIterable recs; -		AltosReplayReader reader; +		//AltosReplayReader reader;  		if (file.getName().endsWith("eeprom")) {  			recs = new AltosEepromIterable(in);  		} else { diff --git a/altosui/AltosUIPreferences.java b/altosui/AltosUIPreferences.java index 8f1e45d9..a28c07b0 100644 --- a/altosui/AltosUIPreferences.java +++ b/altosui/AltosUIPreferences.java @@ -19,12 +19,8 @@ package altosui;  import java.io.*;  import java.util.*; -import java.text.*; -import java.util.prefs.*; -import java.util.concurrent.LinkedBlockingQueue;  import java.awt.Component;  import javax.swing.*; -import javax.swing.filechooser.FileSystemView;  import org.altusmetrum.AltosLib.*;  public class AltosUIPreferences extends AltosPreferences { @@ -50,14 +46,16 @@ public class AltosUIPreferences extends AltosPreferences {  	static boolean serial_debug;  	public static void init() { +		AltosPreferences.init(new AltosUIPreferencesBackend()); +  		font_listeners = new LinkedList<AltosFontListener>(); -		font_size = preferences.getInt(fontSizePreference, Altos.font_size_medium); +		font_size = backend.getInt(fontSizePreference, Altos.font_size_medium);  		Altos.set_fonts(font_size); -		look_and_feel = preferences.get(lookAndFeelPreference, UIManager.getSystemLookAndFeelClassName()); +		look_and_feel = backend.getString(lookAndFeelPreference, UIManager.getSystemLookAndFeelClassName());  		ui_listeners = new LinkedList<AltosUIListener>(); -		serial_debug = preferences.getBoolean(serialDebugPreference, false); +		serial_debug = backend.getBoolean(serialDebugPreference, false);  		AltosLink.set_debug(serial_debug);  	} @@ -102,7 +100,7 @@ public class AltosUIPreferences extends AltosPreferences {  		}  	}  	public static int font_size() { -		synchronized (preferences) { +		synchronized (backend) {  			return font_size;  		}  	} @@ -111,9 +109,9 @@ public class AltosUIPreferences extends AltosPreferences {  	}  	public static void set_font_size(int new_font_size) { -		synchronized (preferences) { +		synchronized (backend) {  			font_size = new_font_size; -			preferences.putInt(fontSizePreference, font_size); +			backend.putInt(fontSizePreference, font_size);  			flush_preferences();  			Altos.set_fonts(font_size);  			for (AltosFontListener l : font_listeners) @@ -122,13 +120,13 @@ public class AltosUIPreferences extends AltosPreferences {  	}  	public static void register_font_listener(AltosFontListener l) { -		synchronized (preferences) { +		synchronized (backend) {  			font_listeners.add(l);  		}  	}  	public static void unregister_font_listener(AltosFontListener l) { -		synchronized (preferences) { +		synchronized (backend) {  			font_listeners.remove(l);  		}  	} @@ -138,9 +136,9 @@ public class AltosUIPreferences extends AltosPreferences {  			UIManager.setLookAndFeel(new_look_and_feel);  		} catch (Exception e) {  		} -		synchronized(preferences) { +		synchronized(backend) {  			look_and_feel = new_look_and_feel; -			preferences.put(lookAndFeelPreference, look_and_feel); +			backend.putString(lookAndFeelPreference, look_and_feel);  			flush_preferences();  			for (AltosUIListener l : ui_listeners)  				l.ui_changed(look_and_feel); @@ -148,35 +146,35 @@ public class AltosUIPreferences extends AltosPreferences {  	}  	public static String look_and_feel() { -		synchronized (preferences) { +		synchronized (backend) {  			return look_and_feel;  		}  	}  	public static void register_ui_listener(AltosUIListener l) { -		synchronized(preferences) { +		synchronized(backend) {  			ui_listeners.add(l);  		}  	}  	public static void unregister_ui_listener(AltosUIListener l) { -		synchronized (preferences) { +		synchronized (backend) {  			ui_listeners.remove(l);  		}  	}  	public static void set_serial_debug(boolean new_serial_debug) { -		AltosLink.set_debug(new_serial_debug); -		synchronized (preferences) { +		AltosLink.set_debug(serial_debug); +		synchronized (backend) {  			serial_debug = new_serial_debug; -			preferences.putBoolean(serialDebugPreference, serial_debug); +			backend.putBoolean(serialDebugPreference, serial_debug);  			flush_preferences();  		}  	}  	public static boolean serial_debug() { -		synchronized (preferences) { +		synchronized (backend) {  			return serial_debug;  		}  	} -}
\ No newline at end of file +} diff --git a/altosui/AltosUIPreferencesBackend.java b/altosui/AltosUIPreferencesBackend.java new file mode 100644 index 00000000..210dcb8b --- /dev/null +++ b/altosui/AltosUIPreferencesBackend.java @@ -0,0 +1,95 @@ +/* + * Copyright © 2012 Mike Beattie <mike@ethernal.org> + * + * 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. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +package altosui; + +import java.util.prefs.*; +import org.altusmetrum.AltosLib.*; + +public class AltosUIPreferencesBackend implements AltosPreferencesBackend { + +	private Preferences _preferences = null; +	 +	public AltosUIPreferencesBackend() { +		_preferences = Preferences.userRoot().node("/org/altusmetrum/altosui"); +	} + +	public AltosUIPreferencesBackend(Preferences in_preferences) { +		_preferences = in_preferences; +	} + +	public String  getString(String key, String def) { +		return _preferences.get(key, def); +	} +	public void    putString(String key, String value) { +		_preferences.put(key, value); +	} + +	public int     getInt(String key, int def) { +		return _preferences.getInt(key, def); +	} +	public void    putInt(String key, int value) { +		_preferences.putInt(key, value); +	} + +	public double  getDouble(String key, double def) { +		return _preferences.getDouble(key, def); +	} +	public void    putDouble(String key, double value) { +		_preferences.putDouble(key, value); +	} + +	public boolean getBoolean(String key, boolean def) { +		return _preferences.getBoolean(key, def); +	} +	public void    putBoolean(String key, boolean value) { +		_preferences.putBoolean(key, value); +	} + +	public boolean nodeExists(String key) { +		try { +			return _preferences.nodeExists(key); +		} catch (BackingStoreException be) { +			return false; +		} +	} + +	public AltosPreferencesBackend node(String key) { +		return new AltosUIPreferencesBackend(_preferences.node(key)); +	} + +	public String[] keys() { +		try { +			return _preferences.keys(); +		} catch (BackingStoreException be) { +			return null; +		} +	} + +	public void remove(String key) { +		_preferences.remove(key); +	} + +	public void    flush() { +		try { +			_preferences.flush(); +		} catch (BackingStoreException ee) { +			System.err.printf("Cannot save preferences\n"); +		} +	} + +} diff --git a/altosui/AltosUSBDevice.java b/altosui/AltosUSBDevice.java index ed5f8307..3af7a7fa 100644 --- a/altosui/AltosUSBDevice.java +++ b/altosui/AltosUSBDevice.java @@ -16,7 +16,6 @@   */  package altosui; -import java.lang.*;  import java.util.*;  import libaltosJNI.*; diff --git a/altosui/AltosVoice.java b/altosui/AltosVoice.java index ab74e0b3..f84c1122 100644 --- a/altosui/AltosVoice.java +++ b/altosui/AltosVoice.java @@ -19,7 +19,6 @@ package altosui;  import com.sun.speech.freetts.Voice;  import com.sun.speech.freetts.VoiceManager; -import com.sun.speech.freetts.audio.JavaClipAudioPlayer;  import java.util.concurrent.LinkedBlockingQueue;  public class AltosVoice implements Runnable { diff --git a/altosui/AltosWriter.java b/altosui/AltosWriter.java index b7375204..6806c50e 100644 --- a/altosui/AltosWriter.java +++ b/altosui/AltosWriter.java @@ -17,10 +17,6 @@  package altosui; -import java.lang.*; -import java.io.*; -import java.text.*; -import java.util.*;  import org.altusmetrum.AltosLib.*; diff --git a/altosui/GrabNDrag.java b/altosui/GrabNDrag.java index c350efec..2fd6c4da 100644 --- a/altosui/GrabNDrag.java +++ b/altosui/GrabNDrag.java @@ -18,16 +18,9 @@  package altosui;  import java.awt.*; -import java.awt.image.*;  import java.awt.event.*;  import javax.swing.*;  import javax.swing.event.MouseInputAdapter; -import javax.imageio.ImageIO; -import javax.swing.table.*; -import java.io.*; -import java.util.*; -import java.text.*; -import org.altusmetrum.AltosLib.*;  class GrabNDrag extends MouseInputAdapter {  	private JComponent scroll; diff --git a/altosui/Makefile.am b/altosui/Makefile.am index 6010df58..9f03ceb6 100644 --- a/altosui/Makefile.am +++ b/altosui/Makefile.am @@ -65,6 +65,7 @@ altosui_JAVA = \  	AltosLights.java \  	AltosPad.java \  	AltosUIPreferences.java \ +	AltosUIPreferencesBackend.java \  	AltosRomconfig.java \  	AltosRomconfigUI.java \  	AltosScanUI.java \ @@ -338,4 +339,4 @@ $(WINDOWS_DIST): $(WINDOWS_FILES) altos-windows.nsi  	makensis -Oaltos-windows.log "-XOutFile $@" "-DVERSION=$(VERSION)" altos-windows.nsi  publish: -	scp launch-sites.txt gag.com:public_html
\ No newline at end of file +	scp launch-sites.txt gag.com:public_html | 
