ASM #14946 - GFE: ZFP displaying time for office timezone for zones in different timezone
Change-Id: I082b26ffea4b228baf4f40afb019994d5fe1e7dd Former-commit-id:5b5d6fd5cd
[formerly 18ab87670fbdd007e5027553d4ee58262ae54f22] Former-commit-id:cd7212c689
This commit is contained in:
parent
9ab6bab9cf
commit
eaf241a60a
3 changed files with 72 additions and 4 deletions
|
@ -37,6 +37,7 @@ from java.io import File
|
|||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 05/29/08 njensen Initial Creation.
|
||||
# 12/10/14 #14946 ryu Add getTimeZones() function.
|
||||
#
|
||||
#
|
||||
#
|
||||
|
@ -434,6 +435,26 @@ def getVTECMessageType(productCategory):
|
|||
import VTECMessageType
|
||||
return VTECMessageType.getVTECMessageType(productCategory)
|
||||
|
||||
def getTimeZones(zones, officeTZ):
|
||||
import AreaDictionary
|
||||
timezones = []
|
||||
if zones is not None:
|
||||
for zone in JUtil.javaStringListToPylist(zones):
|
||||
area_dict = AreaDictionary.AreaDictionary.get(zone)
|
||||
if area_dict is None:
|
||||
continue
|
||||
tzs = area_dict.get("ugcTimeZone")
|
||||
if tzs is not None:
|
||||
if type(tzs) is str:
|
||||
tzs = [tzs]
|
||||
for tz in tzs:
|
||||
if tz not in timezones:
|
||||
timezones.append(tz)
|
||||
if officeTZ in timezones and officeTZ != timezones[0]:
|
||||
timezones.remove(officeTZ)
|
||||
timezones.insert(0, officeTZ)
|
||||
return JUtil.pylistToJavaStringList(timezones)
|
||||
|
||||
def reloadModule(moduleName):
|
||||
# m = __import__(moduleName)
|
||||
# reload(m)
|
||||
|
|
|
@ -161,6 +161,8 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
* 05/12/2014 16195 zhao Modified widgetSelected() for "Auto Wrap" option widget
|
||||
* 10/20/2014 #3685 randerso Made conversion to upper case conditional on product id
|
||||
* 12/01/2014 #624 zhao Modified saveFile()
|
||||
* 12/16/2014 #14946 ryu Modified updateIssueExpireTimes() so issuance time is displayed
|
||||
* for the local time zones for each segment.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -2012,15 +2014,18 @@ public class ProductEditorComp extends Composite implements
|
|||
ProductDataStruct pds = textComp.getProductDataStruct();
|
||||
|
||||
if (pds != null) {
|
||||
String officeTimeZone = dm.getParmManager()
|
||||
.compositeGridLocation()
|
||||
.getTimeZone();
|
||||
int numSegments = pds.getSegmentsArray().size();
|
||||
SimpleDateFormat fmt = new SimpleDateFormat(longLocalFmtStr);
|
||||
fmt.setTimeZone(localTimeZone);
|
||||
String issueTime = fmt.format(now).toUpperCase();
|
||||
String officeIssueTime = fmt.format(now).toUpperCase();
|
||||
|
||||
for (int i = 0; i < numSegments; i++) {
|
||||
textComp.startUpdate();
|
||||
HashMap<String, TextIndexPoints> segMap = textComp
|
||||
.getProductDataStruct().getSegmentsArray()
|
||||
HashMap<String, TextIndexPoints> segMap = pds
|
||||
.getSegmentsArray()
|
||||
.get(i).getSementMap();
|
||||
|
||||
TextIndexPoints tip = segMap.get("purgeT");
|
||||
|
@ -2041,9 +2046,32 @@ public class ProductEditorComp extends Composite implements
|
|||
// vtecs are fixed length and this is variable length,
|
||||
// which ensures we only need to reParse() once per
|
||||
// segment
|
||||
List<String> zones = decodeUGCs(pds.getSegmentsArray().get(i));
|
||||
List<String> timeZones = dm.getTextProductMgr()
|
||||
.getTimeZones(zones,
|
||||
officeTimeZone);
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String tz : timeZones) {
|
||||
String issueTime;
|
||||
if (tz.equals(officeTimeZone)) {
|
||||
issueTime = officeIssueTime;
|
||||
} else {
|
||||
fmt.setTimeZone(TimeZone.getTimeZone(tz));
|
||||
issueTime = fmt.format(now).toUpperCase();
|
||||
}
|
||||
if (sb.length() > 0) {
|
||||
sb.append(" /");
|
||||
sb.append(issueTime);
|
||||
sb.append("/");
|
||||
} else {
|
||||
sb.append(issueTime);
|
||||
}
|
||||
}
|
||||
|
||||
tip = segMap.get("nwstime");
|
||||
if (tip != null) {
|
||||
textComp.replaceText(tip, issueTime);
|
||||
textComp.replaceText(tip, sb.toString());
|
||||
}
|
||||
textComp.endUpdate();
|
||||
}
|
||||
|
|
|
@ -22,7 +22,9 @@ package com.raytheon.viz.gfe.textformatter;
|
|||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -59,6 +61,7 @@ import com.raytheon.viz.gfe.core.DataManager;
|
|||
* Jan 15, 2010 3395 ryu Fix "issued by" functionality
|
||||
* Apr 24, 2013 1936 dgilling Remove unused imports.
|
||||
* Feb 12, 2014 2591 randerso Removed reloadModule method
|
||||
* Dec 15, 2014 #14946 ryu Add getTimeZones() method.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -245,6 +248,22 @@ public class TextProductManager {
|
|||
return vtec;
|
||||
}
|
||||
|
||||
|
||||
public List<String> getTimeZones(List<String> zones,
|
||||
String officeTimeZone) {
|
||||
List<String> timeZones = Collections.emptyList();
|
||||
HashMap<String, Object> map = new HashMap<String, Object>(2);
|
||||
map.put("zones", zones);
|
||||
map.put("officeTZ", officeTimeZone);
|
||||
try {
|
||||
timeZones = (List<String>) script.execute("getTimeZones", map);
|
||||
} catch (JepException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Exception getting time zones", e);
|
||||
}
|
||||
return timeZones;
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
script.dispose();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue