Omaha #3220 - Corrected area configuration managers for Fog, SAFESEAS and SNOW monitors.

Former-commit-id: 5fb653e5c7f7ffff1daf53487147597a569d7d11
This commit is contained in:
Slav Korolev 2014-10-16 14:00:31 -04:00
parent 887b47cda1
commit 9c369a9c5c
24 changed files with 807 additions and 753 deletions

View file

@ -89,6 +89,7 @@ import com.vividsolutions.jts.geom.Geometry;
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method. * Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
* Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea. * Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea.
* Sep 23, 2014 3356 njensen Remove unnecessary import * Sep 23, 2014 3356 njensen Remove unnecessary import
* Oct 16, 2014 3220 skorolev Corrected fogConfig assignment.
* *
* *
* </pre> * </pre>
@ -160,7 +161,7 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
*/ */
private FogMonitor() { private FogMonitor() {
pluginPatterns.add(fogPattern); pluginPatterns.add(fogPattern);
fogConfig = new FSSObsMonitorConfigurationManager(MonName.fog.name()); fogConfig = FSSObsMonitorConfigurationManager.getFogObsManager();
updateMonitoringArea(); updateMonitoringArea();
initObserver(OBS, this); initObserver(OBS, this);
obData = new ObMultiHrsReports(CommonConfig.AppName.FOG); obData = new ObMultiHrsReports(CommonConfig.AppName.FOG);
@ -650,5 +651,4 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
} }
MonitoringArea.setPlatformMap(zones); MonitoringArea.setPlatformMap(zones);
} }
} }

View file

@ -22,7 +22,6 @@ package com.raytheon.uf.viz.monitor.fog.threshold;
import java.util.ArrayList; import java.util.ArrayList;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey; import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr; import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
@ -42,6 +41,7 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.FogMonitor;
* Feb 03, 2014 #2757 skorolev Fixed reInitialize() * Feb 03, 2014 #2757 skorolev Fixed reInitialize()
* May 20, 2014 3086 skorolev Cleaned code. * May 20, 2014 3086 skorolev Cleaned code.
* Sep 04, 2014 3220 skorolev Removed "site". * Sep 04, 2014 3220 skorolev Removed "site".
* Oct 16, 2014 3220 skorolev Corrected areaConfigMgr assignment.
* *
* </pre> * </pre>
* *
@ -61,8 +61,7 @@ public class FogThresholdMgr extends AbstractThresholdMgr {
super("DefaultFogDisplayThresholds.xml", super("DefaultFogDisplayThresholds.xml",
"DefaultFogMonitorThresholds.xml", AppName.FOG.name() "DefaultFogMonitorThresholds.xml", AppName.FOG.name()
.toLowerCase()); .toLowerCase());
areaConfigMgr = new FSSObsMonitorConfigurationManager( areaConfigMgr = FSSObsMonitorConfigurationManager.getFogObsManager();
MonName.fog.name());
init(); init();
} }
@ -75,7 +74,6 @@ public class FogThresholdMgr extends AbstractThresholdMgr {
if (classInstance == null) { if (classInstance == null) {
classInstance = new FogThresholdMgr(); classInstance = new FogThresholdMgr();
} }
return classInstance; return classInstance;
} }
@ -118,20 +116,4 @@ public class FogThresholdMgr extends AbstractThresholdMgr {
} }
return threshKeys; return threshKeys;
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr#
* getMonitorAreaConfigInstance()
*/
@Override
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
if (areaConfigMgr == null) {
areaConfigMgr = new FSSObsMonitorConfigurationManager(
MonName.fog.name());
}
return areaConfigMgr;
}
} }

View file

@ -48,6 +48,7 @@ import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- ------------- * ------------ ---------- ----------- -------------
* May 21, 2014 3086 skorolev Cleaned code. * May 21, 2014 3086 skorolev Cleaned code.
* Oct 16, 2014 3220 skorolev Added condition to avoid NPE.
* *
* </pre> * </pre>
* *
@ -178,22 +179,23 @@ public class FogMonitorMeteoTab extends TabItemComp implements
ThresholdsXML threshXML = ftm.getThresholdsXmlData(duKey); ThresholdsXML threshXML = ftm.getThresholdsXmlData(duKey);
List<AreaXML> areasArray = threshXML.getAreas(); List<AreaXML> areasArray = threshXML.getAreas();
if (areasArray != null) {
for (AreaXML area : areasArray) {
String areaID = area.getAreaId();
FogMonitorMeteoData fmmd = new FogMonitorMeteoData();
fmmd.setAreaID(areaID);
for (AreaXML area : areasArray) { /*
String areaID = area.getAreaId(); * Visibility
FogMonitorMeteoData fmmd = new FogMonitorMeteoData(); */
fmmd.setAreaID(areaID); String xmlKey = FogMonitor.FOG_MONITOR_METEO_VIS.getXmlKey();
fmmd.setMeteoVisR(ftm.getThresholdValue(duKey, threshKeyR,
areaID, xmlKey));
fmmd.setMeteoVisY(ftm.getThresholdValue(duKey, threshKeyY,
areaID, xmlKey));
/* fogDataArray.add(fmmd);
* Visibility }
*/
String xmlKey = FogMonitor.FOG_MONITOR_METEO_VIS.getXmlKey();
fmmd.setMeteoVisR(ftm.getThresholdValue(duKey, threshKeyR, areaID,
xmlKey));
fmmd.setMeteoVisY(ftm.getThresholdValue(duKey, threshKeyY, areaID,
xmlKey));
fogDataArray.add(fmmd);
} }
} }

View file

@ -24,7 +24,6 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey; import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
@ -49,6 +48,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Apr 28, 2014 3086 skorolev Updated getConfigManager. * Apr 28, 2014 3086 skorolev Updated getConfigManager.
* Sep 04, 2014 3220 skorolev Added fireConfigUpdateEvent method. Updated handler. * Sep 04, 2014 3220 skorolev Added fireConfigUpdateEvent method. Updated handler.
* Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons. * Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons.
* Oct 16, 2014 3220 skorolev Corrected getInstance() method.
* *
* *
* </pre> * </pre>
@ -150,11 +150,7 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
*/ */
@Override @Override
protected FSSObsMonitorConfigurationManager getInstance() { protected FSSObsMonitorConfigurationManager getInstance() {
if (configMgr == null) { return FSSObsMonitorConfigurationManager.getFogObsManager();
configMgr = new FSSObsMonitorConfigurationManager(
MonName.fog.name());
}
return configMgr;
} }
/* /*

View file

@ -28,7 +28,6 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey; import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
import com.raytheon.uf.common.monitor.data.ObConst.DisplayVarName; import com.raytheon.uf.common.monitor.data.ObConst.DisplayVarName;
@ -60,6 +59,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg;
* Dec 7, 2012 1351 skorolev Changes for non-blocking dialogs. * Dec 7, 2012 1351 skorolev Changes for non-blocking dialogs.
* Apr 28, 2014 3086 skorolev Updated getConfigMgr method. * Apr 28, 2014 3086 skorolev Updated getConfigMgr method.
* Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose. * Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose.
* Oct 16, 2014 3220 skorolev Corrected configMgr assignment.
* *
* </pre> * </pre>
* *
@ -79,6 +79,7 @@ public class FogZoneTableDlg extends ZoneTableDlg {
*/ */
public FogZoneTableDlg(Shell parent, ObMultiHrsReports obData) { public FogZoneTableDlg(Shell parent, ObMultiHrsReports obData) {
super(parent, obData, CommonConfig.AppName.FOG); super(parent, obData, CommonConfig.AppName.FOG);
configMgr = FSSObsMonitorConfigurationManager.getFogObsManager();
} }
/** /**
@ -294,19 +295,4 @@ public class FogZoneTableDlg extends ZoneTableDlg {
protected void shellDisposeAction() { protected void shellDisposeAction() {
// Not used // Not used
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg#
* getMonitorAreaConfigInstance()
*/
@Override
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
if (configMgr == null || configMgr.isPopulated()) {
configMgr = new FSSObsMonitorConfigurationManager(
MonName.fog.name());
}
return configMgr;
}
} }

View file

@ -37,7 +37,6 @@ import com.raytheon.uf.common.dataplugin.fog.FogRecord.FOG_THREAT;
import com.raytheon.uf.common.geospatial.SpatialException; import com.raytheon.uf.common.geospatial.SpatialException;
import com.raytheon.uf.common.monitor.MonitorAreaUtils; import com.raytheon.uf.common.monitor.MonitorAreaUtils;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.AdjacentWfoMgr; import com.raytheon.uf.common.monitor.data.AdjacentWfoMgr;
import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
@ -87,6 +86,7 @@ import com.vividsolutions.jts.geom.Geometry;
* Feb 15, 2013 1638 mschenke Changed code to reference DataURI.SEPARATOR instead of URIFilter * Feb 15, 2013 1638 mschenke Changed code to reference DataURI.SEPARATOR instead of URIFilter
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method. * Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
* Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea. * Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea.
* Oct 16, 2014 3220 skorolev Corrected ssAreaConfig assignment.
* *
* </pre> * </pre>
* *
@ -161,7 +161,7 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
*/ */
private SafeSeasMonitor() { private SafeSeasMonitor() {
pluginPatterns.add(ssPattern); pluginPatterns.add(ssPattern);
ssAreaConfig = new FSSObsMonitorConfigurationManager(MonName.ss.name()); ssAreaConfig = FSSObsMonitorConfigurationManager.getSsObsManager();
updateMonitoringArea(); updateMonitoringArea();
initObserver(OBS, this); initObserver(OBS, this);
obData = new ObMultiHrsReports(CommonConfig.AppName.SAFESEAS); obData = new ObMultiHrsReports(CommonConfig.AppName.SAFESEAS);
@ -685,5 +685,4 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
} }
MonitoringArea.setPlatformMap(zones); MonitoringArea.setPlatformMap(zones);
} }
} }

View file

@ -22,7 +22,6 @@ package com.raytheon.uf.viz.monitor.safeseas.threshold;
import java.util.ArrayList; import java.util.ArrayList;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey; import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr; import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
@ -42,6 +41,7 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SafeSeasMonitor;
* Feb 03, 2014 #2757 skorolev Fixed reInitialize(). * Feb 03, 2014 #2757 skorolev Fixed reInitialize().
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method. * Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
* Sep 04, 2014 3220 skorolev Removed "site". * Sep 04, 2014 3220 skorolev Removed "site".
* Oct 16, 2014 3220 skorolev Corrected areaConfigMgr assignment.
* *
* </pre> * </pre>
* *
@ -59,7 +59,7 @@ public class SSThresholdMgr extends AbstractThresholdMgr {
super("DefaultSSDisplayThresholds.xml", super("DefaultSSDisplayThresholds.xml",
"DefaultSSMonitorThresholds.xml", AppName.SAFESEAS.name() "DefaultSSMonitorThresholds.xml", AppName.SAFESEAS.name()
.toLowerCase()); .toLowerCase());
areaConfigMgr = new FSSObsMonitorConfigurationManager(MonName.ss.name()); areaConfigMgr = FSSObsMonitorConfigurationManager.getSsObsManager();
init(); init();
} }
@ -113,19 +113,4 @@ public class SSThresholdMgr extends AbstractThresholdMgr {
} }
return threshKeys; return threshKeys;
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr#
* getMonitorAreaConfigInstance()
*/
@Override
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
if (areaConfigMgr == null) {
areaConfigMgr = new FSSObsMonitorConfigurationManager(
MonName.ss.name());
}
return areaConfigMgr;
}
} }

View file

@ -47,28 +47,27 @@ import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Sep 17, 2014 2757 skorolev Removed unnecessary printouts. * Sep 17, 2014 2757 skorolev Removed unnecessary printouts.
* Oct 16, 2014 3220 skorolev Added condition to avoid NPE.
* *
* </pre> * </pre>
* *
* @author skorolev * @author skorolev
* @version 1.0 * @version 1.0
*/ */
public class SSMonitorMeteoTab extends TabItemComp implements IUpdateMonitorMeteo public class SSMonitorMeteoTab extends TabItemComp implements
{ IUpdateMonitorMeteo {
private SSMonitorMeteoEditDlg monitorMeteoEditDlg; private SSMonitorMeteoEditDlg monitorMeteoEditDlg;
private ArrayList<String> areaIDArray; private ArrayList<String> areaIDArray;
private ArrayList<SSMonitorMeteoData> ssDataArray; private ArrayList<SSMonitorMeteoData> ssDataArray;
public SSMonitorMeteoTab(TabFolder parent, DataUsageKey duKey) public SSMonitorMeteoTab(TabFolder parent, DataUsageKey duKey) {
{
super(parent, duKey); super(parent, duKey);
} }
@Override @Override
protected void createListHeader(Composite parentComp) protected void createListHeader(Composite parentComp) {
{
Composite lblComp = new Composite(parentComp, SWT.NONE); Composite lblComp = new Composite(parentComp, SWT.NONE);
GridLayout gl = new GridLayout(5, false); GridLayout gl = new GridLayout(5, false);
gl.horizontalSpacing = 0; gl.horizontalSpacing = 0;
@ -95,16 +94,13 @@ public class SSMonitorMeteoTab extends TabItemComp implements IUpdateMonitorMete
} }
@Override @Override
protected void populateList() protected void populateList() {
{ if (ssDataArray == null) {
if (ssDataArray == null)
{
createDataArray(); createDataArray();
} }
boolean update = false; boolean update = false;
if (dataList.getItemCount() > 0) if (dataList.getItemCount() > 0) {
{
update = true; update = true;
} }
@ -120,8 +116,7 @@ public class SSMonitorMeteoTab extends TabItemComp implements IUpdateMonitorMete
StringBuilder sb = null; StringBuilder sb = null;
SSMonitorMeteoData ssmmd = null; SSMonitorMeteoData ssmmd = null;
for (int i = 0; i < ssDataArray.size(); i++) for (int i = 0; i < ssDataArray.size(); i++) {
{
sb = new StringBuilder(); sb = new StringBuilder();
ssmmd = ssDataArray.get(i); ssmmd = ssDataArray.get(i);
@ -155,11 +150,11 @@ public class SSMonitorMeteoTab extends TabItemComp implements IUpdateMonitorMete
* Visibility * Visibility
*/ */
visVal = ssmmd.getVisR(); visVal = ssmmd.getVisR();
tmpVisStr = rangeUtil.getVisString((int)visVal); tmpVisStr = rangeUtil.getVisString((int) visVal);
sb.append(String.format(dataFmt, tmpVisStr)); sb.append(String.format(dataFmt, tmpVisStr));
visVal = ssmmd.getVisY(); visVal = ssmmd.getVisY();
tmpVisStr = rangeUtil.getVisString((int)visVal); tmpVisStr = rangeUtil.getVisString((int) visVal);
sb.append(String.format(dataFmt, tmpVisStr)); sb.append(String.format(dataFmt, tmpVisStr));
/* /*
@ -167,12 +162,9 @@ public class SSMonitorMeteoTab extends TabItemComp implements IUpdateMonitorMete
*/ */
sb.append(" "); sb.append(" ");
if (update == true) if (update == true) {
{
dataList.setItem(i, sb.toString()); dataList.setItem(i, sb.toString());
} } else {
else
{
dataList.add(sb.toString()); dataList.add(sb.toString());
} }
} }
@ -180,8 +172,7 @@ public class SSMonitorMeteoTab extends TabItemComp implements IUpdateMonitorMete
packListControls(); packListControls();
} }
private void createDataArray() private void createDataArray() {
{
ssDataArray = new ArrayList<SSMonitorMeteoData>(); ssDataArray = new ArrayList<SSMonitorMeteoData>();
SSThresholdMgr sstm = SSThresholdMgr.getInstance(); SSThresholdMgr sstm = SSThresholdMgr.getInstance();
@ -193,69 +184,79 @@ public class SSMonitorMeteoTab extends TabItemComp implements IUpdateMonitorMete
ArrayList<AreaXML> areasArray = threshXML.getAreas(); ArrayList<AreaXML> areasArray = threshXML.getAreas();
for (AreaXML area : areasArray) if (areasArray != null) {
{ for (AreaXML area : areasArray) {
areaID = area.getAreaId(); areaID = area.getAreaId();
SSMonitorMeteoData ssmmd = new SSMonitorMeteoData(); SSMonitorMeteoData ssmmd = new SSMonitorMeteoData();
ssmmd.setAreaID(areaID); ssmmd.setAreaID(areaID);
/* /*
* Wind Speed * Wind Speed
*/ */
xmlKey = SafeSeasMonitor.SS_MON_METEO_WIND_SPEED.getXmlKey(); xmlKey = SafeSeasMonitor.SS_MON_METEO_WIND_SPEED.getXmlKey();
ssmmd.setWindSpeedR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey)); ssmmd.setWindSpeedR(sstm.getThresholdValue(duKey, threshKeyR,
ssmmd.setWindSpeedY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey)); areaID, xmlKey));
ssmmd.setWindSpeedY(sstm.getThresholdValue(duKey, threshKeyY,
areaID, xmlKey));
/* /*
* Peak Wind * Peak Wind
*/ */
xmlKey = SafeSeasMonitor.SS_MON_METEO_PEAK_WIND.getXmlKey(); xmlKey = SafeSeasMonitor.SS_MON_METEO_PEAK_WIND.getXmlKey();
ssmmd.setPeakWindR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey)); ssmmd.setPeakWindR(sstm.getThresholdValue(duKey, threshKeyR,
ssmmd.setPeakWindY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey)); areaID, xmlKey));
ssmmd.setPeakWindY(sstm.getThresholdValue(duKey, threshKeyY,
areaID, xmlKey));
/* /*
* Gust Speed * Gust Speed
*/ */
xmlKey = SafeSeasMonitor.SS_MON_METEO_GUST_SPEED.getXmlKey(); xmlKey = SafeSeasMonitor.SS_MON_METEO_GUST_SPEED.getXmlKey();
ssmmd.setGustSpeedR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey)); ssmmd.setGustSpeedR(sstm.getThresholdValue(duKey, threshKeyR,
ssmmd.setGustSpeedY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey)); areaID, xmlKey));
ssmmd.setGustSpeedY(sstm.getThresholdValue(duKey, threshKeyY,
areaID, xmlKey));
/* /*
* Wave Height * Wave Height
*/ */
xmlKey = SafeSeasMonitor.SS_MON_METEO_WAVE_HT.getXmlKey(); xmlKey = SafeSeasMonitor.SS_MON_METEO_WAVE_HT.getXmlKey();
ssmmd.setWaveHgtR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey)); ssmmd.setWaveHgtR(sstm.getThresholdValue(duKey, threshKeyR,
ssmmd.setWaveHgtY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey)); areaID, xmlKey));
ssmmd.setWaveHgtY(sstm.getThresholdValue(duKey, threshKeyY,
areaID, xmlKey));
/* /*
* Visibility * Visibility
*/ */
xmlKey = SafeSeasMonitor.SS_MON_METEO_VIS.getXmlKey(); xmlKey = SafeSeasMonitor.SS_MON_METEO_VIS.getXmlKey();
ssmmd.setVisR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey)); ssmmd.setVisR(sstm.getThresholdValue(duKey, threshKeyR, areaID,
ssmmd.setVisY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey)); xmlKey));
ssmmd.setVisY(sstm.getThresholdValue(duKey, threshKeyY, areaID,
xmlKey));
/*
* Add data to array.
*/
ssDataArray.add(ssmmd);
}
} else {
/*
* Add data to array.
*/
ssDataArray.add(ssmmd);
} }
} }
private SSMonitorMeteoData getDataAtFirstSelection() private SSMonitorMeteoData getDataAtFirstSelection() {
{
int index = dataList.getSelectionIndex(); int index = dataList.getSelectionIndex();
return ssDataArray.get(index); return ssDataArray.get(index);
} }
private void updateDataArray(SSMonitorMeteoData ssmmd) private void updateDataArray(SSMonitorMeteoData ssmmd) {
{
int[] dataListIndexes = dataList.getSelectionIndices(); int[] dataListIndexes = dataList.getSelectionIndices();
int currentIndex = 0; int currentIndex = 0;
for (int i = 0; i < dataListIndexes.length; i++) for (int i = 0; i < dataListIndexes.length; i++) {
{
currentIndex = dataListIndexes[i]; currentIndex = dataListIndexes[i];
ssDataArray.get(currentIndex).updateData(ssmmd); ssDataArray.get(currentIndex).updateData(ssmmd);
@ -263,57 +264,64 @@ public class SSMonitorMeteoTab extends TabItemComp implements IUpdateMonitorMete
} }
@Override @Override
public void commitDataToXML() public void commitDataToXML() {
{
SSThresholdMgr sstm = SSThresholdMgr.getInstance(); SSThresholdMgr sstm = SSThresholdMgr.getInstance();
String xmlKey; String xmlKey;
String areaID; String areaID;
for (SSMonitorMeteoData ssmmd : ssDataArray) for (SSMonitorMeteoData ssmmd : ssDataArray) {
{
areaID = ssmmd.getAreaID(); areaID = ssmmd.getAreaID();
/* /*
* Wind Speed * Wind Speed
*/ */
xmlKey = SafeSeasMonitor.SS_MON_METEO_WIND_SPEED.getXmlKey(); xmlKey = SafeSeasMonitor.SS_MON_METEO_WIND_SPEED.getXmlKey();
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, ssmmd.getWindSpeedR()); sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, ssmmd.getWindSpeedY()); ssmmd.getWindSpeedR());
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
ssmmd.getWindSpeedY());
/* /*
* Peak Wind * Peak Wind
*/ */
xmlKey = SafeSeasMonitor.SS_MON_METEO_PEAK_WIND.getXmlKey(); xmlKey = SafeSeasMonitor.SS_MON_METEO_PEAK_WIND.getXmlKey();
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, ssmmd.getPeakWindR()); sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, ssmmd.getPeakWindY()); ssmmd.getPeakWindR());
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
ssmmd.getPeakWindY());
/* /*
* Gust Speed * Gust Speed
*/ */
xmlKey = SafeSeasMonitor.SS_MON_METEO_GUST_SPEED.getXmlKey(); xmlKey = SafeSeasMonitor.SS_MON_METEO_GUST_SPEED.getXmlKey();
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, ssmmd.getGustSpeedR()); sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, ssmmd.getGustSpeedY()); ssmmd.getGustSpeedR());
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
ssmmd.getGustSpeedY());
/* /*
* Wave Height * Wave Height
*/ */
xmlKey = SafeSeasMonitor.SS_MON_METEO_WAVE_HT.getXmlKey(); xmlKey = SafeSeasMonitor.SS_MON_METEO_WAVE_HT.getXmlKey();
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, ssmmd.getWaveHgtR()); sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, ssmmd.getWaveHgtY()); ssmmd.getWaveHgtR());
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
ssmmd.getWaveHgtY());
/* /*
* Visibility * Visibility
*/ */
xmlKey = SafeSeasMonitor.SS_MON_METEO_VIS.getXmlKey(); xmlKey = SafeSeasMonitor.SS_MON_METEO_VIS.getXmlKey();
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, ssmmd.getVisR()); sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, ssmmd.getVisY()); ssmmd.getVisR());
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
ssmmd.getVisY());
} }
} }
@Override @Override
public void reloadData() public void reloadData() {
{
dataList.removeAll(); dataList.removeAll();
ssDataArray.clear(); ssDataArray.clear();
ssDataArray = null; ssDataArray = null;
@ -322,23 +330,19 @@ public class SSMonitorMeteoTab extends TabItemComp implements IUpdateMonitorMete
} }
@Override @Override
protected void editDataAction() protected void editDataAction() {
{
SSMonitorMeteoData ssmmd = getDataAtFirstSelection(); SSMonitorMeteoData ssmmd = getDataAtFirstSelection();
if (monitorMeteoEditDlg == null) if (monitorMeteoEditDlg == null) {
{ monitorMeteoEditDlg = new SSMonitorMeteoEditDlg(getParent()
monitorMeteoEditDlg = new SSMonitorMeteoEditDlg(getParent().getShell(), ssmmd, this); .getShell(), ssmmd, this);
monitorMeteoEditDlg.open(); monitorMeteoEditDlg.open();
monitorMeteoEditDlg = null; monitorMeteoEditDlg = null;
} }
} }
@Override @Override
public void updateThresholdData(SSMonitorMeteoData ssmmd) public void updateThresholdData(SSMonitorMeteoData ssmmd) {
{
updateDataArray(ssmmd); updateDataArray(ssmmd);
populateList(); populateList();
} }

