projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altoslib: include TimeSeries code in build
[fw/altos]
/
altosuilib
/
AltosEepromMonitorUI.java
diff --git
a/altosuilib/AltosEepromMonitorUI.java
b/altosuilib/AltosEepromMonitorUI.java
index 02c71cd97ccf424d6a3b140cf283c1d24f0c2dea..036616626bf6ad46f3604500a359fd5d0d445d87 100644
(file)
--- a/
altosuilib/AltosEepromMonitorUI.java
+++ b/
altosuilib/AltosEepromMonitorUI.java
@@
-3,7
+3,8
@@
*
* 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
*
* 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.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
@@
-15,12
+16,12
@@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altosuilib_
2
;
+package org.altusmetrum.altosuilib_
11
;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
-import org.altusmetrum.altoslib_
4
.*;
+import org.altusmetrum.altoslib_
11
.*;
public class AltosEepromMonitorUI extends AltosUIDialog implements AltosEepromMonitor {
JFrame owner;
public class AltosEepromMonitorUI extends AltosUIDialog implements AltosEepromMonitor {
JFrame owner;
@@
-34,9
+35,10
@@
public class AltosEepromMonitorUI extends AltosUIDialog implements AltosEepromMo
JLabel file_value;
JButton cancel;
JProgressBar pbar;
JLabel file_value;
JButton cancel;
JProgressBar pbar;
- int min_state, max_state;
ActionListener listener;
ActionListener listener;
+ static final int progress_max = 10000;
+
public AltosEepromMonitorUI(JFrame owner) {
super (owner, "Download Flight Data", false);
public AltosEepromMonitorUI(JFrame owner) {
super (owner, "Download Flight Data", false);
@@
-102,7
+104,7
@@
public class AltosEepromMonitorUI extends AltosUIDialog implements AltosEepromMo
pbar = new JProgressBar();
pbar.setMinimum(0);
pbar = new JProgressBar();
pbar.setMinimum(0);
- pbar.setMaximum(
1000
);
+ pbar.setMaximum(
progress_max
);
pbar.setValue(0);
pbar.setString("startup");
pbar.setStringPainted(true);
pbar.setValue(0);
pbar.setString("startup");
pbar.setStringPainted(true);
@@
-135,11
+137,6
@@
public class AltosEepromMonitorUI extends AltosUIDialog implements AltosEepromMo
listener = l;
}
listener = l;
}
- public void set_states(int min_state, int max_state) {
- this.min_state = min_state;
- this.max_state = max_state;
- }
-
public void set_thread(Thread in_eeprom_thread) {
final Thread eeprom_thread = in_eeprom_thread;
cancel.addActionListener(new ActionListener() {
public void set_thread(Thread in_eeprom_thread) {
final Thread eeprom_thread = in_eeprom_thread;
cancel.addActionListener(new ActionListener() {
@@
-154,28
+151,30
@@
public class AltosEepromMonitorUI extends AltosUIDialog implements AltosEepromMo
setVisible(true);
}
setVisible(true);
}
- private void set_value_internal(String state_name, int state, int state_block, int block) {
- if (state_block > 100)
- state_block = 100;
- if (state < min_state) state = min_state;
- if (state >= max_state) state = max_state - 1;
- state -= min_state;
+ int max_block = 1;
+
+ public void set_block_internal(int block) {
+ double pos;
+ String s;
- int pos = state * 100 + state_block;
+ pos = (double) block / (double) max_block;
+
+ s = String.format("block %d of %d", block, max_block);
+
+ pbar.setString(s);
+ pbar.setValue((int) (pos * progress_max));
+ }
- pbar.setString(String.format("block %d state %s", block, state_name));
-
pbar.setValue(pos)
;
+ public void set_max(int max_block) {
+
this.max_block = max_block
;
}
}
- public void set_value(String in_state_name, int in_state, int in_state_block, int in_block) {
- final String state_name = in_state_name;
- final int state = in_state;
- final int state_block = in_state_block;
+ public void set_block(int in_block) {
final int block = in_block;
Runnable r = new Runnable() {
public void run() {
try {
final int block = in_block;
Runnable r = new Runnable() {
public void run() {
try {
- set_
value_internal(state_name, state, state_block,
block);
+ set_
block_internal(
block);
} catch (Exception ex) {
}
}
} catch (Exception ex) {
}
}
@@
-256,7
+255,8
@@
public class AltosEepromMonitorUI extends AltosUIDialog implements AltosEepromMo
}
private void reset_internal() {
}
private void reset_internal() {
- set_value_internal("startup",min_state,0, 0);
+ set_max(1);
+ set_block_internal(0);
set_flight_internal(0);
set_filename_internal("");
}
set_flight_internal(0);
set_filename_internal("");
}