Issue #2757. Fixed issues in Area Configuration Dialogs.

Change-Id: Ic3d3d5c41df6c8d80aac8e434e4c42a5ef9d1ecf

Former-commit-id: 7b3702c186 [formerly 6013121a99] [formerly ea573d2c30] [formerly 7b3702c186 [formerly 6013121a99] [formerly ea573d2c30] [formerly a768f540f0 [formerly ea573d2c30 [formerly 81826338bda946aff4ac8a7b9ea83c2eb72397d5]]]]
Former-commit-id: a768f540f0
Former-commit-id: f6ea436e80 [formerly d2d4672a46] [formerly a981a42007f76a4e25e017ce265ad6fb22a436d4 [formerly 6d9a066c36]]
Former-commit-id: 4f37da138bfd1a624cb5c2b39655d2127c907a2a [formerly baf598a6ff]
Former-commit-id: 559d0f9499
This commit is contained in:
Slav Korolev 2014-01-30 11:43:16 -05:00
parent fb03f7b570
commit 4cac912be3
7 changed files with 408 additions and 354 deletions

View file

@ -33,20 +33,20 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.FogMonitor;
* This class manages the FOG thresholds for display and monitor.
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 15, 2009 #3963 lvenable Initial creation
*
* Feb 03, 2014 #2757 skorolev Fixed reInitialize()
*
* </pre>
*
*
* @author lvenable
* @version 1.0
*/
public class FogThresholdMgr extends AbstractThresholdMgr
{
public class FogThresholdMgr extends AbstractThresholdMgr {
/**
* Class instance.
*/
@ -55,75 +55,67 @@ public class FogThresholdMgr extends AbstractThresholdMgr
/**
* Private constructor.
*/
private FogThresholdMgr()
{
private FogThresholdMgr() {
super("DefaultFogDisplayThresholds.xml",
"DefaultFogMonitorThresholds.xml",
"fog");
"DefaultFogMonitorThresholds.xml", "fog");
areaConfigMgr = getAreaConfigMgr();
init(); // call init() after areaConfigMgr is set
init(); // call init() after areaConfigMgr is set
}
/**
* Get an instance of the manager class.
*
* @return Class instance.
*/
public static FogThresholdMgr getInstance()
{
if (classInstance == null)
{
public static FogThresholdMgr getInstance() {
if (classInstance == null) {
classInstance = new FogThresholdMgr();
}
return classInstance;
}
/**
* DR#11279:
* When monitor area configuration is changed,
* threshold manager needs to be re-initialized
* using the new monitor area configuration
* DR#11279: When monitor area configuration is changed, threshold manager
* needs to be re-initialized using the new monitor area configuration
*/
public static void reInitialize() {
if ( classInstance != null ) {
classInstance = null;
classInstance = new FogThresholdMgr();
}
if (classInstance != null) {
classInstance = null;
}
classInstance = new FogThresholdMgr();
// Update threshold file.
classInstance.loadDefaultMonitorThreshold();
classInstance.saveMonitorThresholds();
}
@Override
protected ArrayList<String> getThresholdKeys(DataUsageKey dataUsage)
{
protected ArrayList<String> getThresholdKeys(DataUsageKey dataUsage) {
ArrayList<String> threshKeys = new ArrayList<String>();
if (dataUsage == DataUsageKey.DISPLAY)
{
for (FogDisplay fogDisp : FogDisplay.values())
{
if (dataUsage == DataUsageKey.DISPLAY) {
for (FogDisplay fogDisp : FogDisplay.values()) {
threshKeys.add(fogDisp.getXmlKey());
}
}
else if (dataUsage == DataUsageKey.MONITOR)
{
for (FogMonitor fogMon : FogMonitor.values())
{
} else if (dataUsage == DataUsageKey.MONITOR) {
for (FogMonitor fogMon : FogMonitor.values()) {
threshKeys.add(fogMon.getXmlKey());
}
}
return threshKeys;
}
@Override
public MonitorConfigurationManager getAreaConfigMgr() {
@Override
public MonitorConfigurationManager getAreaConfigMgr() {
if (areaConfigMgr == null) {
LocalizationManager mgr = LocalizationManager.getInstance();
String siteScope = mgr.getCurrentSite();
areaConfigMgr = FogMonitorConfigurationManager.getInstance();
areaConfigMgr.readConfigXml(siteScope);
}
return areaConfigMgr;
}
}
}

View file

@ -40,6 +40,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg;
* ------------ ---------- ----------- --------------------------
* Jan 5, 2010 mpduff Initial creation
* Nov 27, 2012 1351 skorolev Changes for non-blocking dialog.
* Jan 29, 2014 2757 skorolev Changed OK button handler.
*
* </pre>
*
@ -53,6 +54,9 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
readConfigData();
}
private FogMonitorConfigurationManager configManager = FogMonitorConfigurationManager
.getInstance();
/*
* (non-Javadoc)
*
@ -61,19 +65,23 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
*/
@Override
protected void handleOkBtnSelection() {
FogMonitorConfigurationManager configManager = FogMonitorConfigurationManager
.getInstance();
// Check for changes in the data
if (!configManager.getAddedZones().isEmpty()
|| !configManager.getAddedZones().isEmpty()) {
|| !configManager.getAddedStations().isEmpty()
|| this.timeWindowChanged || this.shipDistanceChanged
|| this.fogChkChanged || this.maZonesRemoved) {
int choice = showMessage(shell, SWT.OK | SWT.CANCEL,
"Fog Monitor Confirm Changes",
"Want to Update Fog Monitor's Setup files?");
if (choice == SWT.OK) {
// Save the config xml file
configManager.setShipDistance(distanceScale.getSelection());
configManager.setTimeWindow(timeScale.getSelection());
configManager.setTimeWindow(timeWindow.getSelection());
this.timeWindowChanged = false;
configManager.setShipDistance(shipDistance.getSelection());
this.shipDistanceChanged = false;
configManager.setUseAlgorithms(fogChk.getSelection());
this.fogChkChanged = false;
this.maZonesRemoved = false;
configManager.saveConfigData();
/**
* DR#11279: re-initialize threshold manager and the monitor
@ -82,18 +90,18 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
FogThresholdMgr.reInitialize();
FogMonitor.reInitialize();
String message = "New zones have been added, the display "
+ "thresholds for the new zones are set to "
+ "default values, you may edit them with the display "
+ "thresholds editor which can be launched from Fog Monitor "
+ "zone table.\n\nIf Fog Monitor is running anywhere within "
+ "the office, clear it.\n";
showMessage(shell, SWT.ICON_INFORMATION | SWT.OK,
"Fog Monitor Confirm Changes", message);
if ((!configManager.getAddedZones().isEmpty())
|| (!configManager.getAddedZones().isEmpty())) {
|| (!configManager.getAddedStations().isEmpty())) {
String message = "New zones have been added, the display "
+ "thresholds for the new zones are set to "
+ "default values, you may edit them with the display "
+ "thresholds editor which can be launched from Fog Monitor "
+ "zone table.\n\nIf Fog Monitor is running anywhere within "
+ "the office, clear it.\n";
showMessage(shell, SWT.ICON_INFORMATION | SWT.OK,
"Fog Monitor Confirm Changes", message);
String message2 = "New zones have been added, and their monitoring thresholds "
+ "have been set to default values; would you like to modify "
+ "their threshold values now?";
@ -105,6 +113,8 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
DataUsageKey.MONITOR);
fogMonitorDlg.open();
}
configManager.getAddedZones().clear();
configManager.getAddedStations().clear();
}
}
} else {
@ -114,9 +124,9 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
if (yesno == SWT.NO) {
return;
}
setReturnValue(true);
close();
}
setReturnValue(true);
close();
}
/*
@ -140,8 +150,22 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
*/
@Override
protected void readConfigData() {
FogMonitorConfigurationManager configManager = FogMonitorConfigurationManager
.getInstance();
configManager.readConfigXml(currentSite);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#setValues
* ()
*/
@Override
protected void setValues() {
timeWindow.setSelection(configManager.getTimeWindow());
setTimeScaleLabel();
shipDistance.setSelection(configManager.getShipDistance());
setShipDistScaleLabel();
fogChk.setSelection(configManager.isUseAlgorithms());
}
}

View file

@ -33,140 +33,131 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SafeSeasMonitor;
* This class manages the SafeSeas thresholds for display and monitor.
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 27, 2009 #3963 lvenable Initial creation
*
* Feb 03, 2014 #2757 skorolev Fixed reInitialize()
*
* </pre>
*
*
* @author lvenable
* @version 1.0
*/
public class SSThresholdMgr extends AbstractThresholdMgr
{
public class SSThresholdMgr extends AbstractThresholdMgr {
private static SSThresholdMgr classInstance;
private SSThresholdMgr()
{
private SSThresholdMgr() {
super("DefaultSSDisplayThresholds.xml",
"DefaultSSMonitorThresholds.xml",
"safeseas");
"DefaultSSMonitorThresholds.xml", "safeseas");
areaConfigMgr = getAreaConfigMgr();
init(); // call init() after areaConfigMgr is set
}
public static SSThresholdMgr getInstance()
{
if (classInstance == null)
{
public static SSThresholdMgr getInstance() {
if (classInstance == null) {
classInstance = new SSThresholdMgr();
}
return classInstance;
}
/**
* DR#11279:
* When monitor area configuration is changed,
* threshold manager needs to be re-initialized
* using the new monitor area configuration
* DR#11279: When monitor area configuration is changed, threshold manager
* needs to be re-initialized using the new monitor area configuration
*/
public static void reInitialize() {
if ( classInstance != null ) {
classInstance = null;
classInstance = new SSThresholdMgr();
}
if (classInstance != null) {
classInstance = null;
}
// Update threshold file.
classInstance = new SSThresholdMgr();
classInstance.loadDefaultMonitorThreshold();
classInstance.saveMonitorThresholds();
}
@Override
protected ArrayList<String> getThresholdKeys(DataUsageKey dataUsage)
{
protected ArrayList<String> getThresholdKeys(DataUsageKey dataUsage) {
ArrayList<String> threshKeys = new ArrayList<String>();
if (dataUsage == DataUsageKey.DISPLAY)
{
for (SafeSeasDisplay ssDisp : SafeSeasDisplay.values())
{
if (dataUsage == DataUsageKey.DISPLAY) {
for (SafeSeasDisplay ssDisp : SafeSeasDisplay.values()) {
threshKeys.add(ssDisp.getXmlKey());
}
}
else if (dataUsage == DataUsageKey.MONITOR)
{
for (SafeSeasMonitor ssMon : SafeSeasMonitor.values())
{
} else if (dataUsage == DataUsageKey.MONITOR) {
for (SafeSeasMonitor ssMon : SafeSeasMonitor.values()) {
threshKeys.add(ssMon.getXmlKey());
}
}
return threshKeys;
}
@Override
public MonitorConfigurationManager getAreaConfigMgr() {
@Override
public MonitorConfigurationManager getAreaConfigMgr() {
if (areaConfigMgr == null) {
LocalizationManager mgr = LocalizationManager.getInstance();
String siteScope = mgr.getCurrentSite();
areaConfigMgr = SSMonitorConfigurationManager.getInstance();
areaConfigMgr.readConfigXml(siteScope);
}
return areaConfigMgr;
}
}
// /**
// * Get the path where the display thresholds XML files are contained.
// * @return File path.
// */
// @Override
// public String getDisplayThresholdPath()
// {
// String fs = String.valueOf(File.separatorChar);
// StringBuilder sb = new StringBuilder();
//
// sb.append("safeseas").append(fs);
// sb.append("threshold").append(fs);
// sb.append("display").append(fs);
//
// return sb.toString();
// }
//
// /**
// * Get the path where the monitor thresholds XML files are contained.
// * @return File path.
// */
// @Override
// public String getMonitorThresholdPath()
// {
// String fs = String.valueOf(File.separatorChar);
// StringBuilder sb = new StringBuilder();
//
// sb.append("safeseas").append(fs);
// sb.append("threshold").append(fs);
// sb.append("monitor").append(fs);
//
// return sb.toString();
// }
//
// /**
// * Get the path where the XML file containing the user selected
// * default file is located.
// * @return The path of the user selected default file XML.
// */
// @Override
// public String getDefaultThresholdFilePath()
// {
// String fs = String.valueOf(File.separatorChar);
// StringBuilder sb = new StringBuilder();
//
// sb.append("safeseas").append(fs);
// sb.append("threshold").append(fs);
// sb.append("display").append(fs);
// sb.append("defaultThresh").append(fs);
//
// return sb.toString();
// }
// /**
// * Get the path where the display thresholds XML files are contained.
// * @return File path.
// */
// @Override
// public String getDisplayThresholdPath()
// {
// String fs = String.valueOf(File.separatorChar);
// StringBuilder sb = new StringBuilder();
//
// sb.append("safeseas").append(fs);
// sb.append("threshold").append(fs);
// sb.append("display").append(fs);
//
// return sb.toString();
// }
//
// /**
// * Get the path where the monitor thresholds XML files are contained.
// * @return File path.
// */
// @Override
// public String getMonitorThresholdPath()
// {
// String fs = String.valueOf(File.separatorChar);
// StringBuilder sb = new StringBuilder();
//
// sb.append("safeseas").append(fs);
// sb.append("threshold").append(fs);
// sb.append("monitor").append(fs);
//
// return sb.toString();
// }
//
// /**
// * Get the path where the XML file containing the user selected
// * default file is located.
// * @return The path of the user selected default file XML.
// */
// @Override
// public String getDefaultThresholdFilePath()
// {
// String fs = String.valueOf(File.separatorChar);
// StringBuilder sb = new StringBuilder();
//
// sb.append("safeseas").append(fs);
// sb.append("threshold").append(fs);
// sb.append("display").append(fs);
// sb.append("defaultThresh").append(fs);
//
// return sb.toString();
// }
}

View file

@ -31,7 +31,7 @@ import com.raytheon.uf.viz.monitor.safeseas.threshold.SSThresholdMgr;
import com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg;
/**
* TODO Add Description
* SAFESEAS area configuration dialog.
*
* <pre>
*
@ -40,6 +40,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg;
* ------------ ---------- ----------- --------------------------
* Jan 5, 2010 mpduff Initial creation
* Nov 27, 2012 1351 skorolev Changes for non-blocking dialog.
* Jan 29, 2014 2757 skorolev Changed OK button handler.
*
* </pre>
*
@ -60,6 +61,9 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
readConfigData();
}
private SSMonitorConfigurationManager configManager = SSMonitorConfigurationManager
.getInstance();
/*
* (non-Javadoc)
*
@ -68,19 +72,23 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
*/
@Override
protected void handleOkBtnSelection() {
SSMonitorConfigurationManager configManager = SSMonitorConfigurationManager
.getInstance();
// Check for changes in the data
if (!configManager.getAddedZones().isEmpty()
|| !configManager.getAddedZones().isEmpty()) {
|| !configManager.getAddedStations().isEmpty()
|| this.timeWindowChanged || this.shipDistanceChanged
|| this.fogChkChanged || this.maZonesRemoved) {
int choice = showMessage(shell, SWT.OK | SWT.CANCEL,
"SAFESEAS Monitor Confirm Changes",
"Want to update the SAFESEAS setup files?");
if (choice == SWT.OK) {
// Save the config xml file
configManager.setShipDistance(distanceScale.getSelection());
configManager.setTimeWindow(timeScale.getSelection());
configManager.setTimeWindow(timeWindow.getSelection());
this.timeWindowChanged = false;
configManager.setShipDistance(shipDistance.getSelection());
this.shipDistanceChanged = false;
configManager.setUseAlgorithms(fogChk.getSelection());
this.fogChkChanged = false;
this.maZonesRemoved = false;
configManager.saveConfigData();
/**
* DR#11279: re-initialize threshold manager and the monitor
@ -88,20 +96,30 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
*/
SSThresholdMgr.reInitialize();
SafeSeasMonitor.reInitialize();
showMessage(shell, SWT.OK, "SAFESEAS Config Change",
"You're updating the SAFESEAS monitoring settings."
+ "\n\nIf SAFESEAS is running anywhere within "
+ "the office, please clear it.\n");
String message2 = "New zones have been added, and their monitoring thresholds "
+ "have been set to default values; would you like to modify "
+ "their threshold values now?";
int yesno = showMessage(shell, SWT.ICON_QUESTION | SWT.YES
| SWT.NO, "Edit Thresholds Now?", message2);
if (yesno == SWT.YES) {
SSDispMonThreshDlg ssMonitorDlg = new SSDispMonThreshDlg(
shell, CommonConfig.AppName.SAFESEAS,
DataUsageKey.MONITOR);
ssMonitorDlg.open();
if ((!configManager.getAddedZones().isEmpty())
|| (!configManager.getAddedStations().isEmpty())) {
String message = "You're updating the SAFESEAS monitoring settings."
+ "\n\nIf SAFESEAS is running anywhere within "
+ "the office, please clear it.\n";
showMessage(shell, SWT.OK, "SAFESEAS Config Change",
message);
String message2 = "New zones have been added, and their monitoring thresholds "
+ "have been set to default values; would you like to modify "
+ "their threshold values now?";
int yesno = showMessage(shell, SWT.ICON_QUESTION | SWT.YES
| SWT.NO, "Edit Thresholds Now?", message2);
if (yesno == SWT.YES) {
SSDispMonThreshDlg ssMonitorDlg = new SSDispMonThreshDlg(
shell, CommonConfig.AppName.SAFESEAS,
DataUsageKey.MONITOR);
ssMonitorDlg.open();
}
configManager.getAddedZones().clear();
configManager.getAddedStations().clear();
}
}
} else {
@ -111,9 +129,9 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
if (yesno == SWT.NO) {
return;
}
setReturnValue(true);
close();
}
setReturnValue(true);
close();
}
/*
@ -137,8 +155,22 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
*/
@Override
protected void readConfigData() {
SSMonitorConfigurationManager configManager = SSMonitorConfigurationManager
.getInstance();
configManager.readConfigXml(currentSite);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#setValues
* ()
*/
@Override
protected void setValues() {
timeWindow.setSelection(configManager.getTimeWindow());
setTimeScaleLabel();
shipDistance.setSelection(configManager.getShipDistance());
setShipDistScaleLabel();
fogChk.setSelection(configManager.isUseAlgorithms());
}
}

View file

@ -29,145 +29,135 @@ import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SnowDisplay;
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SnowMonitor;
/**
* This class manages the Snow thresholds for display and monitor.
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 27, 2009 #3963 lvenable Initial creation
*
* Feb 03, 2014 #2757 skorolev Fixed reInitialize()
*
* </pre>
*
*
* @author lvenable
* @version 1.0
*/
public class SnowThresholdMgr extends AbstractThresholdMgr
{
private static SnowThresholdMgr classInstance;
private SnowThresholdMgr()
{
public class SnowThresholdMgr extends AbstractThresholdMgr {
private static SnowThresholdMgr classInstance;
private SnowThresholdMgr() {
super("DefaultSnowDisplayThresholds.xml",
"DefaultSnowMonitorThresholds.xml",
"snow");
"DefaultSnowMonitorThresholds.xml", "snow");
areaConfigMgr = getAreaConfigMgr();
init(); // call init() after areaConfigMgr is set
}
public static SnowThresholdMgr getInstance()
{
if (classInstance == null)
{
public static SnowThresholdMgr getInstance() {
if (classInstance == null) {
classInstance = new SnowThresholdMgr();
}
return classInstance;
}
/**
* DR#11279:
* When monitor area configuration is changed,
* threshold manager needs to be re-initialized
* using the new monitor area configuration
* DR#11279: When monitor area configuration is changed, threshold manager
* needs to be re-initialized using the new monitor area configuration
*/
public static void reInitialize() {
if ( classInstance != null ) {
classInstance = null;
classInstance = new SnowThresholdMgr();
}
if (classInstance != null) {
classInstance = null;
}
// Update threshold file.
classInstance = new SnowThresholdMgr();
classInstance.loadDefaultMonitorThreshold();
classInstance.saveMonitorThresholds();
}
@Override
protected ArrayList<String> getThresholdKeys(DataUsageKey dataUsage)
{
protected ArrayList<String> getThresholdKeys(DataUsageKey dataUsage) {
ArrayList<String> threshKeys = new ArrayList<String>();
if (dataUsage == DataUsageKey.DISPLAY)
{
for (SnowDisplay snowDisp : SnowDisplay.values())
{
if (dataUsage == DataUsageKey.DISPLAY) {
for (SnowDisplay snowDisp : SnowDisplay.values()) {
threshKeys.add(snowDisp.getXmlKey());
}
}
else if (dataUsage == DataUsageKey.MONITOR)
{
for (SnowMonitor snowMon : SnowMonitor.values())
{
} else if (dataUsage == DataUsageKey.MONITOR) {
for (SnowMonitor snowMon : SnowMonitor.values()) {
threshKeys.add(snowMon.getXmlKey());
}
}
return threshKeys;
}
@Override
public MonitorConfigurationManager getAreaConfigMgr() {
@Override
public MonitorConfigurationManager getAreaConfigMgr() {
if (areaConfigMgr == null) {
LocalizationManager mgr = LocalizationManager.getInstance();
String siteScope = mgr.getCurrentSite();
areaConfigMgr = SnowMonitorConfigurationManager.getInstance();
areaConfigMgr.readConfigXml(siteScope);
}
return areaConfigMgr;
}
}
// /**
// * Get the path where the display thresholds XML files are contained.
// * @return File path.
// */
// @Override
// public String getDisplayThresholdPath()
// {
// String fs = String.valueOf(File.separatorChar);
// StringBuilder sb = new StringBuilder();
//
// sb.append("snow").append(fs);
// sb.append("threshold").append(fs);
// sb.append("display").append(fs);
//
// return sb.toString();
// }
//
// /**
// * Get the path where the monitor thresholds XML files are contained.
// * @return File path.
// */
// @Override
// public String getMonitorThresholdPath()
// {
// String fs = String.valueOf(File.separatorChar);
// StringBuilder sb = new StringBuilder();
//
// sb.append("snow").append(fs);
// sb.append("threshold").append(fs);
// sb.append("monitor").append(fs);
//
// return sb.toString();
// }
//
// /**
// * Get the path where the XML file containing the user selected
// * default file is located.
// * @return The path of the user selected default file XML.
// */
// @Override
// public String getDefaultThresholdFilePath()
// {
// String fs = String.valueOf(File.separatorChar);
// StringBuilder sb = new StringBuilder();
//
// sb.append("snow").append(fs);
// sb.append("threshold").append(fs);
// sb.append("display").append(fs);
// sb.append("defaultThresh").append(fs);
//
// return sb.toString();
// }
// /**
// * Get the path where the display thresholds XML files are contained.
// * @return File path.
// */
// @Override
// public String getDisplayThresholdPath()
// {
// String fs = String.valueOf(File.separatorChar);
// StringBuilder sb = new StringBuilder();
//
// sb.append("snow").append(fs);
// sb.append("threshold").append(fs);
// sb.append("display").append(fs);
//
// return sb.toString();
// }
//
// /**
// * Get the path where the monitor thresholds XML files are contained.
// * @return File path.
// */
// @Override
// public String getMonitorThresholdPath()
// {
// String fs = String.valueOf(File.separatorChar);
// StringBuilder sb = new StringBuilder();
//
// sb.append("snow").append(fs);
// sb.append("threshold").append(fs);
// sb.append("monitor").append(fs);
//
// return sb.toString();
// }
//
// /**
// * Get the path where the XML file containing the user selected
// * default file is located.
// * @return The path of the user selected default file XML.
// */
// @Override
// public String getDefaultThresholdFilePath()
// {
// String fs = String.valueOf(File.separatorChar);
// StringBuilder sb = new StringBuilder();
//
// sb.append("snow").append(fs);
// sb.append("threshold").append(fs);
// sb.append("display").append(fs);
// sb.append("defaultThresh").append(fs);
//
// return sb.toString();
// }
}

View file

@ -40,6 +40,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg;
* ------------ ---------- ----------- --------------------------
* Jan 5, 2010 mpduff Initial creation
* Nov 27, 2012 1351 skorolev Changes for non-blocking dialog.
* Jan 29, 2014 2757 skorolev Changed OK button handler.
*
* </pre>
*
@ -54,6 +55,9 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
readConfigData();
}
private SnowMonitorConfigurationManager configManager = SnowMonitorConfigurationManager
.getInstance();
/*
* (non-Javadoc)
*
@ -62,17 +66,18 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
*/
@Override
protected void handleOkBtnSelection() {
SnowMonitorConfigurationManager configManager = SnowMonitorConfigurationManager
.getInstance();
// Check for changes in the data
if (!configManager.getAddedZones().isEmpty()
|| !configManager.getAddedZones().isEmpty()) {
|| !configManager.getAddedStations().isEmpty()
|| this.timeWindowChanged || this.maZonesRemoved) {
int choice = showMessage(shell, SWT.OK | SWT.CANCEL,
"SNOW Monitor Confirm Changes",
"Want to update the SNOW setup files?");
if (choice == SWT.OK) {
// Save the config xml file
configManager.setTimeWindow(timeScale.getSelection());
configManager.setTimeWindow(timeWindow.getSelection());
this.timeWindowChanged = false;
this.maZonesRemoved = false;
configManager.saveConfigData();
/**
* DR#11279: re-initialize threshold manager and the monitor
@ -80,23 +85,29 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
*/
SnowThresholdMgr.reInitialize();
SnowMonitor.reInitialize();
showMessage(shell, SWT.ICON_INFORMATION | SWT.OK,
"SNOW Config Change",
"You're updating the SNOW monitoring settings."
+ "\n\nIf SNOW is running anywhere within "
+ "the office, please clear it.\n");
String message2 = "New zones have been added, and their monitoring thresholds "
+ "have been set to default values; would you like to modify "
+ "their threshold values now?";
int yesno = showMessage(shell, SWT.ICON_QUESTION | SWT.YES
| SWT.NO, "Edit Thresholds Now?", message2);
if (yesno == SWT.YES) {
SnowMonDispThreshDlg snowMonitorDlg = new SnowMonDispThreshDlg(
shell, CommonConfig.AppName.SNOW,
DataUsageKey.MONITOR);
snowMonitorDlg.open();
if ((!configManager.getAddedZones().isEmpty())
|| (!configManager.getAddedStations().isEmpty())) {
showMessage(shell, SWT.ICON_INFORMATION | SWT.OK,
"SNOW Config Change",
"You're updating the SNOW monitoring settings."
+ "\n\nIf SNOW is running anywhere within "
+ "the office, please clear it.\n");
String message2 = "New zones have been added, and their monitoring thresholds "
+ "have been set to default values; would you like to modify "
+ "their threshold values now?";
int yesno = showMessage(shell, SWT.ICON_QUESTION | SWT.YES
| SWT.NO, "Edit Thresholds Now?", message2);
if (yesno == SWT.YES) {
SnowMonDispThreshDlg snowMonitorDlg = new SnowMonDispThreshDlg(
shell, CommonConfig.AppName.SNOW,
DataUsageKey.MONITOR);
snowMonitorDlg.open();
}
}
configManager.getAddedZones().clear();
configManager.getAddedStations().clear();
}
} else {
String message3 = "No changes made.\nDo you want to exit?";
@ -105,9 +116,9 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
if (yesno == SWT.NO) {
return;
}
setReturnValue(true);
close();
}
setReturnValue(true);
close();
}
/*
@ -130,9 +141,20 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
*/
@Override
protected void readConfigData() {
SnowMonitorConfigurationManager configManager = SnowMonitorConfigurationManager
.getInstance();
configManager.readConfigXml(currentSite);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#setValues
* ()
*/
@Override
protected void setValues() {
timeWindow.setSelection(configManager.getTimeWindow());
setTimeScaleLabel();
}
}

View file

@ -71,7 +71,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Nov 16, 2012 1297 skorolev Changes for non-blocking dialog.
* Feb 06, 2013 1578 skorolev Fixed a cursor problem for checkboxes.
* Oct 07, 2013 #2443 lvenable Fixed image memory leak.
*
* Jan 29, 2014 2757 skorolev Added status variables.
* </pre>
*
* @author lvenable
@ -125,17 +125,25 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
/** Edit/Delete button. **/
private Button editDeleteBtn;
/** Time scale control. **/
protected Scale timeScale;
/** Time window control. **/
protected Scale timeWindow;
/** Time window status. */
protected boolean timeWindowChanged = false;
/** Time scale label to display the value set by the time scale. **/
private Label timeScaleLbl;
private Label timeWindowLbl;
/** Distance scale. **/
protected Scale distanceScale;
/** Ship Distance scale. **/
protected Scale shipDistance;
/** Distance scale label to display the value set by the distance scale. **/
private Label distanceScaleLBl;
/** Ship Distance status. */
protected boolean shipDistanceChanged = false;
/**
* Ship Distance scale label to display the value set by the distance scale.
**/
private Label shipDistanceLBl;
/** Monitor area Add button. **/
private Button monAreaAddBtn;
@ -158,6 +166,9 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
/** Fog check button. **/
protected Button fogChk;
/** Fog check button status. */
protected boolean fogChkChanged = false;
/** Control font. **/
private Font controlFont;
@ -170,6 +181,9 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
/** monitor area zones **/
private java.util.List<String> maZones = null;
/** monitor area zones status. */
protected boolean maZonesRemoved = false;
/** monitor area stations **/
private java.util.List<String> maStations = null;
@ -457,6 +471,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
@Override
public void widgetSelected(SelectionEvent event) {
removeZoneStn();
maZonesRemoved = true;
}
});
@ -646,22 +661,23 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
int defaultVal = (int) Math.round((2.00 - 0.25) / .05);
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
timeScale = new Scale(scaleComp, SWT.HORIZONTAL);
timeScale.setMinimum(0);
timeScale.setMaximum(max);
timeScale.setSelection(defaultVal);
timeScale.setLayoutData(gd);
timeScale.addSelectionListener(new SelectionAdapter() {
timeWindow = new Scale(scaleComp, SWT.HORIZONTAL);
timeWindow.setMinimum(0);
timeWindow.setMaximum(max);
timeWindow.setSelection(defaultVal);
timeWindow.setLayoutData(gd);
timeWindow.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setTimeScaleLabel();
timeWindowChanged = true;
}
});
gd = new GridData(50, SWT.DEFAULT);
timeScaleLbl = new Label(scaleComp, SWT.NONE);
timeScaleLbl.setFont(controlFont);
timeScaleLbl.setLayoutData(gd);
timeWindowLbl = new Label(scaleComp, SWT.NONE);
timeWindowLbl.setFont(controlFont);
timeWindowLbl.setLayoutData(gd);
setTimeScaleLabel();
@ -682,22 +698,23 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
distanceLbl.setLayoutData(gd);
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
distanceScale = new Scale(scaleComp, SWT.HORIZONTAL);
distanceScale.setMinimum(0);
distanceScale.setMaximum(200);
distanceScale.setSelection(100);
distanceScale.setLayoutData(gd);
distanceScale.addSelectionListener(new SelectionAdapter() {
shipDistance = new Scale(scaleComp, SWT.HORIZONTAL);
shipDistance.setMinimum(0);
shipDistance.setMaximum(200);
shipDistance.setSelection(100);
shipDistance.setLayoutData(gd);
shipDistance.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setShipDistScaleLabel();
shipDistanceChanged = true;
}
});
gd = new GridData(50, SWT.DEFAULT);
distanceScaleLBl = new Label(scaleComp, SWT.NONE);
distanceScaleLBl.setFont(controlFont);
distanceScaleLBl.setLayoutData(gd);
shipDistanceLBl = new Label(scaleComp, SWT.NONE);
shipDistanceLBl.setFont(controlFont);
shipDistanceLBl.setLayoutData(gd);
setShipDistScaleLabel();
@ -709,6 +726,12 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
gd = new GridData();
gd.horizontalSpan = 2;
fogChk = new Button(scaleComp, SWT.CHECK);
fogChk.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
fogChkChanged = true;
}
});
setAlgorithmText();
}
@ -784,18 +807,18 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
/**
* Set the time scale label.
*/
private void setTimeScaleLabel() {
double val = timeScale.getSelection() * .05 + .25;
protected void setTimeScaleLabel() {
double val = timeWindow.getSelection() * .05 + .25;
val = roundToHundredths(val);
timeScaleLbl.setText(String.format("%5.2f", val));
timeWindowLbl.setText(String.format("%5.2f", val));
}
/**
* Set the ship distance scale label.
*/
private void setShipDistScaleLabel() {
distanceScaleLBl.setText(String.format("%5d",
distanceScale.getSelection()));
protected void setShipDistScaleLabel() {
shipDistanceLBl.setText(String.format("%5d",
shipDistance.getSelection()));
}
/**
@ -958,27 +981,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
/**
* Set the slider values and the check box.
*/
private void setValues() {
MonitorConfigurationManager configManager = getConfigManager();
if (appName == AppName.SAFESEAS) {
fogChk.setSelection(((SSMonitorConfigurationManager) configManager)
.isUseAlgorithms());
distanceScale
.setSelection(((SSMonitorConfigurationManager) configManager)
.getShipDistance());
setShipDistScaleLabel();
} else if (appName == AppName.FOG) {
fogChk.setSelection(((FogMonitorConfigurationManager) configManager)
.isUseAlgorithms());
distanceScale
.setSelection(((FogMonitorConfigurationManager) configManager)
.getShipDistance());
setShipDistScaleLabel();
}
timeScale.setSelection(configManager.getTimeWindow());
setTimeScaleLabel();
}
protected abstract void setValues();
/**
* Show a dialog message.