View file

@ -36,22 +36,43 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SafeSeasMonitor;
import com.raytheon.uf.viz.monitor.xml.AreaXML; import com.raytheon.uf.viz.monitor.xml.AreaXML;
import com.raytheon.uf.viz.monitor.xml.ThresholdsXML; import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
public class SSMonitorSwellTab extends TabItemComp implements IUpdateDisplayMonitorSwell /**
{ * SAFESEAS Monitor Swell Table.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 16, 2014 3220 skorolev Added condition to avoid NPE.
*
* </pre>
*
* @author
* @version 1.0
*/
public class SSMonitorSwellTab extends TabItemComp implements
IUpdateDisplayMonitorSwell {
private SSDispMonSwellEditDlg monitorSwellEditDlg; private SSDispMonSwellEditDlg monitorSwellEditDlg;
private ArrayList<String> areaIDArray; private ArrayList<String> areaIDArray;
private ArrayList<SSDispMonSwellData> ssDataArray; private ArrayList<SSDispMonSwellData> ssDataArray;
public SSMonitorSwellTab(TabFolder parent, DataUsageKey duKey) public SSMonitorSwellTab(TabFolder parent, DataUsageKey duKey) {
{
super(parent, duKey, true); super(parent, duKey, true);
} }
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#createListHeader(org
* .eclipse.swt.widgets.Composite)
*/
@Override @Override
protected void createListHeader(Composite parentComp) protected void createListHeader(Composite parentComp) {
{
Composite lblComp = new Composite(parentComp, SWT.NONE); Composite lblComp = new Composite(parentComp, SWT.NONE);
GridLayout gl = new GridLayout(5, false); GridLayout gl = new GridLayout(5, false);
gl.horizontalSpacing = 0; gl.horizontalSpacing = 0;
@ -69,7 +90,8 @@ public class SSMonitorSwellTab extends TabItemComp implements IUpdateDisplayMoni
/* /*
* Primary Swell * Primary Swell
*/ */
Composite priSwellComp = createGroupComposite(lblComp, 4, "Primary Swell"); Composite priSwellComp = createGroupComposite(lblComp, 4,
"Primary Swell");
createLabelComp(priSwellComp, "Height(ft)", "", false); createLabelComp(priSwellComp, "Height(ft)", "", false);
createLabelComp(priSwellComp, "Periods(s)", "", false); createLabelComp(priSwellComp, "Periods(s)", "", false);
createLabelComp(priSwellComp, "Dir(deg)", "(from)", false); createLabelComp(priSwellComp, "Dir(deg)", "(from)", false);
@ -78,24 +100,27 @@ public class SSMonitorSwellTab extends TabItemComp implements IUpdateDisplayMoni
/* /*
* Secondary Swell * Secondary Swell
*/ */
Composite secSwellComp = createGroupComposite(lblComp, 4, "Secondary Swell"); Composite secSwellComp = createGroupComposite(lblComp, 4,
"Secondary Swell");
createLabelComp(secSwellComp, "Height(ft)", "", false); createLabelComp(secSwellComp, "Height(ft)", "", false);
createLabelComp(secSwellComp, "Periods(s)", "", false); createLabelComp(secSwellComp, "Periods(s)", "", false);
createLabelComp(secSwellComp, "Dir(deg)", "(from)", false); createLabelComp(secSwellComp, "Dir(deg)", "(from)", false);
createLabelComp(secSwellComp, "Dir(deg)", "(to)", false); createLabelComp(secSwellComp, "Dir(deg)", "(to)", false);
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#populateList()
*/
@Override @Override
protected void populateList() protected void populateList() {
{ if (ssDataArray == null) {
if (ssDataArray == null)
{
createDataArray(); createDataArray();
} }
boolean update = false; boolean update = false;
if (dataList.getItemCount() > 0) if (dataList.getItemCount() > 0) {
{
update = true; update = true;
} }
@ -106,8 +131,7 @@ public class SSMonitorSwellTab extends TabItemComp implements IUpdateDisplayMoni
StringBuilder sb = null; StringBuilder sb = null;
SSDispMonSwellData sssd = null; SSDispMonSwellData sssd = null;
for (int i = 0; i < ssDataArray.size(); i++) for (int i = 0; i < ssDataArray.size(); i++) {
{
sb = new StringBuilder(); sb = new StringBuilder();
sssd = ssDataArray.get(i); sssd = ssDataArray.get(i);
@ -120,56 +144,65 @@ public class SSMonitorSwellTab extends TabItemComp implements IUpdateDisplayMoni
/* /*
* Primary Swell * Primary Swell
*/ */
appendIntData(sb, sssd.getPriSwellHeightR(), sssd.getPriSwellHeightY()); appendIntData(sb, sssd.getPriSwellHeightR(),
sssd.getPriSwellHeightY());
double higherThreshold = Math.max(sssd.getPriSwellPeriodR(), sssd.getPriSwellPeriodY()); double higherThreshold = Math.max(sssd.getPriSwellPeriodR(),
double lowerThreshold = Math.min(sssd.getPriSwellPeriodR(), sssd.getPriSwellPeriodY()); sssd.getPriSwellPeriodY());
if ( rankSwellPeriodHigh ) { double lowerThreshold = Math.min(sssd.getPriSwellPeriodR(),
sssd.setRankSwellPeriodHigh(true); sssd.getPriSwellPeriodY());
sssd.setPriSwellPeriodR(higherThreshold); if (rankSwellPeriodHigh) {
sssd.setPriSwellPeriodY(lowerThreshold); sssd.setRankSwellPeriodHigh(true);
sssd.setPriSwellPeriodR(higherThreshold);
sssd.setPriSwellPeriodY(lowerThreshold);
} else { } else {
sssd.setRankSwellPeriodHigh(false); sssd.setRankSwellPeriodHigh(false);
sssd.setPriSwellPeriodR(lowerThreshold); sssd.setPriSwellPeriodR(lowerThreshold);
sssd.setPriSwellPeriodY(higherThreshold); sssd.setPriSwellPeriodY(higherThreshold);
} }
appendIntData(sb, sssd.getPriSwellPeriodR(), sssd.getPriSwellPeriodY()); appendIntData(sb, sssd.getPriSwellPeriodR(),
sssd.getPriSwellPeriodY());
appendIntData(sb, sssd.getPriSwellDirFromR(), sssd.getPriSwellDirFromY()); appendIntData(sb, sssd.getPriSwellDirFromR(),
appendIntData(sb, sssd.getPriSwellDirToR(), sssd.getPriSwellDirToY()); sssd.getPriSwellDirFromY());
appendIntData(sb, sssd.getPriSwellDirToR(),
sssd.getPriSwellDirToY());
/* /*
* Secondary Swell * Secondary Swell
*/ */
appendIntData(sb, sssd.getSecSwellHeightR(), sssd.getSecSwellHeightY()); appendIntData(sb, sssd.getSecSwellHeightR(),
sssd.getSecSwellHeightY());
higherThreshold = Math.max(sssd.getSecSwellPeriodR(), sssd.getSecSwellPeriodY()); higherThreshold = Math.max(sssd.getSecSwellPeriodR(),
lowerThreshold = Math.min(sssd.getSecSwellPeriodR(), sssd.getSecSwellPeriodY()); sssd.getSecSwellPeriodY());
if ( rankSwellPeriodHigh ) { lowerThreshold = Math.min(sssd.getSecSwellPeriodR(),
//sssd.setRankSwellPeriodHigh(true); sssd.getSecSwellPeriodY());
sssd.setSecSwellPeriodR(higherThreshold); if (rankSwellPeriodHigh) {
sssd.setSecSwellPeriodY(lowerThreshold); // sssd.setRankSwellPeriodHigh(true);
sssd.setSecSwellPeriodR(higherThreshold);
sssd.setSecSwellPeriodY(lowerThreshold);
} else { } else {
//sssd.setRankSwellPeriodHigh(false); // sssd.setRankSwellPeriodHigh(false);
sssd.setSecSwellPeriodR(lowerThreshold); sssd.setSecSwellPeriodR(lowerThreshold);
sssd.setSecSwellPeriodY(higherThreshold); sssd.setSecSwellPeriodY(higherThreshold);
} }
appendIntData(sb, sssd.getSecSwellPeriodR(), sssd.getSecSwellPeriodY()); appendIntData(sb, sssd.getSecSwellPeriodR(),
sssd.getSecSwellPeriodY());
appendIntData(sb, sssd.getSecSwellDirFromR(), sssd.getSecSwellDirFromY()); appendIntData(sb, sssd.getSecSwellDirFromR(),
appendIntData(sb, sssd.getSecSwellDirToR(), sssd.getSecSwellDirToY()); sssd.getSecSwellDirFromY());
appendIntData(sb, sssd.getSecSwellDirToR(),
sssd.getSecSwellDirToY());
/* /*
* Append a space and add the data line to the list. * Append a space and add the data line to the list.
*/ */
sb.append(" "); sb.append(" ");
if (update == true) if (update == true) {
{
dataList.setItem(i, sb.toString()); dataList.setItem(i, sb.toString());
} } else {
else
{
dataList.add(sb.toString()); dataList.add(sb.toString());
} }
} }
@ -177,8 +210,10 @@ public class SSMonitorSwellTab extends TabItemComp implements IUpdateDisplayMoni
packListControls(); packListControls();
} }
private void createDataArray() /**
{ * Create Data Array.
*/
private void createDataArray() {
ssDataArray = new ArrayList<SSDispMonSwellData>(); ssDataArray = new ArrayList<SSDispMonSwellData>();
SSThresholdMgr sstm = SSThresholdMgr.getInstance(); SSThresholdMgr sstm = SSThresholdMgr.getInstance();
@ -190,133 +225,180 @@ public class SSMonitorSwellTab extends TabItemComp implements IUpdateDisplayMoni
ArrayList<AreaXML> areasArray = threshXML.getAreas(); ArrayList<AreaXML> areasArray = threshXML.getAreas();
for (AreaXML area : areasArray) if (areasArray != null) {
{ for (AreaXML area : areasArray) {
areaID = area.getAreaId(); areaID = area.getAreaId();
SSDispMonSwellData sssd = new SSDispMonSwellData(); SSDispMonSwellData sssd = new SSDispMonSwellData();
sssd.setAreaID(areaID); sssd.setAreaID(areaID);
/* /*
* Primary Swell * Primary Swell
*/ */
xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_HT.getXmlKey(); xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_HT.getXmlKey();
sssd.setPriSwellHeightR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey)); sssd.setPriSwellHeightR(sstm.getThresholdValue(duKey,
sssd.setPriSwellHeightY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey)); threshKeyR, areaID, xmlKey));
sssd.setPriSwellHeightY(sstm.getThresholdValue(duKey,
threshKeyY, areaID, xmlKey));
xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_PD.getXmlKey(); xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_PD.getXmlKey();
sssd.setPriSwellPeriodR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey)); sssd.setPriSwellPeriodR(sstm.getThresholdValue(duKey,
sssd.setPriSwellPeriodY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey)); threshKeyR, areaID, xmlKey));
sssd.setPriSwellPeriodY(sstm.getThresholdValue(duKey,
threshKeyY, areaID, xmlKey));
xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_FROM.getXmlKey(); xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_FROM.getXmlKey();
sssd.setPriSwellDirFromR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey)); sssd.setPriSwellDirFromR(sstm.getThresholdValue(duKey,
sssd.setPriSwellDirFromY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey)); threshKeyR, areaID, xmlKey));
sssd.setPriSwellDirFromY(sstm.getThresholdValue(duKey,
threshKeyY, areaID, xmlKey));
xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_TO.getXmlKey(); xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_TO.getXmlKey();
sssd.setPriSwellDirToR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey)); sssd.setPriSwellDirToR(sstm.getThresholdValue(duKey,
sssd.setPriSwellDirToY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey)); threshKeyR, areaID, xmlKey));
sssd.setPriSwellDirToY(sstm.getThresholdValue(duKey,
threshKeyY, areaID, xmlKey));
/* /*
* Secondary Swell * Secondary Swell
*/ */
xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_HT.getXmlKey(); xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_HT.getXmlKey();
sssd.setSecSwellHeightR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey)); sssd.setSecSwellHeightR(sstm.getThresholdValue(duKey,
sssd.setSecSwellHeightY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey)); threshKeyR, areaID, xmlKey));
sssd.setSecSwellHeightY(sstm.getThresholdValue(duKey,
threshKeyY, areaID, xmlKey));
xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_PD.getXmlKey(); xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_PD.getXmlKey();
sssd.setSecSwellPeriodR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey)); sssd.setSecSwellPeriodR(sstm.getThresholdValue(duKey,
sssd.setSecSwellPeriodY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey)); threshKeyR, areaID, xmlKey));
sssd.setSecSwellPeriodY(sstm.getThresholdValue(duKey,
threshKeyY, areaID, xmlKey));
xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_DIR_FROM.getXmlKey(); xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_DIR_FROM.getXmlKey();
sssd.setSecSwellDirFromR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey)); sssd.setSecSwellDirFromR(sstm.getThresholdValue(duKey,
sssd.setSecSwellDirFromY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey)); threshKeyR, areaID, xmlKey));
sssd.setSecSwellDirFromY(sstm.getThresholdValue(duKey,
threshKeyY, areaID, xmlKey));
xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_DIR_TO.getXmlKey(); xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_DIR_TO.getXmlKey();
sssd.setSecSwellDirToR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey)); sssd.setSecSwellDirToR(sstm.getThresholdValue(duKey,
sssd.setSecSwellDirToY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey)); threshKeyR, areaID, xmlKey));
sssd.setSecSwellDirToY(sstm.getThresholdValue(duKey,
threshKeyY, areaID, xmlKey));
/* /*
* Add data to array. * Add data to array.
*/ */
ssDataArray.add(sssd); ssDataArray.add(sssd);
}
} }
} }
private SSDispMonSwellData getDataAtFirstSelection() /**
{ * Gets Data at first selection.
*
* @return
*/
private SSDispMonSwellData getDataAtFirstSelection() {
int index = dataList.getSelectionIndex(); int index = dataList.getSelectionIndex();
return ssDataArray.get(index); return ssDataArray.get(index);
} }
private void updateDataArray(SSDispMonSwellData sssd) /**
{ * Update Data Array.
*
* @param sssd
*/
private void updateDataArray(SSDispMonSwellData sssd) {
int[] dataListIndexes = dataList.getSelectionIndices(); int[] dataListIndexes = dataList.getSelectionIndices();
int currentIndex = 0; int currentIndex = 0;
for (int i = 0; i < dataListIndexes.length; i++) for (int i = 0; i < dataListIndexes.length; i++) {
{
currentIndex = dataListIndexes[i]; currentIndex = dataListIndexes[i];
ssDataArray.get(currentIndex).updateData(sssd); ssDataArray.get(currentIndex).updateData(sssd);
} }
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#commitDataToXML()
*/
@Override @Override
public void commitDataToXML() public void commitDataToXML() {
{
SSThresholdMgr sstm = SSThresholdMgr.getInstance(); SSThresholdMgr sstm = SSThresholdMgr.getInstance();
String xmlKey; String xmlKey;
String areaID; String areaID;
for (SSDispMonSwellData sssd : ssDataArray) for (SSDispMonSwellData sssd : ssDataArray) {
{
areaID = sssd.getAreaID(); areaID = sssd.getAreaID();
/* /*
* Primary Swell * Primary Swell
*/ */
xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_HT.getXmlKey(); xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_HT.getXmlKey();
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, sssd.getPriSwellHeightR()); sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, sssd.getPriSwellHeightY()); sssd.getPriSwellHeightR());
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
sssd.getPriSwellHeightY());
xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_PD.getXmlKey(); xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_PD.getXmlKey();
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, sssd.getPriSwellPeriodR()); sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, sssd.getPriSwellPeriodY()); sssd.getPriSwellPeriodR());
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
sssd.getPriSwellPeriodY());
xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_FROM.getXmlKey(); xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_FROM.getXmlKey();
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, sssd.getPriSwellDirFromR()); sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, sssd.getPriSwellDirFromY()); sssd.getPriSwellDirFromR());
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
sssd.getPriSwellDirFromY());
xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_TO.getXmlKey(); xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_TO.getXmlKey();
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, sssd.getPriSwellDirToR()); sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, sssd.getPriSwellDirToY()); sssd.getPriSwellDirToR());
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
sssd.getPriSwellDirToY());
/* /*
* Secondary Swell * Secondary Swell
*/ */
xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_HT.getXmlKey(); xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_HT.getXmlKey();
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, sssd.getSecSwellHeightR()); sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, sssd.getSecSwellHeightY()); sssd.getSecSwellHeightR());
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
sssd.getSecSwellHeightY());
xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_PD.getXmlKey(); xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_PD.getXmlKey();
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, sssd.getSecSwellPeriodR()); sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, sssd.getSecSwellPeriodY()); sssd.getSecSwellPeriodR());
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
sssd.getSecSwellPeriodY());
xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_DIR_FROM.getXmlKey(); xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_DIR_FROM.getXmlKey();
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, sssd.getSecSwellDirFromR()); sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, sssd.getSecSwellDirFromY()); sssd.getSecSwellDirFromR());
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
sssd.getSecSwellDirFromY());
xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_DIR_TO.getXmlKey(); xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_DIR_TO.getXmlKey();
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, sssd.getSecSwellDirToR()); sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, sssd.getSecSwellDirToY()); sssd.getSecSwellDirToR());
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
sssd.getSecSwellDirToY());
} }
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#reloadData()
*/
@Override @Override
public void reloadData() public void reloadData() {
{
dataList.removeAll(); dataList.removeAll();
ssDataArray.clear(); ssDataArray.clear();
ssDataArray = null; ssDataArray = null;
@ -324,24 +406,34 @@ public class SSMonitorSwellTab extends TabItemComp implements IUpdateDisplayMoni
populateList(); populateList();
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#editDataAction()
*/
@Override @Override
protected void editDataAction() protected void editDataAction() {
{
SSDispMonSwellData sssd = getDataAtFirstSelection(); SSDispMonSwellData sssd = getDataAtFirstSelection();
if (monitorSwellEditDlg == null) if (monitorSwellEditDlg == null) {
{ monitorSwellEditDlg = new SSDispMonSwellEditDlg(getParent()
monitorSwellEditDlg = new SSDispMonSwellEditDlg(getParent().getShell(), sssd, this, false); .getShell(), sssd, this, false);
monitorSwellEditDlg.open(); monitorSwellEditDlg.open();
monitorSwellEditDlg = null; monitorSwellEditDlg = null;
} }
} }
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.monitor.safeseas.ui.dialogs.IUpdateDisplayMonitorSwell
* #updateThresholdData(com.raytheon.uf.viz.monitor.safeseas.threshold.
* SSDispMonSwellData)
*/
@Override @Override
public void updateThresholdData(SSDispMonSwellData sssd) public void updateThresholdData(SSDispMonSwellData sssd) {
{
updateDataArray(sssd); updateDataArray(sssd);
populateList(); populateList();
} }
} }

