diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/FollowupData.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/FollowupData.java index e83d22f8e9..8f9dcc32b1 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/FollowupData.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/FollowupData.java @@ -36,7 +36,7 @@ import com.raytheon.uf.common.time.util.TimeUtil; * Initial creation * May 7, 2013 1973 rferrel Changes to properly display Issue Time. * Aug 7, 2013 2243 jsanchez Set all the attributes of an AbstractWarningRecord and added an expiration string. Removed calendar object. - * + * Aug 15,2013 2243 jsanchez Improved the expiration string off by one minute. * * * @author rferrel @@ -139,9 +139,11 @@ public class FollowupData extends WarningRecord { StringBuilder rval = new StringBuilder(); long timeInMillis = SimulatedTime.getSystemTime().getMillis(); if (status != WarningAction.COR) { - // Positive means not yet expired - long diffMins = (record.getEndTime().getTimeInMillis() - timeInMillis) - / TimeUtil.MILLIS_PER_MINUTE; + // use double to keep precision until it's casted to an integer + double diffMillis = record.getEndTime().getTimeInMillis() + - timeInMillis; + int diffMins = (int) Math.round(diffMillis + / TimeUtil.MILLIS_PER_MINUTE); if (diffMins == 0) { rval.append(" Expired"); } else if (diffMins > 0) { @@ -150,8 +152,12 @@ public class FollowupData extends WarningRecord { rval.append(" Exp ").append(-diffMins).append(" min ago"); } } else { - long diffMins = (timeInMillis - record.getIssueTime() - .getTimeInMillis()) / TimeUtil.MILLIS_PER_MINUTE; + // use double to keep precision until it's casted to an integer + double diffMillis = timeInMillis + - record.getIssueTime().getTimeInMillis(); + int diffMins = (int) Math.round(diffMillis + / TimeUtil.MILLIS_PER_MINUTE); + if (diffMins == 0) { rval.append(" Just Issued"); } else { diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java index 60ccbee24d..02b319c787 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java @@ -936,6 +936,7 @@ public class WarngenDialog extends CaveSWTDialog implements // Select the previously selected item. invalidFollowUpAction = false; if (currentSelection != null) { + // isValid checks if the current selection is still in the list boolean isValid = false; for (int i = 0; i < updateListCbo.getItemCount(); i++) { if (updateListCbo.getItem(i).startsWith( @@ -954,7 +955,9 @@ public class WarngenDialog extends CaveSWTDialog implements // up option could be removed due to an action such as a CAN or an // EXP. If an action removes the follow up, then no warning message // should be displayed. - if (!timeRange.contains(SimulatedTime.getSystemTime().getTime())) { + if (!isValid + && !timeRange.contains(SimulatedTime.getSystemTime() + .getTime())) { invalidFollowUpAction = true; preventFollowUpAction(currentSelection); } diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/util/FollowUpUtil.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/util/FollowUpUtil.java index ff94f45f3b..04b3dca957 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/util/FollowUpUtil.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/util/FollowUpUtil.java @@ -32,6 +32,7 @@ import com.raytheon.viz.warngen.text.ICommonPatterns; * Mar 13, 2013 DR 15892 D. Friedman Handle SMW format in canceledAreasFromText * Aug 6, 2013 2243 jsanchez Updated the time ranges to be removed from the follow up list correctly. * Aug 13, 2013 2243 jsanchez Removed calendar object. + * Aug 15, 2013 2243 jsanchez Reset the time ranges to the correct values. * * * @@ -314,45 +315,40 @@ public class FollowUpUtil { TimeRange rval = null; - // The time ranges are offset by 1 minute so that after a refresh and on - // the final minute of the time range the follow up data will be - // removed. For example, if a CON is only a available until 5 minutes - // before a warnings expiration, when the time reaches 5 minutes the - // follow up data for a CON is correctly removed. if (action == WarningAction.NEW) { /* Calculate NEW Time Range */ start.setTime(record.getEndTime().getTime()); - start.add(Calendar.MINUTE, -21); + start.add(Calendar.MINUTE, -20); end.setTime(record.getEndTime().getTime()); - end.add(Calendar.MINUTE, 29); + end.add(Calendar.MINUTE, 30); rval = new TimeRange(start, end); } else if (action == WarningAction.COR) { /* Calculate COR Time Range */ end.setTime(record.getIssueTime().getTime()); - end.add(Calendar.MINUTE, 9); + end.add(Calendar.MINUTE, 10); rval = new TimeRange(record.getStartTime(), end); } else if (action == WarningAction.CAN) { /* Calculate CAN Time Range */ end.setTime(record.getEndTime().getTime()); - end.add(Calendar.MINUTE, -11); + end.add(Calendar.MINUTE, -10); rval = new TimeRange(record.getStartTime(), end); } else if (action == WarningAction.CON) { /* Calculate CON Time Range */ end.setTime(record.getEndTime().getTime()); - end.add(Calendar.MINUTE, -6); + end.add(Calendar.MINUTE, -5); rval = new TimeRange(record.getStartTime(), end); } else if (action == WarningAction.EXP) { /* Calculate EXP Time Range */ start.setTime(record.getEndTime().getTime()); - start.add(Calendar.MINUTE, -11); + start.add(Calendar.MINUTE, -10); end.setTime(record.getEndTime().getTime()); - end.add(Calendar.MINUTE, 9); + end.add(Calendar.MINUTE, 10); rval = new TimeRange(start, end); } else if (action == WarningAction.EXT) { /* Calculate EXT Time Range */ start.setTime(record.getStartTime().getTime()); end.setTime(record.getEndTime().getTime()); - end.add(Calendar.MINUTE, -6); + end.add(Calendar.MINUTE, -5); rval = new TimeRange(start, end); }