From 074abeb0fa28f4bd7121c1dffbf45258d13fd592 Mon Sep 17 00:00:00 2001 From: "Brian.Dyke" Date: Tue, 25 Mar 2014 13:55:54 -0400 Subject: [PATCH] OB_14.1.1-25 baseline Former-commit-id: dd2417b58b33005985f80cc83b45134132b3e5a1 --- .../viz/texteditor/TextWarningConstants.java | 23 ++++++++++++++++++- .../texteditor/dialogs/TextEditorDialog.java | 15 ++++++++---- .../texteditor/qc/TimeConsistentCheck.java | 17 ++++++++++---- .../raytheon/viz/ui/dialogs/ModeListener.java | 3 ++- 4 files changed, 47 insertions(+), 11 deletions(-) diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/TextWarningConstants.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/TextWarningConstants.java index 98b90619c7..1b6b5af59f 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/TextWarningConstants.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/TextWarningConstants.java @@ -31,7 +31,8 @@ import java.util.TimeZone; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Dec 8, 2008 1737 grichard Initial creation. - * Mar 14, 2014 DR 17175 D. Friedman Fixed Atlantic and Samoa time zones + * Mar 14, 2014 DR 17175 D. Friedman Fixed Atlantic and Samoa time zones. + * Add short name map. * * * @author grichard @@ -72,6 +73,8 @@ public final class TextWarningConstants { public static HashMap timeZoneAbbreviationMap = null; + public static HashMap timeZoneShortNameMap = null; + static { // build the abbreviation map timeZoneAbbreviationMap = new HashMap(); @@ -85,6 +88,24 @@ public final class TextWarningConstants { timeZoneAbbreviationMap.put("P", TimeZone.getTimeZone("PST8PDT")); timeZoneAbbreviationMap.put("S", TimeZone.getTimeZone("US/Samoa")); timeZoneAbbreviationMap.put("V", TimeZone.getTimeZone("America/Puerto_Rico")); + + HashMap t = timeZoneAbbreviationMap; + timeZoneShortNameMap = new HashMap(); + timeZoneShortNameMap.put("AKST", t.get("A")); + timeZoneShortNameMap.put("AKDT", t.get("A")); + timeZoneShortNameMap.put("CST", t.get("C")); + timeZoneShortNameMap.put("CDT", t.get("C")); + timeZoneShortNameMap.put("EST", t.get("E")); + timeZoneShortNameMap.put("EDT", t.get("E")); + timeZoneShortNameMap.put("CHST", t.get("G")); + timeZoneShortNameMap.put("ChST", t.get("G")); + timeZoneShortNameMap.put("HST", t.get("H")); + timeZoneShortNameMap.put("MST", t.get("m")); + timeZoneShortNameMap.put("MDT", t.get("M")); + timeZoneShortNameMap.put("PST", t.get("P")); + timeZoneShortNameMap.put("PDT", t.get("P")); + timeZoneShortNameMap.put("SST", t.get("S")); + timeZoneShortNameMap.put("AST", t.get("V")); } /** diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java index 7058adfc3e..a451ae2818 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java @@ -333,6 +333,7 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox; * 12Sep2013 DR 2249 rferrel Change Time stamp in file name created by warngen to use * simulated time. * 20Nov2013 DR 16777 D. Friedman Check if OUPRequest will work before setting ETN. + * 14Mar2014 DR 17175 D. Friedman Get correct time zone for MND header time sync. * * * @author lvenable @@ -5809,11 +5810,15 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, if (m.find()) { SimpleDateFormat headerFormat = new SimpleDateFormat( "hmm a z EEE MMM d yyyy"); - headerFormat - .setTimeZone(TextWarningConstants.timeZoneAbbreviationMap - .get(m.group(5).substring(0, 1))); - product = product.replace(m.group(1), headerFormat.format(now) - .toUpperCase()); + TimeZone tz = TextWarningConstants.timeZoneShortNameMap + .get(m.group(5)); + if (tz != null) { + headerFormat.setTimeZone(tz); + product = product.replace(m.group(1), headerFormat.format(now) + .toUpperCase()); + } else { + statusHandler.warn("Could not sync MND header time because the time zone could not be determined. Will proceed with save/send."); + } } return product; } diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/qc/TimeConsistentCheck.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/qc/TimeConsistentCheck.java index 79e45035d8..a46997cb23 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/qc/TimeConsistentCheck.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/qc/TimeConsistentCheck.java @@ -41,6 +41,7 @@ import com.raytheon.viz.texteditor.util.VtecUtil; * ------------ ---------- ----------- -------------------------- * Initial creation * Aug 25, 2011 10719 rferrel ugcPtrn now local to file. + * Mar 14, 2014 DR 17175 D. Friedman Get correct time zone from times. * * * @version 1.0 @@ -90,8 +91,12 @@ public class TimeConsistentCheck implements IQCCheck { // Event ending time (second bullet) vs Expiration m = secondBulletPtrn.matcher(body); if (m.find()) { - TimeZone timeZone = TextWarningConstants.timeZoneAbbreviationMap - .get(m.group(4).substring(0, 1)); + TimeZone timeZone = TextWarningConstants.timeZoneShortNameMap + .get(m.group(4)); + if (timeZone == null) { + errorMsg += "Could not determine time zone in second bullet"; + return errorMsg; + } int am_pm = m.group(3).equals("AM") ? Calendar.AM : Calendar.PM; int minute = Integer.parseInt(m.group(2)); int hour = Integer.parseInt(m.group(1)) == 12 ? 0 : Integer @@ -134,8 +139,12 @@ public class TimeConsistentCheck implements IQCCheck { m = thirdBulletPtrn.matcher(body); if (m.find()) { - TimeZone timeZone = TextWarningConstants.timeZoneAbbreviationMap - .get(m.group(4).substring(0, 1)); + TimeZone timeZone = TextWarningConstants.timeZoneShortNameMap + .get(m.group(4)); + if (timeZone == null) { + errorMsg += "Could not determine time zone in third bullet"; + return errorMsg; + } int am_pm = m.group(3).equals("AM") ? Calendar.AM : Calendar.PM; int minute = Integer.parseInt(m.group(2)); int hour = Integer.parseInt(m.group(1)); diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/ModeListener.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/ModeListener.java index 36b52f5360..37144f82d1 100644 --- a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/ModeListener.java +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/ModeListener.java @@ -49,6 +49,7 @@ import com.raytheon.viz.core.mode.CAVEMode; * Date Ticket# Engineer Description * ---------- ---------- ----------- -------------------------- * 12/20/07 561 Dan Fitch Initial Creation. + * 03/24/14 DR 17186 D. Friedman Do not change colors of most buttons. * * * @author Dan Fitch @@ -87,7 +88,7 @@ public class ModeListener implements PaintListener { .getStyle() & SWT.READ_ONLY) == 0)) && !(control instanceof Table) && !((control instanceof Button) && ((((Button) control) - .getStyle() & SWT.PUSH) != 0))) { + .getStyle() & (SWT.PUSH|SWT.TOGGLE|SWT.CHECK|SWT.RADIO)) != 0))) { Color back = control.getBackground(); Color fore = control.getForeground();