View file

@ -24,7 +24,6 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey; import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
@ -49,6 +48,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Apr 28, 2014 3086 skorolev Updated getConfigManager. * Apr 28, 2014 3086 skorolev Updated getConfigManager.
* Sep 04, 2014 3220 skorolev Added fireConfigUpdateEvent method. Updated handler. * Sep 04, 2014 3220 skorolev Added fireConfigUpdateEvent method. Updated handler.
* Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons. * Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons.
* Oct 16, 2014 3220 skorolev Corrected getInstance() method.
* *
* *
* </pre> * </pre>
@ -142,10 +142,7 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
*/ */
@Override @Override
public FSSObsMonitorConfigurationManager getInstance() { public FSSObsMonitorConfigurationManager getInstance() {
if (configMgr == null) { return FSSObsMonitorConfigurationManager.getSsObsManager();
configMgr = new FSSObsMonitorConfigurationManager(MonName.ss.name());
}
return configMgr;
} }
/* /*

View file

@ -29,7 +29,6 @@ import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.dataplugin.fog.FogRecord.FOG_THREAT; import com.raytheon.uf.common.dataplugin.fog.FogRecord.FOG_THREAT;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey; import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
import com.raytheon.uf.common.monitor.data.ObConst.DisplayVarName; import com.raytheon.uf.common.monitor.data.ObConst.DisplayVarName;
@ -57,7 +56,8 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
* Nov 10, 2012 1297 skorolev Added initiateProdArray * Nov 10, 2012 1297 skorolev Added initiateProdArray
* Dec 7, 2012 #1351 skorolev Changes for non-blocking dialogs. * Dec 7, 2012 #1351 skorolev Changes for non-blocking dialogs.
* Apr 28, 2014 3086 skorolev Updated getConfigMgr method. * Apr 28, 2014 3086 skorolev Updated getConfigMgr method.
* Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose. * Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose.
* Oct 16, 2014 3220 skorolev Corrected configMgr assignment.
* *
* </pre> * </pre>
* *
@ -80,6 +80,7 @@ public class SSZoneTableDlg extends ZoneTableDlg {
*/ */
public SSZoneTableDlg(Shell parent, ObMultiHrsReports obData) { public SSZoneTableDlg(Shell parent, ObMultiHrsReports obData) {
super(parent, obData, CommonConfig.AppName.SAFESEAS); super(parent, obData, CommonConfig.AppName.SAFESEAS);
configMgr = FSSObsMonitorConfigurationManager.getSsObsManager();
} }
/** /**
@ -319,18 +320,4 @@ public class SSZoneTableDlg extends ZoneTableDlg {
} }
} }
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg#
* getMonitorAreaConfigInstance()
*/
@Override
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
if (configMgr == null || configMgr.isPopulated()) {
configMgr = new FSSObsMonitorConfigurationManager(MonName.ss.name());
}
return configMgr;
}
} }

