Issue #1351. Changes for non-blocking MonitoringAreaConfigDlg according to reviewer's comments. Changes for History Tables.
Change-Id: Ic68f4afd44a3039707cb80ee71a935aa2f00a6a2 Former-commit-id:af101861e4
[formerly5e4bbc03a4
[formerly 82dc81aa3cbdfcfcd0b3f5f6566bfce0b6fddd22]] Former-commit-id:5e4bbc03a4
Former-commit-id:153af1673a
This commit is contained in:
parent
b02c667e72
commit
32f192134d
32 changed files with 3015 additions and 4725 deletions
|
@ -122,7 +122,7 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
|
|||
private FogZoneTableDlg zoneDialog;
|
||||
|
||||
/** zone table dialog **/
|
||||
private MonitoringAreaConfigDlg areaDialog = null;
|
||||
private MonitoringAreaConfigDlg areaDialog;
|
||||
|
||||
/** area config manager **/
|
||||
private FogMonitorConfigurationManager fogConfig = null;
|
||||
|
@ -260,7 +260,7 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
|
|||
FogMonitorConfigurationManager areaConfig = getMonitorAreaConfig();
|
||||
for (String zone : areaConfig.getAreaList()) {
|
||||
// add the unique
|
||||
ArrayList<String> stations = areaConfig.getAreaStations(zone);
|
||||
List<String> stations = areaConfig.getAreaStations(zone);
|
||||
zones.put(zone, stations);
|
||||
}
|
||||
} catch (Exception ve) {
|
||||
|
@ -377,24 +377,20 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
|
|||
* @param shell
|
||||
*/
|
||||
public void launchDialog(String type, Shell shell) {
|
||||
|
||||
if (type.equals("zone")) {
|
||||
if (zoneDialog == null || zoneDialog.getShell() == null
|
||||
|| zoneDialog.isDisposed()) {
|
||||
if (zoneDialog == null) {
|
||||
zoneDialog = new FogZoneTableDlg(shell, obData);
|
||||
addMonitorListener(zoneDialog);
|
||||
zoneDialog.addMonitorControlListener(this);
|
||||
fireMonitorEvent(zoneDialog.getClass().getName());
|
||||
zoneDialog.open();
|
||||
} else {
|
||||
zoneDialog.bringToTop();
|
||||
}
|
||||
zoneDialog.open();
|
||||
} else if (type.equals("area")) {
|
||||
if (areaDialog == null) {
|
||||
areaDialog = new FogMonitoringAreaConfigDlg(shell,
|
||||
"Fog Monitor Area Configuration");
|
||||
areaDialog.open();
|
||||
}
|
||||
areaDialog.open();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -562,7 +558,7 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
|
|||
}
|
||||
|
||||
if (areaDialog != null) {
|
||||
areaDialog.shellDisposeDialog();
|
||||
areaDialog.close();
|
||||
areaDialog = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,496 +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.uf.viz.monitor.fog.test;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Dialog;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.monitor.data.CommonTableConfig.CellType;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
|
||||
import com.raytheon.uf.viz.monitor.fog.threshold.FogAlgorithmMgr;
|
||||
import com.raytheon.uf.viz.monitor.fog.threshold.FogThresholdMgr;
|
||||
import com.raytheon.uf.viz.monitor.fog.ui.dialogs.FogMonThreshSetupDlg;
|
||||
import com.raytheon.uf.viz.monitor.fog.xml.FogMonitorAlgorithmXML;
|
||||
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr.ThresholdKey;
|
||||
import com.raytheon.uf.viz.monitor.ui.dialogs.LoadSaveDeleteSelectDlg;
|
||||
import com.raytheon.uf.viz.monitor.ui.dialogs.LoadSaveDeleteSelectDlg.DialogType;
|
||||
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
|
||||
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.FogDisplay;
|
||||
|
||||
public class FogTestDriverDlg extends Dialog {
|
||||
private Display display;
|
||||
|
||||
private Shell shell;
|
||||
|
||||
private Font lblFont;
|
||||
|
||||
public FogTestDriverDlg(Shell parentShell) {
|
||||
super(parentShell, 0);
|
||||
}
|
||||
|
||||
public Object open() {
|
||||
Shell parent = getParent();
|
||||
display = parent.getDisplay();
|
||||
shell = new Shell(parent, SWT.DIALOG_TRIM);
|
||||
shell.setText("FOG Driver");
|
||||
|
||||
GridLayout gl = new GridLayout(1, false);
|
||||
gl.horizontalSpacing = 0;
|
||||
shell.setLayout(gl);
|
||||
|
||||
shell.setSize(600, 600);
|
||||
|
||||
lblFont = new Font(shell.getDisplay(), "Monospace", 14, SWT.NORMAL);
|
||||
|
||||
initComponents();
|
||||
|
||||
shell.open();
|
||||
|
||||
while (!shell.isDisposed()) {
|
||||
if (!display.readAndDispatch())
|
||||
display.sleep();
|
||||
}
|
||||
|
||||
lblFont.dispose();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
Label lbl = new Label(shell, SWT.NONE);
|
||||
lbl.setText("FOG");
|
||||
lbl.setFont(lblFont);
|
||||
|
||||
Button printFogDisplayThresh = new Button(shell, SWT.PUSH);
|
||||
printFogDisplayThresh.setText("Print FOG Display Threshold Data");
|
||||
printFogDisplayThresh.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
printFogDisplayThresholdData();
|
||||
}
|
||||
});
|
||||
|
||||
Button printCopyFogDisplayThresh = new Button(shell, SWT.PUSH);
|
||||
printCopyFogDisplayThresh
|
||||
.setText("**** Print FOG Display Threshold Data COPY");
|
||||
printCopyFogDisplayThresh.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
printCopyFogDisplayThresholdData();
|
||||
}
|
||||
});
|
||||
|
||||
Button changeThresh = new Button(shell, SWT.PUSH);
|
||||
changeThresh.setText("Change Threshold Data");
|
||||
changeThresh.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
changeThresholdData();
|
||||
}
|
||||
});
|
||||
|
||||
Button loadThreshDlg = new Button(shell, SWT.PUSH);
|
||||
loadThreshDlg.setText("Load Dialog");
|
||||
loadThreshDlg.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
displayLoadDialog();
|
||||
}
|
||||
});
|
||||
|
||||
Button saveAsThreshDlg = new Button(shell, SWT.PUSH);
|
||||
saveAsThreshDlg.setText("Save As Dialog");
|
||||
saveAsThreshDlg.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
displaySaveDialog();
|
||||
}
|
||||
});
|
||||
|
||||
Button printDefaultFileNameBtn = new Button(shell, SWT.PUSH);
|
||||
printDefaultFileNameBtn.setText("Print Default Threshold File Name");
|
||||
printDefaultFileNameBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
displayDefaultThreshFileName();
|
||||
}
|
||||
});
|
||||
|
||||
Button selectDefaultFileNameBtn = new Button(shell, SWT.PUSH);
|
||||
selectDefaultFileNameBtn.setText("Select Default Threshold File Name");
|
||||
selectDefaultFileNameBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
selectDefaultThreshFileName();
|
||||
}
|
||||
});
|
||||
|
||||
Button loadDefaultFileNameBtn = new Button(shell, SWT.PUSH);
|
||||
loadDefaultFileNameBtn.setText("Load Default Threshold");
|
||||
loadDefaultFileNameBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
loadDefaultThresholds();
|
||||
}
|
||||
});
|
||||
|
||||
Button cellTypeBtn = new Button(shell, SWT.PUSH);
|
||||
cellTypeBtn.setText("Print CellType");
|
||||
cellTypeBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
printCellType();
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* ************************************************************************
|
||||
*/
|
||||
addSeparator(shell);
|
||||
|
||||
lbl = new Label(shell, SWT.NONE);
|
||||
lbl.setText("FOG ALGORITHM");
|
||||
lbl.setFont(lblFont);
|
||||
|
||||
Button fogAlgorithmBtn = new Button(shell, SWT.PUSH);
|
||||
fogAlgorithmBtn.setText("Print FOG Algorithm Data");
|
||||
fogAlgorithmBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
printFogAlgorithmData();
|
||||
}
|
||||
});
|
||||
|
||||
Button fogAlgorithmChangeBtn = new Button(shell, SWT.PUSH);
|
||||
fogAlgorithmChangeBtn.setText("Change FOG Algorithm Data");
|
||||
fogAlgorithmChangeBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
changeFogAlgorithmData();
|
||||
}
|
||||
});
|
||||
|
||||
Button saveAsAlgorithmBtn = new Button(shell, SWT.PUSH);
|
||||
saveAsAlgorithmBtn.setText("Algorithm Save As Dialog");
|
||||
saveAsAlgorithmBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
algorithmSaveDialog();
|
||||
}
|
||||
});
|
||||
|
||||
Button loadAlgorithmBtn = new Button(shell, SWT.PUSH);
|
||||
loadAlgorithmBtn.setText("Algorithm Load Dialog");
|
||||
loadAlgorithmBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
algorithmLoadDialog();
|
||||
}
|
||||
});
|
||||
|
||||
Button selectAlgorithmFileNameBtn = new Button(shell, SWT.PUSH);
|
||||
selectAlgorithmFileNameBtn
|
||||
.setText("Select Default Algorithm File Name");
|
||||
selectAlgorithmFileNameBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
selectDefaultAlgorithmFileName();
|
||||
}
|
||||
});
|
||||
|
||||
Button displayFogAlgDailogBtn = new Button(shell, SWT.PUSH);
|
||||
displayFogAlgDailogBtn.setText("Display Fog Algorithm Dialog");
|
||||
displayFogAlgDailogBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
displayFogAlgDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void addSeparator(Composite parentComp) {
|
||||
GridLayout gl = (GridLayout) parentComp.getLayout();
|
||||
|
||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
gd.horizontalSpan = gl.numColumns;
|
||||
Label sepLbl = new Label(parentComp, SWT.SEPARATOR | SWT.HORIZONTAL);
|
||||
sepLbl.setLayoutData(gd);
|
||||
}
|
||||
|
||||
private void printFogDisplayThresholdData() {
|
||||
FogThresholdMgr ftm = FogThresholdMgr.getInstance();
|
||||
ftm.printDisplayThresholds();
|
||||
}
|
||||
|
||||
private void printCopyFogDisplayThresholdData() {
|
||||
FogThresholdMgr ftm = FogThresholdMgr.getInstance();
|
||||
ftm.printDisplayThresholdsXMLCopy();
|
||||
}
|
||||
|
||||
private void changeThresholdData() {
|
||||
FogThresholdMgr ftm = FogThresholdMgr.getInstance();
|
||||
ftm.setThresholdValue(DataUsageKey.DISPLAY, ThresholdKey.RED, "NE093",
|
||||
MonitorConfigConstants.FogDisplay.FOG_DISP_METEO_TEMP
|
||||
.getXmlKey(), 111);
|
||||
}
|
||||
|
||||
private void displayLoadDialog() {
|
||||
FogThresholdMgr ftm = FogThresholdMgr.getInstance();
|
||||
|
||||
LoadSaveDeleteSelectDlg lsDlg = new LoadSaveDeleteSelectDlg(shell,
|
||||
DialogType.OPEN, ftm.getDisplayThresholdPath(), ftm
|
||||
.getDefaultFileName(DataUsageKey.DISPLAY));
|
||||
LocalizationFile fileName = (LocalizationFile) lsDlg.open();
|
||||
|
||||
if (fileName == null) {
|
||||
System.out.println("FileName is null...");
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("Selected file absolute path= "
|
||||
+ fileName.getFile().getAbsolutePath());
|
||||
System.out.println("Selected file name = "
|
||||
+ fileName.getFile().getName());
|
||||
|
||||
ftm.loadDisplayThreashold(fileName.getFile().getName());
|
||||
}
|
||||
|
||||
private void displaySaveDialog() {
|
||||
FogThresholdMgr ftm = FogThresholdMgr.getInstance();
|
||||
|
||||
LoadSaveDeleteSelectDlg lsDlg = new LoadSaveDeleteSelectDlg(shell,
|
||||
DialogType.SAVE_AS, ftm.getDisplayThresholdPath(), ftm
|
||||
.getDefaultFileName(DataUsageKey.DISPLAY));
|
||||
LocalizationFile fileName = (LocalizationFile) lsDlg.open();
|
||||
|
||||
if (fileName == null) {
|
||||
System.out.println("FileName is null...");
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("Selected file absolute path= "
|
||||
+ fileName.getFile().getAbsolutePath());
|
||||
System.out.println("Selected file name = "
|
||||
+ fileName.getFile().getName());
|
||||
|
||||
ftm.saveAsDisplayThresholds(fileName.getFile().getName());
|
||||
}
|
||||
|
||||
private void displayDefaultThreshFileName() {
|
||||
FogThresholdMgr ftm = FogThresholdMgr.getInstance();
|
||||
|
||||
System.out.println(">" + ftm.getDefDisplayThreshFileName() + "<");
|
||||
}
|
||||
|
||||
private void selectDefaultThreshFileName() {
|
||||
FogThresholdMgr ftm = FogThresholdMgr.getInstance();
|
||||
|
||||
LoadSaveDeleteSelectDlg lsDlg = new LoadSaveDeleteSelectDlg(shell,
|
||||
DialogType.SELECT_DEFAULT, ftm.getDisplayThresholdPath(), ftm
|
||||
.getDefaultFileName(DataUsageKey.DISPLAY));
|
||||
LocalizationFile fileName = (LocalizationFile) lsDlg.open();
|
||||
|
||||
if (fileName == null) {
|
||||
System.out.println("FileName is null...");
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("Selected file absolute path= "
|
||||
+ fileName.getFile().getAbsolutePath());
|
||||
System.out.println("Selected file name = "
|
||||
+ fileName.getFile().getName());
|
||||
|
||||
ftm.setDefaultDisplayFileName(fileName.getFile().getName());
|
||||
}
|
||||
|
||||
private void loadDefaultThresholds() {
|
||||
FogThresholdMgr ftm = FogThresholdMgr.getInstance();
|
||||
|
||||
ftm.loadDefaultDisplayThreshold();
|
||||
}
|
||||
|
||||
private void printCellType() {
|
||||
CellType ct;
|
||||
String key;
|
||||
double value = Double.NaN;
|
||||
|
||||
FogThresholdMgr ftm = FogThresholdMgr.getInstance();
|
||||
|
||||
/*
|
||||
* Ceiling
|
||||
*/
|
||||
|
||||
// -----------------------------
|
||||
key = FogDisplay.FOG_DISP_METEO_CEILING.getXmlKey();
|
||||
value = 3.0;
|
||||
ct = ftm.getThresholdValueCellType(DataUsageKey.DISPLAY, "NE093", key,
|
||||
value);
|
||||
System.out.println("key = " + key + "\t value = " + value
|
||||
+ "\tCellType = " + ct.name());
|
||||
|
||||
// -----------------------------
|
||||
value = 7.0;
|
||||
ct = ftm.getThresholdValueCellType(DataUsageKey.DISPLAY, "NE093", key,
|
||||
value);
|
||||
System.out.println("key = " + key + "\t value = " + value
|
||||
+ "\tCellType = " + ct.name());
|
||||
|
||||
// -----------------------------
|
||||
value = 12.0;
|
||||
ct = ftm.getThresholdValueCellType(DataUsageKey.DISPLAY, "NE093", key,
|
||||
value);
|
||||
System.out.println("key = " + key + "\t value = " + value
|
||||
+ "\tCellType = " + ct.name());
|
||||
|
||||
/*
|
||||
* Temp
|
||||
*/
|
||||
|
||||
// -----------------------------
|
||||
key = FogDisplay.FOG_DISP_METEO_TEMP.getXmlKey();
|
||||
value = 100.0;
|
||||
ct = ftm.getThresholdValueCellType(DataUsageKey.DISPLAY, "NE093", key,
|
||||
value);
|
||||
System.out.println("key = " + key + "\t value = " + value
|
||||
+ "\tCellType = " + ct.name());
|
||||
|
||||
// -----------------------------
|
||||
key = FogDisplay.FOG_DISP_METEO_TEMP.getXmlKey();
|
||||
value = 85.0;
|
||||
ct = ftm.getThresholdValueCellType(DataUsageKey.DISPLAY, "NE093", key,
|
||||
value);
|
||||
System.out.println("key = " + key + "\t value = " + value
|
||||
+ "\tCellType = " + ct.name());
|
||||
|
||||
// -----------------------------
|
||||
key = FogDisplay.FOG_DISP_METEO_TEMP.getXmlKey();
|
||||
value = 75.0;
|
||||
ct = ftm.getThresholdValueCellType(DataUsageKey.DISPLAY, "NE093", key,
|
||||
value);
|
||||
System.out.println("key = " + key + "\t value = " + value
|
||||
+ "\tCellType = " + ct.name());
|
||||
}
|
||||
|
||||
private void printFogAlgorithmData() {
|
||||
FogAlgorithmMgr fam = FogAlgorithmMgr.getInstance();
|
||||
|
||||
FogMonitorAlgorithmXML algXML = fam.getAlgorithmXML();
|
||||
|
||||
System.out.println(algXML.getFogProductYLo());
|
||||
System.out.println(algXML.getFogProductRLo());
|
||||
System.out.println(algXML.getFogProductRHi());
|
||||
System.out.println(algXML.getFogProductYHi());
|
||||
System.out.println(algXML.getVisYLo());
|
||||
System.out.println(algXML.getVisRLo());
|
||||
System.out.println(algXML.getVisRHi());
|
||||
System.out.println(algXML.getVisYHi());
|
||||
System.out.println(algXML.getMaxCloudTemp());
|
||||
System.out.println(algXML.getIceSnowVsFog());
|
||||
System.out.println(algXML.getCoolFogVsWarmSurface());
|
||||
System.out.println(algXML.getDaytimeSmoothThresh());
|
||||
System.out.println(algXML.getAdjacencyThresh());
|
||||
System.out.println(algXML.getTwilightAngle());
|
||||
System.out.println(algXML.getFractalDimension());
|
||||
}
|
||||
|
||||
private void changeFogAlgorithmData() {
|
||||
FogAlgorithmMgr fam = FogAlgorithmMgr.getInstance();
|
||||
fam.getAlgorithmXML().setFractalDimension(1.7);
|
||||
}
|
||||
|
||||
private void algorithmSaveDialog() {
|
||||
FogAlgorithmMgr fam = FogAlgorithmMgr.getInstance();
|
||||
|
||||
LoadSaveDeleteSelectDlg lsDlg = new LoadSaveDeleteSelectDlg(shell,
|
||||
DialogType.SAVE_AS, fam.getAlgorithmThresholdPath(), fam
|
||||
.getDefaultAlgorithmFileName());
|
||||
LocalizationFile fileName = (LocalizationFile) lsDlg.open();
|
||||
|
||||
if (fileName == null) {
|
||||
System.out.println("FileName is null...");
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("Selected file absolute path= "
|
||||
+ fileName.getFile().getAbsolutePath());
|
||||
System.out.println("Selected file name = "
|
||||
+ fileName.getFile().getName());
|
||||
|
||||
fam.saveAlgorithmXmlAs(fileName.getFile().getName());
|
||||
}
|
||||
|
||||
private void algorithmLoadDialog() {
|
||||
FogAlgorithmMgr fam = FogAlgorithmMgr.getInstance();
|
||||
|
||||
LoadSaveDeleteSelectDlg lsDlg = new LoadSaveDeleteSelectDlg(shell,
|
||||
DialogType.OPEN, fam.getAlgorithmThresholdPath(), fam
|
||||
.getDefaultAlgorithmFileName());
|
||||
LocalizationFile fileName = (LocalizationFile) lsDlg.open();
|
||||
|
||||
if (fileName == null) {
|
||||
System.out.println("FileName is null...");
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("Selected file absolute path= "
|
||||
+ fileName.getFile().getAbsolutePath());
|
||||
System.out.println("Selected file name = "
|
||||
+ fileName.getFile().getName());
|
||||
|
||||
fam.loadAlgorithmThreashold(fileName.getFile().getName());
|
||||
}
|
||||
|
||||
private void selectDefaultAlgorithmFileName() {
|
||||
FogAlgorithmMgr fam = FogAlgorithmMgr.getInstance();
|
||||
|
||||
LoadSaveDeleteSelectDlg lsDlg = new LoadSaveDeleteSelectDlg(shell,
|
||||
DialogType.SELECT_DEFAULT, fam.getDefaultFileNamePath(), fam
|
||||
.getDefaultAlgorithmFileName());
|
||||
LocalizationFile fileName = (LocalizationFile) lsDlg.open();
|
||||
|
||||
if (fileName == null) {
|
||||
System.out.println("FileName is null...");
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("Selected file absolute path= "
|
||||
+ fileName.getFile().getAbsolutePath());
|
||||
System.out.println("Selected file name = "
|
||||
+ fileName.getFile().getName());
|
||||
|
||||
fam.setDefaultAlgorithmFileName(fileName.getFile().getName());
|
||||
}
|
||||
|
||||
private void displayFogAlgDialog() {
|
||||
FogMonThreshSetupDlg fogThreshSetup = new FogMonThreshSetupDlg(shell);
|
||||
fogThreshSetup.open();
|
||||
}
|
||||
}
|
|
@ -25,6 +25,8 @@ 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.uf.viz.monitor.fog.ui.dialogs.FogMonitoringAreaConfigDlg;
|
||||
|
||||
/**
|
||||
|
@ -36,7 +38,8 @@ import com.raytheon.uf.viz.monitor.fog.ui.dialogs.FogMonitoringAreaConfigDlg;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 19 2009 3963 dhladky Initial creation.
|
||||
* Jul 14 2010 6567 zhao Launch AreaConfigDlg w/o monitor
|
||||
* Jul 14 2010 6567 zhao Launch AreaConfigDlg w/o monitor
|
||||
* Nov.27, 2012 1297 skorolev Cleanup code for non-blocking dialog.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -46,19 +49,22 @@ import com.raytheon.uf.viz.monitor.fog.ui.dialogs.FogMonitoringAreaConfigDlg;
|
|||
|
||||
public class FogAreaConfigAction extends AbstractHandler {
|
||||
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(FogAreaConfigAction.class);
|
||||
|
||||
private FogMonitoringAreaConfigDlg areaDialog;
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
|
||||
System.out.println("Activating/Action the FOG Area Config...");
|
||||
//FogMonitor fog = FogMonitor.getInstance();
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
//fog.launchDialog("area", shell);
|
||||
|
||||
FogMonitoringAreaConfigDlg areaDialog = new FogMonitoringAreaConfigDlg(shell, "Fog Monitor Area Configuration");
|
||||
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
if (areaDialog == null || areaDialog.getShell() == null
|
||||
|| areaDialog.isDisposed()) {
|
||||
areaDialog = new FogMonitoringAreaConfigDlg(shell,
|
||||
"Fog Monitor Area Configuration");
|
||||
}
|
||||
areaDialog.open();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ package com.raytheon.uf.viz.monitor.fog.ui.dialogs;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
|
@ -39,219 +40,204 @@ import com.raytheon.uf.viz.monitor.fog.threshold.FogThresholdMgr;
|
|||
import com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp;
|
||||
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.FogMonitor;
|
||||
|
||||
public class FogMonitorMeteoTab extends TabItemComp implements IUpdateMonitorMeteo
|
||||
{
|
||||
private MonitorConfigurationManager areaConfigMgr = null;
|
||||
public class FogMonitorMeteoTab extends TabItemComp implements
|
||||
IUpdateMonitorMeteo {
|
||||
private MonitorConfigurationManager areaConfigMgr = null;
|
||||
|
||||
private FogMonitorMeteoEditDlg fogMeteoEditDlg;
|
||||
|
||||
|
||||
private ArrayList<String> areaIDArray;
|
||||
|
||||
|
||||
private ArrayList<FogMonitorMeteoData> fogDataArray;
|
||||
|
||||
public FogMonitorMeteoTab(TabFolder parent, DataUsageKey duKey)
|
||||
{
|
||||
|
||||
public FogMonitorMeteoTab(TabFolder parent, DataUsageKey duKey) {
|
||||
super(parent, duKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createListHeader(Composite parentComp)
|
||||
{
|
||||
@Override
|
||||
protected void createListHeader(Composite parentComp) {
|
||||
Composite lblComp = new Composite(parentComp, SWT.NONE);
|
||||
GridLayout gl = new GridLayout(5, false);
|
||||
gl.horizontalSpacing = 0;
|
||||
gl.horizontalSpacing = 0;
|
||||
gl.marginHeight = 0;
|
||||
gl.marginWidth = 0;
|
||||
lblComp.setLayout(gl);
|
||||
|
||||
|
||||
/*
|
||||
* Create filler label.
|
||||
*/
|
||||
GridData gd = new GridData(71, SWT.DEFAULT);
|
||||
Label fillerLbl = new Label(lblComp, SWT.CENTER);
|
||||
fillerLbl.setLayoutData(gd);
|
||||
|
||||
|
||||
/*
|
||||
* Meteo
|
||||
*/
|
||||
Composite meteoComp = createGroupComposite(lblComp, 10, null);
|
||||
createLabelComp(meteoComp, "Vis(mi)", "", true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void populateList()
|
||||
{
|
||||
if (fogDataArray == null)
|
||||
{
|
||||
protected void populateList() {
|
||||
if (fogDataArray == null) {
|
||||
createDataArray();
|
||||
}
|
||||
|
||||
|
||||
boolean update = false;
|
||||
if (dataList.getItemCount() > 0)
|
||||
{
|
||||
if (dataList.getItemCount() > 0) {
|
||||
update = true;
|
||||
}
|
||||
|
||||
|
||||
RangesUtil rangeUtil = RangesUtil.getInstance();
|
||||
|
||||
|
||||
areaIDArray = new ArrayList<String>();
|
||||
|
||||
|
||||
String tmpVisStr;
|
||||
String currentAreaID;
|
||||
|
||||
|
||||
double visVal = 0.0;
|
||||
|
||||
StringBuilder sb = null;
|
||||
|
||||
StringBuilder sb = null;
|
||||
FogMonitorMeteoData fmmd = null;
|
||||
|
||||
for (int i = 0; i < fogDataArray.size(); i++)
|
||||
{
|
||||
|
||||
for (int i = 0; i < fogDataArray.size(); i++) {
|
||||
sb = new StringBuilder();
|
||||
|
||||
|
||||
fmmd = fogDataArray.get(i);
|
||||
|
||||
|
||||
currentAreaID = fmmd.getAreaID();
|
||||
areaIDArray.add(currentAreaID);
|
||||
|
||||
|
||||
sb.append(String.format(areaIdFmt, currentAreaID));
|
||||
|
||||
|
||||
/*
|
||||
* Visibility
|
||||
*/
|
||||
visVal = fmmd.getMeteoVisR();
|
||||
tmpVisStr = rangeUtil.getVisString((int)visVal);
|
||||
*/
|
||||
visVal = fmmd.getMeteoVisR();
|
||||
tmpVisStr = rangeUtil.getVisString((int) visVal);
|
||||
sb.append(String.format(dataFmt, tmpVisStr));
|
||||
|
||||
visVal = fmmd.getMeteoVisY();
|
||||
tmpVisStr = rangeUtil.getVisString((int)visVal);
|
||||
|
||||
visVal = fmmd.getMeteoVisY();
|
||||
tmpVisStr = rangeUtil.getVisString((int) visVal);
|
||||
sb.append(String.format(dataFmt, tmpVisStr));
|
||||
|
||||
|
||||
sb.append(" ");
|
||||
|
||||
if (update == true)
|
||||
{
|
||||
|
||||
if (update == true) {
|
||||
dataList.setItem(i, sb.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
dataList.add(sb.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
packListControls();
|
||||
}
|
||||
|
||||
private void createDataArray()
|
||||
{
|
||||
|
||||
private void createDataArray() {
|
||||
fogDataArray = new ArrayList<FogMonitorMeteoData>();
|
||||
|
||||
FogThresholdMgr ftm = FogThresholdMgr.getInstance();
|
||||
|
||||
|
||||
FogThresholdMgr ftm = FogThresholdMgr.getInstance();
|
||||
|
||||
areaConfigMgr = getAreaConfigMgr();
|
||||
|
||||
ArrayList<String> areas = areaConfigMgr.getAreaList();
|
||||
|
||||
List<String> areas = areaConfigMgr.getAreaList();
|
||||
Collections.sort(areas);
|
||||
|
||||
for (String area : areas ) {
|
||||
|
||||
|
||||
for (String area : areas) {
|
||||
|
||||
FogMonitorMeteoData fmmd = new FogMonitorMeteoData();
|
||||
|
||||
|
||||
fmmd.setAreaID(area);
|
||||
|
||||
/*
|
||||
* Visibility
|
||||
*/
|
||||
String xmlKey = FogMonitor.FOG_MONITOR_METEO_VIS.getXmlKey();
|
||||
fmmd.setMeteoVisR(ftm.getThresholdValue(duKey, threshKeyR, area, xmlKey));
|
||||
fmmd.setMeteoVisY(ftm.getThresholdValue(duKey, threshKeyY, area, xmlKey));
|
||||
|
||||
fmmd.setMeteoVisR(ftm.getThresholdValue(duKey, threshKeyR, area,
|
||||
xmlKey));
|
||||
fmmd.setMeteoVisY(ftm.getThresholdValue(duKey, threshKeyY, area,
|
||||
xmlKey));
|
||||
|
||||
fogDataArray.add(fmmd);
|
||||
}
|
||||
}
|
||||
|
||||
private FogMonitorMeteoData getDataAtFirstSelection()
|
||||
{
|
||||
|
||||
|
||||
private FogMonitorMeteoData getDataAtFirstSelection() {
|
||||
|
||||
int index = dataList.getSelectionIndex();
|
||||
|
||||
|
||||
return fogDataArray.get(index);
|
||||
|
||||
}
|
||||
|
||||
private void updateFogDataArray(FogMonitorMeteoData fmmd)
|
||||
{
|
||||
int[] dataListIndexes = dataList.getSelectionIndices();
|
||||
int currentIndex = 0;
|
||||
|
||||
for (int i = 0; i < dataListIndexes.length; i++)
|
||||
{
|
||||
currentIndex = dataListIndexes[i];
|
||||
|
||||
fogDataArray.get(currentIndex).updateData(fmmd);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void updateFogDataArray(FogMonitorMeteoData fmmd) {
|
||||
int[] dataListIndexes = dataList.getSelectionIndices();
|
||||
int currentIndex = 0;
|
||||
|
||||
for (int i = 0; i < dataListIndexes.length; i++) {
|
||||
currentIndex = dataListIndexes[i];
|
||||
|
||||
fogDataArray.get(currentIndex).updateData(fmmd);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commitDataToXML()
|
||||
{
|
||||
public void commitDataToXML() {
|
||||
FogThresholdMgr ftm = FogThresholdMgr.getInstance();
|
||||
|
||||
|
||||
String xmlKey;
|
||||
String areaID;
|
||||
|
||||
for (FogMonitorMeteoData fdmd : fogDataArray)
|
||||
{
|
||||
|
||||
for (FogMonitorMeteoData fdmd : fogDataArray) {
|
||||
areaID = fdmd.getAreaID();
|
||||
|
||||
|
||||
/*
|
||||
* Visibility
|
||||
*/
|
||||
xmlKey = FogMonitor.FOG_MONITOR_METEO_VIS.getXmlKey();
|
||||
ftm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, fdmd.getMeteoVisR());
|
||||
ftm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, fdmd.getMeteoVisY());
|
||||
ftm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
|
||||
fdmd.getMeteoVisR());
|
||||
ftm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
|
||||
fdmd.getMeteoVisY());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void reloadData()
|
||||
{
|
||||
public void reloadData() {
|
||||
dataList.removeAll();
|
||||
fogDataArray.clear();
|
||||
fogDataArray = null;
|
||||
|
||||
|
||||
populateList();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void editDataAction()
|
||||
{
|
||||
protected void editDataAction() {
|
||||
FogMonitorMeteoData fdmd = getDataAtFirstSelection();
|
||||
|
||||
if (fogMeteoEditDlg == null)
|
||||
{
|
||||
fogMeteoEditDlg = new FogMonitorMeteoEditDlg(getParent().getShell(), fdmd, this);
|
||||
|
||||
if (fogMeteoEditDlg == null) {
|
||||
fogMeteoEditDlg = new FogMonitorMeteoEditDlg(
|
||||
getParent().getShell(), fdmd, this);
|
||||
fogMeteoEditDlg.open();
|
||||
fogMeteoEditDlg = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateThresholdData(FogMonitorMeteoData fmmd)
|
||||
{
|
||||
public void updateThresholdData(FogMonitorMeteoData fmmd) {
|
||||
updateFogDataArray(fmmd);
|
||||
populateList();
|
||||
populateList();
|
||||
}
|
||||
|
||||
private MonitorConfigurationManager getAreaConfigMgr() {
|
||||
if (areaConfigMgr == null) {
|
||||
LocalizationManager mgr = LocalizationManager.getInstance();
|
||||
String siteScope = mgr.getCurrentSite();
|
||||
|
||||
|
||||
areaConfigMgr = FogMonitorConfigurationManager.getInstance();
|
||||
areaConfigMgr.readConfigXml(siteScope);
|
||||
}
|
||||
return areaConfigMgr;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -31,14 +31,15 @@ import com.raytheon.uf.viz.monitor.fog.threshold.FogThresholdMgr;
|
|||
import com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Fog Monitor area configuration dialog.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 5, 2010 mpduff Initial creation
|
||||
* Jan 5, 2010 mpduff Initial creation
|
||||
* Nov 27, 2012 1351 skorolev Changes for non-blocking dialog.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -52,31 +53,35 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
readConfigData();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#
|
||||
* handleOkBtnSelection()
|
||||
*/
|
||||
@Override
|
||||
protected void handleOkBtnSelection() {
|
||||
FogMonitorConfigurationManager configManager = FogMonitorConfigurationManager
|
||||
.getInstance();
|
||||
// Check for changes in the data
|
||||
int choice = showMessage(shell, SWT.OK | SWT.CANCEL,
|
||||
"Fog Monitor Confirm Changes",
|
||||
"Want to Update Fog Monitor's Setup files?");
|
||||
if (!configManager.getAddedZones().isEmpty()
|
||||
|| !configManager.getAddedZones().isEmpty()) {
|
||||
int choice = showMessage(shell, SWT.OK | SWT.CANCEL,
|
||||
"Fog Monitor Confirm Changes",
|
||||
"Want to Update Fog Monitor's Setup files?");
|
||||
if (choice == SWT.OK) {
|
||||
// Save the config xml file
|
||||
configManager.setShipDistance(distanceScale.getSelection());
|
||||
configManager.setTimeWindow(timeScale.getSelection());
|
||||
configManager.setUseAlgorithms(fogChk.getSelection());
|
||||
configManager.saveConfigData();
|
||||
/**
|
||||
* DR#11279: re-initialize threshold manager and the monitor
|
||||
* using new monitor area configuration
|
||||
*/
|
||||
FogThresholdMgr.reInitialize();
|
||||
FogMonitor.reInitialize();
|
||||
|
||||
if (choice == SWT.OK) {
|
||||
// Save the config xml file
|
||||
configManager.setShipDistance(distanceScale.getSelection());
|
||||
configManager.setTimeWindow(timeScale.getSelection());
|
||||
configManager.setUseAlgorithms(fogChk.getSelection());
|
||||
configManager.saveConfigData();
|
||||
|
||||
/**
|
||||
* DR#11279:
|
||||
* re-initialize threshold manager and the monitor
|
||||
* using new monitor area configuration
|
||||
*/
|
||||
FogThresholdMgr.reInitialize();
|
||||
FogMonitor.reInitialize();
|
||||
|
||||
if ( configManager.getAddedZones().size() > 0 || addedZones.size() > 0 ) {
|
||||
String message = "New zones have been added, the display "
|
||||
+ "thresholds for the new zones are set to "
|
||||
+ "default values, you may edit them with the display "
|
||||
|
@ -87,8 +92,8 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
showMessage(shell, SWT.ICON_INFORMATION | SWT.OK,
|
||||
"Fog Monitor Confirm Changes", message);
|
||||
|
||||
if ((configManager.getAddedZones().size() > 0)
|
||||
|| (addedZones.size() > 0)) {
|
||||
if ((!configManager.getAddedZones().isEmpty())
|
||||
|| (!configManager.getAddedZones().isEmpty())) {
|
||||
String message2 = "New zones have been added, and their monitoring thresholds "
|
||||
+ "have been set to default values; would you like to modify "
|
||||
+ "their threshold values now?";
|
||||
|
@ -102,17 +107,37 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
}
|
||||
}
|
||||
}
|
||||
shell.dispose();
|
||||
} else {
|
||||
String message3 = "No changes made.\nDo you want to exit?";
|
||||
int yesno = showMessage(shell,
|
||||
SWT.ICON_QUESTION | SWT.YES | SWT.NO, "Exit", message3);
|
||||
if (yesno == SWT.NO) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
setReturnValue(true);
|
||||
close();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#
|
||||
* setAlgorithmText()
|
||||
*/
|
||||
@Override
|
||||
protected void setAlgorithmText() {
|
||||
fogChk
|
||||
.setText("Fog Monitor algorithms' threat level is considered when determining\n"
|
||||
+ "the guardian icon color.");
|
||||
fogChk.setText("Fog Monitor algorithms' threat level is considered when determining\n"
|
||||
+ "the guardian icon color.");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#readConfigData
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
protected void readConfigData() {
|
||||
FogMonitorConfigurationManager configManager = FogMonitorConfigurationManager
|
||||
|
|
|
@ -1,40 +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.uf.viz.monitor.fog.ui.dialogs;
|
||||
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
||||
import com.raytheon.uf.common.monitor.data.CommonTableConfig.ObsHistType;
|
||||
import com.raytheon.uf.viz.monitor.data.TableData;
|
||||
import com.raytheon.uf.viz.monitor.ui.dialogs.ObsHistTableDlg;
|
||||
|
||||
public class FogObsHistTableDlg extends ObsHistTableDlg {
|
||||
public FogObsHistTableDlg(Shell parent, TableData tableData,
|
||||
String stationID, double lat, double lon, AppName appName,
|
||||
ObsHistType obsType) {
|
||||
super(parent, tableData, stationID, lat, lon, appName, obsType);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
protected void configAction() {
|
||||
System.out.println("FOG Config Action");
|
||||
}
|
||||
}
|
|
@ -207,24 +207,20 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
|
|||
* @param shell
|
||||
*/
|
||||
public void launchDialog(String type, Shell shell) {
|
||||
|
||||
if (type.equals("zone")) {
|
||||
if (zoneDialog == null || zoneDialog.getShell() == null
|
||||
|| zoneDialog.isDisposed()) {
|
||||
if (zoneDialog == null) {
|
||||
zoneDialog = new SSZoneTableDlg(shell, obData);
|
||||
addMonitorListener(zoneDialog);
|
||||
zoneDialog.addMonitorControlListener(this);
|
||||
fireMonitorEvent(zoneDialog.getClass().getName());
|
||||
zoneDialog.open();
|
||||
} else {
|
||||
zoneDialog.bringToTop();
|
||||
}
|
||||
zoneDialog.open();
|
||||
} else if (type.equals("area")) {
|
||||
if (areaDialog == null) {
|
||||
areaDialog = new SSMonitoringAreaConfigDlg(shell,
|
||||
"Safe Seas Monitor Area Configuration");
|
||||
areaDialog.open();
|
||||
}
|
||||
areaDialog.open();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -465,7 +461,7 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
|
|||
zoneDialog = null;
|
||||
}
|
||||
if (areaDialog != null) {
|
||||
areaDialog.shellDisposeDialog();
|
||||
areaDialog.close();
|
||||
areaDialog = null;
|
||||
}
|
||||
}
|
||||
|
@ -492,7 +488,7 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
|
|||
*/
|
||||
public Map<String, Geometry> getMonitoringAreaGeometries() {
|
||||
if (zoneGeometries == null) {
|
||||
ArrayList<String> zones = getMonitorAreaConfig().getAreaList();
|
||||
List<String> zones = getMonitorAreaConfig().getAreaList();
|
||||
zoneGeometries = new HashMap<String, Geometry>();
|
||||
for (String zone : zones) {
|
||||
try {
|
||||
|
|
|
@ -1,293 +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.uf.viz.monitor.safeseas.test;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
||||
import com.raytheon.uf.common.monitor.data.CommonTableConfig;
|
||||
import com.raytheon.uf.common.monitor.data.CommonTableConfig.CellType;
|
||||
import com.raytheon.uf.viz.monitor.data.TableCellData;
|
||||
import com.raytheon.uf.viz.monitor.data.TableData;
|
||||
import com.raytheon.uf.viz.monitor.data.TableRowData;
|
||||
|
||||
public class DataGenerator
|
||||
{
|
||||
private CommonTableConfig ctc;
|
||||
|
||||
public DataGenerator()
|
||||
{
|
||||
ctc = CommonTableConfig.getInstance();
|
||||
}
|
||||
|
||||
public TableData generateData(CommonConfig.AppName appName)
|
||||
{
|
||||
TableData tData = new TableData(appName);
|
||||
|
||||
System.out.println("Creating data for: " + appName.name());
|
||||
|
||||
if (appName == CommonConfig.AppName.SAFESEAS)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
safeseasRow1(i,tData);
|
||||
safeseasRow1(i,tData);
|
||||
}
|
||||
}
|
||||
else if (appName == CommonConfig.AppName.SNOW)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
snowRow1(i,tData);
|
||||
snowRow2(i,tData);
|
||||
}
|
||||
}
|
||||
else if (appName == CommonConfig.AppName.FOG)
|
||||
{
|
||||
for (int i = 0; i < 2000; i++)
|
||||
{
|
||||
fogRow1(i,tData);
|
||||
fogRow2(i,tData);
|
||||
fogRow3(i,tData);
|
||||
fogRow4(i,tData);
|
||||
}
|
||||
}
|
||||
|
||||
return tData;
|
||||
}
|
||||
|
||||
private void fogRow1(int num, TableData tData)
|
||||
{
|
||||
TableRowData trd = new TableRowData(ctc.getTableColumnKeys(CommonConfig.AppName.FOG).length);
|
||||
|
||||
trd.setTableCellData(0, new TableCellData("NJC00" + num, "Hover Text", CellType.AreaId, false));
|
||||
trd.setTableCellData(1, new TableCellData("3", CellType.G, true));
|
||||
trd.setTableCellData(2, new TableCellData(0, CellType.NotMonitored, true));
|
||||
trd.setTableCellData(3, new TableCellData("4", CellType.R, true));
|
||||
trd.setTableCellData(4, new TableCellData(0, CellType.NotMonitored, true));
|
||||
trd.setTableCellData(5, new TableCellData(4, CellType.G, true));
|
||||
trd.setTableCellData(6, new TableCellData(0, CellType.NotMonitored, true));
|
||||
trd.setTableCellData(7, new TableCellData(0, CellType.NotMonitored, true));
|
||||
trd.setTableCellData(8, new TableCellData(70, CellType.G, true));
|
||||
trd.setTableCellData(9, new TableCellData(66, CellType.G, true));
|
||||
trd.setTableCellData(10, new TableCellData(4, CellType.R, true));
|
||||
trd.setTableCellData(11, new TableCellData(88, CellType.R, true));
|
||||
trd.setTableCellData(12, new TableCellData("", CellType.R, true));
|
||||
|
||||
tData.addReplaceDataRow(trd);
|
||||
}
|
||||
|
||||
private void fogRow2(int num, TableData tData)
|
||||
{
|
||||
TableRowData trd = new TableRowData(ctc.getTableColumnKeys(CommonConfig.AppName.FOG).length);
|
||||
|
||||
trd.setTableCellData(0, new TableCellData("ANZ45" + num, "Hover Text", CellType.AreaId, false));
|
||||
trd.setTableCellData(1, new TableCellData("1 1/2", CellType.R, true));
|
||||
trd.setTableCellData(2, new TableCellData(0, CellType.NotMonitored, true));
|
||||
trd.setTableCellData(3, new TableCellData("50", CellType.Y, true));
|
||||
trd.setTableCellData(4, new TableCellData(0, CellType.NotMonitored, true));
|
||||
trd.setTableCellData(5, new TableCellData(80, CellType.R, true));
|
||||
trd.setTableCellData(6, new TableCellData(0, CellType.NotMonitored, true));
|
||||
trd.setTableCellData(7, new TableCellData(0, CellType.NotMonitored, true));
|
||||
trd.setTableCellData(8, new TableCellData(84, CellType.Y, true));
|
||||
trd.setTableCellData(9, new TableCellData(63, CellType.G, true));
|
||||
trd.setTableCellData(10, new TableCellData(6, CellType.Y, true));
|
||||
trd.setTableCellData(11, new TableCellData(48, CellType.G, true));
|
||||
trd.setTableCellData(12, new TableCellData("", CellType.NotDetermined, true));
|
||||
|
||||
tData.addReplaceDataRow(trd);
|
||||
}
|
||||
|
||||
private void fogRow3(int num, TableData tData)
|
||||
{
|
||||
TableRowData trd = new TableRowData(ctc.getTableColumnKeys(CommonConfig.AppName.FOG).length);
|
||||
|
||||
trd.setTableCellData(0, new TableCellData("VAC84" + num, "Hover Text", CellType.AreaId, false));
|
||||
trd.setTableCellData(1, new TableCellData("2 1/2", CellType.Y, true));
|
||||
trd.setTableCellData(2, new TableCellData(0, CellType.NotMonitored, true));
|
||||
trd.setTableCellData(3, new TableCellData("CLR", CellType.G, true));
|
||||
trd.setTableCellData(4, new TableCellData(0, CellType.NotMonitored, true));
|
||||
trd.setTableCellData(5, new TableCellData(45, CellType.Y, true));
|
||||
trd.setTableCellData(6, new TableCellData(0, CellType.NotMonitored, true));
|
||||
trd.setTableCellData(7, new TableCellData(0, CellType.NotMonitored, true));
|
||||
trd.setTableCellData(8, new TableCellData(95, CellType.R, true));
|
||||
trd.setTableCellData(9, new TableCellData(75, CellType.Y, true));
|
||||
trd.setTableCellData(10, new TableCellData(15, CellType.G, true));
|
||||
trd.setTableCellData(11, new TableCellData(66, CellType.Y, true));
|
||||
trd.setTableCellData(12, new TableCellData("", CellType.G, true));
|
||||
|
||||
tData.addReplaceDataRow(trd);
|
||||
}
|
||||
|
||||
private void fogRow4(int num, TableData tData)
|
||||
{
|
||||
TableRowData trd = new TableRowData(ctc.getTableColumnKeys(CommonConfig.AppName.FOG).length);
|
||||
|
||||
trd.setTableCellData(0, new TableCellData("VEC84" + num, "Hover Text", CellType.AreaId, false));
|
||||
trd.setTableCellData(1, new TableCellData("1 7/8", CellType.Y, true));
|
||||
trd.setTableCellData(2, new TableCellData(0, CellType.NotMonitored, true));
|
||||
trd.setTableCellData(3, new TableCellData("CLR", CellType.G, true));
|
||||
trd.setTableCellData(4, new TableCellData(0, CellType.NotMonitored, true));
|
||||
trd.setTableCellData(5, new TableCellData(46, CellType.Y, true));
|
||||
trd.setTableCellData(6, new TableCellData(0, CellType.NotMonitored, true));
|
||||
trd.setTableCellData(7, new TableCellData(0, CellType.NotMonitored, true));
|
||||
trd.setTableCellData(8, new TableCellData(93, CellType.R, true));
|
||||
trd.setTableCellData(9, new TableCellData(76, CellType.Y, true));
|
||||
trd.setTableCellData(10, new TableCellData(14, CellType.G, true));
|
||||
trd.setTableCellData(11, new TableCellData(60, CellType.Y, true));
|
||||
trd.setTableCellData(12, new TableCellData("", CellType.G, true));
|
||||
|
||||
tData.addReplaceDataRow(trd);
|
||||
}
|
||||
|
||||
private void snowRow1(int num, TableData tData)
|
||||
{
|
||||
TableRowData trd = new TableRowData(ctc.getTableColumnKeys(CommonConfig.AppName.SNOW).length);
|
||||
|
||||
trd.setTableCellData(0, new TableCellData("PAC00" + num, "Hover Text", CellType.AreaId, false));
|
||||
trd.setTableCellData(1, new TableCellData("", CellType.G, true));
|
||||
trd.setTableCellData(2, new TableCellData("", CellType.Y, true));
|
||||
trd.setTableCellData(3, new TableCellData(0, CellType.NotAvailable, true));
|
||||
trd.setTableCellData(4, new TableCellData(0, CellType.NotMonitored, true));
|
||||
trd.setTableCellData(5, new TableCellData(0, CellType.NotMonitored, true));
|
||||
trd.setTableCellData(6, new TableCellData(11, CellType.G, true));
|
||||
trd.setTableCellData(7, new TableCellData(0, CellType.NotAvailable, true));
|
||||
trd.setTableCellData(8, new TableCellData(16, CellType.G, true));
|
||||
trd.setTableCellData(9, new TableCellData(36, CellType.Y, true));
|
||||
trd.setTableCellData(10, new TableCellData(28, CellType.R, true));
|
||||
trd.setTableCellData(11, new TableCellData("9", CellType.G, true));
|
||||
trd.setTableCellData(12, new TableCellData(1015, CellType.G, true));
|
||||
trd.setTableCellData(13, new TableCellData(27, CellType.G, true));
|
||||
trd.setTableCellData(14, new TableCellData(0, CellType.NotAvailable, true));
|
||||
trd.setTableCellData(15, new TableCellData(0.025, CellType.Y, true));
|
||||
trd.setTableCellData(16, new TableCellData(0, CellType.NotAvailable, true));
|
||||
trd.setTableCellData(17, new TableCellData(0, CellType.NotAvailable, true));
|
||||
trd.setTableCellData(18, new TableCellData(0, CellType.NotAvailable, true));
|
||||
|
||||
tData.addReplaceDataRow(trd);
|
||||
}
|
||||
|
||||
private void snowRow2(int num, TableData tData)
|
||||
{
|
||||
TableRowData trd = new TableRowData(ctc.getTableColumnKeys(CommonConfig.AppName.SNOW).length);
|
||||
|
||||
trd.setTableCellData(0, new TableCellData("ANZ00" + num, "Hover Text", CellType.AreaId, false));
|
||||
trd.setTableCellData(1, new TableCellData("", CellType.Y, true));
|
||||
trd.setTableCellData(2, new TableCellData("", CellType.R, true));
|
||||
trd.setTableCellData(3, new TableCellData(0, CellType.NotAvailable, true));
|
||||
trd.setTableCellData(4, new TableCellData(0, CellType.NotMonitored, true));
|
||||
trd.setTableCellData(5, new TableCellData(0, CellType.NotMonitored, true));
|
||||
trd.setTableCellData(6, new TableCellData(45, CellType.Y, true));
|
||||
trd.setTableCellData(7, new TableCellData(24, CellType.G, true));
|
||||
trd.setTableCellData(8, new TableCellData(25, CellType.Y, true));
|
||||
trd.setTableCellData(9, new TableCellData(28, CellType.R, true));
|
||||
trd.setTableCellData(10, new TableCellData(45, CellType.G, true));
|
||||
trd.setTableCellData(11, new TableCellData("2 1/2", CellType.G, true));
|
||||
trd.setTableCellData(12, new TableCellData(900, CellType.G, true));
|
||||
trd.setTableCellData(13, new TableCellData(16, CellType.Y, true));
|
||||
trd.setTableCellData(14, new TableCellData(25, CellType.R, true));
|
||||
trd.setTableCellData(15, new TableCellData(1.02566, CellType.R, true));
|
||||
trd.setTableCellData(16, new TableCellData(0, CellType.NotAvailable, true));
|
||||
trd.setTableCellData(17, new TableCellData(0, CellType.NotAvailable, true));
|
||||
trd.setTableCellData(18, new TableCellData(0, CellType.NotAvailable, true));
|
||||
|
||||
tData.addReplaceDataRow(trd);
|
||||
}
|
||||
|
||||
private void safeseasRow1(int num, TableData tData)
|
||||
{
|
||||
TableRowData trd = new TableRowData(ctc.getTableColumnKeys(CommonConfig.AppName.SAFESEAS).length);
|
||||
|
||||
trd.setTableCellData(0, new TableCellData("ANZ00" + num, "Hover Text", CellType.AreaId, false));
|
||||
trd.setTableCellData(1, new TableCellData("", CellType.R, true));
|
||||
trd.setTableCellData(2, new TableCellData("", CellType.G, true));
|
||||
trd.setTableCellData(3, new TableCellData("", CellType.G, true));
|
||||
trd.setTableCellData(4, new TableCellData("", CellType.G, true));
|
||||
trd.setTableCellData(5, new TableCellData(0, CellType.NotAvailable, true));
|
||||
trd.setTableCellData(6, new TableCellData(15, CellType.Y, true));
|
||||
trd.setTableCellData(7, new TableCellData(0, CellType.NotAvailable, true));
|
||||
trd.setTableCellData(8, new TableCellData(19, CellType.R, true));
|
||||
trd.setTableCellData(9, new TableCellData("8", CellType.G, true));
|
||||
trd.setTableCellData(10, new TableCellData(61, CellType.G, true));
|
||||
trd.setTableCellData(11, new TableCellData(43, CellType.G, true));
|
||||
trd.setTableCellData(12, new TableCellData(0, CellType.NotAvailable, true));
|
||||
trd.setTableCellData(13, new TableCellData(0, CellType.NotAvailable, true));
|
||||
trd.setTableCellData(14, new TableCellData(0, CellType.NotAvailable, true));
|
||||
trd.setTableCellData(15, new TableCellData(0, CellType.NotAvailable, true));
|
||||
trd.setTableCellData(16, new TableCellData(0, CellType.NotAvailable, true));
|
||||
trd.setTableCellData(17, new TableCellData(0, CellType.NotAvailable, true));
|
||||
trd.setTableCellData(18, new TableCellData(0, CellType.NotMonitored, true));
|
||||
trd.setTableCellData(19, new TableCellData(0, CellType.NotAvailable, true));
|
||||
trd.setTableCellData(20, new TableCellData(0, CellType.NotAvailable, true));
|
||||
trd.setTableCellData(21, new TableCellData(0, CellType.NotMonitored, true));
|
||||
trd.setTableCellData(22, new TableCellData("", CellType.G, true));
|
||||
|
||||
tData.addReplaceDataRow(trd);
|
||||
}
|
||||
|
||||
//*******************************************************************************************
|
||||
//*******************************************************************************************
|
||||
//*******************************************************************************************
|
||||
//*******************************************************************************************
|
||||
//*******************************************************************************************
|
||||
|
||||
public TableData generateObsHistData(CommonConfig.AppName appName, CommonTableConfig.ObsHistType obsType)
|
||||
{
|
||||
TableData tData = new TableData(appName);
|
||||
|
||||
System.out.println("Creating data for: " + appName.name() + " and " + obsType.name());
|
||||
|
||||
if (appName == CommonConfig.AppName.SAFESEAS)
|
||||
{
|
||||
// Create Safeseas Data
|
||||
}
|
||||
else if (appName == CommonConfig.AppName.SNOW)
|
||||
{
|
||||
if (obsType == CommonTableConfig.ObsHistType.METAR)
|
||||
{
|
||||
obsSnowMetarRow1(0, tData);
|
||||
}
|
||||
}
|
||||
else if (appName == CommonConfig.AppName.FOG)
|
||||
{
|
||||
// Create Fog Data
|
||||
}
|
||||
|
||||
return tData;
|
||||
}
|
||||
|
||||
private void obsSnowMetarRow1(int num, TableData tData)
|
||||
{
|
||||
// TableRowData trd = new TableRowData(ctc.getZoneStnColumnKeys(CommonConfig.AppName.SNOW).length);
|
||||
|
||||
int numCols = ctc.getObsHistColumnKeys(CommonConfig.AppName.SNOW,
|
||||
CommonTableConfig.ObsHistType.METAR).length;
|
||||
TableRowData trd = new TableRowData(numCols);
|
||||
|
||||
trd.setTableCellData(0, new TableCellData(new Date(), CellType.ObsHist));
|
||||
trd.setTableCellData(1, new TableCellData(300, CellType.ObsHist, false));
|
||||
trd.setTableCellData(2, new TableCellData(7, CellType.ObsHist, false));
|
||||
trd.setTableCellData(3, new TableCellData(20, CellType.ObsHist, false));
|
||||
trd.setTableCellData(4, new TableCellData(1023, CellType.ObsHist, false));
|
||||
trd.setTableCellData(5, new TableCellData(-.02, CellType.ObsHist, false));
|
||||
|
||||
tData.addReplaceDataRow(trd);
|
||||
}
|
||||
}
|
|
@ -1,266 +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.uf.viz.monitor.safeseas.test;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Dialog;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.monitor.data.CommonTableConfig.CellType;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
|
||||
import com.raytheon.uf.viz.monitor.safeseas.threshold.SSThresholdMgr;
|
||||
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr.ThresholdKey;
|
||||
import com.raytheon.uf.viz.monitor.ui.dialogs.LoadSaveDeleteSelectDlg;
|
||||
import com.raytheon.uf.viz.monitor.ui.dialogs.LoadSaveDeleteSelectDlg.DialogType;
|
||||
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
|
||||
|
||||
public class SSTestDriverDlg extends Dialog {
|
||||
private Display display;
|
||||
|
||||
private Shell shell;
|
||||
|
||||
private Font lblFont;
|
||||
|
||||
public SSTestDriverDlg(Shell parentShell) {
|
||||
super(parentShell, 0);
|
||||
}
|
||||
|
||||
public Object open() {
|
||||
Shell parent = getParent();
|
||||
display = parent.getDisplay();
|
||||
shell = new Shell(parent, SWT.DIALOG_TRIM);
|
||||
shell.setText("SAFESEAS Driver");
|
||||
|
||||
GridLayout gl = new GridLayout(1, false);
|
||||
gl.horizontalSpacing = 0;
|
||||
shell.setLayout(gl);
|
||||
|
||||
shell.setSize(600, 600);
|
||||
|
||||
lblFont = new Font(shell.getDisplay(), "Monospace", 14, SWT.NORMAL);
|
||||
|
||||
initComponents();
|
||||
|
||||
shell.open();
|
||||
|
||||
while (!shell.isDisposed()) {
|
||||
if (!display.readAndDispatch())
|
||||
display.sleep();
|
||||
}
|
||||
|
||||
lblFont.dispose();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
Label lbl = new Label(shell, SWT.NONE);
|
||||
lbl.setText("SAFESEAS");
|
||||
lbl.setFont(lblFont);
|
||||
|
||||
Button printDisplayThresh = new Button(shell, SWT.PUSH);
|
||||
printDisplayThresh.setText("Print Display Threshold Data");
|
||||
printDisplayThresh.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
printDisplayThresholdData();
|
||||
}
|
||||
});
|
||||
|
||||
Button changeThresh = new Button(shell, SWT.PUSH);
|
||||
changeThresh.setText("Change Threshold Data");
|
||||
changeThresh.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
changeThresholdData();
|
||||
}
|
||||
});
|
||||
|
||||
Button loadThreshDlg = new Button(shell, SWT.PUSH);
|
||||
loadThreshDlg.setText("Load Dialog");
|
||||
loadThreshDlg.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
displayLoadDialog();
|
||||
}
|
||||
});
|
||||
|
||||
Button saveAsThreshDlg = new Button(shell, SWT.PUSH);
|
||||
saveAsThreshDlg.setText("Save As Dialog");
|
||||
saveAsThreshDlg.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
displaySaveDialog();
|
||||
}
|
||||
});
|
||||
|
||||
Button printDefaultFileNameBtn = new Button(shell, SWT.PUSH);
|
||||
printDefaultFileNameBtn.setText("Print Default Threshold File Name");
|
||||
printDefaultFileNameBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
displayDefaultThreshFileName();
|
||||
}
|
||||
});
|
||||
|
||||
Button selectDefaultFileNameBtn = new Button(shell, SWT.PUSH);
|
||||
selectDefaultFileNameBtn.setText("Select Default Threshold File Name");
|
||||
selectDefaultFileNameBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
selectDefaultThreshFileName();
|
||||
}
|
||||
});
|
||||
|
||||
Button loadDefaultFileNameBtn = new Button(shell, SWT.PUSH);
|
||||
loadDefaultFileNameBtn.setText("Load Default Threshold");
|
||||
loadDefaultFileNameBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
loadDefaultThresholds();
|
||||
}
|
||||
});
|
||||
|
||||
Button cellTypeBtn = new Button(shell, SWT.PUSH);
|
||||
cellTypeBtn.setText("Print CellType");
|
||||
cellTypeBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
printCellType();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void addSeparator(Composite parentComp) {
|
||||
GridLayout gl = (GridLayout) parentComp.getLayout();
|
||||
|
||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
gd.horizontalSpan = gl.numColumns;
|
||||
Label sepLbl = new Label(parentComp, SWT.SEPARATOR | SWT.HORIZONTAL);
|
||||
sepLbl.setLayoutData(gd);
|
||||
}
|
||||
|
||||
private void printDisplayThresholdData() {
|
||||
SSThresholdMgr sstm = SSThresholdMgr.getInstance();
|
||||
sstm.printDisplayThresholds();
|
||||
}
|
||||
|
||||
private void changeThresholdData() {
|
||||
System.out.println("NOT WORKING...");
|
||||
SSThresholdMgr sstm = SSThresholdMgr.getInstance();
|
||||
sstm.setThresholdValue(DataUsageKey.DISPLAY, ThresholdKey.RED, "NE093",
|
||||
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_TEMP
|
||||
.getXmlKey(), 111);
|
||||
}
|
||||
|
||||
private void displayLoadDialog() {
|
||||
SSThresholdMgr sstm = SSThresholdMgr.getInstance();
|
||||
|
||||
LoadSaveDeleteSelectDlg lsDlg = new LoadSaveDeleteSelectDlg(shell,
|
||||
DialogType.OPEN, sstm.getDisplayThresholdPath(), sstm
|
||||
.getDefaultFileName(DataUsageKey.DISPLAY));
|
||||
LocalizationFile fileName = (LocalizationFile) lsDlg.open();
|
||||
|
||||
if (fileName == null) {
|
||||
System.out.println("FileName is null...");
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("Selected file absolute path= "
|
||||
+ fileName.getFile().getAbsolutePath());
|
||||
System.out.println("Selected file name = "
|
||||
+ fileName.getFile().getName());
|
||||
|
||||
sstm.loadDisplayThreashold(fileName.getFile().getName());
|
||||
}
|
||||
|
||||
private void displaySaveDialog() {
|
||||
SSThresholdMgr sstm = SSThresholdMgr.getInstance();
|
||||
|
||||
LoadSaveDeleteSelectDlg lsDlg = new LoadSaveDeleteSelectDlg(shell,
|
||||
DialogType.SAVE_AS, sstm.getDisplayThresholdPath(), sstm
|
||||
.getDefaultFileName(DataUsageKey.DISPLAY));
|
||||
LocalizationFile fileName = (LocalizationFile) lsDlg.open();
|
||||
|
||||
if (fileName == null) {
|
||||
System.out.println("FileName is null...");
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("Selected file absolute path= "
|
||||
+ fileName.getFile().getAbsolutePath());
|
||||
System.out.println("Selected file name = "
|
||||
+ fileName.getFile().getName());
|
||||
|
||||
sstm.saveAsDisplayThresholds(fileName.getFile().getName());
|
||||
}
|
||||
|
||||
private void displayDefaultThreshFileName() {
|
||||
SSThresholdMgr sstm = SSThresholdMgr.getInstance();
|
||||
|
||||
System.out.println(">" + sstm.getDefDisplayThreshFileName() + "<");
|
||||
}
|
||||
|
||||
private void selectDefaultThreshFileName() {
|
||||
SSThresholdMgr sstm = SSThresholdMgr.getInstance();
|
||||
|
||||
LoadSaveDeleteSelectDlg lsDlg = new LoadSaveDeleteSelectDlg(shell,
|
||||
DialogType.SELECT_DEFAULT, sstm.getDisplayThresholdPath(), sstm
|
||||
.getDefaultFileName(DataUsageKey.DISPLAY));
|
||||
LocalizationFile fileName = (LocalizationFile) lsDlg.open();
|
||||
|
||||
if (fileName == null) {
|
||||
System.out.println("FileName is null...");
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("Selected file absolute path= "
|
||||
+ fileName.getFile().getAbsolutePath());
|
||||
System.out.println("Selected file name = "
|
||||
+ fileName.getFile().getName());
|
||||
|
||||
sstm.setDefaultDisplayFileName(fileName.getFile().getName());
|
||||
}
|
||||
|
||||
private void loadDefaultThresholds() {
|
||||
SSThresholdMgr sstm = SSThresholdMgr.getInstance();
|
||||
|
||||
sstm.loadDefaultDisplayThreshold();
|
||||
}
|
||||
|
||||
private void printCellType() {
|
||||
CellType ct;
|
||||
String key;
|
||||
double value = Double.NaN;
|
||||
|
||||
SSThresholdMgr sstm = SSThresholdMgr.getInstance();
|
||||
|
||||
}
|
||||
}
|
|
@ -25,7 +25,8 @@ import org.eclipse.core.commands.ExecutionException;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.uf.viz.monitor.safeseas.SafeSeasMonitor;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.viz.monitor.safeseas.ui.dialogs.SSMonitoringAreaConfigDlg;
|
||||
|
||||
/**
|
||||
|
@ -37,7 +38,8 @@ import com.raytheon.uf.viz.monitor.safeseas.ui.dialogs.SSMonitoringAreaConfigDlg
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 28, 2009 3963 dhladky Initial creation.
|
||||
* March 5, 2012 14413 zhao Launch AreaConfigDlg w/o monitor
|
||||
* March 5, 2012 14413 zhao Launch AreaConfigDlg w/o monitor
|
||||
* Nov.27, 2012 1297 skorolev Cleanup code for non-blocking dialog
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -47,19 +49,21 @@ import com.raytheon.uf.viz.monitor.safeseas.ui.dialogs.SSMonitoringAreaConfigDlg
|
|||
|
||||
public class SafeseasAreaConfigAction extends AbstractHandler {
|
||||
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(SafeseasAreaConfigAction.class);
|
||||
|
||||
private SSMonitoringAreaConfigDlg configDlg;
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
|
||||
System.out.println("Activating/Action the Safeseas Area Config...");
|
||||
|
||||
//SafeSeasMonitor monitor = SafeSeasMonitor.getInstance();
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
//monitor.launchDialog("area", shell);
|
||||
|
||||
SSMonitoringAreaConfigDlg configDlg= new SSMonitoringAreaConfigDlg(shell, "Safe Seas Monitor Area Configuration");
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
if (configDlg == null || configDlg.getShell() == null
|
||||
|| configDlg.isDisposed()) {
|
||||
configDlg = new SSMonitoringAreaConfigDlg(shell,
|
||||
"SAFESEAS Monitor Area Configuration");
|
||||
}
|
||||
configDlg.open();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -38,7 +38,8 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 5, 2010 mpduff Initial creation
|
||||
* Jan 5, 2010 mpduff Initial creation
|
||||
* Nov 27, 2012 1351 skorolev Changes for non-blocking dialog.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -48,63 +49,92 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg;
|
|||
|
||||
public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param parent
|
||||
* @param title
|
||||
*/
|
||||
public SSMonitoringAreaConfigDlg(Shell parent, String title) {
|
||||
super(parent, title, AppName.SAFESEAS);
|
||||
readConfigData();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#
|
||||
* handleOkBtnSelection()
|
||||
*/
|
||||
@Override
|
||||
protected void handleOkBtnSelection() {
|
||||
SSMonitorConfigurationManager configManager = SSMonitorConfigurationManager
|
||||
.getInstance();
|
||||
// Check for changes in the data
|
||||
int choice = showMessage(shell, SWT.OK | SWT.CANCEL,
|
||||
"SAFESEAS Monitor Confirm Changes",
|
||||
"Want to update the SAFESEAS setup files?");
|
||||
|
||||
if (choice == SWT.OK) {
|
||||
// Save the config xml file
|
||||
configManager.setShipDistance(distanceScale.getSelection());
|
||||
configManager.setTimeWindow(timeScale.getSelection());
|
||||
configManager.setUseAlgorithms(fogChk.getSelection());
|
||||
configManager.saveConfigData();
|
||||
|
||||
/**
|
||||
* DR#11279: re-initialize threshold manager and the monitor using
|
||||
* new monitor area configuration
|
||||
*/
|
||||
SSThresholdMgr.reInitialize();
|
||||
SafeSeasMonitor.reInitialize();
|
||||
|
||||
showMessage(shell, SWT.OK, "SAFESEAS Config Change",
|
||||
"You're updating the SAFESEAS monitoring settings."
|
||||
+ "\n\nIf SAFESEAS is running anywhere within "
|
||||
+ "the office, please clear it.\n");
|
||||
if (configManager.getAddedZones().size() > 0
|
||||
|| addedZones.size() > 0) {
|
||||
if (!configManager.getAddedZones().isEmpty()
|
||||
|| !configManager.getAddedZones().isEmpty()) {
|
||||
int choice = showMessage(shell, SWT.OK | SWT.CANCEL,
|
||||
"SAFESEAS Monitor Confirm Changes",
|
||||
"Want to update the SAFESEAS setup files?");
|
||||
if (choice == SWT.OK) {
|
||||
// Save the config xml file
|
||||
configManager.setShipDistance(distanceScale.getSelection());
|
||||
configManager.setTimeWindow(timeScale.getSelection());
|
||||
configManager.setUseAlgorithms(fogChk.getSelection());
|
||||
configManager.saveConfigData();
|
||||
/**
|
||||
* DR#11279: re-initialize threshold manager and the monitor
|
||||
* using new monitor area configuration
|
||||
*/
|
||||
SSThresholdMgr.reInitialize();
|
||||
SafeSeasMonitor.reInitialize();
|
||||
showMessage(shell, SWT.OK, "SAFESEAS Config Change",
|
||||
"You're updating the SAFESEAS monitoring settings."
|
||||
+ "\n\nIf SAFESEAS is running anywhere within "
|
||||
+ "the office, please clear it.\n");
|
||||
String message2 = "New zones have been added, and their monitoring thresholds "
|
||||
+ "have been set to default values; would you like to modify "
|
||||
+ "their threshold values now?";
|
||||
int yesno = showMessage(shell, SWT.ICON_QUESTION | SWT.YES
|
||||
| SWT.NO, "Edit Thresholds Now?", message2);
|
||||
if (yesno == SWT.YES) {
|
||||
|
||||
SSDispMonThreshDlg ssMonitorDlg = new SSDispMonThreshDlg(
|
||||
shell, CommonConfig.AppName.SAFESEAS,
|
||||
DataUsageKey.MONITOR);
|
||||
ssMonitorDlg.open();
|
||||
}
|
||||
}
|
||||
shell.dispose();
|
||||
} else {
|
||||
String message3 = "No changes made.\nDo you want to exit?";
|
||||
int yesno = showMessage(shell,
|
||||
SWT.ICON_QUESTION | SWT.YES | SWT.NO, "Exit", message3);
|
||||
if (yesno == SWT.NO) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
setReturnValue(true);
|
||||
close();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#
|
||||
* setAlgorithmText()
|
||||
*/
|
||||
@Override
|
||||
protected void setAlgorithmText() {
|
||||
fogChk.setText("The Fog Monitor overall threat level is "
|
||||
+ "considered when determining the anchor color.");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#readConfigData
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
protected void readConfigData() {
|
||||
SSMonitorConfigurationManager configManager = SSMonitorConfigurationManager
|
||||
|
|
|
@ -1,40 +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.uf.viz.monitor.safeseas.ui.dialogs;
|
||||
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
||||
import com.raytheon.uf.common.monitor.data.CommonTableConfig.ObsHistType;
|
||||
import com.raytheon.uf.viz.monitor.data.TableData;
|
||||
import com.raytheon.uf.viz.monitor.ui.dialogs.ObsHistTableDlg;
|
||||
|
||||
public class SSObsHistTableDlg extends ObsHistTableDlg {
|
||||
public SSObsHistTableDlg(Shell parent, TableData tableData,
|
||||
String stationID, double lat, double lon, AppName appName,
|
||||
ObsHistType obsType) {
|
||||
super(parent, tableData, stationID, lat, lon, appName, obsType);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
protected void configAction() {
|
||||
System.out.println("SAFESEAS Config Action");
|
||||
}
|
||||
}
|
|
@ -1,174 +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.uf.viz.monitor.scan.commondialogs;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.StyledText;
|
||||
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.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Dialog;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
/**
|
||||
* Displays a dialog that contains information about using the unwarned functionality.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 25, 2009 3039 lvenable Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
* @version 1.0
|
||||
*/
|
||||
public class UnwarnedInfoDlg extends Dialog
|
||||
{
|
||||
/**
|
||||
* Dialog shell.
|
||||
*/
|
||||
private Shell shell;
|
||||
|
||||
/**
|
||||
* The display control.
|
||||
*/
|
||||
private Display display;
|
||||
|
||||
/**
|
||||
* Text control.
|
||||
*/
|
||||
private StringBuilder infoText;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param parent Parent shell.
|
||||
*/
|
||||
public UnwarnedInfoDlg(Shell parent)
|
||||
{
|
||||
super(parent, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open method.
|
||||
* @return Null.
|
||||
*/
|
||||
public Object open()
|
||||
{
|
||||
Shell parent = getParent();
|
||||
display = parent.getDisplay();
|
||||
shell = new Shell(parent, SWT.DIALOG_TRIM);
|
||||
|
||||
// Create the main layout for the shell.
|
||||
GridLayout mainLayout = new GridLayout(1, false);
|
||||
mainLayout.marginHeight = 0;
|
||||
mainLayout.marginWidth = 0;
|
||||
shell.setLayout(mainLayout);
|
||||
shell.setText("Unwarned Alarm Information");
|
||||
|
||||
// Initialize all of the controls and layouts
|
||||
initializeComponents();
|
||||
|
||||
shell.pack();
|
||||
shell.open();
|
||||
|
||||
while (!shell.isDisposed())
|
||||
{
|
||||
if (!display.readAndDispatch())
|
||||
{
|
||||
display.sleep();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the components.
|
||||
*/
|
||||
private void initializeComponents()
|
||||
{
|
||||
createInfoString();
|
||||
|
||||
createControls();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the text control and the close button.
|
||||
*/
|
||||
private void createControls()
|
||||
{
|
||||
Composite controlComp = new Composite(shell, SWT.NONE);
|
||||
controlComp.setLayout(new GridLayout(1, false));
|
||||
|
||||
GridData gd = new GridData(400, 300);
|
||||
StyledText stText = new StyledText(controlComp, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
|
||||
stText.setWordWrap(true);
|
||||
stText.setText(infoText.toString());
|
||||
stText.setLayoutData(gd);
|
||||
|
||||
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
|
||||
gd.widthHint = 80;
|
||||
Button closeBtn = new Button(controlComp, SWT.PUSH);
|
||||
closeBtn.setText("Close");
|
||||
closeBtn.setLayoutData(gd);
|
||||
closeBtn.addSelectionListener(new SelectionAdapter()
|
||||
{
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e)
|
||||
{
|
||||
shell.dispose();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the information text.
|
||||
*/
|
||||
private void createInfoString()
|
||||
{
|
||||
infoText = new StringBuilder();
|
||||
|
||||
infoText.append("SCAN identifies those storm cells that contain a ");
|
||||
infoText.append("Tornado Vortex Signature (TVS) and to some extent ");
|
||||
infoText.append("severe weather (based on various storm cell parameters). ");
|
||||
infoText.append("Now SCAN can determine which storm cells currently have ");
|
||||
infoText.append("an active TOR or SVR warning and which do not. For ");
|
||||
infoText.append("those that do not, the SCAN user can set various storm ");
|
||||
infoText.append("cell parameter thresholds (see below). If these thresholds ");
|
||||
infoText.append("are met or exceeded and no TOR and/or SVR is in effect ");
|
||||
infoText.append("in the polygon where the cell is located, an Unwarned Storm ");
|
||||
infoText.append("Alarm will be issued.\n\n");
|
||||
infoText.append("To turn this functionality on for TOR and/or SVR warnings, ");
|
||||
infoText.append("simply click the toggle below on and then check and specify ");
|
||||
infoText.append("the thresholds you would like be used in order to issue a TOR ");
|
||||
infoText.append("and/or SVR Unwarned Storm Cell Alarm. You will know that ");
|
||||
infoText.append("an Unwarned Storm Alarm has been issued when the storm ");
|
||||
infoText.append("cell identifier in the Storm Cell Table changes color to ");
|
||||
infoText.append("magenta for TOR warnings and yellow for SVR warnings.");
|
||||
}
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
package com.raytheon.uf.viz.monitor.scan.test;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.viz.monitor.scan.commondialogs.TimeHeightDlg;
|
||||
|
||||
public class TimeHeightMainDlg
|
||||
{
|
||||
private Display display;
|
||||
private Shell shell;
|
||||
|
||||
public TimeHeightMainDlg()
|
||||
{
|
||||
display = new Display();
|
||||
shell = new Shell(display);
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
GridLayout gl = new GridLayout(1, false);
|
||||
gl.horizontalSpacing = 0;
|
||||
shell.setLayout(gl);
|
||||
|
||||
shell.setSize(600, 300);
|
||||
|
||||
createButtons();
|
||||
|
||||
// shell.pack();
|
||||
shell.open();
|
||||
|
||||
while (!shell.isDisposed())
|
||||
{
|
||||
if (!display.readAndDispatch()) display.sleep();
|
||||
}
|
||||
|
||||
display.dispose();
|
||||
}
|
||||
|
||||
private void createButtons()
|
||||
{
|
||||
Button timeHeightBtn = new Button(shell, SWT.PUSH);
|
||||
timeHeightBtn.setText("Time-Height Graph Dialog");
|
||||
timeHeightBtn.addSelectionListener(new SelectionAdapter()
|
||||
{
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e)
|
||||
{
|
||||
// TimeHeightDlg thd = new TimeHeightDlg(shell);
|
||||
// thd.open();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
TimeHeightMainDlg mwd = new TimeHeightMainDlg();
|
||||
mwd.run();
|
||||
}
|
||||
}
|
|
@ -1,212 +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.uf.viz.monitor.scan.test;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Dialog;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.monitor.scan.config.SCANConfig;
|
||||
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.CELLTable;
|
||||
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
|
||||
import com.raytheon.uf.viz.monitor.scan.TrendGraphData;
|
||||
import com.raytheon.uf.viz.monitor.scan.commondialogs.TrendGraphCanvas;
|
||||
|
||||
public class TrendGraphWindowDlg extends Dialog
|
||||
{
|
||||
private Display display;
|
||||
private Shell shell;
|
||||
|
||||
/*
|
||||
* Canvas information
|
||||
*/
|
||||
private TrendGraphCanvas trendCanvas;
|
||||
|
||||
private Shell parentShell;
|
||||
|
||||
private TrendGraphData trendGraphData;
|
||||
|
||||
private Combo trendsCbo;
|
||||
|
||||
private Calendar cal;
|
||||
|
||||
private Date startTime;
|
||||
|
||||
public TrendGraphWindowDlg(Shell parentShell)
|
||||
{
|
||||
super(parentShell, 0);
|
||||
}
|
||||
|
||||
public Object open()
|
||||
{
|
||||
Shell parent = getParent();
|
||||
display = parent.getDisplay();
|
||||
shell = new Shell(parent, SWT.DIALOG_TRIM);
|
||||
shell.setText("Trend Sample");
|
||||
|
||||
GridLayout gl = new GridLayout(1, false);
|
||||
gl.horizontalSpacing = 0;
|
||||
shell.setLayout(gl);
|
||||
|
||||
shell.setSize(600, 300);
|
||||
|
||||
initComponents();
|
||||
|
||||
shell.open();
|
||||
|
||||
while (!shell.isDisposed())
|
||||
{
|
||||
if (!display.readAndDispatch()) display.sleep();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void initComponents()
|
||||
{
|
||||
cal = Calendar.getInstance();
|
||||
startTime = cal.getTime();
|
||||
trendGraphData = new TrendGraphData();
|
||||
|
||||
setupPoshData();
|
||||
// setupAzmData();
|
||||
|
||||
createCanvas();
|
||||
createComboControls();
|
||||
|
||||
handleComboAction();
|
||||
}
|
||||
|
||||
private void createCanvas()
|
||||
{
|
||||
trendCanvas = new TrendGraphCanvas(shell, trendGraphData, startTime, ScanTables.CELL,
|
||||
CELLTable.POSH.getColName(),null,null,null);
|
||||
|
||||
}
|
||||
|
||||
private void createComboControls()
|
||||
{
|
||||
trendsCbo = new Combo(shell, SWT.DROP_DOWN | SWT.READ_ONLY);
|
||||
trendsCbo.addSelectionListener(new SelectionAdapter()
|
||||
{
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e)
|
||||
{
|
||||
handleComboAction();
|
||||
}
|
||||
});
|
||||
|
||||
SCANConfig scanCfg = SCANConfig.getInstance();
|
||||
|
||||
String[] attrs = scanCfg.getTrendAttributes(ScanTables.CELL);
|
||||
|
||||
for (String str : attrs)
|
||||
{
|
||||
trendsCbo.add(str);
|
||||
}
|
||||
|
||||
int idx = trendsCbo.indexOf("posh");
|
||||
|
||||
trendsCbo.select(idx);
|
||||
}
|
||||
|
||||
private void handleComboAction()
|
||||
{
|
||||
|
||||
String attrName = trendsCbo.getItem(trendsCbo.getSelectionIndex());
|
||||
|
||||
trendCanvas.updateAttribute(attrName, trendGraphData, startTime);
|
||||
}
|
||||
|
||||
// private void setupAzmData()
|
||||
// {
|
||||
// Date d = null;
|
||||
//
|
||||
// d = cal.getTime();
|
||||
// dataMap.put(d, 222.0);
|
||||
//
|
||||
// cal.add(Calendar.MINUTE, -5);
|
||||
// d = cal.getTime();
|
||||
// dataMap.put(d, 200.0);
|
||||
//
|
||||
// cal.add(Calendar.MINUTE, -5);
|
||||
// d = cal.getTime();
|
||||
// dataMap.put(d, 150.0);
|
||||
//
|
||||
// cal.add(Calendar.MINUTE, -5);
|
||||
// d = cal.getTime();
|
||||
// dataMap.put(d, 170.0);
|
||||
//
|
||||
// cal.add(Calendar.MINUTE, -5);
|
||||
// d = cal.getTime();
|
||||
// dataMap.put(d, 210.0);
|
||||
//
|
||||
// cal.add(Calendar.MINUTE, -5);
|
||||
// d = cal.getTime();
|
||||
// dataMap.put(d, 123.0);
|
||||
//
|
||||
// cal.add(Calendar.MINUTE, -5);
|
||||
// d = cal.getTime();
|
||||
// dataMap.put(d, 192.0);
|
||||
// }
|
||||
|
||||
private void setupPoshData()
|
||||
{
|
||||
Date d = null;
|
||||
LinkedHashMap<Date, Double> dataMap = new LinkedHashMap<Date, Double>();
|
||||
d = cal.getTime();
|
||||
dataMap.put(d, 90.0);
|
||||
|
||||
cal.add(Calendar.MINUTE, -5);
|
||||
d = cal.getTime();
|
||||
dataMap.put(d, 30.0);
|
||||
|
||||
cal.add(Calendar.MINUTE, -5);
|
||||
d = cal.getTime();
|
||||
dataMap.put(d, 10.0);
|
||||
|
||||
cal.add(Calendar.MINUTE, -5);
|
||||
d = cal.getTime();
|
||||
dataMap.put(d, 50.0);
|
||||
|
||||
cal.add(Calendar.MINUTE, -5);
|
||||
d = cal.getTime();
|
||||
dataMap.put(d, 25.0);
|
||||
|
||||
cal.add(Calendar.MINUTE, -5);
|
||||
d = cal.getTime();
|
||||
dataMap.put(d, 63.0);
|
||||
|
||||
cal.add(Calendar.MINUTE, -5);
|
||||
d = cal.getTime();
|
||||
dataMap.put(d, 40.0);
|
||||
|
||||
trendGraphData.setGraphData(dataMap);
|
||||
}
|
||||
}
|
|
@ -169,24 +169,20 @@ public class SnowMonitor extends ObsMonitor {
|
|||
* @param shell
|
||||
*/
|
||||
public void launchDialog(String type, Shell shell) {
|
||||
|
||||
if (type.equals("zone")) {
|
||||
if (zoneDialog == null || zoneDialog.getShell() == null
|
||||
|| zoneDialog.isDisposed()) {
|
||||
if (zoneDialog == null) {
|
||||
zoneDialog = new SnowZoneTableDlg(shell, obData);
|
||||
addMonitorListener(zoneDialog);
|
||||
zoneDialog.addMonitorControlListener(this);
|
||||
fireMonitorEvent(zoneDialog.getClass().getName());
|
||||
zoneDialog.open();
|
||||
} else {
|
||||
zoneDialog.bringToTop();
|
||||
}
|
||||
zoneDialog.open();
|
||||
} else if (type.equals("area")) {
|
||||
if (areaDialog == null) {
|
||||
areaDialog = new SnowMonitoringAreaConfigDlg(shell,
|
||||
"SNOW Monitor Area Configuration");
|
||||
areaDialog.open();
|
||||
}
|
||||
areaDialog.open();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -263,7 +259,7 @@ public class SnowMonitor extends ObsMonitor {
|
|||
try {
|
||||
SnowMonitorConfigurationManager areaConfig = getMonitorAreaConfig();
|
||||
for (String zone : areaConfig.getAreaList()) {
|
||||
ArrayList<String> stations = areaConfig.getAreaStations(zone);
|
||||
List<String> stations = areaConfig.getAreaStations(zone);
|
||||
zones.put(zone, stations);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -408,7 +404,7 @@ public class SnowMonitor extends ObsMonitor {
|
|||
zoneDialog = null;
|
||||
}
|
||||
if (areaDialog != null) {
|
||||
areaDialog.shellDisposeDialog();
|
||||
areaDialog.close();
|
||||
areaDialog = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,266 +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.uf.viz.monitor.snow.test;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Dialog;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.monitor.data.CommonTableConfig.CellType;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
|
||||
import com.raytheon.uf.viz.monitor.snow.threshold.SnowThresholdMgr;
|
||||
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr.ThresholdKey;
|
||||
import com.raytheon.uf.viz.monitor.ui.dialogs.LoadSaveDeleteSelectDlg;
|
||||
import com.raytheon.uf.viz.monitor.ui.dialogs.LoadSaveDeleteSelectDlg.DialogType;
|
||||
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
|
||||
|
||||
public class SnowTestDriverDlg extends Dialog {
|
||||
private Display display;
|
||||
|
||||
private Shell shell;
|
||||
|
||||
private Font lblFont;
|
||||
|
||||
public SnowTestDriverDlg(Shell parentShell) {
|
||||
super(parentShell, 0);
|
||||
}
|
||||
|
||||
public Object open() {
|
||||
Shell parent = getParent();
|
||||
display = parent.getDisplay();
|
||||
shell = new Shell(parent, SWT.DIALOG_TRIM);
|
||||
shell.setText("SNOW Driver");
|
||||
|
||||
GridLayout gl = new GridLayout(1, false);
|
||||
gl.horizontalSpacing = 0;
|
||||
shell.setLayout(gl);
|
||||
|
||||
shell.setSize(600, 600);
|
||||
|
||||
lblFont = new Font(shell.getDisplay(), "Monospace", 14, SWT.NORMAL);
|
||||
|
||||
initComponents();
|
||||
|
||||
shell.open();
|
||||
|
||||
while (!shell.isDisposed()) {
|
||||
if (!display.readAndDispatch())
|
||||
display.sleep();
|
||||
}
|
||||
|
||||
lblFont.dispose();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
Label lbl = new Label(shell, SWT.NONE);
|
||||
lbl.setText("SNOW");
|
||||
lbl.setFont(lblFont);
|
||||
|
||||
Button printDisplayThresh = new Button(shell, SWT.PUSH);
|
||||
printDisplayThresh.setText("Print Display Threshold Data");
|
||||
printDisplayThresh.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
printDisplayThresholdData();
|
||||
}
|
||||
});
|
||||
|
||||
Button changeThresh = new Button(shell, SWT.PUSH);
|
||||
changeThresh.setText("Change Threshold Data");
|
||||
changeThresh.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
changeThresholdData();
|
||||
}
|
||||
});
|
||||
|
||||
Button loadThreshDlg = new Button(shell, SWT.PUSH);
|
||||
loadThreshDlg.setText("Load Dialog");
|
||||
loadThreshDlg.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
displayLoadDialog();
|
||||
}
|
||||
});
|
||||
|
||||
Button saveAsThreshDlg = new Button(shell, SWT.PUSH);
|
||||
saveAsThreshDlg.setText("Save As Dialog");
|
||||
saveAsThreshDlg.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
displaySaveDialog();
|
||||
}
|
||||
});
|
||||
|
||||
Button printDefaultFileNameBtn = new Button(shell, SWT.PUSH);
|
||||
printDefaultFileNameBtn.setText("Print Default Threshold File Name");
|
||||
printDefaultFileNameBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
displayDefaultThreshFileName();
|
||||
}
|
||||
});
|
||||
|
||||
Button selectDefaultFileNameBtn = new Button(shell, SWT.PUSH);
|
||||
selectDefaultFileNameBtn.setText("Select Default Threshold File Name");
|
||||
selectDefaultFileNameBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
selectDefaultThreshFileName();
|
||||
}
|
||||
});
|
||||
|
||||
Button loadDefaultFileNameBtn = new Button(shell, SWT.PUSH);
|
||||
loadDefaultFileNameBtn.setText("Load Default Threshold");
|
||||
loadDefaultFileNameBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
loadDefaultThresholds();
|
||||
}
|
||||
});
|
||||
|
||||
Button cellTypeBtn = new Button(shell, SWT.PUSH);
|
||||
cellTypeBtn.setText("Print CellType");
|
||||
cellTypeBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
printCellType();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void addSeparator(Composite parentComp) {
|
||||
GridLayout gl = (GridLayout) parentComp.getLayout();
|
||||
|
||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
gd.horizontalSpan = gl.numColumns;
|
||||
Label sepLbl = new Label(parentComp, SWT.SEPARATOR | SWT.HORIZONTAL);
|
||||
sepLbl.setLayoutData(gd);
|
||||
}
|
||||
|
||||
private void printDisplayThresholdData() {
|
||||
SnowThresholdMgr stm = SnowThresholdMgr.getInstance();
|
||||
stm.printDisplayThresholds();
|
||||
}
|
||||
|
||||
private void changeThresholdData() {
|
||||
System.out.println("NOT WORKING...");
|
||||
SnowThresholdMgr stm = SnowThresholdMgr.getInstance();
|
||||
stm.setThresholdValue(DataUsageKey.DISPLAY, ThresholdKey.RED, "NE093",
|
||||
MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_TEMP
|
||||
.getXmlKey(), 111);
|
||||
}
|
||||
|
||||
private void displayLoadDialog() {
|
||||
SnowThresholdMgr stm = SnowThresholdMgr.getInstance();
|
||||
|
||||
LoadSaveDeleteSelectDlg lsDlg = new LoadSaveDeleteSelectDlg(shell,
|
||||
DialogType.OPEN, stm.getDisplayThresholdPath(), stm
|
||||
.getDefaultFileName(DataUsageKey.DISPLAY));
|
||||
LocalizationFile fileName = (LocalizationFile) lsDlg.open();
|
||||
|
||||
if (fileName == null) {
|
||||
System.out.println("FileName is null...");
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("Selected file absolute path= "
|
||||
+ fileName.getFile().getAbsolutePath());
|
||||
System.out.println("Selected file name = "
|
||||
+ fileName.getFile().getName());
|
||||
|
||||
stm.loadDisplayThreashold(fileName.getFile().getName());
|
||||
}
|
||||
|
||||
private void displaySaveDialog() {
|
||||
SnowThresholdMgr stm = SnowThresholdMgr.getInstance();
|
||||
|
||||
LoadSaveDeleteSelectDlg lsDlg = new LoadSaveDeleteSelectDlg(shell,
|
||||
DialogType.SAVE_AS, stm.getDisplayThresholdPath(), stm
|
||||
.getDefaultFileName(DataUsageKey.DISPLAY));
|
||||
LocalizationFile fileName = (LocalizationFile) lsDlg.open();
|
||||
|
||||
if (fileName == null) {
|
||||
System.out.println("FileName is null...");
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("Selected file absolute path= "
|
||||
+ fileName.getFile().getAbsolutePath());
|
||||
System.out.println("Selected file name = "
|
||||
+ fileName.getFile().getName());
|
||||
|
||||
stm.saveAsDisplayThresholds(fileName.getFile().getName());
|
||||
}
|
||||
|
||||
private void displayDefaultThreshFileName() {
|
||||
SnowThresholdMgr stm = SnowThresholdMgr.getInstance();
|
||||
|
||||
System.out.println(">" + stm.getDefDisplayThreshFileName() + "<");
|
||||
}
|
||||
|
||||
private void selectDefaultThreshFileName() {
|
||||
SnowThresholdMgr stm = SnowThresholdMgr.getInstance();
|
||||
|
||||
LoadSaveDeleteSelectDlg lsDlg = new LoadSaveDeleteSelectDlg(shell,
|
||||
DialogType.SELECT_DEFAULT, stm.getDisplayThresholdPath(), stm
|
||||
.getDefaultFileName(DataUsageKey.DISPLAY));
|
||||
LocalizationFile fileName = (LocalizationFile) lsDlg.open();
|
||||
|
||||
if (fileName == null) {
|
||||
System.out.println("FileName is null...");
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println("Selected file absolute path= "
|
||||
+ fileName.getFile().getAbsolutePath());
|
||||
System.out.println("Selected file name = "
|
||||
+ fileName.getFile().getName());
|
||||
|
||||
stm.setDefaultDisplayFileName(fileName.getFile().getName());
|
||||
}
|
||||
|
||||
private void loadDefaultThresholds() {
|
||||
SnowThresholdMgr stm = SnowThresholdMgr.getInstance();
|
||||
|
||||
stm.loadDefaultDisplayThreshold();
|
||||
}
|
||||
|
||||
private void printCellType() {
|
||||
CellType ct;
|
||||
String key;
|
||||
double value = Double.NaN;
|
||||
|
||||
SnowThresholdMgr stm = SnowThresholdMgr.getInstance();
|
||||
|
||||
}
|
||||
}
|
|
@ -25,7 +25,8 @@ import org.eclipse.core.commands.ExecutionException;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.uf.viz.monitor.snow.SnowMonitor;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.viz.monitor.snow.ui.dialogs.SnowMonitoringAreaConfigDlg;
|
||||
|
||||
/**
|
||||
|
@ -38,6 +39,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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -47,19 +49,22 @@ import com.raytheon.uf.viz.monitor.snow.ui.dialogs.SnowMonitoringAreaConfigDlg;
|
|||
|
||||
public class SnowAreaConfigAction extends AbstractHandler {
|
||||
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(SnowAreaConfigAction.class);
|
||||
|
||||
private SnowMonitoringAreaConfigDlg configDlg;
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
|
||||
System.out.println("Activating/Action the Snow Area Config...");
|
||||
|
||||
//SnowMonitor monitor = SnowMonitor.getInstance();
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
//monitor.launchDialog("area", shell);
|
||||
|
||||
SnowMonitoringAreaConfigDlg configDlg= new SnowMonitoringAreaConfigDlg(shell, "SNOW Monitor Area Configuration");
|
||||
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
if (configDlg == null || configDlg.getShell() == null
|
||||
|| configDlg.isDisposed()) {
|
||||
configDlg = new SnowMonitoringAreaConfigDlg(shell,
|
||||
"SNOW Monitor Area Configuration");
|
||||
}
|
||||
configDlg.open();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -31,14 +31,15 @@ import com.raytheon.uf.viz.monitor.snow.threshold.SnowThresholdMgr;
|
|||
import com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* SNOW Monitor area configuration dialog.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 5, 2010 mpduff Initial creation
|
||||
* Jan 5, 2010 mpduff Initial creation
|
||||
* Nov 27, 2012 1351 skorolev Changes for non-blocking dialog.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -53,35 +54,38 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
readConfigData();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#
|
||||
* handleOkBtnSelection()
|
||||
*/
|
||||
@Override
|
||||
protected void handleOkBtnSelection() {
|
||||
SnowMonitorConfigurationManager configManager = SnowMonitorConfigurationManager
|
||||
.getInstance();
|
||||
// Check for changes in the data
|
||||
int choice = showMessage(shell, SWT.OK | SWT.CANCEL,
|
||||
"SNOW Monitor Confirm Changes",
|
||||
"Want to update the SNOW setup files?");
|
||||
if (!configManager.getAddedZones().isEmpty()
|
||||
|| !configManager.getAddedZones().isEmpty()) {
|
||||
int choice = showMessage(shell, SWT.OK | SWT.CANCEL,
|
||||
"SNOW Monitor Confirm Changes",
|
||||
"Want to update the SNOW setup files?");
|
||||
if (choice == SWT.OK) {
|
||||
// Save the config xml file
|
||||
configManager.setTimeWindow(timeScale.getSelection());
|
||||
configManager.saveConfigData();
|
||||
/**
|
||||
* DR#11279: re-initialize threshold manager and the monitor
|
||||
* using new monitor area configuration
|
||||
*/
|
||||
SnowThresholdMgr.reInitialize();
|
||||
SnowMonitor.reInitialize();
|
||||
showMessage(shell, SWT.ICON_INFORMATION | SWT.OK,
|
||||
"SNOW Config Change",
|
||||
"You're updating the SNOW monitoring settings."
|
||||
+ "\n\nIf SNOW is running anywhere within "
|
||||
+ "the office, please clear it.\n");
|
||||
|
||||
if (choice == SWT.OK) {
|
||||
// Save the config xml file
|
||||
configManager.setTimeWindow(timeScale.getSelection());
|
||||
configManager.saveConfigData();
|
||||
|
||||
/**
|
||||
* DR#11279: re-initialize threshold manager and the monitor using
|
||||
* new monitor area configuration
|
||||
*/
|
||||
SnowThresholdMgr.reInitialize();
|
||||
SnowMonitor.reInitialize();
|
||||
|
||||
showMessage(shell, SWT.ICON_INFORMATION | SWT.OK,
|
||||
"SNOW Config Change",
|
||||
"You're updating the SNOW monitoring settings."
|
||||
+ "\n\nIf SNOW is running anywhere within "
|
||||
+ "the office, please clear it.\n");
|
||||
|
||||
if (configManager.getAddedZones().size() > 0
|
||||
|| addedZones.size() > 0) {
|
||||
String message2 = "New zones have been added, and their monitoring thresholds "
|
||||
+ "have been set to default values; would you like to modify "
|
||||
+ "their threshold values now?";
|
||||
|
@ -94,15 +98,36 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
snowMonitorDlg.open();
|
||||
}
|
||||
}
|
||||
shell.dispose();
|
||||
} else {
|
||||
String message3 = "No changes made.\nDo you want to exit?";
|
||||
int yesno = showMessage(shell,
|
||||
SWT.ICON_QUESTION | SWT.YES | SWT.NO, "Exit", message3);
|
||||
if (yesno == SWT.NO) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
setReturnValue(true);
|
||||
close();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#
|
||||
* setAlgorithmText()
|
||||
*/
|
||||
@Override
|
||||
protected void setAlgorithmText() {
|
||||
// Not used for SNOW
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#readConfigData
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
protected void readConfigData() {
|
||||
SnowMonitorConfigurationManager configManager = SnowMonitorConfigurationManager
|
||||
|
|
|
@ -1,40 +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.uf.viz.monitor.snow.ui.dialogs;
|
||||
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
||||
import com.raytheon.uf.common.monitor.data.CommonTableConfig.ObsHistType;
|
||||
import com.raytheon.uf.viz.monitor.data.TableData;
|
||||
import com.raytheon.uf.viz.monitor.ui.dialogs.ObsHistTableDlg;
|
||||
|
||||
public class SnowObsHistTableDlg extends ObsHistTableDlg {
|
||||
public SnowObsHistTableDlg(Shell parent, TableData tableData,
|
||||
String stationID, double lat, double lon, AppName appName,
|
||||
ObsHistType obsType) {
|
||||
super(parent, tableData, stationID, lat, lon, appName, obsType);
|
||||
|
||||
}
|
||||
|
||||
protected void configAction() {
|
||||
System.out.println("Snow Config Action");
|
||||
}
|
||||
}
|
|
@ -22,16 +22,17 @@ package com.raytheon.uf.viz.monitor.thresholds;
|
|||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext;
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.monitor.config.MonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst;
|
||||
import com.raytheon.uf.common.monitor.data.CommonTableConfig.CellType;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
|
||||
import com.raytheon.uf.viz.monitor.filename.DefaultFilenameMgr;
|
||||
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
|
||||
|
@ -58,6 +59,7 @@ import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
|
|||
*/
|
||||
public abstract class AbstractThresholdMgr {
|
||||
protected MonitorConfigurationManager areaConfigMgr = null;
|
||||
|
||||
/**
|
||||
* Default file name for the FOG display thresholds.
|
||||
*/
|
||||
|
@ -149,13 +151,13 @@ public abstract class AbstractThresholdMgr {
|
|||
loadDefaultDisplayThreshold();
|
||||
} else {
|
||||
currFullDisplayXmlFileName = getDisplayThresholdPath()
|
||||
+ defaultFileNameMgr.getDefaultThresholdFilename();
|
||||
+ defaultFileNameMgr.getDefaultThresholdFilename();
|
||||
displayThreshMgr = new ThresholdMgr(currFullDisplayXmlFileName);
|
||||
displayThreshMgr.readThresholdXml();
|
||||
}
|
||||
} else {
|
||||
currFullDisplayXmlFileName = getDisplayThresholdPath()
|
||||
+ defDisplayThreshName;
|
||||
+ defDisplayThreshName;
|
||||
displayThreshMgr = new ThresholdMgr(currFullDisplayXmlFileName);
|
||||
loadDefaultDisplayThreshold();
|
||||
}
|
||||
|
@ -164,7 +166,7 @@ public abstract class AbstractThresholdMgr {
|
|||
* Setup the Fog monitor threshold manager
|
||||
*/
|
||||
currFullMonitorXmlFileName = getMonitorThresholdPath()
|
||||
+ defMonitorThreshName;
|
||||
+ defMonitorThreshName;
|
||||
|
||||
monitorThreshMgr = new ThresholdMgr(currFullMonitorXmlFileName);
|
||||
if (validateFileName(currFullMonitorXmlFileName) == true) {
|
||||
|
@ -281,18 +283,21 @@ public abstract class AbstractThresholdMgr {
|
|||
|
||||
return CellType.NotMonitored;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determines Table Cell Type for a directional variable such as
|
||||
* Wind Direction or Swell Direction
|
||||
* Determines Table Cell Type for a directional variable such as Wind
|
||||
* Direction or Swell Direction
|
||||
*
|
||||
* @param dataUsage
|
||||
* @param areaID
|
||||
* @param keyFrom
|
||||
* @param keyTo
|
||||
* @param value
|
||||
* @return Cell Type
|
||||
* @return Cell Type
|
||||
*/
|
||||
public CellType getDirectionalThresholdValueCellType(DataUsageKey dataUsage, String areaID, String keyFrom, String keyTo, double value) {
|
||||
public CellType getDirectionalThresholdValueCellType(
|
||||
DataUsageKey dataUsage, String areaID, String keyFrom,
|
||||
String keyTo, double value) {
|
||||
if (hasArea(areaID, dataUsage) == false) {
|
||||
return CellType.NotMonitored;
|
||||
}
|
||||
|
@ -315,44 +320,47 @@ public abstract class AbstractThresholdMgr {
|
|||
redTo = displayThreshMgr.getRedValue(areaID, keyTo);
|
||||
yellowFrom = displayThreshMgr.getYellowValue(areaID, keyFrom);
|
||||
yellowTo = displayThreshMgr.getYellowValue(areaID, keyTo);
|
||||
return calcDirectionalCellType(redFrom, redTo, yellowFrom, yellowTo, value);
|
||||
return calcDirectionalCellType(redFrom, redTo, yellowFrom,
|
||||
yellowTo, value);
|
||||
} else if (dataUsage == DataUsageKey.MONITOR) {
|
||||
redFrom = monitorThreshMgr.getRedValue(areaID, keyFrom);
|
||||
redTo = monitorThreshMgr.getRedValue(areaID, keyTo);
|
||||
yellowFrom = monitorThreshMgr.getYellowValue(areaID, keyFrom);
|
||||
yellowTo = monitorThreshMgr.getYellowValue(areaID, keyTo);
|
||||
return calcDirectionalCellType(redFrom, redTo, yellowFrom, yellowTo, value);
|
||||
return calcDirectionalCellType(redFrom, redTo, yellowFrom,
|
||||
yellowTo, value);
|
||||
}
|
||||
|
||||
return CellType.NotMonitored;
|
||||
}
|
||||
|
||||
private CellType calcDirectionalCellType(double redFrom, double redTo, double yellowFrom, double yellowTo, double value) {
|
||||
|
||||
if ( redFrom < redTo ) {
|
||||
if ( value > redFrom && value < redTo ) {
|
||||
return CellType.R;
|
||||
}
|
||||
}
|
||||
|
||||
if ( redFrom > redTo ) {
|
||||
if ( value > redFrom || value < redTo ) {
|
||||
return CellType.R;
|
||||
}
|
||||
}
|
||||
|
||||
if ( yellowFrom < yellowTo ) {
|
||||
if ( value > yellowFrom && value < yellowTo ) {
|
||||
return CellType.Y;
|
||||
}
|
||||
}
|
||||
|
||||
if ( yellowFrom > yellowTo ) {
|
||||
if ( value > yellowFrom || value < yellowTo ) {
|
||||
return CellType.Y;
|
||||
}
|
||||
}
|
||||
|
||||
private CellType calcDirectionalCellType(double redFrom, double redTo,
|
||||
double yellowFrom, double yellowTo, double value) {
|
||||
|
||||
if (redFrom < redTo) {
|
||||
if (value > redFrom && value < redTo) {
|
||||
return CellType.R;
|
||||
}
|
||||
}
|
||||
|
||||
if (redFrom > redTo) {
|
||||
if (value > redFrom || value < redTo) {
|
||||
return CellType.R;
|
||||
}
|
||||
}
|
||||
|
||||
if (yellowFrom < yellowTo) {
|
||||
if (value > yellowFrom && value < yellowTo) {
|
||||
return CellType.Y;
|
||||
}
|
||||
}
|
||||
|
||||
if (yellowFrom > yellowTo) {
|
||||
if (value > yellowFrom || value < yellowTo) {
|
||||
return CellType.Y;
|
||||
}
|
||||
}
|
||||
|
||||
return CellType.G;
|
||||
}
|
||||
|
||||
|
@ -360,11 +368,12 @@ public abstract class AbstractThresholdMgr {
|
|||
double value) {
|
||||
Boolean redIsHigher = MonitorConfigConstants.rValueIsHigher(key,
|
||||
appName);
|
||||
// SK. Take integer part of data for threshold comparison to avoid color confusion.
|
||||
// To be consistent with table display for which Math.round() is used,
|
||||
// SK. Take integer part of data for threshold comparison to avoid color
|
||||
// confusion.
|
||||
// To be consistent with table display for which Math.round() is used,
|
||||
// [zhao 10/06/2011]
|
||||
value = Math.round( new Float(value) );
|
||||
|
||||
value = Math.round(new Float(value));
|
||||
|
||||
if (redIsHigher == null) {
|
||||
if (red <= yellow) {
|
||||
if (value <= red) {
|
||||
|
@ -403,7 +412,7 @@ public abstract class AbstractThresholdMgr {
|
|||
|
||||
return CellType.NotMonitored;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the default display threshold file name.
|
||||
*
|
||||
|
@ -414,7 +423,7 @@ public abstract class AbstractThresholdMgr {
|
|||
if (fileName == null) {
|
||||
defaultFileNameMgr.setDefaultThresholdFilename("");
|
||||
currFullDisplayXmlFileName = getDisplayThresholdPath()
|
||||
+ defDisplayThreshName;
|
||||
+ defDisplayThreshName;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -455,9 +464,9 @@ public abstract class AbstractThresholdMgr {
|
|||
|
||||
if (filename == null || filename.trim().length() == 0) {
|
||||
currFullDisplayXmlFileName = getDisplayThresholdPath()
|
||||
+ defDisplayThreshName;
|
||||
+ defDisplayThreshName;
|
||||
|
||||
ArrayList<String> areaIDs = null;
|
||||
List<String> areaIDs = null;
|
||||
|
||||
try {
|
||||
areaIDs = areaConfigMgr.getAreaList();
|
||||
|
@ -484,9 +493,9 @@ public abstract class AbstractThresholdMgr {
|
|||
|
||||
public void loadDefaultMonitorThreshold() {
|
||||
currFullMonitorXmlFileName = getMonitorThresholdPath()
|
||||
+ defMonitorThreshName;
|
||||
+ defMonitorThreshName;
|
||||
|
||||
ArrayList<String> areaIDs = null;
|
||||
List<String> areaIDs = null;
|
||||
|
||||
try {
|
||||
areaIDs = areaConfigMgr.getAreaList();
|
||||
|
|
|
@ -21,6 +21,7 @@ package com.raytheon.uf.viz.monitor.thresholds;
|
|||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.JAXB;
|
||||
|
||||
|
@ -30,6 +31,9 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel
|
|||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
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.uf.viz.monitor.xml.AreaThresholdXML;
|
||||
import com.raytheon.uf.viz.monitor.xml.AreaXML;
|
||||
import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
|
||||
|
@ -45,6 +49,7 @@ import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 15, 2009 #3963 lvenable Initial creation
|
||||
* Dec 4, 2012 #1351 skorolev Cleaned code
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -52,6 +57,10 @@ import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class ThresholdMgr {
|
||||
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(ThresholdMgr.class);
|
||||
|
||||
/**
|
||||
* Threshold XML data.
|
||||
*/
|
||||
|
@ -80,12 +89,9 @@ public class ThresholdMgr {
|
|||
cfgXML = null;
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
File path = pm.getStaticFile(currFullPathAndFileName);
|
||||
|
||||
System.out.println("**** path = " + path);
|
||||
|
||||
cfgXML = JAXB.unmarshal(path, ThresholdsXML.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.ERROR, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,22 +104,14 @@ public class ThresholdMgr {
|
|||
LocalizationType.CAVE_STATIC, LocalizationLevel.SITE);
|
||||
LocalizationFile locFile = pm.getLocalizationFile(context,
|
||||
currFullPathAndFileName);
|
||||
|
||||
if (locFile.getFile().getParentFile().exists() == false) {
|
||||
System.out.println("Creating new directory");
|
||||
|
||||
if (locFile.getFile().getParentFile().mkdirs() == false) {
|
||||
System.out.println("Could not create new directory...");
|
||||
}
|
||||
locFile.getFile().getParentFile().mkdirs();
|
||||
}
|
||||
|
||||
try {
|
||||
System.out.println("Saving -- "
|
||||
+ locFile.getFile().getAbsolutePath());
|
||||
JAXB.marshal(cfgXML, locFile.getFile());
|
||||
locFile.save();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.ERROR, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -139,22 +137,17 @@ public class ThresholdMgr {
|
|||
* @return True if the configuration XML was successfully created.
|
||||
*/
|
||||
public boolean createConfigFromDefaults(String fullDefaultPathName,
|
||||
ArrayList<String> areaIDs, ArrayList<String> keys) {
|
||||
List<String> areaIDs, ArrayList<String> keys) {
|
||||
try {
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
File path = pm.getStaticFile(fullDefaultPathName);
|
||||
|
||||
System.out.println("*** create from defaults path = " + path);
|
||||
|
||||
ThresholdsXML cfgXmlDefaults = JAXB.unmarshal(path,
|
||||
ThresholdsXML.class);
|
||||
|
||||
createXmlFromDefaults(cfgXmlDefaults, areaIDs, keys);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.ERROR, e.getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -170,25 +163,27 @@ public class ThresholdMgr {
|
|||
* values.
|
||||
*/
|
||||
private void createXmlFromDefaults(ThresholdsXML cfgXmlDefaults,
|
||||
ArrayList<String> areaIDs, ArrayList<String> keys) {
|
||||
List<String> areaIDs, ArrayList<String> keys) {
|
||||
cfgXML = new ThresholdsXML();
|
||||
|
||||
createAreas(cfgXmlDefaults, areaIDs, keys);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates Areas.
|
||||
*
|
||||
* @param defaultThreshXML
|
||||
* @param areaIDs
|
||||
* @param keys
|
||||
*/
|
||||
private void createAreas(ThresholdsXML defaultThreshXML,
|
||||
ArrayList<String> areaIDs, ArrayList<String> keys) {
|
||||
List<String> areaIDs, ArrayList<String> keys) {
|
||||
ArrayList<AreaXML> areas = new ArrayList<AreaXML>();
|
||||
|
||||
for (String areaID : areaIDs) {
|
||||
AreaXML area = new AreaXML();
|
||||
area.setAreaId(areaID);
|
||||
|
||||
createAreaThreshold(area, defaultThreshXML, keys);
|
||||
|
||||
areas.add(area);
|
||||
}
|
||||
|
||||
cfgXML.setAreas(areas);
|
||||
}
|
||||
|
||||
|
@ -206,7 +201,6 @@ public class ThresholdMgr {
|
|||
private void createAreaThreshold(AreaXML area,
|
||||
ThresholdsXML defaultThreshXML, ArrayList<String> keys) {
|
||||
ArrayList<AreaThresholdXML> areaThreshArray = new ArrayList<AreaThresholdXML>();
|
||||
|
||||
for (String key : keys) {
|
||||
AreaThresholdXML areaThresh = new AreaThresholdXML();
|
||||
areaThresh.setKey(key);
|
||||
|
@ -214,10 +208,8 @@ public class ThresholdMgr {
|
|||
.getRedValue(key));
|
||||
areaThresh.setYellow(defaultThreshXML.getAreas().get(0)
|
||||
.getYellowValue(key));
|
||||
|
||||
areaThreshArray.add(areaThresh);
|
||||
}
|
||||
|
||||
area.setAreaThresholds(areaThreshArray);
|
||||
}
|
||||
|
||||
|
@ -294,41 +286,41 @@ public class ThresholdMgr {
|
|||
return this.cfgXML;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the threshold XML.
|
||||
*
|
||||
* @param newCfgXML
|
||||
*/
|
||||
public void setThresholdXML(ThresholdsXML newCfgXML) {
|
||||
this.cfgXML = newCfgXML;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Thresholds Xml Copy.
|
||||
*
|
||||
* @return newThreshXML
|
||||
*/
|
||||
public ThresholdsXML getThresholdsXmlCopy() {
|
||||
ThresholdsXML newThreshXML = new ThresholdsXML();
|
||||
|
||||
ArrayList<AreaXML> currAreas = cfgXML.getAreas();
|
||||
ArrayList<AreaXML> newAreas = new ArrayList<AreaXML>();
|
||||
|
||||
for (AreaXML currAreaXML : currAreas) {
|
||||
AreaXML newAreaXML = new AreaXML();
|
||||
newAreaXML.setAreaId(currAreaXML.getAreaId());
|
||||
|
||||
ArrayList<AreaThresholdXML> currAreaThreshholds = currAreaXML
|
||||
.getAreaThresholds();
|
||||
ArrayList<AreaThresholdXML> newAreaThreshholds = new ArrayList<AreaThresholdXML>();
|
||||
|
||||
for (AreaThresholdXML currAreaThreshXML : currAreaThreshholds) {
|
||||
AreaThresholdXML newAreaThreshXML = new AreaThresholdXML();
|
||||
newAreaThreshXML.setKey(currAreaThreshXML.getKey());
|
||||
newAreaThreshXML.setRed(currAreaThreshXML.getRed());
|
||||
newAreaThreshXML.setYellow(currAreaThreshXML.getYellow());
|
||||
|
||||
newAreaThreshholds.add(newAreaThreshXML);
|
||||
}
|
||||
|
||||
newAreaXML.setAreaThresholds(newAreaThreshholds);
|
||||
|
||||
newAreas.add(newAreaXML);
|
||||
|
||||
}
|
||||
|
||||
newThreshXML.setAreas(newAreas);
|
||||
|
||||
return newThreshXML;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,9 +26,8 @@ import org.eclipse.swt.layout.GridData;
|
|||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Dialog;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Layout;
|
||||
import org.eclipse.swt.widgets.MessageBox;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
@ -36,360 +35,355 @@ import org.eclipse.swt.widgets.Text;
|
|||
import com.raytheon.uf.common.geospatial.ISpatialQuery;
|
||||
import com.raytheon.uf.common.geospatial.SpatialQueryFactory;
|
||||
import com.raytheon.uf.common.monitor.config.FogMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.MonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.SSMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.SnowMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
||||
import com.raytheon.uf.common.monitor.xml.StationIdXML;
|
||||
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.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
/**
|
||||
*
|
||||
* Add New Station dialog.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 2, 2009 lvenable Initial creation
|
||||
*
|
||||
* Nov 20, 2012 1297 skorolev Changes for non-blocking dialog.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author lvenable
|
||||
* @version 1.0
|
||||
*/
|
||||
public class AddNewStationDlg extends Dialog
|
||||
{
|
||||
/**
|
||||
* Dialog shell.
|
||||
*/
|
||||
private Shell shell;
|
||||
|
||||
/**
|
||||
* The display control.
|
||||
*/
|
||||
private Display display;
|
||||
|
||||
/**
|
||||
* Return value when the shell is disposed.
|
||||
*/
|
||||
private Boolean returnValue = false;
|
||||
|
||||
public class AddNewStationDlg extends CaveSWTDialog {
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(AddNewStationDlg.class);
|
||||
|
||||
/**
|
||||
* Application name.
|
||||
*/
|
||||
private CommonConfig.AppName appName;
|
||||
|
||||
private AppName appName;
|
||||
|
||||
/**
|
||||
* METAR radio button.
|
||||
*/
|
||||
private Button metarRdo;
|
||||
|
||||
|
||||
/**
|
||||
* Maritime button.
|
||||
*/
|
||||
private Button maritimeRdo;
|
||||
|
||||
|
||||
/**
|
||||
* Mesonet button;
|
||||
*/
|
||||
private Button mesonetRdo;
|
||||
|
||||
|
||||
/**
|
||||
* Station label.
|
||||
*/
|
||||
private Label stationLbl;
|
||||
|
||||
|
||||
/**
|
||||
* Station text control.
|
||||
*/
|
||||
private Text stationTF;
|
||||
|
||||
|
||||
/**
|
||||
* Zone
|
||||
*/
|
||||
private String area;
|
||||
|
||||
private INewZoneStnAction macDlg;
|
||||
|
||||
|
||||
/**
|
||||
* Call back interface
|
||||
*/
|
||||
private INewZoneStnAction macDlg;
|
||||
|
||||
/**
|
||||
* Area configuration manager.
|
||||
*/
|
||||
private MonitorConfigurationManager configManager;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param parent Parent shell.
|
||||
* @param appName Application name.
|
||||
*
|
||||
* @param parent
|
||||
* Parent shell.
|
||||
* @param appName
|
||||
* @param area
|
||||
* @param macDlg
|
||||
*/
|
||||
public AddNewStationDlg(Shell parent, CommonConfig.AppName appName, String area, INewZoneStnAction macDlg)
|
||||
{
|
||||
super(parent, 0);
|
||||
|
||||
this.appName = appName;
|
||||
public AddNewStationDlg(Shell parent, CommonConfig.AppName appName,
|
||||
String area, INewZoneStnAction macDlg) {
|
||||
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
|
||||
setText(appName.toString() + ": Add a New Stn to Monitor Area");
|
||||
this.appName = appName;
|
||||
this.area = area;
|
||||
this.macDlg = macDlg;
|
||||
configManager = getConfigManager(appName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open method used to display the dialog.
|
||||
* @return True/False.
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
|
||||
*/
|
||||
public Object open()
|
||||
{
|
||||
Shell parent = getParent();
|
||||
display = parent.getDisplay();
|
||||
shell = new Shell(parent, SWT.DIALOG_TRIM);
|
||||
shell.setText(appName.toString() + ": Add a New Station");
|
||||
|
||||
// Create the main layout for the shell.
|
||||
@Override
|
||||
protected Layout constructShellLayout() {
|
||||
GridLayout mainLayout = new GridLayout(1, false);
|
||||
mainLayout.marginHeight = 2;
|
||||
mainLayout.marginWidth = 2;
|
||||
mainLayout.verticalSpacing = 2;
|
||||
shell.setLayout(mainLayout);
|
||||
|
||||
// Initialize all of the controls and layouts
|
||||
initializeComponents();
|
||||
|
||||
shell.pack();
|
||||
|
||||
shell.open();
|
||||
while (!shell.isDisposed())
|
||||
{
|
||||
if (!display.readAndDispatch())
|
||||
{
|
||||
display.sleep();
|
||||
}
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
return mainLayout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the components on the display.
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
||||
* .eclipse.swt.widgets.Shell)
|
||||
*/
|
||||
private void initializeComponents()
|
||||
{
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
setReturnValue(false);
|
||||
createTopLabelRadioControls();
|
||||
|
||||
createTextControls();
|
||||
|
||||
createBottomButtons();
|
||||
|
||||
setStationLabel();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create the top radio controls.
|
||||
* Creates the top radio controls.
|
||||
*/
|
||||
private void createTopLabelRadioControls()
|
||||
{
|
||||
private void createTopLabelRadioControls() {
|
||||
Composite topComp = new Composite(shell, SWT.NONE);
|
||||
topComp.setLayout(new GridLayout(2, true));
|
||||
topComp.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
|
||||
|
||||
/*
|
||||
* Add the label.
|
||||
*/
|
||||
Label topLbl = new Label(topComp, SWT.RIGHT);
|
||||
topLbl.setText("Please type in a new: ");
|
||||
topLbl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
|
||||
|
||||
/*
|
||||
* Add the radio controls.
|
||||
*/
|
||||
Composite radioComp = new Composite(topComp, SWT.NONE);
|
||||
radioComp.setLayout(new GridLayout(1, false));
|
||||
|
||||
metarRdo = new Button(radioComp, SWT.RADIO);
|
||||
metarRdo.setText("Metar");
|
||||
metarRdo.setSelection(true);
|
||||
metarRdo.addSelectionListener(new SelectionAdapter()
|
||||
{
|
||||
metarRdo.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event)
|
||||
{
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
setStationLabel();
|
||||
}
|
||||
});
|
||||
// TODO: Disable if area has no marine zones.
|
||||
maritimeRdo = new Button(radioComp, SWT.RADIO);
|
||||
maritimeRdo.setText("Maritime");
|
||||
maritimeRdo.setEnabled(appName != CommonConfig.AppName.SNOW);
|
||||
maritimeRdo.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
setStationLabel();
|
||||
}
|
||||
});
|
||||
|
||||
if (appName != CommonConfig.AppName.SNOW)
|
||||
{
|
||||
maritimeRdo = new Button(radioComp, SWT.RADIO);
|
||||
maritimeRdo.setText("Maritime");
|
||||
maritimeRdo.addSelectionListener(new SelectionAdapter()
|
||||
{
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event)
|
||||
{
|
||||
setStationLabel();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
mesonetRdo = new Button(radioComp, SWT.RADIO);
|
||||
mesonetRdo.setText("Mesonet");
|
||||
mesonetRdo.addSelectionListener(new SelectionAdapter()
|
||||
{
|
||||
mesonetRdo.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event)
|
||||
{
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
setStationLabel();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create the text controls.
|
||||
*/
|
||||
private void createTextControls()
|
||||
{
|
||||
private void createTextControls() {
|
||||
Composite textComp = new Composite(shell, SWT.NONE);
|
||||
textComp.setLayout(new GridLayout(1, true));
|
||||
textComp.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
|
||||
|
||||
stationLbl = new Label(textComp, SWT.NONE);
|
||||
stationLbl.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
|
||||
|
||||
stationLbl.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true,
|
||||
false));
|
||||
stationTF = new Text(textComp, SWT.BORDER);
|
||||
stationTF.setLayoutData(new GridData(250, SWT.DEFAULT));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create the bottom buttons.
|
||||
* Creates the bottom buttons.
|
||||
*/
|
||||
private void createBottomButtons()
|
||||
{
|
||||
private void createBottomButtons() {
|
||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
Composite mainButtonComp = new Composite(shell, SWT.NONE);
|
||||
mainButtonComp.setLayout(new GridLayout(1, false));
|
||||
mainButtonComp.setLayoutData(gd);
|
||||
|
||||
// Add a separator label.
|
||||
Label sepLbl = new Label(mainButtonComp, SWT.SEPARATOR | SWT.HORIZONTAL);
|
||||
sepLbl.setLayoutData(gd);
|
||||
|
||||
|
||||
gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, false);
|
||||
Composite buttonComp = new Composite(shell, SWT.NONE);
|
||||
buttonComp.setLayout(new GridLayout(2, false));
|
||||
buttonComp.setLayoutData(gd);
|
||||
|
||||
|
||||
gd = new GridData(100, SWT.DEFAULT);
|
||||
Button addBtn = new Button(buttonComp, SWT.PUSH);
|
||||
addBtn.setText("Add");
|
||||
addBtn.setLayoutData(gd);
|
||||
addBtn.addSelectionListener(new SelectionAdapter()
|
||||
{
|
||||
addBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event)
|
||||
{
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
String stationType = StationIdXML.METAR;
|
||||
FogMonitorConfigurationManager configManager = FogMonitorConfigurationManager.getInstance();
|
||||
if (metarRdo.getSelection()) {
|
||||
stationType = StationIdXML.METAR;
|
||||
} else if (mesonetRdo.getSelection()) {
|
||||
String s = stationTF.getText();
|
||||
s.substring(s.indexOf("#"), s.length() - 1);
|
||||
s = s.substring(s.indexOf("#") + 1, s.length());
|
||||
stationType = s.toUpperCase();
|
||||
// TODO need to verifyu the stationType exists.
|
||||
// TODO need to verify the stationType exists.
|
||||
// was in SSmesonetStationInfo.txt in AWIPS1.
|
||||
} else {
|
||||
stationType = StationIdXML.MARITIME;
|
||||
}
|
||||
|
||||
configManager.addStation(area, stationTF.getText(), stationType, false);
|
||||
|
||||
/**
|
||||
* for DR #7854: add new station to Monitor Area Config GUI
|
||||
*/
|
||||
handleAddNewStation();
|
||||
|
||||
//shell.dispose();
|
||||
if (!stationTF.getText().isEmpty()) {
|
||||
configManager.addStation(area, stationTF.getText(),
|
||||
stationType, false);
|
||||
/**
|
||||
* for DR #7854: add new station to Monitor Area Config GUI
|
||||
*/
|
||||
handleAddNewStation();
|
||||
} else {
|
||||
displayInputErrorMsg("Invalid Station ID entered: Please enter a valid Station ID for the selected Station Type");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
gd = new GridData(100, SWT.DEFAULT);
|
||||
Button closeBtn = new Button(buttonComp, SWT.PUSH);
|
||||
closeBtn.setText("Close");
|
||||
closeBtn.setLayoutData(gd);
|
||||
closeBtn.addSelectionListener(new SelectionAdapter()
|
||||
{
|
||||
closeBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event)
|
||||
{
|
||||
shell.dispose();
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
setReturnValue(true);
|
||||
close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the station label.
|
||||
*/
|
||||
private void setStationLabel()
|
||||
{
|
||||
if (mesonetRdo.getSelection() == true)
|
||||
{
|
||||
private void setStationLabel() {
|
||||
if (mesonetRdo.getSelection() == true) {
|
||||
stationLbl.setText("StationID#Provider:");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
stationLbl.setText("StationID:");
|
||||
}
|
||||
}
|
||||
|
||||
private void handleAddNewStation() {
|
||||
|
||||
if ( !isValidStation() ) {
|
||||
displayInputErrorMsg("Invalid Station ID entered: Please enter a valid Station ID for the selected Station Type");
|
||||
return;
|
||||
}
|
||||
String stn = stationTF.getText();
|
||||
if ( metarRdo.getSelection() ) {
|
||||
stn = stn + "#METAR";
|
||||
} else if ( maritimeRdo.getSelection() ) {
|
||||
stn = stn + "#MARITIME";
|
||||
} else {
|
||||
//Mesonet
|
||||
}
|
||||
if ( macDlg.isExistingStation(stn) ) {
|
||||
displayInputErrorMsg("The Station, " + stn + ", is already in your Monitoring Area or among your Additional Stations");
|
||||
return;
|
||||
}
|
||||
macDlg.addNewStationAction(stn);
|
||||
}
|
||||
|
||||
private boolean isValidStation() {
|
||||
|
||||
String stnId = stationTF.getText();
|
||||
if ( stnId.contains("#") && !mesonetRdo.getSelection() ) {
|
||||
return false;
|
||||
}
|
||||
String catalogtypePhrase = "";
|
||||
if ( metarRdo.getSelection() ) {
|
||||
catalogtypePhrase = "catalogtype = 1"; // METAR
|
||||
} else if ( maritimeRdo.getSelection() ) {
|
||||
catalogtypePhrase = "catalogtype = 33 or catalogtype = 32"; // MARITIME
|
||||
} else {
|
||||
//TODO need code for handling Mesonet
|
||||
}
|
||||
try {
|
||||
String sql = "select stationid, catalogtype from common_obs_spatial where ( " + catalogtypePhrase + " ) and stationid = '" + stnId + "'";
|
||||
ISpatialQuery sq = SpatialQueryFactory.create();
|
||||
Object[] results = sq.dbRequest(sql, "metadata");
|
||||
if ( results == null ) {
|
||||
return false;
|
||||
}
|
||||
if ( results.length != 2 ) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
/**
|
||||
* TODO: need to add code for handling Mesonet station type
|
||||
*/
|
||||
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void displayInputErrorMsg(String msg) {
|
||||
MessageBox messageBox = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK);
|
||||
/**
|
||||
* Adds a new station.
|
||||
*/
|
||||
private void handleAddNewStation() {
|
||||
if (!isValidStation()) {
|
||||
displayInputErrorMsg("Invalid Station ID entered: Please enter a valid Station ID for the selected Station Type");
|
||||
return;
|
||||
}
|
||||
String stn = stationTF.getText();
|
||||
if (metarRdo.getSelection()) {
|
||||
stn = stn + "#METAR";
|
||||
} else if (maritimeRdo.getSelection()) {
|
||||
stn = stn + "#MARITIME";
|
||||
} else {
|
||||
// TODO: Mesonet
|
||||
}
|
||||
if (macDlg.isExistingStation(stn)) {
|
||||
displayInputErrorMsg("The Station, "
|
||||
+ stn
|
||||
+ ", is already in your Monitoring Area or among your Additional Stations");
|
||||
return;
|
||||
}
|
||||
macDlg.addNewStationAction(stn);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if station is valid.
|
||||
*
|
||||
* @return boolean value
|
||||
*/
|
||||
private boolean isValidStation() {
|
||||
String stnId = stationTF.getText();
|
||||
if (stnId.contains("#") && !mesonetRdo.getSelection()) {
|
||||
return false;
|
||||
}
|
||||
String catalogtypePhrase = "";
|
||||
if (metarRdo.getSelection()) {
|
||||
catalogtypePhrase = "catalogtype = 1"; // METAR
|
||||
} else if (maritimeRdo.isEnabled() && maritimeRdo.getSelection()) {
|
||||
catalogtypePhrase = "catalogtype = 33 or catalogtype = 32"; // MARITIME
|
||||
} else {
|
||||
catalogtypePhrase = "catalogtype = 1000"; // MESONET
|
||||
stnId = stnId.substring(0, stnId.indexOf("#"));
|
||||
}
|
||||
try {
|
||||
String sql = "select stationid, catalogtype from common_obs_spatial where ( "
|
||||
+ catalogtypePhrase + " ) and stationid = '" + stnId + "'";
|
||||
ISpatialQuery sq = SpatialQueryFactory.create();
|
||||
Object[] results = sq.dbRequest(sql, "metadata");
|
||||
if (results == null) {
|
||||
return false;
|
||||
}
|
||||
if (results.length != 2) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
/**
|
||||
* TODO: need to add code for handling Mesonet station type
|
||||
*/
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.ERROR, e.getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays input error.
|
||||
*
|
||||
* @param msg
|
||||
*/
|
||||
private void displayInputErrorMsg(String msg) {
|
||||
MessageBox messageBox = new MessageBox(shell, SWT.ICON_INFORMATION
|
||||
| SWT.OK);
|
||||
messageBox.setText("Invalid input");
|
||||
messageBox.setMessage(msg);
|
||||
messageBox.open();
|
||||
}
|
||||
}
|
||||
|
||||
private MonitorConfigurationManager getConfigManager(AppName app) {
|
||||
MonitorConfigurationManager mngr = null;
|
||||
if (app == AppName.FOG) {
|
||||
mngr = FogMonitorConfigurationManager.getInstance();
|
||||
} else if (app == AppName.SAFESEAS) {
|
||||
mngr = SSMonitorConfigurationManager.getInstance();
|
||||
} else if (app == AppName.SNOW) {
|
||||
mngr = SnowMonitorConfigurationManager.getInstance();
|
||||
}
|
||||
return mngr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,9 +26,8 @@ import org.eclipse.swt.layout.GridData;
|
|||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Dialog;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Layout;
|
||||
import org.eclipse.swt.widgets.MessageBox;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
@ -37,236 +36,189 @@ import com.raytheon.uf.common.monitor.config.FogMonitorConfigurationManager;
|
|||
import com.raytheon.uf.common.monitor.config.MonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.SSMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.SnowMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
||||
import com.raytheon.uf.common.monitor.xml.AreaIdXML.ZoneType;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
/**
|
||||
* Dialog to display the control for adding a new zone.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 2, 2009 lvenable Initial creation
|
||||
*
|
||||
* Nov 20, 2012 1297 skorolev Changes for non-blocking dialog.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author lvenable
|
||||
* @version 1.0
|
||||
*/
|
||||
public class AddNewZoneDlg extends Dialog
|
||||
{
|
||||
/**
|
||||
* Dialog shell.
|
||||
*/
|
||||
private Shell shell;
|
||||
|
||||
/**
|
||||
* The display control.
|
||||
*/
|
||||
private Display display;
|
||||
|
||||
/**
|
||||
* Return value when the shell is disposed.
|
||||
*/
|
||||
private Boolean returnValue = false;
|
||||
|
||||
public class AddNewZoneDlg extends CaveSWTDialog {
|
||||
|
||||
/**
|
||||
* Application name.
|
||||
*/
|
||||
private CommonConfig.AppName appName;
|
||||
|
||||
private AppName appName;
|
||||
|
||||
/**
|
||||
* Marine zone radio button.
|
||||
*/
|
||||
private Button marineZoneRdo;
|
||||
|
||||
|
||||
/**
|
||||
* County radio button.
|
||||
*/
|
||||
private Button countyRdo;
|
||||
|
||||
|
||||
/**
|
||||
* ID text control.
|
||||
*/
|
||||
private Text idTF;
|
||||
|
||||
|
||||
/**
|
||||
* Centroid latitude text control.
|
||||
*/
|
||||
private Text centroidLatTF;
|
||||
|
||||
|
||||
/**
|
||||
* Centroid longitude text control.
|
||||
*/
|
||||
private Text centroidLonTF;
|
||||
|
||||
private Button marineRdo;
|
||||
|
||||
private Button nonMarineRdo;
|
||||
|
||||
private INewZoneStnAction macDlg;
|
||||
|
||||
|
||||
/**
|
||||
* Call back interface.
|
||||
*/
|
||||
private INewZoneStnAction macDlg;
|
||||
|
||||
/**
|
||||
* Area configuration manager.
|
||||
*/
|
||||
private MonitorConfigurationManager configMan;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param parent Parent shell.
|
||||
* @param appName Application name.
|
||||
*
|
||||
* @param parent
|
||||
* Parent shell.
|
||||
* @param appName
|
||||
* Application name.
|
||||
*/
|
||||
public AddNewZoneDlg(Shell parent, CommonConfig.AppName appName, INewZoneStnAction macDlg)
|
||||
{
|
||||
super(parent, 0);
|
||||
|
||||
public AddNewZoneDlg(Shell parent, AppName appName, INewZoneStnAction macDlg) {
|
||||
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
|
||||
setText(appName.toString() + ": Add a New Zone to Monitor Area.");
|
||||
this.appName = appName;
|
||||
this.macDlg = macDlg;
|
||||
configMan = getConfigManager(appName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open method used to display the dialog.
|
||||
* @return True/False.
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
|
||||
*/
|
||||
public Object open()
|
||||
{
|
||||
Shell parent = getParent();
|
||||
display = parent.getDisplay();
|
||||
shell = new Shell(parent, SWT.DIALOG_TRIM);
|
||||
shell.setText("Add a New Zone");
|
||||
|
||||
// Create the main layout for the shell.
|
||||
@Override
|
||||
protected Layout constructShellLayout() {
|
||||
GridLayout mainLayout = new GridLayout(1, false);
|
||||
mainLayout.marginHeight = 2;
|
||||
mainLayout.marginWidth = 2;
|
||||
mainLayout.verticalSpacing = 2;
|
||||
shell.setLayout(mainLayout);
|
||||
|
||||
// Initialize all of the controls and layouts
|
||||
initializeComponents();
|
||||
|
||||
shell.pack();
|
||||
|
||||
shell.open();
|
||||
while (!shell.isDisposed())
|
||||
{
|
||||
if (!display.readAndDispatch())
|
||||
{
|
||||
display.sleep();
|
||||
}
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
return mainLayout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the components on the display.
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
||||
* .eclipse.swt.widgets.Shell)
|
||||
*/
|
||||
private void initializeComponents()
|
||||
{
|
||||
if (appName != CommonConfig.AppName.SNOW)
|
||||
{
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
setReturnValue(false);
|
||||
if (appName != AppName.SNOW) {
|
||||
createTopZoneCountyControls();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
createCountyZoneLabels();
|
||||
}
|
||||
|
||||
createTextControls();
|
||||
createBottomButtons();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create the top zone county controls.
|
||||
* Creates the top zone county controls.
|
||||
*/
|
||||
private void createTopZoneCountyControls()
|
||||
{
|
||||
private void createTopZoneCountyControls() {
|
||||
Composite topComp = new Composite(shell, SWT.NONE);
|
||||
topComp.setLayout(new GridLayout(2, true));
|
||||
topComp.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
|
||||
|
||||
/*
|
||||
* Add the label.
|
||||
*/
|
||||
Label topLbl = new Label(topComp, SWT.RIGHT);
|
||||
topLbl.setText("Please type in a new: ");
|
||||
topLbl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
|
||||
|
||||
/*
|
||||
* Add the radio controls.
|
||||
*/
|
||||
Composite radioComp = new Composite(topComp, SWT.NONE);
|
||||
radioComp.setLayout(new GridLayout(1, false));
|
||||
|
||||
marineZoneRdo = new Button(radioComp, SWT.RADIO);
|
||||
marineZoneRdo.setText("Marine Zone");
|
||||
marineZoneRdo.setSelection(true);
|
||||
|
||||
countyRdo = new Button(radioComp, SWT.RADIO);
|
||||
countyRdo.setText("County");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create the county zone labels.
|
||||
* Creates the county zone labels.
|
||||
*/
|
||||
private void createCountyZoneLabels()
|
||||
{
|
||||
private void createCountyZoneLabels() {
|
||||
Composite labelComp = new Composite(shell, SWT.NONE);
|
||||
labelComp.setLayout(new GridLayout(1, false));
|
||||
labelComp.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
|
||||
|
||||
labelComp
|
||||
.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
|
||||
Label topLbl = new Label(labelComp, SWT.CENTER);
|
||||
topLbl.setText("Please type in a new county/zone");
|
||||
topLbl.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create the text controls.
|
||||
* Creates the text controls.
|
||||
*/
|
||||
private void createTextControls()
|
||||
{
|
||||
private void createTextControls() {
|
||||
Composite textComp = new Composite(shell, SWT.NONE);
|
||||
GridLayout gl = new GridLayout(2, false);
|
||||
gl.verticalSpacing = 10;
|
||||
textComp.setLayout(gl);
|
||||
textComp.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
|
||||
|
||||
|
||||
GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, true);
|
||||
Label idLbl = new Label(textComp, SWT.RIGHT);
|
||||
idLbl.setText("Id (e.g. AMZ080):");
|
||||
idLbl.setLayoutData(gd);
|
||||
|
||||
|
||||
idTF = new Text(textComp, SWT.BORDER);
|
||||
idTF.setLayoutData(new GridData(120, SWT.DEFAULT));
|
||||
|
||||
|
||||
gd = new GridData(SWT.FILL, SWT.CENTER, true, true);
|
||||
Label centroidLatLbl = new Label(textComp, SWT.RIGHT);
|
||||
centroidLatLbl.setText("Centroid Lat (e.g. 29.198):");
|
||||
centroidLatLbl.setLayoutData(gd);
|
||||
|
||||
|
||||
centroidLatTF = new Text(textComp, SWT.BORDER);
|
||||
centroidLatTF.setLayoutData(new GridData(120, SWT.DEFAULT));
|
||||
|
||||
|
||||
gd = new GridData(SWT.FILL, SWT.CENTER, true, true);
|
||||
Label centroidLonLbl = new Label(textComp, SWT.RIGHT);
|
||||
centroidLonLbl.setText("Centroid Lon (e.g. -71.75):");
|
||||
centroidLonLbl.setLayoutData(gd);
|
||||
|
||||
|
||||
centroidLonTF = new Text(textComp, SWT.BORDER);
|
||||
centroidLonTF.setLayoutData(new GridData(120, SWT.DEFAULT));
|
||||
|
||||
|
||||
// gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
// marineRdo = new Button(textComp, SWT.RADIO);
|
||||
// marineRdo.setLayoutData(gd);
|
||||
// marineRdo.setSelection(false);
|
||||
// marineRdo.setText("Marine Station");
|
||||
//
|
||||
// gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
// nonMarineRdo = new Button(textComp, SWT.RADIO);
|
||||
// nonMarineRdo.setLayoutData(gd);
|
||||
// nonMarineRdo.setSelection(true);
|
||||
// nonMarineRdo.setText("Non-Marine Station");
|
||||
|
||||
/*
|
||||
* Create the Use Decimal label.
|
||||
*/
|
||||
|
@ -276,113 +228,132 @@ public class AddNewZoneDlg extends Dialog
|
|||
useDecimalLbl.setText("Use Decimal Degrees, West Longitude negative");
|
||||
useDecimalLbl.setLayoutData(gd);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create the bottom Add and Close buttons.
|
||||
* Creates the bottom Add and Close buttons.
|
||||
*/
|
||||
private void createBottomButtons()
|
||||
{
|
||||
private void createBottomButtons() {
|
||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
Composite mainButtonComp = new Composite(shell, SWT.NONE);
|
||||
mainButtonComp.setLayout(new GridLayout(1, false));
|
||||
mainButtonComp.setLayoutData(gd);
|
||||
|
||||
|
||||
// Add a separator label.
|
||||
Label sepLbl = new Label(mainButtonComp, SWT.SEPARATOR | SWT.HORIZONTAL);
|
||||
sepLbl.setLayoutData(gd);
|
||||
|
||||
|
||||
gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, false);
|
||||
Composite buttonComp = new Composite(shell, SWT.NONE);
|
||||
buttonComp.setLayout(new GridLayout(2, false));
|
||||
buttonComp.setLayoutData(gd);
|
||||
|
||||
|
||||
gd = new GridData(100, SWT.DEFAULT);
|
||||
Button addBtn = new Button(buttonComp, SWT.PUSH);
|
||||
addBtn.setText("Add");
|
||||
addBtn.setLayoutData(gd);
|
||||
addBtn.addSelectionListener(new SelectionAdapter()
|
||||
{
|
||||
addBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event)
|
||||
{
|
||||
String latString = centroidLatTF.getText();
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
String latString = centroidLatTF.getText();
|
||||
String lonString = centroidLonTF.getText();
|
||||
|
||||
if (((latString != null) && (latString.length() > 0)) &&
|
||||
(lonString != null) && (lonString.length() > 0)) {
|
||||
double lat;
|
||||
double lon;
|
||||
try {
|
||||
lat = Double.parseDouble(latString);
|
||||
lon = Double.parseDouble(lonString);
|
||||
|
||||
handleAddNewAction(lat, lon);
|
||||
} catch (NumberFormatException e) {
|
||||
MessageBox messageBox = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK);
|
||||
messageBox.setText("Invalid Lat/Lon");
|
||||
messageBox.setMessage("Invalid Lat/Lon entered. Please enter correctly formatted Lat/Lon values");
|
||||
messageBox.open();
|
||||
}
|
||||
|
||||
//shell.dispose();
|
||||
} else {
|
||||
MessageBox messageBox = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK);
|
||||
messageBox.setText("Invalid Lat/Lon");
|
||||
messageBox.setMessage("Invalid Lat/Lon entered. Please enter correctly formatted Lat/Lon values");
|
||||
messageBox.open();
|
||||
}
|
||||
handleAddNewAction(latString, lonString);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
gd = new GridData(100, SWT.DEFAULT);
|
||||
Button closeBtn = new Button(buttonComp, SWT.PUSH);
|
||||
closeBtn.setText("Close");
|
||||
closeBtn.setLayoutData(gd);
|
||||
closeBtn.addSelectionListener(new SelectionAdapter()
|
||||
{
|
||||
closeBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event)
|
||||
{
|
||||
shell.dispose();
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
setReturnValue(true);
|
||||
close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void handleAddNewAction(double lat, double lon) {
|
||||
String areaId = idTF.getText();
|
||||
if ( areaId.length() != 6 || (areaId.charAt(2) != 'C' && areaId.charAt(2) != 'Z') ) {
|
||||
displayInputErrorMsg("Invalid Area ID entered. Please enter a correctly formatted Area ID");
|
||||
return;
|
||||
}
|
||||
if ( macDlg.isExistingZone(areaId) ) {
|
||||
displayInputErrorMsg("The Area ID, " + areaId + ", is already in your Monitoring Area or among your Additional Zones");
|
||||
return;
|
||||
}
|
||||
|
||||
ZoneType type = ZoneType.REGULAR;
|
||||
if (marineRdo.getSelection()) {
|
||||
type = ZoneType.MARITIME;
|
||||
}
|
||||
|
||||
MonitorConfigurationManager configManager = null;
|
||||
if ( appName == CommonConfig.AppName.FOG ) {
|
||||
configManager = FogMonitorConfigurationManager.getInstance();
|
||||
} else if ( appName == CommonConfig.AppName.SAFESEAS ) {
|
||||
configManager = SSMonitorConfigurationManager.getInstance();
|
||||
} else if ( appName == CommonConfig.AppName.SNOW ) {
|
||||
configManager = SnowMonitorConfigurationManager.getInstance();
|
||||
} else {
|
||||
return;
|
||||
/**
|
||||
* Adds a new zone.
|
||||
*
|
||||
* @param latString
|
||||
* @param lonString
|
||||
*/
|
||||
private void handleAddNewAction(String latString, String lonString) {
|
||||
String areaId = idTF.getText();
|
||||
if (areaId.equals("") || areaId.length() != 6
|
||||
|| (areaId.charAt(2) != 'C' && areaId.charAt(2) != 'Z')) {
|
||||
displayInputErrorMsg("Invalid Area ID entered. Please enter a correctly formatted Area ID");
|
||||
return;
|
||||
}
|
||||
if (macDlg.isExistingZone(areaId)) {
|
||||
displayInputErrorMsg("The Area ID, "
|
||||
+ areaId
|
||||
+ ", is already in your Monitoring Area or among your Additional Zones");
|
||||
return;
|
||||
}
|
||||
if (latString == null || latString.isEmpty() || lonString == null
|
||||
|| lonString.isEmpty()) {
|
||||
MessageBox messageBox = new MessageBox(shell, SWT.ICON_INFORMATION
|
||||
| SWT.OK);
|
||||
messageBox.setText("Invalid Lat/Lon");
|
||||
messageBox
|
||||
.setMessage("Invalid Lat/Lon entered. Please enter correctly formatted Lat and Lon values");
|
||||
messageBox.open();
|
||||
return;
|
||||
} else {
|
||||
try {
|
||||
double lat = Double.parseDouble(latString.trim());
|
||||
double lon = Double.parseDouble(lonString.trim());
|
||||
ZoneType type = ZoneType.REGULAR;
|
||||
if (appName != AppName.SNOW) {
|
||||
if (marineZoneRdo.getSelection()) {
|
||||
type = ZoneType.MARITIME;
|
||||
}
|
||||
}
|
||||
configMan.addArea(areaId, lat, lon, type, false);
|
||||
macDlg.addNewZoneAction(areaId, centroidLatTF.getText(),
|
||||
centroidLonTF.getText());
|
||||
} catch (NumberFormatException e) {
|
||||
MessageBox messageBox = new MessageBox(shell,
|
||||
SWT.ICON_INFORMATION | SWT.OK);
|
||||
messageBox.setText("Invalid Lat/Lon");
|
||||
messageBox
|
||||
.setMessage("Invalid Lat/Lon entered. Please enter correctly formatted Lat and Lon values");
|
||||
messageBox.open();
|
||||
return;
|
||||
}
|
||||
}
|
||||
configManager.addArea(areaId, lat, lon, type, false);
|
||||
macDlg.addNewZoneAction(areaId, centroidLatTF.getText(), centroidLonTF.getText());
|
||||
|
||||
}
|
||||
|
||||
private void displayInputErrorMsg(String msg) {
|
||||
MessageBox messageBox = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK);
|
||||
/**
|
||||
* Displays Input Error Message
|
||||
*
|
||||
* @param msg
|
||||
*/
|
||||
private void displayInputErrorMsg(String msg) {
|
||||
MessageBox messageBox = new MessageBox(shell, SWT.ICON_INFORMATION
|
||||
| SWT.OK);
|
||||
messageBox.setText("Invalid input");
|
||||
messageBox.setMessage(msg);
|
||||
messageBox.open();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Configuration Manager.
|
||||
*
|
||||
* @param app
|
||||
* @return manager
|
||||
*/
|
||||
private MonitorConfigurationManager getConfigManager(AppName app) {
|
||||
MonitorConfigurationManager mngr = null;
|
||||
if (app == AppName.FOG) {
|
||||
mngr = FogMonitorConfigurationManager.getInstance();
|
||||
} else if (app == AppName.SAFESEAS) {
|
||||
mngr = SSMonitorConfigurationManager.getInstance();
|
||||
} else if (app == AppName.SNOW) {
|
||||
mngr = SnowMonitorConfigurationManager.getInstance();
|
||||
}
|
||||
return mngr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.monitor.ui.dialogs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
|
@ -29,137 +27,105 @@ import org.eclipse.swt.layout.GridData;
|
|||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Dialog;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Layout;
|
||||
import org.eclipse.swt.widgets.List;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.monitor.config.FogMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
||||
import com.raytheon.uf.common.monitor.config.MonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.SSMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.SnowMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
/**
|
||||
* Dialog for deleting stations.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 2, 2009 lvenable Initial creation
|
||||
*
|
||||
* Nov 20, 2012 1297 skorolev Changes for non-blocking dialog.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author lvenable
|
||||
* @version 1.0
|
||||
*/
|
||||
public class DeleteStationDlg extends Dialog
|
||||
{
|
||||
/**
|
||||
* Dialog shell.
|
||||
*/
|
||||
private Shell shell;
|
||||
|
||||
/**
|
||||
* The display control.
|
||||
*/
|
||||
private Display display;
|
||||
|
||||
/**
|
||||
* Return value when the shell is disposed.
|
||||
*/
|
||||
private Boolean returnValue = false;
|
||||
|
||||
/**
|
||||
* Dialog title.
|
||||
*/
|
||||
private String dialogTitle;
|
||||
|
||||
public class DeleteStationDlg extends CaveSWTDialog {
|
||||
|
||||
/**
|
||||
* Station list control.
|
||||
*/
|
||||
private List stationList;
|
||||
|
||||
|
||||
/**
|
||||
* Control font.
|
||||
*/
|
||||
private Font controlFont;
|
||||
|
||||
|
||||
/**
|
||||
* Area configuration manager.
|
||||
*/
|
||||
private MonitorConfigurationManager configMan;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param parent Parent shell.
|
||||
* @param appName Application name.
|
||||
*
|
||||
* @param parent
|
||||
* Parent shell.
|
||||
* @param appName
|
||||
* Application name.
|
||||
*/
|
||||
public DeleteStationDlg(Shell parent, CommonConfig.AppName appName)
|
||||
{
|
||||
super(parent, 0);
|
||||
|
||||
dialogTitle = appName.toString() + ": Delete a Newly Entered Station";
|
||||
public DeleteStationDlg(Shell parent, AppName appName) {
|
||||
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
|
||||
setText(appName.toString() + ": Delete a Newly Entered Station");
|
||||
configMan = getConfigManager(appName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open method used to display the dialog.
|
||||
* @return True/False.
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
|
||||
*/
|
||||
public Object open()
|
||||
{
|
||||
Shell parent = getParent();
|
||||
display = parent.getDisplay();
|
||||
shell = new Shell(parent, SWT.DIALOG_TRIM);
|
||||
shell.setText(dialogTitle);
|
||||
|
||||
// Create the main layout for the shell.
|
||||
@Override
|
||||
protected Layout constructShellLayout() {
|
||||
GridLayout mainLayout = new GridLayout(1, false);
|
||||
mainLayout.marginHeight = 2;
|
||||
mainLayout.marginWidth = 2;
|
||||
mainLayout.verticalSpacing = 2;
|
||||
shell.setLayout(mainLayout);
|
||||
|
||||
// Initialize all of the controls and layouts
|
||||
initializeComponents();
|
||||
|
||||
populate();
|
||||
|
||||
shell.pack();
|
||||
|
||||
shell.open();
|
||||
while (!shell.isDisposed())
|
||||
{
|
||||
if (!display.readAndDispatch())
|
||||
{
|
||||
display.sleep();
|
||||
}
|
||||
}
|
||||
|
||||
controlFont.dispose();
|
||||
|
||||
return returnValue;
|
||||
return mainLayout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the components on the display.
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
||||
* .eclipse.swt.widgets.Shell)
|
||||
*/
|
||||
private void initializeComponents()
|
||||
{
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
setReturnValue(false);
|
||||
controlFont = new Font(shell.getDisplay(), "Monospace", 10, SWT.NORMAL);
|
||||
|
||||
createListControl();
|
||||
|
||||
createBottomButtons();
|
||||
populate();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create the list control.
|
||||
*/
|
||||
private void createListControl()
|
||||
{
|
||||
private void createListControl() {
|
||||
Composite listComp = new Composite(shell, SWT.NONE);
|
||||
listComp.setLayout(new GridLayout(1, false));
|
||||
|
||||
Label stationLbl = new Label(listComp, SWT.NONE);
|
||||
stationLbl.setText("Available Stations to delete:");
|
||||
|
||||
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
gd.widthHint = 350;
|
||||
gd.heightHint = 250;
|
||||
|
@ -167,62 +133,92 @@ public class DeleteStationDlg extends Dialog
|
|||
stationList.setFont(controlFont);
|
||||
stationList.setLayoutData(gd);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create the Delete Station and Close buttons.
|
||||
*/
|
||||
private void createBottomButtons()
|
||||
{
|
||||
private void createBottomButtons() {
|
||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
Composite mainButtonComp = new Composite(shell, SWT.NONE);
|
||||
mainButtonComp.setLayout(new GridLayout(1, false));
|
||||
mainButtonComp.setLayoutData(gd);
|
||||
|
||||
|
||||
gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, false);
|
||||
Composite buttonComp = new Composite(shell, SWT.NONE);
|
||||
buttonComp.setLayout(new GridLayout(2, false));
|
||||
buttonComp.setLayoutData(gd);
|
||||
|
||||
|
||||
gd = new GridData(120, SWT.DEFAULT);
|
||||
Button deleteBtn = new Button(buttonComp, SWT.PUSH);
|
||||
deleteBtn.setText("Delete Station");
|
||||
deleteBtn.setLayoutData(gd);
|
||||
deleteBtn.addSelectionListener(new SelectionAdapter()
|
||||
{
|
||||
deleteBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event)
|
||||
{
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
deleteSelected();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
gd = new GridData(120, SWT.DEFAULT);
|
||||
Button closeBtn = new Button(buttonComp, SWT.PUSH);
|
||||
closeBtn.setText("Close");
|
||||
closeBtn.setLayoutData(gd);
|
||||
closeBtn.addSelectionListener(new SelectionAdapter()
|
||||
{
|
||||
closeBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event)
|
||||
{
|
||||
shell.dispose();
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
setReturnValue(true);
|
||||
close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Populate list of added stations.
|
||||
*/
|
||||
private void populate() {
|
||||
FogMonitorConfigurationManager configMan = FogMonitorConfigurationManager.getInstance();
|
||||
|
||||
ArrayList<String> addedStations = configMan.getAddedStations();
|
||||
stationList.setItems(addedStations.toArray(new String[addedStations.size()]));
|
||||
java.util.List<String> addedStations = configMan.getAddedStations();
|
||||
stationList.setItems(addedStations.toArray(new String[addedStations
|
||||
.size()]));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete stations from the list.
|
||||
*/
|
||||
private void deleteSelected() {
|
||||
FogMonitorConfigurationManager configMan = FogMonitorConfigurationManager.getInstance();
|
||||
|
||||
String selection = stationList.getItem(stationList.getSelectionIndex());
|
||||
|
||||
configMan.removeStation(selection);
|
||||
stationList.remove(stationList.getSelectionIndex());
|
||||
if (stationList.getItemCount() != 0) {
|
||||
String selection = stationList.getItem(stationList
|
||||
.getSelectionIndex());
|
||||
configMan.removeStation(selection);
|
||||
stationList.remove(stationList.getSelectionIndex());
|
||||
populate();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Configuration Manager.
|
||||
*
|
||||
* @param app
|
||||
* @return manager
|
||||
*/
|
||||
private MonitorConfigurationManager getConfigManager(AppName app) {
|
||||
MonitorConfigurationManager mngr = null;
|
||||
if (app == AppName.FOG) {
|
||||
mngr = FogMonitorConfigurationManager.getInstance();
|
||||
} else if (app == AppName.SAFESEAS) {
|
||||
mngr = SSMonitorConfigurationManager.getInstance();
|
||||
} else if (app == AppName.SNOW) {
|
||||
mngr = SnowMonitorConfigurationManager.getInstance();
|
||||
}
|
||||
return mngr;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
|
||||
*/
|
||||
@Override
|
||||
protected void disposed() {
|
||||
controlFont.dispose();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.monitor.ui.dialogs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
|
@ -29,189 +27,162 @@ import org.eclipse.swt.layout.GridData;
|
|||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Dialog;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Layout;
|
||||
import org.eclipse.swt.widgets.List;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
import com.raytheon.uf.common.monitor.config.FogMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
||||
import com.raytheon.uf.common.monitor.config.MonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.SSMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.SnowMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
||||
import com.raytheon.uf.common.monitor.xml.AreaIdXML;
|
||||
import com.raytheon.uf.common.monitor.xml.AreaIdXML.ZoneType;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
/**
|
||||
* Dialog for editing new zones.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 2, 2009 lvenable Initial creation
|
||||
*
|
||||
* Nov 20, 2012 1297 skorolev Changes for non-blocking dialog.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author lvenable
|
||||
* @version 1.0
|
||||
*/
|
||||
public class EditNewZoneDlg extends Dialog
|
||||
{
|
||||
/**
|
||||
* Dialog shell.
|
||||
*/
|
||||
private Shell shell;
|
||||
|
||||
/**
|
||||
* The display control.
|
||||
*/
|
||||
private Display display;
|
||||
|
||||
/**
|
||||
* Return value when the shell is disposed.
|
||||
*/
|
||||
private Boolean returnValue = false;
|
||||
|
||||
/**
|
||||
* Dialog title.
|
||||
*/
|
||||
private String dialogTitle;
|
||||
|
||||
public class EditNewZoneDlg extends CaveSWTDialog {
|
||||
/**
|
||||
* Zone list control.
|
||||
*/
|
||||
private List zoneList;
|
||||
|
||||
|
||||
/**
|
||||
* ID text control.
|
||||
*/
|
||||
private Text idTF;
|
||||
|
||||
|
||||
/**
|
||||
* Latitude text control.
|
||||
*/
|
||||
private Text latTF;
|
||||
|
||||
|
||||
/**
|
||||
* Longitude text control.
|
||||
*/
|
||||
private Text lonTF;
|
||||
|
||||
|
||||
/**
|
||||
* Save button.
|
||||
*/
|
||||
private Button saveBtn;
|
||||
|
||||
|
||||
/**
|
||||
* Delete button.
|
||||
*/
|
||||
private Button deleteBtn;
|
||||
|
||||
|
||||
/**
|
||||
* Control font.
|
||||
*/
|
||||
private Font controlFont;
|
||||
|
||||
|
||||
/**
|
||||
* Marine station radio button.
|
||||
*/
|
||||
private Button marineRdo;
|
||||
|
||||
|
||||
/**
|
||||
* None Marine station radio button.
|
||||
*/
|
||||
private Button nonMarineRdo;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param parent Parent shell.
|
||||
* @param appName Application name.
|
||||
* Area configuration manager.
|
||||
*/
|
||||
public EditNewZoneDlg(Shell parent, CommonConfig.AppName appName)
|
||||
{
|
||||
super(parent, 0);
|
||||
|
||||
dialogTitle = appName.toString() + ": Edit a Newly Added Zone";
|
||||
}
|
||||
|
||||
private MonitorConfigurationManager configMan;
|
||||
|
||||
/**
|
||||
* Open method used to display the dialog.
|
||||
* @return True/False.
|
||||
* Bottom label
|
||||
*/
|
||||
public Object open()
|
||||
{
|
||||
Shell parent = getParent();
|
||||
display = parent.getDisplay();
|
||||
shell = new Shell(parent, SWT.DIALOG_TRIM);
|
||||
shell.setText(dialogTitle);
|
||||
|
||||
// Create the main layout for the shell.
|
||||
private Label bottomLbl;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param parent
|
||||
* Parent shell.
|
||||
* @param appName
|
||||
* Application name.
|
||||
*/
|
||||
public EditNewZoneDlg(Shell parent, AppName appName) {
|
||||
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
|
||||
setText(appName.toString() + ": Edit a Newly Added Zone");
|
||||
configMan = this.getConfigManager(appName);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
|
||||
*/
|
||||
@Override
|
||||
protected Layout constructShellLayout() {
|
||||
GridLayout mainLayout = new GridLayout(1, false);
|
||||
mainLayout.marginHeight = 2;
|
||||
mainLayout.marginWidth = 2;
|
||||
mainLayout.verticalSpacing = 2;
|
||||
shell.setLayout(mainLayout);
|
||||
|
||||
// Initialize all of the controls and layouts
|
||||
initializeComponents();
|
||||
|
||||
populate();
|
||||
|
||||
shell.pack();
|
||||
|
||||
shell.open();
|
||||
while (!shell.isDisposed())
|
||||
{
|
||||
if (!display.readAndDispatch())
|
||||
{
|
||||
display.sleep();
|
||||
}
|
||||
}
|
||||
|
||||
controlFont.dispose();
|
||||
|
||||
return returnValue;
|
||||
return mainLayout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the components on the display.
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
||||
* .eclipse.swt.widgets.Shell)
|
||||
*/
|
||||
private void initializeComponents()
|
||||
{
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
setReturnValue(false);
|
||||
controlFont = new Font(shell.getDisplay(), "Monospace", 10, SWT.NORMAL);
|
||||
|
||||
createTopLabel();
|
||||
|
||||
createListAndTextControls();
|
||||
|
||||
createBottomLabel();
|
||||
|
||||
createCloseButton();
|
||||
populate();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create the top label.
|
||||
*/
|
||||
private void createTopLabel()
|
||||
{
|
||||
private void createTopLabel() {
|
||||
Composite labelComp = new Composite(shell, SWT.NONE);
|
||||
labelComp.setLayout(new GridLayout(1, false));
|
||||
labelComp.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
|
||||
|
||||
labelComp
|
||||
.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
|
||||
Label topLbl = new Label(labelComp, SWT.CENTER);
|
||||
topLbl.setText("Select Zone from the list box to edit");
|
||||
topLbl.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create the list and text controls.
|
||||
*/
|
||||
private void createListAndTextControls()
|
||||
{
|
||||
private void createListAndTextControls() {
|
||||
Composite mainComp = new Composite(shell, SWT.NONE);
|
||||
GridLayout gl = new GridLayout(2, false);
|
||||
gl.horizontalSpacing = 10;
|
||||
mainComp.setLayout(gl);
|
||||
|
||||
/*
|
||||
* Add the Zone list control
|
||||
*/
|
||||
// Add the Zone list control
|
||||
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
gd.widthHint = 185;
|
||||
gd.heightHint = 220;
|
||||
|
@ -219,60 +190,59 @@ public class EditNewZoneDlg extends Dialog
|
|||
zoneList.setFont(controlFont);
|
||||
zoneList.setLayoutData(gd);
|
||||
zoneList.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse
|
||||
* .swt.events.SelectionEvent)
|
||||
*/
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
handleZoneSelection();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/*
|
||||
* Add the text controls and the Save/Delete buttons
|
||||
*/
|
||||
// Add the text controls and the Save/Delete buttons
|
||||
Composite textButtonComp = new Composite(mainComp, SWT.NONE);
|
||||
textButtonComp.setLayout(new GridLayout(2, true));
|
||||
|
||||
|
||||
int textWidth = 200;
|
||||
|
||||
|
||||
gd = new GridData();
|
||||
gd.horizontalSpan = 2;
|
||||
Label idLbl = new Label(textButtonComp, SWT.NONE);
|
||||
idLbl.setText("Id:");
|
||||
idLbl.setLayoutData(gd);
|
||||
|
||||
|
||||
gd = new GridData(textWidth, SWT.DEFAULT);
|
||||
gd.horizontalSpan = 2;
|
||||
idTF = new Text(textButtonComp, SWT.BORDER);
|
||||
idTF.setLayoutData(gd);
|
||||
|
||||
|
||||
gd = new GridData();
|
||||
gd.horizontalSpan = 2;
|
||||
gd.verticalIndent = 5;
|
||||
Label latLbl = new Label(textButtonComp, SWT.NONE);
|
||||
latLbl.setText("Lat:");
|
||||
latLbl.setLayoutData(gd);
|
||||
|
||||
|
||||
gd = new GridData(textWidth, SWT.DEFAULT);
|
||||
gd.horizontalSpan = 2;
|
||||
latTF = new Text(textButtonComp, SWT.BORDER);
|
||||
latTF.setLayoutData(gd);
|
||||
|
||||
|
||||
gd = new GridData();
|
||||
gd.horizontalSpan = 2;
|
||||
gd.verticalIndent = 5;
|
||||
Label lonLbl = new Label(textButtonComp, SWT.NONE);
|
||||
lonLbl.setText("Lon:");
|
||||
lonLbl.setLayoutData(gd);
|
||||
|
||||
|
||||
gd = new GridData(textWidth, SWT.DEFAULT);
|
||||
gd.horizontalSpan = 2;
|
||||
lonTF = new Text(textButtonComp, SWT.BORDER);
|
||||
lonTF.setLayoutData(gd);
|
||||
|
||||
|
||||
gd = new GridData();
|
||||
gd.horizontalSpan = 2;
|
||||
gd.verticalIndent = 15;
|
||||
|
@ -280,7 +250,7 @@ public class EditNewZoneDlg extends Dialog
|
|||
marineRdo.setLayoutData(gd);
|
||||
marineRdo.setSelection(false);
|
||||
marineRdo.setText("Marine Station");
|
||||
|
||||
|
||||
gd = new GridData();
|
||||
gd.horizontalSpan = 2;
|
||||
nonMarineRdo = new Button(textButtonComp, SWT.RADIO);
|
||||
|
@ -288,136 +258,176 @@ public class EditNewZoneDlg extends Dialog
|
|||
nonMarineRdo.setSelection(true);
|
||||
nonMarineRdo.setText("Non-Marine Station");
|
||||
|
||||
|
||||
gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, true);
|
||||
gd.widthHint = 80;
|
||||
gd.verticalIndent = 5;
|
||||
saveBtn = new Button(textButtonComp, SWT.PUSH);
|
||||
saveBtn.setText("Save");
|
||||
saveBtn.setLayoutData(gd);
|
||||
saveBtn.addSelectionListener(new SelectionAdapter()
|
||||
{
|
||||
saveBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event)
|
||||
{
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
saveSelected();
|
||||
}
|
||||
});
|
||||
|
||||
gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, true);
|
||||
gd.widthHint = 80;
|
||||
gd.verticalIndent = 5;
|
||||
deleteBtn = new Button(textButtonComp, SWT.PUSH);
|
||||
deleteBtn.setText("Delete");
|
||||
deleteBtn.setLayoutData(gd);
|
||||
deleteBtn.addSelectionListener(new SelectionAdapter()
|
||||
{
|
||||
deleteBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event)
|
||||
{
|
||||
deleteSelected();
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
deleteSelected();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create the bottom label centroid label.
|
||||
*/
|
||||
private void createBottomLabel()
|
||||
{
|
||||
private void createBottomLabel() {
|
||||
Composite labelComp = new Composite(shell, SWT.NONE);
|
||||
labelComp.setLayout(new GridLayout(1, false));
|
||||
labelComp.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
|
||||
|
||||
Label bottomLbl = new Label(labelComp, SWT.NONE);
|
||||
bottomLbl.setText("Centriod Lat/Lon use Decimal Degrees, West Longitude negative");
|
||||
labelComp
|
||||
.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
|
||||
bottomLbl = new Label(labelComp, SWT.NONE);
|
||||
bottomLbl
|
||||
.setText("Centriod Lat/Lon use Decimal Degrees, West Longitude negative");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create the Close button.
|
||||
*/
|
||||
private void createCloseButton()
|
||||
{
|
||||
private void createCloseButton() {
|
||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
Composite buttonComp = new Composite(shell, SWT.NONE);
|
||||
buttonComp.setLayout(new GridLayout(1, false));
|
||||
buttonComp.setLayoutData(gd);
|
||||
|
||||
// Add a separator label.
|
||||
Label sepLbl = new Label(buttonComp, SWT.SEPARATOR | SWT.HORIZONTAL);
|
||||
sepLbl.setLayoutData(gd);
|
||||
|
||||
gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, false);
|
||||
gd.widthHint = 100;
|
||||
Button closeBtn = new Button(buttonComp, SWT.PUSH);
|
||||
closeBtn.setText("Close");
|
||||
closeBtn.setLayoutData(gd);
|
||||
closeBtn.addSelectionListener(new SelectionAdapter()
|
||||
{
|
||||
closeBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event)
|
||||
{
|
||||
shell.dispose();
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
setReturnValue(true);
|
||||
close();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Populate list of added zones.
|
||||
*/
|
||||
private void populate() {
|
||||
FogMonitorConfigurationManager configMan = FogMonitorConfigurationManager.getInstance();
|
||||
|
||||
ArrayList<String> newList = configMan.getAddedZones();
|
||||
java.util.List<String> newList = configMan.getAddedZones();
|
||||
zoneList.setItems(newList.toArray(new String[newList.size()]));
|
||||
}
|
||||
|
||||
private void handleZoneSelection() {
|
||||
FogMonitorConfigurationManager configMan = FogMonitorConfigurationManager.getInstance();
|
||||
String zone = zoneList.getItem(zoneList.getSelectionIndex());
|
||||
|
||||
/**
|
||||
* Zone selection
|
||||
*/
|
||||
private void handleZoneSelection() {
|
||||
String zone = zoneList.getItem(zoneList.getSelectionIndex());
|
||||
AreaIdXML areaXml = configMan.getAreaXml(zone);
|
||||
|
||||
// DR #7343: a null areaXml causes an "Unhandled event loop exception"
|
||||
if ( areaXml != null ) {
|
||||
if (areaXml != null) {
|
||||
idTF.setText(areaXml.getAreaId());
|
||||
latTF.setText(String.valueOf(areaXml.getCLat()));
|
||||
lonTF.setText(String.valueOf(areaXml.getCLon()));
|
||||
|
||||
if (areaXml.getType() == ZoneType.REGULAR) {
|
||||
nonMarineRdo.setSelection(true);
|
||||
marineRdo.setSelection(false);
|
||||
} else {
|
||||
nonMarineRdo.setSelection(false);
|
||||
marineRdo.setSelection(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteSelected() {
|
||||
FogMonitorConfigurationManager configMan = FogMonitorConfigurationManager.getInstance();
|
||||
String area = zoneList.getItem(zoneList.getSelectionIndex());
|
||||
zoneList.remove(zoneList.getSelectionIndex());
|
||||
|
||||
configMan.removeArea(area);
|
||||
idTF.setText("");
|
||||
latTF.setText("");
|
||||
lonTF.setText("");
|
||||
}
|
||||
|
||||
private void saveSelected() {
|
||||
FogMonitorConfigurationManager configMan = FogMonitorConfigurationManager.getInstance();
|
||||
String area = zoneList.getItem(zoneList.getSelectionIndex());
|
||||
|
||||
double lat = Double.parseDouble(latTF.getText());
|
||||
double lon = Double.parseDouble(lonTF.getText());
|
||||
|
||||
ZoneType type = ZoneType.REGULAR;
|
||||
if (marineRdo.getSelection()) {
|
||||
type = ZoneType.MARITIME;
|
||||
/**
|
||||
* Delete selected zones.
|
||||
*/
|
||||
// TODO: Delete zone from left list in the Area Configuration dialog.
|
||||
private void deleteSelected() {
|
||||
if (zoneList.getItemCount() != 0) {
|
||||
String area = zoneList.getItem(zoneList.getSelectionIndex());
|
||||
zoneList.remove(zoneList.getSelectionIndex());
|
||||
configMan.removeArea(area);
|
||||
idTF.setText("");
|
||||
latTF.setText("");
|
||||
lonTF.setText("");
|
||||
} else {
|
||||
bottomLbl.setText("No zones have been added.");
|
||||
}
|
||||
|
||||
configMan.removeArea(area);
|
||||
|
||||
configMan.removeAddedArea(area);
|
||||
|
||||
configMan.addArea(idTF.getText(), lat, lon, type, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save selected zones.
|
||||
*/
|
||||
private void saveSelected() {
|
||||
|
||||
if (zoneList.getItemCount() != 0) {
|
||||
String area = zoneList.getItem(zoneList.getSelectionIndex());
|
||||
double lat;
|
||||
if (!latTF.getText().isEmpty()) {
|
||||
lat = Double.parseDouble(latTF.getText());
|
||||
} else {
|
||||
// wrong value will be filtered when save
|
||||
lat = 9999.0;
|
||||
}
|
||||
double lon;
|
||||
if (!lonTF.getText().isEmpty()) {
|
||||
lon = Double.parseDouble(lonTF.getText());
|
||||
} else {
|
||||
// wrong value will be filtered when save
|
||||
lon = 9999.0;
|
||||
}
|
||||
ZoneType type = ZoneType.REGULAR;
|
||||
if (marineRdo.getSelection()) {
|
||||
type = ZoneType.MARITIME;
|
||||
}
|
||||
configMan.removeArea(area);
|
||||
configMan.removeAddedArea(area);
|
||||
configMan.addArea(idTF.getText(), lat, lon, type, false);
|
||||
populate();
|
||||
} else {
|
||||
bottomLbl.setText("No zones have been added.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Configuration Manager.
|
||||
*
|
||||
* @param app
|
||||
* @return manager
|
||||
*/
|
||||
private MonitorConfigurationManager getConfigManager(AppName app) {
|
||||
MonitorConfigurationManager mngr = null;
|
||||
if (app == AppName.FOG) {
|
||||
mngr = FogMonitorConfigurationManager.getInstance();
|
||||
} else if (app == AppName.SAFESEAS) {
|
||||
mngr = SSMonitorConfigurationManager.getInstance();
|
||||
} else if (app == AppName.SNOW) {
|
||||
mngr = SnowMonitorConfigurationManager.getInstance();
|
||||
}
|
||||
return mngr;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
|
||||
*/
|
||||
@Override
|
||||
protected void disposed() {
|
||||
controlFont.dispose();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -38,7 +38,7 @@ import com.raytheon.uf.common.localization.LocalizationContext;
|
|||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
||||
import com.raytheon.uf.common.monitor.data.CommonTableConfig.ObsHistType;
|
||||
import com.raytheon.uf.viz.monitor.data.TableData;
|
||||
import com.raytheon.uf.viz.monitor.xml.HistConfigXML;
|
||||
|
@ -50,10 +50,12 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 6, 2009 lvenable Initial creation
|
||||
* Aug 6, 2010 6877 skorolev Rewrote with using CaveSWTDialog
|
||||
* Apr 6, 2009 lvenable Initial creation
|
||||
* Aug 6, 2010 6877 skorolev Rewrote with using CaveSWTDialog
|
||||
* Nov 29, 2012 1351 skorolev Clean up code. Changes for non-blocking dialog.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
|
@ -61,26 +63,54 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
*/
|
||||
public class ObsHistTableDlg extends CaveSWTDialog {
|
||||
|
||||
private final CommonConfig.AppName appName;
|
||||
/** Monitor name **/
|
||||
private final AppName appName;
|
||||
|
||||
/** Station ID **/
|
||||
private final String stationId;
|
||||
|
||||
/** Visible columns XML file **/
|
||||
private HistConfigXML visColsXML;
|
||||
|
||||
/** **/
|
||||
private ObsHistTableComp obsHistTable;
|
||||
|
||||
/** Observation type **/
|
||||
private final ObsHistType obsType;
|
||||
|
||||
/** Table data **/
|
||||
private final TableData tableData;
|
||||
|
||||
/** Latitude **/
|
||||
private final double lat;
|
||||
|
||||
/** Longitude **/
|
||||
private final double lon;
|
||||
|
||||
/** Observation history configuration dialog **/
|
||||
private ObsHistConfigDlg obsHistConfigDlg;
|
||||
|
||||
/** Dialog ID **/
|
||||
protected String dlgId;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param parent
|
||||
* @param tableData
|
||||
* @param appName
|
||||
* @param stationID
|
||||
* @param lat
|
||||
* @param lon
|
||||
* @param obsType
|
||||
* @param dlgId
|
||||
* dialog ID
|
||||
*/
|
||||
protected ObsHistTableDlg(Shell parent, TableData tableData,
|
||||
String stationID, double lat, double lon,
|
||||
CommonConfig.AppName appName, ObsHistType obsType) {
|
||||
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE);
|
||||
AppName appName, String stationID, double lat, double lon,
|
||||
ObsHistType obsType, String dlgId) {
|
||||
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK
|
||||
| CAVE.INDEPENDENT_SHELL);
|
||||
setText(appName.name() + ":24-Hour Observation History Table");
|
||||
this.tableData = tableData;
|
||||
this.appName = appName;
|
||||
|
@ -88,6 +118,7 @@ public class ObsHistTableDlg extends CaveSWTDialog {
|
|||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
this.obsType = obsType;
|
||||
this.dlgId = dlgId;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -104,6 +135,9 @@ public class ObsHistTableDlg extends CaveSWTDialog {
|
|||
createObsHistTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates Obs History Table.
|
||||
*/
|
||||
private void createObsHistTable() {
|
||||
obsHistTable = new ObsHistTableComp(shell, tableData, appName, obsType);
|
||||
if (visColsXML != null) {
|
||||
|
@ -116,6 +150,9 @@ public class ObsHistTableDlg extends CaveSWTDialog {
|
|||
obsHistTable.pack();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates Top Controls.
|
||||
*/
|
||||
private void createTopControls() {
|
||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
Composite controlComp = new Composite(shell, SWT.NONE);
|
||||
|
@ -146,24 +183,39 @@ public class ObsHistTableDlg extends CaveSWTDialog {
|
|||
closeBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
shell.dispose();
|
||||
setReturnValue(dlgId);
|
||||
close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens Configuration dialog.
|
||||
*/
|
||||
private void configAction() {
|
||||
ObsHistConfigDlg obsHistConfigDlg = new ObsHistConfigDlg(shell,
|
||||
appName, obsHistTable, obsType);
|
||||
if (obsHistConfigDlg == null) {
|
||||
obsHistConfigDlg = new ObsHistConfigDlg(shell, appName,
|
||||
obsHistTable, obsType);
|
||||
}
|
||||
obsHistConfigDlg.open();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets formated coordinates.
|
||||
*
|
||||
* @return formated lat, lon
|
||||
*/
|
||||
private String getFormattedLatLon() {
|
||||
String format = "(%.2f, %.2f)";
|
||||
return String.format(format, lat, lon);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets user file if exist.
|
||||
*
|
||||
* @return visible Columns XML
|
||||
*/
|
||||
private HistConfigXML getHistConfigFile() {
|
||||
// Open user file if exist.
|
||||
visColsXML = null;
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
LocalizationContext context = pm.getContext(
|
||||
|
@ -180,6 +232,11 @@ public class ObsHistTableDlg extends CaveSWTDialog {
|
|||
return visColsXML;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets history file path.
|
||||
*
|
||||
* @return path
|
||||
*/
|
||||
private String getHistPath() {
|
||||
String fs = String.valueOf(File.separatorChar);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
|
|
@ -148,7 +148,7 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
|
|||
public ObConst.VarName varName;
|
||||
|
||||
/** Application name. **/
|
||||
protected final CommonConfig.AppName appName;
|
||||
protected final AppName appName;
|
||||
|
||||
/** Table attribute dialog. **/
|
||||
private TableAttribDlg attrDlg;
|
||||
|
@ -208,15 +208,6 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
|
|||
/** Data source. **/
|
||||
public String dataSrc = "METAR";
|
||||
|
||||
/** trend plots. **/
|
||||
private TrendPlotDlg tpd, tpdHodo;
|
||||
|
||||
/** Hodograph. **/
|
||||
private HodographDlg hodographDlg;
|
||||
|
||||
/** History table. **/
|
||||
private ObsHistTableDlg obsHstTblDlg;
|
||||
|
||||
/** dispose action. **/
|
||||
protected abstract void shellDisposeAction();
|
||||
|
||||
|
@ -614,7 +605,6 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
|
|||
* (int, int)
|
||||
*/
|
||||
public void launchTrendPlot(int rowIndex, int colIndex) {
|
||||
|
||||
setRowIndex(rowIndex);
|
||||
setColIndex(colIndex);
|
||||
String colKey = config.getTableColumnKeys(appName)[colIndex];
|
||||
|
@ -630,7 +620,8 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
|
|||
dlgTitle = getTrendPlotName(prodArray) + " Trend Plot for " + station
|
||||
+ "#" + dataSrc;
|
||||
if (graphType == GraphType.Trend) {
|
||||
if (mustCreate(tpd) || !openedDlgs.containsKey(dlgTitle)) {
|
||||
TrendPlotDlg tpd = (TrendPlotDlg) openedDlgs.get(dlgTitle);
|
||||
if (tpd == null) {
|
||||
tpd = new TrendPlotDlg(getShell(), selectedZone, station,
|
||||
prodArray, dataSrc, dlgTitle);
|
||||
tpd.setCloseCallback(new ICloseCallback() {
|
||||
|
@ -641,10 +632,8 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
|
|||
});
|
||||
openedDlgs.put(dlgTitle, tpd);
|
||||
tpd.setData(obData);
|
||||
tpd.open();
|
||||
} else {
|
||||
openedDlgs.get(dlgTitle).bringToTop();
|
||||
}
|
||||
tpd.open();
|
||||
}
|
||||
if (graphType == GraphType.HodoWindDir) {
|
||||
// get data for a hodograph trend plot
|
||||
|
@ -652,9 +641,9 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
|
|||
station, varName, ObConst.ProductName.UNDEFINED_PRODUCT);
|
||||
if (dataset != null && !dataset.isEmpty()) {
|
||||
float[] thresholds = dataset.getDualValuedThresholds();
|
||||
|
||||
if (mustCreate(hodographDlg)
|
||||
|| !openedDlgs.containsKey(dlgTitle)) {
|
||||
HodographDlg hodographDlg = (HodographDlg) openedDlgs
|
||||
.get(dlgTitle);
|
||||
if (hodographDlg == null) {
|
||||
hodographDlg = new HodographDlg(getShell(), station,
|
||||
dataSrc, dlgTitle);
|
||||
hodographDlg.setCloseCallback(new ICloseCallback() {
|
||||
|
@ -677,14 +666,13 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
|
|||
thresholds[3]);
|
||||
hodographDlg.setRedThreshold(thresholds[0], thresholds[1]);
|
||||
hodographDlg.setHodoGraphData(dataset.getDataSet());
|
||||
hodographDlg.open();
|
||||
} else {
|
||||
openedDlgs.get(dlgTitle).bringToTop();
|
||||
}
|
||||
hodographDlg.open();
|
||||
} else {
|
||||
prodArray = new ArrayList<String>();
|
||||
prodArray.add("VAR_" + varName.name());
|
||||
if (mustCreate(tpdHodo) || !openedDlgs.containsKey(dlgTitle)) {
|
||||
TrendPlotDlg tpdHodo = (TrendPlotDlg) openedDlgs.get(dlgTitle);
|
||||
if (tpdHodo == null) {
|
||||
tpdHodo = new TrendPlotDlg(getShell(), selectedZone,
|
||||
station, prodArray, dataSrc, dlgTitle);
|
||||
tpdHodo.setCloseCallback(new ICloseCallback() {
|
||||
|
@ -695,10 +683,8 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
|
|||
});
|
||||
openedDlgs.put(dlgTitle, tpdHodo);
|
||||
tpdHodo.setData(obData);
|
||||
tpdHodo.open();
|
||||
} else {
|
||||
openedDlgs.get(dlgTitle).bringToTop();
|
||||
}
|
||||
tpdHodo.open();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -712,11 +698,9 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
|
|||
public void launchObHistoryTable(int rowIndex) {
|
||||
String station = stnTblData.getTableRows().get(rowIndex)
|
||||
.getTableCellData(0).getCellText();
|
||||
|
||||
ObStnHourReports report = obData.getObHourReports()
|
||||
.getObZoneHourReports(selectedZone)
|
||||
.getObStnHourReports(station);
|
||||
|
||||
if (report.getStationCenter() != null) {
|
||||
lat = report.getStationCenter()[1];
|
||||
lon = report.getStationCenter()[0];
|
||||
|
@ -724,11 +708,10 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
|
|||
lat = 0.0;
|
||||
lon = 0.0;
|
||||
}
|
||||
|
||||
// Set dialog index
|
||||
String dialogID = appName.name() + station;
|
||||
MonitorConfigurationManager configMgr = getConfigMgr();
|
||||
|
||||
ObsHistType histType = configMgr.getStationType(selectedZone, station);
|
||||
|
||||
/**
|
||||
* For Snow monitor, no history table is displayed for a Maritime
|
||||
* station
|
||||
|
@ -736,16 +719,28 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
|
|||
if (appName == AppName.SNOW && histType == ObsHistType.Maritime) {
|
||||
return;
|
||||
}
|
||||
if (mustCreate(obsHstTblDlg)) {
|
||||
ObsHistTableDlg obsHstTblDlg = (ObsHistTableDlg) openedDlgs
|
||||
.get(dialogID);
|
||||
if (obsHstTblDlg == null) {
|
||||
obsHstTblDlg = new ObsHistTableDlg(getShell(),
|
||||
obData.getHistTableData(selectedZone, station, histType),
|
||||
station, lat, lon, obData.getAppName(), histType);
|
||||
obsHstTblDlg.open();
|
||||
} else {
|
||||
obsHstTblDlg.bringToTop();
|
||||
appName, station, lat, lon, histType, dialogID);
|
||||
obsHstTblDlg.setCloseCallback(new ICloseCallback() {
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
openedDlgs.remove(returnValue);
|
||||
}
|
||||
});
|
||||
openedDlgs.put(dialogID, obsHstTblDlg);
|
||||
}
|
||||
obsHstTblDlg.open();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Configuration manager.
|
||||
*
|
||||
* @return manager
|
||||
*/
|
||||
protected abstract MonitorConfigurationManager getConfigMgr();
|
||||
|
||||
/**
|
||||
|
@ -825,7 +820,9 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
|
|||
}
|
||||
|
||||
/**
|
||||
* @return linkedToFrame
|
||||
* Linked To Frame
|
||||
*
|
||||
* @return True/False
|
||||
*/
|
||||
public boolean isLinkedToFrame() {
|
||||
return linkedToFrame;
|
||||
|
@ -841,7 +838,7 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
|
|||
}
|
||||
|
||||
/**
|
||||
* Handls checkbox "Link to frame"
|
||||
* Handles checkbox "Link to frame"
|
||||
*/
|
||||
protected void handleLinkToFrame() {
|
||||
linkedToFrame = linkToFrameChk.getSelection();
|
||||
|
@ -860,22 +857,42 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
|
|||
/**
|
||||
* Initiates array of products to plot
|
||||
*
|
||||
* @return
|
||||
* @return variable names
|
||||
*/
|
||||
protected abstract void initiateProdArray();
|
||||
|
||||
/**
|
||||
* Gets row index.
|
||||
*
|
||||
* @return rowIndex
|
||||
*/
|
||||
public int getRowIndex() {
|
||||
return rowIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets row index.
|
||||
*
|
||||
* @param rowIndex
|
||||
*/
|
||||
public void setRowIndex(int rowIndex) {
|
||||
this.rowIndex = rowIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets column index.
|
||||
*
|
||||
* @return colIndex
|
||||
*/
|
||||
public int getColIndex() {
|
||||
return colIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets column index.
|
||||
*
|
||||
* @param colIndex
|
||||
*/
|
||||
public void setColIndex(int colIndex) {
|
||||
this.colIndex = colIndex;
|
||||
}
|
||||
|
|
|
@ -20,48 +20,64 @@
|
|||
package com.raytheon.uf.common.monitor.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext;
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.monitor.MonitorAreaUtils;
|
||||
import com.raytheon.uf.common.monitor.data.AdjacentWfoMgr;
|
||||
import com.raytheon.uf.common.monitor.data.CommonTableConfig.ObsHistType;
|
||||
import com.raytheon.uf.common.monitor.xml.AreaIdXML;
|
||||
import com.raytheon.uf.common.monitor.xml.AreaIdXML.ZoneType;
|
||||
import com.raytheon.uf.common.monitor.xml.MonAreaConfigXML;
|
||||
import com.raytheon.uf.common.monitor.xml.StationIdXML;
|
||||
import com.raytheon.uf.common.monitor.xml.AreaIdXML.ZoneType;
|
||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||
import com.raytheon.uf.common.site.SiteMap;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Monitor configuration manager.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 5, 2010 mpduff Initial creation
|
||||
* Apr 29, 2011 DR#8986 zhao Read in Counties instead of Forecast Zones
|
||||
* Feb 21 2012 14413 zhao add code handling "adjacent areas"
|
||||
* Nov 20 2012 1297 skorolev Cleaned code
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public abstract class MonitorConfigurationManager {
|
||||
|
||||
public static final String COUNTY_TABLE = "mapdata.county";
|
||||
|
||||
public static final String FORECAST_ZONE_TABLE = "mapdata.zone";
|
||||
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(MonitorConfigurationManager.class);
|
||||
|
||||
/**
|
||||
* Maps county table in the PostgreSQL database.
|
||||
*/
|
||||
public static final String COUNTY_TABLE = "mapdata.county";
|
||||
|
||||
/**
|
||||
* Maps forecast zones table in the PostgreSQL database.
|
||||
*/
|
||||
public static final String FORECAST_ZONE_TABLE = "mapdata.zone";
|
||||
|
||||
/**
|
||||
* Maps marine zones table in the PostgreSQL database.
|
||||
*/
|
||||
public static final String MARINE_ZONE_TABLE = "mapdata.marinezones";
|
||||
|
||||
/**
|
||||
|
@ -77,41 +93,50 @@ public abstract class MonitorConfigurationManager {
|
|||
/**
|
||||
* List of newly added zones.
|
||||
*/
|
||||
protected ArrayList<String> addedZones = new ArrayList<String>();
|
||||
|
||||
protected List<String> addedZones = new ArrayList<String>();
|
||||
|
||||
/**
|
||||
* List of newly added stations.
|
||||
*/
|
||||
protected ArrayList<String> addedStations = new ArrayList<String>();
|
||||
|
||||
protected List<String> addedStations = new ArrayList<String>();
|
||||
|
||||
public abstract void readConfigXml(String currentSite);
|
||||
|
||||
/**
|
||||
* Read the XML configuration data for the current XML file name.
|
||||
* filename: monitor area config file name
|
||||
* adjAreaFileName: adjacent areas config file name
|
||||
* Station data type in the XML configuration file.
|
||||
*/
|
||||
protected void readConfigXml(String currentSite, String filename, String adjAreaFilename) {
|
||||
private String xmlDataType = StationIdXML.METAR;
|
||||
|
||||
/**
|
||||
* Reads area configuration file.
|
||||
*
|
||||
* @param currentSite
|
||||
*/
|
||||
public abstract void readConfigXml(String currentSite);
|
||||
|
||||
/**
|
||||
* Reads the XML configuration data for the current XML file name. filename:
|
||||
* monitor area config file name adjAreaFileName: adjacent areas config file
|
||||
* name
|
||||
*
|
||||
* @param currentSite
|
||||
* @param filename
|
||||
* @param adjAreaFilename
|
||||
*/
|
||||
protected void readConfigXml(String currentSite, String filename,
|
||||
String adjAreaFilename) {
|
||||
boolean monitorAreaFileExists = true;
|
||||
boolean adjacentAreaFileExists = true;
|
||||
try {
|
||||
// configXml = null;
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
|
||||
String monitorAreaFilePath = pm.getFile(
|
||||
pm.getContext(LocalizationType.COMMON_STATIC,
|
||||
LocalizationLevel.SITE), filename)
|
||||
.getAbsolutePath();
|
||||
|
||||
System.out.println("Read path = " + monitorAreaFilePath);
|
||||
|
||||
MonAreaConfigXML configXmltmp = (MonAreaConfigXML) SerializationUtil
|
||||
.jaxbUnmarshalFromXmlFile(monitorAreaFilePath.toString());
|
||||
configXml = configXmltmp;
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
System.err.println("No mopnitor area configuration file found");
|
||||
statusHandler.handle(Priority.ERROR,
|
||||
"No mopnitor area configuration file found", e);
|
||||
monitorAreaFileExists = false;
|
||||
}
|
||||
|
||||
|
@ -122,150 +147,137 @@ public abstract class MonitorConfigurationManager {
|
|||
pm.getContext(LocalizationType.COMMON_STATIC,
|
||||
LocalizationLevel.SITE), adjAreaFilename)
|
||||
.getAbsolutePath();
|
||||
|
||||
System.out.println("Read path = " + adjacentAreaFilePath);
|
||||
|
||||
MonAreaConfigXML configXmltmp = (MonAreaConfigXML) SerializationUtil
|
||||
.jaxbUnmarshalFromXmlFile(adjacentAreaFilePath.toString());
|
||||
adjAreaConfigXml = configXmltmp;
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
System.err.println("No adjacent area configuration file found");
|
||||
statusHandler.handle(Priority.ERROR,
|
||||
"No adjacent area configuration file found", e);
|
||||
adjacentAreaFileExists = false;
|
||||
}
|
||||
|
||||
try {
|
||||
// Check for a monitor area config file, if one does not exist, create and use defaults
|
||||
// Check for a monitor area config file, if one does not exist,
|
||||
// create and use defaults
|
||||
/**
|
||||
* Note: Read in "county" for CONUS site, "forecast zone" for OCONUS site
|
||||
* [DR#9905]
|
||||
*/
|
||||
* Note: Read in "county" for CONUS site, "forecast zone" for OCONUS
|
||||
* site [DR#9905]
|
||||
*/
|
||||
if (!monitorAreaFileExists) {
|
||||
ArrayList<String> zones;
|
||||
if ( SiteMap.getInstance().getSite4LetterId(currentSite).charAt(0) == 'K' ) { // CONUS site
|
||||
zones = MonitorAreaUtils.getUniqueCounties(currentSite);
|
||||
} else { // OCONUS site
|
||||
zones = MonitorAreaUtils.getForecastZones(currentSite);
|
||||
List<String> zones;
|
||||
if (SiteMap.getInstance().getSite4LetterId(currentSite)
|
||||
.charAt(0) == 'K') { // CONUS site
|
||||
zones = MonitorAreaUtils.getUniqueCounties(currentSite);
|
||||
} else { // OCONUS site
|
||||
zones = MonitorAreaUtils.getForecastZones(currentSite);
|
||||
}
|
||||
ArrayList<String> marineZones = MonitorAreaUtils.getMarineZones(currentSite);
|
||||
|
||||
if (zones.size() > 0) {
|
||||
for (String zone: zones) {
|
||||
AreaIdXML zoneXml = new AreaIdXML();
|
||||
zoneXml.setAreaId(zone);
|
||||
zoneXml.setType(ZoneType.REGULAR);
|
||||
ArrayList<StationIdXML> stations = MonitorAreaUtils.getZoneReportingStationXMLs(zone);
|
||||
if ( stations.size() > 0 ) {
|
||||
for ( StationIdXML station : stations ) {
|
||||
zoneXml.addStationIdXml(station);
|
||||
}
|
||||
}
|
||||
configXml.addAreaId(zoneXml);
|
||||
List<String> marineZones = MonitorAreaUtils
|
||||
.getMarineZones(currentSite);
|
||||
if (zones.isEmpty()) {
|
||||
for (String zone : zones) {
|
||||
AreaIdXML zoneXml = new AreaIdXML();
|
||||
zoneXml.setAreaId(zone);
|
||||
zoneXml.setType(ZoneType.REGULAR);
|
||||
List<StationIdXML> stations = MonitorAreaUtils
|
||||
.getZoneReportingStationXMLs(zone);
|
||||
if (stations.isEmpty()) {
|
||||
for (StationIdXML station : stations) {
|
||||
zoneXml.addStationIdXml(station);
|
||||
}
|
||||
}
|
||||
configXml.addAreaId(zoneXml);
|
||||
}
|
||||
}
|
||||
|
||||
// add marine zones if any exist
|
||||
if (marineZones.size() > 0) {
|
||||
if (marineZones.isEmpty()) {
|
||||
for (String zone : marineZones) {
|
||||
AreaIdXML zoneXml = new AreaIdXML();
|
||||
zoneXml.setAreaId(zone);
|
||||
zoneXml.setType(ZoneType.MARITIME);
|
||||
ArrayList<StationIdXML> stations = MonitorAreaUtils.getZoneReportingStationXMLs(zone);
|
||||
if ( stations.size() > 0 ) {
|
||||
for ( StationIdXML station : stations ) {
|
||||
zoneXml.addStationIdXml(station);
|
||||
}
|
||||
}
|
||||
configXml.addAreaId(zoneXml);
|
||||
AreaIdXML zoneXml = new AreaIdXML();
|
||||
zoneXml.setAreaId(zone);
|
||||
zoneXml.setType(ZoneType.MARITIME);
|
||||
List<StationIdXML> stations = MonitorAreaUtils
|
||||
.getZoneReportingStationXMLs(zone);
|
||||
if (stations.isEmpty()) {
|
||||
for (StationIdXML station : stations) {
|
||||
zoneXml.addStationIdXml(station);
|
||||
}
|
||||
}
|
||||
configXml.addAreaId(zoneXml);
|
||||
}
|
||||
}
|
||||
|
||||
saveConfigXml(filename);
|
||||
}
|
||||
|
||||
// Check for an adjacent area config file, if one does not exist, create and use defaults
|
||||
// Check for an adjacent area config file, if one does not exist,
|
||||
// create and use defaults
|
||||
if (!adjacentAreaFileExists) {
|
||||
AdjacentWfoMgr adjMgr = new AdjacentWfoMgr(currentSite);
|
||||
ArrayList<String> zones = adjMgr.getAdjZones();
|
||||
if (zones.size() > 0) {
|
||||
for (String zone: zones) {
|
||||
AreaIdXML zoneXml = new AreaIdXML();
|
||||
zoneXml.setAreaId(zone);
|
||||
zoneXml.setType(ZoneType.REGULAR);
|
||||
ArrayList<StationIdXML> stations = MonitorAreaUtils.getZoneReportingStationXMLs(zone);
|
||||
if ( stations.size() > 0 ) {
|
||||
for ( StationIdXML station : stations ) {
|
||||
zoneXml.addStationIdXml(station);
|
||||
}
|
||||
}
|
||||
adjAreaConfigXml.addAreaId(zoneXml);
|
||||
AdjacentWfoMgr adjMgr = new AdjacentWfoMgr(currentSite);
|
||||
List<String> zones = adjMgr.getAdjZones();
|
||||
if (zones.isEmpty()) {
|
||||
for (String zone : zones) {
|
||||
AreaIdXML zoneXml = new AreaIdXML();
|
||||
zoneXml.setAreaId(zone);
|
||||
zoneXml.setType(ZoneType.REGULAR);
|
||||
List<StationIdXML> stations = MonitorAreaUtils
|
||||
.getZoneReportingStationXMLs(zone);
|
||||
if (stations.isEmpty()) {
|
||||
for (StationIdXML station : stations) {
|
||||
zoneXml.addStationIdXml(station);
|
||||
}
|
||||
}
|
||||
adjAreaConfigXml.addAreaId(zoneXml);
|
||||
}
|
||||
}
|
||||
|
||||
saveAdjacentAreaConfigXml(adjAreaFilename);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.ERROR, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the monitor area XML configuration data to the current XML file name.
|
||||
* Save the monitor area XML configuration data to the current XML file
|
||||
* name.
|
||||
*
|
||||
* @param filename
|
||||
*/
|
||||
protected void saveConfigXml(String filename) {
|
||||
// Save the xml object to disk
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
LocalizationContext lc = pm.getContext(LocalizationType.COMMON_STATIC,
|
||||
LocalizationLevel.SITE);
|
||||
LocalizationFile newXmlFile = pm.getLocalizationFile(lc,
|
||||
filename);
|
||||
|
||||
LocalizationFile newXmlFile = pm.getLocalizationFile(lc, filename);
|
||||
if (newXmlFile.getFile().getParentFile().exists() == false) {
|
||||
System.out.println("Creating new directory");
|
||||
|
||||
if (newXmlFile.getFile().getParentFile().mkdirs() == false) {
|
||||
System.out.println("Could not create new directory...");
|
||||
}
|
||||
newXmlFile.getFile().getParentFile().mkdirs();
|
||||
}
|
||||
|
||||
try {
|
||||
System.out.println("Saving -- "
|
||||
+ newXmlFile.getFile().getAbsolutePath());
|
||||
SerializationUtil.jaxbMarshalToXmlFile(configXml, newXmlFile
|
||||
.getFile().getAbsolutePath());
|
||||
newXmlFile.save();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.ERROR, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the adjacent area XML configuration data to the current XML file name.
|
||||
* Save the adjacent area XML configuration data to the current XML file
|
||||
* name.
|
||||
*
|
||||
* @param filename
|
||||
*/
|
||||
protected void saveAdjacentAreaConfigXml(String filename) {
|
||||
// Save the xml object to disk
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
LocalizationContext lc = pm.getContext(LocalizationType.COMMON_STATIC,
|
||||
LocalizationLevel.SITE);
|
||||
LocalizationFile newXmlFile = pm.getLocalizationFile(lc,
|
||||
filename);
|
||||
|
||||
LocalizationFile newXmlFile = pm.getLocalizationFile(lc, filename);
|
||||
if (newXmlFile.getFile().getParentFile().exists() == false) {
|
||||
System.out.println("Creating new directory");
|
||||
|
||||
if (newXmlFile.getFile().getParentFile().mkdirs() == false) {
|
||||
System.out.println("Could not create new directory...");
|
||||
}
|
||||
newXmlFile.getFile().getParentFile().mkdirs();
|
||||
}
|
||||
|
||||
try {
|
||||
System.out.println("Saving -- "
|
||||
+ newXmlFile.getFile().getAbsolutePath());
|
||||
SerializationUtil.jaxbMarshalToXmlFile(adjAreaConfigXml, newXmlFile
|
||||
.getFile().getAbsolutePath());
|
||||
newXmlFile.save();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.ERROR, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -275,67 +287,67 @@ public abstract class MonitorConfigurationManager {
|
|||
* this class.
|
||||
*
|
||||
* @param areaId
|
||||
* The area Id (name)
|
||||
* @param type
|
||||
*/
|
||||
public void addArea(String areaId, ZoneType type) {
|
||||
ArrayList<AreaIdXML> areaXmlList = configXml.getAreaIds();
|
||||
List<AreaIdXML> areaXmlList = configXml.getAreaIds();
|
||||
boolean areaExists = false;
|
||||
for (AreaIdXML area: areaXmlList) {
|
||||
for (AreaIdXML area : areaXmlList) {
|
||||
if (area.getAreaId().equals(areaId)) {
|
||||
area.setType(type);
|
||||
areaExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (areaExists == false) {
|
||||
AreaIdXML area = new AreaIdXML();
|
||||
area.setAreaId(areaId);
|
||||
area.setType(type);
|
||||
configXml.addAreaId(area);
|
||||
configXml.addAreaId(area);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a new Area to the configuration. This method only adds the area, the
|
||||
* other info will need to be added to the area via the other methods in
|
||||
* this class.
|
||||
*
|
||||
* @param areaId
|
||||
* The area id
|
||||
* The area id
|
||||
* @param lat
|
||||
* The area latitude
|
||||
* The area latitude
|
||||
* @param lon
|
||||
* The area longitude
|
||||
* The area longitude
|
||||
* @param type
|
||||
* The area type
|
||||
* The area type
|
||||
* @param existingArea
|
||||
* Does the area already exist
|
||||
* Does the area already exist
|
||||
*/
|
||||
public void addArea(String areaId, double lat, double lon, ZoneType type, boolean existingArea) {
|
||||
ArrayList<AreaIdXML> areaXmlList = configXml.getAreaIds();
|
||||
public void addArea(String areaId, double lat, double lon, ZoneType type,
|
||||
boolean existingArea) {
|
||||
List<AreaIdXML> areaXmlList = configXml.getAreaIds();
|
||||
boolean areaExists = false;
|
||||
for (AreaIdXML area: areaXmlList) {
|
||||
for (AreaIdXML area : areaXmlList) {
|
||||
if (area.getAreaId().equals(areaId)) {
|
||||
area.setType(type);
|
||||
area.setCLat(lat);
|
||||
area.setCLon(lon);
|
||||
areaExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (areaExists == false) {
|
||||
AreaIdXML area = new AreaIdXML();
|
||||
area.setAreaId(areaId);
|
||||
area.setType(type);
|
||||
area.setCLat(lat);
|
||||
area.setCLon(lon);
|
||||
configXml.addAreaId(area);
|
||||
}
|
||||
|
||||
if ((existingArea == false) && !addedZones.contains(areaId)) {
|
||||
addedZones.add(areaId);
|
||||
if (lat < -90.0 || lat > 90.0) {
|
||||
area.setCLat(lat);
|
||||
}
|
||||
if (lon < -180.0 || lon > 180.0) {
|
||||
area.setCLon(lon);
|
||||
}
|
||||
configXml.addAreaId(area);
|
||||
if (!addedZones.contains(areaId)) {
|
||||
addedZones.add(areaId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -348,20 +360,22 @@ public abstract class MonitorConfigurationManager {
|
|||
* The station id
|
||||
* @param type
|
||||
* The station type
|
||||
* @param existingStation
|
||||
* Does the station already exist
|
||||
*/
|
||||
public void addStation(String areaId, String stationId, String type, boolean existingStation) {
|
||||
ArrayList<AreaIdXML> areaList = configXml.getAreaIds();
|
||||
public void addStation(String areaId, String stationId, String type,
|
||||
boolean existingStation) {
|
||||
List<AreaIdXML> areaList = configXml.getAreaIds();
|
||||
if (stationId.contains("#")) {
|
||||
stationId = stationId.substring(0, stationId.indexOf("#"));
|
||||
}
|
||||
|
||||
for (AreaIdXML area: areaList) {
|
||||
for (AreaIdXML area : areaList) {
|
||||
if (area.getAreaId().equals(areaId)) {
|
||||
StationIdXML stationXml = new StationIdXML();
|
||||
stationXml.setName(stationId);
|
||||
stationXml.setType(type);
|
||||
area.addStationIdXml(stationXml);
|
||||
addedStations.add(stationId);
|
||||
addedStations.add(stationId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -373,18 +387,14 @@ public abstract class MonitorConfigurationManager {
|
|||
* ZoneType of the area
|
||||
* @return List of areas of the specified type
|
||||
*/
|
||||
public ArrayList<String> getAreasByType(ZoneType type) {
|
||||
ArrayList<String> results = new ArrayList<String>();
|
||||
ArrayList<AreaIdXML> areaList = configXml.getAreaIds();
|
||||
|
||||
public List<String> getAreasByType(ZoneType type) {
|
||||
List<String> results = new ArrayList<String>();
|
||||
List<AreaIdXML> areaList = configXml.getAreaIds();
|
||||
for (AreaIdXML area : areaList) {
|
||||
if (area.getType().equals(type)) {
|
||||
results.add(area.getAreaId());
|
||||
}
|
||||
}
|
||||
|
||||
results.trimToSize();
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
|
@ -392,135 +402,115 @@ public abstract class MonitorConfigurationManager {
|
|||
* Get stations associated with an area.
|
||||
*
|
||||
* @param areaId
|
||||
* AreaId of associated stations
|
||||
* @return
|
||||
* List of stations for area
|
||||
* AreaId of associated stations
|
||||
* @return List of stations for area
|
||||
*/
|
||||
public ArrayList<String> getAreaStationsWithType(String areaId) {
|
||||
ArrayList<String> results = new ArrayList<String>();
|
||||
ArrayList<AreaIdXML> areaList = configXml.getAreaIds();
|
||||
for (AreaIdXML area: areaList) {
|
||||
public List<String> getAreaStationsWithType(String areaId) {
|
||||
List<String> results = new ArrayList<String>();
|
||||
List<AreaIdXML> areaList = configXml.getAreaIds();
|
||||
for (AreaIdXML area : areaList) {
|
||||
if (area.getAreaId().equals(areaId)) {
|
||||
ArrayList<StationIdXML> stationList = area.getStationIds();
|
||||
|
||||
List<StationIdXML> stationList = area.getStationIds();
|
||||
for (StationIdXML station : stationList) {
|
||||
results.add(station.getName() + "#" + station.getType());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get stations associated with an adjacent area.
|
||||
*
|
||||
* @param areaId
|
||||
* AreaId of associated stations
|
||||
* @return
|
||||
* List of stations for area
|
||||
* AreaId of associated stations
|
||||
* @return List of stations for area
|
||||
*/
|
||||
public ArrayList<String> getAdjacentAreaStationsWithType(String areaId) {
|
||||
ArrayList<String> results = new ArrayList<String>();
|
||||
ArrayList<AreaIdXML> areaList = adjAreaConfigXml.getAreaIds();
|
||||
for (AreaIdXML area: areaList) {
|
||||
public List<String> getAdjacentAreaStationsWithType(String areaId) {
|
||||
List<String> results = new ArrayList<String>();
|
||||
List<AreaIdXML> areaList = adjAreaConfigXml.getAreaIds();
|
||||
for (AreaIdXML area : areaList) {
|
||||
if (area.getAreaId().equals(areaId)) {
|
||||
ArrayList<StationIdXML> stationList = area.getStationIds();
|
||||
|
||||
List<StationIdXML> stationList = area.getStationIds();
|
||||
for (StationIdXML station : stationList) {
|
||||
results.add(station.getName() + "#" + station.getType());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get stations associated with an area.
|
||||
*
|
||||
* @param areaId
|
||||
* AreaId of associated stations
|
||||
* @return
|
||||
* List of stations for area
|
||||
* AreaId of associated stations
|
||||
* @return List of stations for area
|
||||
*/
|
||||
public ArrayList<String> getAreaStations(String areaId) {
|
||||
ArrayList<String> results = new ArrayList<String>();
|
||||
ArrayList<AreaIdXML> areaList = configXml.getAreaIds();
|
||||
for (AreaIdXML area: areaList) {
|
||||
public List<String> getAreaStations(String areaId) {
|
||||
List<String> results = new ArrayList<String>();
|
||||
List<AreaIdXML> areaList = configXml.getAreaIds();
|
||||
for (AreaIdXML area : areaList) {
|
||||
if (area.getAreaId().equals(areaId)) {
|
||||
ArrayList<StationIdXML> stationList = area.getStationIds();
|
||||
|
||||
List<StationIdXML> stationList = area.getStationIds();
|
||||
for (StationIdXML station : stationList) {
|
||||
results.add(station.getName());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get an area of a station.
|
||||
*
|
||||
* @param stationId
|
||||
* The station to get the area
|
||||
* @return
|
||||
* List of areas
|
||||
* The station to get the area
|
||||
* @return List of areas
|
||||
*/
|
||||
public ArrayList<String> getAreaByStationId(String stationId) {
|
||||
ArrayList<String> results = new ArrayList<String>();
|
||||
|
||||
ArrayList<AreaIdXML> areaList = configXml.getAreaIds();
|
||||
|
||||
for (AreaIdXML area: areaList) {
|
||||
ArrayList<StationIdXML> stationList = area.getStationIds();
|
||||
for (StationIdXML station: stationList) {
|
||||
public List<String> getAreaByStationId(String stationId) {
|
||||
List<String> results = new ArrayList<String>();
|
||||
List<AreaIdXML> areaList = configXml.getAreaIds();
|
||||
for (AreaIdXML area : areaList) {
|
||||
List<StationIdXML> stationList = area.getStationIds();
|
||||
for (StationIdXML station : stationList) {
|
||||
if (station.getName().equals(stationId)) {
|
||||
results.add(area.getAreaId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get all the stations associated with the areas.
|
||||
* @return
|
||||
*
|
||||
* @return List of stations
|
||||
*/
|
||||
public ArrayList<String> getStations() {
|
||||
ArrayList<AreaIdXML> areaXml = configXml.getAreaIds();
|
||||
ArrayList<String> stations = new ArrayList<String>();
|
||||
|
||||
for (AreaIdXML area: areaXml) {
|
||||
ArrayList<StationIdXML> stationList = area.getStationIds();
|
||||
for (StationIdXML station: stationList) {
|
||||
stations.add(station.getName() + "#" + station.getType() + "#" + area.getAreaId());
|
||||
public List<String> getStations() {
|
||||
List<AreaIdXML> areaXml = configXml.getAreaIds();
|
||||
List<String> stations = new ArrayList<String>();
|
||||
for (AreaIdXML area : areaXml) {
|
||||
List<StationIdXML> stationList = area.getStationIds();
|
||||
for (StationIdXML station : stationList) {
|
||||
stations.add(station.getName() + "#" + station.getType() + "#"
|
||||
+ area.getAreaId());
|
||||
}
|
||||
}
|
||||
|
||||
return stations;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all monitoring areas.
|
||||
*
|
||||
* @return ArrayList<String> of monitor area ids
|
||||
* @return List<String> of monitor area ids
|
||||
*/
|
||||
public ArrayList<String> getAreaList() {
|
||||
ArrayList<AreaIdXML> areaXmlList = configXml.getAreaIds();
|
||||
ArrayList<String> areaList = new ArrayList<String>();
|
||||
|
||||
public List<String> getAreaList() {
|
||||
List<AreaIdXML> areaXmlList = configXml.getAreaIds();
|
||||
List<String> areaList = new ArrayList<String>();
|
||||
for (AreaIdXML area : areaXmlList) {
|
||||
areaList.add(area.getAreaId());
|
||||
}
|
||||
|
||||
areaList.trimToSize();
|
||||
|
||||
return areaList;
|
||||
}
|
||||
|
||||
|
@ -529,16 +519,12 @@ public abstract class MonitorConfigurationManager {
|
|||
*
|
||||
* @return ArrayList<String> of adjacent area ids
|
||||
*/
|
||||
public ArrayList<String> getAdjacentAreaList() {
|
||||
ArrayList<AreaIdXML> areaXmlList = adjAreaConfigXml.getAreaIds();
|
||||
ArrayList<String> areaList = new ArrayList<String>();
|
||||
|
||||
public List<String> getAdjacentAreaList() {
|
||||
List<AreaIdXML> areaXmlList = adjAreaConfigXml.getAreaIds();
|
||||
List<String> areaList = new ArrayList<String>();
|
||||
for (AreaIdXML area : areaXmlList) {
|
||||
areaList.add(area.getAreaId());
|
||||
}
|
||||
|
||||
areaList.trimToSize();
|
||||
|
||||
return areaList;
|
||||
}
|
||||
|
||||
|
@ -552,33 +538,29 @@ public abstract class MonitorConfigurationManager {
|
|||
*/
|
||||
public void removeStation(String area, String station) {
|
||||
station = station.substring(0, station.indexOf("#"));
|
||||
|
||||
ArrayList<AreaIdXML> areaList = configXml.getAreaIds();
|
||||
|
||||
for (AreaIdXML areaXml: areaList) {
|
||||
List<AreaIdXML> areaList = configXml.getAreaIds();
|
||||
for (AreaIdXML areaXml : areaList) {
|
||||
if (areaXml.getAreaId().equals(area)) {
|
||||
ArrayList<StationIdXML> stationList = areaXml.getStationIds();
|
||||
|
||||
List<StationIdXML> stationList = areaXml.getStationIds();
|
||||
for (int i = 0; i < stationList.size(); i++) {
|
||||
if (stationList.get(i).getName().equals(station)) {
|
||||
stationList.remove(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove a station from the monitoring area.
|
||||
*
|
||||
* @param station
|
||||
* The station to remove
|
||||
* The station to remove
|
||||
*/
|
||||
public void removeStation(String station) {
|
||||
ArrayList<AreaIdXML> areaList = configXml.getAreaIds();
|
||||
|
||||
for (AreaIdXML areaXml: areaList) {
|
||||
ArrayList<StationIdXML> stationList = areaXml.getStationIds();
|
||||
List<AreaIdXML> areaList = configXml.getAreaIds();
|
||||
for (AreaIdXML areaXml : areaList) {
|
||||
List<StationIdXML> stationList = areaXml.getStationIds();
|
||||
for (int i = 0; i < stationList.size(); i++) {
|
||||
StationIdXML stationXml = stationList.get(i);
|
||||
if (stationXml.getName().equals(station)) {
|
||||
|
@ -588,43 +570,38 @@ public abstract class MonitorConfigurationManager {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get an AreaIdXML object.
|
||||
*
|
||||
* @param area
|
||||
* The area to get
|
||||
* @return
|
||||
* The AreaIdXML object
|
||||
* The area to get
|
||||
* @return The AreaIdXML object
|
||||
*/
|
||||
public AreaIdXML getAreaXml(String area) {
|
||||
ArrayList<AreaIdXML> areaList = configXml.getAreaIds();
|
||||
|
||||
for (AreaIdXML areaXml: areaList) {
|
||||
List<AreaIdXML> areaList = configXml.getAreaIds();
|
||||
for (AreaIdXML areaXml : areaList) {
|
||||
if (areaXml.equals(area)) {
|
||||
return areaXml;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove an area from the monitoring area.
|
||||
*
|
||||
* @param area
|
||||
* The area to remove
|
||||
* The area to remove
|
||||
*/
|
||||
public void removeArea(String area) {
|
||||
ArrayList<AreaIdXML> areaList = configXml.getAreaIds();
|
||||
|
||||
List<AreaIdXML> areaList = configXml.getAreaIds();
|
||||
for (int i = 0; i < areaList.size(); i++) {
|
||||
if (areaList.get(i).getAreaId().equals(area)) {
|
||||
if (areaList.get(i).getAreaId().equals(area)) {
|
||||
areaList.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < addedZones.size(); i++) {
|
||||
if (addedZones.get(i).equals(area)) {
|
||||
addedZones.remove(i);
|
||||
|
@ -632,12 +609,12 @@ public abstract class MonitorConfigurationManager {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove an added area.
|
||||
*
|
||||
* @param area
|
||||
* The area to remove
|
||||
* The area to remove
|
||||
*/
|
||||
public void removeAddedArea(String area) {
|
||||
for (int i = 0; i < addedZones.size(); i++) {
|
||||
|
@ -647,7 +624,7 @@ public abstract class MonitorConfigurationManager {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the timeWindow
|
||||
*/
|
||||
|
@ -673,12 +650,13 @@ public abstract class MonitorConfigurationManager {
|
|||
/**
|
||||
* @return the addedZones
|
||||
*/
|
||||
public ArrayList<String> getAddedZones() {
|
||||
public List<String> getAddedZones() {
|
||||
return addedZones;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param addedZones the addedZones to set
|
||||
* @param addedZones
|
||||
* the addedZones to set
|
||||
*/
|
||||
public void setAddedZones(ArrayList<String> addedZones) {
|
||||
this.addedZones = addedZones;
|
||||
|
@ -687,33 +665,42 @@ public abstract class MonitorConfigurationManager {
|
|||
/**
|
||||
* @return the addedStations
|
||||
*/
|
||||
public ArrayList<String> getAddedStations() {
|
||||
public List<String> getAddedStations() {
|
||||
return addedStations;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param addedStations the addedStations to set
|
||||
* @param addedStations
|
||||
* the addedStations to set
|
||||
*/
|
||||
public void setAddedStations(ArrayList<String> addedStations) {
|
||||
this.addedStations = addedStations;
|
||||
}
|
||||
|
||||
public ObsHistType getStationType(String theZone, String theStation) {
|
||||
ObsHistType result = null;
|
||||
ArrayList<AreaIdXML> areaList = configXml.getAreaIds();
|
||||
for (AreaIdXML area: areaList) {
|
||||
// TODO: Include Mesonet data types.
|
||||
/**
|
||||
* Get station type.
|
||||
*
|
||||
* @param theZone
|
||||
* @param theStation
|
||||
* @return type of station
|
||||
*/
|
||||
public ObsHistType getStationType(String theZone, String theStation) {
|
||||
ObsHistType result = null;
|
||||
List<AreaIdXML> areaList = configXml.getAreaIds();
|
||||
for (AreaIdXML area : areaList) {
|
||||
if (area.getAreaId().equals(theZone)) {
|
||||
ArrayList<StationIdXML> stationList = area.getStationIds();
|
||||
|
||||
List<StationIdXML> stationList = area.getStationIds();
|
||||
for (StationIdXML station : stationList) {
|
||||
if ( station.getName().equals(theStation) ) {
|
||||
String typeString = station.getType();
|
||||
result = typeString.equals("METAR")?ObsHistType.METAR:ObsHistType.Maritime;
|
||||
if (station.getName().equals(theStation)) {
|
||||
String typeString = station.getType();
|
||||
result = typeString.equals(xmlDataType) ? ObsHistType.METAR
|
||||
: ObsHistType.Maritime;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.raytheon.uf.edex.plugin.fssobs;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -13,40 +13,68 @@ import com.raytheon.edex.urifilter.URIFilter;
|
|||
import com.raytheon.edex.urifilter.URIGenerateMessage;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
||||
/**
|
||||
* FSSObs URI Filter
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 5, 2012 #1351 skorolev Cleaned code
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author skorolev
|
||||
* @version 1.0
|
||||
*/
|
||||
public class FSSObsURIFilter extends URIFilter {
|
||||
|
||||
public String stn; // station
|
||||
/** Station ID **/
|
||||
private String stn;
|
||||
|
||||
public String cwa;
|
||||
/** CWA **/
|
||||
private String cwa;
|
||||
|
||||
public String monitorName;
|
||||
/** Monitor's name **/
|
||||
private String monitorName;
|
||||
|
||||
public Coordinate stationCoor = null;
|
||||
/** Station coordinates **/
|
||||
private Coordinate stationCoor = null;
|
||||
|
||||
/** patterns used for matching URI's **/
|
||||
/** Patterns used for matching URI's **/
|
||||
private HashMap<String, Pattern> patternKeys = null;
|
||||
|
||||
public Pattern MetarPattern = null;
|
||||
/** METAR Pattern **/
|
||||
private Pattern MetarPattern = null;
|
||||
|
||||
public Pattern MaritimePattern = null;
|
||||
/** Maritime Pattern **/
|
||||
private Pattern MaritimePattern = null;
|
||||
|
||||
public Pattern MesowestPattern = null;
|
||||
/** Mesowest Pattern **/
|
||||
private Pattern MesowestPattern = null;
|
||||
|
||||
// IDecoderConstants
|
||||
|
||||
// callback to the generator
|
||||
public FSSObsGenerator fssgen = null;
|
||||
|
||||
// Current data type #METAR, #Maritime or #Mesonet
|
||||
/** Current data type #METAR, #Maritime or #Mesonet **/
|
||||
private String dataType;
|
||||
|
||||
/** Current Site **/
|
||||
private String currentSite = SiteUtil.getSite();
|
||||
|
||||
// dataTypes to process
|
||||
private HashMap<String, Pattern> dataTypes;
|
||||
/** Date format **/
|
||||
private static String datePattern = "yyyy-MM-dd_HH:mm:ss.S";
|
||||
|
||||
public static String datePattern = "yyyy-MM-dd_HH:mm:ss.S";
|
||||
/** Station type **/
|
||||
private enum StnType {
|
||||
METAR, MARITIME, MESONET
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param name
|
||||
* Monitor name
|
||||
*/
|
||||
public FSSObsURIFilter(String name) {
|
||||
super(name);
|
||||
logger.info("FSSObsFilter " + name + " Filter construction...");
|
||||
|
@ -61,22 +89,28 @@ public class FSSObsURIFilter extends URIFilter {
|
|||
setMatchURIs();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.edex.urifilter.URIFilter#setMatchURIs()
|
||||
*/
|
||||
@Override
|
||||
public void setMatchURIs() {
|
||||
ArrayList<String> stns = FSSObsUtils.getStations(name);
|
||||
List<String> stns = FSSObsUtils.getStations(name);
|
||||
Pattern pat = Pattern.compile("#");
|
||||
for (String st : stns) {
|
||||
String[] tokens = st.split("#");
|
||||
String[] tokens = pat.split(st);
|
||||
setStn(tokens[0]);
|
||||
setDataType(tokens[1]);
|
||||
if (getDataType().equals("METAR")) {
|
||||
if (getDataType().equals(StnType.METAR.name())) {
|
||||
setMetarPattern();
|
||||
getMatchURIs().put(getMetarPattern(), 0l);
|
||||
}
|
||||
if (getDataType().equals("MARITIME")) {
|
||||
if (getDataType().equals(StnType.MARITIME.name())) {
|
||||
setMaritimePattern();
|
||||
getMatchURIs().put(getMaritimePattern(), 0l);
|
||||
}
|
||||
if (getDataType().equals("MESONET")) {
|
||||
if (getDataType().equals(StnType.MESONET.name())) {
|
||||
setMesowestPattern();
|
||||
getMatchURIs().put(getMesowestPattern(), 0l);
|
||||
}
|
||||
|
@ -87,6 +121,13 @@ public class FSSObsURIFilter extends URIFilter {
|
|||
* @param message
|
||||
* @return boolean
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.edex.urifilter.URIFilter#isMatched(com.raytheon.edex.msg
|
||||
* .DataURINotificationMessage)
|
||||
*/
|
||||
@Override
|
||||
public boolean isMatched(DataURINotificationMessage message) {
|
||||
setCurrentTime(new Date(System.currentTimeMillis()));
|
||||
|
@ -112,11 +153,16 @@ public class FSSObsURIFilter extends URIFilter {
|
|||
+ " Age of MatchedURI: " + duration
|
||||
/ (1000 * 60) + " minutes");
|
||||
|
||||
// got a replacement
|
||||
logger.debug(name + ": not new. " + dataUri
|
||||
+ " Age of MatchURI: "
|
||||
+ getMatchURIs().get(pattern).longValue()
|
||||
/ (1000 * 60) + " minutes");
|
||||
if (logger.isDebugEnabled()) {
|
||||
// got a replacement
|
||||
logger.debug(name
|
||||
+ ": not new. "
|
||||
+ dataUri
|
||||
+ " Age of MatchURI: "
|
||||
+ getMatchURIs().get(pattern)
|
||||
.longValue() / (1000 * 60)
|
||||
+ " minutes");
|
||||
}
|
||||
if (duration <= getMatchURIs().get(pattern)
|
||||
.longValue()) {
|
||||
// replace
|
||||
|
@ -143,10 +189,10 @@ public class FSSObsURIFilter extends URIFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* gets the matching key for a matching pattern
|
||||
* Gets the matching key for a matching pattern
|
||||
*
|
||||
* @param pattern
|
||||
* @return
|
||||
* @return key
|
||||
*/
|
||||
public String getPatternName(Pattern pattern) {
|
||||
for (String key : patternKeys.keySet()) {
|
||||
|
@ -158,6 +204,12 @@ public class FSSObsURIFilter extends URIFilter {
|
|||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.edex.urifilter.URIFilter#applyWildCards(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
protected String applyWildCards(String key) {
|
||||
|
||||
|
@ -177,6 +229,12 @@ public class FSSObsURIFilter extends URIFilter {
|
|||
return newKey.toString();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.edex.urifilter.URIFilter#removeWildCards(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
protected String removeWildCards(String key) {
|
||||
|
||||
|
@ -198,22 +256,45 @@ public class FSSObsURIFilter extends URIFilter {
|
|||
return newKey.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets CWA
|
||||
*
|
||||
* @return cwa
|
||||
*/
|
||||
public String getCwa() {
|
||||
return cwa;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets CWA
|
||||
*
|
||||
* @param cwa
|
||||
*/
|
||||
public void setCwa(String cwa) {
|
||||
this.cwa = cwa;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets station coordinates
|
||||
*
|
||||
* @return stationCoor
|
||||
*/
|
||||
public Coordinate getStationCoor() {
|
||||
return stationCoor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Metar Pattern.
|
||||
*
|
||||
* @return MetarPattern
|
||||
*/
|
||||
public Pattern getMetarPattern() {
|
||||
return MetarPattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Metar Pattern.
|
||||
*/
|
||||
public void setMetarPattern() {
|
||||
// "/obs/2010-11-01_14:15:00.0/METAR<SPECI???>/null/K0A9/36.371/-82.173"
|
||||
MetarPattern = Pattern.compile("/obs/" + wildCard + uriSeperator
|
||||
|
@ -221,10 +302,18 @@ public class FSSObsURIFilter extends URIFilter {
|
|||
+ uriSeperator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Maritime Pattern.
|
||||
*
|
||||
* @return MaritimePattern
|
||||
*/
|
||||
public Pattern getMaritimePattern() {
|
||||
return MaritimePattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Maritime Pattern
|
||||
*/
|
||||
public void setMaritimePattern() {
|
||||
// /sfcobs/2010-10-28_10:36:00.0/1004/null/BEPB6/32.373/-64.703
|
||||
MaritimePattern = Pattern.compile("/sfcobs/" + wildCard + uriSeperator
|
||||
|
@ -233,6 +322,8 @@ public class FSSObsURIFilter extends URIFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets Mesowest Pattern.
|
||||
*
|
||||
* @return the mesowestPattern
|
||||
*/
|
||||
public Pattern getMesowestPattern() {
|
||||
|
@ -240,6 +331,8 @@ public class FSSObsURIFilter extends URIFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets Mesowest Pattern.
|
||||
*
|
||||
* @param mesowestPattern
|
||||
* the mesowestPattern to set
|
||||
*/
|
||||
|
@ -250,12 +343,19 @@ public class FSSObsURIFilter extends URIFilter {
|
|||
+ uriSeperator + getStn());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.edex.urifilter.URIFilter#createGenerateMessage()
|
||||
*/
|
||||
@Override
|
||||
public URIGenerateMessage createGenerateMessage() {
|
||||
return new FSSObsURIGenrtMessage(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets station name
|
||||
*
|
||||
* @return the stn
|
||||
*/
|
||||
public String getStn() {
|
||||
|
@ -263,6 +363,8 @@ public class FSSObsURIFilter extends URIFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets station name.
|
||||
*
|
||||
* @param stn
|
||||
* the stn to set
|
||||
*/
|
||||
|
@ -271,14 +373,18 @@ public class FSSObsURIFilter extends URIFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets data type.
|
||||
*
|
||||
* @param the
|
||||
* dataType to set
|
||||
*/
|
||||
public void setDataType(String marine) {
|
||||
this.dataType = marine;
|
||||
public void setDataType(String type) {
|
||||
this.dataType = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets data type.
|
||||
*
|
||||
* @return the dataType
|
||||
*/
|
||||
public String getDataType() {
|
||||
|
@ -286,6 +392,8 @@ public class FSSObsURIFilter extends URIFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets Monitor Name.
|
||||
*
|
||||
* @return the monitorName
|
||||
*/
|
||||
public String getMonitorName() {
|
||||
|
@ -293,6 +401,8 @@ public class FSSObsURIFilter extends URIFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets Monitor Name.
|
||||
*
|
||||
* @param monitorName
|
||||
* the monitorName to set
|
||||
*/
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package com.raytheon.uf.edex.plugin.fssobs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
|
||||
import com.raytheon.edex.site.SiteUtil;
|
||||
|
@ -46,6 +47,7 @@ import com.raytheon.uf.edex.pointdata.PointDataQuery;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 12, 2010 skorolev Initial creation
|
||||
* Nov 26, 2012 1297 skorolev Changed ArrayList to List.Clean code
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -57,17 +59,56 @@ public class FSSObsUtils {
|
|||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(FSSObsUtils.class);
|
||||
|
||||
/**
|
||||
* Value of missed data.
|
||||
*/
|
||||
public static final float MISSING = -9999.0f;
|
||||
|
||||
// The constant representing the sky condition for sky clear
|
||||
public static final int SKC_SKY_CONDITION = 9999999;
|
||||
/**
|
||||
* The constant representing the sky condition for sky clear
|
||||
*/
|
||||
private static final int SKC_SKY_CONDITION = 9999999;
|
||||
|
||||
// The constant representing the sky condition for clear sky
|
||||
public static final int CLR_SKY_CONDITION = 8888888;
|
||||
/**
|
||||
* The constant representing the sky condition for clear sky
|
||||
*/
|
||||
private static final int CLR_SKY_CONDITION = 8888888;
|
||||
|
||||
/** Monitor ID **/
|
||||
private enum monID {
|
||||
ss, fog, snow
|
||||
};
|
||||
|
||||
/** Plug-in name **/
|
||||
private enum plgn {
|
||||
obs, sfcobs, ldadmesonet
|
||||
};
|
||||
|
||||
/** Selected column in database **/
|
||||
private static String slct = "dataURI";
|
||||
|
||||
/** Equal sign **/
|
||||
private static String equ = "=";
|
||||
|
||||
/** Database **/
|
||||
private static String db = "metadata";
|
||||
|
||||
/** SQL expression **/
|
||||
private static String sqlexp = "select name from common_obs_spatial where ( catalogtype=1 or catalogtype=33 or catalogtype = 32 or catalogtype = 1000) and stationid = '";
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
private FSSObsUtils() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets METAR records from Obs.
|
||||
*
|
||||
* @param uri
|
||||
* @return Metar record
|
||||
* @throws PluginException
|
||||
*/
|
||||
public static FSSObsRecord getRecordFromMetar(String uri)
|
||||
throws PluginException {
|
||||
|
||||
|
@ -75,14 +116,13 @@ public class FSSObsUtils {
|
|||
PointDataQuery request = null;
|
||||
PointDataContainer result = null;
|
||||
try {
|
||||
request = new PointDataQuery("obs");
|
||||
request = new PointDataQuery(plgn.obs.toString());
|
||||
request.requestAllLevels();
|
||||
request.addParameter("dataURI", uri, "=");
|
||||
request.addParameter(slct, uri, equ);
|
||||
request.setParameters(FSSObsDataTransform.OBS_PARAMS_LIST);
|
||||
result = request.execute();
|
||||
if (result != null) {
|
||||
recFromMetar = FSSObsDataTransform.fromMetarRecord(result);
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
|
@ -90,42 +130,60 @@ public class FSSObsUtils {
|
|||
return recFromMetar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets station name from database.
|
||||
*
|
||||
* @param stnId
|
||||
* @return station name
|
||||
*/
|
||||
public static String getStationName(String stnId) {
|
||||
String retVal = null;
|
||||
ISpatialQuery sq = null;
|
||||
String sql = "select name from common_obs_spatial where ( catalogtype=1 or catalogtype=33 or catalogtype = 32 or catalogtype = 1000) and stationid = '"
|
||||
+ stnId + "'";
|
||||
String sql = sqlexp + stnId + "'";
|
||||
try {
|
||||
sq = SpatialQueryFactory.create();
|
||||
Object[] results = sq.dbRequest(sql, "metadata");
|
||||
Object[] results = sq.dbRequest(sql, db);
|
||||
retVal = (String) results[0];
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.ERROR, e.getMessage());
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Maritime record from sfcobs.
|
||||
*
|
||||
* @param uri
|
||||
* @return maritaime record
|
||||
* @throws PluginException
|
||||
*/
|
||||
public static FSSObsRecord getRecordFromMaritime(String uri)
|
||||
throws PluginException {
|
||||
FSSObsRecord recFromMaritime = null;
|
||||
PointDataQuery request = null;
|
||||
PointDataContainer result = null;
|
||||
try {
|
||||
request = new PointDataQuery("sfcobs");
|
||||
request.addParameter("dataURI", uri, "=");
|
||||
request = new PointDataQuery(plgn.sfcobs.toString());
|
||||
request.addParameter(slct, uri, equ);
|
||||
request.setParameters(FSSObsDataTransform.SFCOBS_PARAMS_LIST);
|
||||
result = request.execute();
|
||||
if (result != null) {
|
||||
recFromMaritime = FSSObsDataTransform
|
||||
.fromMaritimeRecord(result);
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
statusHandler.handle(Priority.ERROR, e.getLocalizedMessage(), e);
|
||||
}
|
||||
return recFromMaritime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Mesowest record from ldadmesonet.
|
||||
*
|
||||
* @param uri
|
||||
* @return mesowest record
|
||||
* @throws PluginException
|
||||
*/
|
||||
public static FSSObsRecord getRecordFromMesowest(String uri)
|
||||
throws PluginException {
|
||||
|
||||
|
@ -133,8 +191,8 @@ public class FSSObsUtils {
|
|||
PointDataQuery request = null;
|
||||
PointDataContainer result = null;
|
||||
try {
|
||||
request = new PointDataQuery("ldadmesonet");
|
||||
request.addParameter("dataURI", uri, "=");
|
||||
request = new PointDataQuery(plgn.ldadmesonet.toString());
|
||||
request.addParameter(slct, uri, equ);
|
||||
request.setParameters(FSSObsDataTransform.MESOWEST_PARAMS_LIST);
|
||||
result = request.execute();
|
||||
if (result != null) {
|
||||
|
@ -163,18 +221,14 @@ public class FSSObsUtils {
|
|||
|
||||
// Temperature must be lower than -4.8C (23F) to avoid a calculation
|
||||
// error (a negative number to -1.668 power is NAN)
|
||||
|
||||
if (temperatureC < -4.8)
|
||||
fbMinutes = ((-24.5f * ((0.667f * windspeedKPH) + 4.8f)) + 2111f)
|
||||
* (float) Math.pow((-4.8 - temperatureC), -1.668);
|
||||
else
|
||||
return MISSING;
|
||||
|
||||
// Check for frost bite boundaries
|
||||
|
||||
if (!(fbMinutes <= 30 && windspeedKPH > 25.0 && windspeedKPH <= 80.5))
|
||||
fbMinutes = MISSING;
|
||||
|
||||
return fbMinutes;
|
||||
}
|
||||
|
||||
|
@ -189,11 +243,9 @@ public class FSSObsUtils {
|
|||
*/
|
||||
public static float calcWindChill(float temp, float windSpd) {
|
||||
float spd;
|
||||
|
||||
/* arbitrarily do the calculation only for temps at or below 60F */
|
||||
if (temp > 16.)
|
||||
return 1e37f;
|
||||
|
||||
/* no chilling if speed < 4 mph = 6.44km/h */
|
||||
if (windSpd < 6.4)
|
||||
return temp;
|
||||
|
@ -202,7 +254,6 @@ public class FSSObsUtils {
|
|||
spd = 128.75f;
|
||||
else
|
||||
spd = windSpd;
|
||||
|
||||
spd = (float) Math.pow(spd, 0.16);
|
||||
float windChillTemp = 13.12f + 0.6215f * temp - 11.37f * spd + 0.3965f
|
||||
* temp * spd;
|
||||
|
@ -258,7 +309,6 @@ public class FSSObsUtils {
|
|||
*/
|
||||
public static Float getRH(float dewpoint, float temperature) {
|
||||
float retVal = MISSING;
|
||||
|
||||
// From http://www.hpc.ncep.noaa.gov/html/dewrh.shtml
|
||||
// to Celsius
|
||||
if (dewpoint != MISSING && temperature != MISSING) {
|
||||
|
@ -277,6 +327,8 @@ public class FSSObsUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets snow data.
|
||||
*
|
||||
* @param tableRow
|
||||
* @return -- Snow data from METAR
|
||||
*/
|
||||
|
@ -310,10 +362,9 @@ public class FSSObsUtils {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((tableRow.getTemperature() != MISSING)
|
||||
&& (tableRow.getTemperature() < 4.4f) // 277.6) // 40 F =
|
||||
// 4.44444 Celsium
|
||||
&& (tableRow.getTemperature() < 4.4f)
|
||||
// 277.6 K = 40 F = 4.44444 Celsium
|
||||
&& (tableRow.getWindSpeed() != MISSING)
|
||||
&& (tableRow.getWindSpeed() <= 43.0f && tableRow.getWindSpeed() >= 14.0f)) {
|
||||
float speedKPH = tableRow.getWindSpeed() * 1.6f;
|
||||
|
@ -326,9 +377,10 @@ public class FSSObsUtils {
|
|||
return retVal;
|
||||
}
|
||||
|
||||
// Routine to calculate dewpoint depression from temperature
|
||||
// and relative humidity.
|
||||
/**
|
||||
* Routine to calculate dewpoint depression from temperature and relative
|
||||
* humidity.
|
||||
*
|
||||
* @param TK
|
||||
* - temperature in K
|
||||
* @param RH
|
||||
|
@ -346,30 +398,36 @@ public class FSSObsUtils {
|
|||
return retVal;
|
||||
}
|
||||
|
||||
public static ArrayList<String> getStations(String monitor) {
|
||||
/**
|
||||
* Gets stations which FSS monitor is using.
|
||||
*
|
||||
* @param monitor
|
||||
* @return stations
|
||||
*/
|
||||
public static List<String> getStations(String monitor) {
|
||||
String currentSite = SiteUtil.getSite();
|
||||
ArrayList<String> stations = new ArrayList<String>();
|
||||
// Which monitor should use this station: fog, ss or snow
|
||||
|
||||
if (monitor.equals("fog")) {
|
||||
List<String> stations = new ArrayList<String>();
|
||||
// Which monitor should use this station: fog, ss or snow
|
||||
if (monitor.equals(monID.fog.name())) {
|
||||
FogMonitorConfigurationManager fogConfigManager = FogMonitorConfigurationManager
|
||||
.getInstance();
|
||||
fogConfigManager.readConfigXml(currentSite);
|
||||
ArrayList<String> fogStations = fogConfigManager.getStations();
|
||||
List<String> fogStations = fogConfigManager.getStations();
|
||||
stations.addAll(fogStations);
|
||||
}
|
||||
if (monitor.equals("ss")) {
|
||||
if (monitor.equals(monID.ss.name())) {
|
||||
SSMonitorConfigurationManager ssConfigManger = SSMonitorConfigurationManager
|
||||
.getInstance();
|
||||
ssConfigManger.readConfigXml(currentSite);
|
||||
ArrayList<String> ssStaitions = ssConfigManger.getStations();
|
||||
List<String> ssStaitions = ssConfigManger.getStations();
|
||||
stations.addAll(ssStaitions);
|
||||
}
|
||||
if (monitor.equals("snow")) {
|
||||
if (monitor.equals(monID.snow.name())) {
|
||||
SnowMonitorConfigurationManager snowConfigManager = SnowMonitorConfigurationManager
|
||||
.getInstance();
|
||||
snowConfigManager.readConfigXml(currentSite);
|
||||
ArrayList<String> snowStations = snowConfigManager.getStations();
|
||||
List<String> snowStations = snowConfigManager.getStations();
|
||||
stations.addAll(snowStations);
|
||||
}
|
||||
return stations;
|
||||
|
|
Loading…
Add table
Reference in a new issue