Omaha #3841 - Corrected dialogs for adding and editing the new zones and stations.
Former-commit-id: 640a7d9e6bfcd25248a36b5babb527cca4baeb7a
This commit is contained in:
parent
567285cfd5
commit
3379aa3316
27 changed files with 820 additions and 520 deletions
|
@ -91,7 +91,7 @@ import com.vividsolutions.jts.geom.Geometry;
|
||||||
* Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea.
|
* Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea.
|
||||||
* Sep 23, 2014 3356 njensen Remove unnecessary import
|
* Sep 23, 2014 3356 njensen Remove unnecessary import
|
||||||
* Mar 09, 2014 3888 dhladky Stopped processing when dialogs are null or disposed.
|
* Mar 09, 2014 3888 dhladky Stopped processing when dialogs are null or disposed.
|
||||||
*
|
* Sep 03, 2015 3841 skorolev Corrected getInstance for FSSObsMonitorConfigurationManager.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -162,7 +162,7 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
|
||||||
*/
|
*/
|
||||||
private FogMonitor() {
|
private FogMonitor() {
|
||||||
pluginPatterns.add(fogPattern);
|
pluginPatterns.add(fogPattern);
|
||||||
fogConfig = new FSSObsMonitorConfigurationManager(MonName.fog.name());
|
fogConfig = FSSObsMonitorConfigurationManager.getInstance(MonName.fog);
|
||||||
updateMonitoringArea();
|
updateMonitoringArea();
|
||||||
initObserver(OBS, this);
|
initObserver(OBS, this);
|
||||||
obData = new ObMultiHrsReports(CommonConfig.AppName.FOG);
|
obData = new ObMultiHrsReports(CommonConfig.AppName.FOG);
|
||||||
|
|
|
@ -42,6 +42,7 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.FogMonitor;
|
||||||
* Feb 03, 2014 #2757 skorolev Fixed reInitialize()
|
* Feb 03, 2014 #2757 skorolev Fixed reInitialize()
|
||||||
* May 20, 2014 3086 skorolev Cleaned code.
|
* May 20, 2014 3086 skorolev Cleaned code.
|
||||||
* Sep 04, 2014 3220 skorolev Removed "site".
|
* Sep 04, 2014 3220 skorolev Removed "site".
|
||||||
|
* Sep 03, 2015 3841 skorolev Corrected getInstance for FSSObsMonitorConfigurationManager.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -61,8 +62,8 @@ public class FogThresholdMgr extends AbstractThresholdMgr {
|
||||||
super("DefaultFogDisplayThresholds.xml",
|
super("DefaultFogDisplayThresholds.xml",
|
||||||
"DefaultFogMonitorThresholds.xml", AppName.FOG.name()
|
"DefaultFogMonitorThresholds.xml", AppName.FOG.name()
|
||||||
.toLowerCase());
|
.toLowerCase());
|
||||||
areaConfigMgr = new FSSObsMonitorConfigurationManager(
|
areaConfigMgr = FSSObsMonitorConfigurationManager
|
||||||
MonName.fog.name());
|
.getInstance(MonName.fog);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,8 +129,8 @@ public class FogThresholdMgr extends AbstractThresholdMgr {
|
||||||
@Override
|
@Override
|
||||||
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
|
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
|
||||||
if (areaConfigMgr == null) {
|
if (areaConfigMgr == null) {
|
||||||
areaConfigMgr = new FSSObsMonitorConfigurationManager(
|
areaConfigMgr = FSSObsMonitorConfigurationManager
|
||||||
MonName.fog.name());
|
.getInstance(MonName.fog);
|
||||||
}
|
}
|
||||||
return areaConfigMgr;
|
return areaConfigMgr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,15 +19,19 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.monitor.fog.ui.dialogs;
|
package com.raytheon.uf.viz.monitor.fog.ui.dialogs;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.localization.exception.LocalizationException;
|
||||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
|
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
|
||||||
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
||||||
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
||||||
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
|
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
|
||||||
|
import com.raytheon.uf.common.serialization.SerializationException;
|
||||||
import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent;
|
import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent;
|
||||||
import com.raytheon.uf.viz.monitor.fog.FogMonitor;
|
import com.raytheon.uf.viz.monitor.fog.FogMonitor;
|
||||||
import com.raytheon.uf.viz.monitor.fog.threshold.FogThresholdMgr;
|
import com.raytheon.uf.viz.monitor.fog.threshold.FogThresholdMgr;
|
||||||
|
@ -51,6 +55,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||||
* Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons.
|
* Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons.
|
||||||
* Oct 27, 2014 3667 skorolev Cleaned code.
|
* Oct 27, 2014 3667 skorolev Cleaned code.
|
||||||
* Feb 10, 2015 3886 skorolev Changed confirmation message.
|
* Feb 10, 2015 3886 skorolev Changed confirmation message.
|
||||||
|
* Aug 17, 2015 3841 skorolev Corrected handleOkBtnSelection.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -80,19 +85,15 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
||||||
* handleOkBtnSelection()
|
* handleOkBtnSelection()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void handleOkBtnSelection() {
|
protected void handleOkBtnSelection() throws LocalizationException,
|
||||||
|
SerializationException, IOException {
|
||||||
if (dataIsChanged()) {
|
if (dataIsChanged()) {
|
||||||
int choice = showMessage(shell, SWT.YES | SWT.NO,
|
int choice = showMessage(shell, SWT.YES | SWT.NO,
|
||||||
"Confirm Cofiguration Changes", "Save changes?");
|
"Fog Monitor Confirm Changes", "Save changes?");
|
||||||
if (choice == SWT.YES) {
|
if (choice == SWT.YES) {
|
||||||
// Save the config xml file.
|
// Save the config xml file.
|
||||||
resetAndSave();
|
saveConfigs();
|
||||||
/**
|
|
||||||
* DR#11279: re-initialize threshold manager and the monitor
|
|
||||||
* using new monitor area configuration
|
|
||||||
*/
|
|
||||||
FogThresholdMgr.reInitialize();
|
FogThresholdMgr.reInitialize();
|
||||||
fireConfigUpdateEvent();
|
|
||||||
// Open Threshold Dialog if zones/stations are added.
|
// Open Threshold Dialog if zones/stations are added.
|
||||||
if ((!configMgr.getAddedZones().isEmpty())
|
if ((!configMgr.getAddedZones().isEmpty())
|
||||||
|| (!configMgr.getAddedStations().isEmpty())) {
|
|| (!configMgr.getAddedStations().isEmpty())) {
|
||||||
|
@ -102,19 +103,19 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
||||||
fogMonitorDlg.setCloseCallback(new ICloseCallback() {
|
fogMonitorDlg.setCloseCallback(new ICloseCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void dialogClosed(Object returnValue) {
|
public void dialogClosed(Object returnValue) {
|
||||||
// Clean added zones and stations. Close dialog.
|
|
||||||
configMgr.getAddedZones().clear();
|
|
||||||
configMgr.getAddedStations().clear();
|
|
||||||
setReturnValue(true);
|
setReturnValue(true);
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
fogMonitorDlg.open();
|
fogMonitorDlg.open();
|
||||||
}
|
}
|
||||||
// Clean added zones and stations.
|
|
||||||
configMgr.getAddedZones().clear();
|
|
||||||
configMgr.getAddedStations().clear();
|
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* DR#11279: re-initialize threshold manager and the monitor
|
||||||
|
* using new monitor area configuration
|
||||||
|
*/
|
||||||
|
fireConfigUpdateEvent();
|
||||||
|
resetStatus();
|
||||||
} else { // Return back to continue edit.
|
} else { // Return back to continue edit.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -150,8 +151,8 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
||||||
@Override
|
@Override
|
||||||
protected FSSObsMonitorConfigurationManager getInstance() {
|
protected FSSObsMonitorConfigurationManager getInstance() {
|
||||||
if (configMgr == null) {
|
if (configMgr == null) {
|
||||||
configMgr = new FSSObsMonitorConfigurationManager(
|
configMgr = FSSObsMonitorConfigurationManager
|
||||||
MonName.fog.name());
|
.getInstance(MonName.fog);
|
||||||
}
|
}
|
||||||
return configMgr;
|
return configMgr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg;
|
||||||
* Dec 7, 2012 1351 skorolev Changes for non-blocking dialogs.
|
* Dec 7, 2012 1351 skorolev Changes for non-blocking dialogs.
|
||||||
* Apr 28, 2014 3086 skorolev Updated getConfigMgr method.
|
* Apr 28, 2014 3086 skorolev Updated getConfigMgr method.
|
||||||
* Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose.
|
* Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose.
|
||||||
|
* Aug 26, 2015 3841 skorolev Corrected getMonitorAreaConfigInstance().
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -219,6 +220,7 @@ public class FogZoneTableDlg extends ZoneTableDlg {
|
||||||
@Override
|
@Override
|
||||||
public void fireDialogShutdown(IMonitorListener iml) {
|
public void fireDialogShutdown(IMonitorListener iml) {
|
||||||
Display.getDefault().asyncExec(new Runnable() {
|
Display.getDefault().asyncExec(new Runnable() {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Iterator<IMonitor> iter = getMonitorControlListeners()
|
Iterator<IMonitor> iter = getMonitorControlListeners()
|
||||||
.iterator();
|
.iterator();
|
||||||
|
@ -239,6 +241,7 @@ public class FogZoneTableDlg extends ZoneTableDlg {
|
||||||
@Override
|
@Override
|
||||||
public void fireKillMonitor() {
|
public void fireKillMonitor() {
|
||||||
Display.getDefault().asyncExec(new Runnable() {
|
Display.getDefault().asyncExec(new Runnable() {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Iterator<IMonitor> iter = getMonitorControlListeners()
|
Iterator<IMonitor> iter = getMonitorControlListeners()
|
||||||
.iterator();
|
.iterator();
|
||||||
|
@ -304,8 +307,9 @@ public class FogZoneTableDlg extends ZoneTableDlg {
|
||||||
@Override
|
@Override
|
||||||
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
|
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
|
||||||
if (configMgr == null || configMgr.isPopulated()) {
|
if (configMgr == null || configMgr.isPopulated()) {
|
||||||
configMgr = new FSSObsMonitorConfigurationManager(
|
configMgr = FSSObsMonitorConfigurationManager
|
||||||
MonName.fog.name());
|
.getInstance(MonName.fog);
|
||||||
|
configMgr.setPopulated(false);
|
||||||
}
|
}
|
||||||
return configMgr;
|
return configMgr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,7 @@ import com.vividsolutions.jts.geom.Geometry;
|
||||||
* Feb 15, 2013 1638 mschenke Changed code to reference DataURI.SEPARATOR instead of URIFilter
|
* Feb 15, 2013 1638 mschenke Changed code to reference DataURI.SEPARATOR instead of URIFilter
|
||||||
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
|
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
|
||||||
* Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea.
|
* Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea.
|
||||||
|
* Sep 03, 2015 3841 skorolev Corrected getInstance for FSSObsMonitorConfigurationManager.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -161,7 +162,8 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
|
||||||
*/
|
*/
|
||||||
private SafeSeasMonitor() {
|
private SafeSeasMonitor() {
|
||||||
pluginPatterns.add(ssPattern);
|
pluginPatterns.add(ssPattern);
|
||||||
ssAreaConfig = new FSSObsMonitorConfigurationManager(MonName.ss.name());
|
ssAreaConfig = FSSObsMonitorConfigurationManager
|
||||||
|
.getInstance(MonName.ss);
|
||||||
updateMonitoringArea();
|
updateMonitoringArea();
|
||||||
initObserver(OBS, this);
|
initObserver(OBS, this);
|
||||||
obData = new ObMultiHrsReports(CommonConfig.AppName.SAFESEAS);
|
obData = new ObMultiHrsReports(CommonConfig.AppName.SAFESEAS);
|
||||||
|
|
|
@ -42,6 +42,7 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SafeSeasMonitor;
|
||||||
* Feb 03, 2014 #2757 skorolev Fixed reInitialize().
|
* Feb 03, 2014 #2757 skorolev Fixed reInitialize().
|
||||||
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
|
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
|
||||||
* Sep 04, 2014 3220 skorolev Removed "site".
|
* Sep 04, 2014 3220 skorolev Removed "site".
|
||||||
|
* Sep 03, 2015 3841 skorolev Corrected getInstance for FSSObsMonitorConfigurationManager.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -59,7 +60,8 @@ public class SSThresholdMgr extends AbstractThresholdMgr {
|
||||||
super("DefaultSSDisplayThresholds.xml",
|
super("DefaultSSDisplayThresholds.xml",
|
||||||
"DefaultSSMonitorThresholds.xml", AppName.SAFESEAS.name()
|
"DefaultSSMonitorThresholds.xml", AppName.SAFESEAS.name()
|
||||||
.toLowerCase());
|
.toLowerCase());
|
||||||
areaConfigMgr = new FSSObsMonitorConfigurationManager(MonName.ss.name());
|
areaConfigMgr = FSSObsMonitorConfigurationManager
|
||||||
|
.getInstance(MonName.ss);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,8 +125,8 @@ public class SSThresholdMgr extends AbstractThresholdMgr {
|
||||||
@Override
|
@Override
|
||||||
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
|
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
|
||||||
if (areaConfigMgr == null) {
|
if (areaConfigMgr == null) {
|
||||||
areaConfigMgr = new FSSObsMonitorConfigurationManager(
|
areaConfigMgr = FSSObsMonitorConfigurationManager
|
||||||
MonName.ss.name());
|
.getInstance(MonName.ss);
|
||||||
}
|
}
|
||||||
return areaConfigMgr;
|
return areaConfigMgr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,15 +19,19 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.monitor.safeseas.ui.dialogs;
|
package com.raytheon.uf.viz.monitor.safeseas.ui.dialogs;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.localization.exception.LocalizationException;
|
||||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
|
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
|
||||||
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
||||||
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
||||||
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
|
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
|
||||||
|
import com.raytheon.uf.common.serialization.SerializationException;
|
||||||
import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent;
|
import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent;
|
||||||
import com.raytheon.uf.viz.monitor.safeseas.SafeSeasMonitor;
|
import com.raytheon.uf.viz.monitor.safeseas.SafeSeasMonitor;
|
||||||
import com.raytheon.uf.viz.monitor.safeseas.threshold.SSThresholdMgr;
|
import com.raytheon.uf.viz.monitor.safeseas.threshold.SSThresholdMgr;
|
||||||
|
@ -50,7 +54,8 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||||
* Sep 04, 2014 3220 skorolev Added fireConfigUpdateEvent method. Updated handler.
|
* Sep 04, 2014 3220 skorolev Added fireConfigUpdateEvent method. Updated handler.
|
||||||
* Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons.
|
* Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons.
|
||||||
* Oct 27, 2014 3667 skorolev Cleaned code.
|
* Oct 27, 2014 3667 skorolev Cleaned code.
|
||||||
* Feb 10, 2015 3886 skorolev Changed confirmation message.
|
* Feb 10, 2015 3886 skorolev Changed confirmation message.
|
||||||
|
* Aug 17, 2015 3841 skorolev Corrected handleOkBtnSelection.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
|
@ -75,18 +80,18 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handleOkBtnSelection() {
|
protected void handleOkBtnSelection() throws LocalizationException,
|
||||||
|
SerializationException, IOException {
|
||||||
if (dataIsChanged()) {
|
if (dataIsChanged()) {
|
||||||
int choice = showMessage(shell, SWT.YES | SWT.NO,
|
int choice = showMessage(shell, SWT.YES | SWT.NO,
|
||||||
"Confirm Cofiguration Changes", "Save changes?");
|
"SAFESEAS Monitor Confirm Changes", "Save changes?");
|
||||||
if (choice == SWT.YES) {
|
if (choice == SWT.YES) {
|
||||||
// Save the config xml file.
|
// Save the config xml file.
|
||||||
resetAndSave();
|
saveConfigs();
|
||||||
SSThresholdMgr.reInitialize();
|
SSThresholdMgr.reInitialize();
|
||||||
fireConfigUpdateEvent();
|
|
||||||
// Open Threshold Dialog if zones/stations are added.
|
|
||||||
if ((!configMgr.getAddedZones().isEmpty())
|
if ((!configMgr.getAddedZones().isEmpty())
|
||||||
|| (!configMgr.getAddedStations().isEmpty())) {
|
|| (!configMgr.getAddedStations().isEmpty())) {
|
||||||
|
// Open Threshold Dialog if zones/stations are added.
|
||||||
if (editDialog() == SWT.YES) {
|
if (editDialog() == SWT.YES) {
|
||||||
ssMonitorDlg = new SSDispMonThreshDlg(shell,
|
ssMonitorDlg = new SSDispMonThreshDlg(shell,
|
||||||
CommonConfig.AppName.SAFESEAS,
|
CommonConfig.AppName.SAFESEAS,
|
||||||
|
@ -94,19 +99,15 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
||||||
ssMonitorDlg.setCloseCallback(new ICloseCallback() {
|
ssMonitorDlg.setCloseCallback(new ICloseCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void dialogClosed(Object returnValue) {
|
public void dialogClosed(Object returnValue) {
|
||||||
// Clean added zones and stations. Close dialog.
|
|
||||||
configMgr.getAddedZones().clear();
|
|
||||||
configMgr.getAddedStations().clear();
|
|
||||||
setReturnValue(true);
|
setReturnValue(true);
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ssMonitorDlg.open();
|
ssMonitorDlg.open();
|
||||||
}
|
}
|
||||||
// Clean added zones and stations.
|
|
||||||
configMgr.getAddedZones().clear();
|
|
||||||
configMgr.getAddedStations().clear();
|
|
||||||
}
|
}
|
||||||
|
fireConfigUpdateEvent();
|
||||||
|
resetStatus();
|
||||||
} else { // Return back to continue edit.
|
} else { // Return back to continue edit.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -142,7 +143,8 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
||||||
@Override
|
@Override
|
||||||
public FSSObsMonitorConfigurationManager getInstance() {
|
public FSSObsMonitorConfigurationManager getInstance() {
|
||||||
if (configMgr == null) {
|
if (configMgr == null) {
|
||||||
configMgr = new FSSObsMonitorConfigurationManager(MonName.ss.name());
|
configMgr = FSSObsMonitorConfigurationManager
|
||||||
|
.getInstance(MonName.ss);
|
||||||
}
|
}
|
||||||
return configMgr;
|
return configMgr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,7 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
|
||||||
* Dec 7, 2012 #1351 skorolev Changes for non-blocking dialogs.
|
* Dec 7, 2012 #1351 skorolev Changes for non-blocking dialogs.
|
||||||
* Apr 28, 2014 3086 skorolev Updated getConfigMgr method.
|
* Apr 28, 2014 3086 skorolev Updated getConfigMgr method.
|
||||||
* Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose.
|
* Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose.
|
||||||
|
* Aug 26, 2015 3841 skorolev Corrected getMonitorAreaConfigInstance().
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -70,7 +71,8 @@ public class SSZoneTableDlg extends ZoneTableDlg {
|
||||||
private SSDispMonThreshDlg ssThreshDlg;
|
private SSDispMonThreshDlg ssThreshDlg;
|
||||||
|
|
||||||
/** Swell column names in the zone and station table. **/
|
/** Swell column names in the zone and station table. **/
|
||||||
private String[] ssSwellCols = { "SSZT_SwellPeriod", "SSZT_Swell2Period" };
|
private final String[] ssSwellCols = { "SSZT_SwellPeriod",
|
||||||
|
"SSZT_Swell2Period" };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor (Dec 30, 2009, zhao)
|
* Constructor (Dec 30, 2009, zhao)
|
||||||
|
@ -329,7 +331,9 @@ public class SSZoneTableDlg extends ZoneTableDlg {
|
||||||
@Override
|
@Override
|
||||||
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
|
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
|
||||||
if (configMgr == null || configMgr.isPopulated()) {
|
if (configMgr == null || configMgr.isPopulated()) {
|
||||||
configMgr = new FSSObsMonitorConfigurationManager(MonName.ss.name());
|
configMgr = FSSObsMonitorConfigurationManager
|
||||||
|
.getInstance(MonName.ss);
|
||||||
|
configMgr.setPopulated(false);
|
||||||
}
|
}
|
||||||
return configMgr;
|
return configMgr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||||
* Feb 15, 2013 1638 mschenke Changed code to reference DataURI.SEPARATOR instead of URIFilter
|
* Feb 15, 2013 1638 mschenke Changed code to reference DataURI.SEPARATOR instead of URIFilter
|
||||||
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
|
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
|
||||||
* Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea.
|
* Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea.
|
||||||
|
* Sep 03, 2015 3841 skorolev Corrected getInstance for FSSObsMonitorConfigurationManager.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -103,7 +104,7 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
|
||||||
* This object contains all observation data necessary for the table dialogs
|
* This object contains all observation data necessary for the table dialogs
|
||||||
* and trending plots
|
* and trending plots
|
||||||
*/
|
*/
|
||||||
private ObMultiHrsReports obData;
|
private final ObMultiHrsReports obData;
|
||||||
|
|
||||||
/** All SNOW datauri start with this */
|
/** All SNOW datauri start with this */
|
||||||
private final String OBS = "fssobs";
|
private final String OBS = "fssobs";
|
||||||
|
@ -128,7 +129,8 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
|
||||||
*/
|
*/
|
||||||
private SnowMonitor() {
|
private SnowMonitor() {
|
||||||
pluginPatterns.add(snowPattern);
|
pluginPatterns.add(snowPattern);
|
||||||
snowConfig = new FSSObsMonitorConfigurationManager(MonName.snow.name());
|
snowConfig = FSSObsMonitorConfigurationManager
|
||||||
|
.getInstance(MonName.snow);
|
||||||
updateMonitoringArea();
|
updateMonitoringArea();
|
||||||
initObserver(OBS, this);
|
initObserver(OBS, this);
|
||||||
obData = new ObMultiHrsReports(CommonConfig.AppName.SNOW);
|
obData = new ObMultiHrsReports(CommonConfig.AppName.SNOW);
|
||||||
|
@ -382,6 +384,7 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
|
||||||
*
|
*
|
||||||
* @param dialogTime
|
* @param dialogTime
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void updateDialogTime(Date dialogTime) {
|
public void updateDialogTime(Date dialogTime) {
|
||||||
this.dialogTime = dialogTime;
|
this.dialogTime = dialogTime;
|
||||||
fireMonitorEvent(this);
|
fireMonitorEvent(this);
|
||||||
|
|
|
@ -42,6 +42,7 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SnowMonitor;
|
||||||
* Feb 03, 2014 #2757 skorolev Fixed reInitialize()
|
* Feb 03, 2014 #2757 skorolev Fixed reInitialize()
|
||||||
* May 21, 2014 3086 skorolev Cleaned code.
|
* May 21, 2014 3086 skorolev Cleaned code.
|
||||||
* Sep 04, 2014 3220 skorolev Removed "site".
|
* Sep 04, 2014 3220 skorolev Removed "site".
|
||||||
|
* Sep 03, 2015 3841 skorolev Corrected getInstance for FSSObsMonitorConfigurationManager.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -59,8 +60,8 @@ public class SnowThresholdMgr extends AbstractThresholdMgr {
|
||||||
"DefaultSnowMonitorThresholds.xml", AppName.SNOW.name()
|
"DefaultSnowMonitorThresholds.xml", AppName.SNOW.name()
|
||||||
.toLowerCase());
|
.toLowerCase());
|
||||||
|
|
||||||
areaConfigMgr = new FSSObsMonitorConfigurationManager(
|
areaConfigMgr = FSSObsMonitorConfigurationManager
|
||||||
MonName.snow.name());
|
.getInstance(MonName.snow);
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,8 +125,8 @@ public class SnowThresholdMgr extends AbstractThresholdMgr {
|
||||||
@Override
|
@Override
|
||||||
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
|
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
|
||||||
if (areaConfigMgr == null) {
|
if (areaConfigMgr == null) {
|
||||||
areaConfigMgr = new FSSObsMonitorConfigurationManager(
|
areaConfigMgr = FSSObsMonitorConfigurationManager
|
||||||
MonName.snow.name());
|
.getInstance(MonName.snow);
|
||||||
}
|
}
|
||||||
return areaConfigMgr;
|
return areaConfigMgr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,15 +19,19 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.monitor.snow.ui.dialogs;
|
package com.raytheon.uf.viz.monitor.snow.ui.dialogs;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.localization.exception.LocalizationException;
|
||||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
|
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
|
||||||
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
||||||
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
||||||
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
|
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
|
||||||
|
import com.raytheon.uf.common.serialization.SerializationException;
|
||||||
import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent;
|
import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent;
|
||||||
import com.raytheon.uf.viz.monitor.snow.SnowMonitor;
|
import com.raytheon.uf.viz.monitor.snow.SnowMonitor;
|
||||||
import com.raytheon.uf.viz.monitor.snow.threshold.SnowThresholdMgr;
|
import com.raytheon.uf.viz.monitor.snow.threshold.SnowThresholdMgr;
|
||||||
|
@ -51,6 +55,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||||
* Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons.
|
* Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons.
|
||||||
* Oct 27, 2014 3667 skorolev Cleaned code.
|
* Oct 27, 2014 3667 skorolev Cleaned code.
|
||||||
* Feb 10, 2015 3886 skorolev Changed confirmation message.
|
* Feb 10, 2015 3886 skorolev Changed confirmation message.
|
||||||
|
* Aug 17, 2015 3841 skorolev Corrected handleOkBtnSelection.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author mpduff
|
* @author mpduff
|
||||||
|
@ -79,15 +84,15 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
||||||
* handleApplyBtnSelection()
|
* handleApplyBtnSelection()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void handleOkBtnSelection() {
|
protected void handleOkBtnSelection() throws LocalizationException,
|
||||||
|
SerializationException, IOException {
|
||||||
if (dataIsChanged()) {
|
if (dataIsChanged()) {
|
||||||
int choice = showMessage(shell, SWT.YES | SWT.NO,
|
int choice = showMessage(shell, SWT.YES | SWT.NO,
|
||||||
"Confirm Cofiguration Changes", "Save changes?");
|
"SNOW Monitor Confirm Changes", "Save changes?");
|
||||||
if (choice == SWT.YES) {
|
if (choice == SWT.YES) {
|
||||||
// Save the config xml file.
|
// Save the config xml file.
|
||||||
resetAndSave();
|
saveConfigs();
|
||||||
SnowThresholdMgr.reInitialize();
|
SnowThresholdMgr.reInitialize();
|
||||||
fireConfigUpdateEvent();
|
|
||||||
// Open Threshold Dialog if zones/stations are added.
|
// Open Threshold Dialog if zones/stations are added.
|
||||||
if ((!configMgr.getAddedZones().isEmpty())
|
if ((!configMgr.getAddedZones().isEmpty())
|
||||||
|| (!configMgr.getAddedStations().isEmpty())) {
|
|| (!configMgr.getAddedStations().isEmpty())) {
|
||||||
|
@ -102,19 +107,15 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dialogClosed(Object returnValue) {
|
public void dialogClosed(Object returnValue) {
|
||||||
// Clean added zones and stations. Close dialog.
|
|
||||||
configMgr.getAddedZones().clear();
|
|
||||||
configMgr.getAddedStations().clear();
|
|
||||||
setReturnValue(true);
|
setReturnValue(true);
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
snowMonitorDlg.open();
|
snowMonitorDlg.open();
|
||||||
}
|
}
|
||||||
// Clean added zones and stations.
|
|
||||||
configMgr.getAddedZones().clear();
|
|
||||||
configMgr.getAddedStations().clear();
|
|
||||||
}
|
}
|
||||||
|
fireConfigUpdateEvent();
|
||||||
|
resetStatus();
|
||||||
} else { // Return back to continue edit.
|
} else { // Return back to continue edit.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -135,8 +136,8 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
||||||
@Override
|
@Override
|
||||||
protected FSSObsMonitorConfigurationManager getInstance() {
|
protected FSSObsMonitorConfigurationManager getInstance() {
|
||||||
if (configMgr == null) {
|
if (configMgr == null) {
|
||||||
configMgr = new FSSObsMonitorConfigurationManager(
|
configMgr = FSSObsMonitorConfigurationManager
|
||||||
MonName.snow.name());
|
.getInstance(MonName.snow);
|
||||||
}
|
}
|
||||||
return configMgr;
|
return configMgr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg;
|
||||||
* Dec 7, 2012 1351 skorolev Changes for non-blocking dialogs
|
* Dec 7, 2012 1351 skorolev Changes for non-blocking dialogs
|
||||||
* Apr 28, 2014 3086 skorolev Updated getConfigMgr method.
|
* Apr 28, 2014 3086 skorolev Updated getConfigMgr method.
|
||||||
* Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose.
|
* Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose.
|
||||||
|
* Aug 26, 2015 3841 skorolev Corrected getMonitorAreaConfigInstance().
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -265,8 +266,9 @@ public class SnowZoneTableDlg extends ZoneTableDlg {
|
||||||
@Override
|
@Override
|
||||||
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
|
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
|
||||||
if (configMgr == null || configMgr.isPopulated()) {
|
if (configMgr == null || configMgr.isPopulated()) {
|
||||||
configMgr = new FSSObsMonitorConfigurationManager(
|
configMgr = FSSObsMonitorConfigurationManager
|
||||||
MonName.snow.name());
|
.getInstance(MonName.snow);
|
||||||
|
configMgr.setPopulated(false);
|
||||||
}
|
}
|
||||||
return configMgr;
|
return configMgr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@ import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
|
||||||
* Oct.31 2012 1297 skorolev Cleaned code.
|
* Oct.31 2012 1297 skorolev Cleaned code.
|
||||||
* Sep 04 2014 3220 skorolev Added updateZones method.
|
* Sep 04 2014 3220 skorolev Added updateZones method.
|
||||||
* Mar 17 2015 3888 dhladky check for nulls
|
* Mar 17 2015 3888 dhladky check for nulls
|
||||||
|
* Sep 03, 2015 3841 skorolev Made final appName, hourReports and thresholdMgr.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -61,19 +62,19 @@ public class ObHourReports {
|
||||||
/**
|
/**
|
||||||
* the nominal time of this ObHourReports object
|
* the nominal time of this ObHourReports object
|
||||||
*/
|
*/
|
||||||
private Date nominalTime;
|
private final Date nominalTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* application name (SNOW, FOG, SAFESEAS)
|
* application name (SNOW, FOG, SAFESEAS)
|
||||||
*/
|
*/
|
||||||
private CommonConfig.AppName appName;
|
private final CommonConfig.AppName appName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* key is zone id, value is ObZoneHourReports object
|
* key is zone id, value is ObZoneHourReports object
|
||||||
*/
|
*/
|
||||||
private Map<String, ObZoneHourReports> hourReports;
|
private final Map<String, ObZoneHourReports> hourReports;
|
||||||
|
|
||||||
private AbstractThresholdMgr thresholdMgr;
|
private final AbstractThresholdMgr thresholdMgr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* constructor
|
* constructor
|
||||||
|
|
|
@ -25,10 +25,13 @@ import java.util.Date;
|
||||||
import com.raytheon.uf.common.geospatial.ISpatialQuery;
|
import com.raytheon.uf.common.geospatial.ISpatialQuery;
|
||||||
import com.raytheon.uf.common.geospatial.SpatialQueryFactory;
|
import com.raytheon.uf.common.geospatial.SpatialQueryFactory;
|
||||||
import com.raytheon.uf.common.monitor.MonitorAreaUtils;
|
import com.raytheon.uf.common.monitor.MonitorAreaUtils;
|
||||||
|
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||||
|
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
|
||||||
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
||||||
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
||||||
import com.raytheon.uf.common.monitor.data.ObConst;
|
import com.raytheon.uf.common.monitor.data.ObConst;
|
||||||
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
|
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
|
||||||
|
import com.raytheon.uf.common.monitor.xml.AreaIdXML;
|
||||||
import com.raytheon.uf.viz.monitor.config.CommonTableConfig;
|
import com.raytheon.uf.viz.monitor.config.CommonTableConfig;
|
||||||
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType;
|
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType;
|
||||||
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.ObsHistType;
|
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.ObsHistType;
|
||||||
|
@ -50,6 +53,7 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
|
||||||
* May 23, 2012 14410 zhao Modified getCellTypeForBlizWarn and getCellTypeForHsnowWarn modules
|
* May 23, 2012 14410 zhao Modified getCellTypeForBlizWarn and getCellTypeForHsnowWarn modules
|
||||||
* Feb 28, 2013 14410 zhao Modified getCellTypeForBlizWarn
|
* Feb 28, 2013 14410 zhao Modified getCellTypeForBlizWarn
|
||||||
* May 23, 2014 3086 skorolev Corrected ObsHistType. Cleaned code.
|
* May 23, 2014 3086 skorolev Corrected ObsHistType. Cleaned code.
|
||||||
|
* Aug 17, 2015 3841 skorolev Added coordinates in the hover text for a newly added zones.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -112,7 +116,11 @@ public final class TableUtil {
|
||||||
|
|
||||||
String hoverText = null;
|
String hoverText = null;
|
||||||
if (isZone) {
|
if (isZone) {
|
||||||
hoverText = getZoneHoverText(areaId);
|
AreaIdXML zoneXML = FSSObsMonitorConfigurationManager
|
||||||
|
.getObsManager(MonName.fog).getAreaXml(zone);
|
||||||
|
if (zoneXML != null) {
|
||||||
|
hoverText = getZoneHoverText(zoneXML);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
hoverText = getStationHoverText(areaId);
|
hoverText = getStationHoverText(areaId);
|
||||||
}
|
}
|
||||||
|
@ -320,7 +328,8 @@ public final class TableUtil {
|
||||||
* dialog)
|
* dialog)
|
||||||
* @param zone
|
* @param zone
|
||||||
* @param report
|
* @param report
|
||||||
* @param tm Abstract Threshold Manager
|
* @param tm
|
||||||
|
* Abstract Threshold Manager
|
||||||
* @param fogCellType
|
* @param fogCellType
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -338,7 +347,11 @@ public final class TableUtil {
|
||||||
|
|
||||||
String hoverText = null;
|
String hoverText = null;
|
||||||
if (isZone) {
|
if (isZone) {
|
||||||
hoverText = getZoneHoverText(areaId);
|
AreaIdXML zoneXML = FSSObsMonitorConfigurationManager
|
||||||
|
.getObsManager(MonName.ss).getAreaXml(zone);
|
||||||
|
if (zoneXML != null) {
|
||||||
|
hoverText = getZoneHoverText(zoneXML);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
hoverText = getStationHoverText(areaId);
|
hoverText = getStationHoverText(areaId);
|
||||||
}
|
}
|
||||||
|
@ -639,7 +652,11 @@ public final class TableUtil {
|
||||||
|
|
||||||
String hoverText = null;
|
String hoverText = null;
|
||||||
if (isZone) {
|
if (isZone) {
|
||||||
hoverText = getZoneHoverText(areaId);
|
AreaIdXML zoneXML = FSSObsMonitorConfigurationManager
|
||||||
|
.getObsManager(MonName.snow).getAreaXml(zone);
|
||||||
|
if (zoneXML != null) {
|
||||||
|
hoverText = getZoneHoverText(zoneXML);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
hoverText = getStationHoverText(areaId);
|
hoverText = getStationHoverText(areaId);
|
||||||
}
|
}
|
||||||
|
@ -881,11 +898,12 @@ public final class TableUtil {
|
||||||
/**
|
/**
|
||||||
* Gets Zone Hover Text.
|
* Gets Zone Hover Text.
|
||||||
*
|
*
|
||||||
* @param zone
|
* @param zoneXML
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private static String getZoneHoverText(String zone) {
|
private static String getZoneHoverText(AreaIdXML zoneXML) {
|
||||||
|
|
||||||
|
String zone = zoneXML.getAreaId();
|
||||||
ISpatialQuery sq = null;
|
ISpatialQuery sq = null;
|
||||||
String sql = null;
|
String sql = null;
|
||||||
String hoverText = zone.substring(0, 2) + ", ";
|
String hoverText = zone.substring(0, 2) + ", ";
|
||||||
|
@ -908,11 +926,13 @@ public final class TableUtil {
|
||||||
sq = SpatialQueryFactory.create();
|
sq = SpatialQueryFactory.create();
|
||||||
Object[] results = sq.dbRequest(sql, "maps");
|
Object[] results = sq.dbRequest(sql, "maps");
|
||||||
if (results.length > 0) {
|
if (results.length > 0) {
|
||||||
if (results[0] instanceof Object[]) {
|
if (results[0] instanceof String) {
|
||||||
Object[] res = (Object[]) results[0];
|
hoverText += (String) results[0];
|
||||||
hoverText += (String) res[0];
|
}
|
||||||
} else {
|
} else {
|
||||||
hoverText += (String) results[0].toString();
|
if (zoneXML.getCLat() != null) {
|
||||||
|
hoverText += "(" + zoneXML.getCLat() + ", "
|
||||||
|
+ zoneXML.getCLon() + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -976,7 +996,7 @@ public final class TableUtil {
|
||||||
*/
|
*/
|
||||||
public static CellType getCellTypeForSCA(String zone, ObReport report,
|
public static CellType getCellTypeForSCA(String zone, ObReport report,
|
||||||
AbstractThresholdMgr tm) {
|
AbstractThresholdMgr tm) {
|
||||||
// TODO:
|
|
||||||
float windSpd = report.getWindSpeed();
|
float windSpd = report.getWindSpeed();
|
||||||
float windGust = report.getWindGust();
|
float windGust = report.getWindGust();
|
||||||
float waveHgt = report.getHighResWaveHeight();
|
float waveHgt = report.getHighResWaveHeight();
|
||||||
|
@ -1027,7 +1047,7 @@ public final class TableUtil {
|
||||||
*/
|
*/
|
||||||
public static CellType getCellTypeForGaleWarn(String zone, ObReport report,
|
public static CellType getCellTypeForGaleWarn(String zone, ObReport report,
|
||||||
AbstractThresholdMgr tm) {
|
AbstractThresholdMgr tm) {
|
||||||
// TODO:
|
|
||||||
CellType type = CellType.NotAvailable;
|
CellType type = CellType.NotAvailable;
|
||||||
CellType windSpeedType = tm
|
CellType windSpeedType = tm
|
||||||
.getThresholdValueCellType(
|
.getThresholdValueCellType(
|
||||||
|
@ -1064,7 +1084,7 @@ public final class TableUtil {
|
||||||
*/
|
*/
|
||||||
public static CellType getCellTypeForStormWarn(String zone,
|
public static CellType getCellTypeForStormWarn(String zone,
|
||||||
ObReport report, AbstractThresholdMgr tm) {
|
ObReport report, AbstractThresholdMgr tm) {
|
||||||
// TODO:
|
|
||||||
CellType type = CellType.NotAvailable;
|
CellType type = CellType.NotAvailable;
|
||||||
CellType windSpeedType = tm
|
CellType windSpeedType = tm
|
||||||
.getThresholdValueCellType(
|
.getThresholdValueCellType(
|
||||||
|
@ -1101,7 +1121,7 @@ public final class TableUtil {
|
||||||
*/
|
*/
|
||||||
public static CellType getCellTypeForHFWW(String zone, ObReport report,
|
public static CellType getCellTypeForHFWW(String zone, ObReport report,
|
||||||
AbstractThresholdMgr tm) {
|
AbstractThresholdMgr tm) {
|
||||||
// TODO:
|
|
||||||
CellType type = CellType.NotAvailable;
|
CellType type = CellType.NotAvailable;
|
||||||
CellType windSpeedType = tm
|
CellType windSpeedType = tm
|
||||||
.getThresholdValueCellType(
|
.getThresholdValueCellType(
|
||||||
|
@ -1138,7 +1158,7 @@ public final class TableUtil {
|
||||||
*/
|
*/
|
||||||
public static CellType getCellTypeForFog(String zone, ObReport report,
|
public static CellType getCellTypeForFog(String zone, ObReport report,
|
||||||
AbstractThresholdMgr tm) {
|
AbstractThresholdMgr tm) {
|
||||||
// TODO:
|
|
||||||
float visValue = report.getVisibility();// in miles
|
float visValue = report.getVisibility();// in miles
|
||||||
if (visValue == ObConst.MISSING) {
|
if (visValue == ObConst.MISSING) {
|
||||||
return CellType.NotAvailable;
|
return CellType.NotAvailable;
|
||||||
|
|
16
cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ui/dialogs/AddNewStationDlg.java
Normal file → Executable file
16
cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ui/dialogs/AddNewStationDlg.java
Normal file → Executable file
|
@ -34,6 +34,7 @@ import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
import com.raytheon.uf.common.geospatial.ISpatialQuery;
|
import com.raytheon.uf.common.geospatial.ISpatialQuery;
|
||||||
import com.raytheon.uf.common.geospatial.SpatialQueryFactory;
|
import com.raytheon.uf.common.geospatial.SpatialQueryFactory;
|
||||||
|
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||||
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
||||||
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
||||||
import com.raytheon.uf.common.monitor.xml.StationIdXML;
|
import com.raytheon.uf.common.monitor.xml.StationIdXML;
|
||||||
|
@ -56,6 +57,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
* Nov 20, 2012 1297 skorolev Changes for non-blocking dialog.
|
* 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.
|
* Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
|
||||||
|
* Aug 17, 2015 3841 skorolev Corrected handleAddNewStation method.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -67,7 +69,7 @@ public class AddNewStationDlg extends CaveSWTDialog {
|
||||||
.getHandler(AddNewStationDlg.class);
|
.getHandler(AddNewStationDlg.class);
|
||||||
|
|
||||||
/** Application name. */
|
/** Application name. */
|
||||||
private AppName appName;
|
private final AppName appName;
|
||||||
|
|
||||||
/** METAR radio button. */
|
/** METAR radio button. */
|
||||||
private Button metarRdo;
|
private Button metarRdo;
|
||||||
|
@ -85,10 +87,12 @@ public class AddNewStationDlg extends CaveSWTDialog {
|
||||||
private Text stationTF;
|
private Text stationTF;
|
||||||
|
|
||||||
/** Zone */
|
/** Zone */
|
||||||
private String area;
|
private final String area;
|
||||||
|
|
||||||
/** Call back interface */
|
/** Call back interface */
|
||||||
private MonitoringAreaConfigDlg macDlg;
|
private final MonitoringAreaConfigDlg macDlg;
|
||||||
|
|
||||||
|
private final FSSObsMonitorConfigurationManager cfgMgr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
@ -106,6 +110,7 @@ public class AddNewStationDlg extends CaveSWTDialog {
|
||||||
this.appName = appName;
|
this.appName = appName;
|
||||||
this.area = area;
|
this.area = area;
|
||||||
this.macDlg = macDlg;
|
this.macDlg = macDlg;
|
||||||
|
cfgMgr = macDlg.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -260,9 +265,10 @@ public class AddNewStationDlg extends CaveSWTDialog {
|
||||||
+ "' is already in your Monitoring Area or among your Additional Stations.");
|
+ "' is already in your Monitoring Area or among your Additional Stations.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
macDlg.addNewStationAction(stn);
|
macDlg.addNewStationAction(stn);
|
||||||
macDlg.getInstance().addStation(area, stn, type, false);
|
cfgMgr.addNewStation(area, stn, type, true);
|
||||||
macDlg.getInstance().getStations().add(stn);
|
cfgMgr.getStations().add(stn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
95
cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ui/dialogs/AddNewZoneDlg.java
Normal file → Executable file
95
cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ui/dialogs/AddNewZoneDlg.java
Normal file → Executable file
|
@ -28,7 +28,6 @@ import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Layout;
|
import org.eclipse.swt.widgets.Layout;
|
||||||
import org.eclipse.swt.widgets.MessageBox;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
|
@ -50,6 +49,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
* Apr 23, 2014 3054 skorolev Deleted unnecessary parameter in addArea method.
|
* Apr 23, 2014 3054 skorolev Deleted unnecessary parameter in addArea method.
|
||||||
* Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
|
* Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
|
||||||
* Feb 10, 2015 3886 skorolev Added fixed width for dialog.
|
* Feb 10, 2015 3886 skorolev Added fixed width for dialog.
|
||||||
|
* Aug 17, 2015 3841 skorolev Corrected handleAddNewAction method.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -59,7 +59,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
public class AddNewZoneDlg extends CaveSWTDialog {
|
public class AddNewZoneDlg extends CaveSWTDialog {
|
||||||
|
|
||||||
/** Application name. */
|
/** Application name. */
|
||||||
private AppName appName;
|
private final AppName appName;
|
||||||
|
|
||||||
/** Marine zone radio button. */
|
/** Marine zone radio button. */
|
||||||
private Button marineZoneRdo;
|
private Button marineZoneRdo;
|
||||||
|
@ -77,7 +77,7 @@ public class AddNewZoneDlg extends CaveSWTDialog {
|
||||||
private Text centroidLonTF;
|
private Text centroidLonTF;
|
||||||
|
|
||||||
/** Monitoring Area Configuration Dialog. */
|
/** Monitoring Area Configuration Dialog. */
|
||||||
private MonitoringAreaConfigDlg macDlg;
|
private final MonitoringAreaConfigDlg macDlg;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
@ -144,13 +144,15 @@ public class AddNewZoneDlg extends CaveSWTDialog {
|
||||||
/*
|
/*
|
||||||
* Add the radio controls.
|
* Add the radio controls.
|
||||||
*/
|
*/
|
||||||
Composite radioComp = new Composite(topComp, SWT.NONE);
|
if (appName != AppName.SNOW) {
|
||||||
radioComp.setLayout(new GridLayout(1, false));
|
Composite radioComp = new Composite(topComp, SWT.NONE);
|
||||||
marineZoneRdo = new Button(radioComp, SWT.RADIO);
|
radioComp.setLayout(new GridLayout(1, false));
|
||||||
marineZoneRdo.setText("Marine Zone");
|
marineZoneRdo = new Button(radioComp, SWT.RADIO);
|
||||||
marineZoneRdo.setSelection(true);
|
marineZoneRdo.setText("Marine Zone");
|
||||||
countyRdo = new Button(radioComp, SWT.RADIO);
|
marineZoneRdo.setSelection(true);
|
||||||
countyRdo.setText("County");
|
countyRdo = new Button(radioComp, SWT.RADIO);
|
||||||
|
countyRdo.setText("County");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -236,9 +238,13 @@ public class AddNewZoneDlg extends CaveSWTDialog {
|
||||||
addBtn.addSelectionListener(new SelectionAdapter() {
|
addBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent event) {
|
public void widgetSelected(SelectionEvent event) {
|
||||||
|
String areaId = idTF.getText().toUpperCase();
|
||||||
|
idTF.setText(areaId);
|
||||||
String latString = centroidLatTF.getText();
|
String latString = centroidLatTF.getText();
|
||||||
String lonString = centroidLonTF.getText();
|
String lonString = centroidLonTF.getText();
|
||||||
handleAddNewAction(latString, lonString);
|
if (macDlg.formIsValid(areaId, latString, lonString)) {
|
||||||
|
handleAddNewAction(areaId, latString, lonString);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -261,58 +267,35 @@ public class AddNewZoneDlg extends CaveSWTDialog {
|
||||||
* @param latString
|
* @param latString
|
||||||
* @param lonString
|
* @param lonString
|
||||||
*/
|
*/
|
||||||
private void handleAddNewAction(String latString, String lonString) {
|
private void handleAddNewAction(String areaId, String latString,
|
||||||
String areaId = idTF.getText();
|
String lonString) throws NumberFormatException {
|
||||||
if (areaId.equals("") || areaId.length() != 6
|
|
||||||
|| (areaId.charAt(2) != 'C' && areaId.charAt(2) != 'Z')) {
|
|
||||||
displayInputErrorMsg("Invalid Area ID = '" + areaId
|
|
||||||
+ "' entered. Please enter a correctly formatted Area ID.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (macDlg.isExistingZone(areaId)) {
|
if (macDlg.isExistingZone(areaId)) {
|
||||||
displayInputErrorMsg("The Area ID, "
|
macDlg.displayInputErrorMsg("The Area ID, "
|
||||||
+ areaId
|
+ areaId
|
||||||
+ ", is already in your Monitoring Area or among your Additional Zones.");
|
+ ", is already in your Monitoring Area or among your Additional Zones.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (latString == null || latString.isEmpty() || lonString == null
|
double lat = Double.parseDouble(latString.trim());
|
||||||
|| lonString.isEmpty()) {
|
double lon = Double.parseDouble(lonString.trim());
|
||||||
macDlg.latLonErrorMsg(latString, lonString);
|
ZoneType type = ZoneType.REGULAR;
|
||||||
return;
|
if (appName != AppName.SNOW) {
|
||||||
|
if (marineZoneRdo.getSelection() || idTF.getText().charAt(2) == 'Z') {
|
||||||
|
type = ZoneType.MARITIME;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
// Correct third character for METARs
|
||||||
double lat = Double.parseDouble(latString.trim());
|
char chr = idTF.getText().charAt(2);
|
||||||
double lon = Double.parseDouble(lonString.trim());
|
if (chr != 'C') {
|
||||||
ZoneType type = ZoneType.REGULAR;
|
String c = idTF.getText().substring(2).replace(chr, 'C');
|
||||||
if (appName != AppName.SNOW) {
|
idTF.setText(idTF.getText().substring(0, 2) + c);
|
||||||
if (marineZoneRdo.getSelection()) {
|
areaId = idTF.getText();
|
||||||
type = ZoneType.MARITIME;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (lat > 90.0 || lat < -90.0 || lon > 180.0 || lon < -180.0) {
|
|
||||||
macDlg.latLonErrorMsg(latString, lonString);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
macDlg.configMgr.addArea(areaId, lat, lon, type);
|
|
||||||
macDlg.addNewZoneAction(areaId, centroidLatTF.getText(),
|
|
||||||
centroidLonTF.getText());
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
macDlg.latLonErrorMsg(latString, lonString);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (lat > 90.0 || lat < -90.0 || lon > 180.0 || lon < -180.0) {
|
||||||
|
macDlg.latLonErrorMsg(latString, lonString);
|
||||||
/**
|
return;
|
||||||
* Displays Input Error Message
|
}
|
||||||
*
|
macDlg.configMgr.addNewArea(areaId, lat, lon, type);
|
||||||
* @param msg
|
macDlg.addZoneToMA(areaId);
|
||||||
*/
|
|
||||||
private void displayInputErrorMsg(String msg) {
|
|
||||||
MessageBox messageBox = new MessageBox(shell, SWT.ICON_INFORMATION
|
|
||||||
| SWT.OK);
|
|
||||||
messageBox.setText("Invalid input");
|
|
||||||
messageBox.setMessage(msg);
|
|
||||||
messageBox.open();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
35
cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ui/dialogs/DeleteStationDlg.java
Normal file → Executable file
35
cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ui/dialogs/DeleteStationDlg.java
Normal file → Executable file
|
@ -19,6 +19,8 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.monitor.ui.dialogs;
|
package com.raytheon.uf.viz.monitor.ui.dialogs;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
@ -35,6 +37,7 @@ import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||||
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
||||||
|
import com.raytheon.uf.common.monitor.xml.AreaIdXML;
|
||||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,6 +53,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
* Nov 20, 2012 1297 skorolev Changes for non-blocking dialog.
|
* Nov 20, 2012 1297 skorolev Changes for non-blocking dialog.
|
||||||
* Apr 23, 2014 3054 skorolev Fixed issue with deleting a new station.
|
* Apr 23, 2014 3054 skorolev Fixed issue with deleting a new station.
|
||||||
* Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
|
* Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
|
||||||
|
* Aug 17, 2015 3841 skorolev Corrected deleteSelected method.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -64,11 +68,12 @@ public class DeleteStationDlg extends CaveSWTDialog {
|
||||||
/** Control font. */
|
/** Control font. */
|
||||||
private Font controlFont;
|
private Font controlFont;
|
||||||
|
|
||||||
/** Area configuration manager. */
|
|
||||||
private FSSObsMonitorConfigurationManager configMgr;
|
|
||||||
|
|
||||||
/** Monitoring Area Configuration Dialog */
|
/** Monitoring Area Configuration Dialog */
|
||||||
private MonitoringAreaConfigDlg macDlg;
|
private final MonitoringAreaConfigDlg macDlg;
|
||||||
|
|
||||||
|
private final FSSObsMonitorConfigurationManager cfgMgr;
|
||||||
|
|
||||||
|
private final java.util.List<String> newAddedStns = new ArrayList<String>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
@ -77,13 +82,15 @@ public class DeleteStationDlg extends CaveSWTDialog {
|
||||||
* Parent shell.
|
* Parent shell.
|
||||||
* @param appName
|
* @param appName
|
||||||
* Application name.
|
* Application name.
|
||||||
|
* @param area
|
||||||
|
* @param macDlg
|
||||||
*/
|
*/
|
||||||
public DeleteStationDlg(Shell parent, AppName appName,
|
public DeleteStationDlg(Shell parent, AppName appName,
|
||||||
MonitoringAreaConfigDlg macDlg) {
|
MonitoringAreaConfigDlg macDlg) {
|
||||||
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
|
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
|
||||||
setText(appName.toString() + ": Delete a Newly Entered Station");
|
setText(appName.toString() + ": Delete a Newly Entered Station");
|
||||||
this.macDlg = macDlg;
|
this.macDlg = macDlg;
|
||||||
configMgr = macDlg.getInstance();
|
cfgMgr = macDlg.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -114,6 +121,10 @@ public class DeleteStationDlg extends CaveSWTDialog {
|
||||||
controlFont = new Font(shell.getDisplay(), "Monospace", 10, SWT.NORMAL);
|
controlFont = new Font(shell.getDisplay(), "Monospace", 10, SWT.NORMAL);
|
||||||
createListControl();
|
createListControl();
|
||||||
createBottomButtons();
|
createBottomButtons();
|
||||||
|
java.util.List<AreaIdXML> areaList = cfgMgr.getConfigXml().getAreaIds();
|
||||||
|
newAddedStns.addAll(cfgMgr.getNewlyAddedStations(areaList));
|
||||||
|
areaList = cfgMgr.getAdjAreaConfigXml().getAreaIds();
|
||||||
|
newAddedStns.addAll(cfgMgr.getNewlyAddedStations(areaList));
|
||||||
populate();
|
populate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,8 +186,7 @@ public class DeleteStationDlg extends CaveSWTDialog {
|
||||||
* Populate list of added stations.
|
* Populate list of added stations.
|
||||||
*/
|
*/
|
||||||
private void populate() {
|
private void populate() {
|
||||||
java.util.List<String> addedStations = configMgr.getAddedStations();
|
stationList.setItems(newAddedStns.toArray(new String[newAddedStns
|
||||||
stationList.setItems(addedStations.toArray(new String[addedStations
|
|
||||||
.size()]));
|
.size()]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,15 +194,20 @@ public class DeleteStationDlg extends CaveSWTDialog {
|
||||||
* Delete stations from the list.
|
* Delete stations from the list.
|
||||||
*/
|
*/
|
||||||
private String deleteSelected() {
|
private String deleteSelected() {
|
||||||
String retval = null;
|
String retval = "";
|
||||||
if (stationList.getItemCount() != 0) {
|
if (stationList.getItemCount() != 0) {
|
||||||
if (stationList.getSelectionIndex() != -1) {
|
if (stationList.getSelectionIndex() != -1) {
|
||||||
int idx = stationList.getSelectionIndex();
|
int idx = stationList.getSelectionIndex();
|
||||||
String selection = stationList.getItem(idx);
|
String selection = stationList.getItem(idx);
|
||||||
retval = configMgr.getAddedStations().get(idx);
|
|
||||||
configMgr.getAddedStations().remove(idx);
|
|
||||||
stationList.remove(selection);
|
stationList.remove(selection);
|
||||||
|
java.util.List<AreaIdXML> areaXmlList = cfgMgr.getConfigXml()
|
||||||
|
.getAreaIds();
|
||||||
|
cfgMgr.removeStation(selection.split("#")[0], areaXmlList);
|
||||||
|
areaXmlList = cfgMgr.getAdjAreaConfigXml().getAreaIds();
|
||||||
|
cfgMgr.removeStation(selection.split("#")[0], areaXmlList);
|
||||||
|
newAddedStns.remove(selection);
|
||||||
populate();
|
populate();
|
||||||
|
macDlg.maStationsRemoved = true;
|
||||||
} else {
|
} else {
|
||||||
MessageBox messageBox = new MessageBox(shell,
|
MessageBox messageBox = new MessageBox(shell,
|
||||||
SWT.ICON_INFORMATION | SWT.NONE);
|
SWT.ICON_INFORMATION | SWT.NONE);
|
||||||
|
|
205
cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ui/dialogs/EditNewZoneDlg.java
Normal file → Executable file
205
cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ui/dialogs/EditNewZoneDlg.java
Normal file → Executable file
|
@ -19,6 +19,8 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.monitor.ui.dialogs;
|
package com.raytheon.uf.viz.monitor.ui.dialogs;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
@ -34,9 +36,11 @@ import org.eclipse.swt.widgets.MessageBox;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||||
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
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;
|
||||||
import com.raytheon.uf.common.monitor.xml.AreaIdXML.ZoneType;
|
import com.raytheon.uf.common.monitor.xml.AreaIdXML.ZoneType;
|
||||||
|
import com.raytheon.uf.common.monitor.xml.StationIdXML;
|
||||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,6 +57,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
* Apr 23, 2014 3054 skorolev Fixed issues with removing a new zone from list.
|
* Apr 23, 2014 3054 skorolev Fixed issues with removing a new zone from list.
|
||||||
* Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
|
* Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
|
||||||
* Nov 10, 2014 3741 skorolev Fixed configXML issue.
|
* Nov 10, 2014 3741 skorolev Fixed configXML issue.
|
||||||
|
* Aug 17, 2015 3841 skorolev Made editable a content of ID field.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -62,7 +67,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
public class EditNewZoneDlg extends CaveSWTDialog {
|
public class EditNewZoneDlg extends CaveSWTDialog {
|
||||||
|
|
||||||
/** Call back interface. */
|
/** Call back interface. */
|
||||||
private MonitoringAreaConfigDlg macDlg;
|
private final MonitoringAreaConfigDlg macDlg;
|
||||||
|
|
||||||
/** Zone list control. */
|
/** Zone list control. */
|
||||||
private List zoneList;
|
private List zoneList;
|
||||||
|
@ -85,17 +90,13 @@ public class EditNewZoneDlg extends CaveSWTDialog {
|
||||||
/** Control font. */
|
/** Control font. */
|
||||||
private Font controlFont;
|
private Font controlFont;
|
||||||
|
|
||||||
/** Marine station radio button. */
|
|
||||||
private Button marineRdo;
|
|
||||||
|
|
||||||
/** None Marine station radio button. */
|
|
||||||
private Button nonMarineRdo;
|
|
||||||
|
|
||||||
/** Bottom label */
|
/** Bottom label */
|
||||||
private Label bottomLbl;
|
private Label bottomLbl;
|
||||||
|
|
||||||
/** Deleted zone */
|
/** Deleted zone */
|
||||||
private String delZone;
|
private boolean delZone = false;
|
||||||
|
|
||||||
|
private final FSSObsMonitorConfigurationManager cfgMgr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
@ -111,6 +112,7 @@ public class EditNewZoneDlg extends CaveSWTDialog {
|
||||||
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
|
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
|
||||||
setText(appName.toString() + ": Edit a Newly Added Zone");
|
setText(appName.toString() + ": Edit a Newly Added Zone");
|
||||||
this.macDlg = macDlg;
|
this.macDlg = macDlg;
|
||||||
|
cfgMgr = macDlg.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -142,7 +144,7 @@ public class EditNewZoneDlg extends CaveSWTDialog {
|
||||||
createListAndTextControls();
|
createListAndTextControls();
|
||||||
createBottomLabel();
|
createBottomLabel();
|
||||||
createCloseButton();
|
createCloseButton();
|
||||||
populate();
|
populate("");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -227,21 +229,6 @@ public class EditNewZoneDlg extends CaveSWTDialog {
|
||||||
lonTF = new Text(textButtonComp, SWT.BORDER);
|
lonTF = new Text(textButtonComp, SWT.BORDER);
|
||||||
lonTF.setLayoutData(gd);
|
lonTF.setLayoutData(gd);
|
||||||
|
|
||||||
gd = new GridData();
|
|
||||||
gd.horizontalSpan = 2;
|
|
||||||
gd.verticalIndent = 15;
|
|
||||||
marineRdo = new Button(textButtonComp, SWT.RADIO);
|
|
||||||
marineRdo.setLayoutData(gd);
|
|
||||||
marineRdo.setSelection(false);
|
|
||||||
marineRdo.setText("Marine Station");
|
|
||||||
|
|
||||||
gd = new GridData();
|
|
||||||
gd.horizontalSpan = 2;
|
|
||||||
nonMarineRdo = new Button(textButtonComp, SWT.RADIO);
|
|
||||||
nonMarineRdo.setLayoutData(gd);
|
|
||||||
nonMarineRdo.setSelection(true);
|
|
||||||
nonMarineRdo.setText("Non-Marine Station");
|
|
||||||
|
|
||||||
gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, true);
|
gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, true);
|
||||||
gd.widthHint = 80;
|
gd.widthHint = 80;
|
||||||
gd.verticalIndent = 5;
|
gd.verticalIndent = 5;
|
||||||
|
@ -251,7 +238,17 @@ public class EditNewZoneDlg extends CaveSWTDialog {
|
||||||
saveBtn.addSelectionListener(new SelectionAdapter() {
|
saveBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent event) {
|
public void widgetSelected(SelectionEvent event) {
|
||||||
saveSelected();
|
if (zoneList.getItemCount() != 0) {
|
||||||
|
String area = zoneList.getItem(zoneList.getSelectionIndex());
|
||||||
|
String areaStr = idTF.getText().toUpperCase();
|
||||||
|
String latStr = latTF.getText();
|
||||||
|
String lonStr = lonTF.getText();
|
||||||
|
if (macDlg.formIsValid(areaStr, latStr, lonStr)) {
|
||||||
|
saveSelected(area, areaStr, latStr, lonStr);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
bottomLbl.setText("No zones have been edited.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, true);
|
gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, true);
|
||||||
|
@ -309,9 +306,24 @@ public class EditNewZoneDlg extends CaveSWTDialog {
|
||||||
/**
|
/**
|
||||||
* Populate list of added zones.
|
* Populate list of added zones.
|
||||||
*/
|
*/
|
||||||
private void populate() {
|
private void populate(String selected) {
|
||||||
java.util.List<String> newList = macDlg.configMgr.getAddedZones();
|
java.util.List<String> newList = new ArrayList<String>();
|
||||||
|
java.util.List<AreaIdXML> maList = cfgMgr.getConfigXml().getAreaIds();
|
||||||
|
for (AreaIdXML maZone : maList) {
|
||||||
|
if (maZone.getCLat() != null) {
|
||||||
|
newList.add(maZone.getAreaId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
java.util.List<AreaIdXML> adtnlList = cfgMgr.getAdjAreaConfigXml()
|
||||||
|
.getAreaIds();
|
||||||
|
for (AreaIdXML aZone : adtnlList) {
|
||||||
|
if (aZone.getCLat() != null) {
|
||||||
|
newList.add(aZone.getAreaId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
zoneList.removeAll();
|
||||||
zoneList.setItems(newList.toArray(new String[newList.size()]));
|
zoneList.setItems(newList.toArray(new String[newList.size()]));
|
||||||
|
macDlg.populateLeftLists(selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -319,27 +331,23 @@ public class EditNewZoneDlg extends CaveSWTDialog {
|
||||||
*/
|
*/
|
||||||
private void handleZoneSelection() {
|
private void handleZoneSelection() {
|
||||||
String zone = zoneList.getItem(zoneList.getSelectionIndex());
|
String zone = zoneList.getItem(zoneList.getSelectionIndex());
|
||||||
AreaIdXML areaXml = macDlg.configMgr.getAreaXml(zone);
|
AreaIdXML areaXml = cfgMgr.getAreaXml(zone);
|
||||||
// DR #7343: a null areaXml causes an "Unhandled event loop exception"
|
AreaIdXML adjAreaXml = cfgMgr.getAdjAreaXML(zone);
|
||||||
if (areaXml != null) {
|
if (areaXml != null) {
|
||||||
idTF.setText(areaXml.getAreaId());
|
idTF.setText(areaXml.getAreaId());
|
||||||
idTF.setEnabled(false);
|
|
||||||
latTF.setText(String.valueOf(areaXml.getCLat()));
|
latTF.setText(String.valueOf(areaXml.getCLat()));
|
||||||
lonTF.setText(String.valueOf(areaXml.getCLon()));
|
lonTF.setText(String.valueOf(areaXml.getCLon()));
|
||||||
if (areaXml.getType() == ZoneType.REGULAR) {
|
} else if (adjAreaXml != null) {
|
||||||
nonMarineRdo.setSelection(true);
|
idTF.setText(adjAreaXml.getAreaId());
|
||||||
marineRdo.setSelection(false);
|
latTF.setText(String.valueOf(adjAreaXml.getCLat()));
|
||||||
} else {
|
lonTF.setText(String.valueOf(adjAreaXml.getCLon()));
|
||||||
nonMarineRdo.setSelection(false);
|
|
||||||
marineRdo.setSelection(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete selected zones.
|
* Delete selected zones.
|
||||||
*/
|
*/
|
||||||
private String deleteSelected() {
|
private Boolean deleteSelected() {
|
||||||
if (zoneList.getItemCount() != 0) {
|
if (zoneList.getItemCount() != 0) {
|
||||||
if (zoneList.getSelectionIndex() == -1) {
|
if (zoneList.getSelectionIndex() == -1) {
|
||||||
MessageBox messageBox = new MessageBox(shell,
|
MessageBox messageBox = new MessageBox(shell,
|
||||||
|
@ -348,62 +356,97 @@ public class EditNewZoneDlg extends CaveSWTDialog {
|
||||||
messageBox.setMessage("Please select zone to be deleted.");
|
messageBox.setMessage("Please select zone to be deleted.");
|
||||||
messageBox.open();
|
messageBox.open();
|
||||||
zoneList.select(0);
|
zoneList.select(0);
|
||||||
return null;
|
return false;
|
||||||
}
|
}
|
||||||
String area = zoneList.getItem(zoneList.getSelectionIndex());
|
String area = zoneList.getItem(zoneList.getSelectionIndex());
|
||||||
|
AreaIdXML zoneXML = null;
|
||||||
|
if (cfgMgr.getConfigXml().containsArea(area)) {
|
||||||
|
zoneXML = cfgMgr.getAreaXml(area);
|
||||||
|
} else if (cfgMgr.getAdjAreaConfigXml().containsArea(area)) {
|
||||||
|
zoneXML = cfgMgr.getAdjAreaXML(area);
|
||||||
|
}
|
||||||
zoneList.remove(zoneList.getSelectionIndex());
|
zoneList.remove(zoneList.getSelectionIndex());
|
||||||
macDlg.configMgr.removeArea(area);
|
zoneList.select(0);
|
||||||
idTF.setText("");
|
if (zoneList.getItemCount() != 0) {
|
||||||
latTF.setText("");
|
handleZoneSelection();
|
||||||
lonTF.setText("");
|
} else {
|
||||||
return area;
|
idTF.setText("");
|
||||||
|
latTF.setText("");
|
||||||
|
lonTF.setText("");
|
||||||
|
}
|
||||||
|
if (zoneXML != null && macDlg.getMaZones().contains(area)) {
|
||||||
|
macDlg.getMaZones().remove(area);
|
||||||
|
cfgMgr.removeArea(zoneXML);
|
||||||
|
}
|
||||||
|
if (zoneXML != null && macDlg.getAdditionalZones().contains(area)) {
|
||||||
|
macDlg.getAdditionalZones().remove(area);
|
||||||
|
cfgMgr.removeAdjArea(zoneXML);
|
||||||
|
}
|
||||||
|
macDlg.populateLeftLists("");
|
||||||
|
macDlg.maZonesRemoved = true;
|
||||||
|
return true;
|
||||||
} else {
|
} else {
|
||||||
bottomLbl.setText("No zones have been deleted.");
|
bottomLbl.setText("No zones have been deleted.");
|
||||||
}
|
}
|
||||||
return null;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save selected zones.
|
* Save selected zones.
|
||||||
|
*
|
||||||
|
* @param area
|
||||||
|
* Original zone ID
|
||||||
|
* @param areaStr
|
||||||
|
* New zone ID
|
||||||
|
* @param latStr
|
||||||
|
* Latitude
|
||||||
|
* @param lonStr
|
||||||
|
* Longitude
|
||||||
|
* @throws NumberFormatException
|
||||||
*/
|
*/
|
||||||
private void saveSelected() {
|
private void saveSelected(String area, String areaStr, String latStr,
|
||||||
|
String lonStr) throws NumberFormatException {
|
||||||
if (zoneList.getItemCount() != 0) {
|
java.util.List<StationIdXML> stationIds;
|
||||||
String area = zoneList.getItem(zoneList.getSelectionIndex());
|
if (macDlg.getMaZones().contains(area)) {
|
||||||
String latStr = latTF.getText();
|
stationIds = cfgMgr.getAreaXml(area).getStationIds();
|
||||||
String lontStr = lonTF.getText();
|
} else if (macDlg.getAdditionalZones().contains(area)) {
|
||||||
if (latStr == null || latStr.isEmpty() || lontStr == null
|
stationIds = cfgMgr.getAdjAreaXML(area).getStationIds();
|
||||||
|| lontStr.isEmpty()) {
|
|
||||||
macDlg.latLonErrorMsg(latStr, lontStr);
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
double lat = Double.parseDouble(latStr);
|
|
||||||
double lon = Double.parseDouble(lontStr);
|
|
||||||
if (lat > 90.0 || lat < -90.0 || lon > 180.0
|
|
||||||
|| lon < -180.0) {
|
|
||||||
macDlg.latLonErrorMsg(latStr, lontStr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ZoneType type = ZoneType.REGULAR;
|
|
||||||
if (marineRdo.getSelection()) {
|
|
||||||
type = ZoneType.MARITIME;
|
|
||||||
}
|
|
||||||
// Replace previously added zone
|
|
||||||
macDlg.configMgr.removeArea(area);
|
|
||||||
macDlg.configMgr.removeAddedArea(area);
|
|
||||||
macDlg.configMgr.addArea(area, lat, lon, type);
|
|
||||||
populate();
|
|
||||||
// Return cursor to the top of the list.
|
|
||||||
zoneList.select(0);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
macDlg.latLonErrorMsg(latStr, lontStr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
bottomLbl.setText("No zones have been edited.");
|
return;
|
||||||
}
|
}
|
||||||
|
double lat = Double.parseDouble(latStr);
|
||||||
|
double lon = Double.parseDouble(lonStr);
|
||||||
|
if (lat > 90.0 || lat < -90.0 || lon > 180.0 || lon < -180.0) {
|
||||||
|
macDlg.latLonErrorMsg(latStr, lonStr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ZoneType type = ZoneType.REGULAR;
|
||||||
|
if (areaStr.charAt(2) != 'C') {
|
||||||
|
type = (ZoneType.MARITIME);
|
||||||
|
}
|
||||||
|
AreaIdXML areaXML = new AreaIdXML();
|
||||||
|
areaXML.setAreaId(areaStr);
|
||||||
|
areaXML.setCLat(lat);
|
||||||
|
areaXML.setCLon(lon);
|
||||||
|
areaXML.setType(type);
|
||||||
|
areaXML.setStationIds(stationIds);
|
||||||
|
// Replace previously added zone
|
||||||
|
if (cfgMgr.getAreaList().contains(area)) {
|
||||||
|
if (macDlg.getMaZones().contains(area)) {
|
||||||
|
int idx = macDlg.getMaZones().indexOf(area);
|
||||||
|
macDlg.getMaZones().set(idx, areaXML.getAreaId());
|
||||||
|
}
|
||||||
|
cfgMgr.replaceArea(cfgMgr.getAreaXml(area), areaXML);
|
||||||
|
} else if (macDlg.getAdditionalZones().contains(area)) {
|
||||||
|
if (macDlg.getAdditionalZones().contains(area)) {
|
||||||
|
int idx = macDlg.getAdditionalZones().indexOf(area);
|
||||||
|
macDlg.getAdditionalZones().set(idx, areaXML.getAreaId());
|
||||||
|
}
|
||||||
|
cfgMgr.replaceAdjArea(cfgMgr.getAdjAreaXML(area), areaXML);
|
||||||
|
}
|
||||||
|
populate(areaStr);
|
||||||
|
// Return cursor to the list.
|
||||||
|
zoneList.select(zoneList.indexOf(areaStr));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
211
cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ui/dialogs/MonitoringAreaConfigDlg.java
Normal file → Executable file
211
cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ui/dialogs/MonitoringAreaConfigDlg.java
Normal file → Executable file
|
@ -19,8 +19,11 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.monitor.ui.dialogs;
|
package com.raytheon.uf.viz.monitor.ui.dialogs;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
@ -42,10 +45,12 @@ import org.eclipse.swt.widgets.Scale;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.localization.exception.LocalizationException;
|
||||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||||
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
||||||
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
||||||
import com.raytheon.uf.common.monitor.xml.AreaIdXML.ZoneType;
|
import com.raytheon.uf.common.monitor.xml.AreaIdXML;
|
||||||
|
import com.raytheon.uf.common.serialization.SerializationException;
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
|
@ -79,6 +84,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||||
* Oct 27, 2014 3667 skorolev Corrected functionality of dialog. Cleaned code.
|
* Oct 27, 2014 3667 skorolev Corrected functionality of dialog. Cleaned code.
|
||||||
* Nov 12, 2014 3650 skorolev Added confirmation box for unsaved changes in the dialog.
|
* Nov 12, 2014 3650 skorolev Added confirmation box for unsaved changes in the dialog.
|
||||||
* Mar 08, 2015 3888 dhladky Restored threshold pop-up when adding new stations/zones.
|
* Mar 08, 2015 3888 dhladky Restored threshold pop-up when adding new stations/zones.
|
||||||
|
* Aug 17, 2015 3841 skorolev Added formIsValid method.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -181,7 +187,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
private Font controlFont;
|
private Font controlFont;
|
||||||
|
|
||||||
/** Application name. **/
|
/** Application name. **/
|
||||||
private CommonConfig.AppName appName;
|
private final CommonConfig.AppName appName;
|
||||||
|
|
||||||
/** The current site. **/
|
/** The current site. **/
|
||||||
protected static String currentSite = null;
|
protected static String currentSite = null;
|
||||||
|
@ -329,7 +335,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
// initialize zone/station lists
|
// initialize zone/station lists
|
||||||
initZoneStationLists();
|
initZoneStationLists();
|
||||||
// Populate the dialog
|
// Populate the dialog
|
||||||
populateLeftLists();
|
populateLeftLists("");
|
||||||
setValues();
|
setValues();
|
||||||
shell.addShellListener(new ShellAdapter() {
|
shell.addShellListener(new ShellAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -401,7 +407,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
|
getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
|
||||||
mode = Mode.Zone;
|
mode = Mode.Zone;
|
||||||
changeZoneStationControls();
|
changeZoneStationControls();
|
||||||
populateLeftLists();
|
populateLeftLists("");
|
||||||
if (!getShell().isDisposed()) {
|
if (!getShell().isDisposed()) {
|
||||||
getShell().setCursor(null);
|
getShell().setCursor(null);
|
||||||
}
|
}
|
||||||
|
@ -417,7 +423,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
|
getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
|
||||||
mode = Mode.Station;
|
mode = Mode.Station;
|
||||||
changeZoneStationControls();
|
changeZoneStationControls();
|
||||||
populateLeftLists();
|
populateLeftLists("");
|
||||||
if (!getShell().isDisposed()) {
|
if (!getShell().isDisposed()) {
|
||||||
getShell().setCursor(null);
|
getShell().setCursor(null);
|
||||||
}
|
}
|
||||||
|
@ -782,7 +788,15 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
okBtn.addSelectionListener(new SelectionAdapter() {
|
okBtn.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent event) {
|
public void widgetSelected(SelectionEvent event) {
|
||||||
handleOkBtnSelection();
|
try {
|
||||||
|
handleOkBtnSelection();
|
||||||
|
} catch (LocalizationException | SerializationException
|
||||||
|
| IOException e) {
|
||||||
|
statusHandler
|
||||||
|
.handle(Priority.PROBLEM,
|
||||||
|
"There is a problem with configuration XML file",
|
||||||
|
e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -878,6 +892,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
* Handles the Add New button click.
|
* Handles the Add New button click.
|
||||||
*/
|
*/
|
||||||
private void handleAddNewAction() {
|
private void handleAddNewAction() {
|
||||||
|
// Zone configure
|
||||||
if (zoneRdo.getSelection() == true) {
|
if (zoneRdo.getSelection() == true) {
|
||||||
if (addNewZoneDlg == null) {
|
if (addNewZoneDlg == null) {
|
||||||
addNewZoneDlg = new AddNewZoneDlg(shell, appName, this);
|
addNewZoneDlg = new AddNewZoneDlg(shell, appName, this);
|
||||||
|
@ -886,16 +901,16 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
public void dialogClosed(Object returnValue) {
|
public void dialogClosed(Object returnValue) {
|
||||||
if ((Boolean) returnValue) {
|
if ((Boolean) returnValue) {
|
||||||
// Update the dialog
|
// Update the dialog
|
||||||
populateLeftLists();
|
populateLeftLists("");
|
||||||
}
|
}
|
||||||
addNewZoneDlg = null;
|
addNewZoneDlg = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
addNewZoneDlg.open();
|
addNewZoneDlg.open();
|
||||||
} else {
|
} else { // Station configure
|
||||||
if (associatedList.getSelectionIndex() != -1) {
|
if (maRegionalList.getSelectionIndex() != -1) {
|
||||||
String area = associatedList.getItem(associatedList
|
String area = maRegionalList.getItem(maRegionalList
|
||||||
.getSelectionIndex());
|
.getSelectionIndex());
|
||||||
if (addNewStnDlg == null) {
|
if (addNewStnDlg == null) {
|
||||||
addNewStnDlg = new AddNewStationDlg(shell, appName, area,
|
addNewStnDlg = new AddNewStationDlg(shell, appName, area,
|
||||||
|
@ -905,7 +920,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
public void dialogClosed(Object returnValue) {
|
public void dialogClosed(Object returnValue) {
|
||||||
if ((Boolean) returnValue) {
|
if ((Boolean) returnValue) {
|
||||||
// Update the dialog
|
// Update the dialog
|
||||||
populateLeftLists();
|
populateLeftLists("");
|
||||||
}
|
}
|
||||||
addNewStnDlg = null;
|
addNewStnDlg = null;
|
||||||
}
|
}
|
||||||
|
@ -916,9 +931,9 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
MessageBox messageBox = new MessageBox(shell,
|
MessageBox messageBox = new MessageBox(shell,
|
||||||
SWT.ICON_INFORMATION | SWT.NONE);
|
SWT.ICON_INFORMATION | SWT.NONE);
|
||||||
messageBox.setText("Selection error.");
|
messageBox.setText("Selection error.");
|
||||||
messageBox.setMessage("Please select associated zone.");
|
messageBox.setMessage("Please select a monitoring zone.");
|
||||||
messageBox.open();
|
messageBox.open();
|
||||||
associatedList.select(0);
|
maRegionalList.select(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -937,7 +952,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
// Update the edit dialog
|
// Update the edit dialog
|
||||||
String selectedZone = returnValue.toString();
|
String selectedZone = returnValue.toString();
|
||||||
maZones.remove(selectedZone);
|
maZones.remove(selectedZone);
|
||||||
populateLeftLists();
|
populateLeftLists("");
|
||||||
}
|
}
|
||||||
editDlg = null;
|
editDlg = null;
|
||||||
}
|
}
|
||||||
|
@ -951,10 +966,9 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
@Override
|
@Override
|
||||||
public void dialogClosed(Object returnValue) {
|
public void dialogClosed(Object returnValue) {
|
||||||
if (returnValue instanceof String) {
|
if (returnValue instanceof String) {
|
||||||
// Update the delete dialog
|
String station = returnValue.toString();
|
||||||
String selectedStn = returnValue.toString();
|
maStations.remove(station);
|
||||||
maStations.remove(selectedStn);
|
populateLeftLists("");
|
||||||
populateLeftLists();
|
|
||||||
}
|
}
|
||||||
deleteStnDlg = null;
|
deleteStnDlg = null;
|
||||||
}
|
}
|
||||||
|
@ -985,13 +999,14 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
maRegionalList.setItems(additionalZones
|
maRegionalList.setItems(additionalZones
|
||||||
.toArray(new String[additionalZones.size()]));
|
.toArray(new String[additionalZones.size()]));
|
||||||
}
|
}
|
||||||
|
maRegionalList.select(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Populates the zone list boxes.
|
* Populates the zone list boxes.
|
||||||
*/
|
*/
|
||||||
private void populateLeftLists() {
|
protected void populateLeftLists(String selected) {
|
||||||
if (mode == Mode.Zone) {
|
if (mode == Mode.Zone) {
|
||||||
/** Zone Mode */
|
/** Zone Mode */
|
||||||
Collections.sort(maZones);
|
Collections.sort(maZones);
|
||||||
|
@ -1011,7 +1026,11 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
}
|
}
|
||||||
if (monitorAreaList.getItemCount() > 0) {
|
if (monitorAreaList.getItemCount() > 0) {
|
||||||
// select top of the list
|
// select top of the list
|
||||||
monitorAreaList.setSelection(0);
|
if (selected.equals("")) {
|
||||||
|
monitorAreaList.setSelection(0);
|
||||||
|
} else {
|
||||||
|
monitorAreaList.setSelection(monitorAreaList.indexOf(selected));
|
||||||
|
}
|
||||||
handleMonitorAreaListSelection();
|
handleMonitorAreaListSelection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1090,20 +1109,20 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
if (mode == Mode.Zone) {
|
if (mode == Mode.Zone) {
|
||||||
String zone = additionalList.getItem(additionalList
|
String zone = additionalList.getItem(additionalList
|
||||||
.getSelectionIndex());
|
.getSelectionIndex());
|
||||||
|
AreaIdXML zoneXML = configMgr.getAdjAreaXML(zone);
|
||||||
additionalList.remove(additionalList.getSelectionIndex());
|
additionalList.remove(additionalList.getSelectionIndex());
|
||||||
maZones.add(zone);
|
maZones.add(zone);
|
||||||
Collections.sort(maZones);
|
Collections.sort(maZones);
|
||||||
monitorAreaList
|
monitorAreaList
|
||||||
.setItems(maZones.toArray(new String[maZones.size()]));
|
.setItems(maZones.toArray(new String[maZones.size()]));
|
||||||
monitorAreaList.setSelection(maZones.indexOf(zone));
|
monitorAreaList.setSelection(maZones.indexOf(zone));
|
||||||
handleMonitorAreaListSelection();
|
|
||||||
additionalZones.remove(zone);
|
additionalZones.remove(zone);
|
||||||
configMgr.addArea(zone, zone.charAt(2) == 'Z' ? ZoneType.MARITIME
|
configMgr.addArea(zoneXML);
|
||||||
: ZoneType.REGULAR);
|
handleMonitorAreaListSelection();
|
||||||
if (!configMgr.getAddedZones().contains(zone)) {
|
if (!configMgr.getAddedZones().contains(zone)) {
|
||||||
configMgr.getAddedZones().add(zone);
|
configMgr.getAddedZones().add(zone);
|
||||||
}
|
}
|
||||||
configMgr.removeAdjArea(zone);
|
configMgr.removeAdjArea(zoneXML);
|
||||||
} else { // Station mode
|
} else { // Station mode
|
||||||
if (associatedList.getSelectionCount() == 0) {
|
if (associatedList.getSelectionCount() == 0) {
|
||||||
showMessage(shell, SWT.ERROR, "Selection Needed",
|
showMessage(shell, SWT.ERROR, "Selection Needed",
|
||||||
|
@ -1123,7 +1142,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
.getSelectionIndex());
|
.getSelectionIndex());
|
||||||
String stnId = stn.substring(0, stn.indexOf('#'));
|
String stnId = stn.substring(0, stn.indexOf('#'));
|
||||||
String stnType = stn.substring(stn.indexOf('#') + 1);
|
String stnType = stn.substring(stn.indexOf('#') + 1);
|
||||||
configMgr.addStation(zone, stnId, stnType, configMgr
|
configMgr.addNewStation(zone, stnId, stnType, configMgr
|
||||||
.getAddedStations().contains(stnId));
|
.getAddedStations().contains(stnId));
|
||||||
handleMonitorAreaListSelection();
|
handleMonitorAreaListSelection();
|
||||||
}
|
}
|
||||||
|
@ -1145,9 +1164,11 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
}
|
}
|
||||||
String entry = monitorAreaList.getItem(monitorAreaList
|
String entry = monitorAreaList.getItem(monitorAreaList
|
||||||
.getSelectionIndex());
|
.getSelectionIndex());
|
||||||
monitorAreaList.remove(monitorAreaList.getSelectionIndex());
|
|
||||||
associatedList.removeAll();
|
|
||||||
if (mode == Mode.Zone) {
|
if (mode == Mode.Zone) {
|
||||||
|
monitorAreaList.remove(monitorAreaList.getSelectionIndex());
|
||||||
|
// entry is a zone to remove.
|
||||||
|
AreaIdXML zoneXML = configMgr.getAreaXml(entry);
|
||||||
if (!additionalZones.contains(entry)) {
|
if (!additionalZones.contains(entry)) {
|
||||||
additionalZones.add(entry);
|
additionalZones.add(entry);
|
||||||
}
|
}
|
||||||
|
@ -1156,22 +1177,30 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
.toArray(new String[additionalZones.size()]));
|
.toArray(new String[additionalZones.size()]));
|
||||||
additionalList.setSelection(additionalZones.indexOf(entry));
|
additionalList.setSelection(additionalZones.indexOf(entry));
|
||||||
maZones.remove(entry);
|
maZones.remove(entry);
|
||||||
configMgr.removeArea(entry);
|
configMgr.removeArea(zoneXML);
|
||||||
if (configMgr.getAddedZones().contains(entry)) {
|
if (configMgr.getAddedZones().contains(entry)) {
|
||||||
configMgr.getAddedZones().remove(entry);
|
configMgr.getAddedZones().remove(entry);
|
||||||
}
|
}
|
||||||
|
configMgr.addAdjArea(zoneXML);
|
||||||
configMgr.addAdjArea(entry,
|
associatedList.removeAll();
|
||||||
entry.charAt(2) == 'Z' ? ZoneType.MARITIME
|
} else { // Station mode. entry is name#type of station.
|
||||||
: ZoneType.REGULAR);
|
if (associatedList.getItemCount() >= 1
|
||||||
} else { // Station mode
|
&& associatedList.getSelectionIndex() < 0) {
|
||||||
|
showMessage(shell, SWT.ERROR, "Selection Needed",
|
||||||
|
"You must select a assopciated area zone to remove.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
monitorAreaList.remove(monitorAreaList.getSelectionIndex());
|
||||||
|
String stnZone = associatedList.getSelection()[0];
|
||||||
additionalStns.add(entry);
|
additionalStns.add(entry);
|
||||||
Collections.sort(additionalStns);
|
Collections.sort(additionalStns);
|
||||||
additionalList.setItems(additionalStns
|
additionalList.setItems(additionalStns
|
||||||
.toArray(new String[additionalStns.size()]));
|
.toArray(new String[additionalStns.size()]));
|
||||||
additionalList.setSelection(additionalStns.indexOf(entry));
|
additionalList.setSelection(additionalStns.indexOf(entry));
|
||||||
maStations.remove(entry);
|
maStations.remove(entry);
|
||||||
configMgr.removeStation(entry.substring(0, entry.indexOf('#')));
|
// station removes from configuration XML files
|
||||||
|
configMgr.removeStationFromArea(stnZone,
|
||||||
|
entry.substring(0, entry.indexOf('#')));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1205,11 +1234,8 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
}
|
}
|
||||||
String entry = maRegionalList.getItem(maRegionalList
|
String entry = maRegionalList.getItem(maRegionalList
|
||||||
.getSelectionIndex());
|
.getSelectionIndex());
|
||||||
String[] items = associatedList.getItems();
|
java.util.List<String> itemList = new LinkedList<String>(
|
||||||
ArrayList<String> itemList = new ArrayList<String>();
|
Arrays.asList(associatedList.getItems()));
|
||||||
for (String item : items) {
|
|
||||||
itemList.add(item);
|
|
||||||
}
|
|
||||||
if (itemList.contains(entry)) {
|
if (itemList.contains(entry)) {
|
||||||
/**
|
/**
|
||||||
* if selected entry is already in associated list: highlight the
|
* if selected entry is already in associated list: highlight the
|
||||||
|
@ -1238,24 +1264,24 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
.getSelectionIndex());
|
.getSelectionIndex());
|
||||||
String stnId = entry.substring(0, entry.indexOf('#'));
|
String stnId = entry.substring(0, entry.indexOf('#'));
|
||||||
String stnType = entry.substring(entry.indexOf('#') + 1);
|
String stnType = entry.substring(entry.indexOf('#') + 1);
|
||||||
configMgr.addStation(zone, stnId, stnType, configMgr
|
|
||||||
|
configMgr.addNewStation(zone, stnId, stnType, configMgr
|
||||||
.getAddedStations().contains(stnId));
|
.getAddedStations().contains(stnId));
|
||||||
} else { // Station mode
|
} else { // Station mode
|
||||||
if (regionalRdo.getSelection()) {
|
if (regionalRdo.getSelection()) {
|
||||||
// entry is a zone selected from additional zones
|
// entry is a zone selected from additional zones
|
||||||
|
AreaIdXML zoneXML = configMgr.getAdjAreaXML(entry);
|
||||||
maZones.add(entry);
|
maZones.add(entry);
|
||||||
Collections.sort(maZones);
|
Collections.sort(maZones);
|
||||||
additionalZones.remove(entry);
|
additionalZones.remove(entry);
|
||||||
maRegionalList.remove(maRegionalList.getSelectionIndex());
|
maRegionalList.remove(maRegionalList.getSelectionIndex());
|
||||||
configMgr.addArea(entry,
|
configMgr.addArea(zoneXML);
|
||||||
entry.charAt(2) == 'Z' ? ZoneType.MARITIME
|
|
||||||
: ZoneType.REGULAR);
|
|
||||||
}
|
}
|
||||||
String stn = monitorAreaList.getItem(monitorAreaList
|
String stn = monitorAreaList.getItem(monitorAreaList
|
||||||
.getSelectionIndex());
|
.getSelectionIndex());
|
||||||
String stnId = stn.substring(0, stn.indexOf('#'));
|
String stnId = stn.substring(0, stn.indexOf('#'));
|
||||||
String stnType = stn.substring(stn.indexOf('#') + 1);
|
String stnType = stn.substring(stn.indexOf('#') + 1);
|
||||||
configMgr.addStation(entry, stnId, stnType, configMgr
|
configMgr.addNewStation(entry, stnId, stnType, configMgr
|
||||||
.getAddedStations().contains(stnId));
|
.getAddedStations().contains(stnId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1280,10 +1306,10 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
if (mode == Mode.Zone) {
|
if (mode == Mode.Zone) {
|
||||||
String zone = monitorAreaList.getItem(monitorAreaList
|
String zone = monitorAreaList.getItem(monitorAreaList
|
||||||
.getSelectionIndex());
|
.getSelectionIndex());
|
||||||
configMgr.removeStation(zone, entry);
|
configMgr.removeStationFromArea(zone, entry);
|
||||||
java.util.List<String> zones = configMgr.getAreaByStationId(entry
|
java.util.List<String> zones = configMgr.getAreaByStationId(entry
|
||||||
.substring(0, entry.indexOf('#')));
|
.substring(0, entry.indexOf('#')));
|
||||||
if (zones.size() == 0) {
|
if (zones.isEmpty()) {
|
||||||
// entry is no longer an MA station
|
// entry is no longer an MA station
|
||||||
maStations.remove(entry);
|
maStations.remove(entry);
|
||||||
additionalStns.add(entry);
|
additionalStns.add(entry);
|
||||||
|
@ -1299,7 +1325,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
} else { // Station mode
|
} else { // Station mode
|
||||||
String stn = monitorAreaList.getItem(monitorAreaList
|
String stn = monitorAreaList.getItem(monitorAreaList
|
||||||
.getSelectionIndex());
|
.getSelectionIndex());
|
||||||
configMgr.removeStation(entry, stn);
|
configMgr.removeStationFromArea(entry, stn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1343,13 +1369,18 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset and Saving configuration parameters.
|
* Save configuration parameters.
|
||||||
|
*
|
||||||
|
* @throws SerializationException
|
||||||
|
* @throws LocalizationException
|
||||||
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
protected void resetAndSave() {
|
protected void saveConfigs() throws LocalizationException,
|
||||||
|
SerializationException, IOException {
|
||||||
getValues();
|
getValues();
|
||||||
resetStatus();
|
|
||||||
configMgr.saveConfigXml();
|
configMgr.saveConfigXml();
|
||||||
configMgr.saveAdjacentAreaConfigXml();
|
configMgr.saveAdjacentAreaConfigXml();
|
||||||
|
configMgr.setPopulated(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1363,8 +1394,13 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
/**
|
/**
|
||||||
* Handles OK button. Save changes and close the dialog (or just close if
|
* Handles OK button. Save changes and close the dialog (or just close if
|
||||||
* there are no changes).
|
* there are no changes).
|
||||||
|
*
|
||||||
|
* @throws SerializationException
|
||||||
|
* @throws LocalizationException
|
||||||
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
protected abstract void handleOkBtnSelection();
|
protected abstract void handleOkBtnSelection()
|
||||||
|
throws LocalizationException, SerializationException, IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new zone to monitor area and refresh GUI
|
* Adds a new zone to monitor area and refresh GUI
|
||||||
|
@ -1374,7 +1410,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
public void addZoneToMA(String zone) {
|
public void addZoneToMA(String zone) {
|
||||||
maZones.add(zone);
|
maZones.add(zone);
|
||||||
Collections.sort(maZones);
|
Collections.sort(maZones);
|
||||||
populateLeftLists();
|
populateLeftLists(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1386,7 +1422,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
public void addStationToMA(String stnWithType) {
|
public void addStationToMA(String stnWithType) {
|
||||||
maStations.add(stnWithType);
|
maStations.add(stnWithType);
|
||||||
Collections.sort(maStations);
|
Collections.sort(maStations);
|
||||||
populateLeftLists();
|
populateLeftLists("");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1416,6 +1452,58 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Input test.
|
||||||
|
*
|
||||||
|
* @param area
|
||||||
|
* @param latString
|
||||||
|
* @param lonString
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean formIsValid(String area, String latString, String lonString) {
|
||||||
|
boolean retVal = true;
|
||||||
|
String msg = "";
|
||||||
|
if (area.equals("") || area.length() != 6
|
||||||
|
|| !Character.isDigit(area.charAt(3))) {
|
||||||
|
msg = "Invalid Area ID = '"
|
||||||
|
+ area
|
||||||
|
+ "' entered.\n"
|
||||||
|
+ "Please enter a correctly formatted Area ID:\n"
|
||||||
|
+ "Zone ID must have six characters. 3 letters and 3 digits.\n"
|
||||||
|
+ "Use only capital characters.\n";
|
||||||
|
retVal = false;
|
||||||
|
}
|
||||||
|
if (appName != AppName.SNOW
|
||||||
|
&& (area.charAt(2) != 'C' && area.charAt(2) != 'Z')) {
|
||||||
|
msg = msg
|
||||||
|
+ "A third character should be C for county and Z for marine zone.\n";
|
||||||
|
retVal = false;
|
||||||
|
}
|
||||||
|
if (!msg.isEmpty()) {
|
||||||
|
displayInputErrorMsg(msg);
|
||||||
|
retVal = false;
|
||||||
|
}
|
||||||
|
if (latString == null || latString.isEmpty() || lonString == null
|
||||||
|
|| lonString.isEmpty()) {
|
||||||
|
latLonErrorMsg(latString, lonString);
|
||||||
|
retVal = false;
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays Input Error Message
|
||||||
|
*
|
||||||
|
* @param msg
|
||||||
|
*/
|
||||||
|
public void displayInputErrorMsg(String msg) {
|
||||||
|
MessageBox messageBox = new MessageBox(shell, SWT.ICON_INFORMATION
|
||||||
|
| SWT.OK);
|
||||||
|
messageBox.setText("Invalid input");
|
||||||
|
messageBox.setMessage(msg);
|
||||||
|
messageBox.open();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
@ -1462,6 +1550,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
* @see
|
* @see
|
||||||
* com.raytheon.uf.viz.monitor.ui.dialogs.INewZoneStnAction#latLonErrorMsg()
|
* com.raytheon.uf.viz.monitor.ui.dialogs.INewZoneStnAction#latLonErrorMsg()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void latLonErrorMsg(String latStr, String lonStr) {
|
public void latLonErrorMsg(String latStr, String lonStr) {
|
||||||
MessageBox messageBox = new MessageBox(shell, SWT.ICON_INFORMATION
|
MessageBox messageBox = new MessageBox(shell, SWT.ICON_INFORMATION
|
||||||
| SWT.OK);
|
| SWT.OK);
|
||||||
|
@ -1538,6 +1627,22 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public java.util.List<String> getMaZones() {
|
||||||
|
return maZones;
|
||||||
|
}
|
||||||
|
|
||||||
|
public java.util.List<String> getMaStations() {
|
||||||
|
return maStations;
|
||||||
|
}
|
||||||
|
|
||||||
|
public java.util.List<String> getAdditionalZones() {
|
||||||
|
return additionalZones;
|
||||||
|
}
|
||||||
|
|
||||||
|
public java.util.List<String> getAdditionalStns() {
|
||||||
|
return additionalStns;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets Configuration manager.
|
* Gets Configuration manager.
|
||||||
*
|
*
|
||||||
|
|
|
@ -96,6 +96,7 @@ import com.vividsolutions.jts.io.ParseException;
|
||||||
* May 15, 2014 3086 skorolev Replaced MonitorConfigurationManager with FSSObsMonitorConfigurationManager.
|
* May 15, 2014 3086 skorolev Replaced MonitorConfigurationManager with FSSObsMonitorConfigurationManager.
|
||||||
* Sep 15, 2014 3220 skorolev Added refreshZoneTableData method.
|
* Sep 15, 2014 3220 skorolev Added refreshZoneTableData method.
|
||||||
* Nov 03, 2014 3741 skorolev Updated zoom procedures.
|
* Nov 03, 2014 3741 skorolev Updated zoom procedures.
|
||||||
|
* Aug 26, 2015 3841 skorolev Corrected zoomToZone procedure.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -225,7 +226,7 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
|
||||||
protected abstract void shellDisposeAction();
|
protected abstract void shellDisposeAction();
|
||||||
|
|
||||||
/** List of opened plots. **/
|
/** List of opened plots. **/
|
||||||
private Map<String, CaveSWTDialog> openedDlgs = new HashMap<String, CaveSWTDialog>();
|
private final Map<String, CaveSWTDialog> openedDlgs = new HashMap<String, CaveSWTDialog>();
|
||||||
|
|
||||||
/** row index in the station table. **/
|
/** row index in the station table. **/
|
||||||
public int rowIndex;
|
public int rowIndex;
|
||||||
|
@ -242,7 +243,7 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
|
||||||
/** current site **/
|
/** current site **/
|
||||||
protected String site;
|
protected String site;
|
||||||
|
|
||||||
protected FSSObsMonitorConfigurationManager configMgr;
|
protected FSSObsMonitorConfigurationManager configMgr = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -788,6 +789,7 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
|
||||||
private void zoomToZone(String zone) throws Exception {
|
private void zoomToZone(String zone) throws Exception {
|
||||||
Coordinate zoneCenter = MonitorAreaUtils.getZoneCenter(zone);
|
Coordinate zoneCenter = MonitorAreaUtils.getZoneCenter(zone);
|
||||||
if (zoneCenter == null) { // Test a newly added zone.
|
if (zoneCenter == null) { // Test a newly added zone.
|
||||||
|
configMgr = getMonitorAreaConfigInstance();
|
||||||
AreaIdXML zoneXML = configMgr.getAreaXml(zone);
|
AreaIdXML zoneXML = configMgr.getAreaXml(zone);
|
||||||
if (zoneXML != null // Coordinates do not the null values.
|
if (zoneXML != null // Coordinates do not the null values.
|
||||||
&& (zoneXML.getCLon() != null || zoneXML.getCLat() != null)) {
|
&& (zoneXML.getCLon() != null || zoneXML.getCLat() != null)) {
|
||||||
|
|
|
@ -20,9 +20,13 @@
|
||||||
package com.raytheon.uf.common.monitor.config;
|
package com.raytheon.uf.common.monitor.config;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
|
||||||
|
@ -34,6 +38,8 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel
|
||||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||||
|
import com.raytheon.uf.common.localization.SaveableOutputStream;
|
||||||
|
import com.raytheon.uf.common.localization.exception.LocalizationException;
|
||||||
import com.raytheon.uf.common.monitor.MonitorAreaUtils;
|
import com.raytheon.uf.common.monitor.MonitorAreaUtils;
|
||||||
import com.raytheon.uf.common.monitor.data.AdjacentWfoMgr;
|
import com.raytheon.uf.common.monitor.data.AdjacentWfoMgr;
|
||||||
import com.raytheon.uf.common.monitor.events.MonitorConfigEvent;
|
import com.raytheon.uf.common.monitor.events.MonitorConfigEvent;
|
||||||
|
@ -42,6 +48,7 @@ import com.raytheon.uf.common.monitor.xml.AreaIdXML;
|
||||||
import com.raytheon.uf.common.monitor.xml.AreaIdXML.ZoneType;
|
import com.raytheon.uf.common.monitor.xml.AreaIdXML.ZoneType;
|
||||||
import com.raytheon.uf.common.monitor.xml.MonAreaConfigXML;
|
import com.raytheon.uf.common.monitor.xml.MonAreaConfigXML;
|
||||||
import com.raytheon.uf.common.monitor.xml.StationIdXML;
|
import com.raytheon.uf.common.monitor.xml.StationIdXML;
|
||||||
|
import com.raytheon.uf.common.serialization.SerializationException;
|
||||||
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
|
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
|
||||||
import com.raytheon.uf.common.site.SiteMap;
|
import com.raytheon.uf.common.site.SiteMap;
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
|
@ -68,6 +75,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
* May 15 2014 3086 skorolev Renamed from MonitorConfigurationManager. Replaces three separate area configuration managers with one.
|
* May 15 2014 3086 skorolev Renamed from MonitorConfigurationManager. Replaces three separate area configuration managers with one.
|
||||||
* Sep 04 2014 3220 skorolev Added fileUpdated method.
|
* Sep 04 2014 3220 skorolev Added fileUpdated method.
|
||||||
* Feb 24 2015 3220 dhladky Made sure config file is read in on change.
|
* Feb 24 2015 3220 dhladky Made sure config file is read in on change.
|
||||||
|
* Aug 17 2015 3841 skorolev Corrected getInstance, addArea, addAdjArea and added getAdjAreaConfigXml.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -108,9 +116,6 @@ public class FSSObsMonitorConfigurationManager implements
|
||||||
/** Name of plugin */
|
/** Name of plugin */
|
||||||
private static String pluginName = null;
|
private static String pluginName = null;
|
||||||
|
|
||||||
/** Monitor name */
|
|
||||||
private static String monitorName = null;
|
|
||||||
|
|
||||||
/** Name of area configuration file */
|
/** Name of area configuration file */
|
||||||
private String configFileName = null;
|
private String configFileName = null;
|
||||||
|
|
||||||
|
@ -128,28 +133,31 @@ public class FSSObsMonitorConfigurationManager implements
|
||||||
ss, fog, snow
|
ss, fog, snow
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Default value for Timewindow in hours */
|
||||||
|
private static final double DEFAULT_TIME = 2;
|
||||||
|
|
||||||
/** Localization Area Configuration File. */
|
/** Localization Area Configuration File. */
|
||||||
private LocalizationFile lacf = null;
|
private LocalizationFile lacf = null;
|
||||||
|
|
||||||
/** Configuration XML is updated and saved */
|
/** Configuration XML is updated and saved */
|
||||||
protected boolean isPopulated;
|
protected boolean isPopulated;
|
||||||
|
|
||||||
/** Singleton instance of this class */
|
/** Map for current configuration managers. */
|
||||||
private static FSSObsMonitorConfigurationManager instance = null;
|
private final static Map<MonName, FSSObsMonitorConfigurationManager> instanceMap = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private Constructor
|
* Private Constructor
|
||||||
*
|
*
|
||||||
* @param monitorName
|
* @param monitorName
|
||||||
*/
|
*/
|
||||||
public FSSObsMonitorConfigurationManager(String monitorName) {
|
private FSSObsMonitorConfigurationManager(MonName monitorName) {
|
||||||
setMonitorName(monitorName);
|
// setMonitorName(monitorName);
|
||||||
setPopulated(false);
|
|
||||||
// Avoid confusion in file path
|
// Avoid confusion in file path
|
||||||
if (monitorName == MonName.ss.name()) {
|
if (monitorName == MonName.ss) {
|
||||||
pluginName = "safeseas";
|
pluginName = "safeseas";
|
||||||
} else {
|
} else {
|
||||||
pluginName = monitorName;
|
pluginName = monitorName.name();
|
||||||
}
|
}
|
||||||
/** Path to Monitoring Area Configuration XML. */
|
/** Path to Monitoring Area Configuration XML. */
|
||||||
setConfigFileName(pluginName + File.separatorChar + "monitoringArea"
|
setConfigFileName(pluginName + File.separatorChar + "monitoringArea"
|
||||||
|
@ -162,19 +170,21 @@ public class FSSObsMonitorConfigurationManager implements
|
||||||
configXml = new MonAreaConfigXML();
|
configXml = new MonAreaConfigXML();
|
||||||
adjAreaConfigXml = new MonAreaConfigXML();
|
adjAreaConfigXml = new MonAreaConfigXML();
|
||||||
readConfigXml();
|
readConfigXml();
|
||||||
|
setPopulated(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an instance of Configuration manager for FSSObs monitors.
|
* Returns instance of current monitor.
|
||||||
*
|
*
|
||||||
* @param monitor
|
* @param monitor
|
||||||
* Name of monitor
|
* @return
|
||||||
* @return Instance of manager
|
|
||||||
*/
|
*/
|
||||||
public static synchronized FSSObsMonitorConfigurationManager getInstance(
|
public static synchronized FSSObsMonitorConfigurationManager getInstance(
|
||||||
String monitor) {
|
MonName monitor) {
|
||||||
|
FSSObsMonitorConfigurationManager instance = instanceMap.get(monitor);
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
instance = new FSSObsMonitorConfigurationManager(monitor);
|
instance = new FSSObsMonitorConfigurationManager(monitor);
|
||||||
|
instanceMap.put(monitor, instance);
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
@ -188,17 +198,16 @@ public class FSSObsMonitorConfigurationManager implements
|
||||||
public void readConfigXml() {
|
public void readConfigXml() {
|
||||||
boolean monitorAreaFileExists = true;
|
boolean monitorAreaFileExists = true;
|
||||||
boolean adjacentAreaFileExists = true;
|
boolean adjacentAreaFileExists = true;
|
||||||
|
// Read area configuration XML file.
|
||||||
try {
|
try {
|
||||||
IPathManager pm = PathManagerFactory.getPathManager();
|
IPathManager pm = PathManagerFactory.getPathManager();
|
||||||
LocalizationContext lc = pm.getContext(
|
LocalizationContext lc = pm.getContext(
|
||||||
LocalizationType.COMMON_STATIC, LocalizationLevel.SITE);
|
LocalizationType.COMMON_STATIC, LocalizationLevel.SITE);
|
||||||
this.currentSite = lc.getContextName();
|
this.currentSite = lc.getContextName();
|
||||||
lacf = pm.getLocalizationFile(lc, configFileName);
|
lacf = pm.getLocalizationFile(lc, configFileName);
|
||||||
String monitorAreaFilePath = lacf.getFile().getAbsolutePath();
|
InputStream inStrm = lacf.openInputStream();
|
||||||
MonAreaConfigXML configXmltmp = jaxb
|
configXml = (MonAreaConfigXML) jaxb
|
||||||
.unmarshalFromXmlFile(monitorAreaFilePath.toString());
|
.unmarshalFromInputStream(inStrm);
|
||||||
configXml = configXmltmp;
|
|
||||||
setPopulated(true);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
statusHandler
|
statusHandler
|
||||||
.handle(Priority.WARN,
|
.handle(Priority.WARN,
|
||||||
|
@ -208,7 +217,7 @@ public class FSSObsMonitorConfigurationManager implements
|
||||||
+ "");
|
+ "");
|
||||||
monitorAreaFileExists = false;
|
monitorAreaFileExists = false;
|
||||||
}
|
}
|
||||||
|
// Read adjacent area configuration XML file.
|
||||||
try {
|
try {
|
||||||
IPathManager pm = PathManagerFactory.getPathManager();
|
IPathManager pm = PathManagerFactory.getPathManager();
|
||||||
String adjacentAreaFilePath = pm.getFile(
|
String adjacentAreaFilePath = pm.getFile(
|
||||||
|
@ -218,7 +227,6 @@ public class FSSObsMonitorConfigurationManager implements
|
||||||
MonAreaConfigXML configXmltmp = jaxb
|
MonAreaConfigXML configXmltmp = jaxb
|
||||||
.unmarshalFromXmlFile(adjacentAreaFilePath.toString());
|
.unmarshalFromXmlFile(adjacentAreaFilePath.toString());
|
||||||
adjAreaConfigXml = configXmltmp;
|
adjAreaConfigXml = configXmltmp;
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
statusHandler
|
statusHandler
|
||||||
.handle(Priority.WARN,
|
.handle(Priority.WARN,
|
||||||
|
@ -276,9 +284,7 @@ public class FSSObsMonitorConfigurationManager implements
|
||||||
configXml.addAreaId(zoneXml);
|
configXml.addAreaId(zoneXml);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Default value for Timewindow.
|
configXml.setTimeWindow(DEFAULT_TIME);
|
||||||
int defaultVal = 2;
|
|
||||||
configXml.setTimeWindow(defaultVal);
|
|
||||||
saveConfigXml();
|
saveConfigXml();
|
||||||
}
|
}
|
||||||
// Check for an adjacent area config file, if one does not exist,
|
// Check for an adjacent area config file, if one does not exist,
|
||||||
|
@ -311,26 +317,26 @@ public class FSSObsMonitorConfigurationManager implements
|
||||||
/**
|
/**
|
||||||
* Saves the monitor area XML configuration data to the current XML file
|
* Saves the monitor area XML configuration data to the current XML file
|
||||||
* name.
|
* name.
|
||||||
|
*
|
||||||
|
* @throws LocalizationException
|
||||||
|
* @throws SerializationException
|
||||||
*/
|
*/
|
||||||
public void saveConfigXml() {
|
public void saveConfigXml() throws LocalizationException,
|
||||||
|
SerializationException {
|
||||||
// Save the xml object to disk
|
// Save the xml object to disk
|
||||||
IPathManager pm = PathManagerFactory.getPathManager();
|
IPathManager pm = PathManagerFactory.getPathManager();
|
||||||
LocalizationContext lc = pm.getContext(LocalizationType.COMMON_STATIC,
|
LocalizationContext lc = pm.getContext(LocalizationType.COMMON_STATIC,
|
||||||
LocalizationLevel.SITE);
|
LocalizationLevel.SITE);
|
||||||
LocalizationFile newXmlFile = pm.getLocalizationFile(lc,
|
LocalizationFile newXmlFile = pm.getLocalizationFile(lc,
|
||||||
getConfigFileName());
|
getConfigFileName());
|
||||||
if (newXmlFile.getFile().getParentFile().exists() == false) {
|
|
||||||
newXmlFile.getFile().getParentFile().mkdirs();
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
jaxb.marshalToXmlFile(configXml, newXmlFile.getFile()
|
SaveableOutputStream outStrm = newXmlFile.openOutputStream();
|
||||||
.getAbsolutePath());
|
jaxb.marshalToStream(configXml, outStrm);
|
||||||
newXmlFile.save();
|
outStrm.save();
|
||||||
lacf = newXmlFile;
|
} catch (IOException e) {
|
||||||
lacf.addFileUpdatedObserver(this);
|
statusHandler.handle(Priority.ERROR,
|
||||||
setPopulated(true);
|
"There is a problem to save configuration XML file: "
|
||||||
} catch (Exception e) {
|
+ getConfigFileName(), e);
|
||||||
statusHandler.handle(Priority.ERROR, e.getMessage());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,53 +345,40 @@ public class FSSObsMonitorConfigurationManager implements
|
||||||
* name.
|
* name.
|
||||||
*
|
*
|
||||||
* @param filename
|
* @param filename
|
||||||
* adjacentAreaConfig.xml
|
* adjacentAreaConfig.xml adjAreaConfigXml
|
||||||
|
* @throws SerializationException
|
||||||
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void saveAdjacentAreaConfigXml() {
|
public void saveAdjacentAreaConfigXml() throws SerializationException,
|
||||||
|
LocalizationException, IOException {
|
||||||
// Save the xml object to disk
|
// Save the xml object to disk
|
||||||
IPathManager pm = PathManagerFactory.getPathManager();
|
IPathManager pm = PathManagerFactory.getPathManager();
|
||||||
LocalizationContext lc = pm.getContext(LocalizationType.COMMON_STATIC,
|
LocalizationContext lc = pm.getContext(LocalizationType.COMMON_STATIC,
|
||||||
LocalizationLevel.SITE);
|
LocalizationLevel.SITE);
|
||||||
LocalizationFile newXmlFile = pm.getLocalizationFile(lc,
|
LocalizationFile newXmlFile = pm.getLocalizationFile(lc,
|
||||||
getAdjAreaConfigFileName());
|
getAdjAreaConfigFileName());
|
||||||
if (newXmlFile.getFile().getParentFile().exists() == false) {
|
|
||||||
newXmlFile.getFile().getParentFile().mkdirs();
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
jaxb.marshalToXmlFile(adjAreaConfigXml, newXmlFile.getFile()
|
SaveableOutputStream outStrm = newXmlFile.openOutputStream();
|
||||||
.getAbsolutePath());
|
jaxb.marshalToStream(adjAreaConfigXml, outStrm);
|
||||||
newXmlFile.save();
|
outStrm.save();
|
||||||
} catch (Exception e) {
|
} catch (LocalizationException e) {
|
||||||
statusHandler.handle(Priority.ERROR, e.getMessage());
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
|
"There is a problem to save configuration XML file: "
|
||||||
|
+ getAdjAreaConfigFileName(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new Area to the configuration. This method only adds the area, the
|
* Adds Area XML.
|
||||||
* other info will need to be added to the area via the other methods in
|
|
||||||
* this class.
|
|
||||||
*
|
*
|
||||||
* @param areaId
|
* @param areaXML
|
||||||
* @param type
|
|
||||||
* Type of zone
|
|
||||||
*/
|
*/
|
||||||
public void addArea(String areaId, ZoneType type) {
|
public void addArea(AreaIdXML areaXML) {
|
||||||
List<AreaIdXML> areaXmlList = configXml.getAreaIds();
|
List<AreaIdXML> areaXmlList = configXml.getAreaIds();
|
||||||
boolean areaExists = false;
|
if (!areaXmlList.contains(areaXML)) {
|
||||||
for (AreaIdXML area : areaXmlList) {
|
configXml.addAreaId(areaXML);
|
||||||
if (area.getAreaId().equals(areaId)) {
|
if (!addedZones.contains(areaXML.getAreaId())) {
|
||||||
area.setType(type);
|
addedZones.add(areaXML.getAreaId());
|
||||||
areaExists = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (areaExists == false) {
|
|
||||||
AreaIdXML area = new AreaIdXML();
|
|
||||||
area.setAreaId(areaId);
|
|
||||||
area.setType(type);
|
|
||||||
configXml.addAreaId(area);
|
|
||||||
if (!addedZones.contains(areaId)) {
|
|
||||||
addedZones.add(areaId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -404,7 +397,7 @@ public class FSSObsMonitorConfigurationManager implements
|
||||||
* @param type
|
* @param type
|
||||||
* The area type
|
* The area type
|
||||||
*/
|
*/
|
||||||
public void addArea(String areaId, double lat, double lon, ZoneType type) {
|
public void addNewArea(String areaId, double lat, double lon, ZoneType type) {
|
||||||
List<AreaIdXML> areaXmlList = configXml.getAreaIds();
|
List<AreaIdXML> areaXmlList = configXml.getAreaIds();
|
||||||
boolean areaExists = false;
|
boolean areaExists = false;
|
||||||
for (AreaIdXML area : areaXmlList) {
|
for (AreaIdXML area : areaXmlList) {
|
||||||
|
@ -440,12 +433,15 @@ public class FSSObsMonitorConfigurationManager implements
|
||||||
* The station id
|
* The station id
|
||||||
* @param type
|
* @param type
|
||||||
* The station type
|
* The station type
|
||||||
* @param existingStation
|
* @param added
|
||||||
* Does the station already exist
|
* Station has been added (true | false)
|
||||||
*/
|
*/
|
||||||
public void addStation(String areaId, String stationId, String type,
|
public void addNewStation(String areaId, String stationId, String type,
|
||||||
boolean existingStation) {
|
boolean added) {
|
||||||
List<AreaIdXML> areaList = configXml.getAreaIds();
|
List<AreaIdXML> areaList = configXml.getAreaIds();
|
||||||
|
if (!configXml.containsArea(areaId)) {
|
||||||
|
areaList = adjAreaConfigXml.getAreaIds();
|
||||||
|
}
|
||||||
if (stationId.contains("#")) {
|
if (stationId.contains("#")) {
|
||||||
stationId = stationId.substring(0, stationId.indexOf("#"));
|
stationId = stationId.substring(0, stationId.indexOf("#"));
|
||||||
}
|
}
|
||||||
|
@ -454,8 +450,13 @@ public class FSSObsMonitorConfigurationManager implements
|
||||||
StationIdXML stationXml = new StationIdXML();
|
StationIdXML stationXml = new StationIdXML();
|
||||||
stationXml.setName(stationId);
|
stationXml.setName(stationId);
|
||||||
stationXml.setType(type);
|
stationXml.setType(type);
|
||||||
|
if (added) {
|
||||||
|
stationXml.setAdded(added);
|
||||||
|
}
|
||||||
area.addStationIdXml(stationXml);
|
area.addStationIdXml(stationXml);
|
||||||
addedStations.add(stationId + "#" + type);
|
if (!addedStations.contains(stationId)) {
|
||||||
|
addedStations.add(stationId + "#" + type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -553,9 +554,11 @@ public class FSSObsMonitorConfigurationManager implements
|
||||||
List<AreaIdXML> areaList = configXml.getAreaIds();
|
List<AreaIdXML> areaList = configXml.getAreaIds();
|
||||||
for (AreaIdXML area : areaList) {
|
for (AreaIdXML area : areaList) {
|
||||||
List<StationIdXML> stationList = area.getStationIds();
|
List<StationIdXML> stationList = area.getStationIds();
|
||||||
for (StationIdXML station : stationList) {
|
if (!stationList.isEmpty()) {
|
||||||
if (station.getName().equals(stationId)) {
|
for (StationIdXML station : stationList) {
|
||||||
results.add(area.getAreaId());
|
if (station.getName().equals(stationId)) {
|
||||||
|
results.add(area.getAreaId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -565,7 +568,7 @@ public class FSSObsMonitorConfigurationManager implements
|
||||||
/**
|
/**
|
||||||
* Gets all the stations associated with the areas.
|
* Gets all the stations associated with the areas.
|
||||||
*
|
*
|
||||||
* @return List of stations
|
* @return List of stations with type
|
||||||
*/
|
*/
|
||||||
public List<String> getStations() {
|
public List<String> getStations() {
|
||||||
List<AreaIdXML> areaXml = configXml.getAreaIds();
|
List<AreaIdXML> areaXml = configXml.getAreaIds();
|
||||||
|
@ -590,13 +593,31 @@ public class FSSObsMonitorConfigurationManager implements
|
||||||
Set<String> stations = new HashSet<String>();
|
Set<String> stations = new HashSet<String>();
|
||||||
for (AreaIdXML area : areaXml) {
|
for (AreaIdXML area : areaXml) {
|
||||||
List<StationIdXML> stationList = area.getStationIds();
|
List<StationIdXML> stationList = area.getStationIds();
|
||||||
for (StationIdXML station : stationList) {
|
if (!stationList.isEmpty()) {
|
||||||
stations.add(station.getName());
|
for (StationIdXML station : stationList) {
|
||||||
|
stations.add(station.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return stations;
|
return stations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getNewlyAddedStations(List<AreaIdXML> areaXml) {
|
||||||
|
ArrayList<String> retVal = new ArrayList<String>();
|
||||||
|
for (AreaIdXML area : areaXml) {
|
||||||
|
List<StationIdXML> stationList = area.getStationIds();
|
||||||
|
if (!stationList.isEmpty()) {
|
||||||
|
for (StationIdXML stn : stationList) {
|
||||||
|
if (stn.isAdded()) {
|
||||||
|
retVal.add(stn.getName() + "#" + stn.getType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a list of all monitoring areas.
|
* Gets a list of all monitoring areas.
|
||||||
*
|
*
|
||||||
|
@ -633,37 +654,41 @@ public class FSSObsMonitorConfigurationManager implements
|
||||||
* @param station
|
* @param station
|
||||||
* Station to remove from the area
|
* Station to remove from the area
|
||||||
*/
|
*/
|
||||||
public void removeStation(String area, String station) {
|
public void removeStationFromArea(String area, String station) {
|
||||||
station = station.substring(0, station.indexOf("#"));
|
|
||||||
List<AreaIdXML> areaList = configXml.getAreaIds();
|
List<AreaIdXML> areaList = configXml.getAreaIds();
|
||||||
for (AreaIdXML areaXml : areaList) {
|
for (AreaIdXML areaXml : areaList) {
|
||||||
if (areaXml.getAreaId().equals(area)) {
|
if (areaXml.getAreaId().equals(area)) {
|
||||||
List<StationIdXML> stationList = areaXml.getStationIds();
|
List<StationIdXML> stationList = areaXml.getStationIds();
|
||||||
for (int i = 0; i < stationList.size(); i++) {
|
if (!stationList.isEmpty()) {
|
||||||
if (stationList.get(i).getName().equals(station)) {
|
for (int i = 0; i < stationList.size(); i++) {
|
||||||
stationList.remove(i);
|
StationIdXML stationXml = stationList.get(i);
|
||||||
areaXml.getStationIds();
|
if (stationXml.getName().equals(station.split("#")[0])) {
|
||||||
|
stationList.remove(i);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a station from the monitoring area.
|
* Removes a station from all monitoring areas.
|
||||||
*
|
*
|
||||||
* @param station
|
* @param station
|
||||||
* The station to remove
|
* The station to remove
|
||||||
*/
|
*/
|
||||||
public void removeStation(String station) {
|
public void removeStation(String station, List<AreaIdXML> areaListXML) {
|
||||||
List<AreaIdXML> areaList = configXml.getAreaIds();
|
for (AreaIdXML areaXML : areaListXML) {
|
||||||
for (AreaIdXML areaXml : areaList) {
|
List<StationIdXML> stationList = areaXML.getStationIds();
|
||||||
List<StationIdXML> stationList = areaXml.getStationIds();
|
if (!stationList.isEmpty()) {
|
||||||
for (int i = 0; i < stationList.size(); i++) {
|
for (int i = 0; i < stationList.size(); i++) {
|
||||||
StationIdXML stationXml = stationList.get(i);
|
StationIdXML stationXml = stationList.get(i);
|
||||||
if (stationXml.getName().equals(station)) {
|
if (stationXml.getName().equals(station)) {
|
||||||
stationList.remove(i);
|
stationList.remove(i);
|
||||||
i--;
|
i--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -687,39 +712,69 @@ public class FSSObsMonitorConfigurationManager implements
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes an area from the monitoring area.
|
* Gets an AdjAreaXml.
|
||||||
|
*
|
||||||
|
* @param zone
|
||||||
|
* from additional list
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public AreaIdXML getAdjAreaXML(String zone) {
|
||||||
|
List<AreaIdXML> areaList = adjAreaConfigXml.getAreaIds();
|
||||||
|
for (AreaIdXML adjAreaXml : areaList) {
|
||||||
|
if (adjAreaXml.getAreaId().equals(zone)) {
|
||||||
|
return adjAreaXml;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes an area XML from the area configuration.
|
||||||
*
|
*
|
||||||
* @param area
|
* @param area
|
||||||
* The area to remove
|
* The area to remove
|
||||||
*/
|
*/
|
||||||
public void removeArea(String area) {
|
public void removeArea(AreaIdXML area) {
|
||||||
List<AreaIdXML> areaList = configXml.getAreaIds();
|
List<AreaIdXML> areaList = configXml.getAreaIds();
|
||||||
for (int i = 0; i < areaList.size(); i++) {
|
if (areaList.contains(area)) {
|
||||||
if (areaList.get(i).getAreaId().equals(area)) {
|
areaList.remove(area);
|
||||||
areaList.remove(i);
|
if (addedZones.contains(area.getAreaId())) {
|
||||||
break;
|
addedZones.remove(area.getAreaId());
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int i = 0; i < addedZones.size(); i++) {
|
|
||||||
if (addedZones.get(i).equals(area)) {
|
|
||||||
addedZones.remove(i);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes an added area.
|
* Replaces existing area XML in the area configuration.
|
||||||
*
|
*
|
||||||
* @param area
|
* @param areaOld
|
||||||
* The area to remove
|
* @param areaNew
|
||||||
*/
|
*/
|
||||||
public void removeAddedArea(String area) {
|
public void replaceArea(AreaIdXML areaOld, AreaIdXML areaNew) {
|
||||||
for (int i = 0; i < addedZones.size(); i++) {
|
List<AreaIdXML> areaList = configXml.getAreaIds();
|
||||||
if (addedZones.get(i).equals(area)) {
|
int idx = areaList.indexOf(areaOld);
|
||||||
addedZones.remove(i);
|
areaList.set(idx, areaNew);
|
||||||
break;
|
if (addedZones.contains(areaOld)) {
|
||||||
}
|
addedZones.set(addedZones.indexOf(areaOld), areaNew.getAreaId());
|
||||||
|
} else {
|
||||||
|
addedZones.add(areaNew.getAreaId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replaces existing area XML in the adjusted area configuration
|
||||||
|
*
|
||||||
|
* @param areaOld
|
||||||
|
* @param areaNew
|
||||||
|
*/
|
||||||
|
public void replaceAdjArea(AreaIdXML areaOld, AreaIdXML areaNew) {
|
||||||
|
List<AreaIdXML> areaList = adjAreaConfigXml.getAreaIds();
|
||||||
|
int idx = areaList.indexOf(areaOld);
|
||||||
|
areaList.set(idx, areaNew);
|
||||||
|
if (addedZones.contains(areaOld)) {
|
||||||
|
addedZones.set(addedZones.indexOf(areaOld), areaNew.getAreaId());
|
||||||
|
} else {
|
||||||
|
addedZones.add(areaNew.getAreaId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -789,6 +844,15 @@ public class FSSObsMonitorConfigurationManager implements
|
||||||
return configXml;
|
return configXml;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets Adjacent Configuration Xml
|
||||||
|
*
|
||||||
|
* @return the adjAreaConfigXml
|
||||||
|
*/
|
||||||
|
public MonAreaConfigXML getAdjAreaConfigXml() {
|
||||||
|
return adjAreaConfigXml;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets Added Zones
|
* Gets Added Zones
|
||||||
*
|
*
|
||||||
|
@ -839,13 +903,15 @@ public class FSSObsMonitorConfigurationManager implements
|
||||||
String result = null;
|
String result = null;
|
||||||
List<AreaIdXML> areaList = configXml.getAreaIds();
|
List<AreaIdXML> areaList = configXml.getAreaIds();
|
||||||
for (AreaIdXML area : areaList) {
|
for (AreaIdXML area : areaList) {
|
||||||
if (area.getAreaId().equals(theZone)) {
|
if (area.getAreaId().equals(theZone)
|
||||||
|
&& area.containsStation(theStation)) {
|
||||||
List<StationIdXML> stationList = area.getStationIds();
|
List<StationIdXML> stationList = area.getStationIds();
|
||||||
for (StationIdXML station : stationList) {
|
for (StationIdXML station : stationList) {
|
||||||
if (station.getName().equals(theStation)) {
|
if (station.getName().equals(theStation)) {
|
||||||
return station.getType();
|
result = station.getType();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -937,24 +1003,6 @@ public class FSSObsMonitorConfigurationManager implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets Monitor Name.
|
|
||||||
*
|
|
||||||
* @return monitor name
|
|
||||||
*/
|
|
||||||
public String getMonitorName() {
|
|
||||||
return monitorName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets Monitor Name.
|
|
||||||
*
|
|
||||||
* @param monitorName
|
|
||||||
*/
|
|
||||||
public void setMonitorName(String monitorName) {
|
|
||||||
FSSObsMonitorConfigurationManager.monitorName = monitorName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag is true if config file updated and saved.
|
* Flag is true if config file updated and saved.
|
||||||
*
|
*
|
||||||
|
@ -974,41 +1022,42 @@ public class FSSObsMonitorConfigurationManager implements
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove Adjacent Area.
|
* Remove Adjacent Area XML.
|
||||||
*
|
*
|
||||||
* @param zone
|
* @param zone
|
||||||
*/
|
*/
|
||||||
public void removeAdjArea(String zone) {
|
public void removeAdjArea(AreaIdXML zone) {
|
||||||
List<AreaIdXML> adjAreaList = adjAreaConfigXml.getAreaIds();
|
List<AreaIdXML> adjAreaList = adjAreaConfigXml.getAreaIds();
|
||||||
for (int i = 0; i < adjAreaList.size(); i++) {
|
if (adjAreaList.contains(zone)) {
|
||||||
if (adjAreaList.get(i).getAreaId().equals(zone)) {
|
adjAreaList.remove(zone);
|
||||||
adjAreaList.remove(i);
|
if (addedZones.contains(zone.getAreaId())) {
|
||||||
break;
|
addedZones.remove(zone.getAreaId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add Adjacent Area.
|
* Add Adjacent Area XML.
|
||||||
*
|
*
|
||||||
* @param areaId
|
* @param areaXML
|
||||||
* @param type
|
|
||||||
*/
|
*/
|
||||||
public void addAdjArea(String areaId, ZoneType type) {
|
public void addAdjArea(AreaIdXML areaXML) {
|
||||||
List<AreaIdXML> adjAreaList = adjAreaConfigXml.getAreaIds();
|
List<AreaIdXML> adjAreaList = adjAreaConfigXml.getAreaIds();
|
||||||
boolean areaExists = false;
|
if (!adjAreaList.contains(areaXML)) {
|
||||||
for (AreaIdXML area : adjAreaList) {
|
adjAreaConfigXml.addAreaId(areaXML);
|
||||||
if (area.getAreaId().equals(areaId)) {
|
|
||||||
area.setType(type);
|
|
||||||
areaExists = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (areaExists == false) {
|
|
||||||
AreaIdXML area = new AreaIdXML();
|
|
||||||
area.setAreaId(areaId);
|
|
||||||
area.setType(type);
|
|
||||||
adjAreaConfigXml.addAreaId(area);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets configuration manager for monitor.
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static FSSObsMonitorConfigurationManager getObsManager(
|
||||||
|
MonName monitor) {
|
||||||
|
FSSObsMonitorConfigurationManager instance = getInstance(monitor);
|
||||||
|
instance.readConfigXml();
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
package com.raytheon.uf.common.monitor.xml;
|
package com.raytheon.uf.common.monitor.xml;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
@ -36,6 +38,7 @@ import javax.xml.bind.annotation.XmlElements;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Dec 21, 2009 lvenable Initial creation
|
* Dec 21, 2009 lvenable Initial creation
|
||||||
|
* Sep 03, 2015 3841 skorolev Added containsStation method
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -46,7 +49,7 @@ import javax.xml.bind.annotation.XmlElements;
|
||||||
public class AreaIdXML {
|
public class AreaIdXML {
|
||||||
|
|
||||||
@XmlElements({ @XmlElement(name = "StationID", type = StationIdXML.class) })
|
@XmlElements({ @XmlElement(name = "StationID", type = StationIdXML.class) })
|
||||||
private ArrayList<StationIdXML> stationIds = new ArrayList<StationIdXML>();
|
private List<StationIdXML> stationIds = new ArrayList<StationIdXML>();
|
||||||
|
|
||||||
@XmlAttribute(name = "id")
|
@XmlAttribute(name = "id")
|
||||||
private String areaId;
|
private String areaId;
|
||||||
|
@ -67,11 +70,11 @@ public class AreaIdXML {
|
||||||
public AreaIdXML() {
|
public AreaIdXML() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<StationIdXML> getStationIds() {
|
public List<StationIdXML> getStationIds() {
|
||||||
return stationIds;
|
return stationIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStationIds(ArrayList<StationIdXML> stationIds) {
|
public void setStationIds(List<StationIdXML> stationIds) {
|
||||||
this.stationIds = stationIds;
|
this.stationIds = stationIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,4 +141,21 @@ public class AreaIdXML {
|
||||||
public void setCLon(Double lon) {
|
public void setCLon(Double lon) {
|
||||||
cLon = lon;
|
cLon = lon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param station
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean containsStation(String station) {
|
||||||
|
if (!stationIds.isEmpty()) {
|
||||||
|
Iterator<StationIdXML> itr = getStationIds().iterator();
|
||||||
|
while (itr.hasNext()) {
|
||||||
|
if (itr.next().getName().equals(station)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
package com.raytheon.uf.common.monitor.xml;
|
package com.raytheon.uf.common.monitor.xml;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
@ -37,6 +39,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Dec 21, 2009 lvenable Initial creation
|
* Dec 21, 2009 lvenable Initial creation
|
||||||
* May 15, 2014 3086 skorolev Changed type for timeWindow element.
|
* May 15, 2014 3086 skorolev Changed type for timeWindow element.
|
||||||
|
* Sep 03, 2015 3841 skorolev Added containsArea method.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -48,7 +51,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||||
public class MonAreaConfigXML {
|
public class MonAreaConfigXML {
|
||||||
|
|
||||||
@XmlElements({ @XmlElement(name = "AreaID", type = AreaIdXML.class) })
|
@XmlElements({ @XmlElement(name = "AreaID", type = AreaIdXML.class) })
|
||||||
private ArrayList<AreaIdXML> areaIds = new ArrayList<AreaIdXML>();
|
private List<AreaIdXML> areaIds = new ArrayList<AreaIdXML>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time period in minutes during which stations are monitoring.
|
* Time period in minutes during which stations are monitoring.
|
||||||
|
@ -71,7 +74,7 @@ public class MonAreaConfigXML {
|
||||||
public MonAreaConfigXML() {
|
public MonAreaConfigXML() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<AreaIdXML> getAreaIds() {
|
public List<AreaIdXML> getAreaIds() {
|
||||||
return areaIds;
|
return areaIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,4 +133,21 @@ public class MonAreaConfigXML {
|
||||||
public void addAreaId(AreaIdXML areaXml) {
|
public void addAreaId(AreaIdXML areaXml) {
|
||||||
areaIds.add(areaXml);
|
areaIds.add(areaXml);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if areaXML exist for area ID.
|
||||||
|
*
|
||||||
|
* @param area
|
||||||
|
* area ID
|
||||||
|
* @return areaXML
|
||||||
|
*/
|
||||||
|
public boolean containsArea(String areaId) {
|
||||||
|
Iterator<AreaIdXML> itr = getAreaIds().iterator();
|
||||||
|
while (itr.hasNext()) {
|
||||||
|
if (itr.next().getAreaId().equals(areaId)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,8 @@ import javax.xml.bind.annotation.XmlAttribute;
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Dec 21, 2009 lvenable Initial creation
|
* Dec 21, 2009 lvenable Initial creation
|
||||||
|
* Aug 25, 2015 3481 skorolev Added attribute "added"
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -47,6 +48,9 @@ public class StationIdXML {
|
||||||
@XmlAttribute(name = "name")
|
@XmlAttribute(name = "name")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@XmlAttribute(name = "added", required = false)
|
||||||
|
private boolean added;
|
||||||
|
|
||||||
public static final String MARITIME = "MARITIME";
|
public static final String MARITIME = "MARITIME";
|
||||||
|
|
||||||
public static final String METAR = "METAR";
|
public static final String METAR = "METAR";
|
||||||
|
@ -79,4 +83,12 @@ public class StationIdXML {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isAdded() {
|
||||||
|
return added;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAdded(boolean added) {
|
||||||
|
this.added = added;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,7 @@ import com.raytheon.uf.edex.menus.AbstractMenuUtil;
|
||||||
* Configuration Manager has not read a
|
* Configuration Manager has not read a
|
||||||
* FFMPRunConfig.xml file.
|
* FFMPRunConfig.xml file.
|
||||||
* Sep 04, 2014 3220 skorolev Updated menu creation for Fog, Safeseas and Snow monitors.
|
* Sep 04, 2014 3220 skorolev Updated menu creation for Fog, Safeseas and Snow monitors.
|
||||||
|
* Sep 03, 2015 3841 skorolev Corrected getInstance for Fog, Safeseas and Snow monitors.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -483,26 +484,26 @@ public class DatMenuUtil extends AbstractMenuUtil {
|
||||||
*/
|
*/
|
||||||
private void createSafeseasMenu() {
|
private void createSafeseasMenu() {
|
||||||
FSSObsMonitorConfigurationManager ssConfig = FSSObsMonitorConfigurationManager
|
FSSObsMonitorConfigurationManager ssConfig = FSSObsMonitorConfigurationManager
|
||||||
.getInstance(MonName.ss.name());
|
.getInstance(MonName.ss);
|
||||||
Set<String> ssStns = ssConfig.getStationIDs();
|
Set<String> ssStns = ssConfig.getStationIDs();
|
||||||
StringBuilder stations = new StringBuilder();
|
StringBuilder stations = new StringBuilder();
|
||||||
for (String s : ssStns) {
|
for (String s : ssStns) {
|
||||||
if (stations.length() > 0) {
|
if (stations.length() > 0) {
|
||||||
stations.append(",");
|
stations.append(",");
|
||||||
}
|
|
||||||
stations.append(s);
|
|
||||||
}
|
}
|
||||||
String ssStations = stations.toString();
|
stations.append(s);
|
||||||
CommonMenuContributionFile safeMenuContributionFile = new CommonMenuContributionFile();
|
}
|
||||||
safeMenuContributionFile.contribution = new CommonIncludeMenuItem[1];
|
String ssStations = stations.toString();
|
||||||
safeMenuContributionFile.contribution[0] = new CommonIncludeMenuItem();
|
CommonMenuContributionFile safeMenuContributionFile = new CommonMenuContributionFile();
|
||||||
safeMenuContributionFile.contribution[0] = processOtherContribution(
|
safeMenuContributionFile.contribution = new CommonIncludeMenuItem[1];
|
||||||
ssStations, "menus/safeseas/baseSafeSeas.xml",
|
safeMenuContributionFile.contribution[0] = new CommonIncludeMenuItem();
|
||||||
"menu:obs?before=EndOfMaritime", "SAFESEAS",
|
safeMenuContributionFile.contribution[0] = processOtherContribution(
|
||||||
safeMenuContributionFile.contribution[0]);
|
ssStations, "menus/safeseas/baseSafeSeas.xml",
|
||||||
toXml(safeMenuContributionFile, "menus" + File.separator
|
"menu:obs?before=EndOfMaritime", "SAFESEAS",
|
||||||
+ "safeseas" + File.separator + "index.xml");
|
safeMenuContributionFile.contribution[0]);
|
||||||
ssConfig = null;
|
toXml(safeMenuContributionFile, "menus" + File.separator + "safeseas"
|
||||||
|
+ File.separator + "index.xml");
|
||||||
|
ssConfig = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -510,26 +511,26 @@ public class DatMenuUtil extends AbstractMenuUtil {
|
||||||
*/
|
*/
|
||||||
private void createFogMenu() {
|
private void createFogMenu() {
|
||||||
FSSObsMonitorConfigurationManager fogConfig = FSSObsMonitorConfigurationManager
|
FSSObsMonitorConfigurationManager fogConfig = FSSObsMonitorConfigurationManager
|
||||||
.getInstance(MonName.fog.name());
|
.getInstance(MonName.fog);
|
||||||
Set<String> fogStns = fogConfig.getStationIDs();
|
Set<String> fogStns = fogConfig.getStationIDs();
|
||||||
StringBuilder stations = new StringBuilder();
|
StringBuilder stations = new StringBuilder();
|
||||||
for (String s : fogStns) {
|
for (String s : fogStns) {
|
||||||
if (stations.length() > 0) {
|
if (stations.length() > 0) {
|
||||||
stations.append(",");
|
stations.append(",");
|
||||||
}
|
|
||||||
stations.append(s);
|
|
||||||
}
|
}
|
||||||
String fogStations = stations.toString();
|
stations.append(s);
|
||||||
CommonMenuContributionFile fogMenuContributionFile = new CommonMenuContributionFile();
|
}
|
||||||
fogMenuContributionFile.contribution = new CommonIncludeMenuItem[1];
|
String fogStations = stations.toString();
|
||||||
fogMenuContributionFile.contribution[0] = new CommonIncludeMenuItem();
|
CommonMenuContributionFile fogMenuContributionFile = new CommonMenuContributionFile();
|
||||||
fogMenuContributionFile.contribution[0] = processOtherContribution(
|
fogMenuContributionFile.contribution = new CommonIncludeMenuItem[1];
|
||||||
fogStations, "menus/fog/baseFog.xml",
|
fogMenuContributionFile.contribution[0] = new CommonIncludeMenuItem();
|
||||||
"menu:obs?after=FOGPLACEHOLDER", "Fog Monitor",
|
fogMenuContributionFile.contribution[0] = processOtherContribution(
|
||||||
fogMenuContributionFile.contribution[0]);
|
fogStations, "menus/fog/baseFog.xml",
|
||||||
toXml(fogMenuContributionFile, "menus" + File.separator + "fog"
|
"menu:obs?after=FOGPLACEHOLDER", "Fog Monitor",
|
||||||
+ File.separator + "index.xml");
|
fogMenuContributionFile.contribution[0]);
|
||||||
fogConfig = null;
|
toXml(fogMenuContributionFile, "menus" + File.separator + "fog"
|
||||||
|
+ File.separator + "index.xml");
|
||||||
|
fogConfig = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -537,26 +538,26 @@ public class DatMenuUtil extends AbstractMenuUtil {
|
||||||
*/
|
*/
|
||||||
private void createSnowMenu() {
|
private void createSnowMenu() {
|
||||||
FSSObsMonitorConfigurationManager snowConfig = FSSObsMonitorConfigurationManager
|
FSSObsMonitorConfigurationManager snowConfig = FSSObsMonitorConfigurationManager
|
||||||
.getInstance(MonName.snow.name());
|
.getInstance(MonName.snow);
|
||||||
Set<String> snowStns = snowConfig.getStationIDs();
|
Set<String> snowStns = snowConfig.getStationIDs();
|
||||||
StringBuilder stations = new StringBuilder();
|
StringBuilder stations = new StringBuilder();
|
||||||
for (String s : snowStns) {
|
for (String s : snowStns) {
|
||||||
if (stations.length() > 0) {
|
if (stations.length() > 0) {
|
||||||
stations.append(",");
|
stations.append(",");
|
||||||
}
|
|
||||||
stations.append(s);
|
|
||||||
}
|
}
|
||||||
String snowStations = stations.toString();
|
stations.append(s);
|
||||||
CommonMenuContributionFile snowMenuContributionFile = new CommonMenuContributionFile();
|
}
|
||||||
snowMenuContributionFile.contribution = new CommonIncludeMenuItem[1];
|
String snowStations = stations.toString();
|
||||||
snowMenuContributionFile.contribution[0] = new CommonIncludeMenuItem();
|
CommonMenuContributionFile snowMenuContributionFile = new CommonMenuContributionFile();
|
||||||
snowMenuContributionFile.contribution[0] = processOtherContribution(
|
snowMenuContributionFile.contribution = new CommonIncludeMenuItem[1];
|
||||||
snowStations, "menus/snow/baseSnow.xml",
|
snowMenuContributionFile.contribution[0] = new CommonIncludeMenuItem();
|
||||||
"menu:obs?after=SNOWPLACEHOLDER", "SNOW",
|
snowMenuContributionFile.contribution[0] = processOtherContribution(
|
||||||
snowMenuContributionFile.contribution[0]);
|
snowStations, "menus/snow/baseSnow.xml",
|
||||||
toXml(snowMenuContributionFile, "menus" + File.separator + "snow"
|
"menu:obs?after=SNOWPLACEHOLDER", "SNOW",
|
||||||
+ File.separator + "index.xml");
|
snowMenuContributionFile.contribution[0]);
|
||||||
snowConfig = null;
|
toXml(snowMenuContributionFile, "menus" + File.separator + "snow"
|
||||||
|
+ File.separator + "index.xml");
|
||||||
|
snowConfig = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -51,6 +51,7 @@ import com.raytheon.uf.edex.plugin.fssobs.common.FSSObsConfig;
|
||||||
* May 23, 2014 3086 skorolev Cleaned code.
|
* May 23, 2014 3086 skorolev Cleaned code.
|
||||||
* Aug 18, 2014 3530 bclement removed constructDataURI() call
|
* Aug 18, 2014 3530 bclement removed constructDataURI() call
|
||||||
* Sep 04, 2014 3220 skorolev Replaced 3 URI filters with one.
|
* Sep 04, 2014 3220 skorolev Replaced 3 URI filters with one.
|
||||||
|
* Sep 03, 2015 3841 skorolev Corrected getInstance.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -141,7 +142,7 @@ public class FSSObsGenerator extends CompositeProductGenerator implements
|
||||||
allStations = new HashSet<String>();
|
allStations = new HashSet<String>();
|
||||||
|
|
||||||
for (MonName mname : MonName.values()) {
|
for (MonName mname : MonName.values()) {
|
||||||
currManager = new FSSObsMonitorConfigurationManager(mname.name());
|
currManager = FSSObsMonitorConfigurationManager.getInstance(mname);
|
||||||
currManager.addListener(this);
|
currManager.addListener(this);
|
||||||
allStations.addAll(currManager.getStations());
|
allStations.addAll(currManager.getStations());
|
||||||
currManager = null;
|
currManager = null;
|
||||||
|
|
|
@ -56,6 +56,7 @@ import com.raytheon.uf.edex.plugin.loctables.util.store.ObStationStoreStrategy;
|
||||||
* Mar 06, 2014 2876 mpduff New NDM plugin.
|
* Mar 06, 2014 2876 mpduff New NDM plugin.
|
||||||
* Apr 28, 2014 3086 skorolev Updated setupLocalFiles method
|
* Apr 28, 2014 3086 skorolev Updated setupLocalFiles method
|
||||||
* Sep 04, 2014 3220 skorolev Removed parameter currentSite from FSSObs configuration managers.
|
* Sep 04, 2014 3220 skorolev Removed parameter currentSite from FSSObs configuration managers.
|
||||||
|
* Sep 03, 2015 3841 skorolev Corrected getInstance for FSSObs monitors.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -128,12 +129,10 @@ public class LocationTablesIngest implements INationalDatasetSubscriber {
|
||||||
private void setupLocalFiles() {
|
private void setupLocalFiles() {
|
||||||
List<FSSObsMonitorConfigurationManager> monitors = new ArrayList<FSSObsMonitorConfigurationManager>();
|
List<FSSObsMonitorConfigurationManager> monitors = new ArrayList<FSSObsMonitorConfigurationManager>();
|
||||||
|
|
||||||
monitors.add(FSSObsMonitorConfigurationManager.getInstance(MonName.fog
|
monitors.add(FSSObsMonitorConfigurationManager.getInstance(MonName.fog));
|
||||||
.name()));
|
monitors.add(FSSObsMonitorConfigurationManager.getInstance(MonName.ss));
|
||||||
monitors.add(FSSObsMonitorConfigurationManager.getInstance(MonName.ss
|
monitors.add(FSSObsMonitorConfigurationManager
|
||||||
.name()));
|
.getInstance(MonName.snow));
|
||||||
monitors.add(FSSObsMonitorConfigurationManager.getInstance(MonName.snow
|
|
||||||
.name()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue