From: Keith Packard Date: Tue, 13 May 2014 05:47:55 +0000 (-0700) Subject: atosui: Hide Callsign and RSSI tabs for devices without a radio X-Git-Tag: 1.3.2.2~115 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=238ddde1ffdb8521d06519306cfb76271ae552b9;hp=8d9c79f5c162e07d57d42c6ba5825a3327a911d5;ds=sidebyside 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 --- 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");