summaryrefslogtreecommitdiff
path: root/altosui
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-05-12 22:47:55 -0700
committerKeith Packard <keithp@keithp.com>2014-05-12 22:47:55 -0700
commit238ddde1ffdb8521d06519306cfb76271ae552b9 (patch)
tree5bed69067dc123002af18146430017fd4d9e551f /altosui
parent8d9c79f5c162e07d57d42c6ba5825a3327a911d5 (diff)
atosui: Hide Callsign and RSSI tabs for devices without a radio
When doing Monitor Idle with EasyMini, it's nice to not put fields on the screen which won't ever have useful data in them. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui')
-rw-r--r--altosui/AltosFlightStatus.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/altosui/AltosFlightStatus.java b/altosui/AltosFlightStatus.java
index c6d75420..b467bbde 100644
--- a/altosui/AltosFlightStatus.java
+++ b/altosui/AltosFlightStatus.java
@@ -39,6 +39,11 @@ public class AltosFlightStatus extends JComponent implements AltosFlightDisplay
value.setFont(Altos.status_font);
}
+ void setVisible(boolean visible) {
+ label.setVisible(visible);
+ value.setVisible(visible);
+ }
+
public FlightValue (GridBagLayout layout, int x, String text) {
GridBagConstraints c = new GridBagConstraints();
c.insets = new Insets(5, 5, 5, 5);
@@ -66,6 +71,10 @@ public class AltosFlightStatus extends JComponent implements AltosFlightDisplay
class Call extends FlightValue {
void show(AltosState state, AltosListenerState listener_state) {
value.setText(state.callsign);
+ if (state.callsign == null)
+ setVisible(false);
+ else
+ setVisible(true);
}
public Call (GridBagLayout layout, int x) {
super (layout, x, "Callsign");
@@ -116,6 +125,10 @@ public class AltosFlightStatus extends JComponent implements AltosFlightDisplay
class RSSI extends FlightValue {
void show(AltosState state, AltosListenerState listener_state) {
value.setText(String.format("%d", state.rssi()));
+ if (state.rssi == AltosLib.MISSING)
+ setVisible(false);
+ else
+ setVisible(true);
}
public RSSI (GridBagLayout layout, int x) {
super (layout, x, "RSSI");