View file

@ -31,7 +31,6 @@ import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.dataplugin.annotations.DataURI; import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
@ -74,6 +73,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Feb 15, 2013 1638 mschenke Changed code to reference DataURI.SEPARATOR instead of URIFilter * Feb 15, 2013 1638 mschenke Changed code to reference DataURI.SEPARATOR instead of URIFilter
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method. * Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
* Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea. * Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea.
* Oct 16, 2014 3220 skorolev Corrected snowConfig assignment.
* *
* </pre> * </pre>
* *
@ -128,7 +128,7 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
*/ */
private SnowMonitor() { private SnowMonitor() {
pluginPatterns.add(snowPattern); pluginPatterns.add(snowPattern);
snowConfig = new FSSObsMonitorConfigurationManager(MonName.snow.name()); snowConfig = FSSObsMonitorConfigurationManager.getSnowObsManager();
updateMonitoringArea(); updateMonitoringArea();
initObserver(OBS, this); initObserver(OBS, this);
obData = new ObMultiHrsReports(CommonConfig.AppName.SNOW); obData = new ObMultiHrsReports(CommonConfig.AppName.SNOW);

View file

@ -22,7 +22,6 @@ package com.raytheon.uf.viz.monitor.snow.threshold;
import java.util.ArrayList; import java.util.ArrayList;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey; import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr; import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
@ -42,6 +41,7 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SnowMonitor;
* Feb 03, 2014 #2757 skorolev Fixed reInitialize() * Feb 03, 2014 #2757 skorolev Fixed reInitialize()
* May 21, 2014 3086 skorolev Cleaned code. * May 21, 2014 3086 skorolev Cleaned code.
* Sep 04, 2014 3220 skorolev Removed "site". * Sep 04, 2014 3220 skorolev Removed "site".
* Oct 16, 2014 3220 skorolev Corrected areaConfigMgr assignment.
* *
* </pre> * </pre>
* *
@ -58,9 +58,7 @@ public class SnowThresholdMgr extends AbstractThresholdMgr {
super("DefaultSnowDisplayThresholds.xml", super("DefaultSnowDisplayThresholds.xml",
"DefaultSnowMonitorThresholds.xml", AppName.SNOW.name() "DefaultSnowMonitorThresholds.xml", AppName.SNOW.name()
.toLowerCase()); .toLowerCase());
areaConfigMgr = FSSObsMonitorConfigurationManager.getSnowObsManager();
areaConfigMgr = new FSSObsMonitorConfigurationManager(
MonName.snow.name());
init(); init();
} }
@ -114,19 +112,4 @@ public class SnowThresholdMgr extends AbstractThresholdMgr {
} }
return threshKeys; return threshKeys;
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr#
* getMonitorAreaConfigInstance()
*/
@Override
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
if (areaConfigMgr == null) {
areaConfigMgr = new FSSObsMonitorConfigurationManager(
MonName.snow.name());
}
return areaConfigMgr;
}
} }

View file

@ -48,6 +48,7 @@ import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* May 21, 2014 3086 skorolev Cleaned code. * May 21, 2014 3086 skorolev Cleaned code.
* Oct 16, 2014 3220 skorolev Added condition to avoid NPE.
* *
* </pre> * </pre>
* *
@ -213,84 +214,86 @@ public class SnowDisplayMeteoTab extends TabItemComp implements
List<AreaXML> areasArray = threshXML.getAreas(); List<AreaXML> areasArray = threshXML.getAreas();
for (AreaXML area : areasArray) { if (areasArray != null) {
areaID = area.getAreaId(); for (AreaXML area : areasArray) {
SnowDisplayMeteoData sdmd = new SnowDisplayMeteoData(); areaID = area.getAreaId();
SnowDisplayMeteoData sdmd = new SnowDisplayMeteoData();
sdmd.setAreaID(areaID); sdmd.setAreaID(areaID);
/* Tempature */ /* Tempature */
xmlKey = SnowDisplay.SNOW_DISP_METEO_TEMP.getXmlKey(); xmlKey = SnowDisplay.SNOW_DISP_METEO_TEMP.getXmlKey();
sdmd.setTempR(stm.getThresholdValue(duKey, threshKeyR, areaID, sdmd.setTempR(stm.getThresholdValue(duKey, threshKeyR, areaID,
xmlKey)); xmlKey));
sdmd.setTempY(stm.getThresholdValue(duKey, threshKeyY, areaID, sdmd.setTempY(stm.getThresholdValue(duKey, threshKeyY, areaID,
xmlKey)); xmlKey));
/* Dew point */ /* Dew point */
xmlKey = SnowDisplay.SNOW_DISP_METEO_DEWPT.getXmlKey(); xmlKey = SnowDisplay.SNOW_DISP_METEO_DEWPT.getXmlKey();
sdmd.setDewpointR(stm.getThresholdValue(duKey, threshKeyR, areaID, sdmd.setDewpointR(stm.getThresholdValue(duKey, threshKeyR,
xmlKey)); areaID, xmlKey));
sdmd.setDewpointY(stm.getThresholdValue(duKey, threshKeyY, areaID, sdmd.setDewpointY(stm.getThresholdValue(duKey, threshKeyY,
xmlKey)); areaID, xmlKey));
/* Visibility */ /* Visibility */
xmlKey = SnowDisplay.SNOW_DISP_METEO_VIS.getXmlKey(); xmlKey = SnowDisplay.SNOW_DISP_METEO_VIS.getXmlKey();
sdmd.setVisR(stm.getThresholdValue(duKey, threshKeyR, areaID, sdmd.setVisR(stm.getThresholdValue(duKey, threshKeyR, areaID,
xmlKey)); xmlKey));
sdmd.setVisY(stm.getThresholdValue(duKey, threshKeyY, areaID, sdmd.setVisY(stm.getThresholdValue(duKey, threshKeyY, areaID,
xmlKey)); xmlKey));
/* SLP */ /* SLP */
xmlKey = SnowDisplay.SNOW_DISP_METEO_SLP.getXmlKey(); xmlKey = SnowDisplay.SNOW_DISP_METEO_SLP.getXmlKey();
sdmd.setSlpR(stm.getThresholdValue(duKey, threshKeyR, areaID, sdmd.setSlpR(stm.getThresholdValue(duKey, threshKeyR, areaID,
xmlKey)); xmlKey));
sdmd.setSlpY(stm.getThresholdValue(duKey, threshKeyY, areaID, sdmd.setSlpY(stm.getThresholdValue(duKey, threshKeyY, areaID,
xmlKey)); xmlKey));
/* Hourly Precipitation */ /* Hourly Precipitation */
xmlKey = SnowDisplay.SNOW_DISP_METEO_HOURLY_PRECIP.getXmlKey(); xmlKey = SnowDisplay.SNOW_DISP_METEO_HOURLY_PRECIP.getXmlKey();
sdmd.setHrPrecipR(stm.getThresholdValue(duKey, threshKeyR, areaID, sdmd.setHrPrecipR(stm.getThresholdValue(duKey, threshKeyR,
xmlKey)); areaID, xmlKey));
sdmd.setHrPrecipY(stm.getThresholdValue(duKey, threshKeyY, areaID, sdmd.setHrPrecipY(stm.getThresholdValue(duKey, threshKeyY,
xmlKey)); areaID, xmlKey));
/* Wind Chill */ /* Wind Chill */
xmlKey = SnowDisplay.SNOW_DISP_METEO_WIND_CHILL.getXmlKey(); xmlKey = SnowDisplay.SNOW_DISP_METEO_WIND_CHILL.getXmlKey();
sdmd.setWindChillR(stm.getThresholdValue(duKey, threshKeyR, areaID, sdmd.setWindChillR(stm.getThresholdValue(duKey, threshKeyR,
xmlKey)); areaID, xmlKey));
sdmd.setWindChillY(stm.getThresholdValue(duKey, threshKeyY, areaID, sdmd.setWindChillY(stm.getThresholdValue(duKey, threshKeyY,
xmlKey)); areaID, xmlKey));
/* Frost Bite */ /* Frost Bite */
xmlKey = SnowDisplay.SNOW_DISP_METEO_FROSTBITE.getXmlKey(); xmlKey = SnowDisplay.SNOW_DISP_METEO_FROSTBITE.getXmlKey();
sdmd.setFrostBiteR(stm.getThresholdValue(duKey, threshKeyR, areaID, sdmd.setFrostBiteR(stm.getThresholdValue(duKey, threshKeyR,
xmlKey)); areaID, xmlKey));
sdmd.setFrostBiteY(stm.getThresholdValue(duKey, threshKeyY, areaID, sdmd.setFrostBiteY(stm.getThresholdValue(duKey, threshKeyY,
xmlKey)); areaID, xmlKey));
/* Snow Depth */ /* Snow Depth */
xmlKey = SnowDisplay.SNOW_DISP_METEO_SNOW_DEPTH.getXmlKey(); xmlKey = SnowDisplay.SNOW_DISP_METEO_SNOW_DEPTH.getXmlKey();
sdmd.setSnowDepthR(stm.getThresholdValue(duKey, threshKeyR, areaID, sdmd.setSnowDepthR(stm.getThresholdValue(duKey, threshKeyR,
xmlKey)); areaID, xmlKey));
sdmd.setSnowDepthY(stm.getThresholdValue(duKey, threshKeyY, areaID, sdmd.setSnowDepthY(stm.getThresholdValue(duKey, threshKeyY,
xmlKey)); areaID, xmlKey));
/* SNINCR Hourly */ /* SNINCR Hourly */
xmlKey = SnowDisplay.SNOW_DISP_METEO_SNINCR_HOURLY.getXmlKey(); xmlKey = SnowDisplay.SNOW_DISP_METEO_SNINCR_HOURLY.getXmlKey();
sdmd.setSnincrHrlyR(stm.getThresholdValue(duKey, threshKeyR, sdmd.setSnincrHrlyR(stm.getThresholdValue(duKey, threshKeyR,
areaID, xmlKey)); areaID, xmlKey));
sdmd.setSnincrHrlyY(stm.getThresholdValue(duKey, threshKeyY, sdmd.setSnincrHrlyY(stm.getThresholdValue(duKey, threshKeyY,
areaID, xmlKey)); areaID, xmlKey));
/* SNINCR Total */ /* SNINCR Total */
xmlKey = SnowDisplay.SNOW_DISP_METEO_SNINCR_TOTAL.getXmlKey(); xmlKey = SnowDisplay.SNOW_DISP_METEO_SNINCR_TOTAL.getXmlKey();
sdmd.setSnincrTotR(stm.getThresholdValue(duKey, threshKeyR, areaID, sdmd.setSnincrTotR(stm.getThresholdValue(duKey, threshKeyR,
xmlKey)); areaID, xmlKey));
sdmd.setSnincrTotY(stm.getThresholdValue(duKey, threshKeyY, areaID, sdmd.setSnincrTotY(stm.getThresholdValue(duKey, threshKeyY,
xmlKey)); areaID, xmlKey));
/* Add data to array. */ /* Add data to array. */
snowDataArray.add(sdmd); snowDataArray.add(sdmd);
}
} }
} }

View file

@ -24,7 +24,6 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey; import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
@ -49,6 +48,8 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Apr 28, 2014 3086 skorolev Updated snowConfigManager. * Apr 28, 2014 3086 skorolev Updated snowConfigManager.
* Sep 04, 2014 3220 skorolev Added fireConfigUpdateEvent method. Updated handler. * Sep 04, 2014 3220 skorolev Added fireConfigUpdateEvent method. Updated handler.
* Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons. * Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons.
* Oct 16, 2014 3220 skorolev Corrected getInstance() method.
*
* </pre> * </pre>
* *
* @author mpduff * @author mpduff
@ -134,11 +135,7 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
*/ */
@Override @Override
protected FSSObsMonitorConfigurationManager getInstance() { protected FSSObsMonitorConfigurationManager getInstance() {
if (configMgr == null) { return FSSObsMonitorConfigurationManager.getSnowObsManager();
configMgr = new FSSObsMonitorConfigurationManager(
MonName.snow.name());
}
return configMgr;
} }
/* /*

View file

@ -26,7 +26,6 @@ import java.util.List;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey; import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
import com.raytheon.uf.common.monitor.data.ObConst.DisplayVarName; import com.raytheon.uf.common.monitor.data.ObConst.DisplayVarName;
@ -55,6 +54,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg;
* Dec 7, 2012 1351 skorolev Changes for non-blocking dialogs * Dec 7, 2012 1351 skorolev Changes for non-blocking dialogs
* Apr 28, 2014 3086 skorolev Updated getConfigMgr method. * Apr 28, 2014 3086 skorolev Updated getConfigMgr method.
* Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose. * Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose.
* Oct 16, 2014 3220 skorolev Corrected configMgr assignment.
* *
* </pre> * </pre>
* *
@ -75,6 +75,7 @@ public class SnowZoneTableDlg extends ZoneTableDlg {
*/ */
public SnowZoneTableDlg(Shell parent, ObMultiHrsReports obData) { public SnowZoneTableDlg(Shell parent, ObMultiHrsReports obData) {
super(parent, obData, CommonConfig.AppName.SNOW); super(parent, obData, CommonConfig.AppName.SNOW);
configMgr = FSSObsMonitorConfigurationManager.getSnowObsManager();
} }
/** /**
@ -256,18 +257,4 @@ public class SnowZoneTableDlg extends ZoneTableDlg {
protected void shellDisposeAction() { protected void shellDisposeAction() {
// Not used // Not used
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg#getInstance()
*/
@Override
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
if (configMgr == null || configMgr.isPopulated()) {
configMgr = new FSSObsMonitorConfigurationManager(
MonName.snow.name());
}
return configMgr;
}
} }

View file

@ -33,6 +33,9 @@ import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.data.ObConst; import com.raytheon.uf.common.monitor.data.ObConst;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey; import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.localization.LocalizationManager; import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType; import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType;
import com.raytheon.uf.viz.monitor.filename.DefaultFilenameMgr; import com.raytheon.uf.viz.monitor.filename.DefaultFilenameMgr;
@ -53,6 +56,7 @@ import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
* Mar 22, 2010 #4282 zhao obtain zone IDs from monitoring-area-config-manager * Mar 22, 2010 #4282 zhao obtain zone IDs from monitoring-area-config-manager
* Feb 16, 2011 #7346 zhao added getDirectionalThresholdValueCellType(...) * Feb 16, 2011 #7346 zhao added getDirectionalThresholdValueCellType(...)
* Apr 28, 2014 3086 skorolev Updated getAreaConfigMgr method. * Apr 28, 2014 3086 skorolev Updated getAreaConfigMgr method.
* Oct 17, 2014 3220 skorolev Replaced System.out.print with debug statusHandler.
* *
* </pre> * </pre>
* *
@ -61,6 +65,9 @@ import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
*/ */
public abstract class AbstractThresholdMgr { public abstract class AbstractThresholdMgr {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(AbstractThresholdMgr.class);
/** /**
* Monitor Area Configuration Manager. * Monitor Area Configuration Manager.
*/ */
@ -134,7 +141,6 @@ public abstract class AbstractThresholdMgr {
this.defMonitorThreshName = defMonitorThreshName; this.defMonitorThreshName = defMonitorThreshName;
this.appName = appName; this.appName = appName;
this.site = LocalizationManager.getInstance().getCurrentSite(); this.site = LocalizationManager.getInstance().getCurrentSite();
this.areaConfigMgr = getMonitorAreaConfigInstance();
} }
/** /**
@ -201,7 +207,7 @@ public abstract class AbstractThresholdMgr {
LocalizationFile locFile = pm.getLocalizationFile(context, LocalizationFile locFile = pm.getLocalizationFile(context,
pathAndFileName); pathAndFileName);
System.out.println("--- validate path = " statusHandler.handle(Priority.DEBUG, "--- validate path = "
+ locFile.getFile().getAbsolutePath()); + locFile.getFile().getAbsolutePath());
return locFile.getFile().exists(); return locFile.getFile().exists();
@ -526,7 +532,8 @@ public abstract class AbstractThresholdMgr {
ArrayList<String> threshKeys = getThresholdKeys(DataUsageKey.DISPLAY); ArrayList<String> threshKeys = getThresholdKeys(DataUsageKey.DISPLAY);
System.out.println("---- " + currFullDisplayXmlFileName); statusHandler.handle(Priority.DEBUG, "---- "
+ currFullDisplayXmlFileName);
displayThreshMgr.createConfigFromDefaults( displayThreshMgr.createConfigFromDefaults(
currFullDisplayXmlFileName, areaIDs, threshKeys); currFullDisplayXmlFileName, areaIDs, threshKeys);
@ -764,14 +771,17 @@ public abstract class AbstractThresholdMgr {
ArrayList<AreaXML> areasArray = displayXML.getAreas(); ArrayList<AreaXML> areasArray = displayXML.getAreas();
for (AreaXML area : areasArray) { for (AreaXML area : areasArray) {
System.out.println("--- " + area.getAreaId()); statusHandler.handle(Priority.DEBUG, "--- " + area.getAreaId());
ArrayList<AreaThresholdXML> atXmlArray = area.getAreaThresholds(); ArrayList<AreaThresholdXML> atXmlArray = area.getAreaThresholds();
for (AreaThresholdXML atXml : atXmlArray) { for (AreaThresholdXML atXml : atXmlArray) {
System.out.println("****** " + atXml.getKey()); statusHandler.handle(Priority.DEBUG,
System.out.println(" R " + atXml.getRed()); "****** " + atXml.getKey());
System.out.println(" Y " + atXml.getYellow()); statusHandler.handle(Priority.DEBUG,
" R " + atXml.getRed());
statusHandler.handle(Priority.DEBUG,
" Y " + atXml.getYellow());
} }
} }
} }
@ -784,23 +794,18 @@ public abstract class AbstractThresholdMgr {
ArrayList<AreaXML> areasArray = threshXmlCopy.getAreas(); ArrayList<AreaXML> areasArray = threshXmlCopy.getAreas();
for (AreaXML area : areasArray) { for (AreaXML area : areasArray) {
System.out.println("--- " + area.getAreaId()); statusHandler.handle(Priority.DEBUG, "--- " + area.getAreaId());
ArrayList<AreaThresholdXML> atXmlArray = area.getAreaThresholds(); ArrayList<AreaThresholdXML> atXmlArray = area.getAreaThresholds();
for (AreaThresholdXML atXml : atXmlArray) { for (AreaThresholdXML atXml : atXmlArray) {
System.out.println("****** " + atXml.getKey()); statusHandler.handle(Priority.DEBUG,
System.out.println(" R " + atXml.getRed()); "****** " + atXml.getKey());
System.out.println(" Y " + atXml.getYellow()); statusHandler.handle(Priority.DEBUG,
" R " + atXml.getRed());
statusHandler.handle(Priority.DEBUG,
" Y " + atXml.getYellow());
} }
} }
} }
/**
* Gets Monitor Area Configuration manager.
*
* @return manager
*/
protected abstract FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance();
} }

View file

@ -50,6 +50,7 @@ import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 15, 2009 #3963 lvenable Initial creation * Dec 15, 2009 #3963 lvenable Initial creation
* Dec 4, 2012 #1351 skorolev Cleaned code * Dec 4, 2012 #1351 skorolev Cleaned code
* Oct 16, 2014 #3220 skorolev Added error message when Default threshold configuration file is corrupted or empty.
* *
* </pre> * </pre>
* *
@ -145,7 +146,11 @@ public class ThresholdMgr {
ThresholdsXML.class); ThresholdsXML.class);
createXmlFromDefaults(cfgXmlDefaults, areaIDs, keys); createXmlFromDefaults(cfgXmlDefaults, areaIDs, keys);
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.ERROR, e.getMessage()); statusHandler
.handle(Priority.ERROR,
"Default threshold configuration file "
+ fullDefaultPathName
+ " is corrupted.\nDelete the files in the folder on the server side and restart CAVE.");
return false; return false;
} }
return true; return true;

View file

@ -89,6 +89,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* May 13, 2014 3133 njensen Updated getting ObsHistType from configMgr * May 13, 2014 3133 njensen Updated getting ObsHistType from configMgr
* May 15, 2014 3086 skorolev Replaced MonitorConfigurationManager with FSSObsMonitorConfigurationManager. * May 15, 2014 3086 skorolev Replaced MonitorConfigurationManager with FSSObsMonitorConfigurationManager.
* Sep 15, 2014 3220 skorolev Added refreshZoneTableData method. * Sep 15, 2014 3220 skorolev Added refreshZoneTableData method.
* Oct 17, 2014 3220 skorolev Added condition into launchTrendPlot to avoid NPE.
* *
* </pre> * </pre>
* *
@ -736,10 +737,14 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
} }
// Set dialog index // Set dialog index
String dialogID = appName.name() + station; String dialogID = appName.name() + station;
String strHistType = getMonitorAreaConfigInstance().getStationType( ObsHistType histType = null;
selectedZone, station); if (configMgr != null) {
ObsHistType histType = ObsHistType.valueOf(strHistType); String strHistType = configMgr
.getStationType(selectedZone, station);
histType = ObsHistType.valueOf(strHistType);
}
if (histType == null)
return;
/** /**
* For Snow monitor, no history table is displayed for a Maritime * For Snow monitor, no history table is displayed for a Maritime
* station * station
@ -953,13 +958,6 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
return varName; return varName;
} }
/**
* Gets Configuration manager.
*
* @return manager
*/
protected abstract FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance();
/** /**
* Refreshes Zone Table. * Refreshes Zone Table.
* *

View file

@ -127,15 +127,21 @@ public class FSSObsMonitorConfigurationManager implements
ss, fog, snow ss, fog, snow
}; };
/** Instance of SAFESEAS monitor configuration manager. */
private static FSSObsMonitorConfigurationManager ssInstance = new FSSObsMonitorConfigurationManager(
MonName.ss.name());
/** Instance of Fog monitor configuration manager. */
private static FSSObsMonitorConfigurationManager fogInstance = new FSSObsMonitorConfigurationManager(
MonName.fog.name());
/** Instance of SNOW monitor configuration manager. */
private static FSSObsMonitorConfigurationManager snowInstance = new FSSObsMonitorConfigurationManager(
MonName.snow.name());
/** Localization Area Configuration File. */ /** Localization Area Configuration File. */
private LocalizationFile lacf = null; private LocalizationFile lacf = null;
/** Configuration XML is updated and saved */
protected boolean isPopulated;
/** Singleton instance of this class */
private static FSSObsMonitorConfigurationManager instance = null;
/** /**
* Private Constructor * Private Constructor
* *
@ -143,7 +149,6 @@ public class FSSObsMonitorConfigurationManager implements
*/ */
public FSSObsMonitorConfigurationManager(String monitorName) { public FSSObsMonitorConfigurationManager(String monitorName) {
setMonitorName(monitorName); setMonitorName(monitorName);
setPopulated(false);
// Avoid confusion in file path // Avoid confusion in file path
if (monitorName == MonName.ss.name()) { if (monitorName == MonName.ss.name()) {
pluginName = "safeseas"; pluginName = "safeseas";
@ -163,21 +168,6 @@ public class FSSObsMonitorConfigurationManager implements
readConfigXml(); readConfigXml();
} }
/**
* Get an instance of Configuration manager for FSSObs monitors.
*
* @param monitor
* Name of monitor
* @return Instance of manager
*/
public static synchronized FSSObsMonitorConfigurationManager getInstance(
String monitor) {
if (instance == null) {
instance = new FSSObsMonitorConfigurationManager(monitor);
}
return instance;
}
/** /**
* Reads the XML configuration data for the current XML file name. filename: * Reads the XML configuration data for the current XML file name. filename:
* monitor area config file name adjAreaFileName: adjacent areas config file * monitor area config file name adjAreaFileName: adjacent areas config file
@ -193,11 +183,11 @@ public class FSSObsMonitorConfigurationManager implements
LocalizationType.COMMON_STATIC, LocalizationLevel.SITE); LocalizationType.COMMON_STATIC, LocalizationLevel.SITE);
this.currentSite = lc.getContextName(); this.currentSite = lc.getContextName();
lacf = pm.getLocalizationFile(lc, configFileName); lacf = pm.getLocalizationFile(lc, configFileName);
lacf.addFileUpdatedObserver(this);
String monitorAreaFilePath = lacf.getFile().getAbsolutePath(); String monitorAreaFilePath = lacf.getFile().getAbsolutePath();
MonAreaConfigXML configXmltmp = jaxb MonAreaConfigXML configXmltmp = jaxb
.unmarshalFromXmlFile(monitorAreaFilePath.toString()); .unmarshalFromXmlFile(monitorAreaFilePath.toString());
configXml = configXmltmp; configXml = configXmltmp;
setPopulated(true);
} catch (Exception e) { } catch (Exception e) {
statusHandler statusHandler
.handle(Priority.WARN, .handle(Priority.WARN,
@ -327,7 +317,6 @@ public class FSSObsMonitorConfigurationManager implements
newXmlFile.save(); newXmlFile.save();
lacf = newXmlFile; lacf = newXmlFile;
lacf.addFileUpdatedObserver(this); lacf.addFileUpdatedObserver(this);
setPopulated(true);
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.ERROR, e.getMessage()); statusHandler.handle(Priority.ERROR, e.getMessage());
} }
@ -953,24 +942,6 @@ public class FSSObsMonitorConfigurationManager implements
FSSObsMonitorConfigurationManager.monitorName = monitorName; FSSObsMonitorConfigurationManager.monitorName = monitorName;
} }
/**
* Flag is true if config file updated and saved.
*
* @return
*/
public boolean isPopulated() {
return isPopulated;
}
/**
* Sets flag indicating that config file has been updated and saved.
*
* @param isPopulated
*/
public void setPopulated(boolean isPopulated) {
this.isPopulated = isPopulated;
}
/** /**
* Remove Adjacent Area. * Remove Adjacent Area.
* *
@ -1009,4 +980,34 @@ public class FSSObsMonitorConfigurationManager implements
adjAreaConfigXml.addAreaId(area); adjAreaConfigXml.addAreaId(area);
} }
} }
/**
* Get Fog monitor area configuration manager.
*
* @return
*/
public static FSSObsMonitorConfigurationManager getFogObsManager() {
fogInstance.readConfigXml();
return fogInstance;
}
/**
* Get SAFESEAS monitor area configuration manager.
*
* @return
*/
public static FSSObsMonitorConfigurationManager getSsObsManager() {
ssInstance.readConfigXml();
return ssInstance;
}
/**
* Get SNOW monitor area configuration manager.
*
* @return
*/
public static FSSObsMonitorConfigurationManager getSnowObsManager() {
snowInstance.readConfigXml();
return snowInstance;
}
} }

View file

