altosui: Don't display 0000-00-00 for missing flight log dates
authorKeith Packard <keithp@keithp.com>
Tue, 29 Mar 2011 16:39:27 +0000 (09:39 -0700)
committerKeith Packard <keithp@keithp.com>
Tue, 29 Mar 2011 16:39:27 +0000 (09:39 -0700)
With Tm/Tn not having GPS to get the current date, it's no longer
unusual to have no date for a flight log, so don't show the 0000-00-00
piece in that case.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosui/AltosEepromSelect.java

index cb71524d48dad38d04b4d7ef573c6f4c2a6c747b..0a6eec173b3eeabcba9e736aec48c712920c9e27 100644 (file)
@@ -45,8 +45,14 @@ class AltosEepromItem implements ActionListener {
        public AltosEepromItem(AltosEepromLog in_log) {
                log = in_log;
 
-               label = new JLabel(String.format("Flight #%02d - %04d-%02d-%02d",
-                                                log.flight, log.year, log.month, log.day));
+               String  text;
+               if (log.year != 0)
+                       text = String.format("Flight #%02d - %04d-%02d-%02d",
+                                            log.flight, log.year, log.month, log.day);
+               else
+                       text = String.format("Flight #%02d", log.flight);
+
+               label = new JLabel(text);
 
                download = new JCheckBox("", log.download);
                download.addActionListener(this);