From 382c54a0d052c8975b57c995ef83bc8934bde242 Mon Sep 17 00:00:00 2001 From: Mike Beattie Date: Fri, 14 Sep 2012 13:09:58 +1200 Subject: altosui: remove un-used imports Signed-off-by: Mike Beattie --- altosui/AltosUI.java | 7 ------- 1 file changed, 7 deletions(-) (limited to 'altosui/AltosUI.java') diff --git a/altosui/AltosUI.java b/altosui/AltosUI.java index c1a66b83..e4af6b3b 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(); -- cgit v1.2.3 From ce1b19a012a2c1c623b03efb93b881e297736718 Mon Sep 17 00:00:00 2001 From: Mike Beattie Date: Fri, 14 Sep 2012 13:13:35 +1200 Subject: altosui: comment out un-used fields and methods Signed-off-by: Mike Beattie --- altosui/AltosBTDevice.java | 2 ++ altosui/AltosConfigUI.java | 4 ++-- altosui/AltosDisplayThread.java | 2 +- altosui/AltosEepromManage.java | 4 ++-- altosui/AltosEepromSelect.java | 2 +- altosui/AltosFlashUI.java | 2 +- altosui/AltosGraphUI.java | 8 +++++--- altosui/AltosInfoTable.java | 6 +++--- altosui/AltosSiteMap.java | 10 +++++++--- altosui/AltosSiteMapPreload.java | 2 +- altosui/AltosUI.java | 4 ++-- 11 files changed, 27 insertions(+), 19 deletions(-) (limited to 'altosui/AltosUI.java') diff --git a/altosui/AltosBTDevice.java b/altosui/AltosBTDevice.java index 0866ccc8..03e7cbec 100644 --- a/altosui/AltosBTDevice.java +++ b/altosui/AltosBTDevice.java @@ -77,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/AltosConfigUI.java b/altosui/AltosConfigUI.java index 8a8f2c0e..dd34a9cf 100644 --- a/altosui/AltosConfigUI.java +++ b/altosui/AltosConfigUI.java @@ -741,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/AltosDisplayThread.java b/altosui/AltosDisplayThread.java index 299070c9..f7a1d03e 100644 --- a/altosui/AltosDisplayThread.java +++ b/altosui/AltosDisplayThread.java @@ -222,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/AltosEepromManage.java b/altosui/AltosEepromManage.java index e6739e77..b8de77da 100644 --- a/altosui/AltosEepromManage.java +++ b/altosui/AltosEepromManage.java @@ -153,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()), @@ -194,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/AltosEepromSelect.java b/altosui/AltosEepromSelect.java index dcdfcc3e..d8b8693d 100644 --- a/altosui/AltosEepromSelect.java +++ b/altosui/AltosEepromSelect.java @@ -51,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/AltosFlashUI.java b/altosui/AltosFlashUI.java index 3ccfa76c..f8c24b16 100644 --- a/altosui/AltosFlashUI.java +++ b/altosui/AltosFlashUI.java @@ -286,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/AltosGraphUI.java b/altosui/AltosGraphUI.java index e0e03093..7715eedd 100644 --- a/altosui/AltosGraphUI.java +++ b/altosui/AltosGraphUI.java @@ -22,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 { @@ -94,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"); @@ -223,11 +223,13 @@ public class AltosGraphUI extends AltosFrame return createGraphsWhich(data, which).get(0); } + /* private static ArrayList createGraphs( Iterable data) { return createGraphsWhich(data, -1); } + */ private static ArrayList createGraphsWhich( Iterable data, int which) diff --git a/altosui/AltosInfoTable.java b/altosui/AltosInfoTable.java index c4f42125..d578f2d2 100644 --- a/altosui/AltosInfoTable.java +++ b/altosui/AltosInfoTable.java @@ -85,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); @@ -184,7 +184,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/AltosSiteMap.java b/altosui/AltosSiteMap.java index d928dd5c..3ea4d0fd 100644 --- a/altosui/AltosSiteMap.java +++ b/altosui/AltosSiteMap.java @@ -52,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) @@ -99,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 mapTiles = new ConcurrentHashMap(); Point2D.Double centre; @@ -181,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++) { @@ -417,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/AltosSiteMapPreload.java b/altosui/AltosSiteMapPreload.java index 35f730e3..33849c66 100644 --- a/altosui/AltosSiteMapPreload.java +++ b/altosui/AltosSiteMapPreload.java @@ -176,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/AltosUI.java b/altosui/AltosUI.java index e4af6b3b..b5cbefe7 100644 --- a/altosui/AltosUI.java +++ b/altosui/AltosUI.java @@ -87,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); @@ -441,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 { -- cgit v1.2.3 From 08345b8909922f2ff8f9ed8b4497b9cbea6b26e9 Mon Sep 17 00:00:00 2001 From: Mike Beattie Date: Fri, 14 Sep 2012 00:53:56 +1200 Subject: altosui/altoslib: Add call to …Preferences.init() with backend object, remove static init() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mike Beattie --- altoslib/AltosPreferences.java | 6 ++---- altosui/AltosUI.java | 1 + altosui/AltosUIPreferences.java | 6 +++--- 3 files changed, 6 insertions(+), 7 deletions(-) (limited to 'altosui/AltosUI.java') diff --git a/altoslib/AltosPreferences.java b/altoslib/AltosPreferences.java index ef30f8e9..a82ea3f6 100644 --- a/altoslib/AltosPreferences.java +++ b/altoslib/AltosPreferences.java @@ -137,8 +137,8 @@ public class AltosPreferences { 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 = backend.getString(logdirPreference, null); @@ -179,8 +179,6 @@ public class AltosPreferences { AltosConvert.imperial_units = backend.getBoolean(unitsPreference, false); } - static { init(); } - public static void flush_preferences() { backend.flush(); } diff --git a/altosui/AltosUI.java b/altosui/AltosUI.java index b5cbefe7..52b6b128 100644 --- a/altosui/AltosUI.java +++ b/altosui/AltosUI.java @@ -98,6 +98,7 @@ public class AltosUI extends AltosFrame { load_library(null); + AltosUIPreferences.init(new AltosUIPreferencesBackend()); AltosUIPreferences.set_component(this); pane = getContentPane(); diff --git a/altosui/AltosUIPreferences.java b/altosui/AltosUIPreferences.java index 6e4c9097..c1087dd6 100644 --- a/altosui/AltosUIPreferences.java +++ b/altosui/AltosUIPreferences.java @@ -45,7 +45,9 @@ public class AltosUIPreferences extends AltosPreferences { /* Serial debug */ static boolean serial_debug; - public static void init() { + public static void init(AltosUIPreferencesBackend in_backend) { + super(in_backend); + font_listeners = new LinkedList(); font_size = backend.getInt(fontSizePreference, Altos.font_size_medium); @@ -57,8 +59,6 @@ public class AltosUIPreferences extends AltosPreferences { AltosLink.set_debug(serial_debug); } - static { init(); } - static void set_component(Component in_component) { component = in_component; } -- cgit v1.2.3 From f985ea055d935b10ae9ae8441fe808ba2c13c99e Mon Sep 17 00:00:00 2001 From: Mike Beattie Date: Fri, 14 Sep 2012 01:27:22 +1200 Subject: altosui: revert AltosUIPreferences init() method Signed-off-by: Mike Beattie --- altosui/AltosUI.java | 1 - altosui/AltosUIPreferences.java | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'altosui/AltosUI.java') diff --git a/altosui/AltosUI.java b/altosui/AltosUI.java index 52b6b128..b5cbefe7 100644 --- a/altosui/AltosUI.java +++ b/altosui/AltosUI.java @@ -98,7 +98,6 @@ public class AltosUI extends AltosFrame { load_library(null); - AltosUIPreferences.init(new AltosUIPreferencesBackend()); AltosUIPreferences.set_component(this); pane = getContentPane(); diff --git a/altosui/AltosUIPreferences.java b/altosui/AltosUIPreferences.java index 4ef9384d..a28c07b0 100644 --- a/altosui/AltosUIPreferences.java +++ b/altosui/AltosUIPreferences.java @@ -45,8 +45,8 @@ public class AltosUIPreferences extends AltosPreferences { /* Serial debug */ static boolean serial_debug; - public static void init(AltosUIPreferencesBackend in_backend) { - AltosPreferences.init(in_backend); + public static void init() { + AltosPreferences.init(new AltosUIPreferencesBackend()); font_listeners = new LinkedList(); @@ -59,6 +59,8 @@ public class AltosUIPreferences extends AltosPreferences { AltosLink.set_debug(serial_debug); } + static { init(); } + static void set_component(Component in_component) { component = in_component; } -- cgit v1.2.3