Omaha #3841 - Updated the dialogs for adding and editing a new zone/station.
Former-commit-id: 5a7e13b6a6db5ca766da3ad957c12077470359e7
This commit is contained in:
parent
ad8aadf385
commit
dc1722a8b7
11 changed files with 285 additions and 196 deletions
|
@ -50,6 +50,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 16, 2014 3220 skorolev Corrected getInstance() method.
|
* Oct 16, 2014 3220 skorolev Corrected getInstance() method.
|
||||||
* Oct 27, 2014 3667 skorolev Cleaned code.
|
* Oct 27, 2014 3667 skorolev Cleaned code.
|
||||||
|
* Nov 21, 2014 3841 skorolev Corrected handleOkBtnSelection.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -85,13 +86,8 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
||||||
"Fog Monitor Confirm 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())) {
|
||||||
|
@ -101,19 +97,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();
|
||||||
|
resetParams();
|
||||||
} else { // Return back to continue edit.
|
} else { // Return back to continue edit.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,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 16, 2014 3220 skorolev Corrected getInstance() method.
|
* Oct 16, 2014 3220 skorolev Corrected getInstance() method.
|
||||||
* Oct 27, 2014 3667 skorolev Cleaned code.
|
* Oct 27, 2014 3667 skorolev Cleaned code.
|
||||||
|
* Nov 21, 2014 3841 skorolev Corrected handleOkBtnSelection.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
|
@ -80,12 +81,11 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
||||||
"SAFESEAS Monitor Confirm 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,
|
||||||
|
@ -93,19 +93,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();
|
||||||
|
resetParams();
|
||||||
} else { // Return back to continue edit.
|
} else { // Return back to continue edit.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,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 16, 2014 3220 skorolev Corrected getInstance() method.
|
* Oct 16, 2014 3220 skorolev Corrected getInstance() method.
|
||||||
* Oct 27, 2014 3667 skorolev Cleaned code.
|
* Oct 27, 2014 3667 skorolev Cleaned code.
|
||||||
|
* Nov 21, 2014 3841 skorolev Corrected handleOkBtnSelection.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -85,9 +86,8 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
||||||
"SNOW Monitor Confirm 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 +102,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();
|
||||||
|
resetParams();
|
||||||
} else { // Return back to continue edit.
|
} else { // Return back to continue edit.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,10 +25,12 @@ 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.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 +52,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.
|
||||||
|
* Nov 21, 2014 3841 skorolev Added coordinates in the hover text for a newly added zones.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -112,7 +115,11 @@ public final class TableUtil {
|
||||||
|
|
||||||
String hoverText = null;
|
String hoverText = null;
|
||||||
if (isZone) {
|
if (isZone) {
|
||||||
hoverText = getZoneHoverText(areaId);
|
AreaIdXML zoneXML = FSSObsMonitorConfigurationManager
|
||||||
|
.getSsObsManager().getAreaXml(zone);
|
||||||
|
if (zoneXML != null) {
|
||||||
|
hoverText = getZoneHoverText(zoneXML);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
hoverText = getStationHoverText(areaId);
|
hoverText = getStationHoverText(areaId);
|
||||||
}
|
}
|
||||||
|
@ -320,7 +327,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 +346,11 @@ public final class TableUtil {
|
||||||
|
|
||||||
String hoverText = null;
|
String hoverText = null;
|
||||||
if (isZone) {
|
if (isZone) {
|
||||||
hoverText = getZoneHoverText(areaId);
|
AreaIdXML zoneXML = FSSObsMonitorConfigurationManager
|
||||||
|
.getSsObsManager().getAreaXml(zone);
|
||||||
|
if (zoneXML != null) {
|
||||||
|
hoverText = getZoneHoverText(zoneXML);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
hoverText = getStationHoverText(areaId);
|
hoverText = getStationHoverText(areaId);
|
||||||
}
|
}
|
||||||
|
@ -639,7 +651,11 @@ public final class TableUtil {
|
||||||
|
|
||||||
String hoverText = null;
|
String hoverText = null;
|
||||||
if (isZone) {
|
if (isZone) {
|
||||||
hoverText = getZoneHoverText(areaId);
|
AreaIdXML zoneXML = FSSObsMonitorConfigurationManager
|
||||||
|
.getSsObsManager().getAreaXml(zone);
|
||||||
|
if (zoneXML != null) {
|
||||||
|
hoverText = getZoneHoverText(zoneXML);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
hoverText = getStationHoverText(areaId);
|
hoverText = getStationHoverText(areaId);
|
||||||
}
|
}
|
||||||
|
@ -884,8 +900,9 @@ public final class TableUtil {
|
||||||
* @param zone
|
* @param zone
|
||||||
* @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) + ", ";
|
||||||
|
@ -914,6 +931,11 @@ public final class TableUtil {
|
||||||
} else {
|
} else {
|
||||||
hoverText += (String) results[0].toString();
|
hoverText += (String) results[0].toString();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (zoneXML.getCLat() != null) {
|
||||||
|
hoverText += "(" + zoneXML.getCLat() + ", "
|
||||||
|
+ zoneXML.getCLon() + ")";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -56,6 +56,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.
|
||||||
|
* Nov 21, 2014 3841 skorolev Corrected handleAddNewStation method.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -261,8 +262,8 @@ public class AddNewStationDlg extends CaveSWTDialog {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
macDlg.addNewStationAction(stn);
|
macDlg.addNewStationAction(stn);
|
||||||
macDlg.getInstance().addStation(area, stn, type, false);
|
macDlg.configMgr.addStation(area, stn, type, false);
|
||||||
macDlg.getInstance().getStations().add(stn);
|
macDlg.configMgr.getStations().add(stn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
@ -49,6 +48,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 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.
|
||||||
|
* Nov 21, 2014 3841 skorolev Corrected handleAddNewAction method.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -234,9 +234,12 @@ 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();
|
||||||
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -256,61 +259,32 @@ public class AddNewZoneDlg extends CaveSWTDialog {
|
||||||
/**
|
/**
|
||||||
* Adds a new zone.
|
* Adds a new zone.
|
||||||
*
|
*
|
||||||
|
* @param areaId
|
||||||
* @param latString
|
* @param latString
|
||||||
* @param lonString
|
* @param lonString
|
||||||
|
* @throws NumberFormatException
|
||||||
*/
|
*/
|
||||||
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) {
|
||||||
} else {
|
if (marineZoneRdo.getSelection() || idTF.getText().charAt(2) == 'Z') {
|
||||||
try {
|
type = ZoneType.MARITIME;
|
||||||
double lat = Double.parseDouble(latString.trim());
|
|
||||||
double lon = Double.parseDouble(lonString.trim());
|
|
||||||
ZoneType type = ZoneType.REGULAR;
|
|
||||||
if (appName != AppName.SNOW) {
|
|
||||||
if (marineZoneRdo.getSelection()) {
|
|
||||||
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.addArea(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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,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.
|
||||||
|
* Nov 21, 2014 3841 skorolev Corrected deleteSelected method.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -189,8 +190,8 @@ public class DeleteStationDlg extends CaveSWTDialog {
|
||||||
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);
|
retval = macDlg.configMgr.getAddedStations().get(idx);
|
||||||
configMgr.getAddedStations().remove(idx);
|
macDlg.configMgr.getAddedStations().remove(idx);
|
||||||
stationList.remove(selection);
|
stationList.remove(selection);
|
||||||
populate();
|
populate();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -37,6 +39,7 @@ import org.eclipse.swt.widgets.Text;
|
||||||
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 +56,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.
|
||||||
|
* Nov 21, 2014 3841 skorolev Content of ID field made an editable.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -85,17 +89,11 @@ 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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
@ -227,21 +225,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 +234,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();
|
||||||
|
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);
|
||||||
|
@ -310,7 +303,21 @@ public class EditNewZoneDlg extends CaveSWTDialog {
|
||||||
* Populate list of added zones.
|
* Populate list of added zones.
|
||||||
*/
|
*/
|
||||||
private void populate() {
|
private void populate() {
|
||||||
java.util.List<String> newList = macDlg.configMgr.getAddedZones();
|
java.util.List<String> newList = new ArrayList<String>();
|
||||||
|
java.util.List<AreaIdXML> maList = macDlg.configMgr.getConfigXml()
|
||||||
|
.getAreaIds();
|
||||||
|
for (AreaIdXML maZone : maList) {
|
||||||
|
if (maZone.getCLat() != null) {
|
||||||
|
newList.add(maZone.getAreaId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
java.util.List<AreaIdXML> adtnlList = macDlg.configMgr
|
||||||
|
.getAdjAreaConfigXml().getAreaIds();
|
||||||
|
for (AreaIdXML aZone : adtnlList) {
|
||||||
|
if (aZone.getCLat() != null) {
|
||||||
|
newList.add(aZone.getAreaId());
|
||||||
|
}
|
||||||
|
}
|
||||||
zoneList.setItems(newList.toArray(new String[newList.size()]));
|
zoneList.setItems(newList.toArray(new String[newList.size()]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,26 +327,25 @@ 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 = macDlg.configMgr.getAreaXml(zone);
|
||||||
|
AreaIdXML adjAreaXml = macDlg.configMgr.getAdjAreaXML(zone);
|
||||||
// DR #7343: a null areaXml causes an "Unhandled event loop exception"
|
// DR #7343: a null areaXml causes an "Unhandled event loop exception"
|
||||||
if (areaXml != null) {
|
if (areaXml != null) {
|
||||||
idTF.setText(areaXml.getAreaId());
|
idTF.setText(areaXml.getAreaId());
|
||||||
idTF.setEnabled(false);
|
// 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);
|
// idTF.setEnabled(false);
|
||||||
} else {
|
latTF.setText(String.valueOf(adjAreaXml.getCLat()));
|
||||||
nonMarineRdo.setSelection(false);
|
lonTF.setText(String.valueOf(adjAreaXml.getCLon()));
|
||||||
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 +354,81 @@ 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());
|
||||||
zoneList.remove(zoneList.getSelectionIndex());
|
zoneList.remove(zoneList.getSelectionIndex());
|
||||||
macDlg.configMgr.removeArea(area);
|
|
||||||
idTF.setText("");
|
idTF.setText("");
|
||||||
latTF.setText("");
|
latTF.setText("");
|
||||||
lonTF.setText("");
|
lonTF.setText("");
|
||||||
return area;
|
if (macDlg.getMaZones().contains(area)) {
|
||||||
|
macDlg.getMaZones().remove(area);
|
||||||
|
macDlg.configMgr.removeArea(area);
|
||||||
|
}
|
||||||
|
if (macDlg.getAdditionalZones().contains(area)) {
|
||||||
|
macDlg.getAdditionalZones().remove(area);
|
||||||
|
macDlg.configMgr.removeAdjArea(area);
|
||||||
|
}
|
||||||
|
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.
|
||||||
*/
|
*/
|
||||||
private void saveSelected() {
|
/**
|
||||||
|
* @param area
|
||||||
|
* Original zone ID
|
||||||
|
* @param areaStr
|
||||||
|
* New zone ID
|
||||||
|
* @param latStr
|
||||||
|
* Latitude
|
||||||
|
* @param lonStr
|
||||||
|
* Longitude
|
||||||
|
* @throws NumberFormatException
|
||||||
|
*/
|
||||||
|
private void saveSelected(String area, String areaStr, String latStr,
|
||||||
|
String lonStr) throws NumberFormatException {
|
||||||
|
|
||||||
if (zoneList.getItemCount() != 0) {
|
ArrayList<StationIdXML> stationIds = macDlg.configMgr.getAreaXml(area)
|
||||||
String area = zoneList.getItem(zoneList.getSelectionIndex());
|
.getStationIds();
|
||||||
String latStr = latTF.getText();
|
|
||||||
String lontStr = lonTF.getText();
|
double lat = Double.parseDouble(latStr);
|
||||||
if (latStr == null || latStr.isEmpty() || lontStr == null
|
double lon = Double.parseDouble(lonStr);
|
||||||
|| lontStr.isEmpty()) {
|
if (lat > 90.0 || lat < -90.0 || lon > 180.0 || lon < -180.0) {
|
||||||
macDlg.latLonErrorMsg(latStr, lontStr);
|
macDlg.latLonErrorMsg(latStr, lonStr);
|
||||||
return;
|
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 {
|
|
||||||
bottomLbl.setText("No zones have been edited.");
|
|
||||||
}
|
}
|
||||||
|
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 (macDlg.configMgr.getAreaList().contains(area)) {
|
||||||
|
if (macDlg.getMaZones().contains(area)) {
|
||||||
|
macDlg.getMaZones().remove(area);
|
||||||
|
}
|
||||||
|
macDlg.configMgr.removeAddedArea(area);
|
||||||
|
macDlg.configMgr.removeArea(area);
|
||||||
|
macDlg.configMgr.addArea(areaXML);
|
||||||
|
} else if (macDlg.getAdditionalZones().contains(area)) {
|
||||||
|
macDlg.getAdditionalZones().remove(area);
|
||||||
|
macDlg.configMgr.removeAdjArea(area);
|
||||||
|
macDlg.configMgr.addAdjArea(areaXML);
|
||||||
|
}
|
||||||
|
populate();
|
||||||
|
// Return cursor to the list.
|
||||||
|
zoneList.select(zoneList.indexOf(areaStr));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -45,7 +45,7 @@ import org.eclipse.swt.widgets.Text;
|
||||||
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.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;
|
||||||
|
@ -78,6 +78,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||||
* Sep 24, 2014 2757 skorolev Fixed problem with adding and removing zones.
|
* Sep 24, 2014 2757 skorolev Fixed problem with adding and removing zones.
|
||||||
* 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.
|
||||||
|
* Nov 21, 2014 3841 skorolev Added formIsValid method.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -877,6 +878,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);
|
||||||
|
@ -892,9 +894,9 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
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,
|
||||||
|
@ -915,9 +917,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -932,10 +934,8 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
editDlg.setCloseCallback(new ICloseCallback() {
|
editDlg.setCloseCallback(new ICloseCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void dialogClosed(Object returnValue) {
|
public void dialogClosed(Object returnValue) {
|
||||||
if (returnValue instanceof String) {
|
if ((boolean) returnValue) {
|
||||||
// Update the edit dialog
|
// Update the edit dialog
|
||||||
String selectedZone = returnValue.toString();
|
|
||||||
maZones.remove(selectedZone);
|
|
||||||
populateLeftLists();
|
populateLeftLists();
|
||||||
}
|
}
|
||||||
editDlg = null;
|
editDlg = null;
|
||||||
|
@ -1084,6 +1084,7 @@ 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);
|
||||||
|
@ -1092,8 +1093,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
monitorAreaList.setSelection(maZones.indexOf(zone));
|
monitorAreaList.setSelection(maZones.indexOf(zone));
|
||||||
handleMonitorAreaListSelection();
|
handleMonitorAreaListSelection();
|
||||||
additionalZones.remove(zone);
|
additionalZones.remove(zone);
|
||||||
configMgr.addArea(zone, zone.charAt(2) == 'Z' ? ZoneType.MARITIME
|
configMgr.addArea(zoneXML);
|
||||||
: ZoneType.REGULAR);
|
|
||||||
if (!configMgr.getAddedZones().contains(zone)) {
|
if (!configMgr.getAddedZones().contains(zone)) {
|
||||||
configMgr.getAddedZones().add(zone);
|
configMgr.getAddedZones().add(zone);
|
||||||
}
|
}
|
||||||
|
@ -1142,6 +1142,8 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
monitorAreaList.remove(monitorAreaList.getSelectionIndex());
|
monitorAreaList.remove(monitorAreaList.getSelectionIndex());
|
||||||
associatedList.removeAll();
|
associatedList.removeAll();
|
||||||
if (mode == Mode.Zone) {
|
if (mode == Mode.Zone) {
|
||||||
|
// 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);
|
||||||
}
|
}
|
||||||
|
@ -1154,11 +1156,9 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
if (configMgr.getAddedZones().contains(entry)) {
|
if (configMgr.getAddedZones().contains(entry)) {
|
||||||
configMgr.getAddedZones().remove(entry);
|
configMgr.getAddedZones().remove(entry);
|
||||||
}
|
}
|
||||||
|
configMgr.addAdjArea(zoneXML);
|
||||||
configMgr.addAdjArea(entry,
|
|
||||||
entry.charAt(2) == 'Z' ? ZoneType.MARITIME
|
|
||||||
: ZoneType.REGULAR);
|
|
||||||
} else { // Station mode
|
} else { // Station mode
|
||||||
|
// entry is a station to remove.
|
||||||
additionalStns.add(entry);
|
additionalStns.add(entry);
|
||||||
Collections.sort(additionalStns);
|
Collections.sort(additionalStns);
|
||||||
additionalList.setItems(additionalStns
|
additionalList.setItems(additionalStns
|
||||||
|
@ -1237,13 +1237,12 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
} 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());
|
||||||
|
@ -1334,11 +1333,17 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset and Saving configuration parameters.
|
* Reset configuration parameters.
|
||||||
*/
|
*/
|
||||||
protected void resetAndSave() {
|
protected void resetParams() {
|
||||||
getValues();
|
getValues();
|
||||||
resetStatus();
|
resetStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saving configuration parameters.
|
||||||
|
*/
|
||||||
|
protected void saveConfigs() {
|
||||||
configMgr.saveConfigXml();
|
configMgr.saveConfigXml();
|
||||||
configMgr.saveAdjacentAreaConfigXml();
|
configMgr.saveAdjacentAreaConfigXml();
|
||||||
}
|
}
|
||||||
|
@ -1407,6 +1412,27 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean formIsValid(String area, String latString, String lonString) {
|
||||||
|
boolean retVal = true;
|
||||||
|
if (area.equals("") || area.length() != 6
|
||||||
|
|| (area.charAt(2) != 'C' && area.charAt(2) != 'Z')) {
|
||||||
|
displayInputErrorMsg("Invalid Area ID = '"
|
||||||
|
+ area
|
||||||
|
+ "' entered.\n"
|
||||||
|
+ "Please enter a correctly formatted Area ID:\n"
|
||||||
|
+ "Zone ID must have six characters.\n"
|
||||||
|
+ "A third character should be C for county and Z for marine zone.\n"
|
||||||
|
+ "Use only capital characters.");
|
||||||
|
retVal = false;
|
||||||
|
}
|
||||||
|
if (latString == null || latString.isEmpty() || lonString == null
|
||||||
|
|| lonString.isEmpty()) {
|
||||||
|
latLonErrorMsg(latString, lonString);
|
||||||
|
retVal = false;
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
|
@ -1534,6 +1560,35 @@ 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets Configuration manager.
|
* Gets Configuration manager.
|
||||||
*
|
*
|
||||||
|
|
|
@ -35,6 +35,7 @@ import com.vividsolutions.jts.io.WKTWriter;
|
||||||
* Apr 30, 2014 3086 skorolev Replaced MonitorConfigurationManager with FSSObsMonitorConfigurationManager
|
* Apr 30, 2014 3086 skorolev Replaced MonitorConfigurationManager with FSSObsMonitorConfigurationManager
|
||||||
* Oct 17, 2014 2757 skorolev Corrected SQL in the getAdjacentZones to avoid duplicates.
|
* Oct 17, 2014 2757 skorolev Corrected SQL in the getAdjacentZones to avoid duplicates.
|
||||||
* Nov 03, 2014 3741 skorolev Updated getZoneCenter and added getStationCenter methods.
|
* Nov 03, 2014 3741 skorolev Updated getZoneCenter and added getStationCenter methods.
|
||||||
|
* Dec 02, 2014 3841 skorolev Fixed possible duplicates in SQL expression.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -191,7 +192,8 @@ public class MonitorAreaUtils {
|
||||||
+ zoneEnvelope
|
+ zoneEnvelope
|
||||||
+ "', -1), the_geom) "
|
+ "', -1), the_geom) "
|
||||||
+ "and (catalogtype = 1 or catalogtype = 33 or catalogtype = 32 or catalogtype = 1000) order by stationid asc";
|
+ "and (catalogtype = 1 or catalogtype = 33 or catalogtype = 32 or catalogtype = 1000) order by stationid asc";
|
||||||
|
// 1= CAT_TYPE_ICAO, 33=CAT_TYPE_CMAN ,
|
||||||
|
// 32=CAT_TYPE_BUOY_FXD 1000=CAT_TYPE_MESONET see ObStation.java
|
||||||
ISpatialQuery sq = SpatialQueryFactory.create();
|
ISpatialQuery sq = SpatialQueryFactory.create();
|
||||||
Object[] results = sq.dbRequest(sql, META_DB);
|
Object[] results = sq.dbRequest(sql, META_DB);
|
||||||
if (results.length != 0) {
|
if (results.length != 0) {
|
||||||
|
@ -599,7 +601,9 @@ public class MonitorAreaUtils {
|
||||||
Coordinate stnCenter = null;
|
Coordinate stnCenter = null;
|
||||||
ISpatialQuery sq = null;
|
ISpatialQuery sq = null;
|
||||||
String sql = "select AsBinary(the_geom) from common_obs_spatial where stationid = '"
|
String sql = "select AsBinary(the_geom) from common_obs_spatial where stationid = '"
|
||||||
+ stationid + "'";
|
+ stationid
|
||||||
|
+ "'"
|
||||||
|
+ "and (catalogtype = 1 or catalogtype = 33 or catalogtype = 32 or catalogtype = 1000)";
|
||||||
sq = SpatialQueryFactory.create();
|
sq = SpatialQueryFactory.create();
|
||||||
Object results[] = sq.dbRequest(sql, "metadata");
|
Object results[] = sq.dbRequest(sql, "metadata");
|
||||||
if (results.length > 0) {
|
if (results.length > 0) {
|
||||||
|
|
|
@ -67,6 +67,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
* May 13 2014 3133 njensen getStationType returns String instead of ObsHistType
|
* May 13 2014 3133 njensen getStationType returns String instead of ObsHistType
|
||||||
* May 15 2014 3086 skorolev Renamed from MonitorConfigurationManager. Replaces three separate area configuration managers with one.
|
* 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.
|
||||||
|
* Nov 21 2014 3841 skorolev Corrected addArea, addAdjArea and added getAdjAreaConfigXml.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -357,21 +358,18 @@ public class FSSObsMonitorConfigurationManager implements
|
||||||
* @param type
|
* @param type
|
||||||
* Type of zone
|
* 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;
|
boolean areaExists = false;
|
||||||
|
String areaId = areaXML.getAreaId();
|
||||||
for (AreaIdXML area : areaXmlList) {
|
for (AreaIdXML area : areaXmlList) {
|
||||||
if (area.getAreaId().equals(areaId)) {
|
if (area.getAreaId().equals(areaId)) {
|
||||||
area.setType(type);
|
|
||||||
areaExists = true;
|
areaExists = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (areaExists == false) {
|
if (areaExists == false) {
|
||||||
AreaIdXML area = new AreaIdXML();
|
configXml.addAreaId(areaXML);
|
||||||
area.setAreaId(areaId);
|
|
||||||
area.setType(type);
|
|
||||||
configXml.addAreaId(area);
|
|
||||||
if (!addedZones.contains(areaId)) {
|
if (!addedZones.contains(areaId)) {
|
||||||
addedZones.add(areaId);
|
addedZones.add(areaId);
|
||||||
}
|
}
|
||||||
|
@ -674,6 +672,23 @@ public class FSSObsMonitorConfigurationManager implements
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 from the monitoring area.
|
* Removes an area from the monitoring area.
|
||||||
*
|
*
|
||||||
|
@ -777,6 +792,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
|
||||||
*
|
*
|
||||||
|
@ -960,24 +984,19 @@ public class FSSObsMonitorConfigurationManager implements
|
||||||
/**
|
/**
|
||||||
* Add Adjacent Area.
|
* Add Adjacent Area.
|
||||||
*
|
*
|
||||||
* @param areaId
|
* @param area
|
||||||
* @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;
|
boolean areaExists = false;
|
||||||
for (AreaIdXML area : adjAreaList) {
|
for (AreaIdXML area : adjAreaList) {
|
||||||
if (area.getAreaId().equals(areaId)) {
|
if (area.getAreaId().equals(areaXML.getAreaId())) {
|
||||||
area.setType(type);
|
|
||||||
areaExists = true;
|
areaExists = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (areaExists == false) {
|
if (areaExists == false) {
|
||||||
AreaIdXML area = new AreaIdXML();
|
adjAreaConfigXml.addAreaId(areaXML);
|
||||||
area.setAreaId(areaId);
|
|
||||||
area.setType(type);
|
|
||||||
adjAreaConfigXml.addAreaId(area);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue