altosui: Use shared AltosUIFrame and AltosUIDialog
authorKeith Packard <keithp@keithp.com>
Wed, 2 Jan 2013 17:40:13 +0000 (09:40 -0800)
committerKeith Packard <keithp@keithp.com>
Wed, 2 Jan 2013 17:40:13 +0000 (09:40 -0800)
Signed-off-by: Keith Packard <keithp@keithp.com>
21 files changed:
altosui/AltosBTManage.java
altosui/AltosCSVUI.java
altosui/AltosConfigFreqUI.java
altosui/AltosConfigPyroUI.java
altosui/AltosConfigTDUI.java
altosui/AltosConfigUI.java
altosui/AltosDialog.java [deleted file]
altosui/AltosEepromMonitor.java
altosui/AltosEepromSelect.java
altosui/AltosFlashUI.java
altosui/AltosFlightUI.java
altosui/AltosFrame.java [deleted file]
altosui/AltosGraphUI.java
altosui/AltosIdleMonitorUI.java
altosui/AltosIgniteUI.java
altosui/AltosLaunchUI.java
altosui/AltosRomconfigUI.java
altosui/AltosScanUI.java
altosui/AltosSiteMapPreload.java
altosui/AltosUI.java
altosui/Makefile.am

index 9a28d72b61e4fb1879b16f9c269b3643a79f0a3a..b7b632a72bc5729438f851cbea98209a253cfc56 100644 (file)
@@ -23,8 +23,9 @@ import javax.swing.*;
 import javax.swing.plaf.basic.*;
 import java.util.*;
 import java.util.concurrent.*;
+import org.altusmetrum.altosuilib.*;
 
