Issue #2757 - Fixed problem with adding and removing zones.
Former-commit-id: 31ccaf218df628327fe4b27d69a4500eb1dc8d84
This commit is contained in:
parent
00eda3f982
commit
a4914bd85d
8 changed files with 96 additions and 25 deletions
|
@ -111,6 +111,8 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
});
|
||||
fogMonitorDlg.open();
|
||||
}
|
||||
configManager.getAddedZones().clear();
|
||||
configManager.getAddedStations().clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,6 +107,8 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
});
|
||||
ssMonitorDlg.open();
|
||||
}
|
||||
configManager.getAddedZones().clear();
|
||||
configManager.getAddedStations().clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,6 +109,8 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
});
|
||||
snowMonitorDlg.open();
|
||||
}
|
||||
configManager.getAddedZones().clear();
|
||||
configManager.getAddedStations().clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,6 +74,7 @@ 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.
|
||||
* Sep 16, 2014 2757 skorolev Updated createBottomButtons method.
|
||||
* Sep 24, 2014 2757 skorolev Fixed problem with adding and removing zones.
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
|
@ -1055,14 +1056,20 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
if (!configMgr.getAddedZones().contains(entry)) {
|
||||
configMgr.getAddedZones().add(entry);
|
||||
}
|
||||
configMgr.removeAdjArea(entry);
|
||||
} else { // Station mode
|
||||
maStations.add(entry);
|
||||
Collections.sort(maStations);
|
||||
monitorAreaList.setItems(maStations.toArray(new String[maStations
|
||||
.size()]));
|
||||
monitorAreaList.setSelection(maStations.indexOf(entry));
|
||||
handleMonitorAreaListSelection();
|
||||
additionalStns.remove(entry);
|
||||
String zone = associatedList.getItem(associatedList.getSelectionIndex());
|
||||
String stnId = entry.substring(0, entry.indexOf('#'));
|
||||
String stnType = entry.substring(entry.indexOf('#') + 1);
|
||||
configMgr.addStation(zone, stnId, stnType, configMgr
|
||||
.getAddedStations().contains(stnId));
|
||||
handleMonitorAreaListSelection();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1095,6 +1102,9 @@ 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);
|
||||
} else { // Station mode
|
||||
additionalStns.add(entry);
|
||||
Collections.sort(additionalStns);
|
||||
|
@ -1191,7 +1201,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
* Remove an associated zone or station.
|
||||
*/
|
||||
private void removeAssociated() {
|
||||
if (associatedList.getItemCount() == 0) {
|
||||
if (associatedList.getSelectionCount() == 0) {
|
||||
if (mode == Mode.Zone) {
|
||||
showMessage(shell, SWT.ERROR, "Select Needed",
|
||||
"You must select a station");
|
||||
|
|
|
@ -33,6 +33,7 @@ import com.raytheon.uf.common.monitor.xml.MonAreaConfigXML;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 28, 2009 mpduff Initial creation
|
||||
* Feb 21, 2012 14413 zhao added code handling "adjacent areas"
|
||||
* Sep 24, 2014 2757 skorolev Added save for Adjacent Area config.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -46,9 +47,10 @@ public class FogMonitorConfigurationManager extends MonitorConfigurationManager
|
|||
+ "monitoringArea" + File.separatorChar + "monitorAreaConfig.xml";
|
||||
|
||||
/** Path to Adjacent Area Configuration XML. */
|
||||
private static final String ADJ_AREA_CONFIG_FILE_NAME = "fog" + File.separatorChar
|
||||
+ "monitoringArea" + File.separatorChar + "adjacentAreaConfig.xml";
|
||||
|
||||
private static final String ADJ_AREA_CONFIG_FILE_NAME = "fog"
|
||||
+ File.separatorChar + "monitoringArea" + File.separatorChar
|
||||
+ "adjacentAreaConfig.xml";
|
||||
|
||||
/** Singleton instance of this class */
|
||||
private static MonitorConfigurationManager instance = null;
|
||||
|
||||
|
@ -76,13 +78,15 @@ public class FogMonitorConfigurationManager extends MonitorConfigurationManager
|
|||
*/
|
||||
public void saveConfigData() {
|
||||
super.saveConfigXml(CONFIG_FILE_NAME);
|
||||
super.saveAdjacentAreaConfigXml(ADJ_AREA_CONFIG_FILE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the XML configuration data for the current XML file name.
|
||||
*/
|
||||
public void readConfigXml(String currentSite) {
|
||||
super.readConfigXml(currentSite, CONFIG_FILE_NAME, ADJ_AREA_CONFIG_FILE_NAME);
|
||||
super.readConfigXml(currentSite, CONFIG_FILE_NAME,
|
||||
ADJ_AREA_CONFIG_FILE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -57,6 +57,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
* Oct 02 2013 2361 njensen Use JAXBManager for XML
|
||||
* Oct 17 2013 16682 zhao fixed a bug in readConfigXml()
|
||||
* Apr 23 2014 3054 skorolev Removed unnecessary parameter in the addArea method.
|
||||
* Sep 24 2014 2757 skorolev Fixed problem with adding and removing zones.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -706,4 +707,44 @@ public abstract class MonitorConfigurationManager {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Adjacent Area.
|
||||
*
|
||||
* @param zone
|
||||
*/
|
||||
public void removeAdjArea(String zone) {
|
||||
List<AreaIdXML> adjAreaList = adjAreaConfigXml.getAreaIds();
|
||||
for (int i = 0; i < adjAreaList.size(); i++) {
|
||||
if (adjAreaList.get(i).getAreaId().equals(zone)) {
|
||||
adjAreaList.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Adjacent Area.
|
||||
*
|
||||
* @param areaId
|
||||
* @param type
|
||||
*/
|
||||
public void addAdjArea(String areaId, ZoneType type) {
|
||||
List<AreaIdXML> adjAreaList = adjAreaConfigXml.getAreaIds();
|
||||
boolean areaExists = false;
|
||||
for (AreaIdXML area : adjAreaList) {
|
||||
if (area.getAreaId().equals(areaId)) {
|
||||
area.setType(type);
|
||||
areaExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (areaExists == false) {
|
||||
AreaIdXML area = new AreaIdXML();
|
||||
area.setAreaId(areaId);
|
||||
area.setType(type);
|
||||
adjAreaConfigXml.addAreaId(area);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,28 +27,31 @@ import com.raytheon.uf.common.monitor.xml.MonAreaConfigXML;
|
|||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 5, 2010 mpduff Initial creation
|
||||
* Feb 21, 2012 14413 zhao added code handling "adjacent areas"
|
||||
* Sep 24, 2014 2757 skorolev Added save for Adjacent Area config.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SSMonitorConfigurationManager extends MonitorConfigurationManager {
|
||||
/** Path to Monitoring Area Configuration XML. */
|
||||
private static final String CONFIG_FILE_NAME = "safeseas" + File.separatorChar
|
||||
+ "monitoringArea" + File.separatorChar + "monitorAreaConfig.xml";
|
||||
private static final String CONFIG_FILE_NAME = "safeseas"
|
||||
+ File.separatorChar + "monitoringArea" + File.separatorChar
|
||||
+ "monitorAreaConfig.xml";
|
||||
|
||||
/** Path to Adjacent Area Configuration XML. */
|
||||
private static final String ADJ_AREA_CONFIG_FILE_NAME = "safeseas" + File.separatorChar
|
||||
+ "monitoringArea" + File.separatorChar + "adjacentAreaConfig.xml";
|
||||
private static final String ADJ_AREA_CONFIG_FILE_NAME = "safeseas"
|
||||
+ File.separatorChar + "monitoringArea" + File.separatorChar
|
||||
+ "adjacentAreaConfig.xml";
|
||||
|
||||
/** Singleton instance of this class */
|
||||
private static MonitorConfigurationManager instance = null;
|
||||
|
@ -57,7 +60,7 @@ public class SSMonitorConfigurationManager extends MonitorConfigurationManager {
|
|||
private SSMonitorConfigurationManager() {
|
||||
configXml = new MonAreaConfigXML();
|
||||
adjAreaConfigXml = new MonAreaConfigXML();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an instance of this singleton.
|
||||
|
@ -77,13 +80,15 @@ public class SSMonitorConfigurationManager extends MonitorConfigurationManager {
|
|||
*/
|
||||
public void saveConfigData() {
|
||||
super.saveConfigXml(CONFIG_FILE_NAME);
|
||||
super.saveAdjacentAreaConfigXml(ADJ_AREA_CONFIG_FILE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the XML configuration data for the current XML file name.
|
||||
*/
|
||||
public void readConfigXml(String currentSite) {
|
||||
super.readConfigXml(currentSite, CONFIG_FILE_NAME, ADJ_AREA_CONFIG_FILE_NAME);
|
||||
super.readConfigXml(currentSite, CONFIG_FILE_NAME,
|
||||
ADJ_AREA_CONFIG_FILE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,28 +27,31 @@ import com.raytheon.uf.common.monitor.xml.MonAreaConfigXML;
|
|||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 5, 2010 mpduff Initial creation
|
||||
* Feb 21 2012 14413 zhao add code handling "adjacent areas"
|
||||
*
|
||||
* Sep 24 2014 2757 skorolev Added save for Adjacent Area config.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SnowMonitorConfigurationManager extends MonitorConfigurationManager {
|
||||
public class SnowMonitorConfigurationManager extends
|
||||
MonitorConfigurationManager {
|
||||
/** Path to Monitoring Area Configuration XML. */
|
||||
private static final String CONFIG_FILE_NAME = "snow" + File.separatorChar
|
||||
+ "monitoringArea" + File.separatorChar + "monitorAreaConfig.xml";
|
||||
|
||||
/** Path to Adjacent Areas Configuration XML. */
|
||||
private static final String ADJ_AREA_CONFIG_FILE_NAME = "snow" + File.separatorChar
|
||||
+ "monitoringArea" + File.separatorChar + "adjacentAreaConfig.xml";
|
||||
private static final String ADJ_AREA_CONFIG_FILE_NAME = "snow"
|
||||
+ File.separatorChar + "monitoringArea" + File.separatorChar
|
||||
+ "adjacentAreaConfig.xml";
|
||||
|
||||
/** Singleton instance of this class */
|
||||
private static MonitorConfigurationManager instance = null;
|
||||
|
@ -77,13 +80,15 @@ public class SnowMonitorConfigurationManager extends MonitorConfigurationManager
|
|||
*/
|
||||
public void saveConfigData() {
|
||||
super.saveConfigXml(CONFIG_FILE_NAME);
|
||||
super.saveAdjacentAreaConfigXml(ADJ_AREA_CONFIG_FILE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the XML configuration data for the current XML file name.
|
||||
*/
|
||||
public void readConfigXml(String currentSite) {
|
||||
super.readConfigXml(currentSite, CONFIG_FILE_NAME, ADJ_AREA_CONFIG_FILE_NAME);
|
||||
super.readConfigXml(currentSite, CONFIG_FILE_NAME,
|
||||
ADJ_AREA_CONFIG_FILE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue