From 26b60e16c984255e869300b4aeafc12dd37fbd09 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 24 Mar 2013 16:15:21 -0700 Subject: altosui/altoslib: Move more flashing code from altosui to altoslib Required a bit of refactoring to eliminate swing types from the flashing code, but nothing major. Signed-off-by: Keith Packard --- altosui/AltosFlashUI.java | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'altosui/AltosFlashUI.java') diff --git a/altosui/AltosFlashUI.java b/altosui/AltosFlashUI.java index e5176278..f4e52218 100644 --- a/altosui/AltosFlashUI.java +++ b/altosui/AltosFlashUI.java @@ -215,15 +215,30 @@ public class AltosFlashUI } } - class flash_task implements Runnable { + class flash_task implements Runnable, AltosFlashListener { AltosFlashUI ui; Thread t; AltosFlash flash; + public void position(String in_s, int in_percent) { + final String s = in_s; + final int percent = in_percent; + Runnable r = new Runnable() { + public void run() { + try { + ui.actionPerformed(new ActionEvent(this, + percent, + s)); + } catch (Exception ex) { + } + } + }; + SwingUtilities.invokeLater(r); + } + public void run () { try { - flash = new AltosFlash(ui.file, ui.debug_dongle); - flash.addActionListener(ui); + flash = new AltosFlash(ui.file, new AltosSerial(ui.debug_dongle), this); final AltosRomconfig current_config = flash.romconfig(); -- cgit v1.2.3