Merge branch 'omaha_14.3.1' of ssh://www.awips2omaha.com:29418/AWIPS2_baseline into master_14.3.1
Former-commit-id: 23d16004c389f0ef708bee2a8bfb84d465b7b36b
This commit is contained in:
commit
92762f46c7
36 changed files with 986 additions and 888 deletions
|
@ -38,6 +38,7 @@ import com.raytheon.uf.viz.monitor.fog.ui.dialogs.FogMonitoringAreaConfigDlg;
|
|||
* Dec 19 2009 3963 dhladky Initial creation.
|
||||
* Jul 14 2010 6567 zhao Launch AreaConfigDlg w/o monitor
|
||||
* Nov.27, 2012 1297 skorolev Cleanup code for non-blocking dialog.
|
||||
* Sep 16, 2014 2757 skorolev Added test of dialog on dispose.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -51,7 +52,7 @@ public class FogAreaConfigAction extends AbstractHandler {
|
|||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
if (areaDialog == null) {
|
||||
if (areaDialog == null || areaDialog.isDisposed()) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
areaDialog = new FogMonitoringAreaConfigDlg(shell,
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
|
|||
import com.raytheon.uf.viz.monitor.fog.FogMonitor;
|
||||
import com.raytheon.uf.viz.monitor.fog.threshold.FogThresholdMgr;
|
||||
import com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg;
|
||||
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||
|
||||
/**
|
||||
* Fog Monitor area configuration dialog.
|
||||
|
@ -42,7 +43,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg;
|
|||
* Nov 27, 2012 1351 skorolev Changes for non-blocking dialog.
|
||||
* Jan 29, 2014 2757 skorolev Changed OK button handler.
|
||||
* Apr 23, 2014 3054 skorolev Fixed issue with removing a new station from list.
|
||||
* Sep 15, 2014 2757 skorolev Removed extra dialog.
|
||||
* Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -51,6 +52,15 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg;
|
|||
*/
|
||||
|
||||
public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
||||
|
||||
private FogMonDispThreshDlg fogMonitorDlg;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param parent
|
||||
* @param title
|
||||
*/
|
||||
public FogMonitoringAreaConfigDlg(Shell parent, String title) {
|
||||
super(parent, title, AppName.FOG);
|
||||
readConfigData();
|
||||
|
@ -67,7 +77,6 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
*/
|
||||
@Override
|
||||
protected void handleOkBtnSelection() {
|
||||
// Check for changes in the data
|
||||
if (dataIsChanged()) {
|
||||
int choice = showMessage(shell, SWT.OK | SWT.CANCEL,
|
||||
"Fog Monitor Confirm Changes",
|
||||
|
@ -85,20 +94,32 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
*/
|
||||
FogThresholdMgr.reInitialize();
|
||||
FogMonitor.reInitialize();
|
||||
|
||||
if ((!configManager.getAddedZones().isEmpty())
|
||||
|| (!configManager.getAddedStations().isEmpty())) {
|
||||
if (editDialog() == SWT.YES) {
|
||||
FogMonDispThreshDlg fogMonitorDlg = new FogMonDispThreshDlg(
|
||||
shell, CommonConfig.AppName.FOG,
|
||||
DataUsageKey.MONITOR);
|
||||
fogMonitorDlg = new FogMonDispThreshDlg(shell,
|
||||
CommonConfig.AppName.FOG, DataUsageKey.MONITOR);
|
||||
fogMonitorDlg.setCloseCallback(new ICloseCallback() {
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
// Clear added zones and stations.
|
||||
configManager.getAddedZones().clear();
|
||||
configManager.getAddedStations().clear();
|
||||
setReturnValue(true);
|
||||
close();
|
||||
}
|
||||
});
|
||||
fogMonitorDlg.open();
|
||||
}
|
||||
configManager.getAddedZones().clear();
|
||||
configManager.getAddedStations().clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fogMonitorDlg == null || fogMonitorDlg.isDisposed()) {
|
||||
setReturnValue(true);
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -38,6 +38,7 @@ import com.raytheon.uf.viz.monitor.safeseas.ui.dialogs.SSMonitoringAreaConfigDlg
|
|||
* Dec 28, 2009 3963 dhladky Initial creation.
|
||||
* March 5, 2012 14413 zhao Launch AreaConfigDlg w/o monitor
|
||||
* Nov.27, 2012 1297 skorolev Cleanup code for non-blocking dialog
|
||||
* Sep 16, 2014 2757 skorolev Added test of dialog on dispose.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -51,7 +52,7 @@ public class SafeseasAreaConfigAction extends AbstractHandler {
|
|||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
if (configDlg == null) {
|
||||
if (configDlg == null || configDlg.isDisposed()) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
configDlg = new SSMonitoringAreaConfigDlg(shell,
|
||||
|
|
|
@ -37,6 +37,22 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SafeSeasMonitor;
|
|||
import com.raytheon.uf.viz.monitor.xml.AreaXML;
|
||||
import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
|
||||
|
||||
/**
|
||||
* SAFESEAS Monitor Meteo Table.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 17, 2014 2757 skorolev Removed unnecessary printouts.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author skorolev
|
||||
* @version 1.0
|
||||
*/
|
||||
public class SSMonitorMeteoTab extends TabItemComp implements IUpdateMonitorMeteo
|
||||
{
|
||||
private SSMonitorMeteoEditDlg monitorMeteoEditDlg;
|
||||
|
@ -191,9 +207,6 @@ public class SSMonitorMeteoTab extends TabItemComp implements IUpdateMonitorMete
|
|||
ssmmd.setWindSpeedR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
|
||||
ssmmd.setWindSpeedY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
|
||||
|
||||
System.out.println("=== " + sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
|
||||
System.out.println("=== " + sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
|
||||
|
||||
/*
|
||||
* Peak Wind
|
||||
*/
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
|
|||
import com.raytheon.uf.viz.monitor.safeseas.SafeSeasMonitor;
|
||||
import com.raytheon.uf.viz.monitor.safeseas.threshold.SSThresholdMgr;
|
||||
import com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg;
|
||||
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||
|
||||
/**
|
||||
* SAFESEAS area configuration dialog.
|
||||
|
@ -42,7 +43,8 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg;
|
|||
* Nov 27, 2012 1351 skorolev Changes for non-blocking dialog.
|
||||
* Jan 29, 2014 2757 skorolev Changed OK button handler.
|
||||
* Apr 23, 2014 3054 skorolev Fixed issue with removing a new station from list.
|
||||
* Sep 15, 2014 2757 skorolev Removed extra dialog.
|
||||
* Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons.
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -52,6 +54,8 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg;
|
|||
|
||||
public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
||||
|
||||
private SSDispMonThreshDlg ssMonitorDlg;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
@ -66,15 +70,8 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
private SSMonitorConfigurationManager configManager = SSMonitorConfigurationManager
|
||||
.getInstance();
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#
|
||||
* handleOkBtnSelection()
|
||||
*/
|
||||
@Override
|
||||
protected void handleOkBtnSelection() {
|
||||
// Check for changes in the data
|
||||
if (dataIsChanged()) {
|
||||
int choice = showMessage(shell, SWT.OK | SWT.CANCEL,
|
||||
"SAFESEAS Monitor Confirm Changes",
|
||||
|
@ -95,16 +92,30 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
if ((!configManager.getAddedZones().isEmpty())
|
||||
|| (!configManager.getAddedStations().isEmpty())) {
|
||||
if (editDialog() == SWT.YES) {
|
||||
SSDispMonThreshDlg ssMonitorDlg = new SSDispMonThreshDlg(
|
||||
shell, CommonConfig.AppName.SAFESEAS,
|
||||
ssMonitorDlg = new SSDispMonThreshDlg(shell,
|
||||
CommonConfig.AppName.SAFESEAS,
|
||||
DataUsageKey.MONITOR);
|
||||
ssMonitorDlg.setCloseCallback(new ICloseCallback() {
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
// Clear added zones and stations.
|
||||
configManager.getAddedZones().clear();
|
||||
configManager.getAddedStations().clear();
|
||||
setReturnValue(true);
|
||||
close();
|
||||
}
|
||||
});
|
||||
ssMonitorDlg.open();
|
||||
}
|
||||
configManager.getAddedZones().clear();
|
||||
configManager.getAddedStations().clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ssMonitorDlg == null || ssMonitorDlg.isDisposed()) {
|
||||
setReturnValue(true);
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -38,6 +38,7 @@ import com.raytheon.uf.viz.monitor.snow.ui.dialogs.SnowMonitoringAreaConfigDlg;
|
|||
* Dec 28, 2009 3963 dhladky Initial creation.
|
||||
* March 5, 2012 14413 zhao Launch AreaConfigDlg w/o monitor
|
||||
* Nov.27, 2012 1297 skorolev Cleanup code for non-blocking dialog
|
||||
* Sep 16, 2014 2757 skorolev Added test of dialog on dispose.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -51,7 +52,7 @@ public class SnowAreaConfigAction extends AbstractHandler {
|
|||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
if (configDlg == null) {
|
||||
if (configDlg == null || configDlg.isDisposed()) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
configDlg = new SnowMonitoringAreaConfigDlg(shell,
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
|
|||
import com.raytheon.uf.viz.monitor.snow.SnowMonitor;
|
||||
import com.raytheon.uf.viz.monitor.snow.threshold.SnowThresholdMgr;
|
||||
import com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg;
|
||||
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||
|
||||
/**
|
||||
* SNOW Monitor area configuration dialog.
|
||||
|
@ -42,7 +43,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg;
|
|||
* Nov 27, 2012 1351 skorolev Changes for non-blocking dialog.
|
||||
* Jan 29, 2014 2757 skorolev Changed OK button handler.
|
||||
* Apr 23, 2014 3054 skorolev Fixed issue with removing a new station from list.
|
||||
* Sep 15, 2014 2757 skorolev Removed extra dialog.
|
||||
* Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -52,6 +53,14 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg;
|
|||
|
||||
public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
||||
|
||||
private SnowMonDispThreshDlg snowMonitorDlg;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param parent
|
||||
* @param title
|
||||
*/
|
||||
public SnowMonitoringAreaConfigDlg(Shell parent, String title) {
|
||||
super(parent, title, AppName.SNOW);
|
||||
readConfigData();
|
||||
|
@ -64,11 +73,10 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#
|
||||
* handleOkBtnSelection()
|
||||
* handleApplyBtnSelection()
|
||||
*/
|
||||
@Override
|
||||
protected void handleOkBtnSelection() {
|
||||
// Check for changes in the data
|
||||
if (dataIsChanged()) {
|
||||
int choice = showMessage(shell, SWT.OK | SWT.CANCEL,
|
||||
"SNOW Monitor Confirm Changes",
|
||||
|
@ -84,20 +92,32 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
*/
|
||||
SnowThresholdMgr.reInitialize();
|
||||
SnowMonitor.reInitialize();
|
||||
|
||||
if ((!configManager.getAddedZones().isEmpty())
|
||||
|| (!configManager.getAddedStations().isEmpty())) {
|
||||
if (editDialog() == SWT.YES) {
|
||||
SnowMonDispThreshDlg snowMonitorDlg = new SnowMonDispThreshDlg(
|
||||
shell, CommonConfig.AppName.SNOW,
|
||||
DataUsageKey.MONITOR);
|
||||
snowMonitorDlg = new SnowMonDispThreshDlg(shell,
|
||||
CommonConfig.AppName.SNOW, DataUsageKey.MONITOR);
|
||||
snowMonitorDlg.setCloseCallback(new ICloseCallback() {
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
// Clear added zones and stations.
|
||||
configManager.getAddedZones().clear();
|
||||
configManager.getAddedStations().clear();
|
||||
setReturnValue(true);
|
||||
close();
|
||||
}
|
||||
});
|
||||
snowMonitorDlg.open();
|
||||
}
|
||||
configManager.getAddedZones().clear();
|
||||
configManager.getAddedStations().clear();
|
||||
}
|
||||
configManager.getAddedZones().clear();
|
||||
configManager.getAddedStations().clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (snowMonitorDlg == null || snowMonitorDlg.isDisposed()) {
|
||||
setReturnValue(true);
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -135,5 +155,4 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
timeWindow.setSelection(configManager.getTimeWindow());
|
||||
setTimeScaleLabel();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -73,6 +73,8 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
* Oct 07, 2013 #2443 lvenable Fixed image memory leak.
|
||||
* 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
|
||||
|
@ -1054,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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1094,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);
|
||||
|
@ -1190,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");
|
||||
|
@ -1284,18 +1295,12 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
}
|
||||
|
||||
/**
|
||||
* Called when the cancel or "X" button is clicked.
|
||||
* Called when the cancel.
|
||||
*/
|
||||
private void closeWithoutSave() {
|
||||
int choice = showMessage(shell, SWT.YES | SWT.NO, appName
|
||||
+ " Monitor Exit", "Are you sure you want to exit?");
|
||||
if (choice == SWT.YES) {
|
||||
MonitorConfigurationManager configManager = getConfigManager();
|
||||
configManager.setAddedZones(new ArrayList<String>());
|
||||
configManager.setAddedStations(new ArrayList<String>());
|
||||
setReturnValue(true);
|
||||
close();
|
||||
}
|
||||
resetStatus();
|
||||
setReturnValue(true);
|
||||
close();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1304,7 +1309,8 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
protected abstract void setAlgorithmText();
|
||||
|
||||
/**
|
||||
* Handles OK button.
|
||||
* Handles OK button. Save changes and close the dialog (or just close if
|
||||
* there are no changes).
|
||||
*/
|
||||
protected abstract void handleOkBtnSelection();
|
||||
|
||||
|
@ -1466,4 +1472,5 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
"Edit Thresholds Now?", message2);
|
||||
return yesno;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,8 +26,7 @@ import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
|||
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
|
||||
|
||||
/**
|
||||
* To allow spatial information in various plugins based on what is in the
|
||||
* bundle
|
||||
* @deprecated do not extend this class, only exists for XML compatibility.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -36,6 +35,7 @@ import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
|
|||
* ------------- -------- ----------- --------------------------
|
||||
* Mar 2, 2010 mnash Initial creation
|
||||
* Oct 23, 2013 2491 bsteffen Remove ISerializableObject
|
||||
* Sep 26, 2014 3669 bsteffen Deprecate
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
|
@ -43,9 +43,11 @@ import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
|
|||
* @author mnash
|
||||
* @version 1.0
|
||||
*/
|
||||
@Deprecated
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public abstract class AbstractSpatialEnabler {
|
||||
|
||||
public void enable(PluginDataObject d, AbstractRequestableResourceData arrd) {
|
||||
/* Nothing calls this method */
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,10 +36,12 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.RecordFactory;
|
||||
import com.raytheon.uf.viz.core.alerts.AlertMessage;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.exception.NoDataAvailableException;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
|
||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
|
@ -52,9 +54,10 @@ import com.raytheon.uf.viz.core.rsc.ResourceList;
|
|||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 5, 2010 mnash Initial creation
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Jan 05, 2010 mnash Initial creation
|
||||
* Sep 26, 2014 3669 bsteffen Fix updates so that no alert parser is used.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -73,6 +76,8 @@ public class BestResResourceData extends AbstractRequestableResourceData
|
|||
@XmlAttribute
|
||||
private String productIdentifierKey;
|
||||
|
||||
/** @deprecated only exists for xml compatibility. */
|
||||
@Deprecated
|
||||
@XmlElement
|
||||
private AbstractSpatialEnabler enabler = null;
|
||||
|
||||
|
@ -132,6 +137,67 @@ public class BestResResourceData extends AbstractRequestableResourceData
|
|||
}
|
||||
}
|
||||
|
||||
private AbstractResourceData getRscToUpdate(Map<String, Object> recordMap) {
|
||||
AbstractVizResource<?, ?> rscToUse = null;
|
||||
for (AbstractVizResource<?, ?> rsc : rscs) {
|
||||
if (rsc != null) {
|
||||
AbstractRequestableResourceData arrd = (AbstractRequestableResourceData) rsc
|
||||
.getResourceData();
|
||||
String rscValue = arrd.getMetadataMap()
|
||||
.get(productIdentifierKey).getConstraintValue();
|
||||
String updateValue = recordMap.get(productIdentifierKey)
|
||||
.toString();
|
||||
if (rscValue != null && rscValue.equals(updateValue)) {
|
||||
rscToUse = rsc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// no resource found for update
|
||||
if (rscToUse == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
DataTime updateTime = (DataTime) recordMap
|
||||
.get(PluginDataObject.DATATIME_ID);
|
||||
AbstractVizResource<?, ?> curRes = bestResTimes.get(updateTime);
|
||||
|
||||
// we already have this time?
|
||||
if (rscToUse == curRes) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// new time, rscToUse is best res
|
||||
if (curRes == null) {
|
||||
bestResTimes.put(updateTime, rscToUse);
|
||||
return rscToUse.getResourceData();
|
||||
} else {
|
||||
// Check to see if rscToUse is higher res than curRes
|
||||
int curIdx = rscs.indexOf(curRes);
|
||||
int rscToUseIdx = rscs.indexOf(rscToUse);
|
||||
|
||||
if (curIdx == -1 /* shouldn't happen */
|
||||
|| rscToUseIdx < curIdx) {
|
||||
// rscToUse is higher res than curRes
|
||||
curRes.remove(updateTime);
|
||||
bestResTimes.put(updateTime, rscToUse);
|
||||
return rscToUse.getResourceData();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void update(AlertMessage... messages) {
|
||||
for (AlertMessage message : messages) {
|
||||
AbstractResourceData rscData = getRscToUpdate(message.decodedAlert);
|
||||
if (rscData != null) {
|
||||
rscData.update(new AlertMessage[] { message });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -151,57 +217,9 @@ public class BestResResourceData extends AbstractRequestableResourceData
|
|||
} catch (VizException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
AbstractVizResource<?, ?> rscToUse = null;
|
||||
for (AbstractVizResource<?, ?> rsc : rscs) {
|
||||
if (rsc != null) {
|
||||
AbstractRequestableResourceData arrd = (AbstractRequestableResourceData) rsc
|
||||
.getResourceData();
|
||||
String rscValue = arrd.getMetadataMap()
|
||||
.get(productIdentifierKey).getConstraintValue();
|
||||
String updateValue = recordMap
|
||||
.get(productIdentifierKey).toString();
|
||||
if (rscValue != null && rscValue.equals(updateValue)) {
|
||||
rscToUse = rsc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// no resource found for update
|
||||
if (rscToUse == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// We know the resource it is for
|
||||
if (enabler != null) {
|
||||
enabler.enable(updatePDO[i], this);
|
||||
}
|
||||
DataTime updateTime = updatePDO[i].getDataTime();
|
||||
AbstractVizResource<?, ?> curRes = bestResTimes.get(updateTime);
|
||||
|
||||
// we already have this time?
|
||||
if (rscToUse == curRes) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// new time, rscToUse is best res
|
||||
if (curRes == null) {
|
||||
rscToUse.getResourceData().update(
|
||||
new PluginDataObject[] { updatePDO[i] });
|
||||
bestResTimes.put(updateTime, rscToUse);
|
||||
} else {
|
||||
// Check to see if rscToUse is higher res than curRes
|
||||
int curIdx = rscs.indexOf(curRes);
|
||||
int rscToUseIdx = rscs.indexOf(rscToUse);
|
||||
|
||||
if (curIdx == -1 /* shouldn't happen */
|
||||
|| rscToUseIdx < curIdx) {
|
||||
// rscToUse is higher res than curRes
|
||||
curRes.remove(updateTime);
|
||||
rscToUse.getResourceData().update(
|
||||
new PluginDataObject[] { updatePDO[i] });
|
||||
bestResTimes.put(updateTime, rscToUse);
|
||||
}
|
||||
AbstractResourceData rscData = getRscToUpdate(recordMap);
|
||||
if (rscData != null) {
|
||||
rscData.update(new PluginDataObject[] { updatePDO[i] });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -235,6 +253,7 @@ public class BestResResourceData extends AbstractRequestableResourceData
|
|||
protected AbstractVizResource<?, ?> constructResource(
|
||||
LoadProperties loadProperties, PluginDataObject[] objects)
|
||||
throws VizException {
|
||||
this.enabler = null;
|
||||
this.retrieveData = true;
|
||||
return new BestResResource(this, loadProperties);
|
||||
}
|
||||
|
|
|
@ -146,14 +146,16 @@
|
|||
<command id="com.raytheon.viz.gfe.actions.ShowProcessMonitorDialog"
|
||||
name="ShowProcessMonitorDialog">
|
||||
</command>
|
||||
<command id="com.raytheon.viz.gfe.actions.ShowDeleteSampleSetDialog"
|
||||
name="ShowDeleteSampleSetDialog">
|
||||
</command>
|
||||
<command id="com.raytheon.viz.gfe.actions.ShowLoadSampleSetDialog"
|
||||
name="ShowLoadSampleSetDialog">
|
||||
</command>
|
||||
<command id="com.raytheon.viz.gfe.actions.ShowSaveSampleSetDialog"
|
||||
name="ShowSaveSampleSetDialog">
|
||||
<command id="com.raytheon.viz.gfe.actions.ShowSaveDeleteSampleSetDialog"
|
||||
name="ShowSaveDeleteSampleSetDialog">
|
||||
<commandParameter
|
||||
id="Action"
|
||||
name="Action"
|
||||
optional="false">
|
||||
</commandParameter>
|
||||
</command>
|
||||
<command id="com.raytheon.viz.gfe.actions.ShowClearSamples"
|
||||
name="ShowClearSamples">
|
||||
|
@ -574,13 +576,6 @@
|
|||
<activeWhen>
|
||||
<reference definitionId="com.raytheon.viz.gfe.inGFEActionSet">
|
||||
</reference>
|
||||
</activeWhen>
|
||||
</handler>
|
||||
<handler class="com.raytheon.viz.gfe.actions.ShowDeleteSampleSetDialog"
|
||||
commandId="com.raytheon.viz.gfe.actions.ShowDeleteSampleSetDialog">
|
||||
<activeWhen>
|
||||
<reference definitionId="com.raytheon.viz.gfe.inGFEActionSet">
|
||||
</reference>
|
||||
</activeWhen>
|
||||
</handler>
|
||||
<handler class="com.raytheon.viz.gfe.actions.ShowLoadSampleSetDialog"
|
||||
|
@ -590,8 +585,8 @@
|
|||
</reference>
|
||||
</activeWhen>
|
||||
</handler>
|
||||
<handler class="com.raytheon.viz.gfe.actions.ShowSaveSampleSetDialog"
|
||||
commandId="com.raytheon.viz.gfe.actions.ShowSaveSampleSetDialog">
|
||||
<handler class="com.raytheon.viz.gfe.actions.ShowSaveDeleteSampleSetDialog"
|
||||
commandId="com.raytheon.viz.gfe.actions.ShowSaveDeleteSampleSetDialog">
|
||||
<activeWhen>
|
||||
<reference definitionId="com.raytheon.viz.gfe.inGFEActionSet">
|
||||
</reference>
|
||||
|
@ -1349,11 +1344,19 @@
|
|||
<command commandId="com.raytheon.viz.gfe.actions.ShowClearSamples"
|
||||
label="Clear">
|
||||
</command>
|
||||
<command commandId="com.raytheon.viz.gfe.actions.ShowSaveSampleSetDialog"
|
||||
<command commandId="com.raytheon.viz.gfe.actions.ShowSaveDeleteSampleSetDialog"
|
||||
label="Save...">
|
||||
<parameter
|
||||
name="Action"
|
||||
value="Save">
|
||||
</parameter>
|
||||
</command>
|
||||
<command commandId="com.raytheon.viz.gfe.actions.ShowDeleteSampleSetDialog"
|
||||
<command commandId="com.raytheon.viz.gfe.actions.ShowSaveDeleteSampleSetDialog"
|
||||
label="Delete...">
|
||||
<parameter
|
||||
name="Action"
|
||||
value="Delete">
|
||||
</parameter>
|
||||
</command>
|
||||
<separator name="xxx" visible="true" />
|
||||
<command
|
||||
|
|
|
@ -58,7 +58,6 @@ import com.raytheon.uf.common.util.FileUtil;
|
|||
* Sep 05, 2013 #2307 dgilling Use better PythonScript constructor.
|
||||
* Sep 11, 2013 #2033 dgilling Don't load loadConfig.py from
|
||||
* localization store.
|
||||
* Apr 02, 2014 #2729 randerso Added commonPython to path for LogStream
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -90,7 +89,6 @@ public class PythonPreferenceStore implements IPreferenceStore,
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void loadConfiguration(String configName) {
|
||||
String commonPythonPath = GfePyIncludeUtil.getCommonPythonIncludePath();
|
||||
String configPath = GfePyIncludeUtil.getConfigIncludePath();
|
||||
String vtecPath = GfePyIncludeUtil.getVtecIncludePath();
|
||||
|
||||
|
@ -102,8 +100,8 @@ public class PythonPreferenceStore implements IPreferenceStore,
|
|||
new Path(FileUtil.join("python", "utility",
|
||||
"loadConfig.py")), null)).getPath());
|
||||
py = new PythonScript(scriptFile.getPath(),
|
||||
PyUtil.buildJepIncludePath(commonPythonPath, configPath,
|
||||
vtecPath), this.getClass().getClassLoader());
|
||||
PyUtil.buildJepIncludePath(configPath, vtecPath), this
|
||||
.getClass().getClassLoader());
|
||||
} catch (JepException e) {
|
||||
statusHandler.handle(Priority.CRITICAL,
|
||||
"Unable to load GFE config", e);
|
||||
|
@ -190,7 +188,7 @@ public class PythonPreferenceStore implements IPreferenceStore,
|
|||
public void firePropertyChangeEvent(String name, Object oldValue,
|
||||
Object newValue) {
|
||||
// The following criteria meets the Eclipse contract
|
||||
if ((oldValue == null) || oldValue.equals(newValue)) {
|
||||
if (oldValue == null || oldValue.equals(newValue)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -677,32 +675,32 @@ public class PythonPreferenceStore implements IPreferenceStore,
|
|||
|
||||
public boolean isBoolean(String name) {
|
||||
Object obj = selectedConfiguration.get(name);
|
||||
return ((obj != null) && (obj instanceof Boolean));
|
||||
return (obj != null && obj instanceof Boolean);
|
||||
}
|
||||
|
||||
public boolean isInt(String name) {
|
||||
Object obj = selectedConfiguration.get(name);
|
||||
return ((obj != null) && (obj instanceof Integer));
|
||||
return (obj != null && obj instanceof Integer);
|
||||
}
|
||||
|
||||
public boolean isFloat(String name) {
|
||||
Object obj = selectedConfiguration.get(name);
|
||||
return ((obj != null) && (obj instanceof Float));
|
||||
return (obj != null && obj instanceof Float);
|
||||
}
|
||||
|
||||
public boolean isDouble(String name) {
|
||||
Object obj = selectedConfiguration.get(name);
|
||||
return ((obj != null) && (obj instanceof Double));
|
||||
return (obj != null && obj instanceof Double);
|
||||
}
|
||||
|
||||
public boolean isLong(String name) {
|
||||
Object obj = selectedConfiguration.get(name);
|
||||
return ((obj != null) && (obj instanceof Long));
|
||||
return (obj != null && obj instanceof Long);
|
||||
}
|
||||
|
||||
public boolean isString(String name) {
|
||||
Object obj = selectedConfiguration.get(name);
|
||||
return ((obj != null) && (obj instanceof String));
|
||||
return (obj != null && obj instanceof String);
|
||||
}
|
||||
|
||||
public boolean isStringArray(String name) {
|
||||
|
@ -713,7 +711,7 @@ public class PythonPreferenceStore implements IPreferenceStore,
|
|||
result = true;
|
||||
} else if (obj instanceof List) {
|
||||
List<?> list = (List<?>) obj;
|
||||
if ((list.size() == 0) || (list.get(0) instanceof String)) {
|
||||
if (list.size() == 0 || list.get(0) instanceof String) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
@ -730,7 +728,7 @@ public class PythonPreferenceStore implements IPreferenceStore,
|
|||
result = true;
|
||||
} else if (obj instanceof List) {
|
||||
List<?> list = (List<?>) obj;
|
||||
if ((list.size() == 0) || (list.get(0) instanceof Float)) {
|
||||
if (list.size() == 0 || list.get(0) instanceof Float) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
@ -747,7 +745,7 @@ public class PythonPreferenceStore implements IPreferenceStore,
|
|||
result = true;
|
||||
} else if (obj instanceof List) {
|
||||
List<?> list = (List<?>) obj;
|
||||
if ((list.size() == 0) || (list.get(0) instanceof Integer)) {
|
||||
if (list.size() == 0 || list.get(0) instanceof Integer) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,136 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.viz.gfe.actions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.window.Window;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.sample.SampleId;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.viz.gfe.core.DataManager;
|
||||
import com.raytheon.viz.gfe.dialogs.SampleSetDialog;
|
||||
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||
|
||||
/**
|
||||
* Action for launching delete samples dialog.
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 7, 2008 Eric Babin Initial Creation
|
||||
* 22JUL2008 #1275. Eric Babin Remove inadvertent dispose on parent shell.
|
||||
* Oct 24, 2012 #1287 rferrel Changes for non-blocking SampleSetDialog.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author ebabin
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ShowDeleteSampleSetDialog extends AbstractHandler {
|
||||
private final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(ShowDeleteSampleSetDialog.class);
|
||||
|
||||
private SampleSetDialog dialog;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands
|
||||
* .ExecutionEvent)
|
||||
*/
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) {
|
||||
ArrayList<SampleId> sampleIdList = DataManager.getCurrentInstance()
|
||||
.getSampleSetManager().getInventoryAsList();
|
||||
|
||||
Collections.sort(sampleIdList, new Comparator<SampleId>() {
|
||||
|
||||
@Override
|
||||
public int compare(SampleId o1, SampleId o2) {
|
||||
return o1.getName().compareTo(o2.getName());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
|
||||
dialog = new SampleSetDialog(shell, sampleIdList,
|
||||
SampleSetDialog.DELETE);
|
||||
|
||||
dialog.setBlockOnOpen(false);
|
||||
dialog.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof Integer) {
|
||||
int returnCode = (Integer) returnValue;
|
||||
doDialogClose(returnCode);
|
||||
}
|
||||
dialog = null;
|
||||
}
|
||||
});
|
||||
dialog.open();
|
||||
} else {
|
||||
dialog.bringToTop();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void doDialogClose(int returnCode) {
|
||||
if (returnCode != Window.CANCEL
|
||||
&& dialog.getSelectedSampleIdIndexes() != null) {
|
||||
List<SampleId> sampleIdList = dialog.getSamples();
|
||||
SampleId id = sampleIdList
|
||||
.get(dialog.getSelectedSampleIdIndexes()[0]);
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
|
||||
if (MessageDialog.openConfirm(shell, "Delete sample set",
|
||||
"Delete selected sample set?")) {
|
||||
if (DataManager.getCurrentInstance().getSampleSetManager()
|
||||
.deleteSampleSet(id)) {
|
||||
statusHandler.handle(Priority.EVENTA, id.getName()
|
||||
+ ", Sample set deleted successfully");
|
||||
} else {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error deleting sample set, " + id.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,27 +19,17 @@
|
|||
**/
|
||||
package com.raytheon.viz.gfe.actions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.jface.window.Window;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.sample.SampleId;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.viz.gfe.GFEException;
|
||||
import com.raytheon.viz.gfe.core.DataManager;
|
||||
import com.raytheon.viz.gfe.core.ISampleSetManager;
|
||||
import com.raytheon.viz.gfe.dialogs.SampleSetDialog;
|
||||
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||
import com.raytheon.viz.gfe.core.DataManagerUIFactory;
|
||||
import com.raytheon.viz.gfe.dialogs.LoadSampleSetDialog;
|
||||
|
||||
/**
|
||||
* Action to launch sampele set dialog.
|
||||
|
@ -51,6 +41,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
* Mar 7, 2008 Eric Babin Initial Creation
|
||||
* Apr 9, 2009 1288 rjpeter Removed explicit refresh of SpatialDisplayManager.
|
||||
* Oct 24, 2012 1287 rferrel Changes for non-blocking SampleSetDialog.
|
||||
* Sep 15, 2014 3592 randerso Move logic into dialog code.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -60,11 +51,9 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
|
||||
public class ShowLoadSampleSetDialog extends AbstractHandler {
|
||||
private final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(ShowLoadSampleSetDialog.class);
|
||||
.getHandler(ShowSaveDeleteSampleSetDialog.class);
|
||||
|
||||
private SampleSetDialog dialog;
|
||||
|
||||
private DataManager dm;
|
||||
private LoadSampleSetDialog dialog;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
|
@ -74,82 +63,26 @@ public class ShowLoadSampleSetDialog extends AbstractHandler {
|
|||
* .ExecutionEvent)
|
||||
*/
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) {
|
||||
dm = DataManager.getCurrentInstance();
|
||||
if (dm == null) {
|
||||
return null;
|
||||
}
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
DataManager dm = DataManagerUIFactory.getCurrentInstance();
|
||||
if (dm == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ((dialog == null) || (dialog.getShell() == null)
|
||||
|| dialog.isDisposed()) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
|
||||
ArrayList<SampleId> sampleIdList = dm.getSampleSetManager()
|
||||
.getInventoryAsList();
|
||||
|
||||
Collections.sort(sampleIdList, new Comparator<SampleId>() {
|
||||
|
||||
@Override
|
||||
public int compare(SampleId o1, SampleId o2) {
|
||||
return o1.getName().compareTo(o2.getName());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
dialog = new SampleSetDialog(shell, sampleIdList,
|
||||
SampleSetDialog.LOAD);
|
||||
dialog = new LoadSampleSetDialog(dm.getSampleSetManager(), shell);
|
||||
|
||||
dialog.setBlockOnOpen(false);
|
||||
dialog.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof Integer) {
|
||||
int returnCode = (Integer) returnValue;
|
||||
doDialogClosed(returnCode);
|
||||
}
|
||||
dialog = null;
|
||||
}
|
||||
});
|
||||
|
||||
dialog.open();
|
||||
} else {
|
||||
dialog.bringToTop();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void doDialogClosed(int returnCode) {
|
||||
if (returnCode != Window.CANCEL
|
||||
&& dialog.getSelectedSampleIdIndexes() != null) {
|
||||
List<SampleId> sampleIdList = dialog.getSamples();
|
||||
ISampleSetManager.SampleSetLoadMode mode = null;
|
||||
switch (returnCode) {
|
||||
case SampleSetDialog.OK:
|
||||
mode = ISampleSetManager.SampleSetLoadMode.ADD;
|
||||
break;
|
||||
case SampleSetDialog.REMOVE:
|
||||
mode = ISampleSetManager.SampleSetLoadMode.REMOVE;
|
||||
break;
|
||||
case SampleSetDialog.REPLACE:
|
||||
mode = ISampleSetManager.SampleSetLoadMode.REPLACE;
|
||||
break;
|
||||
default:
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Load unknow return code: " + returnCode);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int index : dialog.getSelectedSampleIdIndexes()) {
|
||||
SampleId id = sampleIdList.get(index);
|
||||
try {
|
||||
dm.getSampleSetManager().loadSampleSet(id, mode);
|
||||
} catch (GFEException e) {
|
||||
statusHandler.handle(Priority.ERROR,
|
||||
"Load failed for mode: " + mode.toString()
|
||||
+ ", sample id: " + id.toString(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.viz.gfe.actions;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.viz.gfe.core.DataManager;
|
||||
import com.raytheon.viz.gfe.core.DataManagerUIFactory;
|
||||
import com.raytheon.viz.gfe.dialogs.SaveDeleteSampleSetDialog;
|
||||
|
||||
/**
|
||||
* Action for launching delete samples dialog.
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 7, 2008 Eric Babin Initial Creation
|
||||
* Jul 28, 2008 #1275. Eric Babin Remove inadvertent dispose on parent shell.
|
||||
* Oct 24, 2012 #1287 rferrel Changes for non-blocking SampleSetDialog.
|
||||
* Sep 15, 2014 #3592 randerso Renamed class, moved logic to dialog.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author ebabin
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ShowSaveDeleteSampleSetDialog extends AbstractHandler {
|
||||
private final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(ShowSaveDeleteSampleSetDialog.class);
|
||||
|
||||
private SaveDeleteSampleSetDialog dialog;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands
|
||||
* .ExecutionEvent)
|
||||
*/
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
DataManager dm = DataManagerUIFactory.getCurrentInstance();
|
||||
if (dm == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ((dialog == null) || (dialog.getShell() == null)
|
||||
|| dialog.isDisposed()) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
|
||||
String action = event.getParameter("Action");
|
||||
dialog = new SaveDeleteSampleSetDialog(dm.getSampleSetManager(),
|
||||
shell, action);
|
||||
|
||||
dialog.setBlockOnOpen(false);
|
||||
dialog.open();
|
||||
} else {
|
||||
dialog.bringToTop();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,113 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.viz.gfe.actions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.sample.SampleId;
|
||||
import com.raytheon.viz.gfe.core.DataManager;
|
||||
import com.raytheon.viz.gfe.core.ISampleSetManager;
|
||||
import com.raytheon.viz.gfe.dialogs.SampleSetDialog;
|
||||
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||
|
||||
/**
|
||||
* Action to show save sample set dialog.
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 7, 2008 Eric Babin Initial Creation
|
||||
* Oct 24, 2012 1287 rferrel Changes for non-blocking SampleSetDialog.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author ebabin
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ShowSaveSampleSetDialog extends AbstractHandler {
|
||||
private SampleSetDialog dialog;
|
||||
|
||||
private ISampleSetManager sampleMgr;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands
|
||||
* .ExecutionEvent)
|
||||
*/
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
|
||||
sampleMgr = DataManager.getCurrentInstance().getSampleSetManager();
|
||||
|
||||
ArrayList<SampleId> sampleIdList = sampleMgr.getInventoryAsList();
|
||||
Collections.sort(sampleIdList, new Comparator<SampleId>() {
|
||||
|
||||
@Override
|
||||
public int compare(SampleId o1, SampleId o2) {
|
||||
return o1.getName().compareTo(o2.getName());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
dialog = new SampleSetDialog(shell, sampleIdList,
|
||||
SampleSetDialog.SAVE);
|
||||
|
||||
dialog.setBlockOnOpen(false);
|
||||
dialog.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof Integer) {
|
||||
int returnCode = (Integer) returnValue;
|
||||
doDialogClose(returnCode);
|
||||
}
|
||||
dialog = null;
|
||||
}
|
||||
});
|
||||
dialog.open();
|
||||
} else {
|
||||
dialog.bringToTop();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void doDialogClose(int returnCode) {
|
||||
if ((returnCode == SampleSetDialog.OK)
|
||||
&& (dialog.getSelectedSampleIdIndexes() != null)
|
||||
&& (dialog.getSampleName() != null)) {
|
||||
sampleMgr.saveActiveSampleSet(new SampleId(dialog.getSampleName()));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -20,12 +20,10 @@
|
|||
|
||||
package com.raytheon.viz.gfe.core;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.sample.SampleId;
|
||||
import com.raytheon.viz.gfe.GFEException;
|
||||
import com.raytheon.viz.gfe.core.msgs.ISampleSetChangedListener;
|
||||
import com.raytheon.viz.gfe.edittool.GridID;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
@ -39,15 +37,33 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 30, 2008 chammack Initial creation
|
||||
* Apr 09, 2009 1288 rjpeter Added add/remove method for sample set listener
|
||||
* Sep 09, 2014 3592 randerso Added dispose method, removed networkNotification method
|
||||
* Sep 09, 2014 3592 randerso Added dispose method,
|
||||
* removed getInventoryAsList and networkNotification,
|
||||
* improved JavaDoc
|
||||
* </pre>
|
||||
*
|
||||
* @author chammack
|
||||
* @version 1.0
|
||||
*/
|
||||
public interface ISampleSetManager {
|
||||
/**
|
||||
* Sample Set Load Mode
|
||||
*/
|
||||
public static enum SampleSetLoadMode {
|
||||
ADD, REMOVE, REPLACE
|
||||
/**
|
||||
* Add sample set to existing sample points
|
||||
*/
|
||||
ADD,
|
||||
|
||||
/**
|
||||
* Remove sample set from existing sample points
|
||||
*/
|
||||
REMOVE,
|
||||
|
||||
/**
|
||||
* Replase existing sample points with sample set
|
||||
*/
|
||||
REPLACE
|
||||
}
|
||||
|
||||
public static final float DEFAULT_THRESHOLD = 0.0f;
|
||||
|
@ -64,8 +80,7 @@ public interface ISampleSetManager {
|
|||
* @param setName
|
||||
* @return the locations
|
||||
*/
|
||||
public List<Coordinate> sampleSetLocations(final String setName)
|
||||
throws GFEException;
|
||||
public List<Coordinate> sampleSetLocations(final String setName);
|
||||
|
||||
/**
|
||||
* Loads the named sample set and mixes it with the active sample set in a
|
||||
|
@ -81,7 +96,7 @@ public interface ISampleSetManager {
|
|||
* @param loadMode
|
||||
*/
|
||||
public void loadSampleSet(final SampleId sampleId,
|
||||
SampleSetLoadMode loadMode) throws GFEException;
|
||||
SampleSetLoadMode loadMode);
|
||||
|
||||
/**
|
||||
* Clears all anchored samples.
|
||||
|
@ -211,13 +226,6 @@ public interface ISampleSetManager {
|
|||
*/
|
||||
public SampleId[] getInventory();
|
||||
|
||||
/**
|
||||
* Return the inventory as a list
|
||||
*
|
||||
* @return the inventory
|
||||
*/
|
||||
public ArrayList<SampleId> getInventoryAsList();
|
||||
|
||||
/**
|
||||
* @return the inventory
|
||||
*/
|
||||
|
|
|
@ -29,6 +29,8 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.geotools.referencing.GeodeticCalculator;
|
||||
|
||||
|
@ -55,6 +57,7 @@ import com.raytheon.viz.gfe.GFEException;
|
|||
import com.raytheon.viz.gfe.core.ISampleSetManager;
|
||||
import com.raytheon.viz.gfe.core.msgs.ISampleSetChangedListener;
|
||||
import com.raytheon.viz.gfe.edittool.GridID;
|
||||
import com.raytheon.viz.gfe.ui.AccessMgr;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
||||
/**
|
||||
|
@ -69,7 +72,9 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* Apr 9, 2009 1288 rjpeter Added ISampleSetChangedListener handling.
|
||||
* Aug 6, 2013 1561 njensen Use pm.listFiles() instead of pm.listStaticFiles()
|
||||
* Sep 30, 2013 2361 njensen Use JAXBManager for XML
|
||||
* Sep 08, 2104 #3592 randerso Changed to use new pm listStaticFiles()
|
||||
* Sep 08, 2104 #3592 randerso Changed to use new pm listStaticFiles().
|
||||
* Reworked inventory to use a map to better handle
|
||||
* files at multiple localization levels
|
||||
* </pre>
|
||||
*
|
||||
* @author rbell
|
||||
|
@ -88,7 +93,7 @@ public class SampleSetManager implements ISampleSetManager,
|
|||
|
||||
private SampleId loadedSet;
|
||||
|
||||
private Set<SampleId> inventory;
|
||||
private SortedMap<String, SampleId> inventory;
|
||||
|
||||
private ArrayList<Coordinate> locations;
|
||||
|
||||
|
@ -110,7 +115,7 @@ public class SampleSetManager implements ISampleSetManager,
|
|||
public SampleSetManager() {
|
||||
this.loadedSet = new SampleId();
|
||||
|
||||
this.inventory = new HashSet<SampleId>();
|
||||
this.inventory = new TreeMap<String, SampleId>();
|
||||
|
||||
this.locations = new ArrayList<Coordinate>();
|
||||
|
||||
|
@ -129,10 +134,11 @@ public class SampleSetManager implements ISampleSetManager,
|
|||
LocalizationType.COMMON_STATIC, SAMPLE_SETS_DIR,
|
||||
new String[] { ".xml" }, true, true);
|
||||
|
||||
for (LocalizationFile file : files) {
|
||||
String fn = LocalizationUtil.extractName(file.getName()).replace(
|
||||
for (LocalizationFile lf : files) {
|
||||
String name = LocalizationUtil.extractName(lf.getName()).replace(
|
||||
".xml", "");
|
||||
this.inventory.add(new SampleId(fn));
|
||||
this.inventory.put(name, new SampleId(name, false, lf.getContext()
|
||||
.getLocalizationLevel()));
|
||||
}
|
||||
this.sampleSetDir.addFileUpdatedObserver(this);
|
||||
|
||||
|
@ -140,9 +146,9 @@ public class SampleSetManager implements ISampleSetManager,
|
|||
String[] sampleSets = Activator.getDefault().getPreferenceStore()
|
||||
.getStringArray("DefaultSamples");
|
||||
if (sampleSets != null) {
|
||||
for (String id : sampleSets) {
|
||||
SampleId sid = new SampleId(id);
|
||||
if (this.inventory.contains(sid)) {
|
||||
for (String name : sampleSets) {
|
||||
SampleId sid = inventory.get(name);
|
||||
if (sid != null) {
|
||||
loadSampleSet(sid, SampleSetLoadMode.ADD);
|
||||
}
|
||||
}
|
||||
|
@ -171,31 +177,27 @@ public class SampleSetManager implements ISampleSetManager,
|
|||
@Override
|
||||
public List<Coordinate> sampleSetLocations(final String setName) {
|
||||
// verify set in inventory
|
||||
boolean found = false;
|
||||
for (SampleId thisId : this.inventory) {
|
||||
if (setName.equals(thisId.getName())) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
SampleId sampleId = this.inventory.get(setName);
|
||||
|
||||
if (!found) {
|
||||
if (sampleId == null) {
|
||||
statusHandler
|
||||
.error("Attempt to get locations for unknown sample set ["
|
||||
+ setName + "]");
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
String fileName = FileUtil.join(SAMPLE_SETS_DIR, setName + ".xml");
|
||||
String fileName = FileUtil.join(SAMPLE_SETS_DIR, sampleId.getName()
|
||||
+ ".xml");
|
||||
|
||||
LocalizationFile file = PathManagerFactory.getPathManager()
|
||||
.getStaticLocalizationFile(fileName);
|
||||
LocalizationFile lf = this.pathManager.getLocalizationFile(
|
||||
this.pathManager.getContext(LocalizationType.COMMON_STATIC,
|
||||
sampleId.getAccess()), fileName);
|
||||
|
||||
File f = null;
|
||||
File file = null;
|
||||
try {
|
||||
f = file.getFile(true);
|
||||
file = lf.getFile(true);
|
||||
} catch (LocalizationException e) {
|
||||
if (f == null) {
|
||||
if (file == null) {
|
||||
statusHandler.error("An error occurred retrieving SampleSet: "
|
||||
+ fileName, e);
|
||||
return Collections.emptyList();
|
||||
|
@ -205,9 +207,9 @@ public class SampleSetManager implements ISampleSetManager,
|
|||
SampleData sampleData = null;
|
||||
try {
|
||||
sampleData = SampleData.getJAXBManager().unmarshalFromXmlFile(
|
||||
f.getAbsolutePath());
|
||||
file.getAbsolutePath());
|
||||
} catch (Exception e) {
|
||||
statusHandler.error("Unable to load sampledata: " + f, e);
|
||||
statusHandler.error("Unable to load sampledata: " + file, e);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
@ -225,8 +227,8 @@ public class SampleSetManager implements ISampleSetManager,
|
|||
@Override
|
||||
public void loadSampleSet(final SampleId sampleId,
|
||||
SampleSetLoadMode loadMode) {
|
||||
File f = PathManagerFactory.getPathManager().getStaticFile(
|
||||
FileUtil.join(SAMPLE_SETS_DIR, sampleId.getName() + ".xml"));
|
||||
File f = this.pathManager.getStaticFile(FileUtil.join(SAMPLE_SETS_DIR,
|
||||
sampleId.getName() + ".xml"));
|
||||
|
||||
SampleData sampleData = null;
|
||||
try {
|
||||
|
@ -414,12 +416,10 @@ public class SampleSetManager implements ISampleSetManager,
|
|||
|
||||
SampleData sd = new SampleData(sampleId, sampleLocations);
|
||||
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
LocalizationContext lc = this.pathManager.getContext(
|
||||
LocalizationType.COMMON_STATIC, LocalizationLevel.USER);
|
||||
|
||||
LocalizationContext lc = pm.getContext(LocalizationType.COMMON_STATIC,
|
||||
LocalizationLevel.USER);
|
||||
|
||||
LocalizationFile file = pm.getLocalizationFile(lc,
|
||||
LocalizationFile file = this.pathManager.getLocalizationFile(lc,
|
||||
FileUtil.join(SAMPLE_SETS_DIR, sampleId.getName() + ".xml"));
|
||||
|
||||
try {
|
||||
|
@ -459,27 +459,25 @@ public class SampleSetManager implements ISampleSetManager,
|
|||
*/
|
||||
@Override
|
||||
public boolean deleteSampleSet(final SampleId sampleId) {
|
||||
LocalizationFile file = PathManagerFactory.getPathManager()
|
||||
.getStaticLocalizationFile(
|
||||
FileUtil.join(SAMPLE_SETS_DIR, sampleId.getName()
|
||||
+ ".xml"));
|
||||
|
||||
LocalizationContext context = file.getContext();
|
||||
if (context.getLocalizationLevel() != LocalizationLevel.USER) {
|
||||
statusHandler.handle(Priority.PROBLEM, "Unable to delete "
|
||||
+ sampleId.getName()
|
||||
+ ", because it is not a sampleset owned by you.");
|
||||
return false;
|
||||
LocalizationContext ctx = this.pathManager.getContext(
|
||||
LocalizationType.COMMON_STATIC, LocalizationLevel.USER);
|
||||
LocalizationFile lf = this.pathManager.getLocalizationFile(ctx,
|
||||
FileUtil.join(SAMPLE_SETS_DIR, sampleId.getName() + ".xml"));
|
||||
|
||||
if ((lf != null)
|
||||
&& (AccessMgr.verifyDelete(lf.getName(),
|
||||
LocalizationType.COMMON_STATIC, false))) {
|
||||
try {
|
||||
lf.delete();
|
||||
return true;
|
||||
} catch (LocalizationException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, "Unable to sample set "
|
||||
+ sampleId.getName() + " from server.", e);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
file.delete();
|
||||
} catch (LocalizationOpFailedException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error deleting from localization server", e);
|
||||
}
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -494,19 +492,24 @@ public class SampleSetManager implements ISampleSetManager,
|
|||
|
||||
String name = LocalizationUtil.extractName(message.getFileName())
|
||||
.replace(".xml", "");
|
||||
SampleId id = new SampleId(name);
|
||||
SampleId id = new SampleId(name, false, message.getContext()
|
||||
.getLocalizationLevel());
|
||||
|
||||
switch (message.getChangeType()) {
|
||||
case ADDED:
|
||||
case UPDATED:
|
||||
this.inventory.add(id);
|
||||
SampleId existing = this.inventory.get(id.getName());
|
||||
if ((existing == null)
|
||||
|| (existing.getAccess().compareTo(id.getAccess()) <= 0)) {
|
||||
this.inventory.put(id.getName(), id);
|
||||
|
||||
// loaded sample set "added", may simply be a rename
|
||||
if (id.getName().equals(this.loadedSet.getName())) {
|
||||
loadSampleSet(id, SampleSetLoadMode.REPLACE);
|
||||
}
|
||||
if (id.getName().equals(SampleSetManager.MARKER_NAME)) {
|
||||
getMarkerPoints();
|
||||
// loaded sample set "added", may simply be a rename
|
||||
if (id.getName().equals(this.loadedSet.getName())) {
|
||||
loadSampleSet(id, SampleSetLoadMode.REPLACE);
|
||||
}
|
||||
if (id.getName().equals(SampleSetManager.MARKER_NAME)) {
|
||||
getMarkerPoints();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -515,13 +518,15 @@ public class SampleSetManager implements ISampleSetManager,
|
|||
LocalizationType.COMMON_STATIC, message.getFileName(),
|
||||
new String[] { ".xml" }, false, true);
|
||||
|
||||
if (files.length == 0) {
|
||||
this.inventory.remove(id.getName());
|
||||
} else {
|
||||
this.inventory.put(id.getName(), new SampleId(id.getName(),
|
||||
false, files[0].getContext().getLocalizationLevel()));
|
||||
}
|
||||
|
||||
if (id.getName().equals(this.loadedSet.getName())) {
|
||||
if (files.length > 0) {
|
||||
loadSampleSet(id, SampleSetLoadMode.REPLACE);
|
||||
} else {
|
||||
this.inventory.remove(id);
|
||||
this.loadedSet = new SampleId();
|
||||
}
|
||||
this.loadedSet = new SampleId();
|
||||
}
|
||||
|
||||
if (id.getName().equals(SampleSetManager.MARKER_NAME)) {
|
||||
|
@ -608,11 +613,9 @@ public class SampleSetManager implements ISampleSetManager,
|
|||
// ensure it is in the inventory
|
||||
this.markerLocations.clear();
|
||||
|
||||
for (Iterator<SampleId> it = this.inventory.iterator(); it.hasNext();) {
|
||||
SampleId id = it.next();
|
||||
if (id.getName().startsWith(MARKER_NAME)) {
|
||||
markerLocations.put(id.getName(),
|
||||
this.sampleSetLocations(id.getName()));
|
||||
for (String name : this.inventory.keySet()) {
|
||||
if (name.startsWith(MARKER_NAME)) {
|
||||
markerLocations.put(name, this.sampleSetLocations(name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -634,21 +637,8 @@ public class SampleSetManager implements ISampleSetManager,
|
|||
*/
|
||||
@Override
|
||||
public SampleId[] getInventory() {
|
||||
return this.inventory.toArray(new SampleId[this.inventory.size()]);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.gfe.core.ISampleSetManager#getInventoryAsList()
|
||||
*/
|
||||
@Override
|
||||
public ArrayList<SampleId> getInventoryAsList() {
|
||||
ArrayList<SampleId> ids = new ArrayList<SampleId>();
|
||||
for (SampleId id : this.inventory) {
|
||||
ids.add(id);
|
||||
}
|
||||
return ids;
|
||||
return this.inventory.values().toArray(
|
||||
new SampleId[this.inventory.size()]);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -660,9 +650,8 @@ public class SampleSetManager implements ISampleSetManager,
|
|||
public String[] getInventoryAsStrings() {
|
||||
String[] retVal = new String[this.inventory.size()];
|
||||
int i = 0;
|
||||
for (SampleId id : this.inventory) {
|
||||
retVal[i] = id.getName();
|
||||
i++;
|
||||
for (String name : this.inventory.keySet()) {
|
||||
retVal[i++] = name;
|
||||
}
|
||||
|
||||
return retVal;
|
||||
|
@ -721,6 +710,15 @@ public class SampleSetManager implements ISampleSetManager,
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Load sample set (for Python use)
|
||||
*
|
||||
* @param sampleId
|
||||
* id of sample set to load
|
||||
* @param loadMode
|
||||
* load mode
|
||||
* @throws GFEException
|
||||
*/
|
||||
public void loadSampleSet(final SampleId sampleId, String loadMode)
|
||||
throws GFEException {
|
||||
loadSampleSet(sampleId, SampleSetLoadMode.valueOf(loadMode));
|
||||
|
|
|
@ -221,7 +221,11 @@ public class SelectTimeRangeManager implements ISelectTimeRangeManager,
|
|||
message.getContext(), message.getFileName());
|
||||
range = loadTimeRange(lf);
|
||||
if (range != null) {
|
||||
this.rangeMap.put(range.getName(), range);
|
||||
SelectTimeRange existing = this.rangeMap.get(range.getName());
|
||||
if ((existing == null)
|
||||
|| (existing.getLevel().compareTo(range.getLevel()) <= 0)) {
|
||||
this.rangeMap.put(range.getName(), range);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -0,0 +1,161 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.viz.gfe.dialogs;
|
||||
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.List;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.sample.SampleId;
|
||||
import com.raytheon.viz.gfe.core.ISampleSetManager;
|
||||
import com.raytheon.viz.gfe.core.ISampleSetManager.SampleSetLoadMode;
|
||||
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
||||
|
||||
/**
|
||||
* Dialog for selecting sample sets to load
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 15, 2014 #3592 randerso Re-implemented to match A1
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author randerso
|
||||
* @version 1.0
|
||||
*/
|
||||
public class LoadSampleSetDialog extends CaveJFACEDialog {
|
||||
|
||||
private static final int ADD_ID = IDialogConstants.CLIENT_ID;
|
||||
|
||||
private static final int REMOVE_ID = IDialogConstants.CLIENT_ID + 1;
|
||||
|
||||
private static final int REPLACE_ID = IDialogConstants.CLIENT_ID + 2;
|
||||
|
||||
private ISampleSetManager sampleSetMgr;
|
||||
|
||||
private String[] sets;
|
||||
|
||||
private List sampleSetList;
|
||||
|
||||
public LoadSampleSetDialog(ISampleSetManager sampleSetMgr, Shell parent) {
|
||||
super(parent);
|
||||
|
||||
this.sampleSetMgr = sampleSetMgr;
|
||||
this.sets = this.sampleSetMgr.getInventoryAsStrings();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Control createDialogArea(Composite parent) {
|
||||
Composite comp = (Composite) super.createDialogArea(parent);
|
||||
|
||||
Label label = new Label(comp, SWT.NONE);
|
||||
GridData layoutData = new GridData(SWT.DEFAULT, SWT.DEFAULT, false,
|
||||
false);
|
||||
label.setLayoutData(layoutData);
|
||||
label.setText("Sample Set Name(s)");
|
||||
|
||||
sampleSetList = new List(comp, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL
|
||||
| SWT.MULTI);
|
||||
layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
sampleSetList.setLayoutData(layoutData);
|
||||
sampleSetList.setItems(sets);
|
||||
|
||||
return comp;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets
|
||||
* .Shell)
|
||||
*/
|
||||
@Override
|
||||
protected void configureShell(Shell shell) {
|
||||
super.configureShell(shell);
|
||||
shell.setText("Load Sample Set");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createButtonsForButtonBar(Composite parent) {
|
||||
super.createButton(parent, ADD_ID, "Add", false);
|
||||
super.createButton(parent, REMOVE_ID, "Remove", false);
|
||||
super.createButton(parent, REPLACE_ID, "Replace", false);
|
||||
super.createButton(parent, IDialogConstants.CANCEL_ID, "Cancel", false);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
|
||||
*/
|
||||
@Override
|
||||
protected void buttonPressed(int buttonId) {
|
||||
SampleSetLoadMode mode;
|
||||
switch (buttonId) {
|
||||
case ADD_ID:
|
||||
mode = SampleSetLoadMode.ADD;
|
||||
break;
|
||||
case REPLACE_ID:
|
||||
mode = SampleSetLoadMode.REPLACE;
|
||||
break;
|
||||
case REMOVE_ID:
|
||||
mode = SampleSetLoadMode.REMOVE;
|
||||
break;
|
||||
|
||||
default:
|
||||
super.cancelPressed();
|
||||
return;
|
||||
}
|
||||
|
||||
action(mode);
|
||||
super.okPressed();
|
||||
}
|
||||
|
||||
private void action(SampleSetLoadMode mode) {
|
||||
for (int index : sampleSetList.getSelectionIndices()) {
|
||||
String name = sampleSetList.getItem(index);
|
||||
SampleId id = new SampleId(name);
|
||||
if (id.isValid()) {
|
||||
sampleSetMgr.loadSampleSet(id, mode);
|
||||
}
|
||||
|
||||
/*
|
||||
* REPLACE with multiple entries needs to ADD after the first one to
|
||||
* have the effect of replacing the currently loaded Samples with
|
||||
* the set of selected samples. If actionType is REPLACE, set
|
||||
* actionType to ADD for second and subsequent entries.
|
||||
*/
|
||||
if (mode.equals(SampleSetLoadMode.REPLACE)) {
|
||||
mode = SampleSetLoadMode.ADD;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,227 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.viz.gfe.dialogs;
|
||||
|
||||
import org.eclipse.jface.window.Window;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.SelectionListener;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.List;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.sample.SampleId;
|
||||
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
||||
|
||||
/**
|
||||
* The sample set dialog.
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 7, 2008 Eric Babin Initial Creation
|
||||
* Oct 24, 2012 1287 rferrel Code clean up for non-blocking dialog.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author ebabin
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SampleSetDialog extends CaveJFACEDialog {
|
||||
|
||||
public final static int LOAD = 1;
|
||||
|
||||
public final static int SAVE = 2;
|
||||
|
||||
public final static int DELETE = 3;
|
||||
|
||||
public final static int OK = 97;
|
||||
|
||||
public final static int REMOVE = 98;
|
||||
|
||||
public final static int REPLACE = 99;
|
||||
|
||||
public final static int CANCEL = Window.CANCEL;
|
||||
|
||||
private Composite top;
|
||||
|
||||
private java.util.List<SampleId> samples;
|
||||
|
||||
private List sampleSetList;
|
||||
|
||||
private Text identifierField;
|
||||
|
||||
private String sampleName;
|
||||
|
||||
private int[] selectedSamples;
|
||||
|
||||
private int returnCode = CANCEL;
|
||||
|
||||
private int type;
|
||||
|
||||
public SampleSetDialog(Shell parent, java.util.List<SampleId> samples,
|
||||
int type) {
|
||||
super(parent);
|
||||
this.setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS);
|
||||
this.samples = samples;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
private void initializeComponents() {
|
||||
Label lab = new Label(top, SWT.NONE);
|
||||
lab.setText("Sample Set Name(s)");
|
||||
|
||||
if (type == SampleSetDialog.LOAD) {
|
||||
sampleSetList = new List(top, SWT.BORDER | SWT.V_SCROLL
|
||||
| SWT.H_SCROLL | SWT.MULTI);
|
||||
} else {
|
||||
sampleSetList = new List(top, SWT.BORDER | SWT.V_SCROLL
|
||||
| SWT.H_SCROLL | SWT.SINGLE);
|
||||
}
|
||||
|
||||
for (SampleId sample : samples) {
|
||||
sampleSetList.add(sample.getName());
|
||||
}
|
||||
|
||||
sampleSetList.addSelectionListener(new SelectionListener() {
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
}
|
||||
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
selectedSamples = sampleSetList.getSelectionIndices();
|
||||
if (identifierField != null
|
||||
&& sampleSetList.getSelectionIndex() != -1) {
|
||||
identifierField.setText(sampleSetList.getItem(sampleSetList
|
||||
.getSelectionIndex()));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
sampleSetList.setLayoutData(data);
|
||||
if (type != SampleSetDialog.LOAD) {
|
||||
Label processOn = new Label(top, SWT.NONE);
|
||||
processOn.setText("Identifier");
|
||||
|
||||
if (type == SampleSetDialog.DELETE) {
|
||||
identifierField = new Text(top, SWT.BORDER | SWT.READ_ONLY);
|
||||
} else {
|
||||
identifierField = new Text(top, SWT.BORDER);
|
||||
}
|
||||
identifierField.addModifyListener(new ModifyListener() {
|
||||
public void modifyText(ModifyEvent arg0) {
|
||||
selectedSamples = sampleSetList.getSelectionIndices();
|
||||
sampleName = identifierField.getText();
|
||||
}
|
||||
});
|
||||
identifierField
|
||||
.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buttonPressed(int buttonId) {
|
||||
returnCode = buttonId;
|
||||
|
||||
super.buttonPressed(Window.OK);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Control createDialogArea(Composite parent) {
|
||||
top = (Composite) super.createDialogArea(parent);
|
||||
|
||||
GridLayout layout = new GridLayout(1, true);
|
||||
top.setLayout(layout);
|
||||
|
||||
initializeComponents();
|
||||
|
||||
return top;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getReturnCode() {
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets
|
||||
* .Shell)
|
||||
*/
|
||||
@Override
|
||||
protected void configureShell(Shell shell) {
|
||||
super.configureShell(shell);
|
||||
|
||||
if (type == SampleSetDialog.LOAD) {
|
||||
shell.setText("Load Sample Set");
|
||||
} else if (type == SampleSetDialog.SAVE) {
|
||||
shell.setText("Save Sample Set");
|
||||
} else if (type == SampleSetDialog.DELETE) {
|
||||
shell.setText("Delete Sample Set");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createButtonsForButtonBar(Composite parent) {
|
||||
if (type == SampleSetDialog.LOAD) {
|
||||
super.createButton(parent, OK, "Add", false);
|
||||
super.createButton(parent, REMOVE, "Remove", false);
|
||||
super.createButton(parent, REPLACE, "Replace", true);
|
||||
super.createButton(parent, CANCEL, "Cancel", true);
|
||||
} else if (type == SampleSetDialog.SAVE) {
|
||||
super.createButton(parent, OK, "Save", false);
|
||||
super.createButton(parent, CANCEL, "Cancel", false);
|
||||
} else if (type == SampleSetDialog.DELETE) {
|
||||
super.createButton(parent, OK, "Delete", false);
|
||||
super.createButton(parent, CANCEL, "Cancel", false);
|
||||
}
|
||||
}
|
||||
|
||||
public int[] getSelectedSampleIdIndexes() {
|
||||
return selectedSamples;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getSampleName() {
|
||||
return sampleName;
|
||||
}
|
||||
|
||||
public void setSampleName(String sampleName) {
|
||||
this.sampleName = sampleName;
|
||||
}
|
||||
|
||||
public java.util.List<SampleId> getSamples() {
|
||||
return samples;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,238 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.viz.gfe.dialogs;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Group;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.List;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.sample.SampleId;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.viz.gfe.core.ISampleSetManager;
|
||||
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
||||
|
||||
/**
|
||||
* Dialog for selecting sample sets to save or delete
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 07, 2008 Eric Babin Initial Creation
|
||||
* Oct 24, 2012 1287 rferrel Code clean up for non-blocking dialog.
|
||||
* Sep 15, 2014 3592 randerso Re-implemented to match A1
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author ebabin
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SaveDeleteSampleSetDialog extends CaveJFACEDialog {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(SaveDeleteSampleSetDialog.class);
|
||||
|
||||
private ISampleSetManager sampleSetMgr;
|
||||
|
||||
private String optionStr;
|
||||
|
||||
private SortedSet<String> sets;
|
||||
|
||||
private Set<String> protectedSets;
|
||||
|
||||
private List sampleSetList;
|
||||
|
||||
private Text identifierField;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param sampleSetMgr
|
||||
* SampleSetManager to use
|
||||
* @param parent
|
||||
* parent shell for dialog
|
||||
* @param optionStr
|
||||
* "Save" or "Delete"
|
||||
*/
|
||||
public SaveDeleteSampleSetDialog(ISampleSetManager sampleSetMgr,
|
||||
Shell parent, String optionStr) {
|
||||
super(parent);
|
||||
|
||||
this.sampleSetMgr = sampleSetMgr;
|
||||
this.optionStr = optionStr;
|
||||
this.sets = new TreeSet<String>();
|
||||
this.protectedSets = new HashSet<String>();
|
||||
|
||||
SampleId[] sampleIDs = this.sampleSetMgr.getInventory();
|
||||
|
||||
if (this.optionStr.equals("Save")) {
|
||||
for (SampleId id : sampleIDs) {
|
||||
if (!id.isProtected()) {
|
||||
this.sets.add(id.getName());
|
||||
} else {
|
||||
this.protectedSets.add(id.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
// delete mode
|
||||
else {
|
||||
for (SampleId id : sampleIDs) {
|
||||
if (!id.isProtected()
|
||||
&& id.getAccess().equals(LocalizationLevel.USER)) {
|
||||
this.sets.add(id.getName());
|
||||
} else {
|
||||
this.protectedSets.add(id.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Control createDialogArea(Composite parent) {
|
||||
Composite comp = (Composite) super.createDialogArea(parent);
|
||||
|
||||
Group group = new Group(comp, SWT.NONE);
|
||||
group.setLayout(new GridLayout());
|
||||
GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
group.setLayoutData(layoutData);
|
||||
group.setLayout(new GridLayout(1, false));
|
||||
group.setText("Sample Set Name");
|
||||
|
||||
sampleSetList = new List(group, SWT.BORDER | SWT.V_SCROLL
|
||||
| SWT.H_SCROLL | SWT.SINGLE);
|
||||
layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
sampleSetList.setLayoutData(layoutData);
|
||||
if (!sets.isEmpty()) {
|
||||
sampleSetList.setItems(sets.toArray(new String[sets.size()]));
|
||||
sampleSetList.select(0);
|
||||
sampleSetList.deselectAll();
|
||||
}
|
||||
|
||||
sampleSetList.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
identifierField.setText(sampleSetList.getItem(sampleSetList
|
||||
.getSelectionIndex()));
|
||||
}
|
||||
});
|
||||
|
||||
Label label = new Label(group, SWT.NONE);
|
||||
layoutData = new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false);
|
||||
label.setLayoutData(layoutData);
|
||||
label.setText("Identifier");
|
||||
|
||||
if (this.optionStr.equals("Save")) {
|
||||
identifierField = new Text(group, SWT.BORDER);
|
||||
} else {
|
||||
identifierField = new Text(group, SWT.BORDER | SWT.READ_ONLY);
|
||||
}
|
||||
layoutData = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
identifierField.setLayoutData(layoutData);
|
||||
|
||||
return group;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets
|
||||
* .Shell)
|
||||
*/
|
||||
@Override
|
||||
protected void configureShell(Shell shell) {
|
||||
super.configureShell(shell);
|
||||
|
||||
if (this.optionStr.equals("Save")) {
|
||||
shell.setText("Save Sample Set");
|
||||
} else {
|
||||
shell.setText("Delete Sample Set");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createButtonsForButtonBar(Composite parent) {
|
||||
super.createButton(parent, IDialogConstants.OK_ID, this.optionStr,
|
||||
false);
|
||||
super.createButton(parent, IDialogConstants.CANCEL_ID, "Cancel", false);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.dialogs.Dialog#okPressed()
|
||||
*/
|
||||
@Override
|
||||
protected void okPressed() {
|
||||
String name = this.identifierField.getText();
|
||||
if (this.optionStr.equals("Save")) {
|
||||
saveSample(name);
|
||||
} else {
|
||||
deleteSample(name);
|
||||
}
|
||||
|
||||
super.okPressed();
|
||||
}
|
||||
|
||||
private void saveSample(String name) {
|
||||
SampleId id = new SampleId(name);
|
||||
if (id.isValid() && !this.protectedSets.contains(name)) {
|
||||
// LogStream.logUse("Save", name);
|
||||
this.sampleSetMgr.saveActiveSampleSet(id);
|
||||
} else {
|
||||
String message = "Sample Set " + name + " is protected "
|
||||
+ "or an invalid name. ";
|
||||
statusHandler.handle(Priority.SIGNIFICANT, message);
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteSample(String name) {
|
||||
SampleId id = new SampleId(name);
|
||||
if (id.isValid() && !this.protectedSets.contains(name)
|
||||
&& this.sets.contains(name)) {
|
||||
// LogStream.logUse("Delete", name);
|
||||
this.sampleSetMgr.deleteSampleSet(id);
|
||||
} else {
|
||||
String message = "Sample Set " + name + " is protected "
|
||||
+ "or an invalid name. ";
|
||||
statusHandler.handle(Priority.SIGNIFICANT, message);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -20,6 +20,10 @@
|
|||
package com.raytheon.viz.gfe.ui;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
|
@ -40,7 +44,9 @@ import com.raytheon.uf.common.localization.PathManagerFactory;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 10, 2010 #4727 randerso Initial creation
|
||||
* Jun 10, 2010 #4727 randerso Initial creation
|
||||
* Sep 15, 2014 #3592 randerso Fix logic to not include USER level.
|
||||
* Code cleanup.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -66,33 +72,24 @@ public class AccessMgr {
|
|||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
Map<LocalizationLevel, LocalizationFile> tieredData = pm
|
||||
.getTieredLocalizationFile(type, itemName);
|
||||
tieredData.remove(LocalizationLevel.USER);
|
||||
|
||||
StringBuilder kind = new StringBuilder();
|
||||
|
||||
int i = 1;
|
||||
for (LocalizationLevel level : tieredData.keySet()) {
|
||||
if (i == 1) {
|
||||
kind.append(level.toString());
|
||||
} else if (i == tieredData.size()) {
|
||||
kind.append(" and ").append(level.toString());
|
||||
} else {
|
||||
kind.append(", ").append(level.toString());
|
||||
}
|
||||
i++;
|
||||
}
|
||||
List<LocalizationLevel> availableLevels = new ArrayList<LocalizationLevel>(
|
||||
Arrays.asList(pm.getAvailableLevels()));
|
||||
availableLevels.remove(LocalizationLevel.USER);
|
||||
|
||||
boolean continueFlag = false;
|
||||
boolean answer = false;
|
||||
String message;
|
||||
|
||||
if (kind.length() == 0) {
|
||||
message = "There is no version of " + altName
|
||||
+ " at the BASE, CONFIGURED, or SITE levels.";
|
||||
if (tieredData.isEmpty()) {
|
||||
message = "There is no version of " + altName + " at the "
|
||||
+ levelString(availableLevels) + " levels.";
|
||||
} else {
|
||||
message = "Note that " + altName
|
||||
+ " will continue to appear in your "
|
||||
+ "GFESuite since a version of it exists " + "at the "
|
||||
+ kind + " level.";
|
||||
+ levelString(tieredData.keySet()) + " level.";
|
||||
continueFlag = true;
|
||||
}
|
||||
message = altName + " will be deleted. \n\n" + message;
|
||||
|
@ -104,4 +101,25 @@ public class AccessMgr {
|
|||
}
|
||||
return answer;
|
||||
}
|
||||
|
||||
private static String levelString(Collection<LocalizationLevel> levels) {
|
||||
StringBuilder kind = new StringBuilder();
|
||||
|
||||
int i = 1;
|
||||
for (LocalizationLevel level : levels) {
|
||||
if (level.equals(LocalizationLevel.USER)) {
|
||||
continue;
|
||||
}
|
||||
if (i == 1) {
|
||||
kind.append(level.toString());
|
||||
} else if (i == levels.size()) {
|
||||
kind.append(" and ").append(level.toString());
|
||||
} else {
|
||||
kind.append(", ").append(level.toString());
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
return kind.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,6 @@
|
|||
</properties>
|
||||
<resourceData xsi:type="bestResResourceData"
|
||||
productIdentifierKey="productCode" retrieveData="false">
|
||||
<enabler xsi:type="radarSpatialEnabler" />
|
||||
<metadataMap>
|
||||
<mapping key="productCode">
|
||||
<constraint constraintValue="37,35" constraintType="IN" />
|
||||
|
@ -130,7 +129,6 @@
|
|||
<properties isSystemResource="false" isBlinking="false" isMapLayer="false" isHoverOn="false" isVisible="true">
|
||||
</properties>
|
||||
<resourceData xsi:type="bestResResourceData" productIdentifierKey="productCode" retrieveData="false">
|
||||
<enabler xsi:type="radarSpatialEnabler" />
|
||||
<metadataMap>
|
||||
<mapping key="productCode">
|
||||
<constraint constraintValue="38,36" constraintType="IN" />
|
||||
|
@ -211,7 +209,6 @@
|
|||
</properties>
|
||||
<resourceData xsi:type="bestResResourceData"
|
||||
productIdentifierKey="productCode" retrieveData="false">
|
||||
<enabler xsi:type="radarSpatialEnabler" />
|
||||
<metadataMap>
|
||||
<mapping key="productCode">
|
||||
<constraint constraintValue="153,94,19,20"
|
||||
|
|
|
@ -70,7 +70,6 @@
|
|||
</properties>
|
||||
<resourceData xsi:type="bestResResourceData"
|
||||
productIdentifierKey="productCode" retrieveData="false">
|
||||
<enabler xsi:type="radarSpatialEnabler" />
|
||||
<metadataMap>
|
||||
<mapping key="productCode">
|
||||
<constraint constraintValue="37,35" constraintType="IN" />
|
||||
|
@ -159,7 +158,6 @@
|
|||
</properties>
|
||||
<resourceData xsi:type="bestResResourceData"
|
||||
productIdentifierKey="productCode" retrieveData="false">
|
||||
<enabler xsi:type="radarSpatialEnabler" />
|
||||
<metadataMap>
|
||||
<mapping key="productCode">
|
||||
<constraint constraintValue="38,36" constraintType="IN" />
|
||||
|
|
|
@ -59,7 +59,6 @@
|
|||
<properties isSystemResource="false" isBlinking="false" isMapLayer="false" isHoverOn="false" isVisible="true">
|
||||
</properties>
|
||||
<resourceData xsi:type="bestResResourceData" productIdentifierKey="productCode" retrieveData="false">
|
||||
<enabler xsi:type="radarSpatialEnabler" />
|
||||
<metadataMap>
|
||||
<mapping key="productCode">
|
||||
<constraint constraintValue="37,36,57" constraintType="IN" />
|
||||
|
|
|
@ -104,7 +104,6 @@
|
|||
<properties isSystemResource="false" isBlinking="false" isMapLayer="false" isHoverOn="false" isVisible="true">
|
||||
</properties>
|
||||
<resourceData xsi:type="bestResResourceData" productIdentifierKey="productCode" retrieveData="false">
|
||||
<enabler xsi:type="radarSpatialEnabler" />
|
||||
<metadataMap>
|
||||
<mapping key="productCode">
|
||||
<constraint constraintValue="153,94,19,20" constraintType="IN" />
|
||||
|
|
|
@ -97,7 +97,6 @@
|
|||
</properties>
|
||||
<resourceData xsi:type="bestResResourceData"
|
||||
productIdentifierKey="productCode" retrieveData="false">
|
||||
<enabler xsi:type="radarSpatialEnabler" />
|
||||
<metadataMap>
|
||||
<mapping key="productCode">
|
||||
<constraint constraintValue="37,35" constraintType="IN" />
|
||||
|
@ -167,7 +166,6 @@
|
|||
<properties isSystemResource="false" isBlinking="false" isMapLayer="false" isHoverOn="false" isVisible="true">
|
||||
</properties>
|
||||
<resourceData xsi:type="bestResResourceData" productIdentifierKey="productCode" retrieveData="false">
|
||||
<enabler xsi:type="radarSpatialEnabler" />
|
||||
<metadataMap>
|
||||
<mapping key="productCode">
|
||||
<constraint constraintValue="38,36" constraintType="IN" />
|
||||
|
|
|
@ -62,7 +62,6 @@
|
|||
</properties>
|
||||
<resourceData xsi:type="bestResResourceData"
|
||||
productIdentifierKey="productCode" retrieveData="false">
|
||||
<enabler xsi:type="radarSpatialEnabler" />
|
||||
<metadataMap>
|
||||
<mapping key="productCode">
|
||||
<constraint constraintValue="37,35" constraintType="IN" />
|
||||
|
@ -132,7 +131,6 @@
|
|||
<properties isSystemResource="false" isBlinking="false" isMapLayer="false" isHoverOn="false" isVisible="true">
|
||||
</properties>
|
||||
<resourceData xsi:type="bestResResourceData" productIdentifierKey="productCode" retrieveData="false">
|
||||
<enabler xsi:type="radarSpatialEnabler" />
|
||||
<metadataMap>
|
||||
<mapping key="productCode">
|
||||
<constraint constraintValue="38,36,57" constraintType="IN" />
|
||||
|
|
|
@ -22,50 +22,28 @@ package com.raytheon.viz.radar;
|
|||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.radar.RadarRecord;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
|
||||
import com.raytheon.viz.core.rsc.AbstractSpatialEnabler;
|
||||
import com.raytheon.viz.radar.rsc.RadarResourceData;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* @deprecated do not use this class, it only exists for XML compatibility.
|
||||
*
|
||||
* <pre>
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 2, 2010 mnash Initial creation
|
||||
* Sep 26, 2014 3669 bsteffen Deprecate
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mnash
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
@Deprecated
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class RadarSpatialEnabler extends AbstractSpatialEnabler {
|
||||
public final class RadarSpatialEnabler extends AbstractSpatialEnabler {
|
||||
|
||||
private final String elevAngle = "primaryElevationAngle";
|
||||
/* Empty due to deprecation */
|
||||
|
||||
public RadarSpatialEnabler() {
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.core.rsc.AbstractSpatialEnabler#enable(com.raytheon.
|
||||
* uf.common.dataplugin.PluginDataObject,
|
||||
* com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData)
|
||||
*/
|
||||
@Override
|
||||
public void enable(PluginDataObject d, AbstractRequestableResourceData arrd) {
|
||||
if (arrd instanceof RadarResourceData && d instanceof RadarRecord) {
|
||||
RadarRecord rr = (RadarRecord) d;
|
||||
RadarResourceData rrd = (RadarResourceData) arrd;
|
||||
rr.setAddSpatial(!rrd.isLatest());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
|
|||
import com.raytheon.uf.viz.personalities.cave.workbench.VizWorkbenchAdvisor;
|
||||
|
||||
/**
|
||||
* AWIPS {@link VizWorkbenchAdvisor} that reqeusts menu creation service to run
|
||||
* AWIPS {@link VizWorkbenchAdvisor} that requests menu creation service to run
|
||||
* before discovering dynamic menus
|
||||
*
|
||||
* <pre>
|
||||
|
@ -54,6 +54,7 @@ import com.raytheon.uf.viz.personalities.cave.workbench.VizWorkbenchAdvisor;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 20, 2013 mschenke Initial creation
|
||||
* Oct 01, 2014 3679 njensen Fix propertyChange() for logPerformance
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -81,7 +82,8 @@ public class AWIPSWorkbenchAdvisor extends VizWorkbenchAdvisor {
|
|||
public void propertyChange(PropertyChangeEvent event) {
|
||||
if (PreferenceConstants.P_LOG_PERF.equals(event
|
||||
.getProperty())) {
|
||||
Boolean log = (Boolean) event.getNewValue();
|
||||
Boolean log = Boolean.valueOf(event.getNewValue()
|
||||
.toString());
|
||||
if (log != logPeformance) {
|
||||
toggleLogging();
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
package com.raytheon.uf.common.dataplugin.gfe.sample;
|
||||
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
|
||||
/**
|
||||
* Contains the identifier to uniquely identify a SampleData set.
|
||||
|
@ -29,7 +28,8 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 14, 2008 879 rbell Initial creation
|
||||
* Apr 14, 2008 879 rbell Initial creation
|
||||
* Sep 15, 2014 #3592 randerso Code cleanup, JavaDoc improvement
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -37,7 +37,7 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SampleId implements Cloneable, ISerializableObject {
|
||||
public class SampleId implements Cloneable {
|
||||
|
||||
private String name;
|
||||
|
||||
|
@ -52,8 +52,13 @@ public class SampleId implements Cloneable, ISerializableObject {
|
|||
this((String) null);
|
||||
}
|
||||
|
||||
public SampleId(String aName) {
|
||||
this(aName, false, LocalizationLevel.UNKNOWN);
|
||||
/**
|
||||
* Constructor taking the name to uniquely identify this sample data.
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public SampleId(String name) {
|
||||
this(name, false, LocalizationLevel.UNKNOWN);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -64,11 +69,10 @@ public class SampleId implements Cloneable, ISerializableObject {
|
|||
* @param protect
|
||||
* @param access
|
||||
*/
|
||||
public SampleId(final String aName, boolean aProtect,
|
||||
LocalizationLevel anAccess) {
|
||||
this.name = aName;
|
||||
this.protect = aProtect;
|
||||
this.access = anAccess;
|
||||
public SampleId(final String name, boolean protect, LocalizationLevel access) {
|
||||
this.name = name;
|
||||
this.protect = protect;
|
||||
this.access = access;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -118,11 +122,11 @@ public class SampleId implements Cloneable, ISerializableObject {
|
|||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result
|
||||
result = (prime * result)
|
||||
+ ((this.access == null) ? 0 : this.access.hashCode());
|
||||
result = prime * result
|
||||
result = (prime * result)
|
||||
+ ((this.name == null) ? 0 : this.name.hashCode());
|
||||
result = prime * result + (this.protect ? 1231 : 1237);
|
||||
result = (prime * result) + (this.protect ? 1231 : 1237);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -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