Omaha #3086 - Replaced three separate area configuration managers with one FSSObsMonitorConfigurationManager.

Former-commit-id: 14ff7a84235ed8cc95aca488910e7f975a5bd41e
This commit is contained in:
Slav Korolev 2014-05-20 16:14:21 -04:00
parent f6e7dffe61
commit e3fe3c9736
40 changed files with 3572 additions and 2943 deletions

View file

@ -39,14 +39,14 @@ import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.fog.FogRecord.FOG_THREAT;
import com.raytheon.uf.common.geospatial.SpatialException;
import com.raytheon.uf.common.monitor.MonitorAreaUtils;
import com.raytheon.uf.common.monitor.config.FogMonitorConfigurationManager;
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.CommonConfig;
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.alerts.AlertMessage;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.notification.NotificationMessage;
import com.raytheon.uf.viz.monitor.IMonitor;
import com.raytheon.uf.viz.monitor.Monitor;
@ -66,6 +66,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg;
import com.raytheon.uf.viz.monitor.util.MonitorThresholdConfiguration;
import com.raytheon.viz.alerts.Activator;
import com.raytheon.viz.alerts.observers.ProductAlertObserver;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
import com.vividsolutions.jts.geom.Geometry;
/**
@ -86,6 +87,7 @@ import com.vividsolutions.jts.geom.Geometry;
* Oct 26, 2012 1280 skorolev Made changes for non-blocking dialog and changed HashMap to Map
* Oct.31 2012 1297 skorolev Clean code
* Feb 15, 2013 1638 mschenke Changed code to reference DataURI.SEPARATOR instead of URIFilter
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
*
* </pre>
*
@ -127,7 +129,7 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
private MonitoringAreaConfigDlg areaDialog;
/** area config manager **/
private FogMonitorConfigurationManager fogConfig = null;
private FSSObsMonitorConfigurationManager fogConfig;
/** table data for the station table **/
private final TableData stationTableData = new TableData(
@ -157,6 +159,8 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
*/
private FogMonitor() {
pluginPatterns.add(fogPattern);
fogConfig = new FSSObsMonitorConfigurationManager(currentSite,
MonName.fog.name());
readTableConfig(MonitorThresholdConfiguration.FOG_THRESHOLD_CONFIG);
initObserver(OBS, this);
}
@ -172,7 +176,7 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
// Pre-populate dialog with an observations from DB
monitor.createDataStructures();
monitor.getAdjAreas();
monitor.processProductAtStartup("fog");
monitor.processProductAtStartup(MonName.fog.name());
monitor.fireMonitorEvent(monitor);
}
@ -182,6 +186,8 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
// TODO: Provide the changes in EDEX URIFilters when area configuration file
// has been changed.
/**
* Re-initialization of monitor.
*
* DR#11279: When monitor area configuration is changed, this module is
* called to re-initialize monitor using new monitor area configuration
*/
@ -258,10 +264,9 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
Map<String, List<String>> zones = new HashMap<String, List<String>>();
// create zones and stations list
try {
FogMonitorConfigurationManager areaConfig = getMonitorAreaConfig();
for (String zone : areaConfig.getAreaList()) {
for (String zone : fogConfig.getAreaList()) {
// add the unique
List<String> stations = areaConfig.getAreaStations(zone);
List<String> stations = fogConfig.getAreaStations(zone);
zones.put(zone, stations);
}
} catch (Exception ve) {
@ -311,7 +316,7 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
}
/**
* Kill this monitor by nullifying the monitor's private instance variable.
* Kills this monitor by nullifying the monitor's private instance variable.
*/
@Override
public void nullifyMonitor() {
@ -335,7 +340,7 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
}
/**
* get the main map
* Gets the main map
*
* @return obsData
*/
@ -363,7 +368,7 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
}
/**
* gets the station Table Data
* Gets the station Table Data.
*
* @return stationTableData
*/
@ -372,7 +377,7 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
}
/**
* launch the zone table dialog
* Launches the zone table dialog
*
* @param type
* @param shell
@ -390,13 +395,21 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
if (areaDialog == null) {
areaDialog = new FogMonitoringAreaConfigDlg(shell,
"Fog Monitor Area Configuration");
areaDialog.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
areaDialog = null;
}
});
}
areaDialog.open();
}
}
/**
* Set the algorithm threat by time and zone
* Sets the algorithm threat by time and zone
*
* @param time
* @param algData
@ -438,7 +451,7 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
if (zoneGeometries == null) {
List<String> zones = getMonitorAreaConfig().getAreaList();
List<String> zones = fogConfig.getAreaList();
zoneGeometries = new HashMap<String, Geometry>();
for (String zone : zones) {
@ -455,22 +468,6 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
return zoneGeometries;
}
/**
* Gets the fog configuration manager
*
* @return fogConfig
*/
public FogMonitorConfigurationManager getMonitorAreaConfig() {
if (fogConfig == null) {
LocalizationManager mgr = LocalizationManager.getInstance();
String siteScope = mgr.getCurrentSite();
fogConfig = FogMonitorConfigurationManager.getInstance();
fogConfig.readConfigXml(siteScope);
}
return fogConfig;
}
/**
* Gets observation data
*
@ -503,7 +500,7 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
}
/**
* add a listener
* Adds a listener
*
* @param ifru
*/
@ -512,9 +509,10 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
}
/**
* remove a listener
* Removes a listener
*
* @param ifru
* Fog Resource Listener
*/
public void removeFogResourceListener(IFogResourceListener ifru) {
fogResources.remove(ifru);
@ -540,10 +538,6 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
return dialogTime;
}
/**
* close down the dialog
*
*/
/*
* (non-Javadoc)
*
@ -567,12 +561,6 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
}
}
/**
* Order the dates
*
* @param type
* @return
*/
/*
* (non-Javadoc)
*
@ -586,7 +574,7 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
}
/**
* Get adjacent areas.
* Gets adjacent areas.
*/
public void getAdjAreas() {
try {
@ -597,7 +585,7 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
}
/**
* Get geometry of adjacent areas.
* Gets geometry of adjacent areas.
*
* @return the geoAdjAreas
*/
@ -614,9 +602,6 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
this.geoAdjAreas = geoAdjAreas;
}
/**
* First start
*/
/*
* (non-Javadoc)
*

View file

@ -21,10 +21,10 @@ package com.raytheon.uf.viz.monitor.fog.threshold;
import java.util.ArrayList;
import com.raytheon.uf.common.monitor.config.FogMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.MonitorConfigurationManager;
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.ObConst.DataUsageKey;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.FogDisplay;
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.FogMonitor;
@ -40,6 +40,7 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.FogMonitor;
* ------------ ---------- ----------- --------------------------
* Dec 15, 2009 #3963 lvenable Initial creation
* Feb 03, 2014 #2757 skorolev Fixed reInitialize()
* May 20, 2014 3086 skorolev Cleaned code.
*
* </pre>
*
@ -57,10 +58,11 @@ public class FogThresholdMgr extends AbstractThresholdMgr {
*/
private FogThresholdMgr() {
super("DefaultFogDisplayThresholds.xml",
"DefaultFogMonitorThresholds.xml", "fog");
areaConfigMgr = getAreaConfigMgr();
init(); // call init() after areaConfigMgr is set
"DefaultFogMonitorThresholds.xml", AppName.FOG.name()
.toLowerCase());
areaConfigMgr = new FSSObsMonitorConfigurationManager(site,
MonName.fog.name());
init();
}
/**
@ -77,8 +79,11 @@ public class FogThresholdMgr extends AbstractThresholdMgr {
}
/**
* Re-initialization of threshold manager.
*
* DR#11279: When monitor area configuration is changed, threshold manager
* needs to be re-initialized using the new monitor area configuration
*
*/
public static void reInitialize() {
if (classInstance != null) {
@ -90,6 +95,13 @@ public class FogThresholdMgr extends AbstractThresholdMgr {
classInstance.saveMonitorThresholds();
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr#getThresholdKeys
* (com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey)
*/
@Override
protected ArrayList<String> getThresholdKeys(DataUsageKey dataUsage) {
ArrayList<String> threshKeys = new ArrayList<String>();
@ -103,19 +115,22 @@ public class FogThresholdMgr extends AbstractThresholdMgr {
threshKeys.add(fogMon.getXmlKey());
}
}
return threshKeys;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr#
* getMonitorAreaConfigInstance()
*/
@Override
public MonitorConfigurationManager getAreaConfigMgr() {
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
if (areaConfigMgr == null) {
LocalizationManager mgr = LocalizationManager.getInstance();
String siteScope = mgr.getCurrentSite();
areaConfigMgr = FogMonitorConfigurationManager.getInstance();
areaConfigMgr.readConfigXml(siteScope);
areaConfigMgr = new FSSObsMonitorConfigurationManager(site,
MonName.fog.name());
}
return areaConfigMgr;
}
}

View file

@ -26,6 +26,7 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import com.raytheon.uf.viz.monitor.fog.ui.dialogs.FogMonitoringAreaConfigDlg;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
/**
* The Fog Monitor Action
@ -38,6 +39,7 @@ import com.raytheon.uf.viz.monitor.fog.ui.dialogs.FogMonitoringAreaConfigDlg;
* Dec 19 2009 3963 dhladky Initial creation.
* Jul 14 2010 6567 zhao Launch AreaConfigDlg w/o monitor
* Nov.27, 2012 1297 skorolev Cleanup code for non-blocking dialog.
* May 08, 2014 3086 skorolev Added CloseCallback to dialog.
*
* </pre>
*
@ -47,8 +49,18 @@ import com.raytheon.uf.viz.monitor.fog.ui.dialogs.FogMonitoringAreaConfigDlg;
public class FogAreaConfigAction extends AbstractHandler {
/**
* Fog Monitoring Area Config Dialog.
*/
private FogMonitoringAreaConfigDlg areaDialog;
/*
* (non-Javadoc)
*
* @see
* org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands
* .ExecutionEvent)
*/
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
if (areaDialog == null) {
@ -56,6 +68,14 @@ public class FogAreaConfigAction extends AbstractHandler {
.getShell();
areaDialog = new FogMonitoringAreaConfigDlg(shell,
"Fog Monitor Area Configuration");
areaDialog.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
areaDialog = null;
}
});
}
areaDialog.open();
return null;

View file