@ -43,7 +43,6 @@ import com.raytheon.uf.common.monitor.config.FFMPRunConfigurationManager;
import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager; import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager;
import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager.DATA_TYPE; import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager.DATA_TYPE;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.config.SCANRunSiteConfigurationManager; import com.raytheon.uf.common.monitor.config.SCANRunSiteConfigurationManager;
import com.raytheon.uf.common.monitor.xml.FFMPRunXML; import com.raytheon.uf.common.monitor.xml.FFMPRunXML;
import com.raytheon.uf.common.monitor.xml.ProductRunXML; import com.raytheon.uf.common.monitor.xml.ProductRunXML;
@ -479,30 +478,29 @@ public class DatMenuUtil extends AbstractMenuUtil {
} }
/** /**
* Creates Safeseas Menu. * Creates SAFESEAS Menu.
*/ */
private void createSafeseasMenu() { private void createSafeseasMenu() {
FSSObsMonitorConfigurationManager ssConfig = FSSObsMonitorConfigurationManager FSSObsMonitorConfigurationManager ssConfig = FSSObsMonitorConfigurationManager
.getInstance(MonName.ss.name()); .getSsObsManager();
Set<String> ssStns = ssConfig.getStationIDs(); Set<String> ssStns = ssConfig.getStationIDs();
StringBuilder stations = new StringBuilder(); StringBuilder stations = new StringBuilder();
for (String s : ssStns) { for (String s : ssStns) {
if (stations.length() > 0) { if (stations.length() > 0) {
stations.append(","); stations.append(",");
}
stations.append(s);
} }
String ssStations = stations.toString(); stations.append(s);
CommonMenuContributionFile safeMenuContributionFile = new CommonMenuContributionFile(); }
safeMenuContributionFile.contribution = new CommonIncludeMenuItem[1]; String ssStations = stations.toString();
safeMenuContributionFile.contribution[0] = new CommonIncludeMenuItem(); CommonMenuContributionFile safeMenuContributionFile = new CommonMenuContributionFile();
safeMenuContributionFile.contribution[0] = processOtherContribution( safeMenuContributionFile.contribution = new CommonIncludeMenuItem[1];
ssStations, "menus/safeseas/baseSafeSeas.xml", safeMenuContributionFile.contribution[0] = new CommonIncludeMenuItem();
"menu:obs?before=EndOfMaritime", "SAFESEAS", safeMenuContributionFile.contribution[0] = processOtherContribution(
safeMenuContributionFile.contribution[0]); ssStations, "menus/safeseas/baseSafeSeas.xml",
toXml(safeMenuContributionFile, "menus" + File.separator "menu:obs?before=EndOfMaritime", "SAFESEAS",
+ "safeseas" + File.separator + "index.xml"); safeMenuContributionFile.contribution[0]);
ssConfig = null; toXml(safeMenuContributionFile, "menus" + File.separator + "safeseas"
+ File.separator + "index.xml");
} }
/** /**
@ -510,53 +508,51 @@ public class DatMenuUtil extends AbstractMenuUtil {
*/ */
private void createFogMenu() { private void createFogMenu() {
FSSObsMonitorConfigurationManager fogConfig = FSSObsMonitorConfigurationManager FSSObsMonitorConfigurationManager fogConfig = FSSObsMonitorConfigurationManager
.getInstance(MonName.fog.name()); .getFogObsManager();
Set<String> fogStns = fogConfig.getStationIDs(); Set<String> fogStns = fogConfig.getStationIDs();
StringBuilder stations = new StringBuilder(); StringBuilder stations = new StringBuilder();
for (String s : fogStns) { for (String s : fogStns) {
if (stations.length() > 0) { if (stations.length() > 0) {
stations.append(","); stations.append(",");
}
stations.append(s);
} }
String fogStations = stations.toString(); stations.append(s);
CommonMenuContributionFile fogMenuContributionFile = new CommonMenuContributionFile(); }
fogMenuContributionFile.contribution = new CommonIncludeMenuItem[1]; String fogStations = stations.toString();
fogMenuContributionFile.contribution[0] = new CommonIncludeMenuItem(); CommonMenuContributionFile fogMenuContributionFile = new CommonMenuContributionFile();
fogMenuContributionFile.contribution[0] = processOtherContribution( fogMenuContributionFile.contribution = new CommonIncludeMenuItem[1];
fogStations, "menus/fog/baseFog.xml", fogMenuContributionFile.contribution[0] = new CommonIncludeMenuItem();
"menu:obs?after=FOGPLACEHOLDER", "Fog Monitor", fogMenuContributionFile.contribution[0] = processOtherContribution(
fogMenuContributionFile.contribution[0]); fogStations, "menus/fog/baseFog.xml",
toXml(fogMenuContributionFile, "menus" + File.separator + "fog" "menu:obs?after=FOGPLACEHOLDER", "Fog Monitor",
+ File.separator + "index.xml"); fogMenuContributionFile.contribution[0]);
fogConfig = null; toXml(fogMenuContributionFile, "menus" + File.separator + "fog"
+ File.separator + "index.xml");
} }
/** /**
* Creates Snow Menu. * Creates SNOW Menu.
*/ */
private void createSnowMenu() { private void createSnowMenu() {
FSSObsMonitorConfigurationManager snowConfig = FSSObsMonitorConfigurationManager FSSObsMonitorConfigurationManager snowConfig = FSSObsMonitorConfigurationManager
.getInstance(MonName.snow.name()); .getSnowObsManager();
Set<String> snowStns = snowConfig.getStationIDs(); Set<String> snowStns = snowConfig.getStationIDs();
StringBuilder stations = new StringBuilder(); StringBuilder stations = new StringBuilder();
for (String s : snowStns) { for (String s : snowStns) {
if (stations.length() > 0) { if (stations.length() > 0) {
stations.append(","); stations.append(",");
}
stations.append(s);
} }
String snowStations = stations.toString(); stations.append(s);
CommonMenuContributionFile snowMenuContributionFile = new CommonMenuContributionFile(); }
snowMenuContributionFile.contribution = new CommonIncludeMenuItem[1]; String snowStations = stations.toString();
snowMenuContributionFile.contribution[0] = new CommonIncludeMenuItem(); CommonMenuContributionFile snowMenuContributionFile = new CommonMenuContributionFile();
snowMenuContributionFile.contribution[0] = processOtherContribution( snowMenuContributionFile.contribution = new CommonIncludeMenuItem[1];
snowStations, "menus/snow/baseSnow.xml", snowMenuContributionFile.contribution[0] = new CommonIncludeMenuItem();
"menu:obs?after=SNOWPLACEHOLDER", "SNOW", snowMenuContributionFile.contribution[0] = processOtherContribution(
snowMenuContributionFile.contribution[0]); snowStations, "menus/snow/baseSnow.xml",
toXml(snowMenuContributionFile, "menus" + File.separator + "snow" "menu:obs?after=SNOWPLACEHOLDER", "SNOW",
+ File.separator + "index.xml"); snowMenuContributionFile.contribution[0]);
snowConfig = null; toXml(snowMenuContributionFile, "menus" + File.separator + "snow"
+ File.separator + "index.xml");
} }
/** /**

View file

@ -21,13 +21,14 @@
package com.raytheon.uf.edex.plugin.fssobs; package com.raytheon.uf.edex.plugin.fssobs;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import java.util.Set;
import com.raytheon.edex.site.SiteUtil; import com.raytheon.edex.site.SiteUtil;
import com.raytheon.edex.urifilter.URIFilter; import com.raytheon.edex.urifilter.URIFilter;
import com.raytheon.edex.urifilter.URIGenerateMessage; import com.raytheon.edex.urifilter.URIGenerateMessage;
import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecord; import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecord;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.events.MonitorConfigEvent; import com.raytheon.uf.common.monitor.events.MonitorConfigEvent;
import com.raytheon.uf.common.monitor.events.MonitorConfigListener; import com.raytheon.uf.common.monitor.events.MonitorConfigListener;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
@ -69,10 +70,17 @@ public class FSSObsGenerator extends CompositeProductGenerator implements
/** Product */ /** Product */
private static final String productType = "fssobs"; private static final String productType = "fssobs";
/** Sets of all stations to filter for */ /** All stations to be filtered. */
private HashSet<String> allStations = null; private Set<String> allStations = null;
private FSSObsMonitorConfigurationManager currManager = null; /** Fog monitor area configuration file */
public FSSObsMonitorConfigurationManager fogAreaConfig = null;
/** SAFESEAS monitor area configuration file */
public FSSObsMonitorConfigurationManager ssAreaConfig = null;
/** SNOW monitor area configuration file */
public FSSObsMonitorConfigurationManager snowAreaConfig = null;
/** /**
* Public construction * Public construction
@ -140,12 +148,14 @@ public class FSSObsGenerator extends CompositeProductGenerator implements
+ " process Filter Config..."); + " process Filter Config...");
allStations = new HashSet<String>(); allStations = new HashSet<String>();
for (MonName mname : MonName.values()) { List<String> ssStations = getSSAreaConfig().getStations();
currManager = new FSSObsMonitorConfigurationManager(mname.name()); allStations.addAll(ssStations);
currManager.addListener(this);
allStations.addAll(currManager.getStations()); List<String> fogStations = getFogAreaConfig().getStations();
currManager = null; allStations.addAll(fogStations);
}
List<String> snowStations = getSnowAreaConfig().getStations();
allStations.addAll(snowStations);
} }
/** /**
@ -187,4 +197,45 @@ public class FSSObsGenerator extends CompositeProductGenerator implements
dmu.createMenus(); dmu.createMenus();
} }
} }
/**
* Gets Fog monitor area configuration file.
*
* @return
*/
public FSSObsMonitorConfigurationManager getFogAreaConfig() {
if (fogAreaConfig == null) {
fogAreaConfig = FSSObsMonitorConfigurationManager
.getFogObsManager();
fogAreaConfig.addListener(this);
}
return fogAreaConfig;
}
/**
* Gets SAFESEAS monitor area configuration file.
*
* @return
*/
public FSSObsMonitorConfigurationManager getSSAreaConfig() {
if (ssAreaConfig == null) {
ssAreaConfig = FSSObsMonitorConfigurationManager.getSsObsManager();
ssAreaConfig.addListener(this);
}
return ssAreaConfig;
}
/**
* Gets SNOW monitor area configuration file.
*
* @return
*/
public FSSObsMonitorConfigurationManager getSnowAreaConfig() {
if (snowAreaConfig == null) {
snowAreaConfig = FSSObsMonitorConfigurationManager
.getSnowObsManager();
snowAreaConfig.addListener(this);
}
return snowAreaConfig;
}
} }

View file

@ -3,7 +3,7 @@ package com.raytheon.uf.edex.plugin.fssobs;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.Set;
import java.util.TimeZone; import java.util.TimeZone;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -23,6 +23,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Dec 5, 2012 #1351 skorolev Cleaned code * Dec 5, 2012 #1351 skorolev Cleaned code
* Feb 15, 2013 1638 mschenke Moved DataURINotificationMessage to uf.common.dataplugin * Feb 15, 2013 1638 mschenke Moved DataURINotificationMessage to uf.common.dataplugin
* Sep 04, 2014 3220 skorolev Removed CWA from filter. * Sep 04, 2014 3220 skorolev Removed CWA from filter.
* Oct 17, 2014 3220 skorolev Replaced HashSet with Set.
* *
* </pre> * </pre>
* *
@ -53,7 +54,7 @@ public class FSSObsURIFilter extends URIFilter {
private String dataType; private String dataType;
/** All filtered stations */ /** All filtered stations */
private HashSet<String> stations = null; private Set<String> stations = null;
/** Date format **/ /** Date format **/
private static String datePattern = "yyyy-MM-dd_HH:mm:ss.S"; private static String datePattern = "yyyy-MM-dd_HH:mm:ss.S";
@ -72,7 +73,7 @@ public class FSSObsURIFilter extends URIFilter {
* @param stations * @param stations
* for FSSObs filter * for FSSObs filter
*/ */
public FSSObsURIFilter(String name, HashSet<String> stations) { public FSSObsURIFilter(String name, Set<String> stations) {
super(name); super(name);
logger.info("FSSObsFilter " + name + " Filter construction..."); logger.info("FSSObsFilter " + name + " Filter construction...");
setDataTypes(new String[] { "obs", "sfcobs", "ldadmesonet" }); setDataTypes(new String[] { "obs", "sfcobs", "ldadmesonet" });

View file

@ -29,7 +29,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.edex.ndm.ingest.IDataSetIngester; import com.raytheon.uf.edex.ndm.ingest.IDataSetIngester;
import com.raytheon.uf.edex.ndm.ingest.INationalDatasetSubscriber; import com.raytheon.uf.edex.ndm.ingest.INationalDatasetSubscriber;
import com.raytheon.uf.edex.plugin.loctables.util.CommonObsSpatialBuilder; import com.raytheon.uf.edex.plugin.loctables.util.CommonObsSpatialBuilder;
@ -56,6 +55,7 @@ import com.raytheon.uf.edex.plugin.loctables.util.store.ObStationStoreStrategy;
* Mar 06, 2014 2876 mpduff New NDM plugin. * Mar 06, 2014 2876 mpduff New NDM plugin.
* Apr 28, 2014 3086 skorolev Updated setupLocalFiles method * Apr 28, 2014 3086 skorolev Updated setupLocalFiles method
* Sep 04, 2014 3220 skorolev Removed parameter currentSite from FSSObs configuration managers. * Sep 04, 2014 3220 skorolev Removed parameter currentSite from FSSObs configuration managers.
* Oct 17, 2014 3220 skorolev Corrected FSSObsMonitorConfigurationManager instances.
* *
* </pre> * </pre>
* *
@ -128,12 +128,9 @@ public class LocationTablesIngest implements INationalDatasetSubscriber {
private void setupLocalFiles() { private void setupLocalFiles() {
List<FSSObsMonitorConfigurationManager> monitors = new ArrayList<FSSObsMonitorConfigurationManager>(); List<FSSObsMonitorConfigurationManager> monitors = new ArrayList<FSSObsMonitorConfigurationManager>();
monitors.add(FSSObsMonitorConfigurationManager.getInstance(MonName.fog monitors.add(FSSObsMonitorConfigurationManager.getSsObsManager());
.name())); monitors.add(FSSObsMonitorConfigurationManager.getFogObsManager());
monitors.add(FSSObsMonitorConfigurationManager.getInstance(MonName.ss monitors.add(FSSObsMonitorConfigurationManager.getSnowObsManager());
.name()));
monitors.add(FSSObsMonitorConfigurationManager.getInstance(MonName.snow
.name()));
} }
/** /**