-public class AltosBTManage extends AltosDialog implements ActionListener, Iterable<AltosBTDevice> {
+public class AltosBTManage extends AltosUIDialog implements ActionListener, Iterable<AltosBTDevice> {
        LinkedBlockingQueue<AltosBTDevice> found_devices;
        Frame frame;
        LinkedList<ActionListener> listeners;
index 1d024086514e8161d91a46d2170a789940ac37c6..83bf16a78f0d100f4e9552c3ad7f27559d9afb4a 100644 (file)
@@ -22,9 +22,10 @@ import java.awt.event.*;
 import javax.swing.*;
 import java.io.*;
 import org.altusmetrum.AltosLib.*;
+import org.altusmetrum.altosuilib.*;
 
 public class AltosCSVUI
-       extends AltosDialog
+       extends AltosUIDialog
        implements ActionListener
 {
        JFileChooser            csv_chooser;
index 918748f7d4918ce04d8478f046b2518a22844a14..75101e3d57164f4356a97366fbfd3ae285eec155 100644 (file)
@@ -22,8 +22,9 @@ import java.awt.event.*;
 import javax.swing.*;
 import java.util.*;
 import org.altusmetrum.AltosLib.*;
+import org.altusmetrum.altosuilib.*;
 
-class AltosEditFreqUI extends AltosDialog implements ActionListener {
+class AltosEditFreqUI extends AltosUIDialog implements ActionListener {
        Frame           frame;
        JTextField      frequency;
        JTextField      description;
@@ -158,7 +159,7 @@ class AltosEditFreqUI extends AltosDialog implements ActionListener {
        }
 }
 
-public class AltosConfigFreqUI extends AltosDialog implements ActionListener {
+public class AltosConfigFreqUI extends AltosUIDialog implements ActionListener {
 
        Frame frame;
        LinkedList<ActionListener> listeners;
index 17adb15f6dd74e815e5ba835686614aeabbdfda7..5cdaf5647f3bfe7a4ba000a98c3c07f722b3f8e3 100644 (file)
@@ -22,9 +22,10 @@ import java.awt.event.*;
 import javax.swing.*;
 import javax.swing.event.*;
 import org.altusmetrum.AltosLib.*;
+import org.altusmetrum.altosuilib.*;
 
 public class AltosConfigPyroUI
-       extends AltosDialog
+       extends AltosUIDialog
        implements ItemListener, DocumentListener
 {
        AltosConfigUI   owner;
index 532a49fa1cd2b66cf98b3ff3fad930f69a40f7f9..540738439280e2268efb0b03361f497e2ef16c5f 100644 (file)
@@ -22,9 +22,10 @@ import java.awt.event.*;
 import javax.swing.*;
 import javax.swing.event.*;
 import org.altusmetrum.AltosLib.*;
+import org.altusmetrum.altosuilib.*;
 
 public class AltosConfigTDUI
-       extends AltosDialog
+       extends AltosUIDialog
        implements ActionListener, ItemListener, DocumentListener
 {
 
index 95780e2b26a0484272728a0875a39da0aea1e3a8..599ed0512bca0c869d1dc38c48ec3e98d48e8022 100644 (file)
@@ -22,9 +22,10 @@ import java.awt.event.*;
 import javax.swing.*;
 import javax.swing.event.*;
 import org.altusmetrum.AltosLib.*;
+import org.altusmetrum.altosuilib.*;
 
 public class AltosConfigUI
-       extends AltosDialog
+       extends AltosUIDialog
        implements ActionListener, ItemListener, DocumentListener, AltosConfigValues
 {
 
diff --git a/altosui/AltosDialog.java b/altosui/AltosDialog.java
deleted file mode 100644 (file)
index c2a9d6e..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * 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.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-
-class AltosDialogListener extends WindowAdapter {
-       public void windowClosing (WindowEvent e) {
-               AltosUIPreferences.unregister_ui_listener((AltosDialog) e.getWindow());
-       }
-}
-
-public class AltosDialog extends JDialog implements AltosUIListener {
-
-       public void ui_changed(String look_and_feel) {
-               SwingUtilities.updateComponentTreeUI(this);
-               this.pack();
-       }
-
-       public AltosDialog() {
-               AltosUIPreferences.register_ui_listener(this);
-               addWindowListener(new AltosDialogListener());
-       }
-
-       public AltosDialog(Frame frame, String label, boolean modal) {
-               super(frame, label, modal);
-               AltosUIPreferences.register_ui_listener(this);
-               addWindowListener(new AltosDialogListener());
-       }
-
-       public AltosDialog(Dialog dialog, String label, boolean modal) {
-               super(dialog, label, modal);
-               AltosUIPreferences.register_ui_listener(this);
-               addWindowListener(new AltosDialogListener());
-       }
-
-       public AltosDialog(Frame frame, boolean modal) {
-               super(frame, modal);
-               AltosUIPreferences.register_ui_listener(this);
-               addWindowListener(new AltosDialogListener());
-       }
-}
index 251344e9c44e4cc16c3ad2fddeadf0d07d336d36..8eae5eb841345c0202144e2c15af58d8d177af83 100644 (file)
@@ -20,8 +20,9 @@ package altosui;
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
+import org.altusmetrum.altosuilib.*;
 
-public class AltosEepromMonitor extends AltosDialog {
+public class AltosEepromMonitor extends AltosUIDialog {
 
        Container       pane;
        Box             box;
index d8b8693d8762f22f4b43232edf440df5c381f661..c08862127a56875b5c6d8e068135b4e197a452e9 100644 (file)
@@ -22,6 +22,7 @@ import javax.swing.border.*;
 import java.awt.*;
 import java.awt.event.*;
 import org.altusmetrum.AltosLib.*;
+import org.altusmetrum.altosuilib.*;
 
 class AltosEepromItem implements ActionListener {
        AltosEepromLog  log;
@@ -50,7 +51,7 @@ class AltosEepromItem implements ActionListener {
        }
 }
 
-public class AltosEepromSelect extends AltosDialog implements ActionListener {
+public class AltosEepromSelect extends AltosUIDialog implements ActionListener {
        //private JList                 list;
        private JFrame                  frame;
        JButton                         ok;
index 878150f6603646b5d897282f59ff856def46ddfc..921207bc4f399bed6ff046ae0ba9b884ab4b1c73 100644 (file)
@@ -26,7 +26,7 @@ import java.util.concurrent.*;
 import org.altusmetrum.altosuilib.*;
 
 public class AltosFlashUI
-       extends AltosDialog
+       extends AltosUIDialog
        implements ActionListener
 {
        Container       pane;
index 604ea6580103529ed6d77bcb532de8fd977ea25e..e2dc06bd97842182fc35bd3399258f22560a3bd2 100644 (file)
@@ -24,7 +24,7 @@ import java.util.concurrent.*;
 import org.altusmetrum.AltosLib.*;
 import org.altusmetrum.altosuilib.*;
 
-public class AltosFlightUI extends AltosFrame implements AltosFlightDisplay, AltosFontListener {
+public class AltosFlightUI extends AltosUIFrame implements AltosFlightDisplay, AltosFontListener {
        AltosVoice              voice;
        AltosFlightReader       reader;
        AltosDisplayThread      thread;
diff --git a/altosui/AltosFrame.java b/altosui/AltosFrame.java
deleted file mode 100644 (file)
index 731a29b..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * 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.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import java.util.*;
-
-class AltosFrameListener extends WindowAdapter {
-       public void windowClosing (WindowEvent e) {
-               AltosUIPreferences.unregister_ui_listener((AltosFrame) e.getWindow());
-       }
-}
-
-public class AltosFrame extends JFrame implements AltosUIListener {
-
-       public void ui_changed(String look_and_feel) {
-               SwingUtilities.updateComponentTreeUI(this);
-               this.pack();
-       }
-
-       static final String[] icon_names = {
-               "/altus-metrum-16.png",
-               "/altus-metrum-32.png",
-               "/altus-metrum-48.png",
-               "/altus-metrum-64.png",
-               "/altus-metrum-128.png",
-               "/altus-metrum-256.png"
-       };
-
-       public void set_icon() {
-               ArrayList<Image> icons = new ArrayList<Image>();
-               
-               for (int i = 0; i < icon_names.length; i++) {
-                       java.net.URL imgURL = AltosUI.class.getResource(icon_names[i]);
-                       if (imgURL != null)
-                               icons.add(new ImageIcon(imgURL).getImage());
-               }
-
-               setIconImages(icons);
-       }
-                       
-       public AltosFrame() {
-               AltosUIPreferences.register_ui_listener(this);
-               addWindowListener(new AltosFrameListener());
-               set_icon();
-       }
-
-       public AltosFrame(String name) {
-               super(name);
-               AltosUIPreferences.register_ui_listener(this);
-               addWindowListener(new AltosFrameListener());
-               set_icon();
-       }
-}
index b7c2e92e74c07ea3cad46cba633e71f88fe5bc71..d6891ffa04d33e7bb719b4cbd449700b582deddd 100644 (file)
@@ -10,12 +10,13 @@ import java.util.ArrayList;
 import java.awt.*;
 import javax.swing.*;
 import org.altusmetrum.AltosLib.*;
+import org.altusmetrum.altosuilib.*;
 
 import org.jfree.chart.ChartPanel;
 import org.jfree.chart.JFreeChart;
 import org.jfree.ui.RefineryUtilities;
 
-public class AltosGraphUI extends AltosFrame 
+public class AltosGraphUI extends AltosUIFrame 
 {
     JTabbedPane        pane;
 
index 6d3450b6a4302aa9744c5f356595d3a5b6309128..1b3dd5470a0e9b4ec951721e2ace1d43c31d004e 100644 (file)
@@ -25,7 +25,7 @@ import java.util.concurrent.*;
 import org.altusmetrum.AltosLib.*;
 import org.altusmetrum.altosuilib.*;
 
-public class AltosIdleMonitorUI extends AltosFrame implements AltosFlightDisplay, AltosFontListener, AltosIdleMonitorListener {
+public class AltosIdleMonitorUI extends AltosUIFrame implements AltosFlightDisplay, AltosFontListener, AltosIdleMonitorListener {
        AltosDevice             device;
        JTabbedPane             pane;
        AltosPad                pad;
index f1742203308eb0e2b3dac8882dcf26e13acc7010..c1378eb948f5cd0300cf86e1074782372b7ce7b7 100644 (file)
@@ -27,7 +27,7 @@ import org.altusmetrum.AltosLib.*;
 import org.altusmetrum.altosuilib.*;
 
 public class AltosIgniteUI
-       extends AltosDialog
+       extends AltosUIDialog
        implements ActionListener
 {
        AltosDevice     device;
index 68c978dc5e01dc4b91a50560f37032c8d9ce020d..7e7ed010af487dc5dce5ebac84f06af076adce65 100644 (file)
@@ -46,7 +46,7 @@ class FireButton extends JButton {
 }
 
 public class AltosLaunchUI
-       extends AltosDialog
+       extends AltosUIDialog
        implements ActionListener
 {
        AltosDevice     device;
index d4a5ef6dac33d65aee1407d0b905173d91ff9aed..5fc786e2f1247402aaed4cf60620abda4efbd89e 100644 (file)
@@ -20,9 +20,10 @@ package altosui;
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
+import org.altusmetrum.altosuilib.*;
 
 public class AltosRomconfigUI
-       extends AltosDialog
+       extends AltosUIDialog
        implements ActionListener
 {
        Container       pane;
index 6a8db0e05aeeb915ce9b311beaa929e3c707dce8..14b523108b2900795576a953a3b8b4fa2db23e6f 100644 (file)
@@ -122,7 +122,7 @@ class AltosScanResults extends LinkedList<AltosScanResult> implements ListModel
 }
 
 public class AltosScanUI
-       extends AltosDialog
+       extends AltosUIDialog
        implements ActionListener
 {
        AltosUI                         owner;
index 33849c660bb1fa12124cd0bc6f89540883defa0c..f4dcc9033f4904dae8ba4c15a66e54bb83b10c58 100644 (file)
@@ -26,6 +26,7 @@ import java.text.*;
 import java.lang.Math;
 import java.net.URL;
 import java.net.URLConnection;
+import org.altusmetrum.altosuilib.*;
 
 class AltosMapPos extends Box {
        AltosUI         owner;
@@ -205,7 +206,7 @@ class AltosSites extends Thread {
        }
 }
 
-public class AltosSiteMapPreload extends AltosDialog implements ActionListener, ItemListener {
+public class AltosSiteMapPreload extends AltosUIDialog implements ActionListener, ItemListener {
        AltosUI         owner;
        AltosSiteMap    map;
 
index a385b8b3923d4b842ac03951ce7575a436c59ea7..70142a93b5d3beeb6d7e0a8c75b8308e31800273 100644 (file)
@@ -25,7 +25,7 @@ import java.util.concurrent.*;
 import org.altusmetrum.AltosLib.*;
 import org.altusmetrum.altosuilib.*;
 
-public class AltosUI extends AltosFrame {
+public class AltosUI extends AltosUIFrame {
        public AltosVoice voice = new AltosVoice();
 
        public static boolean load_library(Frame frame) {
index 1bd98c1c2e0545d5861283ecd1f1fa059fa552a9..368233d1a98c835c224bfdc09268f6c37ab2d43a 100644 (file)
@@ -6,7 +6,7 @@ man_MANS=altosui.1
 
 altoslibdir=$(libdir)/altos
 
-CLASSPATH_ENV=mkdir -p $(JAVAROOT); CLASSPATH="./*:$(JAVAROOT):../libaltos:$(JCOMMON)/jcommon.jar:$(JFREECHART)/jfreechart.jar:$(FREETTS)/freetts.jar"
+CLASSPATH_ENV=mkdir -p $(JAVAROOT); CLASSPATH="$(JAVAROOT):./*:../libaltos:$(JCOMMON)/jcommon.jar:$(JFREECHART)/jfreechart.jar:$(FREETTS)/freetts.jar"
 
 bin_SCRIPTS=altosui
 
@@ -76,8 +76,6 @@ altosui_JAVA = \
        AltosSiteMapTile.java \
        AltosUI.java \
        AltosUIListener.java \
-       AltosFrame.java \
-       AltosDialog.java \
        AltosWriter.java \
        AltosDataPointReader.java \
        AltosDataPoint.java \