@ -20,6 +20,7 @@
package com.raytheon.uf.viz.monitor.fog.ui.dialogs;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@ -37,315 +38,343 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.FogDisplay;
import com.raytheon.uf.viz.monitor.xml.AreaXML;
import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
public class FogDisplayMeteoTab extends TabItemComp implements IUpdateDisplayMeteo
{
/**
* Dialog used for editing the FOG display meteo data.
*/
/**
* Fog Display Meteo Table.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 21, 2014 3086 skorolev Cleaned code
*
* </pre>
*
* @author
* @version 1.0
*/
public class FogDisplayMeteoTab extends TabItemComp implements
IUpdateDisplayMeteo {
/** Dialog used for editing the display meteo data. */
private FogDisplayMeteoEditDlg fogMeteoEditDlg;
private ArrayList<String> areaIDArray;
private ArrayList<FogDisplayMeteoData> fogDataArray;
public FogDisplayMeteoTab(TabFolder parent, DataUsageKey duKey)
{
/** List of zones */
private List<String> areaIDArray;
/** Fog Display Meteo Data. */
private List<FogDisplayMeteoData> fogDataArray;
/**
* Constructor
*
* @param parent
* @param duKey
* threshold usage data key
*/
public FogDisplayMeteoTab(TabFolder parent, DataUsageKey duKey) {
super(parent, duKey);
}
@Override
protected void createListHeader(Composite parentComp)
{
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#createListHeader(org
* .eclipse.swt.widgets.Composite)
*/
@Override
protected void createListHeader(Composite parentComp) {
Composite lblComp = new Composite(parentComp, SWT.NONE);
GridLayout gl = new GridLayout(5, false);
gl.horizontalSpacing = 0;
gl.horizontalSpacing = 0;
gl.marginHeight = 0;
gl.marginWidth = 0;
lblComp.setLayout(gl);
/*
* Create filler label.
*/
/* Create filler label. */
GridData gd = new GridData(68, SWT.DEFAULT);
Label fillerLbl = new Label(lblComp, SWT.CENTER);
fillerLbl.setLayoutData(gd);
/*
* Meteo
*/
/* Meteo */
Composite meteoComp = createGroupComposite(lblComp, 6, null);
createLabelComp(meteoComp, "Vis(mi)", "", true);
createLabelComp(meteoComp, "Ceiling", "(100ft)", false);
createLabelComp(meteoComp, "Temp(F)", "", false);
createLabelComp(meteoComp, "Dewpt(F)", "", false);
createLabelComp(meteoComp, "T-Td(F)", "", false);
createLabelComp(meteoComp, "Dewpt(F)", "", false);
createLabelComp(meteoComp, "T-Td(F)", "", false);
createLabelComp(meteoComp, "Rel Hum(%)", "", false);
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#populateList()
*/
@Override
protected void populateList()
{
if (fogDataArray == null)
{
protected void populateList() {
if (fogDataArray == null) {
createDataArray();
}
boolean update = false;
if (dataList.getItemCount() > 0)
{
if (dataList.getItemCount() > 0) {
update = true;
}
RangesUtil rangeUtil = RangesUtil.getInstance();
areaIDArray = new ArrayList<String>();
String tmpVisStr;
String currentAreaID;
double visVal = 0.0;
StringBuilder sb = null;
StringBuilder sb = null;
FogDisplayMeteoData fdmd = null;
for (int i = 0; i < fogDataArray.size(); i++)
{
for (int i = 0; i < fogDataArray.size(); i++) {
sb = new StringBuilder();
fdmd = fogDataArray.get(i);
currentAreaID = fdmd.getAreaID();
areaIDArray.add(currentAreaID);
sb.append(String.format(areaIdFmt, currentAreaID));
/*
* Visibility
*/
visVal = fdmd.getMeteoVisR();
tmpVisStr = rangeUtil.getVisString((int)visVal);
/* Visibility */
visVal = fdmd.getMeteoVisR();
tmpVisStr = rangeUtil.getVisString((int) visVal);
sb.append(String.format(dataFmt, tmpVisStr));
visVal = fdmd.getMeteoVisY();
tmpVisStr = rangeUtil.getVisString((int)visVal);
visVal = fdmd.getMeteoVisY();
tmpVisStr = rangeUtil.getVisString((int) visVal);
sb.append(String.format(dataFmt, tmpVisStr));
/*
* Ceiling
*/
/* Ceiling */
appendIntData(sb, fdmd.getMeteoCeilingR(), fdmd.getMeteoCeilingY());
/*
* Temperature
*/
/* Temperature */
appendIntData(sb, fdmd.getMeteoTempR(), fdmd.getMeteoTempY());
/*
* Dewpoint
*/
appendIntData(sb, fdmd.getMeteoDewpointR(), fdmd.getMeteoDewpointY());
/*
* T-Td
*/
/* Dewpoint */
appendIntData(sb, fdmd.getMeteoDewpointR(),
fdmd.getMeteoDewpointY());
/* T-Td */
appendIntData(sb, fdmd.getMeteoTtdR(), fdmd.getMeteoTtdY());
/*
* Relative Humidity
*/
/* Relative Humidity */
appendIntData(sb, fdmd.getMeteoRelHumR(), fdmd.getMeteoRelHumY());
/*
* Append a space and add the data line to the list.
*/
/* Append a space and add the data line to the list. */
sb.append(" ");
if (update == true)
{
if (update == true) {
dataList.setItem(i, sb.toString());
}
else
{
} else {
dataList.add(sb.toString());
}
}
}
packListControls();
}
private void createDataArray()
{
/**
* Creates Data Array.
*/
private void createDataArray() {
fogDataArray = new ArrayList<FogDisplayMeteoData>();
FogThresholdMgr ftm = FogThresholdMgr.getInstance();
FogThresholdMgr ftm = FogThresholdMgr.getInstance();
String xmlKey;
String areaID;
String areaID;
ThresholdsXML threshXML = ftm.getThresholdsXmlData(duKey);
ArrayList<AreaXML> areasArray = threshXML.getAreas();
for (AreaXML area : areasArray)
{
List<AreaXML> areasArray = threshXML.getAreas();
for (AreaXML area : areasArray) {
areaID = area.getAreaId();
FogDisplayMeteoData fdmd = new FogDisplayMeteoData();
fdmd.setAreaID(areaID);
/*
* Visibility
*/
/* Visibility */
xmlKey = FogDisplay.FOG_DISP_METEO_VIS.getXmlKey();
fdmd.setMeteoVisR(ftm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
fdmd.setMeteoVisY(ftm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
fdmd.setMeteoVisR(ftm.getThresholdValue(duKey, threshKeyR, areaID,
xmlKey));
fdmd.setMeteoVisY(ftm.getThresholdValue(duKey, threshKeyY, areaID,
xmlKey));
/*
* Ceiling
*/
/* Ceiling */
xmlKey = FogDisplay.FOG_DISP_METEO_CEILING.getXmlKey();
fdmd.setMeteoCeilingR(ftm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
fdmd.setMeteoCeilingY(ftm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
fdmd.setMeteoCeilingR(ftm.getThresholdValue(duKey, threshKeyR,
areaID, xmlKey));
fdmd.setMeteoCeilingY(ftm.getThresholdValue(duKey, threshKeyY,
areaID, xmlKey));
/*
* Temperature
*/
/* Temperature */
xmlKey = FogDisplay.FOG_DISP_METEO_TEMP.getXmlKey();
fdmd.setMeteoTempR(ftm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
fdmd.setMeteoTempY(ftm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
fdmd.setMeteoTempR(ftm.getThresholdValue(duKey, threshKeyR, areaID,
xmlKey));
fdmd.setMeteoTempY(ftm.getThresholdValue(duKey, threshKeyY, areaID,
xmlKey));
/*
* Dewpoint
*/
/* Dewpoint */
xmlKey = FogDisplay.FOG_DISP_METEO_DEWPT.getXmlKey();
fdmd.setMeteoDewpointR(ftm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
fdmd.setMeteoDewpointY(ftm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
fdmd.setMeteoDewpointR(ftm.getThresholdValue(duKey, threshKeyR,
areaID, xmlKey));
fdmd.setMeteoDewpointY(ftm.getThresholdValue(duKey, threshKeyY,
areaID, xmlKey));
/*
* T-Td
*/
/* T-Td */
xmlKey = FogDisplay.FOG_DISP_METEO_T_TD.getXmlKey();
fdmd.setMeteoTtdR(ftm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
fdmd.setMeteoTtdY(ftm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
fdmd.setMeteoTtdR(ftm.getThresholdValue(duKey, threshKeyR, areaID,
xmlKey));
fdmd.setMeteoTtdY(ftm.getThresholdValue(duKey, threshKeyY, areaID,
xmlKey));
/*
* Relative Humidity
*/
/* Relative Humidity */
xmlKey = FogDisplay.FOG_DISP_METEO_REL_HUMIDITY.getXmlKey();
fdmd.setMeteoRelHumR(ftm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
fdmd.setMeteoRelHumY(ftm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
/*
* Add data to array.
*/
fdmd.setMeteoRelHumR(ftm.getThresholdValue(duKey, threshKeyR,
areaID, xmlKey));
fdmd.setMeteoRelHumY(ftm.getThresholdValue(duKey, threshKeyY,
areaID, xmlKey));
/* Add data to array. */
fogDataArray.add(fdmd);
}
}
private FogDisplayMeteoData getDataAtFirstSelection()
{
/**
* Gets Data At First Selection.
*
* @return selected data
*/
private FogDisplayMeteoData getDataAtFirstSelection() {
int index = dataList.getSelectionIndex();
return fogDataArray.get(index);
return fogDataArray.get(index);
}
private void updateDataArray(FogDisplayMeteoData fdmd)
{
int[] dataListIndexes = dataList.getSelectionIndices();
/**
* Updates Data Array.
*
* @param fdmd
* Display Meteo Data
*/
private void updateDataArray(FogDisplayMeteoData fdmd) {
int[] dataListIndexes = dataList.getSelectionIndices();
int currentIndex = 0;
for (int i = 0; i < dataListIndexes.length; i++)
{
for (int i = 0; i < dataListIndexes.length; i++) {
currentIndex = dataListIndexes[i];
fogDataArray.get(currentIndex).updateData(fdmd);
}
}
@Override
public void commitDataToXML()
{
FogThresholdMgr ftm = FogThresholdMgr.getInstance();
String xmlKey;
String areaID;
for (FogDisplayMeteoData fdmd : fogDataArray)
{
areaID = fdmd.getAreaID();
/*
* Visibility
*/
xmlKey = FogDisplay.FOG_DISP_METEO_VIS.getXmlKey();
ftm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, fdmd.getMeteoVisR());
ftm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, fdmd.getMeteoVisY());
/*
* Ceiling
*/
xmlKey = FogDisplay.FOG_DISP_METEO_CEILING.getXmlKey();
ftm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, fdmd.getMeteoCeilingR());
ftm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, fdmd.getMeteoCeilingY());
/*
* Temperature
*/
xmlKey = FogDisplay.FOG_DISP_METEO_TEMP.getXmlKey();
ftm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, fdmd.getMeteoTempR());
ftm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, fdmd.getMeteoTempY());
/*
* Dewpoint
*/
xmlKey = FogDisplay.FOG_DISP_METEO_DEWPT.getXmlKey();
ftm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, fdmd.getMeteoDewpointR());
ftm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, fdmd.getMeteoDewpointY());
/*
* T-Td
*/
xmlKey = FogDisplay.FOG_DISP_METEO_T_TD.getXmlKey();
ftm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, fdmd.getMeteoTtdR());
ftm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, fdmd.getMeteoTtdY());
/*
* Relative Humidity
*/
xmlKey = FogDisplay.FOG_DISP_METEO_REL_HUMIDITY.getXmlKey();
ftm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, fdmd.getMeteoRelHumR());
ftm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, fdmd.getMeteoRelHumY());
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#commitDataToXML()
*/
@Override
public void reloadData()
{
public void commitDataToXML() {
FogThresholdMgr ftm = FogThresholdMgr.getInstance();
String xmlKey;
String areaID;
for (FogDisplayMeteoData fdmd : fogDataArray) {
areaID = fdmd.getAreaID();
/* Visibility */
xmlKey = FogDisplay.FOG_DISP_METEO_VIS.getXmlKey();
ftm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
fdmd.getMeteoVisR());
ftm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
fdmd.getMeteoVisY());
/* Ceiling */
xmlKey = FogDisplay.FOG_DISP_METEO_CEILING.getXmlKey();
ftm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
fdmd.getMeteoCeilingR());
ftm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
fdmd.getMeteoCeilingY());
/* Temperature */
xmlKey = FogDisplay.FOG_DISP_METEO_TEMP.getXmlKey();
ftm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
fdmd.getMeteoTempR());
ftm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
fdmd.getMeteoTempY());
/* Dewpoint */
xmlKey = FogDisplay.FOG_DISP_METEO_DEWPT.getXmlKey();
ftm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
fdmd.getMeteoDewpointR());
ftm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
fdmd.getMeteoDewpointY());
/* T-Td */
xmlKey = FogDisplay.FOG_DISP_METEO_T_TD.getXmlKey();
ftm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
fdmd.getMeteoTtdR());
ftm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
fdmd.getMeteoTtdY());
/* Relative Humidity */
xmlKey = FogDisplay.FOG_DISP_METEO_REL_HUMIDITY.getXmlKey();
ftm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
fdmd.getMeteoRelHumR());
ftm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
fdmd.getMeteoRelHumY());
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#reloadData()
*/
@Override
public void reloadData() {
dataList.removeAll();
fogDataArray.clear();
fogDataArray = null;
populateList();
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#editDataAction()
*/
@Override
protected void editDataAction()
{
protected void editDataAction() {
FogDisplayMeteoData fdmd = getDataAtFirstSelection();
if (fogMeteoEditDlg == null)
{
fogMeteoEditDlg = new FogDisplayMeteoEditDlg(getParent().getShell(), fdmd, this);
fogMeteoEditDlg.open();
if (fogMeteoEditDlg == null) {
fogMeteoEditDlg = new FogDisplayMeteoEditDlg(
getParent().getShell(), fdmd, this);
fogMeteoEditDlg.open();
fogMeteoEditDlg = null;
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.fog.ui.dialogs.IUpdateDisplayMeteo#
* updateThresholdData
* (com.raytheon.uf.viz.monitor.fog.threshold.FogDisplayMeteoData)
*/
@Override
public void updateThresholdData(FogDisplayMeteoData fdmd)
{
public void updateThresholdData(FogDisplayMeteoData fdmd) {
updateDataArray(fdmd);
populateList();
}
}

View file

@ -20,7 +20,6 @@
package com.raytheon.uf.viz.monitor.fog.ui.dialogs;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.eclipse.swt.SWT;
@ -30,30 +29,60 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.TabFolder;
import com.raytheon.uf.common.monitor.config.FogMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.MonitorConfigurationManager;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.monitor.data.RangesUtil;
import com.raytheon.uf.viz.monitor.fog.threshold.FogMonitorMeteoData;
import com.raytheon.uf.viz.monitor.fog.threshold.FogThresholdMgr;
import com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp;
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.FogMonitor;
import com.raytheon.uf.viz.monitor.xml.AreaXML;
import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
/**
* Fog Monitor Meteo Table
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------
* May 21, 2014 3086 skorolev Cleaned code.
*
* </pre>
*
* @author
* @version 1.0
*/
public class FogMonitorMeteoTab extends TabItemComp implements
IUpdateMonitorMeteo {
private MonitorConfigurationManager areaConfigMgr = null;
/** Dialog used for editing the Monitor meteo data. */
private FogMonitorMeteoEditDlg fogMeteoEditDlg;
private ArrayList<String> areaIDArray;
/** List of zones */
private List<String> areaIDArray;
private ArrayList<FogMonitorMeteoData> fogDataArray;
/** Data Array */
private List<FogMonitorMeteoData> fogDataArray;
/**
* Constructor.
*
* @param parent
* @param duKey
*/
public FogMonitorMeteoTab(TabFolder parent, DataUsageKey duKey) {
super(parent, duKey);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#createListHeader(org
* .eclipse.swt.widgets.Composite)
*/
@Override
protected void createListHeader(Composite parentComp) {
Composite lblComp = new Composite(parentComp, SWT.NONE);
@ -77,6 +106,11 @@ public class FogMonitorMeteoTab extends TabItemComp implements
createLabelComp(meteoComp, "Vis(mi)", "", true);
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#populateList()
*/
@Override
protected void populateList() {
if (fogDataArray == null) {
@ -133,35 +167,41 @@ public class FogMonitorMeteoTab extends TabItemComp implements
packListControls();
}
/**
* Create Data Array.
*/
private void createDataArray() {
fogDataArray = new ArrayList<FogMonitorMeteoData>();
FogThresholdMgr ftm = FogThresholdMgr.getInstance();
areaConfigMgr = getAreaConfigMgr();
ThresholdsXML threshXML = ftm.getThresholdsXmlData(duKey);
List<String> areas = areaConfigMgr.getAreaList();
Collections.sort(areas);
for (String area : areas) {
List<AreaXML> areasArray = threshXML.getAreas();
for (AreaXML area : areasArray) {
String areaID = area.getAreaId();
FogMonitorMeteoData fmmd = new FogMonitorMeteoData();
fmmd.setAreaID(area);
fmmd.setAreaID(areaID);
/*
* Visibility
*/
String xmlKey = FogMonitor.FOG_MONITOR_METEO_VIS.getXmlKey();
fmmd.setMeteoVisR(ftm.getThresholdValue(duKey, threshKeyR, area,
fmmd.setMeteoVisR(ftm.getThresholdValue(duKey, threshKeyR, areaID,
xmlKey));
fmmd.setMeteoVisY(ftm.getThresholdValue(duKey, threshKeyY, area,
fmmd.setMeteoVisY(ftm.getThresholdValue(duKey, threshKeyY, areaID,
xmlKey));
fogDataArray.add(fmmd);
}
}
/**
* Gets Data At First Selection
*
* @return
*/
private FogMonitorMeteoData getDataAtFirstSelection() {
int index = dataList.getSelectionIndex();
@ -170,17 +210,27 @@ public class FogMonitorMeteoTab extends TabItemComp implements
}
/**
* Update Fog Data Array.
*
* @param fmmd
* Meteo data
*/
private void updateFogDataArray(FogMonitorMeteoData fmmd) {
int[] dataListIndexes = dataList.getSelectionIndices();
int currentIndex = 0;
for (int i = 0; i < dataListIndexes.length; i++) {
currentIndex = dataListIndexes[i];
fogDataArray.get(currentIndex).updateData(fmmd);
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#commitDataToXML()
*/
@Override
public void commitDataToXML() {
FogThresholdMgr ftm = FogThresholdMgr.getInstance();
@ -202,15 +252,24 @@ public class FogMonitorMeteoTab extends TabItemComp implements
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#reloadData()
*/
@Override
public void reloadData() {
dataList.removeAll();
fogDataArray.clear();
fogDataArray = null;
populateList();
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#editDataAction()
*/
@Override
protected void editDataAction() {
FogMonitorMeteoData fdmd = getDataAtFirstSelection();
@ -223,21 +282,16 @@ public class FogMonitorMeteoTab extends TabItemComp implements
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.fog.ui.dialogs.IUpdateMonitorMeteo#
* updateThresholdData
* (com.raytheon.uf.viz.monitor.fog.threshold.FogMonitorMeteoData)
*/
@Override
public void updateThresholdData(FogMonitorMeteoData fmmd) {
updateFogDataArray(fmmd);
populateList();
}
private MonitorConfigurationManager getAreaConfigMgr() {
if (areaConfigMgr == null) {
LocalizationManager mgr = LocalizationManager.getInstance();
String siteScope = mgr.getCurrentSite();
areaConfigMgr = FogMonitorConfigurationManager.getInstance();
areaConfigMgr.readConfigXml(siteScope);
}
return areaConfigMgr;
}
}

View file

@ -22,7 +22,8 @@ package com.raytheon.uf.viz.monitor.fog.ui.dialogs;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.monitor.config.FogMonitorConfigurationManager;
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.AppName;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
@ -42,6 +43,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg;
* Nov 27, 2012 1351 skorolev Changes for non-blocking dialog.
* Jan 29, 2014 2757 skorolev Changed OK button handler.
* Apr 23, 2014 3054 skorolev Fixed issue with removing a new station from list.
* Apr 28, 2014 3086 skorolev Updated getConfigManager.
*
* </pre>
*
@ -50,14 +52,20 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg;
*/
public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
/** Configuration manager for Fog monitor. */
private static FSSObsMonitorConfigurationManager fogConfigMgr;
/**
* Constructor
*
* @param parent
* @param title
*/
public FogMonitoringAreaConfigDlg(Shell parent, String title) {
super(parent, title, AppName.FOG);
readConfigData();
}
private FogMonitorConfigurationManager configManager = FogMonitorConfigurationManager
.getInstance();
/*
* (non-Javadoc)
*
@ -72,12 +80,10 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
"Fog Monitor Confirm Changes",
"Want to Update Fog Monitor's Setup files?");
if (choice == SWT.OK) {
// Save the config xml file
configManager.setTimeWindow(timeWindow.getSelection());
configManager.setShipDistance(shipDistance.getSelection());
configManager.setUseAlgorithms(fogChk.getSelection());
// Save the configuration xml file
getValues();
resetStatus();
configManager.saveConfigData();
fogConfigMgr.saveConfigXml();
/**
* DR#11279: re-initialize threshold manager and the monitor
* using new monitor area configuration
@ -85,16 +91,16 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
FogThresholdMgr.reInitialize();
FogMonitor.reInitialize();
if ((!configManager.getAddedZones().isEmpty())
|| (!configManager.getAddedStations().isEmpty())) {
if ((!fogConfigMgr.getAddedZones().isEmpty())
|| (!fogConfigMgr.getAddedStations().isEmpty())) {
if (editDialog() == SWT.YES) {
FogMonDispThreshDlg fogMonitorDlg = new FogMonDispThreshDlg(
shell, CommonConfig.AppName.FOG,
DataUsageKey.MONITOR);
fogMonitorDlg.open();
}
configManager.getAddedZones().clear();
configManager.getAddedStations().clear();
fogConfigMgr.getAddedZones().clear();
fogConfigMgr.getAddedStations().clear();
}
}
} else {
@ -112,40 +118,26 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#
* setAlgorithmText()
* @see
* com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#getInstance
* ()
*/
@Override
protected void setAlgorithmText() {
fogChk.setText("Fog Monitor algorithms' threat level is considered when determining\n"
+ "the guardian icon color.");
protected FSSObsMonitorConfigurationManager getInstance() {
if (fogConfigMgr == null) {
fogConfigMgr = new FSSObsMonitorConfigurationManager(currentSite,
MonName.fog.name());
}
return (FSSObsMonitorConfigurationManager) fogConfigMgr;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#readConfigData
* ()
* com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#disposed()
*/
@Override
protected void readConfigData() {
configManager.readConfigXml(currentSite);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#setValues
* ()
*/
@Override
protected void setValues() {
timeWindow.setSelection(configManager.getTimeWindow());
setTimeScaleLabel();
shipDistance.setSelection(configManager.getShipDistance());
setShipDistScaleLabel();
fogChk.setSelection(configManager.isUseAlgorithms());
protected void disposed() {
fogConfigMgr = null;
}
}

View file

@ -27,8 +27,8 @@ import java.util.Map;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.monitor.config.FogMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.MonitorConfigurationManager;
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.ObConst.DataUsageKey;
import com.raytheon.uf.common.monitor.data.ObConst.DisplayVarName;
@ -57,7 +57,8 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg;
* Oct 30, 2012 skorolev Changed HashMap to Map
* Nov 11, 2012 1297 skorolev Added initiateProdArray
* Dec 03, 2012 15216/15639 zhao fixed a bug related to Link-to-Frame
* 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.
*
* </pre>
*
@ -65,12 +66,23 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg;
* @version 1.0
*/
public class FogZoneTableDlg extends ZoneTableDlg {
/** Fog threshold dialog. **/
private FogMonDispThreshDlg fogThreshDlg;
/**
* Constructor
*
* @param parent
* @param obData
*/
public FogZoneTableDlg(Shell parent, ObMultiHrsReports obData) {
super(parent, obData, CommonConfig.AppName.FOG);
}
/**
* @param parent
*/
public FogZoneTableDlg(Shell parent) {
super(parent, CommonConfig.AppName.FOG);
}
@ -138,9 +150,9 @@ public class FogZoneTableDlg extends ZoneTableDlg {
if (date != null) {
Date nominalTime = date;
ObMultiHrsReports obData = fog.getObData();
if (!isLinkedToFrame()) {
nominalTime = obData.getLatestNominalTime();
}
if (!isLinkedToFrame()) {
nominalTime = obData.getLatestNominalTime();
}
FogDataGenerator fdg = new FogDataGenerator();
Map<String, CellType> fogAlgCellType = fdg.getAlgCellTypes(fog
.getAlgorithmData(nominalTime));
@ -259,16 +271,6 @@ public class FogZoneTableDlg extends ZoneTableDlg {
getMonitorControlListeners().remove(monitor);
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg#getConfigMgr()
*/
@Override
protected MonitorConfigurationManager getConfigMgr() {
return FogMonitorConfigurationManager.getInstance();
}
/*
* (non-Javadoc)
*
@ -293,25 +295,11 @@ public class FogZoneTableDlg extends ZoneTableDlg {
}
@Override
protected void setZoneSortColumnAndDirection() {
if (zoneTblData != null) {
zoneSortColumn = zoneTblData.getSortColumn();
zoneSortDirection = zoneTblData.getSortDirection();
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
if (configMgr == null) {
configMgr = new FSSObsMonitorConfigurationManager(site,
MonName.fog.name());
}
return configMgr;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg#
* setStnSortColumnAndDirection()
*/
@Override
protected void setStnSortColumnAndDirection() {
if (stnTblData != null) {
stnSortColumn = stnTblData.getSortColumn();
stnSortDirection = stnTblData.getSortDirection();
}
}
}

View file

@ -36,14 +36,14 @@ import com.raytheon.uf.common.dataplugin.fog.FogRecord;
import com.raytheon.uf.common.dataplugin.fog.FogRecord.FOG_THREAT;
import com.raytheon.uf.common.geospatial.SpatialException;
import com.raytheon.uf.common.monitor.MonitorAreaUtils;
import com.raytheon.uf.common.monitor.config.SSMonitorConfigurationManager;
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.CommonConfig;
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.alerts.AlertMessage;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.notification.NotificationMessage;
import com.raytheon.uf.viz.monitor.IMonitor;
import com.raytheon.uf.viz.monitor.Monitor;
@ -64,6 +64,7 @@ import com.raytheon.uf.viz.monitor.safeseas.ui.dialogs.SSZoneTableDlg;
import com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg;
import com.raytheon.uf.viz.monitor.util.MonitorThresholdConfiguration;
import com.raytheon.viz.alerts.observers.ProductAlertObserver;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
import com.vividsolutions.jts.geom.Geometry;
/**
@ -84,6 +85,7 @@ import com.vividsolutions.jts.geom.Geometry;
* Oct 26, 2012 1280 skorolev Clean code and made changes for non-blocking dialog
* Oct 30, 2012 1297 skorolev Changed HashMap to Map
* Feb 15, 2013 1638 mschenke Changed code to reference DataURI.SEPARATOR instead of URIFilter
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
*
* </pre>
*
@ -107,7 +109,7 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
private SSMonitoringAreaConfigDlg areaDialog = null;
/** configuration manager **/
private SSMonitorConfigurationManager safeseasConfig = null;
private FSSObsMonitorConfigurationManager safeseasConfig;
/**
* This object contains all observation data necessary for the table dialogs
@ -159,6 +161,8 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
*/
private SafeSeasMonitor() {
pluginPatterns.add(ssPattern);
safeseasConfig = new FSSObsMonitorConfigurationManager(currentSite,
MonName.ss.name());
readTableConfig(MonitorThresholdConfiguration.SAFESEAS_THRESHOLD_CONFIG);
initObserver(OBS, this);
}
@ -181,6 +185,8 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
// TODO: Provide the changes in EDEX URIFilters when area configuration file
// has been changed.
/**
* Re-initialization of monitor.
*
* DR#11279: When monitor area configuration is changed, this module is
* called to re-initialize monitor using new monitor area configuration
*/
@ -192,7 +198,7 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
}
/**
* Creates the maps
* Creates the maps.
*/
private void createDataStructures() {
obData = new ObMultiHrsReports(CommonConfig.AppName.SAFESEAS);
@ -201,7 +207,7 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
}
/**
* Launch SAFESEAS Zone Dialog
* Launch SAFESEAS Zone Dialog.
*
* @param type
* @param shell
@ -219,6 +225,14 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
if (areaDialog == null) {
areaDialog = new SSMonitoringAreaConfigDlg(shell,
"Safe Seas Monitor Area Configuration");
areaDialog.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
areaDialog = null;
}
});
}
areaDialog.open();
}
@ -263,9 +277,10 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
}
/**
* Adds data to station table
* Adds data to station table.
*
* @param trd
* Table Row Data
* @param stationID
*/
public void addToStationDataTable(TableRowData trd, String stationID) {
@ -281,6 +296,8 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
}
/**
* Reads Table Configuration.
*
* Method that reads the table configuration and updates the zone monitor
* threshold map
*
@ -291,9 +308,8 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
Map<String, List<String>> zones = new HashMap<String, List<String>>();
// create zones and station list
try {
SSMonitorConfigurationManager areaConfig = getMonitorAreaConfig();
for (String zone : areaConfig.getAreaList()) {
List<String> stations = areaConfig.getAreaStations(zone);
for (String zone : safeseasConfig.getAreaList()) {
List<String> stations = safeseasConfig.getAreaStations(zone);
zones.put(zone, stations);
}
} catch (Exception e) {
@ -304,22 +320,6 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
MonitoringArea.setPlatformMap(zones);
}
/**
* Gets configuration manager
*
* @return safeseasConfig
*/
private SSMonitorConfigurationManager getMonitorAreaConfig() {
if (safeseasConfig == null) {
LocalizationManager mgr = LocalizationManager.getInstance();
String siteScope = mgr.getCurrentSite();
safeseasConfig = SSMonitorConfigurationManager.getInstance();
safeseasConfig.readConfigXml(siteScope);
}
return safeseasConfig;
}
/*
* (non-Javadoc)
*
@ -370,6 +370,8 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
}
/**
* Gets Zone Table Data.
*
* @return zoneTableData
*/
public TableData getZoneTableData() {
@ -377,6 +379,8 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
}
/**
* Gets Station Table Data.
*
* @return stationTableData
*/
public TableData getStationTableData() {
@ -417,6 +421,8 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
}
/**
* Gets Dialog Time.
*
* @return dialogTime
*/
public Date getDialogTime() {
@ -433,25 +439,27 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
}
/**
* Add recourse listener
* Adds recourse listener
*
* @param issr
* listener
*/
public void addSSResourceListener(ISSResourceListener issr) {
safeSeasResources.add(issr);
}
/**
* Remove recourse listener
* Removes recourse listener
*
* @param issr
* listener
*/
public void removeSSResourceListener(ISSResourceListener issr) {
safeSeasResources.remove(issr);
}
/**
* Close dialog
* Close dialog.
*/
public void closeDialog() {
if (zoneDialog != null) {
@ -468,11 +476,8 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
}
/**
* (non-Javadoc)
*
* @param type
* @return
*
* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.IMonitor#getTimeOrderedKeys(com.raytheon.
* uf.viz.monitor.IMonitor, java.lang.String)
*/
@ -489,7 +494,7 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
*/
public Map<String, Geometry> getMonitoringAreaGeometries() {
if (zoneGeometries == null) {
List<String> zones = getMonitorAreaConfig().getAreaList();
List<String> zones = safeseasConfig.getAreaList();
zoneGeometries = new HashMap<String, Geometry>();
for (String zone : zones) {
try {

View file

@ -21,10 +21,10 @@ package com.raytheon.uf.viz.monitor.safeseas.threshold;
import java.util.ArrayList;
import com.raytheon.uf.common.monitor.config.MonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.SSMonitorConfigurationManager;
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.ObConst.DataUsageKey;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SafeSeasDisplay;
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SafeSeasMonitor;
@ -39,7 +39,8 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SafeSeasMonitor;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 27, 2009 #3963 lvenable Initial creation
* Feb 03, 2014 #2757 skorolev Fixed reInitialize()
* Feb 03, 2014 #2757 skorolev Fixed reInitialize().
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
*
* </pre>
*
@ -50,12 +51,15 @@ public class SSThresholdMgr extends AbstractThresholdMgr {
private static SSThresholdMgr classInstance;
private SSThresholdMgr() {
/**
* Private constructor.
*/
public SSThresholdMgr() {
super("DefaultSSDisplayThresholds.xml",
"DefaultSSMonitorThresholds.xml", "safeseas");
areaConfigMgr = getAreaConfigMgr();
// call init() after areaConfigMgr is set
"DefaultSSMonitorThresholds.xml", AppName.SAFESEAS.name()
.toLowerCase());
areaConfigMgr = new FSSObsMonitorConfigurationManager(site,
MonName.ss.name());
init();
}
@ -72,6 +76,8 @@ public class SSThresholdMgr extends AbstractThresholdMgr {
}
/**
* Re-initialization of threshold manager.
*
* DR#11279: When monitor area configuration is changed, threshold manager
* needs to be re-initialized using the new monitor area configuration
*/
@ -105,25 +111,20 @@ public class SSThresholdMgr extends AbstractThresholdMgr {
threshKeys.add(ssMon.getXmlKey());
}
}
return threshKeys;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr#getAreaConfigMgr
* ()
* @see com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr#
* getMonitorAreaConfigInstance()
*/
@Override
public MonitorConfigurationManager getAreaConfigMgr() {
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
if (areaConfigMgr == null) {
LocalizationManager mgr = LocalizationManager.getInstance();
String siteScope = mgr.getCurrentSite();
areaConfigMgr = SSMonitorConfigurationManager.getInstance();
areaConfigMgr.readConfigXml(siteScope);
areaConfigMgr = new FSSObsMonitorConfigurationManager(site,
MonName.ss.name());
}
return areaConfigMgr;
}

View file

@ -26,6 +26,7 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import com.raytheon.uf.viz.monitor.safeseas.ui.dialogs.SSMonitoringAreaConfigDlg;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
/**
* The SAFESEAS Action
@ -37,7 +38,8 @@ import com.raytheon.uf.viz.monitor.safeseas.ui.dialogs.SSMonitoringAreaConfigDlg
* ------------ ---------- ----------- --------------------------
* Dec 28, 2009 3963 dhladky Initial creation.
* March 5, 2012 14413 zhao Launch AreaConfigDlg w/o monitor
* Nov.27, 2012 1297 skorolev Cleanup code for non-blocking dialog
* Nov.27, 2012 1297 skorolev Cleanup code for non-blocking dialog.
* May 08, 2014 3086 skorolev Added CloseCallback to dialog.
*
* </pre>
*
@ -47,8 +49,18 @@ import com.raytheon.uf.viz.monitor.safeseas.ui.dialogs.SSMonitoringAreaConfigDlg
public class SafeseasAreaConfigAction extends AbstractHandler {
/**
* SAFESEAS Monitoring Area Configuration Dialog.
*/
private SSMonitoringAreaConfigDlg configDlg;
/*
* (non-Javadoc)
*
* @see
* org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands
* .ExecutionEvent)
*/
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
if (configDlg == null) {
@ -56,6 +68,14 @@ public class SafeseasAreaConfigAction extends AbstractHandler {
.getShell();
configDlg = new SSMonitoringAreaConfigDlg(shell,
"SAFESEAS Monitor Area Configuration");
configDlg.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
configDlg = null;
}
});
}
configDlg.open();
return null;

View file

@ -20,6 +20,7 @@
package com.raytheon.uf.viz.monitor.safeseas.ui.dialogs;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@ -37,22 +38,54 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SafeSeasDisplay;
import com.raytheon.uf.viz.monitor.xml.AreaXML;
import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
public class SSDisplayMeteoTab extends TabItemComp implements IUpdateDisplayMeteo
{
/**
* SAFESEAS Display Meteo Table
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 21, 2014 3086 skorolev Cleaned code
*
* </pre>
*
* @author
* @version 1.0
*/
public class SSDisplayMeteoTab extends TabItemComp implements
IUpdateDisplayMeteo {
/** Dialog used for editing the display meteo data. */
private SSDisplayMeteoEditDlg editMeteoDlg;
private ArrayList<String> areaIDArray;
/** List of zones */
private List<String> areaIDArray;
private ArrayList<SSDisplayMeteoData> ssDataArray;
/** SAFESEAS Data Array */
private List<SSDisplayMeteoData> ssDataArray;
public SSDisplayMeteoTab(TabFolder parent, DataUsageKey duKey)
{
/**
* Constructor
*
* @param parent
* @param duKey
* threshold usage data key
*/
public SSDisplayMeteoTab(TabFolder parent, DataUsageKey duKey) {
super(parent, duKey);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#createListHeader(org
* .eclipse.swt.widgets.Composite)
*/
@Override
protected void createListHeader(Composite parentComp)
{
protected void createListHeader(Composite parentComp) {
Composite lblComp = new Composite(parentComp, SWT.NONE);
GridLayout gl = new GridLayout(5, false);
gl.horizontalSpacing = 0;
@ -80,17 +113,19 @@ public class SSDisplayMeteoTab extends TabItemComp implements IUpdateDisplayMete
createLabelComp(windComp, "Wave", "Steep\n(x1000)", false);
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#populateList()
*/
@Override
protected void populateList()
{
if (ssDataArray == null)
{
protected void populateList() {
if (ssDataArray == null) {
createDataArray();
}
boolean update = false;
if (dataList.getItemCount() > 0)
{
if (dataList.getItemCount() > 0) {
update = true;
}
@ -106,8 +141,7 @@ public class SSDisplayMeteoTab extends TabItemComp implements IUpdateDisplayMete
StringBuilder sb = null;
SSDisplayMeteoData ssdmd = null;
for (int i = 0; i < ssDataArray.size(); i++)
{
for (int i = 0; i < ssDataArray.size(); i++) {
sb = new StringBuilder();
ssdmd = ssDataArray.get(i);
@ -117,254 +151,250 @@ public class SSDisplayMeteoTab extends TabItemComp implements IUpdateDisplayMete
sb.append(String.format(areaIdFmt, currentAreaID));
/*
* Visibility
*/
visVal = ssdmd.getVisR();
tmpVisStr = rangeUtil.getVisString((int)visVal);
sb.append(String.format(dataFmt, tmpVisStr));
/* Visibility */
visVal = ssdmd.getVisR();
tmpVisStr = rangeUtil.getVisString((int) visVal);
sb.append(String.format(dataFmt, tmpVisStr));
visVal = ssdmd.getVisY();
tmpVisStr = rangeUtil.getVisString((int)visVal);
sb.append(String.format(dataFmt, tmpVisStr));
visVal = ssdmd.getVisY();
tmpVisStr = rangeUtil.getVisString((int) visVal);
sb.append(String.format(dataFmt, tmpVisStr));
/*
* Temperature
*/
appendIntData(sb, ssdmd.getTempR(), ssdmd.getTempY());
/* Temperature */
appendIntData(sb, ssdmd.getTempR(), ssdmd.getTempY());
/*
* Dew point
*/
appendIntData(sb, ssdmd.getDewpointR(), ssdmd.getDewpointY());
/* Dew point */
appendIntData(sb, ssdmd.getDewpointR(), ssdmd.getDewpointY());
/*
* SLP
*/
appendIntData(sb, ssdmd.getSlpR(), ssdmd.getSlpY());
/* SLP */
appendIntData(sb, ssdmd.getSlpR(), ssdmd.getSlpY());
/*
* SST
*/
appendIntData(sb, ssdmd.getSstR(), ssdmd.getSstY());
/* SST */
appendIntData(sb, ssdmd.getSstR(), ssdmd.getSstY());
/*
* Wave Height
*/
appendIntData(sb, ssdmd.getWaveHgtR(), ssdmd.getWaveHgtY());
/* Wave Height */
appendIntData(sb, ssdmd.getWaveHgtR(), ssdmd.getWaveHgtY());
/*
* Wave Steep
*/
appendIntData(sb, ssdmd.getWaveSteepR(), ssdmd.getWaveSteepY());
/* Wave Steep */
appendIntData(sb, ssdmd.getWaveSteepR(), ssdmd.getWaveSteepY());
/*
* Append a space and add the data line to the list.
*/
sb.append(" ");
/* Append a space and add the data line to the list. */
sb.append(" ");
if (update == true)
{
dataList.setItem(i, sb.toString());
}
else
{
dataList.add(sb.toString());
}
if (update == true) {
dataList.setItem(i, sb.toString());
} else {
dataList.add(sb.toString());
}
}
packListControls();
}
private void createDataArray()
{
/**
* Create Data Array.
*/
private void createDataArray() {
ssDataArray = new ArrayList<SSDisplayMeteoData>();
SSThresholdMgr sstm = SSThresholdMgr.getInstance();
SSThresholdMgr sstm = new SSThresholdMgr();
String xmlKey;
String areaID;
ThresholdsXML threshXML = sstm.getThresholdsXmlData(duKey);
ArrayList<AreaXML> areasArray = threshXML.getAreas();
List<AreaXML> areasArray = threshXML.getAreas();
for (AreaXML area : areasArray)
{
for (AreaXML area : areasArray) {
areaID = area.getAreaId();
SSDisplayMeteoData ssdmd = new SSDisplayMeteoData();
ssdmd.setAreaID(areaID);
/*
* Visibility
*/
/* Visibility */
xmlKey = SafeSeasDisplay.SS_DISP_METEO_VIS.getXmlKey();
ssdmd.setVisR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
ssdmd.setVisY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
ssdmd.setVisR(sstm.getThresholdValue(duKey, threshKeyR, areaID,
xmlKey));
ssdmd.setVisY(sstm.getThresholdValue(duKey, threshKeyY, areaID,
xmlKey));
/*
* Temperature
*/
/* Temperature */
xmlKey = SafeSeasDisplay.SS_DISP_METEO_TEMP.getXmlKey();
ssdmd.setTempR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
ssdmd.setTempY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
ssdmd.setTempR(sstm.getThresholdValue(duKey, threshKeyR, areaID,
xmlKey));
ssdmd.setTempY(sstm.getThresholdValue(duKey, threshKeyY, areaID,
xmlKey));
/*
* Dew point
*/
/* Dew point */
xmlKey = SafeSeasDisplay.SS_DISP_METEO_DEWPT.getXmlKey();
ssdmd.setDewpointR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
ssdmd.setDewpointY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
ssdmd.setDewpointR(sstm.getThresholdValue(duKey, threshKeyR,
areaID, xmlKey));
ssdmd.setDewpointY(sstm.getThresholdValue(duKey, threshKeyY,
areaID, xmlKey));
/*
* SLP
*/
/* SLP */
xmlKey = SafeSeasDisplay.SS_DISP_METEO_SLP.getXmlKey();
ssdmd.setSlpR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
ssdmd.setSlpY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
ssdmd.setSlpR(sstm.getThresholdValue(duKey, threshKeyR, areaID,
xmlKey));
ssdmd.setSlpY(sstm.getThresholdValue(duKey, threshKeyY, areaID,
xmlKey));
/*
* SST
*/
/* SST */
xmlKey = SafeSeasDisplay.SS_DISP_METEO_SST.getXmlKey();
ssdmd.setSstR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
ssdmd.setSstY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
ssdmd.setSstR(sstm.getThresholdValue(duKey, threshKeyR, areaID,
xmlKey));
ssdmd.setSstY(sstm.getThresholdValue(duKey, threshKeyY, areaID,
xmlKey));
/*
* Wave Height
*/
/* Wave Height */
xmlKey = SafeSeasDisplay.SS_DISP_METEO_WAVE_HT.getXmlKey();
ssdmd.setWaveHgtR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
ssdmd.setWaveHgtY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
ssdmd.setWaveHgtR(sstm.getThresholdValue(duKey, threshKeyR, areaID,
xmlKey));
ssdmd.setWaveHgtY(sstm.getThresholdValue(duKey, threshKeyY, areaID,
xmlKey));
/*
* Wave Steep
*/
/* Wave Steep */
xmlKey = SafeSeasDisplay.SS_DISP_METEO_WAVE_STEEP.getXmlKey();
ssdmd.setWaveSteepR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
ssdmd.setWaveSteepY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
ssdmd.setWaveSteepR(sstm.getThresholdValue(duKey, threshKeyR,
areaID, xmlKey));
ssdmd.setWaveSteepY(sstm.getThresholdValue(duKey, threshKeyY,
areaID, xmlKey));
/*
* Add data to array.
*/
/* Add data to array. */
ssDataArray.add(ssdmd);
}
}
private SSDisplayMeteoData getDataAtFirstSelection()
{
/**
* Gets Data At First Selection.
*
* @return selected data
*/
private SSDisplayMeteoData getDataAtFirstSelection() {
int index = dataList.getSelectionIndex();
return ssDataArray.get(index);
}
private void updateDataArray(SSDisplayMeteoData ssdmd)
{
/**
* Updates Data Array.
*
* @param ssdmd
* Display Meteo Data
*/
private void updateDataArray(SSDisplayMeteoData ssdmd) {
int[] dataListIndexes = dataList.getSelectionIndices();
int currentIndex = 0;
for (int i = 0; i < dataListIndexes.length; i++)
{
for (int i = 0; i < dataListIndexes.length; i++) {
currentIndex = dataListIndexes[i];
ssDataArray.get(currentIndex).updateData(ssdmd);
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#commitDataToXML()
*/
@Override
public void commitDataToXML()
{
public void commitDataToXML() {
SSThresholdMgr sstm = SSThresholdMgr.getInstance();
String xmlKey;
String areaID;
for (SSDisplayMeteoData ssdmd : ssDataArray)
{
for (SSDisplayMeteoData ssdmd : ssDataArray) {
areaID = ssdmd.getAreaID();
/*
* Visibility
*/
/* Visibility */
xmlKey = SafeSeasDisplay.SS_DISP_METEO_VIS.getXmlKey();
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, ssdmd.getVisR());
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, ssdmd.getVisY());
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
ssdmd.getVisR());
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
ssdmd.getVisY());
/*
* Temperature
*/
/* Temperature */
xmlKey = SafeSeasDisplay.SS_DISP_METEO_TEMP.getXmlKey();
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, ssdmd.getTempR());
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, ssdmd.getTempY());
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
ssdmd.getTempR());
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
ssdmd.getTempY());
/*
* Dew point
*/
/* Dew point */
xmlKey = SafeSeasDisplay.SS_DISP_METEO_DEWPT.getXmlKey();
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, ssdmd.getDewpointR());
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, ssdmd.getDewpointY());
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
ssdmd.getDewpointR());
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
ssdmd.getDewpointY());
/*
* SLP
*/
/* SLP */
xmlKey = SafeSeasDisplay.SS_DISP_METEO_SLP.getXmlKey();
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, ssdmd.getSlpR());
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, ssdmd.getSlpY());
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
ssdmd.getSlpR());
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
ssdmd.getSlpY());
/*
* SST
*/
/* SST */
xmlKey = SafeSeasDisplay.SS_DISP_METEO_SST.getXmlKey();
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, ssdmd.getSstR());
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, ssdmd.getSstY());
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
ssdmd.getSstR());
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
ssdmd.getSstY());
/*
* Wave Height
*/
/* Wave Height */
xmlKey = SafeSeasDisplay.SS_DISP_METEO_WAVE_HT.getXmlKey();
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, ssdmd.getWaveHgtR());
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, ssdmd.getWaveHgtY());
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
ssdmd.getWaveHgtR());
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
ssdmd.getWaveHgtY());
/*
* Wave Steep
*/
/* Wave Steep */
xmlKey = SafeSeasDisplay.SS_DISP_METEO_WAVE_STEEP.getXmlKey();
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, ssdmd.getWaveSteepR());
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, ssdmd.getWaveSteepY());
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
ssdmd.getWaveSteepR());
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
ssdmd.getWaveSteepY());
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#reloadData()
*/
@Override
public void reloadData()
{
public void reloadData() {
dataList.removeAll();
ssDataArray.clear();
ssDataArray = null;
populateList();
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#editDataAction()
*/
@Override
protected void editDataAction()
{
protected void editDataAction() {
SSDisplayMeteoData ssdmd = getDataAtFirstSelection();
if (editMeteoDlg == null)
{
editMeteoDlg = new SSDisplayMeteoEditDlg(getParent().getShell(), ssdmd, this);
if (editMeteoDlg == null) {
editMeteoDlg = new SSDisplayMeteoEditDlg(getParent().getShell(),
ssdmd, this);
editMeteoDlg.open();
editMeteoDlg = null;
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.safeseas.ui.dialogs.IUpdateDisplayMeteo#
* updateThresholdData
* (com.raytheon.uf.viz.monitor.safeseas.threshold.SSDisplayMeteoData)
*/
@Override
public void updateThresholdData(SSDisplayMeteoData ssdmd)
{
public void updateThresholdData(SSDisplayMeteoData ssdmd) {
updateDataArray(ssdmd);
populateList();
}

View file

@ -22,7 +22,8 @@ package com.raytheon.uf.viz.monitor.safeseas.ui.dialogs;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.monitor.config.SSMonitorConfigurationManager;
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.AppName;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
@ -42,6 +43,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg;
* Nov 27, 2012 1351 skorolev Changes for non-blocking dialog.
* Jan 29, 2014 2757 skorolev Changed OK button handler.
* Apr 23, 2014 3054 skorolev Fixed issue with removing a new station from list.
* Apr 28, 2014 3086 skorolev Updated getConfigManager.
*
* </pre>
*
@ -51,6 +53,9 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg;
public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
/** Configuration manager for SAFESEAS monitor. */
private FSSObsMonitorConfigurationManager ssConfigMgr;
/**
* Constructor
*
@ -59,12 +64,8 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
*/
public SSMonitoringAreaConfigDlg(Shell parent, String title) {
super(parent, title, AppName.SAFESEAS);
readConfigData();
}
private SSMonitorConfigurationManager configManager = SSMonitorConfigurationManager
.getInstance();
/*
* (non-Javadoc)
*
@ -80,27 +81,25 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
"Want to update the SAFESEAS setup files?");
if (choice == SWT.OK) {
// Save the config xml file
configManager.setTimeWindow(timeWindow.getSelection());
configManager.setShipDistance(shipDistance.getSelection());
configManager.setUseAlgorithms(fogChk.getSelection());
getValues();
resetStatus();
configManager.saveConfigData();
ssConfigMgr.saveConfigXml();
/**
* DR#11279: re-initialize threshold manager and the monitor
* using new monitor area configuration
*/
SSThresholdMgr.reInitialize();
SafeSeasMonitor.reInitialize();
if ((!configManager.getAddedZones().isEmpty())
|| (!configManager.getAddedStations().isEmpty())) {
if ((!ssConfigMgr.getAddedZones().isEmpty())
|| (!ssConfigMgr.getAddedStations().isEmpty())) {
if (editDialog() == SWT.YES) {
SSDispMonThreshDlg ssMonitorDlg = new SSDispMonThreshDlg(
shell, CommonConfig.AppName.SAFESEAS,
DataUsageKey.MONITOR);
ssMonitorDlg.open();
}
configManager.getAddedZones().clear();
configManager.getAddedStations().clear();
ssConfigMgr.getAddedZones().clear();
ssConfigMgr.getAddedStations().clear();
}
}
} else {
@ -118,40 +117,26 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#
* setAlgorithmText()
* @see
* com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#getInstance
* ()
*/
@Override
protected void setAlgorithmText() {
fogChk.setText("The Fog Monitor overall threat level is "
+ "considered when determining the anchor color.");
public FSSObsMonitorConfigurationManager getInstance() {
if (ssConfigMgr == null) {
ssConfigMgr = new FSSObsMonitorConfigurationManager(currentSite,
MonName.ss.name());
}
return (FSSObsMonitorConfigurationManager) ssConfigMgr;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#readConfigData
* ()
* com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#disposed()
*/
@Override
protected void readConfigData() {
configManager.readConfigXml(currentSite);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#setValues
* ()
*/
@Override
protected void setValues() {
timeWindow.setSelection(configManager.getTimeWindow());
setTimeScaleLabel();
shipDistance.setSelection(configManager.getShipDistance());
setShipDistScaleLabel();
fogChk.setSelection(configManager.isUseAlgorithms());
protected void disposed() {
ssConfigMgr = null;
}
}

View file

@ -28,8 +28,8 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.dataplugin.fog.FogRecord.FOG_THREAT;
import com.raytheon.uf.common.monitor.config.MonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.SSMonitorConfigurationManager;
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.ObConst.DataUsageKey;
import com.raytheon.uf.common.monitor.data.ObConst.DisplayVarName;
@ -56,6 +56,7 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
* Oct 30, 2012 1297 skorolev Changed HashMap to Map
* Nov 10, 2012 1297 skorolev Added initiateProdArray
* Dec 7, 2012 #1351 skorolev Changes for non-blocking dialogs.
* Apr 28, 2014 3086 skorolev Updated getConfigMgr method.
*
* </pre>
*
@ -74,6 +75,7 @@ public class SSZoneTableDlg extends ZoneTableDlg {
* Constructor (Dec 30, 2009, zhao)
*
* @param parent
* @param obData
*/
public SSZoneTableDlg(Shell parent, ObMultiHrsReports obData) {
super(parent, obData, CommonConfig.AppName.SAFESEAS);
@ -233,16 +235,6 @@ public class SSZoneTableDlg extends ZoneTableDlg {
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg#getConfigMgr()
*/
@Override
protected MonitorConfigurationManager getConfigMgr() {
return SSMonitorConfigurationManager.getInstance();
}
/*
* (non-Javadoc)
*
@ -279,6 +271,12 @@ public class SSZoneTableDlg extends ZoneTableDlg {
// Not used
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg#
* setZoneSortColumnAndDirection()
*/
@Override
protected void setZoneSortColumnAndDirection() {
if (zoneTblData != null) {
@ -297,6 +295,12 @@ public class SSZoneTableDlg extends ZoneTableDlg {
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg#
* setStnSortColumnAndDirection()
*/
@Override
protected void setStnSortColumnAndDirection() {
if (stnTblData != null) {
@ -314,4 +318,19 @@ 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 = new FSSObsMonitorConfigurationManager(site,
MonName.ss.name());
}
return configMgr;
}
}

View file

@ -30,13 +30,13 @@ import java.util.regex.Pattern;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.monitor.config.SnowMonitorConfigurationManager;
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.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.alerts.AlertMessage;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.notification.NotificationMessage;
import com.raytheon.uf.viz.monitor.IMonitor;
import com.raytheon.uf.viz.monitor.Monitor;
@ -52,6 +52,7 @@ import com.raytheon.uf.viz.monitor.snow.ui.dialogs.SnowMonitoringAreaConfigDlg;
import com.raytheon.uf.viz.monitor.snow.ui.dialogs.SnowZoneTableDlg;
import com.raytheon.uf.viz.monitor.util.MonitorThresholdConfiguration;
import com.raytheon.viz.alerts.observers.ProductAlertObserver;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
/**
*
@ -73,6 +74,7 @@ import com.raytheon.viz.alerts.observers.ProductAlertObserver;
* Oct 26, 2012 1280 skorolev Clean code and made changes for non-blocking ZoneTableDlg
* Nov. 1, 2012 1297 skorolev Changed HashMap to Map and clean code
* Feb 15, 2013 1638 mschenke Changed code to reference DataURI.SEPARATOR instead of URIFilter
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
*
* </pre>
*
@ -96,7 +98,7 @@ public class SnowMonitor extends ObsMonitor {
private SnowMonitoringAreaConfigDlg areaDialog = null;
/** SNOW configuration manager **/
private SnowMonitorConfigurationManager snowConfig = null;
private FSSObsMonitorConfigurationManager snowConfig;
/**
* This object contains all observation data necessary for the table dialogs
@ -117,18 +119,19 @@ public class SnowMonitor extends ObsMonitor {
private final List<ISnowResourceListener> snowResources = new ArrayList<ISnowResourceListener>();
/** Pattern for SNOW **/
private final Pattern snowPattern = Pattern.compile(DataURI.SEPARATOR
+ OBS + DataURI.SEPARATOR + wildCard + DataURI.SEPARATOR
+ wildCard + DataURI.SEPARATOR + cwa + DataURI.SEPARATOR
+ wildCard + DataURI.SEPARATOR + wildCard
+ DataURI.SEPARATOR + wildCard + DataURI.SEPARATOR
+ "snow");
private final Pattern snowPattern = Pattern.compile(DataURI.SEPARATOR + OBS
+ DataURI.SEPARATOR + wildCard + DataURI.SEPARATOR + wildCard
+ DataURI.SEPARATOR + cwa + DataURI.SEPARATOR + wildCard
+ DataURI.SEPARATOR + wildCard + DataURI.SEPARATOR + wildCard
+ DataURI.SEPARATOR + "snow");
/**
* Private constructor, singleton
*/
private SnowMonitor() {
pluginPatterns.add(snowPattern);
snowConfig = new FSSObsMonitorConfigurationManager(currentSite,
MonName.snow.name());
readTableConfig(MonitorThresholdConfiguration.SNOW_THRESHOLD_CONFIG);
initObserver(OBS, this);
obData = new ObMultiHrsReports(CommonConfig.AppName.SNOW);
@ -153,6 +156,8 @@ public class SnowMonitor extends ObsMonitor {
// TODO: Provide the changes in EDEX URIFilters when area configuration file
// has been changed.
/**
* Re-initialization of monitor.
*
* DR#11279: When monitor area configuration is changed, this module is
* called to re-initialize monitor using new monitor area configuration
*/
@ -182,13 +187,21 @@ public class SnowMonitor extends ObsMonitor {
if (areaDialog == null) {
areaDialog = new SnowMonitoringAreaConfigDlg(shell,
"SNOW Monitor Area Configuration");
areaDialog.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
areaDialog = null;
}
});
}
areaDialog.open();
}
}
/**
* Gets data
* Gets data.
*
* @return obData
*/
@ -235,7 +248,7 @@ public class SnowMonitor extends ObsMonitor {
}
/**
* Sort by Date
* Sort by Date.
*
* @author dhladky
*
@ -258,9 +271,8 @@ public class SnowMonitor extends ObsMonitor {
Map<String, List<String>> zones = new HashMap<String, List<String>>();
// create zones and station list
try {
SnowMonitorConfigurationManager areaConfig = getMonitorAreaConfig();
for (String zone : areaConfig.getAreaList()) {
List<String> stations = areaConfig.getAreaStations(zone);
for (String zone : snowConfig.getAreaList()) {
List<String> stations = snowConfig.getAreaStations(zone);
zones.put(zone, stations);
}
} catch (Exception e) {
@ -271,21 +283,6 @@ public class SnowMonitor extends ObsMonitor {
MonitoringArea.setPlatformMap(zones);
}
/**
* Gets configuration manager
*
* @return snowConfig
*/
public SnowMonitorConfigurationManager getMonitorAreaConfig() {
if (snowConfig == null) {
LocalizationManager mgr = LocalizationManager.getInstance();
String siteScope = mgr.getCurrentSite();
snowConfig = SnowMonitorConfigurationManager.getInstance();
snowConfig.readConfigXml(siteScope);
}
return snowConfig;
}
/*
* (non-Javadoc)
*
@ -350,6 +347,8 @@ public class SnowMonitor extends ObsMonitor {
}
/**
* Gets Dialog Time.
*
* @return dialogTime
*/
public Date getDialogTime() {
@ -357,7 +356,7 @@ public class SnowMonitor extends ObsMonitor {
}
/**
* Sets dialog time
* Sets dialog time.
*
* @param dialogTime
*/
@ -366,27 +365,29 @@ public class SnowMonitor extends ObsMonitor {
}
/**
* add a listener
* Adds a listener.
*
* @param isru
* listener
*/
public void addSnowResourceListener(ISnowResourceListener isru) {
snowResources.add(isru);
}
/**
* remove a listener
* Removes a listener.
*
* @param isru
* listener
*/
public void removeSnowResourceListener(ISnowResourceListener isru) {
snowResources.remove(isru);
}
/**
* SnowResource sets the Drawtime
* SnowResource sets the Drawtime.
*
* @param drawTime
* @param dialogTime
*/
public void updateDialogTime(Date dialogTime) {
this.dialogTime = dialogTime;
@ -394,7 +395,7 @@ public class SnowMonitor extends ObsMonitor {
}
/**
* Close SNOW zone table dialog
* Close SNOW zone table dialog.
*/
public void closeDialog() {
if (zoneDialog != null) {
@ -424,6 +425,8 @@ public class SnowMonitor extends ObsMonitor {
}
/**
* Gets Zone Dialog.
*
* @return zoneDialog
*/
public SnowZoneTableDlg getZoneDialog() {

View file

@ -21,10 +21,10 @@ package com.raytheon.uf.viz.monitor.snow.threshold;
import java.util.ArrayList;
import com.raytheon.uf.common.monitor.config.MonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.SnowMonitorConfigurationManager;
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.ObConst.DataUsageKey;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SnowDisplay;
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SnowMonitor;
@ -40,6 +40,7 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SnowMonitor;
* ------------ ---------- ----------- --------------------------
* Dec 27, 2009 #3963 lvenable Initial creation
* Feb 03, 2014 #2757 skorolev Fixed reInitialize()
* May 21, 2014 3086 skorolev Cleaned code
*
* </pre>
*
@ -49,17 +50,21 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SnowMonitor;
public class SnowThresholdMgr extends AbstractThresholdMgr {
private static SnowThresholdMgr classInstance;
/**
* Constructor
*/
private SnowThresholdMgr() {
super("DefaultSnowDisplayThresholds.xml",
"DefaultSnowMonitorThresholds.xml", "snow");
"DefaultSnowMonitorThresholds.xml", AppName.SNOW.name()
.toLowerCase());
areaConfigMgr = getAreaConfigMgr();
// call init() after areaConfigMgr is set
areaConfigMgr = new FSSObsMonitorConfigurationManager(site,
MonName.snow.name());
init();
}
/**
* Get instance.
* Gets instance.
*
* @return
*/
@ -67,11 +72,12 @@ public class SnowThresholdMgr extends AbstractThresholdMgr {
if (classInstance == null) {
classInstance = new SnowThresholdMgr();
}
return classInstance;
}
/**
* Re-initialization of threshold manager.
*
* DR#11279: When monitor area configuration is changed, threshold manager
* needs to be re-initialized using the new monitor area configuration
*/
@ -105,25 +111,20 @@ public class SnowThresholdMgr extends AbstractThresholdMgr {
threshKeys.add(snowMon.getXmlKey());
}
}
return threshKeys;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr#getAreaConfigMgr
* ()
* @see com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr#
* getMonitorAreaConfigInstance()
*/
@Override
public MonitorConfigurationManager getAreaConfigMgr() {
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
if (areaConfigMgr == null) {
LocalizationManager mgr = LocalizationManager.getInstance();
String siteScope = mgr.getCurrentSite();
areaConfigMgr = SnowMonitorConfigurationManager.getInstance();
areaConfigMgr.readConfigXml(siteScope);
areaConfigMgr = new FSSObsMonitorConfigurationManager(site,
MonName.snow.name());
}
return areaConfigMgr;
}

View file

@ -26,6 +26,7 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import com.raytheon.uf.viz.monitor.snow.ui.dialogs.SnowMonitoringAreaConfigDlg;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
/**
* The Snow Area Action
@ -37,7 +38,8 @@ import com.raytheon.uf.viz.monitor.snow.ui.dialogs.SnowMonitoringAreaConfigDlg;
* ------------ ---------- ----------- --------------------------
* Dec 28, 2009 3963 dhladky Initial creation.
* March 5, 2012 14413 zhao Launch AreaConfigDlg w/o monitor
* Nov.27, 2012 1297 skorolev Cleanup code for non-blocking dialog
* Nov.27, 2012 1297 skorolev Cleanup code for non-blocking dialog.
* May 08, 2014 3086 skorolev Added CloseCallback to dialog.
*
* </pre>
*
@ -47,8 +49,18 @@ import com.raytheon.uf.viz.monitor.snow.ui.dialogs.SnowMonitoringAreaConfigDlg;
public class SnowAreaConfigAction extends AbstractHandler {
/**
* SNOW Monitoring Area Configuration Dialog.
*/
private SnowMonitoringAreaConfigDlg configDlg;
/*
* (non-Javadoc)
*
* @see
* org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands
* .ExecutionEvent)
*/
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
if (configDlg == null) {
@ -56,6 +68,14 @@ public class SnowAreaConfigAction extends AbstractHandler {
.getShell();
configDlg = new SnowMonitoringAreaConfigDlg(shell,
"SNOW Monitor Area Configuration");
configDlg.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
configDlg = null;
}
});
}
configDlg.open();
return null;

View file

@ -20,6 +20,7 @@
package com.raytheon.uf.viz.monitor.snow.ui.dialogs;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@ -37,393 +38,416 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SnowDisplay;
import com.raytheon.uf.viz.monitor.xml.AreaXML;
import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
public class SnowDisplayMeteoTab extends TabItemComp implements IUpdateDisplayMeteo
{
/**
* Snow Display Meteo Table.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 21, 2014 3086 skorolev Cleaned code.
*
* </pre>
*
* @author
* @version 1.0
*/
public class SnowDisplayMeteoTab extends TabItemComp implements
IUpdateDisplayMeteo {
/** Dialog used for editing the display meteo data. */
private SnowDisplayMeteoEditDlg meteoEditDlg;
private ArrayList<String> areaIDArray;
private ArrayList<SnowDisplayMeteoData> snowDataArray;
public SnowDisplayMeteoTab(TabFolder parent, DataUsageKey duKey)
{
/** List of zones */
private List<String> areaIDArray;
/** Snow Display Meteo Data. */
private List<SnowDisplayMeteoData> snowDataArray;
/**
* Constructor
*
* @param parent
* @param duKey
* threshold usage data key
*/
public SnowDisplayMeteoTab(TabFolder parent, DataUsageKey duKey) {
super(parent, duKey);
}
@Override
protected void createListHeader(Composite parentComp)
{
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#createListHeader(org
* .eclipse.swt.widgets.Composite)
*/
@Override
protected void createListHeader(Composite parentComp) {
Composite lblComp = new Composite(parentComp, SWT.NONE);
GridLayout gl = new GridLayout(5, false);
gl.horizontalSpacing = 0;
gl.horizontalSpacing = 0;
gl.marginHeight = 0;
gl.marginWidth = 0;
lblComp.setLayout(gl);
/*
* Create filler label.
*/
/* Create filler label. */
GridData gd = new GridData(71, SWT.DEFAULT);
Label fillerLbl = new Label(lblComp, SWT.CENTER);
fillerLbl.setLayoutData(gd);
/*
* Meteo
*/
/* Meteo */
Composite meteoComp = createGroupComposite(lblComp, 10, null);
createLabelComp(meteoComp, "Temp(F)", "", false);
createLabelComp(meteoComp, "Dewpt(F)", "", false);
createLabelComp(meteoComp, "Vis(mi)", "", true);
createLabelComp(meteoComp, "SLP(mb)", "", false);
createLabelComp(meteoComp, "Hourly", "Prcp(in)", false);
createLabelComp(meteoComp, "Wind", "Chill(F)", false);
createLabelComp(meteoComp, "Frost", "Bite\nTime(min)", false);
createLabelComp(meteoComp, "Wind", "Chill(F)", false);
createLabelComp(meteoComp, "Frost", "Bite\nTime(min)", false);
createLabelComp(meteoComp, "Snow", "Depth(in)", false);
createLabelComp(meteoComp, "SNINCR", "Hr(in)", false);
createLabelComp(meteoComp, "SNINCR", "Tot(in)", false);
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#populateList()
*/
@Override
protected void populateList()
{
if (snowDataArray == null)
{
protected void populateList() {
if (snowDataArray == null) {
createDataArray();
}
boolean update = false;
if (dataList.getItemCount() > 0)
{
if (dataList.getItemCount() > 0) {
update = true;
}
RangesUtil rangeUtil = RangesUtil.getInstance();
areaIDArray = new ArrayList<String>();
String tmpVisStr;
String currentAreaID;
double visVal = 0.0;
StringBuilder sb = null;
StringBuilder sb = null;
SnowDisplayMeteoData sdmd = null;
for (int i = 0; i < snowDataArray.size(); i++)
{
for (int i = 0; i < snowDataArray.size(); i++) {
sb = new StringBuilder();
sdmd = snowDataArray.get(i);
currentAreaID = sdmd.getAreaID();
areaIDArray.add(currentAreaID);
sb.append(String.format(areaIdFmt, currentAreaID));
/*
* Temp
*/
/* Temperature */
appendIntData(sb, sdmd.getTempR(), sdmd.getTempY());
/*
* Dew point
*/
/* Dew point */
appendIntData(sb, sdmd.getDewpointR(), sdmd.getDewpointY());
/*
* Visibility
*/
visVal = sdmd.getVisR();
tmpVisStr = rangeUtil.getVisString((int)visVal);
/* Visibility */
visVal = sdmd.getVisR();
tmpVisStr = rangeUtil.getVisString((int) visVal);
sb.append(String.format(dataFmt, tmpVisStr));
visVal = sdmd.getVisY();
tmpVisStr = rangeUtil.getVisString((int)visVal);
visVal = sdmd.getVisY();
tmpVisStr = rangeUtil.getVisString((int) visVal);
sb.append(String.format(dataFmt, tmpVisStr));
/*
* SLP
*/
/* SLP */
appendIntData(sb, sdmd.getSlpR(), sdmd.getSlpY());
/*
* Hourly Precip
*/
/* Hourly Precipitation */
appendDecimalData(sb, sdmd.getHrPrecipR(), sdmd.getHrPrecipY());
/*
* Wind Chill
*/
/* Wind Chill */
appendIntData(sb, sdmd.getWindChillR(), sdmd.getWindChillY());
/*
* Frost Bite
*/
/* Frost Bite */
appendIntData(sb, sdmd.getFrostBiteR(), sdmd.getFrostBiteY());
/*
* Snow Depth
*/
/* Snow Depth */
appendIntData(sb, sdmd.getSnowDepthR(), sdmd.getSnowDepthY());
/*
* SNINCR Hourly
*/
/* SNINCR Hourly */
appendIntData(sb, sdmd.getSnincrHrlyR(), sdmd.getSnincrHrlyY());
/*
* SNINCR Total
*/
/* SNINCR Total */
appendIntData(sb, sdmd.getSnincrTotR(), sdmd.getSnincrTotY());
/*
* Append a space and add the data line to the list.
*/
/* Append a space and add the data line to the list. */
sb.append(" ");
if (update == true)
{
if (update == true) {
dataList.setItem(i, sb.toString());
}
else
{
} else {
dataList.add(sb.toString());
}
}
}
packListControls();
}
private void createDataArray()
{
/**
* Creates Data Array.
*/
private void createDataArray() {
snowDataArray = new ArrayList<SnowDisplayMeteoData>();
SnowThresholdMgr stm = SnowThresholdMgr.getInstance();
SnowThresholdMgr stm = SnowThresholdMgr.getInstance();
String xmlKey;
String areaID;
String areaID;
ThresholdsXML threshXML = stm.getThresholdsXmlData(duKey);
ArrayList<AreaXML> areasArray = threshXML.getAreas();
for (AreaXML area : areasArray)
{
List<AreaXML> areasArray = threshXML.getAreas();
for (AreaXML area : areasArray) {
areaID = area.getAreaId();
SnowDisplayMeteoData sdmd = new SnowDisplayMeteoData();
sdmd.setAreaID(areaID);
/*
* Temp
*/
/* Tempature */
xmlKey = SnowDisplay.SNOW_DISP_METEO_TEMP.getXmlKey();
sdmd.setTempR(stm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
sdmd.setTempY(stm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
/*
* Dew point
*/
sdmd.setTempR(stm.getThresholdValue(duKey, threshKeyR, areaID,
xmlKey));
sdmd.setTempY(stm.getThresholdValue(duKey, threshKeyY, areaID,
xmlKey));
/* Dew point */
xmlKey = SnowDisplay.SNOW_DISP_METEO_DEWPT.getXmlKey();
sdmd.setDewpointR(stm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
sdmd.setDewpointY(stm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
/*
* Visibility
*/
sdmd.setDewpointR(stm.getThresholdValue(duKey, threshKeyR, areaID,
xmlKey));
sdmd.setDewpointY(stm.getThresholdValue(duKey, threshKeyY, areaID,
xmlKey));
/* Visibility */
xmlKey = SnowDisplay.SNOW_DISP_METEO_VIS.getXmlKey();
sdmd.setVisR(stm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
sdmd.setVisY(stm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
/*
* SLP
*/
sdmd.setVisR(stm.getThresholdValue(duKey, threshKeyR, areaID,
xmlKey));
sdmd.setVisY(stm.getThresholdValue(duKey, threshKeyY, areaID,
xmlKey));
/* SLP */
xmlKey = SnowDisplay.SNOW_DISP_METEO_SLP.getXmlKey();
sdmd.setSlpR(stm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
sdmd.setSlpY(stm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
/*
* Hourly Precip
*/
sdmd.setSlpR(stm.getThresholdValue(duKey, threshKeyR, areaID,
xmlKey));
sdmd.setSlpY(stm.getThresholdValue(duKey, threshKeyY, areaID,
xmlKey));
/* Hourly Precipitation */
xmlKey = SnowDisplay.SNOW_DISP_METEO_HOURLY_PRECIP.getXmlKey();
sdmd.setHrPrecipR(stm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
sdmd.setHrPrecipY(stm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
/*
* Wind Chill
*/
sdmd.setHrPrecipR(stm.getThresholdValue(duKey, threshKeyR, areaID,
xmlKey));
sdmd.setHrPrecipY(stm.getThresholdValue(duKey, threshKeyY, areaID,
xmlKey));
/* Wind Chill */
xmlKey = SnowDisplay.SNOW_DISP_METEO_WIND_CHILL.getXmlKey();
sdmd.setWindChillR(stm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
sdmd.setWindChillY(stm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
/*
* Frost Bite
*/
sdmd.setWindChillR(stm.getThresholdValue(duKey, threshKeyR, areaID,
xmlKey));
sdmd.setWindChillY(stm.getThresholdValue(duKey, threshKeyY, areaID,
xmlKey));
/* Frost Bite */
xmlKey = SnowDisplay.SNOW_DISP_METEO_FROSTBITE.getXmlKey();
sdmd.setFrostBiteR(stm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
sdmd.setFrostBiteY(stm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
/*
* Snow Depth
*/
sdmd.setFrostBiteR(stm.getThresholdValue(duKey, threshKeyR, areaID,
xmlKey));
sdmd.setFrostBiteY(stm.getThresholdValue(duKey, threshKeyY, areaID,
xmlKey));
/* Snow Depth */
xmlKey = SnowDisplay.SNOW_DISP_METEO_SNOW_DEPTH.getXmlKey();
sdmd.setSnowDepthR(stm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
sdmd.setSnowDepthY(stm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
/*
* SNINCR Hourly
*/
sdmd.setSnowDepthR(stm.getThresholdValue(duKey, threshKeyR, areaID,
xmlKey));
sdmd.setSnowDepthY(stm.getThresholdValue(duKey, threshKeyY, areaID,
xmlKey));
/* SNINCR Hourly */
xmlKey = SnowDisplay.SNOW_DISP_METEO_SNINCR_HOURLY.getXmlKey();
sdmd.setSnincrHrlyR(stm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
sdmd.setSnincrHrlyY(stm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
/*
* SNINCR Total
*/
sdmd.setSnincrHrlyR(stm.getThresholdValue(duKey, threshKeyR,
areaID, xmlKey));
sdmd.setSnincrHrlyY(stm.getThresholdValue(duKey, threshKeyY,
areaID, xmlKey));
/* SNINCR Total */
xmlKey = SnowDisplay.SNOW_DISP_METEO_SNINCR_TOTAL.getXmlKey();
sdmd.setSnincrTotR(stm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
sdmd.setSnincrTotY(stm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
/*
* Add data to array.
*/
sdmd.setSnincrTotR(stm.getThresholdValue(duKey, threshKeyR, areaID,
xmlKey));
sdmd.setSnincrTotY(stm.getThresholdValue(duKey, threshKeyY, areaID,
xmlKey));
/* Add data to array. */
snowDataArray.add(sdmd);
}
}
private SnowDisplayMeteoData getDataAtFirstSelection()
{
/**
* Gets Data At First Selection.
*
* @return selected data
*/
private SnowDisplayMeteoData getDataAtFirstSelection() {
int index = dataList.getSelectionIndex();
return snowDataArray.get(index);
return snowDataArray.get(index);
}
private void updateDataArray(SnowDisplayMeteoData sdmd)
{
int[] dataListIndexes = dataList.getSelectionIndices();
/**
* Updates Data Array.
*
* @param sdmd
* Display Meteo Data
*/
private void updateDataArray(SnowDisplayMeteoData sdmd) {
int[] dataListIndexes = dataList.getSelectionIndices();
int currentIndex = 0;
for (int i = 0; i < dataListIndexes.length; i++)
{
for (int i = 0; i < dataListIndexes.length; i++) {
currentIndex = dataListIndexes[i];
snowDataArray.get(currentIndex).updateData(sdmd);
}
}
@Override
public void commitDataToXML()
{
SnowThresholdMgr stm = SnowThresholdMgr.getInstance();
String xmlKey;
String areaID;
for (SnowDisplayMeteoData sdmd : snowDataArray)
{
areaID = sdmd.getAreaID();
/*
* Temperature
*/
xmlKey = SnowDisplay.SNOW_DISP_METEO_TEMP.getXmlKey();
stm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, sdmd.getTempR());
stm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, sdmd.getTempY());
/*
* Dew point
*/
xmlKey = SnowDisplay.SNOW_DISP_METEO_DEWPT.getXmlKey();
stm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, sdmd.getDewpointR());
stm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, sdmd.getDewpointY());
/*
* Visibility
*/
xmlKey = SnowDisplay.SNOW_DISP_METEO_VIS.getXmlKey();
stm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, sdmd.getVisR());
stm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, sdmd.getVisY());
/*
* SLP
*/
xmlKey = SnowDisplay.SNOW_DISP_METEO_SLP.getXmlKey();
stm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, sdmd.getSlpR());
stm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, sdmd.getSlpY());
/*
* Hourly Precip
*/
xmlKey = SnowDisplay.SNOW_DISP_METEO_HOURLY_PRECIP.getXmlKey();
stm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, sdmd.getHrPrecipR());
stm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, sdmd.getHrPrecipY());
/*
* Wind Chill
*/
xmlKey = SnowDisplay.SNOW_DISP_METEO_WIND_CHILL.getXmlKey();
stm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, sdmd.getWindChillR());
stm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, sdmd.getWindChillY());
/*
* Frost Bite
*/
xmlKey = SnowDisplay.SNOW_DISP_METEO_FROSTBITE.getXmlKey();
stm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, sdmd.getFrostBiteR());
stm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, sdmd.getFrostBiteY());
/*
* Snow Depth
*/
xmlKey = SnowDisplay.SNOW_DISP_METEO_SNOW_DEPTH.getXmlKey();
stm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, sdmd.getSnowDepthR());
stm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, sdmd.getSnowDepthY());
/*
* SNINCR Hourly
*/
xmlKey = SnowDisplay.SNOW_DISP_METEO_SNINCR_HOURLY.getXmlKey();
stm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, sdmd.getSnincrHrlyR());
stm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, sdmd.getSnincrHrlyY());
/*
* SNINCR Total
*/
xmlKey = SnowDisplay.SNOW_DISP_METEO_SNINCR_TOTAL.getXmlKey();
stm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, sdmd.getSnincrTotR());
stm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, sdmd.getSnincrTotY());
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#commitDataToXML()
*/
@Override
public void reloadData()
{
public void commitDataToXML() {
SnowThresholdMgr stm = SnowThresholdMgr.getInstance();
String xmlKey;
String areaID;
for (SnowDisplayMeteoData sdmd : snowDataArray) {
areaID = sdmd.getAreaID();
/* Temperature */
xmlKey = SnowDisplay.SNOW_DISP_METEO_TEMP.getXmlKey();
stm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
sdmd.getTempR());
stm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
sdmd.getTempY());
/* Dew point */
xmlKey = SnowDisplay.SNOW_DISP_METEO_DEWPT.getXmlKey();
stm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
sdmd.getDewpointR());
stm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
sdmd.getDewpointY());
/* Visibility */
xmlKey = SnowDisplay.SNOW_DISP_METEO_VIS.getXmlKey();
stm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
sdmd.getVisR());
stm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
sdmd.getVisY());
/* SLP */
xmlKey = SnowDisplay.SNOW_DISP_METEO_SLP.getXmlKey();
stm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
sdmd.getSlpR());
stm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
sdmd.getSlpY());
/* Hourly Precipitation */
xmlKey = SnowDisplay.SNOW_DISP_METEO_HOURLY_PRECIP.getXmlKey();
stm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
sdmd.getHrPrecipR());
stm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
sdmd.getHrPrecipY());
/* Wind Chill */
xmlKey = SnowDisplay.SNOW_DISP_METEO_WIND_CHILL.getXmlKey();
stm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
sdmd.getWindChillR());
stm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
sdmd.getWindChillY());
/* Frost Bite */
xmlKey = SnowDisplay.SNOW_DISP_METEO_FROSTBITE.getXmlKey();
stm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
sdmd.getFrostBiteR());
stm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
sdmd.getFrostBiteY());
/* Snow Depth */
xmlKey = SnowDisplay.SNOW_DISP_METEO_SNOW_DEPTH.getXmlKey();
stm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
sdmd.getSnowDepthR());
stm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
sdmd.getSnowDepthY());
/* SNINCR Hourly */
xmlKey = SnowDisplay.SNOW_DISP_METEO_SNINCR_HOURLY.getXmlKey();
stm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
sdmd.getSnincrHrlyR());
stm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
sdmd.getSnincrHrlyY());
/* SNINCR Total */
xmlKey = SnowDisplay.SNOW_DISP_METEO_SNINCR_TOTAL.getXmlKey();
stm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
sdmd.getSnincrTotR());
stm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
sdmd.getSnincrTotY());
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#reloadData()
*/
@Override
public void reloadData() {
dataList.removeAll();
snowDataArray.clear();
snowDataArray = null;
populateList();
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#editDataAction()
*/
@Override
protected void editDataAction()
{
protected void editDataAction() {
SnowDisplayMeteoData sdmd = getDataAtFirstSelection();
if (meteoEditDlg == null)
{
meteoEditDlg = new SnowDisplayMeteoEditDlg(getParent().getShell(), sdmd, this);
if (meteoEditDlg == null) {
meteoEditDlg = new SnowDisplayMeteoEditDlg(getParent().getShell(),
sdmd, this);
meteoEditDlg.open();
meteoEditDlg = null;
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.snow.ui.dialogs.IUpdateDisplayMeteo#
* updateThresholdData
* (com.raytheon.uf.viz.monitor.snow.threshold.SnowDisplayMeteoData)
*/
@Override
public void updateThresholdData(SnowDisplayMeteoData sdmd)
{
public void updateThresholdData(SnowDisplayMeteoData sdmd) {
updateDataArray(sdmd);
populateList();
}
}

View file

@ -22,7 +22,8 @@ package com.raytheon.uf.viz.monitor.snow.ui.dialogs;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.monitor.config.SnowMonitorConfigurationManager;
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.AppName;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
@ -42,6 +43,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg;
* Nov 27, 2012 1351 skorolev Changes for non-blocking dialog.
* Jan 29, 2014 2757 skorolev Changed OK button handler.
* Apr 23, 2014 3054 skorolev Fixed issue with removing a new station from list.
* Apr 28, 2014 3086 skorolev Updated snowConfigManager.
*
* </pre>
*
@ -51,14 +53,19 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg;
public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
/** Configuration manager for SNOW monitor. */
private FSSObsMonitorConfigurationManager snowConfigMgr;
/**
* Constructor
*
* @param parent
* @param title
*/
public SnowMonitoringAreaConfigDlg(Shell parent, String title) {
super(parent, title, AppName.SNOW);
readConfigData();
}
private SnowMonitorConfigurationManager configManager = SnowMonitorConfigurationManager
.getInstance();
/*
* (non-Javadoc)
*
@ -67,16 +74,17 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
*/
@Override
protected void handleOkBtnSelection() {
// Check for changes in the data
snowConfigMgr = getInstance();
// Check for changes in the data\
if (dataIsChanged()) {
int choice = showMessage(shell, SWT.OK | SWT.CANCEL,
"SNOW Monitor Confirm Changes",
"Want to update the SNOW setup files?");
if (choice == SWT.OK) {
// Save the config xml file
configManager.setTimeWindow(timeWindow.getSelection());
getValues();
resetStatus();
configManager.saveConfigData();
snowConfigMgr.saveConfigXml();
/**
* DR#11279: re-initialize threshold manager and the monitor
* using new monitor area configuration
@ -84,17 +92,17 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
SnowThresholdMgr.reInitialize();
SnowMonitor.reInitialize();
if ((!configManager.getAddedZones().isEmpty())
|| (!configManager.getAddedStations().isEmpty())) {
if ((!snowConfigMgr.getAddedZones().isEmpty())
|| (!snowConfigMgr.getAddedStations().isEmpty())) {
if (editDialog() == SWT.YES) {
SnowMonDispThreshDlg snowMonitorDlg = new SnowMonDispThreshDlg(
shell, CommonConfig.AppName.SNOW,
DataUsageKey.MONITOR);
snowMonitorDlg.open();
}
snowConfigMgr.getAddedZones().clear();
snowConfigMgr.getAddedStations().clear();
}
configManager.getAddedZones().clear();
configManager.getAddedStations().clear();
}
} else {
String message3 = "No changes made.\nDo you want to exit?";
@ -104,6 +112,7 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
return;
}
setReturnValue(true);
snowConfigMgr = null;
close();
}
}
@ -111,37 +120,27 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#
* setAlgorithmText()
* @see
* com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#getInstance
* ()
*/
@Override
protected void setAlgorithmText() {
// Not used for SNOW
protected FSSObsMonitorConfigurationManager getInstance() {
if (configMgr == null) {
configMgr = new FSSObsMonitorConfigurationManager(currentSite,
MonName.snow.name());
}
return (FSSObsMonitorConfigurationManager) configMgr;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#readConfigData
* ()
* com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#disposed()
*/
@Override
protected void readConfigData() {
configManager.readConfigXml(currentSite);
protected void disposed() {
configMgr = null;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#setValues
* ()
*/
@Override
protected void setValues() {
timeWindow.setSelection(configManager.getTimeWindow());
setTimeScaleLabel();
}
}

View file

@ -25,8 +25,8 @@ import java.util.List;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.monitor.config.MonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.SnowMonitorConfigurationManager;
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.ObConst.DataUsageKey;
import com.raytheon.uf.common.monitor.data.ObConst.DisplayVarName;
@ -53,6 +53,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg;
* July 20,2010 4891 skorolev added code to fireDialogShutdown
* Nov. 8, 2012 1297 skorolev Added initiateProdArray method
* Dec 7, 2012 1351 skorolev Changes for non-blocking dialogs
* Apr 28, 2014 3086 skorolev Updated getConfigMgr method.
*
* </pre>
*
@ -62,9 +63,12 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg;
public class SnowZoneTableDlg extends ZoneTableDlg {
/** SNOW threshold dialog. **/
private SnowMonDispThreshDlg snowThreshDlg;
/**
* Constructor
*
* @param parent
* @param obData
*/
@ -229,16 +233,6 @@ public class SnowZoneTableDlg extends ZoneTableDlg {
getMonitorControlListeners().remove(monitor);
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg#getConfigMgr()
*/
@Override
protected MonitorConfigurationManager getConfigMgr() {
return SnowMonitorConfigurationManager.getInstance();
}
/*
* (non-Javadoc)
*
@ -265,24 +259,15 @@ public class SnowZoneTableDlg extends ZoneTableDlg {
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg#
* setZoneSortColumnAndDirection()
* @see com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg#getInstance()
*/
@Override
protected void setZoneSortColumnAndDirection() {
if (zoneTblData != null) {
zoneSortColumn = zoneTblData.getSortColumn();
zoneSortDirection = zoneTblData.getSortDirection();
}
return;
}
@Override
protected void setStnSortColumnAndDirection() {
if (stnTblData != null) {
stnSortColumn = stnTblData.getSortColumn();
stnSortDirection = stnTblData.getSortDirection();
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
if (configMgr == null) {
configMgr = new FSSObsMonitorConfigurationManager(site,
MonName.snow.name());
}
return configMgr;
}
}

View file

@ -27,12 +27,12 @@ import java.util.regex.Pattern;
import org.eclipse.swt.widgets.Display;
import com.raytheon.uf.common.inventory.exception.DataCubeException;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.annotations.DataURIUtil;
import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecord;
import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecordTransform;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.inventory.exception.DataCubeException;
import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
@ -60,6 +60,7 @@ import com.raytheon.uf.viz.monitor.events.IMonitorThresholdEvent;
* Mar 15, 2012 14510 zhao modified processProductAtStartup()
* Sep 11, 2013 2277 mschenke Got rid of ScriptCreator references
* Feb 04, 2014 2757 skorolev Added filter for removed stations
* May 08, 2014 3086 skorolev Added current site definition.
*
* </pre>
*
@ -73,6 +74,10 @@ public abstract class ObsMonitor extends Monitor {
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(ObsMonitor.class);
/** Current Site name */
protected String currentSite = LocalizationManager.getInstance()
.getCurrentSite();
/*
* (non-Javadoc)
*

View file

@ -26,8 +26,6 @@ import org.eclipse.swt.graphics.RGB;
import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.ObConst;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst.VarName;
import com.raytheon.uf.viz.monitor.data.ColumnAttribData;
/**
@ -40,6 +38,7 @@ import com.raytheon.uf.viz.monitor.data.ColumnAttribData;
* ------------ ---------- ----------- --------------------------
* Apr 8, 2009 lvenable Initial creation
* Dec 17, 2009 3424 zhao added snowZoneStnTableColVarNames
* May 23, 2014 3086 skorolev Corrected ObsHistType. Cleaned code.
*
* </pre>
*
@ -63,7 +62,7 @@ public class CommonTableConfig {
* Obs History configuration enumeration.
*/
public static enum ObsHistType {
Maritime, METAR;
MARITIME, METAR, MESONET;
}
/**
@ -71,8 +70,8 @@ public class CommonTableConfig {
*/
public static enum CellType {
R("R"), Y("Y"), G("G"), W("W"), NotAvailable("N/A"), NotMonitored("NM"), NotDetermined(
"N/D"), AreaId(""), Default(""), Custom(""), ObsHist(""), StationID(
""), PresWx("");
"N/D"), AreaId(""), Default(""), Custom(""), ObsHist(""), StationID(
""), PresWx("");
String displayString;
@ -196,94 +195,96 @@ public class CommonTableConfig {
/**
* SAFESEAS Maritime table columns.
*/
private final String[] ssMaritimeTableCols = new String[] {
obsHistCols.Time.name(), obsHistCols.Lat.name(),
obsHistCols.Lon.name(), obsHistCols.WindSpd.name(),
obsHistCols.MaxWindSpd.name(), obsHistCols.WindGust.name(),
obsHistCols.Vis_mn.name(), obsHistCols.P.name(),
obsHistCols.PTend.name(), obsHistCols.T.name(),
obsHistCols.Dewpt.name(), obsHistCols.SST.name(),
obsHistCols.SigWaveHgt.name(), obsHistCols.WaveSteep.name(),
obsHistCols.SwellHgt.name(), obsHistCols.SwellPer.name(),
obsHistCols.SwellDir.name() };
private final String[] ssMaritimeTableCols = new String[] {
obsHistCols.Time.name(), obsHistCols.Lat.name(),
obsHistCols.Lon.name(), obsHistCols.WindSpd.name(),
obsHistCols.MaxWindSpd.name(), obsHistCols.WindGust.name(),
obsHistCols.Vis_mn.name(), obsHistCols.P.name(),
obsHistCols.PTend.name(), obsHistCols.T.name(),
obsHistCols.Dewpt.name(), obsHistCols.SST.name(),
obsHistCols.SigWaveHgt.name(), obsHistCols.WaveSteep.name(),
obsHistCols.SwellHgt.name(), obsHistCols.SwellPer.name(),
obsHistCols.SwellDir.name() };
/**
* SAFESEAS METAR table columns.
*/
private final String[] ssMetarTableCols = new String[] {
obsHistCols.Time.name(), obsHistCols.Lat.name(),
obsHistCols.Lon.name(), obsHistCols.WindDir.name(),
obsHistCols.WindSpd.name(), obsHistCols.WindGust.name(),
obsHistCols.P.name(), obsHistCols.T.name(),
obsHistCols.Dewpt.name(), obsHistCols.PTend.name() };
/**
* SAFESEAS METAR table columns.
*/
private final String[] ssMetarTableCols = new String[] {
obsHistCols.Time.name(), obsHistCols.Lat.name(),
obsHistCols.Lon.name(), obsHistCols.WindDir.name(),
obsHistCols.WindSpd.name(), obsHistCols.WindGust.name(),
obsHistCols.P.name(), obsHistCols.T.name(),
obsHistCols.Dewpt.name(), obsHistCols.PTend.name() };
/**
* Snow METAR table columns.
*/
private final String[] snowMetarTableCols = new String[] {
obsHistCols.Time.name(), obsHistCols.Lat.name(),
obsHistCols.Lon.name(), obsHistCols.WindDir.name(),
obsHistCols.WindSpd.name(), obsHistCols.WindGust.name(),
obsHistCols.P.name(), obsHistCols.T.name(),
obsHistCols.Dewpt.name(), obsHistCols.PTend.name() };
/**
* Snow METAR table columns.
*/
private final String[] snowMetarTableCols = new String[] {
obsHistCols.Time.name(), obsHistCols.Lat.name(),
obsHistCols.Lon.name(), obsHistCols.WindDir.name(),
obsHistCols.WindSpd.name(), obsHistCols.WindGust.name(),
obsHistCols.P.name(), obsHistCols.T.name(),
obsHistCols.Dewpt.name(), obsHistCols.PTend.name() };
/**
* METAR configure names
*/
private final String[] metarConfigureNames = new String[] {
"Lat (deg)", "Lon (deg)", "Wind Dir (deg)", "Wind Spd (kt)", "Wind Gust (kt)", "P (in)",
"T (deg F)", "Dewpt (deg F)", "P Tendency (in)" };
private final String[] metarConfigureNames = new String[] { "Lat (deg)",
"Lon (deg)", "Wind Dir (deg)", "Wind Spd (kt)", "Wind Gust (kt)",
"P (in)", "T (deg F)", "Dewpt (deg F)", "P Tendency (in)" };
/**
* Fog METAR configure names
*/
private final String[] metarFogConfigureNames = new String[] {
"Lat (deg)", "Lon (deg)", "Rel Hum (%)", "Vis (mi)", "Ceiling (ft x 100)", "Wind Dir (deg)",
"Wind Spd (kt)", "Wind Gust (kt)", "P (in)", "T (deg F)",
"Dewpt (deg F)", "DewptDepr (deg F)", "P Tendency (in)" };
private final String[] metarFogConfigureNames = new String[] { "Lat (deg)",
"Lon (deg)", "Rel Hum (%)", "Vis (mi)", "Ceiling (ft x 100)",
"Wind Dir (deg)", "Wind Spd (kt)", "Wind Gust (kt)", "P (in)",
"T (deg F)", "Dewpt (deg F)", "DewptDepr (deg F)",
"P Tendency (in)" };
/**
* Fog Maritime configure names
*/
private final String[] maritimeFogConfigureNames = new String[] {
"Lat (deg)", "Lon (deg)", "Wind Dir (deg)", "Wind Spd (kt)", "Wind Gust (kt)", "Vis (nm)",
"P (in)", "P Tendency (in)", "T (deg F)", "Dewpt (deg F)",
"SST (deg F)", "Significant Wave Hgt (ft)", "Wave Steep",
"Swell Hgt (ft)", "Swell Per (sec)", "Swell Dir (deg)",
"Rel Hum (%)" };
"Lat (deg)", "Lon (deg)", "Wind Dir (deg)", "Wind Spd (kt)",
"Wind Gust (kt)", "Vis (nm)", "P (in)", "P Tendency (in)",
"T (deg F)", "Dewpt (deg F)", "SST (deg F)",
"Significant Wave Hgt (ft)", "Wave Steep", "Swell Hgt (ft)",
"Swell Per (sec)", "Swell Dir (deg)", "Rel Hum (%)" };
/**
* SAFESEAS Maritime configure names
*/
private final String[] maritimeSSConfigureNames = new String[] {
"Lat (deg)", "Lon (deg)", "Wind Spd (kt)", "MaxWindSpd (kt)", "Wind Gust (kt)", "Vis (nm)",
"P (in)", "P Tendency (in)", "T (deg F)", "Dewpt (deg F)",
"SST (deg F)", "Significant Wave Hgt (ft)", "Wave Steep",
"Swell Hgt (ft)", "Swell Per (sec)", "Swell Dir (deg)" };
"Lat (deg)", "Lon (deg)", "Wind Spd (kt)", "MaxWindSpd (kt)",
"Wind Gust (kt)", "Vis (nm)", "P (in)", "P Tendency (in)",
"T (deg F)", "Dewpt (deg F)", "SST (deg F)",
"Significant Wave Hgt (ft)", "Wave Steep", "Swell Hgt (ft)",
"Swell Per (sec)", "Swell Dir (deg)" };
/**
* Fog Maritime table columns.
*/
private final String[] fogMaritimeTableCols = new String[] {
obsHistCols.Time.name(), obsHistCols.Lat.name(),
obsHistCols.Lon.name(), obsHistCols.WindSpd.name(),
obsHistCols.MaxWindSpd.name(), obsHistCols.WindGust.name(),
obsHistCols.Vis_mi.name(), obsHistCols.P.name(),
obsHistCols.PTend.name(), obsHistCols.T.name(),
obsHistCols.Dewpt.name(), obsHistCols.SST.name(),
obsHistCols.SigWaveHgt.name(), obsHistCols.WaveSteep.name(),
obsHistCols.SwellHgt.name(), obsHistCols.SwellPer.name(),
obsHistCols.SwellDir.name(), obsHistCols.RelHum.name() };
private final String[] fogMaritimeTableCols = new String[] {
obsHistCols.Time.name(), obsHistCols.Lat.name(),
obsHistCols.Lon.name(), obsHistCols.WindSpd.name(),
obsHistCols.MaxWindSpd.name(), obsHistCols.WindGust.name(),
obsHistCols.Vis_mi.name(), obsHistCols.P.name(),
obsHistCols.PTend.name(), obsHistCols.T.name(),
obsHistCols.Dewpt.name(), obsHistCols.SST.name(),
obsHistCols.SigWaveHgt.name(), obsHistCols.WaveSteep.name(),
obsHistCols.SwellHgt.name(), obsHistCols.SwellPer.name(),
obsHistCols.SwellDir.name(), obsHistCols.RelHum.name() };
/**
* Fog METAR table columns.
*/
private final String[] fogMetarTableCols = new String[] {
obsHistCols.Time.name(), obsHistCols.Lat.name(),
obsHistCols.Lon.name(),obsHistCols.RelHum.name(),
obsHistCols.Lon.name(), obsHistCols.RelHum.name(),
obsHistCols.Vis_mi.name(), obsHistCols.Ceiling.name(),
obsHistCols.WindDir.name(), obsHistCols.WindSpd.name(),
obsHistCols.WindGust.name(), obsHistCols.P.name(),
@ -417,8 +418,7 @@ public class CommonTableConfig {
tableColumnAttrMap.put(ssZoneStnTableCols[21], new ColumnAttribData(
"Swell2 Dir", SortDirection.Ascending, GraphType.HodoWindDir));
tableColumnAttrMap.put(ssZoneStnTableCols[22], new ColumnAttribData(
"Fog",
SortDirection.Decending, GraphType.None));
"Fog", SortDirection.Decending, GraphType.None));
}
/**
@ -450,13 +450,11 @@ public class CommonTableConfig {
tableColumnAttrMap.put(snowZoneStnTableCols[11], new ColumnAttribData(
"Vis", SortDirection.Ascending, GraphType.Trend));
tableColumnAttrMap.put(snowZoneStnTableCols[12], new ColumnAttribData(
"SLP",
SortDirection.Ascending, GraphType.Trend));
"SLP", SortDirection.Ascending, GraphType.Trend));
tableColumnAttrMap.put(snowZoneStnTableCols[13], new ColumnAttribData(
"Wind Chill", SortDirection.Ascending, GraphType.Trend));
tableColumnAttrMap.put(snowZoneStnTableCols[14], new ColumnAttribData(
"FrstBt Time",
SortDirection.Ascending, GraphType.Trend));
"FrstBt Time", SortDirection.Ascending, GraphType.Trend));
tableColumnAttrMap.put(snowZoneStnTableCols[15], new ColumnAttribData(
"Hourly Precip", SortDirection.Decending, GraphType.Trend));
tableColumnAttrMap.put(snowZoneStnTableCols[16], new ColumnAttribData(
@ -474,13 +472,11 @@ public class CommonTableConfig {
tableColumnAttrMap.put(fogZoneStnTableCols[0], new ColumnAttribData(
"Area_Id", SortDirection.Ascending));
tableColumnAttrMap.put(fogZoneStnTableCols[1], new ColumnAttribData(
"Vis",
SortDirection.Ascending, GraphType.Trend));
"Vis", SortDirection.Ascending, GraphType.Trend));
tableColumnAttrMap.put(fogZoneStnTableCols[2], new ColumnAttribData(
"Pres Weather", SortDirection.None, GraphType.None));
tableColumnAttrMap.put(fogZoneStnTableCols[3], new ColumnAttribData(
"Ceiling",
SortDirection.Ascending, GraphType.Trend));
"Ceiling", SortDirection.Ascending, GraphType.Trend));
tableColumnAttrMap.put(fogZoneStnTableCols[4], new ColumnAttribData(
"Wind Direc", SortDirection.Decending, GraphType.HodoWindDir));
tableColumnAttrMap.put(fogZoneStnTableCols[5], new ColumnAttribData(
@ -490,74 +486,71 @@ public class CommonTableConfig {
tableColumnAttrMap.put(fogZoneStnTableCols[7], new ColumnAttribData(
"Wind Gust", SortDirection.Decending, GraphType.Trend));
tableColumnAttrMap.put(fogZoneStnTableCols[8], new ColumnAttribData(
"Temp",
SortDirection.Decending, GraphType.Trend));
"Temp", SortDirection.Decending, GraphType.Trend));
tableColumnAttrMap.put(fogZoneStnTableCols[9], new ColumnAttribData(
"Dewpt", SortDirection.Decending, GraphType.Trend));
tableColumnAttrMap.put(fogZoneStnTableCols[10], new ColumnAttribData(
"Depr",
SortDirection.Ascending, GraphType.Trend));
"Depr", SortDirection.Ascending, GraphType.Trend));
tableColumnAttrMap.put(fogZoneStnTableCols[11], new ColumnAttribData(
"Rel Humid", SortDirection.Decending, GraphType.Trend));
tableColumnAttrMap.put(fogZoneStnTableCols[12], new ColumnAttribData(
"ALG",
SortDirection.Decending, GraphType.None));
"ALG", SortDirection.Decending, GraphType.None));
}
/**
* Create the Observation History column attributes.
*/
private void createObsHistoryColumnAttributes() {
obsHistColumnAttrMap.put(obsHistCols.Time.name(), new ColumnAttribData(
"Time (UTC)", "Time (UTC)"));
obsHistColumnAttrMap.put(obsHistCols.Lat.name(), new ColumnAttribData(
"Lat (deg)", "Lat (deg)"));
obsHistColumnAttrMap.put(obsHistCols.Lon.name(), new ColumnAttribData(
"Lon (deg)", "Lon (deg)"));
obsHistColumnAttrMap.put(obsHistCols.WindSpd.name(),
new ColumnAttribData("Wind Spd (kt)", "Wind Spd\n(kt)"));
obsHistColumnAttrMap
.put(obsHistCols.MaxWindSpd.name(), new ColumnAttribData(
"Max Wind Spd (kt)", "Max Wind\nSpd (kt)"));
obsHistColumnAttrMap.put(obsHistCols.WindGust.name(),
new ColumnAttribData("Wind Gust (kt)", "Wind Gust\n(kt)"));
obsHistColumnAttrMap.put(obsHistCols.WindDir.name(),
new ColumnAttribData("Wind Dir (deg)", "Wind Dir\n(deg)"));
obsHistColumnAttrMap.put(obsHistCols.Vis_mi.name(),
new ColumnAttribData("Vis (mi)", "Vis (mi)"));
obsHistColumnAttrMap.put(obsHistCols.Vis_mn.name(),
new ColumnAttribData("Vis (nm)", "Vis (nm)"));
obsHistColumnAttrMap.put(obsHistCols.P.name(), new ColumnAttribData(
"P (in)", "P (in)"));
obsHistColumnAttrMap.put(obsHistCols.PTend.name(),
new ColumnAttribData("P Tendency (in)", "P Tendency\n(in)"));
obsHistColumnAttrMap.put(obsHistCols.SigWaveHgt.name(),
new ColumnAttribData("Significant Wave Hgt (ft)",
"Significant\nWave Hgt (ft)"));
obsHistColumnAttrMap.put(obsHistCols.SwellHgt.name(),
new ColumnAttribData("Swell Hgt (ft)", "Swell Hgt\n(ft)"));
obsHistColumnAttrMap.put(obsHistCols.SwellPer.name(),
new ColumnAttribData("Swell Per (sec)", "Swell Per\n(sec)"));
obsHistColumnAttrMap.put(obsHistCols.SwellDir.name(),
new ColumnAttribData("Swell Dir (deg)", "Swell Dir\n(deg)"));
obsHistColumnAttrMap.put(obsHistCols.T.name(), new ColumnAttribData(
"T (deg F)", "T (deg F)"));
obsHistColumnAttrMap.put(obsHistCols.Dewpt.name(),
new ColumnAttribData("Dewpt (deg F)", "Dewpt\n(deg F)"));
obsHistColumnAttrMap.put(obsHistCols.SST.name(), new ColumnAttribData(
"SST (deg F)", "SST\n(deg F)"));
obsHistColumnAttrMap.put(obsHistCols.WaveSteep.name(),
new ColumnAttribData("Wave Steep", "Wave\nSteep"));
obsHistColumnAttrMap.put(obsHistCols.RelHum.name(),
new ColumnAttribData("Rel. Humid (%)", "Rel. Humid\n(%)"));
obsHistColumnAttrMap.put(obsHistCols.Ceiling.name(),
new ColumnAttribData("Ceiling (ft x 100)",
"Ceiling\n(ft x 100)"));
obsHistColumnAttrMap
.put(obsHistCols.DewptDepr.name(), new ColumnAttribData(
"DewptDepr (deg F)", "DewptDepr\n(deg F)"));
/**
* Create the Observation History column attributes.
*/
private void createObsHistoryColumnAttributes() {
obsHistColumnAttrMap.put(obsHistCols.Time.name(), new ColumnAttribData(
"Time (UTC)", "Time (UTC)"));
obsHistColumnAttrMap.put(obsHistCols.Lat.name(), new ColumnAttribData(
"Lat (deg)", "Lat (deg)"));
obsHistColumnAttrMap.put(obsHistCols.Lon.name(), new ColumnAttribData(
"Lon (deg)", "Lon (deg)"));
obsHistColumnAttrMap.put(obsHistCols.WindSpd.name(),
new ColumnAttribData("Wind Spd (kt)", "Wind Spd\n(kt)"));
obsHistColumnAttrMap
.put(obsHistCols.MaxWindSpd.name(), new ColumnAttribData(
"Max Wind Spd (kt)", "Max Wind\nSpd (kt)"));
obsHistColumnAttrMap.put(obsHistCols.WindGust.name(),
new ColumnAttribData("Wind Gust (kt)", "Wind Gust\n(kt)"));
obsHistColumnAttrMap.put(obsHistCols.WindDir.name(),
new ColumnAttribData("Wind Dir (deg)", "Wind Dir\n(deg)"));
obsHistColumnAttrMap.put(obsHistCols.Vis_mi.name(),
new ColumnAttribData("Vis (mi)", "Vis (mi)"));
obsHistColumnAttrMap.put(obsHistCols.Vis_mn.name(),
new ColumnAttribData("Vis (nm)", "Vis (nm)"));
obsHistColumnAttrMap.put(obsHistCols.P.name(), new ColumnAttribData(
"P (in)", "P (in)"));
obsHistColumnAttrMap.put(obsHistCols.PTend.name(),
new ColumnAttribData("P Tendency (in)", "P Tendency\n(in)"));
obsHistColumnAttrMap.put(obsHistCols.SigWaveHgt.name(),
new ColumnAttribData("Significant Wave Hgt (ft)",
"Significant\nWave Hgt (ft)"));
obsHistColumnAttrMap.put(obsHistCols.SwellHgt.name(),
new ColumnAttribData("Swell Hgt (ft)", "Swell Hgt\n(ft)"));
obsHistColumnAttrMap.put(obsHistCols.SwellPer.name(),
new ColumnAttribData("Swell Per (sec)", "Swell Per\n(sec)"));
obsHistColumnAttrMap.put(obsHistCols.SwellDir.name(),
new ColumnAttribData("Swell Dir (deg)", "Swell Dir\n(deg)"));
obsHistColumnAttrMap.put(obsHistCols.T.name(), new ColumnAttribData(
"T (deg F)", "T (deg F)"));
obsHistColumnAttrMap.put(obsHistCols.Dewpt.name(),
new ColumnAttribData("Dewpt (deg F)", "Dewpt\n(deg F)"));
obsHistColumnAttrMap.put(obsHistCols.SST.name(), new ColumnAttribData(
"SST (deg F)", "SST\n(deg F)"));
obsHistColumnAttrMap.put(obsHistCols.WaveSteep.name(),
new ColumnAttribData("Wave Steep", "Wave\nSteep"));
obsHistColumnAttrMap.put(obsHistCols.RelHum.name(),
new ColumnAttribData("Rel. Humid (%)", "Rel. Humid\n(%)"));
obsHistColumnAttrMap.put(obsHistCols.Ceiling.name(),
new ColumnAttribData("Ceiling (ft x 100)",
"Ceiling\n(ft x 100)"));
obsHistColumnAttrMap
.put(obsHistCols.DewptDepr.name(), new ColumnAttribData(
"DewptDepr (deg F)", "DewptDepr\n(deg F)"));
}
}
/**
* Get the Zone/Station column keys.
@ -608,17 +601,17 @@ public class CommonTableConfig {
public String[] getObsHistColumnKeys(CommonConfig.AppName app,
ObsHistType obsType) {
if (app == CommonConfig.AppName.SAFESEAS) {
if (obsType == ObsHistType.Maritime) {
if (obsType == ObsHistType.MARITIME) {
return ssMaritimeTableCols;
} else {
return ssMetarTableCols;
}
} else if (app == CommonConfig.AppName.SNOW) {
if (obsType == ObsHistType.METAR) {
if (obsType == ObsHistType.METAR || obsType == ObsHistType.MESONET) {
return snowMetarTableCols;
}
} else if (app == CommonConfig.AppName.FOG) {
if (obsType == ObsHistType.Maritime) {
if (obsType == ObsHistType.MARITIME) {
return fogMaritimeTableCols;
} else {
return fogMetarTableCols;
@ -661,18 +654,18 @@ public class CommonTableConfig {
public int getNumberOfObsHistColumns(CommonConfig.AppName app,
ObsHistType obsType) {
if (app == CommonConfig.AppName.SAFESEAS) {
if (obsType == ObsHistType.Maritime) {
if (obsType == ObsHistType.MARITIME) {
return ssMaritimeTableCols.length;
} else {
return ssMetarTableCols.length;
}
} else if (app == CommonConfig.AppName.SNOW) {
if (obsType == ObsHistType.METAR) {
if (obsType == ObsHistType.METAR || obsType == ObsHistType.MESONET) {
return snowMetarTableCols.length;
}
} else if (app == CommonConfig.AppName.FOG) {
if (obsType == ObsHistType.Maritime) {
if (obsType == ObsHistType.MARITIME) {
return fogMaritimeTableCols.length;
} else {
return fogMetarTableCols.length;
@ -696,7 +689,7 @@ public class CommonTableConfig {
public int getObsHistColumnIndex(CommonConfig.AppName app,
ObsHistType obsType, String columnName) {
if (app == CommonConfig.AppName.SAFESEAS) {
if (obsType == ObsHistType.Maritime) {
if (obsType == ObsHistType.MARITIME) {
return getColumnIndex(columnName, ssMaritimeTableCols);
} else {
return getColumnIndex(columnName, ssMetarTableCols);
@ -707,7 +700,7 @@ public class CommonTableConfig {
return getColumnIndex(columnName, snowMetarTableCols);
}
} else if (app == CommonConfig.AppName.FOG) {
if (obsType == ObsHistType.Maritime) {
if (obsType == ObsHistType.MARITIME) {
return getColumnIndex(columnName, fogMaritimeTableCols);
} else {
return getColumnIndex(columnName, fogMetarTableCols);

View file

@ -30,9 +30,10 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.monitor.config.MonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.data.ObConst;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType;
import com.raytheon.uf.viz.monitor.filename.DefaultFilenameMgr;
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
@ -51,6 +52,7 @@ import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
* Jan 5, 2010 #3963 lvenable Initial creation
* Mar 22, 2010 #4282 zhao obtain zone IDs from monitoring-area-config-manager
* Feb 16, 2011 #7346 zhao added getDirectionalThresholdValueCellType(...)
* Apr 28, 2014 3086 skorolev Updated getAreaConfigMgr method.
*
* </pre>
*
@ -58,7 +60,11 @@ import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
* @version 1.0
*/
public abstract class AbstractThresholdMgr {
protected MonitorConfigurationManager areaConfigMgr = null;
/**
* Monitor Area Configuration Manager.
*/
protected FSSObsMonitorConfigurationManager areaConfigMgr;
/**
* Default file name for the FOG display thresholds.
@ -108,12 +114,16 @@ public abstract class AbstractThresholdMgr {
RED, YELLOW
};
/** current site **/
protected String site;
/*
* TODO : remove this when debugging is complete
*/
public ThresholdsXML threshXmlCopy;
/**
* Constructor.
*
* @param defDisplayThreshName
* @param defMonitorThreshName
@ -123,14 +133,16 @@ public abstract class AbstractThresholdMgr {
this.defDisplayThreshName = defDisplayThreshName;
this.defMonitorThreshName = defMonitorThreshName;
this.appName = appName;
this.site = LocalizationManager.getInstance().getCurrentSite();
this.areaConfigMgr = getMonitorAreaConfigInstance();
}
/**
* Setup the default threshold file manager that stores the file name to use
* for the display thresholds. If the file name is blank or null then the
* file name to use is the default file name.
*/
protected void init() {
/*
* Setup the default threshold file manager that stores the file name to
* use for the display thresholds. If the file name is blank or null
* then the file name to use is the default file name.
*/
defaultFileNameMgr = new DefaultFilenameMgr(
getDefaultThresholdFilePath());
defaultFileNameMgr.readXmlConfig();
@ -176,6 +188,12 @@ public abstract class AbstractThresholdMgr {
}
}
/**
* Validate File Name
*
* @param pathAndFileName
* @return
*/
private boolean validateFileName(String pathAndFileName) {
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext context = pm.getContext(
@ -252,6 +270,15 @@ public abstract class AbstractThresholdMgr {
}
}
/**
* Gets Threshold Value Cell Type
*
* @param dataUsage
* @param areaID
* @param key
* @param value
* @return
*/
public CellType getThresholdValueCellType(DataUsageKey dataUsage,
String areaID, String key, double value) {
if (hasArea(areaID, dataUsage) == false) {
@ -334,6 +361,16 @@ public abstract class AbstractThresholdMgr {
return CellType.NotMonitored;
}
/**
* Calculates Table Cell Type for a directional variable.
*
* @param redFrom
* @param redTo
* @param yellowFrom
* @param yellowTo
* @param value
* @return
*/
private CellType calcDirectionalCellType(double redFrom, double redTo,
double yellowFrom, double yellowTo, double value) {
@ -364,6 +401,15 @@ public abstract class AbstractThresholdMgr {
return CellType.G;
}
/**
* Calculates CellType.
*
* @param key
* @param red
* @param yellow
* @param value
* @return
*/
private CellType calcCellType(String key, double red, double yellow,
double value) {
Boolean redIsHigher = MonitorConfigConstants.rValueIsHigher(key,
@ -491,6 +537,9 @@ public abstract class AbstractThresholdMgr {
}
}
/**
* Load Default Monitor Threshold.
*/
public void loadDefaultMonitorThreshold() {
currFullMonitorXmlFileName = getMonitorThresholdPath()
+ defMonitorThreshName;
@ -509,9 +558,6 @@ public abstract class AbstractThresholdMgr {
ArrayList<String> threshKeys = getThresholdKeys(DataUsageKey.MONITOR);
System.out.println("********** currFullMonitorXmlFileName = "
+ currFullMonitorXmlFileName);
monitorThreshMgr.createConfigFromDefaults(currFullMonitorXmlFileName,
areaIDs, threshKeys);
}
@ -628,6 +674,12 @@ public abstract class AbstractThresholdMgr {
return sb.toString();
}
/**
* Gets Thresholds Xml Copy.
*
* @param dataUsageKey
* @return
*/
public ThresholdsXML getThresholdsXmlCopy(DataUsageKey dataUsageKey) {
if (dataUsageKey == DataUsageKey.DISPLAY) {
return displayThreshMgr.getThresholdsXmlCopy();
@ -638,6 +690,12 @@ public abstract class AbstractThresholdMgr {
return null;
}
/**
* Deletes File.
*
* @param fileName
* @return
*/
public boolean deleteFile(LocalizationFile fileName) {
boolean deletedUserSelectedDefault = false;
@ -667,6 +725,13 @@ public abstract class AbstractThresholdMgr {
return deletedUserSelectedDefault;
}
/**
* Is there AreaID?
*
* @param areaID
* @param dataUsageKey
* @return
*/
public boolean hasArea(String areaID, DataUsageKey dataUsageKey) {
if (dataUsageKey == DataUsageKey.DISPLAY) {
return displayThreshMgr.getThresholdXML().hasAreaId(areaID);
@ -675,6 +740,12 @@ public abstract class AbstractThresholdMgr {
return monitorThreshMgr.getThresholdXML().hasAreaId(areaID);
}
/**
* Gets Threshold Keys.
*
* @param dataUsageKey
* @return
*/
protected abstract ArrayList<String> getThresholdKeys(
DataUsageKey dataUsageKey);
@ -725,6 +796,11 @@ public abstract class AbstractThresholdMgr {
}
}
public abstract MonitorConfigurationManager getAreaConfigMgr();
/**
* Gets Monitor Area Configuration manager.
*
* @return manager
*/
protected abstract FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance();
}

View file

@ -34,10 +34,6 @@ import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.common.geospatial.ISpatialQuery;
import com.raytheon.uf.common.geospatial.SpatialQueryFactory;
import com.raytheon.uf.common.monitor.config.FogMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.MonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.SSMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.SnowMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.xml.StationIdXML;
@ -58,7 +54,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* ------------ ---------- ----------- --------------------------
* Apr 2, 2009 lvenable Initial creation
* Nov 20, 2012 1297 skorolev Changes for non-blocking dialog.
* Apr 23, 2014 3054 skorolev Added MESONET handling
* Apr 23, 2014 3054 skorolev Added MESONET handling.
* Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
*
* </pre>
*
@ -69,50 +66,29 @@ public class AddNewStationDlg extends CaveSWTDialog {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(AddNewStationDlg.class);
/**
* Application name.
*/
/** Application name. */
private AppName appName;
/**
* METAR radio button.
*/
/** METAR radio button. */
private Button metarRdo;
/**
* Maritime button.
*/
/** Maritime button. */
private Button maritimeRdo;
/**
* Mesonet button;
*/
/** Mesonet button; */
private Button mesonetRdo;
/**
* Station label.
*/
/** Station label. */
private Label stationLbl;
/**
* Station text control.
*/
/** Station text control. */
private Text stationTF;
/**
* Zone
*/
/** Zone */
private String area;
/**
* Call back interface
*/
private INewZoneStnAction macDlg;
/**
* Area configuration manager.
*/
private MonitorConfigurationManager configManager;
/** Call back interface */
private MonitoringAreaConfigDlg macDlg;
/**
* Constructor.
@ -124,13 +100,12 @@ public class AddNewStationDlg extends CaveSWTDialog {
* @param macDlg
*/
public AddNewStationDlg(Shell parent, CommonConfig.AppName appName,
String area, INewZoneStnAction macDlg) {
String area, MonitoringAreaConfigDlg macDlg) {
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
setText(appName.toString() + ": Add a New Stn to Monitor Area");
this.appName = appName;
this.area = area;
this.macDlg = macDlg;
configManager = getConfigManager(appName);
}
/*
@ -194,7 +169,7 @@ public class AddNewStationDlg extends CaveSWTDialog {
}
/**
* Create the text controls.
* Creates the text controls.
*/
private void createTextControls() {
Composite textComp = new Composite(shell, SWT.NONE);
@ -231,27 +206,18 @@ public class AddNewStationDlg extends CaveSWTDialog {
addBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
String stationType = StationIdXML.METAR;
/**
* for DR #7854: add new station to Monitor Area Config GUI
*/
String type;
if (metarRdo.getSelection()) {
stationType = StationIdXML.METAR;
} else if (mesonetRdo.getSelection()) {
stationType = StationIdXML.MESONET;
// TODO need to verify the stationType exists.
// was in SSmesonetStationInfo.txt in AWIPS1.
type = StationIdXML.METAR;
} else if (maritimeRdo.getSelection()) {
type = StationIdXML.MARITIME;
} else {
stationType = StationIdXML.MARITIME;
}
if (!stationTF.getText().isEmpty()) {
configManager.addStation(area, stationTF.getText()
.toUpperCase(), stationType, false);
/**
* for DR #7854: add new station to Monitor Area Config GUI
*/
handleAddNewStation();
} else {
displayInputErrorMsg("No Station ID entered."
+ "\nPlease enter a valid Station ID for the selected Station Type.");
type = StationIdXML.MESONET;
}
handleAddNewStation(type);
}
});
@ -270,8 +236,16 @@ public class AddNewStationDlg extends CaveSWTDialog {
/**
* Adds a new station.
*
* @param type
*/
private void handleAddNewStation() {
private void handleAddNewStation(String type) {
if (stationTF.getText().isEmpty()) {
displayInputErrorMsg("No Station ID entered."
+ "\nPlease enter a valid Station ID for the selected Station Type.");
return;
}
String stn = stationTF.getText().toUpperCase();
if (!isValidStation(stn)) {
displayInputErrorMsg("Invalid Station ID entered: "
@ -279,13 +253,7 @@ public class AddNewStationDlg extends CaveSWTDialog {
+ " \nPlease enter a valid Station ID for the selected Station Type.");
return;
}
if (metarRdo.getSelection()) {
stn = stn + "#METAR";
} else if (maritimeRdo.getSelection()) {
stn = stn + "#MARITIME";
} else {
stn = stn + "#MESONET";
}
stn = stn + "#" + type;
if (macDlg.isExistingStation(stn)) {
displayInputErrorMsg("The Station '"
+ stn
@ -293,7 +261,8 @@ public class AddNewStationDlg extends CaveSWTDialog {
return;
}
macDlg.addNewStationAction(stn);
macDlg.getInstance().addStation(area, stn, type, false);
macDlg.getInstance().getStations().add(stn);
}
/**
@ -343,16 +312,4 @@ public class AddNewStationDlg extends CaveSWTDialog {
messageBox.setMessage(msg);
messageBox.open();
}
private MonitorConfigurationManager getConfigManager(AppName app) {
MonitorConfigurationManager mngr = null;
if (app == AppName.FOG) {
mngr = FogMonitorConfigurationManager.getInstance();
} else if (app == AppName.SAFESEAS) {
mngr = SSMonitorConfigurationManager.getInstance();
} else if (app == AppName.SNOW) {
mngr = SnowMonitorConfigurationManager.getInstance();
}
return mngr;
}
}

View file

@ -32,10 +32,6 @@ import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.common.monitor.config.FogMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.MonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.SSMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.SnowMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.xml.AreaIdXML.ZoneType;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
@ -52,6 +48,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Apr 2, 2009 lvenable Initial creation
* Nov 20, 2012 1297 skorolev Changes for non-blocking dialog.
* Apr 23, 2014 3054 skorolev Deleted unnecessary parameter in addArea method.
* Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
*
* </pre>
*
@ -60,45 +57,26 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
*/
public class AddNewZoneDlg extends CaveSWTDialog {
/**
* Application name.
*/
/** Application name. */
private AppName appName;
/**
* Marine zone radio button.
*/
/** Marine zone radio button. */
private Button marineZoneRdo;
/**
* County radio button.
*/
/** County radio button. */
private Button countyRdo;
/**
* ID text control.
*/
/** ID text control. */
private Text idTF;
/**
* Centroid latitude text control.
*/
/** Centroid latitude text control. */
private Text centroidLatTF;
/**
* Centroid longitude text control.
*/
/** Centroid longitude text control. */
private Text centroidLonTF;
/**
* Call back interface.
*/
private INewZoneStnAction macDlg;
/**
* Area configuration manager.
*/
private MonitorConfigurationManager configMan;
/** Monitoring Area Configuration Dialog. */
private MonitoringAreaConfigDlg macDlg;
/**
* Constructor.
@ -108,12 +86,12 @@ public class AddNewZoneDlg extends CaveSWTDialog {
* @param appName
* Application name.
*/
public AddNewZoneDlg(Shell parent, AppName appName, INewZoneStnAction macDlg) {
public AddNewZoneDlg(Shell parent, AppName appName,
MonitoringAreaConfigDlg macDlg) {
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
setText(appName.toString() + ": Add a New Zone to Monitor Area.");
this.appName = appName;
this.macDlg = macDlg;
configMan = getConfigManager(appName);
}
/*
@ -313,7 +291,7 @@ public class AddNewZoneDlg extends CaveSWTDialog {
macDlg.latLonErrorMsg(latString, lonString);
return;
}
configMan.addArea(areaId, lat, lon, type);
macDlg.configMgr.addArea(areaId, lat, lon, type);
macDlg.addNewZoneAction(areaId, centroidLatTF.getText(),
centroidLonTF.getText());
} catch (NumberFormatException e) {
@ -335,22 +313,4 @@ public class AddNewZoneDlg extends CaveSWTDialog {
messageBox.setMessage(msg);
messageBox.open();
}
/**
* Gets Configuration Manager.
*
* @param app
* @return manager
*/
private MonitorConfigurationManager getConfigManager(AppName app) {
MonitorConfigurationManager mngr = null;
if (app == AppName.FOG) {
mngr = FogMonitorConfigurationManager.getInstance();
} else if (app == AppName.SAFESEAS) {
mngr = SSMonitorConfigurationManager.getInstance();
} else if (app == AppName.SNOW) {
mngr = SnowMonitorConfigurationManager.getInstance();
}
return mngr;
}
}

View file

@ -33,10 +33,7 @@ import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.monitor.config.FogMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.MonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.SSMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.SnowMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
@ -52,6 +49,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Apr 2, 2009 lvenable Initial creation
* Nov 20, 2012 1297 skorolev Changes for non-blocking dialog.
* Apr 23, 2014 3054 skorolev Fixed issue with deleting a new station.
* Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
*
* </pre>
*
@ -60,20 +58,17 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
*/
public class DeleteStationDlg extends CaveSWTDialog {
/**
* Station list control.
*/
/** Station list control. */
private List stationList;
/**
* Control font.
*/
/** Control font. */
private Font controlFont;
/**
* Area configuration manager.
*/
private MonitorConfigurationManager configMan;
/** Area configuration manager. */
private FSSObsMonitorConfigurationManager configMgr;
/** Monitoring Area Configuration Dialog */
private MonitoringAreaConfigDlg macDlg;
/**
* Constructor.
@ -83,10 +78,12 @@ public class DeleteStationDlg extends CaveSWTDialog {
* @param appName
* Application name.
*/
public DeleteStationDlg(Shell parent, AppName appName) {
public DeleteStationDlg(Shell parent, AppName appName,
MonitoringAreaConfigDlg macDlg) {
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
setText(appName.toString() + ": Delete a Newly Entered Station");
configMan = getConfigManager(appName);
this.macDlg = macDlg;
configMgr = macDlg.getInstance();
}
/*
@ -121,7 +118,7 @@ public class DeleteStationDlg extends CaveSWTDialog {
}
/**
* Create the list control.
* Creates the list control.
*/
private void createListControl() {
Composite listComp = new Composite(shell, SWT.NONE);
@ -137,7 +134,7 @@ public class DeleteStationDlg extends CaveSWTDialog {
}
/**
* Create the Delete Station and Close buttons.
* Creates the Delete Station and Close buttons.
*/
private void createBottomButtons() {
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
@ -178,7 +175,7 @@ public class DeleteStationDlg extends CaveSWTDialog {
* Populate list of added stations.
*/
private void populate() {
java.util.List<String> addedStations = configMan.getAddedStations();
java.util.List<String> addedStations = configMgr.getAddedStations();
stationList.setItems(addedStations.toArray(new String[addedStations
.size()]));
}
@ -192,8 +189,8 @@ public class DeleteStationDlg extends CaveSWTDialog {
if (stationList.getSelectionIndex() != -1) {
int idx = stationList.getSelectionIndex();
String selection = stationList.getItem(idx);
retval = configMan.getAddedStations().get(idx);
configMan.getAddedStations().remove(idx);
retval = configMgr.getAddedStations().get(idx);
configMgr.getAddedStations().remove(idx);
stationList.remove(selection);
populate();
} else {
@ -208,24 +205,6 @@ public class DeleteStationDlg extends CaveSWTDialog {
return retval;
}
/**
* Gets Configuration Manager.
*
* @param app
* @return manager
*/
private MonitorConfigurationManager getConfigManager(AppName app) {
MonitorConfigurationManager mngr = null;
if (app == AppName.FOG) {
mngr = FogMonitorConfigurationManager.getInstance();
} else if (app == AppName.SAFESEAS) {
mngr = SSMonitorConfigurationManager.getInstance();
} else if (app == AppName.SNOW) {
mngr = SnowMonitorConfigurationManager.getInstance();
}
return mngr;
}
/*
* (non-Javadoc)
*

View file

@ -30,13 +30,11 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.common.monitor.config.FogMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.MonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.SSMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.SnowMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.xml.AreaIdXML;
import com.raytheon.uf.common.monitor.xml.AreaIdXML.ZoneType;
@ -54,6 +52,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Apr 2, 2009 lvenable Initial creation
* Nov 20, 2012 1297 skorolev Changes for non-blocking dialog.
* Apr 23, 2014 3054 skorolev Fixed issues with removing a new zone from list.
* Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
*
* </pre>
*
@ -62,68 +61,44 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
*/
public class EditNewZoneDlg extends CaveSWTDialog {
/**
* Call back interface.
*/
private INewZoneStnAction macDlg;
/** Call back interface. */
private MonitoringAreaConfigDlg macDlg;
/**
* Zone list control.
*/
/** Zone list control. */
private List zoneList;
/**
* ID text control.
*/
/** ID text control. */
private Text idTF;
/**
* Latitude text control.
*/
/** Latitude text control. */
private Text latTF;
/**
* Longitude text control.
*/
/** Longitude text control. */
private Text lonTF;
/**
* Save button.
*/
/** Save button. */
private Button saveBtn;
/**
* Delete button.
*/
/** Delete button. */
private Button deleteBtn;
/**
* Control font.
*/
/** Control font. */
private Font controlFont;
/**
* Marine station radio button.
*/
/** Marine station radio button. */
private Button marineRdo;
/**
* None Marine station radio button.
*/
/** None Marine station radio button. */
private Button nonMarineRdo;
/**
* Area configuration manager.
*/
private MonitorConfigurationManager configMan;
/**
* Bottom label
*/
/** Bottom label */
private Label bottomLbl;
/** Deleted zone */
private String delZone;
private FSSObsMonitorConfigurationManager areaConfigMgr;
/**
* Constructor.
*
@ -134,11 +109,11 @@ public class EditNewZoneDlg extends CaveSWTDialog {
* @param monitoringAreaConfigDlg
*/
public EditNewZoneDlg(Shell parent, AppName appName,
INewZoneStnAction macDlg) {
MonitoringAreaConfigDlg macDlg) {
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
setText(appName.toString() + ": Edit a Newly Added Zone");
this.macDlg = macDlg;
configMan = this.getConfigManager(appName);
areaConfigMgr = macDlg.getInstance();
}
/*
@ -306,7 +281,7 @@ public class EditNewZoneDlg extends CaveSWTDialog {
.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
bottomLbl = new Label(labelComp, SWT.NONE);
bottomLbl
.setText("Centriod Lat/Lon use Decimal Degrees, West Longitude negative");
.setText("Centroid Lat/Lon use Decimal Degrees, West Longitude negative");
}
/**
@ -338,7 +313,7 @@ public class EditNewZoneDlg extends CaveSWTDialog {
* Populate list of added zones.
*/
private void populate() {
java.util.List<String> newList = configMan.getAddedZones();
java.util.List<String> newList = areaConfigMgr.getAddedZones();
zoneList.setItems(newList.toArray(new String[newList.size()]));
}
@ -347,7 +322,7 @@ public class EditNewZoneDlg extends CaveSWTDialog {
*/
private void handleZoneSelection() {
String zone = zoneList.getItem(zoneList.getSelectionIndex());
AreaIdXML areaXml = configMan.getAreaXml(zone);
AreaIdXML areaXml = areaConfigMgr.getAreaXml(zone);
// DR #7343: a null areaXml causes an "Unhandled event loop exception"
if (areaXml != null) {
idTF.setText(areaXml.getAreaId());
@ -369,15 +344,24 @@ public class EditNewZoneDlg extends CaveSWTDialog {
*/
private String deleteSelected() {
if (zoneList.getItemCount() != 0) {
if (zoneList.getSelectionIndex() == -1) {
MessageBox messageBox = new MessageBox(shell,
SWT.ICON_INFORMATION | SWT.OK);
messageBox.setText("Error.");
messageBox.setMessage("Please select zone to be deleted.");
messageBox.open();
zoneList.select(0);
return null;
}
String area = zoneList.getItem(zoneList.getSelectionIndex());
zoneList.remove(zoneList.getSelectionIndex());
configMan.removeArea(area);
areaConfigMgr.removeArea(area);
idTF.setText("");
latTF.setText("");
lonTF.setText("");
return area;
} else {
bottomLbl.setText("No zones have been added.");
bottomLbl.setText("No zones have been deleted.");
}
return null;
}
@ -408,9 +392,10 @@ public class EditNewZoneDlg extends CaveSWTDialog {
if (marineRdo.getSelection()) {
type = ZoneType.MARITIME;
}
configMan.removeArea(area);
configMan.removeAddedArea(area);
configMan.addArea(area, lat, lon, type);
// Replace previously added zone
areaConfigMgr.removeArea(area);
areaConfigMgr.removeAddedArea(area);
macDlg.configMgr.addArea(area, lat, lon, type);
populate();
// Return cursor to the top of the list.
zoneList.select(0);
@ -420,28 +405,10 @@ public class EditNewZoneDlg extends CaveSWTDialog {
}
}
} else {
bottomLbl.setText("No zones have been added.");
bottomLbl.setText("No zones have been edited.");
}
}
/**
* Gets Configuration Manager.
*
* @param app
* @return manager
*/
private MonitorConfigurationManager getConfigManager(AppName app) {
MonitorConfigurationManager mngr = null;
if (app == AppName.FOG) {
mngr = FogMonitorConfigurationManager.getInstance();
} else if (app == AppName.SAFESEAS) {
mngr = SSMonitorConfigurationManager.getInstance();
} else if (app == AppName.SNOW) {
mngr = SnowMonitorConfigurationManager.getInstance();
}
return mngr;
}
/*
* (non-Javadoc)
*

View file

@ -40,10 +40,7 @@ import org.eclipse.swt.widgets.Scale;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.common.monitor.config.FogMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.MonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.SSMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.SnowMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.xml.AreaIdXML.ZoneType;
@ -73,6 +70,8 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Oct 07, 2013 #2443 lvenable Fixed image memory leak.
* Jan 29, 2014 2757 skorolev Added status variables.
* Apr 23, 2014 3054 skorolev Fixed issue with removing from list a new zone and a new station.
* Apr 28, 2014 3086 skorolev Updated getConfigManager method.
*
* </pre>
*
* @author lvenable
@ -177,7 +176,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
private CommonConfig.AppName appName;
/** The current site. **/
protected String currentSite = null;
protected static String currentSite = null;
/** monitor area zones **/
private java.util.List<String> maZones = null;
@ -197,8 +196,8 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
/** monitor area additional stations in the region **/
private java.util.List<String> additionalStns = null;
/** Monitor Configuration Manager **/
private MonitorConfigurationManager configMgr = null;
/** current Monitor Configuration Manager **/
protected FSSObsMonitorConfigurationManager configMgr;
/** Table mode **/
private static enum Mode {
@ -208,24 +207,16 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
/** mode by default **/
private Mode mode = Mode.Zone;
/**
* Add new Zone dialog.
*/
/** Add new Zone dialog. */
private AddNewZoneDlg addNewZoneDlg;
/**
* Add new Station dialog.
*/
/** Add new Station dialog. */
private AddNewStationDlg addNewStnDlg;
/**
* Edit newly added zone dialog.
*/
/** Edit newly added zone dialog. */
private EditNewZoneDlg editDlg;
/**
* Delete a Newly Entered Station dialog
*/
/** Delete a Newly Entered Station dialog */
private DeleteStationDlg deleteStnDlg;
/**
@ -245,6 +236,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
setText(title);
this.appName = appName;
currentSite = LocalizationManager.getInstance().getCurrentSite();
configMgr = getInstance();
}
/**
@ -272,7 +264,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
}
Collections.sort(maStations);
// (3) set additional zones in the neighborhood of the monitor area
additionalZones = configMgr.getAdjacentAreaList(); // adjMgr.getAdjZones();
additionalZones = configMgr.getAdjacentAreaList();
Collections.sort(additionalZones);
// (4) set additional stations
additionalStns = new ArrayList<String>();
@ -323,13 +315,10 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
initFontAndImages();
// Initialize all of the controls and layouts
initComponents();
// set configuration and adjacent managers
configMgr = getConfigManager();
// initialize zone/station lists
initZoneStationLists();
// Populate the dialog
populateLeftLists();
// populateRightLists(); // this is called from populateLeftLists()
setValues();
}
@ -362,7 +351,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
}
/**
* Create the top configuration controls.
* Creates the top configuration controls.
*
* @param parentComp
*/
@ -416,7 +405,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
}
/**
* Create the Monitor/Additional label and list controls.
* Creates the Monitor/Additional label and list controls.
*
* @param parentComp
* Parent composite.
@ -517,7 +506,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
}
/**
* Create the Associated & MA/Regional labels and controls.
* Creates the Associated & MA/Regional labels and controls.
*
* @param parentComp
* Parent composite.
@ -528,14 +517,16 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
rightComp
.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
/*
* Create the Associated label and list control.
* Create the Associated label.
*/
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
gd.horizontalSpan = 2;
associatedLbl = new Label(rightComp, SWT.NONE);
associatedLbl.setText("Associated Stations:");
associatedLbl.setLayoutData(gd);
/*
* Create Associated list control.
*/
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.widthHint = 185;
gd.heightHint = 200;
@ -573,9 +564,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
maStationsRemoved = true;
}
});
/*
* Create the Additional label and list control.
*/
gd = new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false);
gd.verticalIndent = 5;
gd.heightHint = 20;
@ -614,7 +603,9 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
}
}
});
/*
* Create the Additional stations list control.
*/
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.widthHint = 185;
gd.heightHint = 200;
@ -640,7 +631,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
}
/**
* Create the bottom scale controls.
* Creates the bottom scale controls.
*
* @param parentComp
* Parent composite.
@ -663,14 +654,14 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
timeLbl.setText("Time window (hrs)");
timeLbl.setLayoutData(gd);
// Timewindow scale should be from 0.25(15 min) to 8 hours with step
// 0.05 hour(3 min).
int max = (int) Math.round((8.00 - 0.25) / .05);
int defaultVal = (int) Math.round((2.00 - 0.25) / .05);
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
timeWindow = new Scale(scaleComp, SWT.HORIZONTAL);
timeWindow.setMinimum(0);
timeWindow.setMaximum(max);
timeWindow.setSelection(defaultVal);
timeWindow.setLayoutData(gd);
timeWindow.addSelectionListener(new SelectionAdapter() {
@Override
@ -722,8 +713,6 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
shipDistanceLBl.setFont(controlFont);
shipDistanceLBl.setLayoutData(gd);
setShipDistScaleLabel();
/*
* Create the Fog check box.
*/
@ -742,7 +731,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
}
/**
* Create the bottom OK/Cancel buttons.
* Creates the bottom OK/Cancel buttons.
*/
private void createBottomButtons() {
addSeparator(shell);
@ -781,7 +770,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
}
/**
* Add a separator bar to the display.
* Adds a separator bar to the display.
*
* @param parentComp
* Parent composite.
@ -796,7 +785,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
}
/**
* Round a value to the hundredths decimal place.
* Rounds a value to the hundredths decimal place.
*
* @param val
* Value.
@ -811,16 +800,17 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
}
/**
* Set the time scale label.
* Sets the time scale label in hours.
*/
protected void setTimeScaleLabel() {
// Conversion of a scale to hour.
double val = timeWindow.getSelection() * .05 + .25;
val = roundToHundredths(val);
timeWindowLbl.setText(String.format("%5.2f", val));
}
/**
* Set the ship distance scale label.
* Sets the ship distance scale label.
*/
protected void setShipDistScaleLabel() {
shipDistanceLBl.setText(String.format("%5d",
@ -828,7 +818,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
}
/**
* Change the Zone and Station controls.
* Changes the Zone and Station controls.
*/
private void changeZoneStationControls() {
if (mode == Mode.Zone) {
@ -851,7 +841,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
}
/**
* Handle the Add New button click.
* Handles the Add New button click.
*/
private void handleAddNewAction() {
if (zoneRdo.getSelection() == true) {
@ -900,7 +890,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
}
/**
* Handle the Edit/Delete button click.
* Handles the Edit/Delete button click.
*/
private void handleEditDeleteAction() {
if (zoneRdo.getSelection() == true) {
@ -922,7 +912,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
editDlg.open();
} else {
if (deleteStnDlg == null) {
deleteStnDlg = new DeleteStationDlg(shell, appName);
deleteStnDlg = new DeleteStationDlg(shell, appName, this);
deleteStnDlg.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
@ -941,7 +931,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
}
/**
* Populate the MA-Regional list box.
* Populates the MA-Regional list box.
*/
private void populateMaRegionalList() {
maRegionalList.removeAll();
@ -965,13 +955,11 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
}
/**
* Populate the zone list boxes.
* Populates the zone list boxes.
*/
private void populateLeftLists() {
if (mode == Mode.Zone) {
/**
* Zone Mode
*/
/** Zone Mode */
Collections.sort(maZones);
monitorAreaList
.setItems(maZones.toArray(new String[maZones.size()]));
@ -979,9 +967,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
additionalList.setItems(additionalZones
.toArray(new String[additionalZones.size()]));
} else {
/**
* Station Mode
*/
/** Station Mode */
Collections.sort(maStations);
monitorAreaList.setItems(maStations.toArray(new String[maStations
.size()]));
@ -990,18 +976,45 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
.toArray(new String[additionalStns.size()]));
}
if (monitorAreaList.getItemCount() > 0) {
// select top of the list
monitorAreaList.setSelection(0);
handleMonitorAreaListSelection();
}
}
/**
* Set the slider values and the check box.
* Sets the slider values and the check box.
*/
protected abstract void setValues();
protected void setValues() {
// Conversion scale to hour.
Double val = (configMgr.getTimeWindow() - .25) * 20;
timeWindow.setSelection(val.intValue());
setTimeScaleLabel();
// Set other values.
if (appName != AppName.SNOW) {
shipDistance.setSelection(configMgr.getShipDistance());
setShipDistScaleLabel();
fogChk.setSelection(configMgr.isUseAlgorithms());
}
}
/**
* Show a dialog message.
* Gets changed slider values and the check box.
*/
protected void getValues() {
// Conversion of a hour to scale.
double time = timeWindow.getSelection() * .05 + .25;
time = roundToHundredths(time);
configMgr.setTimeWindow(time);
// Get other values.
if (appName != AppName.SNOW) {
configMgr.setShipDistance(shipDistance.getSelection());
configMgr.setUseAlgorithms(fogChk.getSelection());
}
}
/**
* Shows a dialog message.
*
* @param shell
* The parent shell
@ -1021,7 +1034,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
}
/**
* Add a zone or station to the monitoring area.
* Adds a zone or station to the monitoring area.
*/
private void addZoneStn() {
@ -1045,12 +1058,9 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
.setItems(maZones.toArray(new String[maZones.size()]));
monitorAreaList.setSelection(maZones.indexOf(entry));
handleMonitorAreaListSelection();
additionalZones.remove(entry);
configMgr.addArea(entry, entry.charAt(2) == 'Z' ? ZoneType.MARITIME
: ZoneType.REGULAR);
if (!configMgr.getAddedZones().contains(entry)) {
configMgr.getAddedZones().add(entry);
}
@ -1066,7 +1076,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
}
/**
* Remove a zone or station from the monitoring area.
* Removes a zone or station from the monitoring area.
*/
private void removeZoneStn() {
if (monitorAreaList.getSelectionCount() == 0) {
@ -1084,7 +1094,9 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
monitorAreaList.remove(monitorAreaList.getSelectionIndex());
associatedList.removeAll();
if (mode == Mode.Zone) {
additionalZones.add(entry);
if (!additionalZones.contains(entry)) {
additionalZones.add(entry);
}
Collections.sort(additionalZones);
additionalList.setItems(additionalZones
.toArray(new String[additionalZones.size()]));
@ -1106,13 +1118,14 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
}
/**
* Add an associated zone or station.
* Adds an associated zone or station.
*/
private void addAssociated() {
if (monitorAreaList.getSelectionCount() == 0) {
if (mode == Mode.Zone) {
showMessage(shell, SWT.ERROR, "Select Needed",
"You must select a zone");
monitorAreaList.select(0);
} else {
showMessage(shell, SWT.ERROR, "Select Needed",
"You must select a station");
@ -1126,6 +1139,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
} else {
showMessage(shell, SWT.ERROR, "Select Needed",
"You must select a zone");
associatedList.select(0);
}
return;
}
@ -1187,7 +1201,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
}
/**
* Remove an associated zone or station.
* Removes an associated zone or station.
*/
private void removeAssociated() {
if (associatedList.getItemCount() == 0) {
@ -1230,14 +1244,13 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
}
/**
* Handle the monitor area list selection.
* Handles the monitor area list selection.
*/
private void handleMonitorAreaListSelection() {
if (mode == Mode.Zone) {
String zone = monitorAreaList.getItem(monitorAreaList
.getSelectionIndex());
selectedStnZoneTF.setText(zone);
java.util.List<String> stations = configMgr
.getAreaStationsWithType(zone);
if (stations.size() > 1) {
@ -1266,23 +1279,6 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
populateMaRegionalList();
}
/**
* Get the appropriate configuration manager.
*
* @return The correct MonitorConfigurationManager
*/
protected MonitorConfigurationManager getConfigManager() {
MonitorConfigurationManager configManager = null;
if (appName == AppName.FOG) {
configManager = FogMonitorConfigurationManager.getInstance();
} else if (appName == AppName.SNOW) {
configManager = SnowMonitorConfigurationManager.getInstance();
} else if (appName == AppName.SAFESEAS) {
configManager = SSMonitorConfigurationManager.getInstance();
}
return configManager;
}
/**
* Called when the cancel or "X" button is clicked.
*/
@ -1290,9 +1286,8 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
int choice = showMessage(shell, SWT.YES | SWT.NO, appName
+ " Monitor Exit", "Are you sure you want to exit?");
if (choice == SWT.YES) {
MonitorConfigurationManager configManager = getConfigManager();
configManager.setAddedZones(new ArrayList<String>());
configManager.setAddedStations(new ArrayList<String>());
configMgr.setAddedZones(new ArrayList<String>());
configMgr.setAddedStations(new ArrayList<String>());
setReturnValue(true);
close();
}
@ -1301,7 +1296,10 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
/**
* Sets algorithm text.
*/
protected abstract void setAlgorithmText();
protected void setAlgorithmText() {
fogChk.setText("The Fog Monitor overall threat level is "
+ "considered when determining the anchor color.");
}
/**
* Handles OK button.
@ -1309,12 +1307,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
protected abstract void handleOkBtnSelection();
/**
* Reads configuration file.
*/
protected abstract void readConfigData();
/**
* Add a new zone to monitor area and refresh GUI
* Adds a new zone to monitor area and refresh GUI
*
* @param zone
*/
@ -1325,7 +1318,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
}
/**
* Add a new station to monitor area and refresh GUI
* Adds a new station to monitor area and refresh GUI
*
* @param stnWithType
* (String of station ID with type)
@ -1452,6 +1445,11 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
return false;
}
/**
* Dialog asking to edit thresholds.
*
* @return
*/
protected int editDialog() {
showMessage(shell, SWT.ICON_INFORMATION | SWT.OK, appName
+ " Config Change", "You're updating the " + appName
@ -1459,11 +1457,18 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
+ " is running anywhere within "
+ "the office, please clear it.\n");
String message2 = "New zones have been added, and their monitoring thresholds "
String message = "New zones have been added, and their monitoring thresholds "
+ "have been set to default values; would you like to modify "
+ "their threshold values now?";
int yesno = showMessage(shell, SWT.ICON_QUESTION | SWT.YES | SWT.NO,
"Edit Thresholds Now?", message2);
"Edit Thresholds Now?", message);
return yesno;
}
/**
* Gets Configuration manager.
*
* @return manager
*/
protected abstract FSSObsMonitorConfigurationManager getInstance();
}

View file

@ -41,6 +41,8 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.viz.monitor.config.CommonTableConfig;
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.ObsHistType;
import com.raytheon.uf.viz.monitor.xml.HistConfigXML;
@ -54,7 +56,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 6, 2009 lvenable Initial creation
* Apr 6, 2009 lvenable Initial creation
* May 23, 2014 3068 skorolev Corrected ObsHistType. Cleaned code.
*
* </pre>
*
@ -62,6 +65,10 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* @version 1.0
*/
public class ObsHistConfigDlg extends CaveSWTDialog {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(ObsHistConfigDlg.class);
/**
* Application name.
*/
@ -120,16 +127,34 @@ public class ObsHistConfigDlg extends CaveSWTDialog {
*/
private HistConfigXML cfgXML = null;
/**
* File in the localization system.
*/
private LocalizationFile locFile;
/**
* Composite for History Table.
*/
private final ObsHistTableComp obsHistTable;
/**
* History table observation type.
*/
private final ObsHistType obsType;
/**
* Keys for columns.
*/
private String[] colKeys;
/**
* Initiate Columns for Metar data.
*/
private boolean[] initColsMetar;
/**
* Initiate Columns for Maritime data.
*/
private boolean[] initColsMaritime;
/**
@ -165,13 +190,13 @@ public class ObsHistConfigDlg extends CaveSWTDialog {
* Element 1 of the metarCols is element 0 of the METAR checkbox array.
*/
tableConfig = CommonTableConfig.getInstance();
initiateColums();
initiateColumns();
}
/**
*
* Initiates Columns.
*/
private void initiateColums() {
private void initiateColumns() {
this.setInitColsMetar(new boolean[tableConfig.getMetarConfigureNames().length + 1]);
newVisColsMetar = new boolean[tableConfig.getMetarConfigureNames().length + 1];
@ -213,8 +238,6 @@ public class ObsHistConfigDlg extends CaveSWTDialog {
}
/**
* Initialize the components on the display.
*/
@ -244,11 +267,6 @@ public class ObsHistConfigDlg extends CaveSWTDialog {
private void createColumnControls() {
int gridColumns = 3;
// if (appName == CommonConfig.AppName.SNOW)
// {
// gridColumns = 1;
// }
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
Composite mainControlComp = new Composite(shell, SWT.NONE);
mainControlComp.setLayout(new GridLayout(gridColumns, false));
@ -279,7 +297,7 @@ public class ObsHistConfigDlg extends CaveSWTDialog {
maritimeChkArray[i - 1].setEnabled(false);
}
}
if (obsType == ObsHistType.Maritime) {
if (obsType == ObsHistType.MARITIME) {
for (int i = startingColIndex; i < newVisColsMetar.length; i++) {
metarChkArray[i - 1].setEnabled(false);
}
@ -413,7 +431,7 @@ public class ObsHistConfigDlg extends CaveSWTDialog {
@Override
public void widgetSelected(SelectionEvent event) {
saveConfig();
initiateColums();
initiateColumns();
shell.dispose();
}
});
@ -495,7 +513,7 @@ public class ObsHistConfigDlg extends CaveSWTDialog {
mainCheckBox.setSelection(allChecked);
if ((obsType == ObsHistType.METAR && mainCheckBox == maritimeChk)
|| (obsType == ObsHistType.Maritime && mainCheckBox == metarChk)) {
|| (obsType == ObsHistType.MARITIME && mainCheckBox == metarChk)) {
mainCheckBox.setEnabled(false);
}
}
@ -512,6 +530,9 @@ public class ObsHistConfigDlg extends CaveSWTDialog {
return locFile;
}
/**
* Saves Configuration file.
*/
private void saveConfig() {
updateCheckBoxesStatus();
this.cfgXML = new HistConfigXML();
@ -519,7 +540,7 @@ public class ObsHistConfigDlg extends CaveSWTDialog {
cfgXML.setMetar(newVisColsMetar);
locFile = getXmlFile();
try {
System.out.println("Saving -- "
statusHandler.info("Saving -- "
+ locFile.getFile().getAbsolutePath());
JAXB.marshal(cfgXML, locFile.getFile());
locFile.save();
@ -528,6 +549,11 @@ public class ObsHistConfigDlg extends CaveSWTDialog {
}
}
/**
* Gets History Configuration XML.
*
* @return
*/
private HistConfigXML getHistConfigFile() {
// Open user file if exist.
locFile = getXmlFile();
@ -541,6 +567,11 @@ public class ObsHistConfigDlg extends CaveSWTDialog {
return cfgXML;
}
/**
* Gets History Table Configuration Path.
*
* @return
*/
private String getHistPath() {
String fs = String.valueOf(File.separatorChar);
StringBuilder sb = new StringBuilder();
@ -549,6 +580,9 @@ public class ObsHistConfigDlg extends CaveSWTDialog {
return sb.toString();
}
/**
* Updates Check Boxes Status.
*/
private void updateCheckBoxesStatus() {
{
if (!isSkipMaritime()) {
@ -565,9 +599,13 @@ public class ObsHistConfigDlg extends CaveSWTDialog {
}
/**
* Apply Visible Columns.
*/
private void applyVisCols() {
updateCheckBoxesStatus();
if (obsType.equals(ObsHistType.METAR)) {
if (obsType.equals(ObsHistType.METAR)
|| obsType.equals(ObsHistType.MESONET)) {
obsHistTable.showHideTableColumns(newVisColsMetar);
} else {
obsHistTable.showHideTableColumns(newVisColsMaritime);
@ -575,8 +613,12 @@ public class ObsHistConfigDlg extends CaveSWTDialog {
obsHistTable.getParent().pack();
}
/**
* Restore Visible Columns.
*/
private void restoreVisCols() {
if (obsType.equals(ObsHistType.METAR)) {
if (obsType.equals(ObsHistType.METAR)
|| obsType.equals(ObsHistType.MESONET)) {
obsHistTable.showHideTableColumns(getInitColsMetar());
} else {
obsHistTable.showHideTableColumns(getInitColsMaritime());
@ -585,6 +627,8 @@ public class ObsHistConfigDlg extends CaveSWTDialog {
}
/**
* Get Skip Maritime flag.
*
* @return the skipMaritime
*/
protected boolean isSkipMaritime() {
@ -592,6 +636,8 @@ public class ObsHistConfigDlg extends CaveSWTDialog {
}
/**
* Sets Skip Maritime flag.
*
* @param skipMaritime
* the skipMaritime to set
*/
@ -600,6 +646,8 @@ public class ObsHistConfigDlg extends CaveSWTDialog {
}
/**
* Gets InitColsMetar flag.
*
* @return the initColsMetar
*/
protected boolean[] getInitColsMetar() {
@ -607,6 +655,8 @@ public class ObsHistConfigDlg extends CaveSWTDialog {
}
/**
* Sets InitColsMetar flag.
*
* @param initColsMetar
* the initColsMetar to set
*/
@ -615,6 +665,8 @@ public class ObsHistConfigDlg extends CaveSWTDialog {
}
/**
* Gets InitColsMaritime flag.
*
* @return the initColsMaritime
*/
protected boolean[] getInitColsMaritime() {
@ -622,6 +674,8 @@ public class ObsHistConfigDlg extends CaveSWTDialog {
}
/**
* Sets InitColsMaritime flag.
*
* @param initColsMaritime
* the initColsMaritime to set
*/
@ -629,5 +683,4 @@ public class ObsHistConfigDlg extends CaveSWTDialog {
this.initColsMaritime = initColsMaritime;
}
}

View file

@ -43,13 +43,14 @@ import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.monitor.MonitorAreaUtils;
import com.raytheon.uf.common.monitor.config.MonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.map.IMapDescriptor;
import com.raytheon.uf.viz.monitor.IMonitor;
import com.raytheon.uf.viz.monitor.config.CommonTableConfig;
@ -86,6 +87,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Oct 26, 2012 1280 skorolev Changes for non-blocking dialog.
* Nov.11, 2012 1297 skorolev new abstract initiateProdArray()
* May 13, 2014 3133 njensen Updated getting ObsHistType from configMgr
* May 15, 2014 3086 skorolev Replaced MonitorConfigurationManager with FSSObsMonitorConfigurationManager.
*
* </pre>
*
@ -227,6 +229,11 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
/** title of plot. **/
private String dlgTitle;
/** current site **/
protected String site;
protected FSSObsMonitorConfigurationManager configMgr;
/**
* Constructor
*
@ -238,6 +245,7 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK
| CAVE.INDEPENDENT_SHELL);
this.appName = appName;
this.site = LocalizationManager.getInstance().getCurrentSite();
dFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
this.obData = obData;
// the zone table data of the latest nominal time:
@ -472,16 +480,25 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
}
/**
* Sets zone table sort column index and sort direction to the current zone
* table sort column index and sort direction
* Sets Column and Sort Direction for Zone table.
*/
protected abstract void setZoneSortColumnAndDirection();
protected void setZoneSortColumnAndDirection() {
if (zoneTblData != null) {
zoneSortColumn = zoneTblData.getSortColumn();
zoneSortDirection = zoneTblData.getSortDirection();
}
}
/**
* Sets station table sort column index and sort direction to the current
* station table sort column index and sort direction
*/
protected abstract void setStnSortColumnAndDirection();
protected void setStnSortColumnAndDirection() {
if (stnTblData != null) {
stnSortColumn = stnTblData.getSortColumn();
stnSortDirection = stnTblData.getSortDirection();
}
}
/**
* Creates the station table.
@ -713,15 +730,15 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
}
// Set dialog index
String dialogID = appName.name() + station;
MonitorConfigurationManager configMgr = getConfigMgr();
String strHistType = configMgr.getStationType(selectedZone, station);
String strHistType = getMonitorAreaConfigInstance().getStationType(
selectedZone, station);
ObsHistType histType = ObsHistType.valueOf(strHistType);
/**
* For Snow monitor, no history table is displayed for a Maritime
* station
*/
if (appName == AppName.SNOW && histType == ObsHistType.Maritime) {
if (appName == AppName.SNOW && histType == ObsHistType.MARITIME) {
return;
}
ObsHistTableDlg obsHstTblDlg = (ObsHistTableDlg) openedDlgs
@ -741,13 +758,6 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
obsHstTblDlg.open();
}
/**
* Gets Configuration manager.
*
* @return manager
*/
protected abstract MonitorConfigurationManager getConfigMgr();
/**
* Configuration button action method.
*/
@ -858,6 +868,7 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
@Override
protected void disposed() {
setReturnValue(true);
configMgr = null;
}
/**
@ -935,4 +946,11 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
}
return varName;
}
/**
* Gets Configuration manager.
*
* @return manager
*/
protected abstract FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance();
}

View file

@ -19,8 +19,10 @@
**/
package com.raytheon.uf.common.monitor.config;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
@ -30,6 +32,7 @@ import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.monitor.MonitorAreaUtils;
import com.raytheon.uf.common.monitor.data.AdjacentWfoMgr;
import com.raytheon.uf.common.monitor.events.MonitorConfigListener;
import com.raytheon.uf.common.monitor.xml.AreaIdXML;
import com.raytheon.uf.common.monitor.xml.AreaIdXML.ZoneType;
import com.raytheon.uf.common.monitor.xml.MonAreaConfigXML;
@ -57,6 +60,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* Oct 17 2013 16682 zhao fixed a bug in readConfigXml()
* Apr 23 2014 3054 skorolev Removed unnecessary parameter in the addArea method.
* May 13 2014 3133 njensen getStationType returns String instead of ObsHistType
* May 15 2014 3086 skorolev Renamed from MonitorConfigurationManager. Replaces three separate area configuration managers with one.
*
* </pre>
*
@ -64,71 +68,123 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* @version 1.0
*/
public abstract class MonitorConfigurationManager {
public class FSSObsMonitorConfigurationManager {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(MonitorConfigurationManager.class);
.getHandler(FSSObsMonitorConfigurationManager.class);
/**
* Maps county table in the PostgreSQL database.
*/
/** Maps county table in the PostgreSQL database. */
public static final String COUNTY_TABLE = "mapdata.county";
/**
* Maps forecast zones table in the PostgreSQL database.
*/
/** Maps forecast zones table in the PostgreSQL database. */
public static final String FORECAST_ZONE_TABLE = "mapdata.zone";
/**
* Maps marine zones table in the PostgreSQL database.
*/
/** Maps marine zones table in the PostgreSQL database. */
public static final String MARINE_ZONE_TABLE = "mapdata.marinezones";
/** Single Type JAXB Manager */
private static final SingleTypeJAXBManager<MonAreaConfigXML> jaxb = SingleTypeJAXBManager
.createWithoutException(MonAreaConfigXML.class);
/**
* Monitoring Area Configuration XML object.
*/
/** Monitoring Area Configuration XML object. */
protected MonAreaConfigXML configXml;
/**
* Adjacent Area Configuration XML object.
*/
/** Adjacent Area Configuration XML object. */
protected MonAreaConfigXML adjAreaConfigXml;
/**
* List of newly added zones.
*/
/** List of newly added zones. */
protected List<String> addedZones = new ArrayList<String>();
/**
* List of newly added stations.
*/
/** List of newly added stations. */
protected List<String> addedStations = new ArrayList<String>();
/**
* Station data type in the XML configuration file.
*/
private String xmlDataType = StationIdXML.METAR;
/** Name of plugin */
private static String pluginName;
/** Name of area configuration file */
private String configFileName = null;
/** Name of adjacent Area Configuration file */
private String adjAreaConfigFileName = null;
/** List of listeners */
private List<MonitorConfigListener> listeners = new CopyOnWriteArrayList<MonitorConfigListener>();
private String currentSite;
/** Monitor Name **/
public enum MonName {
ss, fog, snow
};
/** Singleton instance of this class */
private static FSSObsMonitorConfigurationManager instance;
/**
* Reads area configuration file.
* Private Constructor
*
* @param currentSite
* @param site
* @param monitorName
*/
public abstract void readConfigXml(String currentSite);
public FSSObsMonitorConfigurationManager(String site, String monitorName) {
// Avoid confusion in file path
if (monitorName == MonName.ss.name()) {
pluginName = "safeseas";
} else {
pluginName = monitorName;
}
currentSite = site;
/** Path to Monitoring Area Configuration XML. */
setConfigFileName(pluginName + File.separatorChar + "monitoringArea"
+ File.separatorChar + "monitorAreaConfig.xml");
/** Path to Adjacent Areas Configuration XML. */
setAdjAreaConfigFileName(pluginName + File.separatorChar
+ "monitoringArea" + File.separatorChar
+ "adjacentAreaConfig.xml");
configXml = new MonAreaConfigXML();
adjAreaConfigXml = new MonAreaConfigXML();
readConfigXml();
}
/**
* Get an instance of Configuration manager for FSSObs monitors.
*
* @param site
* Current site
* @param monitor
* Name of monitor
* @return
*/
public static synchronized FSSObsMonitorConfigurationManager getInstance(
String site, String monitor) {
if (instance == null) {
instance = new FSSObsMonitorConfigurationManager(site, monitor);
}
return (FSSObsMonitorConfigurationManager) instance;
}
/**
* Reads the XML configuration file
*/
public void readConfigXml() {
try {
readConfigXml(configFileName, adjAreaConfigFileName);
} catch (Throwable t) {
statusHandler.error("Could not configure " + pluginName
+ " for site " + currentSite, t);
}
}
/**
* Reads the XML configuration data for the current XML file name. filename:
* monitor area config file name adjAreaFileName: adjacent areas config file
* name
*
* @param currentSite
* @param filename
* @param adjAreaFilename
*/
protected void readConfigXml(String currentSite, String filename,
String adjAreaFilename) {
protected void readConfigXml(String filename, String adjAreaFilename) {
boolean monitorAreaFileExists = true;
boolean adjacentAreaFileExists = true;
try {
@ -141,14 +197,17 @@ public abstract class MonitorConfigurationManager {
.unmarshalFromXmlFile(monitorAreaFilePath.toString());
configXml = configXmltmp;
} catch (Exception e) {
statusHandler.handle(Priority.ERROR,
"No monitor area configuration file found", e);
statusHandler
.handle(Priority.WARN,
"No "
+ pluginName
+ " monitor area configuration file found. New configuration file has been generated and saved:"
+ "");
monitorAreaFileExists = false;
}
try {
IPathManager pm = PathManagerFactory.getPathManager();
String adjacentAreaFilePath = pm.getFile(
pm.getContext(LocalizationType.COMMON_STATIC,
LocalizationLevel.SITE), adjAreaFilename)
@ -157,8 +216,11 @@ public abstract class MonitorConfigurationManager {
.unmarshalFromXmlFile(adjacentAreaFilePath.toString());
adjAreaConfigXml = configXmltmp;
} catch (Exception e) {
statusHandler.handle(Priority.ERROR,
"No adjacent area configuration file found", e);
statusHandler
.handle(Priority.WARN,
"No "
+ pluginName
+ " adjacent area configuration file found. New configuration file has been generated and saved.");
adjacentAreaFileExists = false;
}
@ -210,7 +272,10 @@ public abstract class MonitorConfigurationManager {
configXml.addAreaId(zoneXml);
}
}
saveConfigXml(filename);
// Default value for Timewindow.
int defaultVal = 2;
configXml.setTimeWindow(defaultVal);
saveConfigXml();
}
// Check for an adjacent area config file, if one does not exist,
// create and use defaults
@ -242,11 +307,10 @@ public abstract class MonitorConfigurationManager {
/**
* Save the monitor area XML configuration data to the current XML file
* name.
*
* @param filename
*/
protected void saveConfigXml(String filename) {
public void saveConfigXml() {
// Save the xml object to disk
String filename = this.getConfigFileName();
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext lc = pm.getContext(LocalizationType.COMMON_STATIC,
LocalizationLevel.SITE);
@ -268,6 +332,7 @@ public abstract class MonitorConfigurationManager {
* name.
*
* @param filename
* adjacentAreaConfig.xml
*/
protected void saveAdjacentAreaConfigXml(String filename) {
// Save the xml object to disk
@ -294,6 +359,7 @@ public abstract class MonitorConfigurationManager {
*
* @param areaId
* @param type
* Type of zone
*/
public void addArea(String areaId, ZoneType type) {
List<AreaIdXML> areaXmlList = configXml.getAreaIds();
@ -310,6 +376,9 @@ public abstract class MonitorConfigurationManager {
area.setAreaId(areaId);
area.setType(type);
configXml.addAreaId(area);
if (!addedZones.contains(areaId)) {
addedZones.add(areaId);
}
}
}
@ -548,6 +617,7 @@ public abstract class MonitorConfigurationManager {
for (int i = 0; i < stationList.size(); i++) {
if (stationList.get(i).getName().equals(station)) {
stationList.remove(i);
areaXml.getStationIds();
}
}
}
@ -629,21 +699,65 @@ public abstract class MonitorConfigurationManager {
}
/**
* Gets TimeWindow
*
* @return the timeWindow
*/
public int getTimeWindow() {
public double getTimeWindow() {
return configXml.getTimeWindow();
}
/**
* @param timeWindow
* Sets TimeWindow
*
* @param hours
* the timeWindow to set
*/
public void setTimeWindow(int timeWindow) {
configXml.setTimeWindow(timeWindow);
public void setTimeWindow(double hours) {
configXml.setTimeWindow(hours);
}
/**
* Gets Ship Distance
*
* @return the shipDistance
*/
public int getShipDistance() {
return configXml.getShipDistance();
}
/**
* Sets Ship Distance
*
* @param shipDistance
* the shipDistance to set
*/
public void setShipDistance(int shipDistance) {
configXml.setShipDistance(shipDistance);
}
/**
* Flag is true if to use the Fog Monitor overall threat level.
*
* @return the useAlgorithms flag
*/
public boolean isUseAlgorithms() {
return configXml.isUseAlgorithms();
}
/**
* Sets flag UseAlgorithms
*
* @param useAlgorithms
* the useAlgorithms to set
*/
public void setUseAlgorithms(boolean useAlgorithms) {
configXml.setUseAlgorithms(useAlgorithms);
}
/**
* Gets Configuration Xml
*
* @return the configXml
*/
public MonAreaConfigXML getConfigXml() {
@ -651,6 +765,8 @@ public abstract class MonitorConfigurationManager {
}
/**
* Gets Added Zones
*
* @return the addedZones
*/
public List<String> getAddedZones() {
@ -658,6 +774,8 @@ public abstract class MonitorConfigurationManager {
}
/**
* Sets Added Zones
*
* @param addedZones
* the addedZones to set
*/
@ -666,6 +784,8 @@ public abstract class MonitorConfigurationManager {
}
/**
* Gets Added Stations
*
* @return the addedStations
*/
public List<String> getAddedStations() {
@ -673,6 +793,8 @@ public abstract class MonitorConfigurationManager {
}
/**
* Sets Added Stations
*
* @param addedStations
* the addedStations to set
*/
@ -703,4 +825,63 @@ public abstract class MonitorConfigurationManager {
}
return result;
}
/**
* Gets Configuration File Name
*
* @return
*/
public String getConfigFileName() {
return configFileName;
}
/**
* Sets Configuration File Name
*
* @param configFileName
*/
public void setConfigFileName(String configFileName) {
this.configFileName = configFileName;
}
/**
* Gets Adjacent Area Configuration File Name
*
* @return
*/
public String getAdjAreaConfigFileName() {
return adjAreaConfigFileName;
}
/**
* Sets Adjacent Area Configuration File Name
*
* @param adjAreaConfigFileName
*/
public void setAdjAreaConfigFileName(String adjAreaConfigFileName) {
this.adjAreaConfigFileName = adjAreaConfigFileName;
}
/**
* Adds Monitor Configuration Listener
*
* @param ml
* Monitor config listener
*/
public void addListener(MonitorConfigListener ml) {
listeners.add(ml);
}
/**
* Removes Monitor Configuration Listener
*
* @param ml
* Monitor config listener
*/
public void removeListener(MonitorConfigListener ml) {
listeners.remove(ml);
}
// TODO: Make a loopback to change FSSObs URI filters according to changes
// in the configuration files.
}

View file

@ -1,117 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.monitor.config;
import java.io.File;
import com.raytheon.uf.common.monitor.xml.MonAreaConfigXML;
/**
* Fog Monitor Configuration XML File Manager.
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 28, 2009 mpduff Initial creation
* Feb 21, 2012 14413 zhao added code handling "adjacent areas"
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
public class FogMonitorConfigurationManager extends MonitorConfigurationManager {
/** Path to Monitoring Area Configuration XML. */
private static final String CONFIG_FILE_NAME = "fog" + File.separatorChar
+ "monitoringArea" + File.separatorChar + "monitorAreaConfig.xml";
/** Path to Adjacent Area Configuration XML. */
private static final String ADJ_AREA_CONFIG_FILE_NAME = "fog" + File.separatorChar
+ "monitoringArea" + File.separatorChar + "adjacentAreaConfig.xml";
/** Singleton instance of this class */
private static MonitorConfigurationManager instance = null;
/* Private Constructor */
private FogMonitorConfigurationManager() {
configXml = new MonAreaConfigXML();
adjAreaConfigXml = new MonAreaConfigXML();
}
/**
* Get an instance of this singleton.
*
* @return Instance of this class
*/
public static synchronized FogMonitorConfigurationManager getInstance() {
if (instance == null) {
instance = new FogMonitorConfigurationManager();
}
return (FogMonitorConfigurationManager) instance;
}
/**
* Save the XML configuration data to the current XML file name.
*/
public void saveConfigData() {
super.saveConfigXml(CONFIG_FILE_NAME);
}
/**
* Read the XML configuration data for the current XML file name.
*/
public void readConfigXml(String currentSite) {
super.readConfigXml(currentSite, CONFIG_FILE_NAME, ADJ_AREA_CONFIG_FILE_NAME);
}
/**
* @return the shipDistance
*/
public int getShipDistance() {
return configXml.getShipDistance();
}
/**
* @param shipDistance
* the shipDistance to set
*/
public void setShipDistance(int shipDistance) {
configXml.setShipDistance(shipDistance);
}
/**
* @return the useAlgorithms
*/
public boolean isUseAlgorithms() {
return configXml.isUseAlgorithms();
}
/**
* @param useAlgorithms
* the useAlgorithms to set
*/
public void setUseAlgorithms(boolean useAlgorithms) {
configXml.setUseAlgorithms(useAlgorithms);
}
}

View file

@ -1,118 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.monitor.config;
import java.io.File;
import com.raytheon.uf.common.monitor.xml.MonAreaConfigXML;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 5, 2010 mpduff Initial creation
* Feb 21, 2012 14413 zhao added code handling "adjacent areas"
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
public class SSMonitorConfigurationManager extends MonitorConfigurationManager {
/** Path to Monitoring Area Configuration XML. */
private static final String CONFIG_FILE_NAME = "safeseas" + File.separatorChar
+ "monitoringArea" + File.separatorChar + "monitorAreaConfig.xml";
/** Path to Adjacent Area Configuration XML. */
private static final String ADJ_AREA_CONFIG_FILE_NAME = "safeseas" + File.separatorChar
+ "monitoringArea" + File.separatorChar + "adjacentAreaConfig.xml";
/** Singleton instance of this class */
private static MonitorConfigurationManager instance = null;
/* Private Constructor */
private SSMonitorConfigurationManager() {
configXml = new MonAreaConfigXML();
adjAreaConfigXml = new MonAreaConfigXML();
}
/**
* Get an instance of this singleton.
*
* @return Instance of this class
*/
public static synchronized SSMonitorConfigurationManager getInstance() {
if (instance == null) {
instance = new SSMonitorConfigurationManager();
}
return (SSMonitorConfigurationManager) instance;
}
/**
* Save the XML configuration data to the current XML file name.
*/
public void saveConfigData() {
super.saveConfigXml(CONFIG_FILE_NAME);
}
/**
* Read the XML configuration data for the current XML file name.
*/
public void readConfigXml(String currentSite) {
super.readConfigXml(currentSite, CONFIG_FILE_NAME, ADJ_AREA_CONFIG_FILE_NAME);
}
/**
* @return the shipDistance
*/
public int getShipDistance() {
return configXml.getShipDistance();
}
/**
* @param shipDistance
* the shipDistance to set
*/
public void setShipDistance(int shipDistance) {
configXml.setShipDistance(shipDistance);
}
/**
* @return the useAlgorithms
*/
public boolean isUseAlgorithms() {
return configXml.isUseAlgorithms();
}
/**
* @param useAlgorithms
* the useAlgorithms to set
*/
public void setUseAlgorithms(boolean useAlgorithms) {
configXml.setUseAlgorithms(useAlgorithms);
}
}

View file

@ -1,118 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.monitor.config;
import java.io.File;
import com.raytheon.uf.common.monitor.xml.MonAreaConfigXML;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 5, 2010 mpduff Initial creation
* Feb 21 2012 14413 zhao add code handling "adjacent areas"
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
public class SnowMonitorConfigurationManager extends MonitorConfigurationManager {
/** Path to Monitoring Area Configuration XML. */
private static final String CONFIG_FILE_NAME = "snow" + File.separatorChar
+ "monitoringArea" + File.separatorChar + "monitorAreaConfig.xml";
/** Path to Adjacent Areas Configuration XML. */
private static final String ADJ_AREA_CONFIG_FILE_NAME = "snow" + File.separatorChar
+ "monitoringArea" + File.separatorChar + "adjacentAreaConfig.xml";
/** Singleton instance of this class */
private static MonitorConfigurationManager instance = null;
/* Private Constructor */
private SnowMonitorConfigurationManager() {
configXml = new MonAreaConfigXML();
adjAreaConfigXml = new MonAreaConfigXML();
}
/**
* Get an instance of this singleton.
*
* @return Instance of this class
*/
public static synchronized SnowMonitorConfigurationManager getInstance() {
if (instance == null) {
instance = new SnowMonitorConfigurationManager();
}
return (SnowMonitorConfigurationManager) instance;
}
/**
* Save the XML configuration data to the current XML file name.
*/
public void saveConfigData() {
super.saveConfigXml(CONFIG_FILE_NAME);
}
/**
* Read the XML configuration data for the current XML file name.
*/
public void readConfigXml(String currentSite) {
super.readConfigXml(currentSite, CONFIG_FILE_NAME, ADJ_AREA_CONFIG_FILE_NAME);
}
/**
* @return the shipDistance
*/
public int getShipDistance() {
return configXml.getShipDistance();
}
/**
* @param shipDistance
* the shipDistance to set
*/
public void setShipDistance(int shipDistance) {
configXml.setShipDistance(shipDistance);
}
/**
* @return the useAlgorithms
*/
public boolean isUseAlgorithms() {
return configXml.isUseAlgorithms();
}
/**
* @param useAlgorithms
* the useAlgorithms to set
*/
public void setUseAlgorithms(boolean useAlgorithms) {
configXml.setUseAlgorithms(useAlgorithms);
}
}

View file

@ -51,6 +51,7 @@ import com.vividsolutions.jts.io.WKBReader;
* Dec 22, 2009 mpduff Initial creation
* Jul 24, 2013 2219 mpduff Improve error handling.
* Oct 02, 2013 2361 njensen Use JAXBManager for XML
* May 23, 2014 3086 skorolev Cleaned code.
*
* </pre>
*
@ -69,14 +70,17 @@ public class AdjacentWfoMgr {
private static final SingleTypeJAXBManager<AdjacentWfoXML> jaxb = SingleTypeJAXBManager
.createWithoutException(AdjacentWfoXML.class);
/** Configuration XML. */
/** Configuration Adjacent WFO XML. */
private AdjacentWfoXML adjXML = null;
private ArrayList<String> adjZones = null;
/** Adjacent zones */
private List<String> adjZones = null;
/** Current site */
private final String currentSite;
private ArrayList<String> idList = null;
/** List of adjacent areas */
private List<String> idList = null;
/** Adjacent area geometry */
private Geometry geoAdjAreas = null;
@ -128,6 +132,8 @@ public class AdjacentWfoMgr {
}
/**
* Gets Adjacent Wfo XML.
*
* @return the adjXML
*/
public AdjacentWfoXML getAdjXML() {
@ -135,6 +141,8 @@ public class AdjacentWfoMgr {
}
/**
* Sets Adjacent Wfo XML.
*
* @param adjXML
* the adjXML to set
*/
@ -143,6 +151,8 @@ public class AdjacentWfoMgr {
}
/**
* Gets Adjacent Zones.
*
* @return the adjZones
*/
public ArrayList<String> getAdjZones() {
@ -156,9 +166,11 @@ public class AdjacentWfoMgr {
}
/**
* Gets list of adjacent areas.
*
* @return List of adjacent areas
*/
public ArrayList<String> getAdjIdList() {
public List<String> getAdjIdList() {
return idList;
}

View file

@ -36,6 +36,7 @@ import javax.xml.bind.annotation.XmlRootElement;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 21, 2009 lvenable Initial creation
* May 15, 2014 3086 skorolev Changed type for timeWindow element.
*
* </pre>
*
@ -49,12 +50,21 @@ public class MonAreaConfigXML {
@XmlElements({ @XmlElement(name = "AreaID", type = AreaIdXML.class) })
private ArrayList<AreaIdXML> areaIds = new ArrayList<AreaIdXML>();
@XmlElements({ @XmlElement(name = "timeWindow", type = Integer.class) })
private int timeWindow;
/**
* Time period in minutes during which stations are monitoring.
*/
@XmlElements({ @XmlElement(name = "timeWindow", type = Double.class) })
private double timeWindow;
/**
* The shortest distance between center of site and a ship.
*/
@XmlElements({ @XmlElement(name = "shipDistance", type = Integer.class) })
private int shipDistance;
/**
* Flag to use the Fog Monitor overall threat level.
*/
@XmlElements({ @XmlElement(name = "useAlgorithms", type = Boolean.class) })
private boolean useAlgorithms;
@ -72,16 +82,16 @@ public class MonAreaConfigXML {
/**
* @return the timeWindow
*/
public int getTimeWindow() {
public double getTimeWindow() {
return timeWindow;
}
/**
* @param timeWindow
* @param hours
* the timeWindow to set
*/
public void setTimeWindow(int timeWindow) {
this.timeWindow = timeWindow;
public void setTimeWindow(double hours) {
this.timeWindow = hours;
}
/**
@ -114,6 +124,9 @@ public class MonAreaConfigXML {
this.useAlgorithms = useAlgorithms;
}
/**
* @param areaXml
*/
public void addAreaId(AreaIdXML areaXml) {
areaIds.add(areaXml);
}

View file

@ -26,6 +26,7 @@ import com.raytheon.edex.urifilter.URIFilter;
import com.raytheon.edex.urifilter.URIGenerateMessage;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecord;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
@ -43,6 +44,7 @@ import com.raytheon.uf.edex.plugin.fssobs.common.FSSObsConfig;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 26, 2010 skorolev Initial creation
* May 23, 2014 3086 skorolev Cleaned code.
*
* </pre>
*
@ -65,6 +67,13 @@ public class FSSObsGenerator extends CompositeProductGenerator {
super(genName, productType);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.edex.cpgsrv.CompositeProductGenerator#generateProduct
* (com.raytheon.edex.urifilter.URIGenerateMessage)
*/
@Override
public void generateProduct(URIGenerateMessage genMessage) {
@ -99,24 +108,45 @@ public class FSSObsGenerator extends CompositeProductGenerator {
}
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.edex.cpgsrv.CompositeProductGenerator#createFilters()
*/
@Override
protected void createFilters() {
ArrayList<URIFilter> tmp = new ArrayList<URIFilter>(3);
tmp.add(new FSSObsURIFilter("fog"));
tmp.add(new FSSObsURIFilter("ss"));
tmp.add(new FSSObsURIFilter("snow"));
tmp.add(new FSSObsURIFilter(MonName.fog.name()));
tmp.add(new FSSObsURIFilter(MonName.ss.name()));
tmp.add(new FSSObsURIFilter(MonName.snow.name()));
filters = tmp.toArray(new FSSObsURIFilter[tmp.size()]);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.edex.cpgsrv.CompositeProductGenerator#configureFilters()
*/
@Override
protected void configureFilters() {
}
/**
* Sets Product Time.
*
* @param filter
*/
public void setProductTime(URIFilter filter) {
productTime = new DataTime(filter.getValidTime());
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.edex.cpgsrv.CompositeProductGenerator#isRunning()
*/
@Override
public boolean isRunning() {
return getConfigManager().getFSSState();

View file

@ -32,9 +32,8 @@ import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecord;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.geospatial.ISpatialQuery;
import com.raytheon.uf.common.geospatial.SpatialQueryFactory;
import com.raytheon.uf.common.monitor.config.FogMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.SSMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.SnowMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
@ -56,6 +55,7 @@ import com.raytheon.uf.edex.pointdata.PointDataQuery;
* May 16, 2013 1869 bsteffen Rewrite dataURI property mappings.
* Jan 02, 2014 2580 skorolev Fixed FSSObs error.
* Jan 06, 2014 2653 skorolev Corrected decoding of snincrHourly and snincrTotal.
* Apr 28, 2014 3086 skorolev Updated getStations method.
*
* </pre>
*
@ -85,13 +85,8 @@ public class FSSObsUtils {
*/
private static final int CLR_SKY_CONDITION = 8888888;
/** Monitor ID **/
private enum monID {
ss, fog, snow
};
/** Plug-in name **/
private enum plgn {
private enum Plgn {
obs, sfcobs, ldadmesonet
};
@ -127,7 +122,7 @@ public class FSSObsUtils {
PointDataQuery request = null;
PointDataContainer result = null;
try {
request = new PointDataQuery(plgn.obs.toString());
request = new PointDataQuery(Plgn.obs.toString());
request.requestAllLevels();
request.addParameter(slct, uri, equ);
request.setParameters(FSSObsDataTransform.OBS_PARAMS_LIST);
@ -174,7 +169,7 @@ public class FSSObsUtils {
PointDataQuery request = null;
PointDataContainer result = null;
try {
request = new PointDataQuery(plgn.sfcobs.toString());
request = new PointDataQuery(Plgn.sfcobs.toString());
request.addParameter(slct, uri, equ);
request.setParameters(FSSObsDataTransform.SFCOBS_PARAMS_LIST);
result = request.execute();
@ -206,7 +201,7 @@ public class FSSObsUtils {
.toConstraintMapping(DataURIUtil.createDataURIMap(uri));
// Not actually in db
rcMap.remove("pluginName");
request = new PointDataQuery(plgn.ldadmesonet.toString());
request = new PointDataQuery(Plgn.ldadmesonet.toString());
for (Entry<String, RequestConstraint> entry : rcMap.entrySet()) {
RequestConstraint rc = entry.getValue();
String value = rc.getConstraintValue();
@ -425,7 +420,7 @@ public class FSSObsUtils {
}
/**
* Gets stations which FSS monitor is using.
* Gets stations which FSSObs monitor is using.
*
* @param monitor
* @return stations
@ -435,26 +430,26 @@ public class FSSObsUtils {
List<String> stations = new ArrayList<String>();
// Which monitor should use this station: fog, ss or snow
if (monitor.equals(monID.fog.name())) {
FogMonitorConfigurationManager fogConfigManager = FogMonitorConfigurationManager
.getInstance();
fogConfigManager.readConfigXml(currentSite);
if (monitor.equals(MonName.fog.name())) {
FSSObsMonitorConfigurationManager fogConfigManager = new FSSObsMonitorConfigurationManager(
currentSite, MonName.fog.name());
List<String> fogStations = fogConfigManager.getStations();
stations.addAll(fogStations);
fogConfigManager = null;
}
if (monitor.equals(monID.ss.name())) {
SSMonitorConfigurationManager ssConfigManger = SSMonitorConfigurationManager
.getInstance();
ssConfigManger.readConfigXml(currentSite);
if (monitor.equals(MonName.ss.name())) {
FSSObsMonitorConfigurationManager ssConfigManger = new FSSObsMonitorConfigurationManager(
currentSite, MonName.ss.name());
List<String> ssStaitions = ssConfigManger.getStations();
stations.addAll(ssStaitions);
ssConfigManger = null;
}
if (monitor.equals(monID.snow.name())) {
SnowMonitorConfigurationManager snowConfigManager = SnowMonitorConfigurationManager
.getInstance();
snowConfigManager.readConfigXml(currentSite);
if (monitor.equals(MonName.snow.name())) {
FSSObsMonitorConfigurationManager snowConfigManager = new FSSObsMonitorConfigurationManager(
currentSite, MonName.snow.name());
List<String> snowStations = snowConfigManager.getStations();
stations.addAll(snowStations);
snowConfigManager = null;
}
return stations;
}

View file

@ -29,10 +29,8 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.raytheon.edex.site.SiteUtil;
import com.raytheon.uf.common.monitor.config.FogMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.MonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.SSMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.SnowMonitorConfigurationManager;
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.INationalDatasetSubscriber;
import com.raytheon.uf.edex.plugin.loctables.util.CommonObsSpatialBuilder;
@ -57,6 +55,7 @@ import com.raytheon.uf.edex.plugin.loctables.util.store.ObStationStoreStrategy;
* ------------ ---------- ----------- --------------------------
* Apr 08, 2010 jkorman Initial creation
* Mar 06, 2014 2876 mpduff New NDM plugin.
* Apr 28, 2014 3086 skorolev Updated setupLocalFiles method
*
* </pre>
*
@ -120,19 +119,13 @@ public class LocationTablesIngest implements INationalDatasetSubscriber {
private void setupLocalFiles() {
String currentSite = SiteUtil.getSite();
List<MonitorConfigurationManager> monitors = new ArrayList<MonitorConfigurationManager>();
monitors.add(FogMonitorConfigurationManager.getInstance());
monitors.add(SSMonitorConfigurationManager.getInstance());
monitors.add(SnowMonitorConfigurationManager.getInstance());
for (MonitorConfigurationManager monitor : monitors) {
try {
monitor.readConfigXml(currentSite);
} catch (Throwable t) {
logger.error("Could not configure "
+ monitor.getClass().getName() + " for site "
+ currentSite, t);
}
}
List<FSSObsMonitorConfigurationManager> monitors = new ArrayList<FSSObsMonitorConfigurationManager>();
monitors.add(FSSObsMonitorConfigurationManager.getInstance(currentSite,
MonName.fog.name()));
monitors.add(FSSObsMonitorConfigurationManager.getInstance(currentSite,
MonName.ss.name()));
monitors.add(FSSObsMonitorConfigurationManager.getInstance(currentSite,
MonName.snow.name()));
}
/**