Omaha #3667 - Corrected functionality of dialog.
Former-commit-id: cf354d6ac5668ba502feb188bdf17a0967168b19
This commit is contained in:
parent
7f051d34e6
commit
9f0b1a68e6
4 changed files with 83 additions and 71 deletions
|
@ -48,8 +48,8 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
* Apr 28, 2014 3086 skorolev Updated getConfigManager.
|
||||
* Sep 04, 2014 3220 skorolev Added fireConfigUpdateEvent method. Updated handler.
|
||||
* Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons.
|
||||
* Oct 16, 2014 3220 skorolev Corrected getInstance() method.
|
||||
*
|
||||
* Oct 16, 2014 3220 skorolev Corrected getInstance() method.
|
||||
* Oct 27, 2014 3667 skorolev Cleaned code.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -81,22 +81,18 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
@Override
|
||||
protected void handleOkBtnSelection() {
|
||||
if (dataIsChanged()) {
|
||||
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 configuration xml file
|
||||
getValues();
|
||||
resetStatus();
|
||||
configMgr.saveConfigXml();
|
||||
configMgr.saveAdjacentAreaConfigXml();
|
||||
|
||||
int choice = showMessage(shell, SWT.YES | SWT.NO,
|
||||
"Fog Monitor Confirm Changes", "Save changes?");
|
||||
if (choice == SWT.YES) {
|
||||
// Save the config xml file.
|
||||
resetAndSave();
|
||||
/**
|
||||
* DR#11279: re-initialize threshold manager and the monitor
|
||||
* using new monitor area configuration
|
||||
*/
|
||||
FogThresholdMgr.reInitialize();
|
||||
fireConfigUpdateEvent();
|
||||
// Open Threshold Dialog if zones/stations are added.
|
||||
if ((!configMgr.getAddedZones().isEmpty())
|
||||
|| (!configMgr.getAddedStations().isEmpty())) {
|
||||
if (editDialog() == SWT.YES) {
|
||||
|
@ -118,6 +114,8 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
configMgr.getAddedZones().clear();
|
||||
configMgr.getAddedStations().clear();
|
||||
}
|
||||
} else { // Return back to continue edit.
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ((fogMonitorDlg == null) || fogMonitorDlg.isDisposed()) {
|
||||
|
|
|
@ -49,6 +49,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
* Sep 04, 2014 3220 skorolev Added fireConfigUpdateEvent method. Updated handler.
|
||||
* Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons.
|
||||
* Oct 16, 2014 3220 skorolev Corrected getInstance() method.
|
||||
* Oct 27, 2014 3667 skorolev Cleaned code.
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
|
@ -75,19 +76,14 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
@Override
|
||||
protected void handleOkBtnSelection() {
|
||||
if (dataIsChanged()) {
|
||||
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
|
||||
getValues();
|
||||
resetStatus();
|
||||
configMgr.saveConfigXml();
|
||||
configMgr.saveAdjacentAreaConfigXml();
|
||||
|
||||
int choice = showMessage(shell, SWT.YES | SWT.NO,
|
||||
"SAFESEAS Monitor Confirm Changes", "Save changes?");
|
||||
if (choice == SWT.YES) {
|
||||
// Save the config xml file.
|
||||
resetAndSave();
|
||||
SSThresholdMgr.reInitialize();
|
||||
fireConfigUpdateEvent();
|
||||
|
||||
// Open Threshold Dialog if zones/stations are added.
|
||||
if ((!configMgr.getAddedZones().isEmpty())
|
||||
|| (!configMgr.getAddedStations().isEmpty())) {
|
||||
if (editDialog() == SWT.YES) {
|
||||
|
@ -110,6 +106,8 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
configMgr.getAddedZones().clear();
|
||||
configMgr.getAddedStations().clear();
|
||||
}
|
||||
} else { // Return back to continue edit.
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ((ssMonitorDlg == null) || ssMonitorDlg.isDisposed()) {
|
||||
|
|
|
@ -49,6 +49,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
* Sep 04, 2014 3220 skorolev Added fireConfigUpdateEvent method. Updated handler.
|
||||
* Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons.
|
||||
* Oct 16, 2014 3220 skorolev Corrected getInstance() method.
|
||||
* Oct 27, 2014 3667 skorolev Cleaned code.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -80,18 +81,14 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
@Override
|
||||
protected void handleOkBtnSelection() {
|
||||
if (dataIsChanged()) {
|
||||
int choice = showMessage(shell, SWT.OK | SWT.CANCEL,
|
||||
"SNOW Monitor Confirm Changes",
|
||||
"Want to update the SNOW setup files?");
|
||||
if (choice == SWT.OK) {
|
||||
// Save the config xml file
|
||||
getValues();
|
||||
resetStatus();
|
||||
configMgr.saveConfigXml();
|
||||
configMgr.saveAdjacentAreaConfigXml();
|
||||
|
||||
int choice = showMessage(shell, SWT.YES | SWT.NO,
|
||||
"SNOW Monitor Confirm Changes", "Save changes?");
|
||||
if (choice == SWT.YES) {
|
||||
// Save the config xml file.
|
||||
resetAndSave();
|
||||
SnowThresholdMgr.reInitialize();
|
||||
fireConfigUpdateEvent();
|
||||
// Open Threshold Dialog if zones/stations are added.
|
||||
if ((!configMgr.getAddedZones().isEmpty())
|
||||
|| (!configMgr.getAddedStations().isEmpty())) {
|
||||
if (editDialog() == SWT.YES) {
|
||||
|
@ -118,6 +115,8 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
configMgr.getAddedZones().clear();
|
||||
configMgr.getAddedStations().clear();
|
||||
}
|
||||
} else { // Return back to continue edit.
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ((snowMonitorDlg == null) || snowMonitorDlg.isDisposed()) {
|
||||
|
|
|
@ -71,9 +71,10 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
* Jan 29, 2014 2757 skorolev Added status variables.
|
||||
* Apr 23, 2014 3054 skorolev Fixed issue with removing from list a new zone and a new station.
|
||||
* Apr 28, 2014 3086 skorolev Updated getConfigManager method.
|
||||
*
|
||||
* Sep 16, 2014 2757 skorolev Updated createBottomButtons method.
|
||||
* Sep 24, 2014 2757 skorolev Fixed problem with adding and removing zones.
|
||||
* Oct 27, 2014 3667 skorolev Corrected functionality of dialog. Cleaned code.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
|
@ -1043,40 +1044,49 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
if (additionalList.getSelectionCount() == 0) {
|
||||
if (mode == Mode.Zone) {
|
||||
showMessage(shell, SWT.ERROR, "Selection Needed",
|
||||
"You must select a station first");
|
||||
"You must select an additional zone to add.");
|
||||
} else {
|
||||
showMessage(shell, SWT.ERROR, "Selection Needed",
|
||||
"You must select a zone first");
|
||||
"You must select an additional station to add.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
String entry = additionalList.getItem(additionalList
|
||||
.getSelectionIndex());
|
||||
additionalList.remove(additionalList.getSelectionIndex());
|
||||
if (mode == Mode.Zone) {
|
||||
maZones.add(entry);
|
||||
String zone = additionalList.getItem(additionalList
|
||||
.getSelectionIndex());
|
||||
additionalList.remove(additionalList.getSelectionIndex());
|
||||
maZones.add(zone);
|
||||
Collections.sort(maZones);
|
||||
monitorAreaList
|
||||
.setItems(maZones.toArray(new String[maZones.size()]));
|
||||
monitorAreaList.setSelection(maZones.indexOf(entry));
|
||||
monitorAreaList.setSelection(maZones.indexOf(zone));
|
||||
handleMonitorAreaListSelection();
|
||||
additionalZones.remove(entry);
|
||||
configMgr.addArea(entry, entry.charAt(2) == 'Z' ? ZoneType.MARITIME
|
||||
additionalZones.remove(zone);
|
||||
configMgr.addArea(zone, zone.charAt(2) == 'Z' ? ZoneType.MARITIME
|
||||
: ZoneType.REGULAR);
|
||||
if (!configMgr.getAddedZones().contains(entry)) {
|
||||
configMgr.getAddedZones().add(entry);
|
||||
if (!configMgr.getAddedZones().contains(zone)) {
|
||||
configMgr.getAddedZones().add(zone);
|
||||
}
|
||||
configMgr.removeAdjArea(entry);
|
||||
configMgr.removeAdjArea(zone);
|
||||
} else { // Station mode
|
||||
maStations.add(entry);
|
||||
if (associatedList.getSelectionCount() == 0) {
|
||||
showMessage(shell, SWT.ERROR, "Selection Needed",
|
||||
"You must select an associated zone first.");
|
||||
return;
|
||||
}
|
||||
String stn = additionalList.getItem(additionalList
|
||||
.getSelectionIndex());
|
||||
additionalList.remove(additionalList.getSelectionIndex());
|
||||
maStations.add(stn);
|
||||
Collections.sort(maStations);
|
||||
monitorAreaList.setItems(maStations.toArray(new String[maStations
|
||||
.size()]));
|
||||
monitorAreaList.setSelection(maStations.indexOf(entry));
|
||||
additionalStns.remove(entry);
|
||||
String zone = associatedList.getItem(associatedList.getSelectionIndex());
|
||||
String stnId = entry.substring(0, entry.indexOf('#'));
|
||||
String stnType = entry.substring(entry.indexOf('#') + 1);
|
||||
monitorAreaList.setSelection(maStations.indexOf(stn));
|
||||
additionalStns.remove(stn);
|
||||
String zone = associatedList.getItem(associatedList
|
||||
.getSelectionIndex());
|
||||
String stnId = stn.substring(0, stn.indexOf('#'));
|
||||
String stnType = stn.substring(stn.indexOf('#') + 1);
|
||||
configMgr.addStation(zone, stnId, stnType, configMgr
|
||||
.getAddedStations().contains(stnId));
|
||||
handleMonitorAreaListSelection();
|
||||
|
@ -1090,10 +1100,10 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
if (monitorAreaList.getSelectionCount() == 0) {
|
||||
if (mode == Mode.Zone) {
|
||||
showMessage(shell, SWT.ERROR, "Selection Needed",
|
||||
"You must select a station first");
|
||||
"You must select a monitor area zone to remove.");
|
||||
} else {
|
||||
showMessage(shell, SWT.ERROR, "Selection Needed",
|
||||
"You must select a zone first");
|
||||
"You must select a monitor area station to remove.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1114,9 +1124,10 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
if (configMgr.getAddedZones().contains(entry)) {
|
||||
configMgr.getAddedZones().remove(entry);
|
||||
}
|
||||
|
||||
configMgr.addAdjArea(entry,entry.charAt(2) == 'Z' ? ZoneType.MARITIME
|
||||
: ZoneType.REGULAR);
|
||||
|
||||
configMgr.addAdjArea(entry,
|
||||
entry.charAt(2) == 'Z' ? ZoneType.MARITIME
|
||||
: ZoneType.REGULAR);
|
||||
} else { // Station mode
|
||||
additionalStns.add(entry);
|
||||
Collections.sort(additionalStns);
|
||||
|
@ -1135,21 +1146,23 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
if (monitorAreaList.getSelectionCount() == 0) {
|
||||
if (mode == Mode.Zone) {
|
||||
showMessage(shell, SWT.ERROR, "Select Needed",
|
||||
"You must select a zone");
|
||||
"You must select a monitor area zone to add.");
|
||||
monitorAreaList.select(0);
|
||||
} else {
|
||||
showMessage(shell, SWT.ERROR, "Select Needed",
|
||||
"You must select a station");
|
||||
if (additionalList.getSelectionCount() == 0) {
|
||||
showMessage(shell, SWT.ERROR, "Select Needed",
|
||||
"You must select a monitor area station to add.");
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (maRegionalList.getSelectionCount() == 0) {
|
||||
if (mode == Mode.Zone) {
|
||||
showMessage(shell, SWT.ERROR, "Select Needed",
|
||||
"You must select a station");
|
||||
"You must select a station to add into Associated Stations.");
|
||||
} else {
|
||||
showMessage(shell, SWT.ERROR, "Select Needed",
|
||||
"You must select a zone");
|
||||
"You must select a zone to add into Associated Zones.");
|
||||
associatedList.select(0);
|
||||
}
|
||||
return;
|
||||
|
@ -1218,10 +1231,10 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
if (associatedList.getSelectionCount() == 0) {
|
||||
if (mode == Mode.Zone) {
|
||||
showMessage(shell, SWT.ERROR, "Select Needed",
|
||||
"You must select a station");
|
||||
"You must select an associated station to remove.");
|
||||
} else {
|
||||
showMessage(shell, SWT.ERROR, "Select Needed",
|
||||
"You must select a zone");
|
||||
"You must select an associated zone to remove.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1293,12 +1306,22 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
/**
|
||||
* Called when the cancel.
|
||||
*/
|
||||
private void closeWithoutSave() {
|
||||
protected void closeWithoutSave() {
|
||||
resetStatus();
|
||||
setReturnValue(true);
|
||||
close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset and Saving configuration parameters.
|
||||
*/
|
||||
protected void resetAndSave() {
|
||||
getValues();
|
||||
resetStatus();
|
||||
configMgr.saveConfigXml();
|
||||
configMgr.saveAdjacentAreaConfigXml();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets algorithm text.
|
||||
*/
|
||||
|
@ -1458,12 +1481,6 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
* @return
|
||||
*/
|
||||
protected int editDialog() {
|
||||
showMessage(shell, SWT.ICON_INFORMATION | SWT.OK, appName
|
||||
+ " Config Change", "You're updating the " + appName
|
||||
+ " monitoring settings." + "\n\nIf " + appName
|
||||
+ " is running anywhere within "
|
||||
+ "the office, please clear it.\n");
|
||||
|
||||
String message = "New zones have been added, and their monitoring thresholds "
|
||||
+ "have been set to default values; would you like to modify "
|
||||
+ "their threshold values now?";
|
||||
|
|
Loading…
Add table
Reference in a new issue