Issue #1790 Changes for non-blocking dialogs DescriptionDlg, FloodCategoryDlg, FloodDamageDlg, GageHistoryDlg, HydroGenConfigDlg, LowWaterDlg, NwrTransmitterDlg, PreferencesDlg, PublicationsDlg and QcAlertAlarmLimitsDlg.
Change-Id: Ic4a3ccb3e13344244415786591accbffda0d0e96 Former-commit-id:7bb8189127
[formerly1af1e9e61a
] [formerly75c1470c3a
] [formerly7bb8189127
[formerly1af1e9e61a
] [formerly75c1470c3a
] [formerly2dafedfed2
[formerly75c1470c3a
[formerly b9d5321cdeaeb9b37783e96b76321ddb90c0d6dd]]]] Former-commit-id:2dafedfed2
Former-commit-id:67e4e40ada
[formerly0018cad990
] [formerly ee26ccec332b7bf02995b1fa50cc61721ea41820 [formerly399a54cc4b
]] Former-commit-id: 3194ac7c31f2fe53d6e12847db6c9597d4d10031 [formerlycf3f91c2ee
] Former-commit-id:2b5d99a69e
This commit is contained in:
parent
05ff0b87bf
commit
f82345061a
13 changed files with 1079 additions and 578 deletions
|
@ -139,6 +139,16 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
* Changes for non-blocking DataIngestFilterDlg.
|
||||
* Changes for non-blocking DataPurgeParamsDlg.
|
||||
* Changes for non-blocking DatumDlg.
|
||||
* Changes for non-blocking DescriptionDlg.
|
||||
* Changes for non-blocking FloodCategoryDlg.
|
||||
* Changes for non-blocking FloodDamageDlg.
|
||||
* Changes for non-blocking GageHistoryDlg.
|
||||
* Changes for non-blocking HydroGenConfigDlg.
|
||||
* Changes for non-blocking LowWaterDlg.
|
||||
* Changes for non-blocking NwrTransmitterDlg.
|
||||
* Changes for non-blocking PreferencesDlg.
|
||||
* Changes for non-blocking PublicationsDlg.
|
||||
* Changes for non-blocking QcAlertAlarmLimitsDlg.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -201,6 +211,56 @@ public class HydroBaseDlg extends CaveSWTDialog implements IGetSortType,
|
|||
*/
|
||||
private final Map<String, DatumDlg> datumDlgMap = new HashMap<String, DatumDlg>();
|
||||
|
||||
/**
|
||||
* Allow one description dialog per station.
|
||||
*/
|
||||
private final Map<String, DescriptionDlg> descDlgMap = new HashMap<String, DescriptionDlg>();
|
||||
|
||||
/**
|
||||
* Allow one flood category dialog per station.
|
||||
*/
|
||||
private final Map<String, FloodCategoryDlg> floodCatDlgMap = new HashMap<String, FloodCategoryDlg>();;
|
||||
|
||||
/**
|
||||
* Allow one flood damage dialog per station.
|
||||
*/
|
||||
private final Map<String, FloodDamageDlg> floodDamDlgMap = new HashMap<String, FloodDamageDlg>();
|
||||
|
||||
/**
|
||||
* Allow one gage history dialog per station.
|
||||
*/
|
||||
private final Map<String, GageHistoryDlg> ghDlgMap = new HashMap<String, GageHistoryDlg>();
|
||||
|
||||
/**
|
||||
* Allow one Hydrogen configuration dialog.
|
||||
*/
|
||||
private HydroGenConfigDlg hydroGenDlg;
|
||||
|
||||
/**
|
||||
* Allow one low water dialog per station.
|
||||
*/
|
||||
private final Map<String, LowWaterDlg> lowWaterDlgMap = new HashMap<String, LowWaterDlg>();
|
||||
|
||||
/**
|
||||
* Allow one NWR Transmitter Towers dialog.
|
||||
*/
|
||||
private NwrTransmitterDlg nwrTransDlg;
|
||||
|
||||
/**
|
||||
* Allow one preferences dialog.
|
||||
*/
|
||||
private PreferencesDlg prefDlg;
|
||||
|
||||
/**
|
||||
* Allow one publication dialog per station.
|
||||
*/
|
||||
private final Map<String, PublicationsDlg> publicationsDlgMap = new HashMap<String, PublicationsDlg>();
|
||||
|
||||
/**
|
||||
* Allow one QC alart/alarm limits dialog.
|
||||
*/
|
||||
private QcAlertAlarmLimitsDlg qcAlertAlarmDlg;
|
||||
|
||||
/**
|
||||
* Flood category menu item.
|
||||
*/
|
||||
|
@ -454,10 +514,13 @@ public class HydroBaseDlg extends CaveSWTDialog implements IGetSortType,
|
|||
}
|
||||
|
||||
private void openPreferencesDialog() {
|
||||
PreferencesDlg prefDlg = new PreferencesDlg(shell);
|
||||
if (prefDlg == null || prefDlg.isDisposed()) {
|
||||
prefDlg = new PreferencesDlg(shell);
|
||||
prefDlg.addListener(this);
|
||||
prefDlg.open();
|
||||
prefDlg.removeListener(this);
|
||||
} else {
|
||||
prefDlg.bringToTop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -559,9 +622,26 @@ public class HydroBaseDlg extends CaveSWTDialog implements IGetSortType,
|
|||
gageHistoryMI.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
GageHistoryDlg ghDlg = new GageHistoryDlg(shell,
|
||||
getStationAndName(), getSelectedLocation().getStation());
|
||||
String lid = getSelectedLocation().getStation();
|
||||
GageHistoryDlg ghDlg = ghDlgMap.get(lid);
|
||||
|
||||
if (ghDlg == null) {
|
||||
ghDlg = new GageHistoryDlg(shell, getStationAndName(), lid);
|
||||
ghDlg.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof String) {
|
||||
String lid = returnValue.toString();
|
||||
ghDlgMap.remove(lid);
|
||||
}
|
||||
}
|
||||
});
|
||||
ghDlgMap.put(lid, ghDlg);
|
||||
ghDlg.open();
|
||||
} else {
|
||||
ghDlg.bringToTop();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -623,9 +703,27 @@ public class HydroBaseDlg extends CaveSWTDialog implements IGetSortType,
|
|||
floodCategoryMI.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
FloodCategoryDlg floodCatDlg = new FloodCategoryDlg(shell,
|
||||
getStationAndName(), getSelectedLocation().getStation());
|
||||
String lid = getSelectedLocation().getStation();
|
||||
FloodCategoryDlg floodCatDlg = floodCatDlgMap.get(lid);
|
||||
|
||||
if (floodCatDlg == null) {
|
||||
floodCatDlg = new FloodCategoryDlg(shell,
|
||||
getStationAndName(), lid);
|
||||
floodCatDlg.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof String) {
|
||||
String lid = returnValue.toString();
|
||||
floodCatDlgMap.remove(lid);
|
||||
}
|
||||
}
|
||||
});
|
||||
floodCatDlgMap.put(lid, floodCatDlg);
|
||||
floodCatDlg.open();
|
||||
} else {
|
||||
floodCatDlg.bringToTop();
|
||||
}
|
||||
}
|
||||
});
|
||||
riverGageMenuItems.add(floodCategoryMI);
|
||||
|
@ -667,9 +765,27 @@ public class HydroBaseDlg extends CaveSWTDialog implements IGetSortType,
|
|||
floodDamageMI.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
FloodDamageDlg floodDamDlg = new FloodDamageDlg(shell,
|
||||
getStationAndName(), getSelectedLocation().getStation());
|
||||
String lid = getSelectedLocation().getStation();
|
||||
FloodDamageDlg floodDamDlg = floodDamDlgMap.get(lid);
|
||||
|
||||
if (floodDamDlg == null) {
|
||||
floodDamDlg = new FloodDamageDlg(shell,
|
||||
getStationAndName(), lid);
|
||||
floodDamDlg.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof String) {
|
||||
String lid = returnValue.toString();
|
||||
floodDamDlgMap.remove(lid);
|
||||
}
|
||||
}
|
||||
});
|
||||
floodDamDlgMap.put(lid, floodDamDlg);
|
||||
floodDamDlg.open();
|
||||
} else {
|
||||
floodDamDlg.bringToTop();
|
||||
}
|
||||
}
|
||||
});
|
||||
riverGageMenuItems.add(floodDamageMI);
|
||||
|
@ -724,9 +840,27 @@ public class HydroBaseDlg extends CaveSWTDialog implements IGetSortType,
|
|||
lowWaterMI.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
LowWaterDlg lowWaterDlg = new LowWaterDlg(shell,
|
||||
getStationAndName(), getSelectedLocation().getStation());
|
||||
String lid = getSelectedLocation().getStation();
|
||||
LowWaterDlg lowWaterDlg = lowWaterDlgMap.get(lid);
|
||||
|
||||
if (lowWaterDlg == null) {
|
||||
lowWaterDlg = new LowWaterDlg(shell, getStationAndName(),
|
||||
lid);
|
||||
lowWaterDlg.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof String) {
|
||||
String lid = returnValue.toString();
|
||||
lowWaterDlgMap.remove(lid);
|
||||
}
|
||||
}
|
||||
});
|
||||
lowWaterDlgMap.put(lid, lowWaterDlg);
|
||||
lowWaterDlg.open();
|
||||
} else {
|
||||
lowWaterDlg.bringToTop();
|
||||
}
|
||||
}
|
||||
});
|
||||
riverGageMenuItems.add(lowWaterMI);
|
||||
|
@ -801,9 +935,27 @@ public class HydroBaseDlg extends CaveSWTDialog implements IGetSortType,
|
|||
descriptionMI.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
DescriptionDlg descDlg = new DescriptionDlg(shell,
|
||||
getStationAndName(), getSelectedLocation().getStation());
|
||||
String lid = getSelectedLocation().getStation();
|
||||
DescriptionDlg descDlg = descDlgMap.get(lid);
|
||||
|
||||
if (descDlg == null) {
|
||||
descDlg = new DescriptionDlg(shell, getStationAndName(),
|
||||
lid);
|
||||
descDlg.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof String) {
|
||||
String lid = returnValue.toString();
|
||||
descDlgMap.remove(lid);
|
||||
}
|
||||
}
|
||||
});
|
||||
descDlgMap.put(lid, descDlg);
|
||||
descDlg.open();
|
||||
} else {
|
||||
descDlg.bringToTop();
|
||||
}
|
||||
}
|
||||
});
|
||||
riverGageMenuItems.add(descriptionMI);
|
||||
|
@ -817,9 +969,26 @@ public class HydroBaseDlg extends CaveSWTDialog implements IGetSortType,
|
|||
publicationsMI.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
PublicationsDlg publicationsDlg = new PublicationsDlg(shell,
|
||||
getStationAndName(), getSelectedLocation().getStation());
|
||||
String lid = getSelectedLocation().getStation();
|
||||
PublicationsDlg publicationsDlg = publicationsDlgMap.get(lid);
|
||||
if (publicationsDlg == null) {
|
||||
publicationsDlg = new PublicationsDlg(shell,
|
||||
getStationAndName(), lid);
|
||||
publicationsDlg.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof String) {
|
||||
String lid = returnValue.toString();
|
||||
publicationsDlgMap.remove(lid);
|
||||
}
|
||||
}
|
||||
});
|
||||
publicationsDlgMap.put(lid, publicationsDlg);
|
||||
publicationsDlg.open();
|
||||
} else {
|
||||
publicationsDlg.bringToTop();
|
||||
}
|
||||
}
|
||||
});
|
||||
riverGageMenuItems.add(publicationsMI);
|
||||
|
@ -931,9 +1100,12 @@ public class HydroBaseDlg extends CaveSWTDialog implements IGetSortType,
|
|||
qcAlertAlarmMI.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
QcAlertAlarmLimitsDlg qcAlertAlarmDlg = new QcAlertAlarmLimitsDlg(
|
||||
shell);
|
||||
if (qcAlertAlarmDlg == null || qcAlertAlarmDlg.isDisposed()) {
|
||||
qcAlertAlarmDlg = new QcAlertAlarmLimitsDlg(shell);
|
||||
qcAlertAlarmDlg.open();
|
||||
} else {
|
||||
qcAlertAlarmDlg.bringToTop();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1139,8 +1311,12 @@ public class HydroBaseDlg extends CaveSWTDialog implements IGetSortType,
|
|||
nwrTransmitterMI.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
NwrTransmitterDlg nwrTransDlg = new NwrTransmitterDlg(shell);
|
||||
if (nwrTransDlg == null || nwrTransDlg.isDisposed()) {
|
||||
nwrTransDlg = new NwrTransmitterDlg(shell);
|
||||
nwrTransDlg.open();
|
||||
} else {
|
||||
nwrTransDlg.bringToTop();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1181,8 +1357,12 @@ public class HydroBaseDlg extends CaveSWTDialog implements IGetSortType,
|
|||
hydroGenConfMI.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
HydroGenConfigDlg hydroGenDlg = new HydroGenConfigDlg(shell);
|
||||
if (hydroGenDlg == null || hydroGenDlg.isDisposed()) {
|
||||
hydroGenDlg = new HydroGenConfigDlg(shell);
|
||||
hydroGenDlg.open();
|
||||
} else {
|
||||
hydroGenDlg.bringToTop();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -206,7 +206,7 @@ public class CountyStateDlg extends CaveSWTDialog {
|
|||
CountiesData rval = new CountiesData();
|
||||
rval.setCounty("COUNTY");
|
||||
rval.setState("STATE");
|
||||
String labelStr = formatCountState(rval);
|
||||
String labelStr = formatCountyState(rval);
|
||||
return labelStr;
|
||||
}
|
||||
|
||||
|
@ -232,7 +232,7 @@ public class CountyStateDlg extends CaveSWTDialog {
|
|||
countyStateList.removeAll();
|
||||
|
||||
for (CountiesData currCounty : countiesData) {
|
||||
countyStateList.add(formatCountState(currCounty));
|
||||
countyStateList.add(formatCountyState(currCounty));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -242,7 +242,7 @@ public class CountyStateDlg extends CaveSWTDialog {
|
|||
* @param countiesData
|
||||
* @return formatedString
|
||||
*/
|
||||
private String formatCountState(CountiesData countiesData) {
|
||||
private String formatCountyState(CountiesData countiesData) {
|
||||
return String.format("%-36s %-2s", countiesData.getCounty(),
|
||||
countiesData.getState());
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ public class CountyStateDlg extends CaveSWTDialog {
|
|||
return;
|
||||
}
|
||||
|
||||
String selectedString = formatCountState(selectedData);
|
||||
String selectedString = formatCountyState(selectedData);
|
||||
|
||||
// Clear selection
|
||||
countyStateList.deselectAll();
|
||||
|
|
|
@ -38,6 +38,9 @@ import org.eclipse.swt.widgets.MessageBox;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
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.core.exception.VizException;
|
||||
import com.raytheon.viz.hydrocommon.data.DescriptionData;
|
||||
import com.raytheon.viz.hydrocommon.data.LocationAreaData;
|
||||
|
@ -55,6 +58,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 4, 2008 lvenable Initial creation
|
||||
* Apr 19,2013 1790 rferrel Make dialog non-blocking.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -62,6 +66,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class DescriptionDlg extends CaveSWTDialog {
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(DescriptionDlg.class);
|
||||
|
||||
/**
|
||||
* Control font.
|
||||
|
@ -136,10 +142,15 @@ public class DescriptionDlg extends CaveSWTDialog {
|
|||
private String locationId;
|
||||
|
||||
private String currentRemarkText = null;
|
||||
|
||||
private String currentFreezeText = null;
|
||||
|
||||
private String currentReachText = null;
|
||||
|
||||
private String currentRegText = null;
|
||||
|
||||
private String currentTopoText = null;
|
||||
|
||||
private String currentAreaText = null;
|
||||
|
||||
// private boolean hasCurrentData = false;
|
||||
|
@ -153,12 +164,17 @@ public class DescriptionDlg extends CaveSWTDialog {
|
|||
* Dialog title information.
|
||||
*/
|
||||
public DescriptionDlg(Shell parent, String titleInfo, String lid) {
|
||||
super(parent);
|
||||
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
|
||||
setText("Description" + titleInfo);
|
||||
|
||||
locationId = lid;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
|
||||
*/
|
||||
@Override
|
||||
protected Layout constructShellLayout() {
|
||||
// Create the main layout for the shell.
|
||||
|
@ -169,14 +185,26 @@ public class DescriptionDlg extends CaveSWTDialog {
|
|||
return mainLayout;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
|
||||
*/
|
||||
@Override
|
||||
protected void disposed() {
|
||||
controlFont.dispose();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
||||
* .eclipse.swt.widgets.Shell)
|
||||
*/
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
setReturnValue(false);
|
||||
setReturnValue(locationId);
|
||||
controlFont = new Font(shell.getDisplay(), "Monospace", 10, SWT.NORMAL);
|
||||
|
||||
createMainControls();
|
||||
|
@ -249,8 +277,7 @@ public class DescriptionDlg extends CaveSWTDialog {
|
|||
if (remarksTF.getText().length() > 255) {
|
||||
remarksTF.setText(currentRemarkText);
|
||||
shell.getDisplay().beep();
|
||||
}
|
||||
else
|
||||
} else
|
||||
currentRemarkText = remarksTF.getText();
|
||||
}
|
||||
};
|
||||
|
@ -275,8 +302,7 @@ public class DescriptionDlg extends CaveSWTDialog {
|
|||
if (freezingTF.getText().length() > 160) {
|
||||
freezingTF.setText(currentFreezeText);
|
||||
shell.getDisplay().beep();
|
||||
}
|
||||
else
|
||||
} else
|
||||
currentFreezeText = freezingTF.getText();
|
||||
}
|
||||
};
|
||||
|
@ -300,8 +326,7 @@ public class DescriptionDlg extends CaveSWTDialog {
|
|||
if (reachTF.getText().length() > 80) {
|
||||
reachTF.setText(currentReachText);
|
||||
shell.getDisplay().beep();
|
||||
}
|
||||
else
|
||||
} else
|
||||
currentReachText = reachTF.getText();
|
||||
}
|
||||
};
|
||||
|
@ -325,8 +350,7 @@ public class DescriptionDlg extends CaveSWTDialog {
|
|||
if (regulationTF.getText().length() > 230) {
|
||||
regulationTF.setText(currentRegText);
|
||||
shell.getDisplay().beep();
|
||||
}
|
||||
else
|
||||
} else
|
||||
currentRegText = regulationTF.getText();
|
||||
}
|
||||
};
|
||||
|
@ -350,8 +374,7 @@ public class DescriptionDlg extends CaveSWTDialog {
|
|||
if (topoTF.getText().length() > 230) {
|
||||
topoTF.setText(currentTopoText);
|
||||
shell.getDisplay().beep();
|
||||
}
|
||||
else
|
||||
} else
|
||||
currentTopoText = topoTF.getText();
|
||||
}
|
||||
};
|
||||
|
@ -416,14 +439,12 @@ public class DescriptionDlg extends CaveSWTDialog {
|
|||
if (affectedAreaTF.getText().length() > 80) {
|
||||
affectedAreaTF.setText(currentAreaText);
|
||||
shell.getDisplay().beep();
|
||||
}
|
||||
else
|
||||
} else
|
||||
currentAreaText = affectedAreaTF.getText();
|
||||
}
|
||||
};
|
||||
affectedAreaTF.addModifyListener(listenerA);
|
||||
|
||||
|
||||
// ---------------------------------------------
|
||||
// Add the Delete and Save buttons
|
||||
// ---------------------------------------------
|
||||
|
@ -475,7 +496,7 @@ public class DescriptionDlg extends CaveSWTDialog {
|
|||
exitBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -502,8 +523,8 @@ public class DescriptionDlg extends CaveSWTDialog {
|
|||
}
|
||||
|
||||
} catch (VizException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to get proximity data. ", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -543,8 +564,8 @@ public class DescriptionDlg extends CaveSWTDialog {
|
|||
affectedAreaTF.setText(locAreaData.getArea());
|
||||
}
|
||||
} catch (VizException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to get description data. ", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -565,15 +586,8 @@ public class DescriptionDlg extends CaveSWTDialog {
|
|||
try {
|
||||
DescriptionDataManager.getInstance().deleteDescription(locationId);
|
||||
} catch (VizException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
|
||||
MessageBox errorMb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
errorMb.setText("Error");
|
||||
errorMb.setMessage("Error deleting the selected description.");
|
||||
errorMb.open();
|
||||
|
||||
return;
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to delete description. ", e);
|
||||
}
|
||||
|
||||
streamBedTF.setText("");
|
||||
|
@ -603,8 +617,8 @@ public class DescriptionDlg extends CaveSWTDialog {
|
|||
descriptionData);
|
||||
}
|
||||
} catch (VizException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to save description. ", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -625,14 +639,8 @@ public class DescriptionDlg extends CaveSWTDialog {
|
|||
try {
|
||||
LocationAreaManager.getInstance().deleteRecord(locationId);
|
||||
} catch (VizException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
|
||||
MessageBox errorMb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
errorMb.setText("Error");
|
||||
errorMb.setMessage("Error deleting the selected description.");
|
||||
errorMb.open();
|
||||
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to delete selected description. ", e);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -659,8 +667,8 @@ public class DescriptionDlg extends CaveSWTDialog {
|
|||
locAreaData);
|
||||
}
|
||||
} catch (VizException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to save affected area. ", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,9 @@ import org.eclipse.swt.widgets.Shell;
|
|||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
import com.raytheon.uf.common.dataquery.db.QueryResult;
|
||||
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.core.exception.VizException;
|
||||
import com.raytheon.viz.hydrocommon.data.FloodCategoryData;
|
||||
import com.raytheon.viz.hydrocommon.datamanager.FloodCategoryDataManager;
|
||||
|
@ -52,12 +55,15 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Nov 10, 2008 1661 askripsky Connected to DB
|
||||
* March 3, 2011 JingtaoD Mondification - display blank on Flood category GUI
|
||||
* if the value is null in database
|
||||
* Apr 19, 2013 1790 rferrel Make dialog non-blocking.
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
* @version 1.0
|
||||
*/
|
||||
public class FloodCategoryDlg extends CaveSWTDialog {
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(FloodCategoryDlg.class);
|
||||
|
||||
/**
|
||||
* Location whose data is displayed.
|
||||
|
@ -98,10 +104,14 @@ public class FloodCategoryDlg extends CaveSWTDialog {
|
|||
* constant for missing value
|
||||
*/
|
||||
private static final double missingVal = -9999.0;
|
||||
|
||||
/**
|
||||
* delta factor to consider 2 double values equal.
|
||||
*/
|
||||
private static final double diffAllowed = 0.0001;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Non-blocking Constructor.
|
||||
*
|
||||
* @param parent
|
||||
* Parent shell.
|
||||
|
@ -109,12 +119,17 @@ public class FloodCategoryDlg extends CaveSWTDialog {
|
|||
* Dialog title information.
|
||||
*/
|
||||
public FloodCategoryDlg(Shell parent, String titleInfo, String lid) {
|
||||
super(parent);
|
||||
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
|
||||
setText("Flood Category" + titleInfo);
|
||||
|
||||
this.lid = lid;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
|
||||
*/
|
||||
@Override
|
||||
protected Layout constructShellLayout() {
|
||||
// Create the main layout for the shell.
|
||||
|
@ -125,9 +140,16 @@ public class FloodCategoryDlg extends CaveSWTDialog {
|
|||
return mainLayout;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
||||
* .eclipse.swt.widgets.Shell)
|
||||
*/
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
setReturnValue(false);
|
||||
setReturnValue(lid);
|
||||
// Initialize all of the controls and layouts
|
||||
initializeComponents();
|
||||
|
||||
|
@ -230,7 +252,7 @@ public class FloodCategoryDlg extends CaveSWTDialog {
|
|||
okBtn.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
if (saveChanges()) {
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -241,7 +263,7 @@ public class FloodCategoryDlg extends CaveSWTDialog {
|
|||
cancelBtn.setLayoutData(gd);
|
||||
cancelBtn.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -254,12 +276,17 @@ public class FloodCategoryDlg extends CaveSWTDialog {
|
|||
if (MessageDialog.openConfirm(null, "Delete Confirmation",
|
||||
"Do you wish to delete this entry?")) {
|
||||
removeRecord();
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify and save changes.
|
||||
*
|
||||
* @return true if save successful
|
||||
*/
|
||||
private boolean saveChanges() {
|
||||
boolean successful = false;
|
||||
|
||||
|
@ -272,9 +299,7 @@ public class FloodCategoryDlg extends CaveSWTDialog {
|
|||
modDischargeTF.getText(),
|
||||
minorDischargeTF.getText(), shell);
|
||||
} catch (VizException e) {
|
||||
e.printStackTrace();
|
||||
String showErrorMsg = "Unable to save values";
|
||||
MessageDialog.openConfirm(null, "Save Failed", showErrorMsg);
|
||||
statusHandler.handle(Priority.PROBLEM, "Save failed. ", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -301,13 +326,12 @@ public class FloodCategoryDlg extends CaveSWTDialog {
|
|||
} else {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
mb
|
||||
.setMessage("Data for the location must be add via the River Gauge dialog first.");
|
||||
mb.setMessage("Data for the location must be add via the River Gauge dialog first.");
|
||||
mb.open();
|
||||
}
|
||||
} catch (VizException e) {
|
||||
// don't care, just return false
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Check constraints failed. ", e);
|
||||
}
|
||||
|
||||
return rval;
|
||||
|
@ -317,11 +341,13 @@ public class FloodCategoryDlg extends CaveSWTDialog {
|
|||
try {
|
||||
FloodCategoryDataManager.getInstance().deleteRecord(lid);
|
||||
} catch (VizException e) {
|
||||
String showErrorMsg = "Unable to delete records";
|
||||
MessageDialog.openConfirm(null, "Delete Failed", showErrorMsg);
|
||||
statusHandler.handle(Priority.PROBLEM, "Delete record failed. ", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get flood catagory data and update display.
|
||||
*/
|
||||
private void loadFloodCategoryData() {
|
||||
try {
|
||||
FloodCategoryData data = FloodCategoryDataManager.getInstance()
|
||||
|
@ -345,22 +371,23 @@ public class FloodCategoryDlg extends CaveSWTDialog {
|
|||
if (Math.abs(data.getMajorDischarge() - missingVal) < diffAllowed)
|
||||
majorDischargeTF.setText("");
|
||||
else
|
||||
majorDischargeTF.setText(Double.toString(data.getMajorDischarge()));
|
||||
majorDischargeTF.setText(Double.toString(data
|
||||
.getMajorDischarge()));
|
||||
|
||||
if (Math.abs(data.getModerateDischarge() - missingVal) < diffAllowed)
|
||||
modDischargeTF.setText("");
|
||||
else
|
||||
modDischargeTF.setText(Double.toString(data.getModerateDischarge()));
|
||||
modDischargeTF.setText(Double.toString(data
|
||||
.getModerateDischarge()));
|
||||
|
||||
if (Math.abs(data.getMinorDischarge() - missingVal) < diffAllowed)
|
||||
minorDischargeTF.setText("");
|
||||
else
|
||||
minorDischargeTF.setText(Double.toString(data.getMinorDischarge()));
|
||||
|
||||
minorDischargeTF.setText(Double.toString(data
|
||||
.getMinorDischarge()));
|
||||
|
||||
} catch (VizException e) {
|
||||
String showErrorMsg = "Unable to retrieve values";
|
||||
MessageDialog.openConfirm(null, "Retrieve Failed", showErrorMsg);
|
||||
statusHandler.handle(Priority.PROBLEM, "Retrieve failed. ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,9 @@ import org.eclipse.swt.widgets.List;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
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.core.exception.VizException;
|
||||
import com.raytheon.viz.hydrocommon.data.FloodData;
|
||||
import com.raytheon.viz.hydrocommon.datamanager.FloodDataManager;
|
||||
|
@ -53,6 +56,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 4, 2008 lvenable Initial creation
|
||||
* Apr 19, 2013 1790 rferrel Make dialog non-blocking.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -60,6 +64,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class FloodDamageDlg extends CaveSWTDialog {
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(FloodDamageDlg.class);
|
||||
|
||||
/**
|
||||
* Control font.
|
||||
|
@ -102,7 +108,7 @@ public class FloodDamageDlg extends CaveSWTDialog {
|
|||
private ArrayList<FloodData> floodData;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Non-blocking Constructor.
|
||||
*
|
||||
* @param parent
|
||||
* Parent shell.
|
||||
|
@ -110,12 +116,17 @@ public class FloodDamageDlg extends CaveSWTDialog {
|
|||
* Dialog title information.
|
||||
*/
|
||||
public FloodDamageDlg(Shell parent, String titleInfo, String lid) {
|
||||
super(parent);
|
||||
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
|
||||
setText("Flood Damage" + titleInfo);
|
||||
|
||||
this.lid = lid;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
|
||||
*/
|
||||
@Override
|
||||
protected Layout constructShellLayout() {
|
||||
GridLayout mainLayout = new GridLayout(1, false);
|
||||
|
@ -125,14 +136,26 @@ public class FloodDamageDlg extends CaveSWTDialog {
|
|||
return mainLayout;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
|
||||
*/
|
||||
@Override
|
||||
protected void disposed() {
|
||||
controlFont.dispose();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
||||
* .eclipse.swt.widgets.Shell)
|
||||
*/
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
setReturnValue(false);
|
||||
setReturnValue(lid);
|
||||
// Initialize all of the controls and layouts
|
||||
initializeComponents();
|
||||
|
||||
|
@ -234,8 +257,7 @@ public class FloodDamageDlg extends CaveSWTDialog {
|
|||
if (damageTF.getText().length() > 510) {
|
||||
damageTF.setText(currentDamageText);
|
||||
shell.getDisplay().beep();
|
||||
}
|
||||
else
|
||||
} else
|
||||
currentDamageText = damageTF.getText();
|
||||
}
|
||||
};
|
||||
|
@ -262,7 +284,7 @@ public class FloodDamageDlg extends CaveSWTDialog {
|
|||
okBtn.setLayoutData(gd);
|
||||
okBtn.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -284,7 +306,7 @@ public class FloodDamageDlg extends CaveSWTDialog {
|
|||
cancelBtn.setLayoutData(gd);
|
||||
cancelBtn.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -335,13 +357,16 @@ public class FloodDamageDlg extends CaveSWTDialog {
|
|||
try {
|
||||
floodData = FloodDataManager.getInstance().getFloodData(lid);
|
||||
} catch (VizException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Uable to get flood damage data. ", e);
|
||||
}
|
||||
|
||||
updateFloodDamageData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update stage list with current flood data.
|
||||
*/
|
||||
private void updateFloodDamageData() {
|
||||
// Clear current Stages
|
||||
stageList.removeAll();
|
||||
|
@ -351,20 +376,36 @@ public class FloodDamageDlg extends CaveSWTDialog {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display flood damage for the currentl selected stage.
|
||||
*/
|
||||
private void getDamageStatement() {
|
||||
updateDamageDisplay(getCurrentlySelectedStage());
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispal the data's damage information.
|
||||
*
|
||||
* @param data
|
||||
*/
|
||||
private void updateDamageDisplay(FloodData data) {
|
||||
stageTF.setText(Double.toString(data.getStage()));
|
||||
displayTF.setText(data.getDisplayStatement());
|
||||
damageTF.setText(data.getDamage());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the flood data for the currently selected stage.
|
||||
*
|
||||
* @return data
|
||||
*/
|
||||
private FloodData getCurrentlySelectedStage() {
|
||||
return floodData.get(stageList.getSelectionIndex());
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirm, delete record and update display.
|
||||
*/
|
||||
private void deleteRecord() {
|
||||
if (MessageDialog.openConfirm(null, "Delete Confirmation",
|
||||
"Do you wish to delete this entry?")) {
|
||||
|
@ -372,8 +413,8 @@ public class FloodDamageDlg extends CaveSWTDialog {
|
|||
FloodDataManager.getInstance().deleteRecord(
|
||||
getCurrentlySelectedStage());
|
||||
} catch (VizException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Uable to delete record. ", e);
|
||||
}
|
||||
|
||||
getFloodDamageData();
|
||||
|
@ -382,12 +423,18 @@ public class FloodDamageDlg extends CaveSWTDialog {
|
|||
clearStatement();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear text fields.
|
||||
*/
|
||||
private void clearStatement() {
|
||||
stageTF.setText("");
|
||||
damageTF.setText("");
|
||||
displayTF.setText("");
|
||||
}
|
||||
|
||||
/**
|
||||
* Save flood information for station location.
|
||||
*/
|
||||
private void saveRecord() {
|
||||
try {
|
||||
FloodDataManager.getInstance().putFloodCategoryData(lid,
|
||||
|
@ -397,8 +444,7 @@ public class FloodDamageDlg extends CaveSWTDialog {
|
|||
MessageDialog.openConfirm(null, "Invalid Stage value",
|
||||
"Please enter a valid numeric value for Stage");
|
||||
} catch (VizException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM, "Uable to save record. ", e);
|
||||
}
|
||||
|
||||
getFloodDamageData();
|
||||
|
|
|
@ -45,6 +45,9 @@ import org.eclipse.swt.widgets.Text;
|
|||
|
||||
import com.raytheon.uf.common.dataquery.db.QueryResult;
|
||||
import com.raytheon.uf.common.dataquery.db.QueryResultRow;
|
||||
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.core.exception.VizException;
|
||||
import com.raytheon.viz.hydrocommon.data.GageDBData;
|
||||
import com.raytheon.viz.hydrocommon.datamanager.HydroDBDataManager;
|
||||
|
@ -59,6 +62,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 4, 2008 lvenable Initial creation
|
||||
* Jan 8, 2008 1802 askripsk Connect to DB.
|
||||
* Apr 19, 2013 170- rferrel Make dialog non-blocking.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -66,6 +70,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class GageHistoryDlg extends CaveSWTDialog {
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(GageHistoryDlg.class);
|
||||
|
||||
/**
|
||||
* Control font.
|
||||
|
@ -147,7 +153,7 @@ public class GageHistoryDlg extends CaveSWTDialog {
|
|||
private String lid;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Non-blocking Constructor.
|
||||
*
|
||||
* @param parent
|
||||
* Parent shell.
|
||||
|
@ -164,6 +170,11 @@ public class GageHistoryDlg extends CaveSWTDialog {
|
|||
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
|
||||
*/
|
||||
@Override
|
||||
protected Layout constructShellLayout() {
|
||||
// Create the main layout for the shell.
|
||||
|
@ -174,14 +185,26 @@ public class GageHistoryDlg extends CaveSWTDialog {
|
|||
return mainLayout;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
|
||||
*/
|
||||
@Override
|
||||
protected void disposed() {
|
||||
controlFont.dispose();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
||||
* .eclipse.swt.widgets.Shell)
|
||||
*/
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
setReturnValue(false);
|
||||
setReturnValue(lid);
|
||||
// Initialize all of the controls and layouts
|
||||
initializeComponents();
|
||||
|
||||
|
@ -358,7 +381,7 @@ public class GageHistoryDlg extends CaveSWTDialog {
|
|||
okBtn.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
if (saveRecord()) {
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -382,7 +405,7 @@ public class GageHistoryDlg extends CaveSWTDialog {
|
|||
cancelBtn.setLayoutData(gd);
|
||||
cancelBtn.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -424,6 +447,9 @@ public class GageHistoryDlg extends CaveSWTDialog {
|
|||
return labelStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain and display gage static data.
|
||||
*/
|
||||
private void loadStaticData() {
|
||||
typeList.removeAll();
|
||||
ownerList.removeAll();
|
||||
|
@ -445,10 +471,19 @@ public class GageHistoryDlg extends CaveSWTDialog {
|
|||
maintList.add(currAgency);
|
||||
}
|
||||
} catch (VizException e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to load static data. ", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get gage data and update the display.
|
||||
*
|
||||
* @param table
|
||||
* @param column
|
||||
* @return
|
||||
* @throws VizException
|
||||
*/
|
||||
private java.util.List<String> getGageData(String table, String column)
|
||||
throws VizException {
|
||||
java.util.List<String> rval = new ArrayList<String>();
|
||||
|
@ -467,6 +502,9 @@ public class GageHistoryDlg extends CaveSWTDialog {
|
|||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get gage data for the station location.
|
||||
*/
|
||||
private void getDialogData() {
|
||||
GageDBData seedData = new GageDBData();
|
||||
seedData.setLid(lid);
|
||||
|
@ -474,12 +512,15 @@ public class GageHistoryDlg extends CaveSWTDialog {
|
|||
try {
|
||||
gageData = HydroDBDataManager.getInstance().getData(seedData);
|
||||
} catch (VizException e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM, "Unable to load data. ", e);
|
||||
}
|
||||
|
||||
updateDisplay();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update display with gage data.
|
||||
*/
|
||||
private void updateDisplay() {
|
||||
String format = "%-15s %-15s %-10s %-10s";
|
||||
dataList.removeAll();
|
||||
|
@ -502,6 +543,9 @@ public class GageHistoryDlg extends CaveSWTDialog {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Display currently selected record's information.
|
||||
*/
|
||||
private void updateInformation() {
|
||||
GageDBData currData = getSelectedRecord();
|
||||
|
||||
|
@ -544,6 +588,11 @@ public class GageHistoryDlg extends CaveSWTDialog {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify and save gage data.
|
||||
*
|
||||
* @return true when record saved
|
||||
*/
|
||||
private boolean saveRecord() {
|
||||
boolean successful = false;
|
||||
|
||||
|
@ -608,18 +657,17 @@ public class GageHistoryDlg extends CaveSWTDialog {
|
|||
// Refresh Cache
|
||||
getDialogData();
|
||||
} catch (VizException e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
mb.setMessage("An error occurred while trying to save the City");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error while trying to save the City. ", e);
|
||||
}
|
||||
}
|
||||
|
||||
return successful;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete selected record from data base and update display.
|
||||
*/
|
||||
private void deleteRecord() {
|
||||
GageDBData currData = getSelectedRecord();
|
||||
|
||||
|
@ -638,12 +686,8 @@ public class GageHistoryDlg extends CaveSWTDialog {
|
|||
// Refresh the cache
|
||||
getDialogData();
|
||||
} catch (VizException e) {
|
||||
mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Delete");
|
||||
mb.setMessage("An error occurred while trying to delete the entry");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to delete entry. ", e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -654,11 +698,17 @@ public class GageHistoryDlg extends CaveSWTDialog {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear information fields and update to new record.
|
||||
*/
|
||||
private void newRecord() {
|
||||
clearInformation();
|
||||
updateDialogState(DialogState.NEW_RECORD);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all the information list and fields.
|
||||
*/
|
||||
private void clearInformation() {
|
||||
typeList.select(0);
|
||||
ownerList.select(0);
|
||||
|
@ -669,6 +719,11 @@ public class GageHistoryDlg extends CaveSWTDialog {
|
|||
locationTF.setText("");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the gage data for the current selection in the data list.
|
||||
*
|
||||
* @return currData
|
||||
*/
|
||||
private GageDBData getSelectedRecord() {
|
||||
GageDBData currData = null;
|
||||
|
||||
|
@ -679,6 +734,11 @@ public class GageHistoryDlg extends CaveSWTDialog {
|
|||
return currData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update button enable state base on the state.
|
||||
*
|
||||
* @param currState
|
||||
*/
|
||||
private void updateDialogState(DialogState currState) {
|
||||
switch (currState) {
|
||||
case NEW_RECORD:
|
||||
|
|
|
@ -21,9 +21,14 @@ package com.raytheon.viz.hydrobase.dialogs;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.graphics.Cursor;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
|
@ -40,6 +45,10 @@ import org.eclipse.swt.widgets.Text;
|
|||
|
||||
import com.raytheon.uf.common.dataquery.db.QueryResult;
|
||||
import com.raytheon.uf.common.dataquery.db.QueryResultRow;
|
||||
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.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.viz.hydrocommon.data.HydroGenStationData;
|
||||
import com.raytheon.viz.hydrocommon.datamanager.DataTrashCanDataManager;
|
||||
|
@ -56,6 +65,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 4, 2008 lvenable Initial creation
|
||||
* Dec 29, 2008 1802 askripsk Connect to database.
|
||||
* Apr 19, 2013 1790 rferrel Make dialog non-blocking.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -63,6 +73,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class HydroGenConfigDlg extends CaveSWTDialog {
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(HydroGenConfigDlg.class);
|
||||
|
||||
/**
|
||||
* Control font.
|
||||
|
@ -105,13 +117,18 @@ public class HydroGenConfigDlg extends CaveSWTDialog {
|
|||
private java.util.List<HydroGenStationData> stationData;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* System wait cursor no need to dispose.
|
||||
*/
|
||||
Cursor waitCursor;
|
||||
|
||||
/**
|
||||
* Non-blocking Constructor.
|
||||
*
|
||||
* @param parent
|
||||
* Parent shell.
|
||||
*/
|
||||
public HydroGenConfigDlg(Shell parent) {
|
||||
super(parent);
|
||||
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
|
||||
setText("HydroGen Configuration");
|
||||
}
|
||||
|
||||
|
@ -132,6 +149,8 @@ public class HydroGenConfigDlg extends CaveSWTDialog {
|
|||
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
waitCursor = shell.getDisplay().getSystemCursor(SWT.CURSOR_WAIT);
|
||||
|
||||
controlFont = new Font(shell.getDisplay(), "Monospace", 10, SWT.NORMAL);
|
||||
|
||||
createSummaryGroup();
|
||||
|
@ -277,7 +296,7 @@ public class HydroGenConfigDlg extends CaveSWTDialog {
|
|||
closeBtn.setLayoutData(gd);
|
||||
closeBtn.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -325,7 +344,8 @@ public class HydroGenConfigDlg extends CaveSWTDialog {
|
|||
}
|
||||
}
|
||||
} catch (VizException e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to load static data. ", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -333,14 +353,32 @@ public class HydroGenConfigDlg extends CaveSWTDialog {
|
|||
* Retrieves the hydrogen data from the database.
|
||||
*/
|
||||
private void getDialogData() {
|
||||
shell.setCursor(waitCursor);
|
||||
|
||||
Job job = new Job("HydroGen") {
|
||||
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
try {
|
||||
stationData = HydroDBDataManager.getInstance().getData(
|
||||
HydroGenStationData.class);
|
||||
} catch (VizException e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to load data. ", e);
|
||||
}
|
||||
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
updateDialogDisplay();
|
||||
shell.setCursor(null);
|
||||
}
|
||||
});
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
};
|
||||
job.schedule();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -490,12 +528,8 @@ public class HydroGenConfigDlg extends CaveSWTDialog {
|
|||
// Refresh data
|
||||
getDialogData();
|
||||
} catch (VizException e) {
|
||||
mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Delete");
|
||||
mb.setMessage("An error occurred while trying to delete the record.");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to delete the record. ", e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -521,13 +555,8 @@ public class HydroGenConfigDlg extends CaveSWTDialog {
|
|||
try {
|
||||
HydroDBDataManager.getInstance().putData(newData);
|
||||
} catch (VizException e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR
|
||||
| SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
mb.setMessage("An error occurred while trying to save.");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to save the data. ", e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -618,8 +647,8 @@ public class HydroGenConfigDlg extends CaveSWTDialog {
|
|||
mb.open();
|
||||
}
|
||||
} catch (VizException e) {
|
||||
// don't care, just return false
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to verify constraints. ", e);
|
||||
}
|
||||
|
||||
return rval;
|
||||
|
|
|
@ -21,7 +21,6 @@ package com.raytheon.viz.hydrobase.dialogs;
|
|||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
|
@ -41,6 +40,9 @@ import org.eclipse.swt.widgets.List;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
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.core.exception.VizException;
|
||||
import com.raytheon.viz.hydrocommon.data.LowWaterData;
|
||||
import com.raytheon.viz.hydrocommon.datamanager.LowWaterDataManager;
|
||||
|
@ -55,6 +57,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 5, 2008 lvenable Initial creation
|
||||
* Nov 12, 2008 1697 askripsky Connect to DB
|
||||
* Apr 19, 2013 1790 rferrel Make dialog non-blocking.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -62,6 +65,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class LowWaterDlg extends CaveSWTDialog {
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(LowWaterDlg.class);
|
||||
|
||||
/**
|
||||
* Control font.
|
||||
|
@ -109,9 +114,9 @@ public class LowWaterDlg extends CaveSWTDialog {
|
|||
private String lid;
|
||||
|
||||
/**
|
||||
* Low water Data for the current location
|
||||
* Low water Data for the current location.
|
||||
*/
|
||||
private ArrayList<LowWaterData> lwData;
|
||||
private java.util.List<LowWaterData> lwData;
|
||||
|
||||
/**
|
||||
* Formats date.
|
||||
|
@ -128,7 +133,7 @@ public class LowWaterDlg extends CaveSWTDialog {
|
|||
private DialogStates buttonState;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Non-blocking Constructor.
|
||||
*
|
||||
* @param parent
|
||||
* Parent shell.
|
||||
|
@ -136,7 +141,7 @@ public class LowWaterDlg extends CaveSWTDialog {
|
|||
* Dialog title information.
|
||||
*/
|
||||
public LowWaterDlg(Shell parent, String titleInfo, String lid) {
|
||||
super(parent);
|
||||
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
|
||||
setText("Low Water" + titleInfo);
|
||||
|
||||
this.lid = lid;
|
||||
|
@ -144,6 +149,11 @@ public class LowWaterDlg extends CaveSWTDialog {
|
|||
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
|
||||
*/
|
||||
@Override
|
||||
protected Layout constructShellLayout() {
|
||||
// Create the main layout for the shell.
|
||||
|
@ -154,14 +164,26 @@ public class LowWaterDlg extends CaveSWTDialog {
|
|||
return mainLayout;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
|
||||
*/
|
||||
@Override
|
||||
protected void disposed() {
|
||||
controlFont.dispose();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
||||
* .eclipse.swt.widgets.Shell)
|
||||
*/
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
setReturnValue(false);
|
||||
setReturnValue(lid);
|
||||
// Initialize all of the controls and layouts
|
||||
initializeComponents();
|
||||
|
||||
|
@ -285,7 +307,7 @@ public class LowWaterDlg extends CaveSWTDialog {
|
|||
okBtn.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
saveRecord();
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -307,7 +329,7 @@ public class LowWaterDlg extends CaveSWTDialog {
|
|||
cancelBtn.setLayoutData(gd);
|
||||
cancelBtn.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -348,7 +370,7 @@ public class LowWaterDlg extends CaveSWTDialog {
|
|||
}
|
||||
|
||||
/**
|
||||
* Loads the Stage/Display statement data for a location
|
||||
* Loads the Stage/Display statement data for a location.
|
||||
*/
|
||||
private void getLowWaterData() {
|
||||
if (lwData != null) {
|
||||
|
@ -358,13 +380,16 @@ public class LowWaterDlg extends CaveSWTDialog {
|
|||
try {
|
||||
lwData = LowWaterDataManager.getInstance().getLowWaterData(lid);
|
||||
} catch (VizException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to get low water data. ", e);
|
||||
}
|
||||
|
||||
updateFloodDamageData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update flood damage stages based on selected data.
|
||||
*/
|
||||
private void updateFloodDamageData() {
|
||||
// Clear current Stages
|
||||
dataList.removeAll();
|
||||
|
@ -383,15 +408,16 @@ public class LowWaterDlg extends CaveSWTDialog {
|
|||
setButtonStates();
|
||||
}
|
||||
|
||||
/**
|
||||
* Display information on currently selected stage.
|
||||
*/
|
||||
private void getLowWaterInformation() {
|
||||
updateInformationDisplay(getCurrentlySelectedStage());
|
||||
}
|
||||
|
||||
private void updateInformationDisplay(LowWaterData data) {
|
||||
stageTF
|
||||
.setText((data.getStage() != LowWaterData.MISSING_VALUE_D) ? Double
|
||||
.toString(data.getStage())
|
||||
: "");
|
||||
stageTF.setText((data.getStage() != LowWaterData.MISSING_VALUE_D) ? Double
|
||||
.toString(data.getStage()) : "");
|
||||
flowTF.setText((data.getFlow() != LowWaterData.MISSING_VALUE) ? Integer
|
||||
.toString(data.getFlow()) : "");
|
||||
dateTF.setText(dateFormat.format(data.getDate()));
|
||||
|
@ -409,8 +435,8 @@ public class LowWaterDlg extends CaveSWTDialog {
|
|||
LowWaterDataManager.getInstance().deleteRecord(
|
||||
getCurrentlySelectedStage());
|
||||
} catch (VizException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to delete low water data. ", e);
|
||||
}
|
||||
|
||||
getLowWaterData();
|
||||
|
@ -453,8 +479,8 @@ public class LowWaterDlg extends CaveSWTDialog {
|
|||
MessageDialog.openConfirm(null, "Invalid Stage value",
|
||||
"Please enter a valid numeric value for Stage");
|
||||
} catch (VizException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to save low water data. ", e);
|
||||
} catch (ParseException e) {
|
||||
MessageDialog.openConfirm(null, "Invalid Date value",
|
||||
"Please enter a date in the form: MM/DD/YYYY");
|
||||
|
|
|
@ -36,6 +36,9 @@ import org.eclipse.swt.widgets.MessageBox;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
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.core.exception.VizException;
|
||||
import com.raytheon.viz.hydrobase.listeners.ICountyStateListener;
|
||||
import com.raytheon.viz.hydrocommon.data.CountiesData;
|
||||
|
@ -57,6 +60,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Sep 5, 2008 lvenable Initial creation
|
||||
* Jan 9, 2008 1802 askripsk Connect to DB.
|
||||
* Apr 17,2013 1790 rferrel Changes for non-blocking CountyStateDlg.
|
||||
* Make dialog non-blocking.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -65,6 +69,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
*/
|
||||
public class NwrTransmitterDlg extends CaveSWTDialog implements
|
||||
ICountyStateListener {
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(NwrTransmitterDlg.class);
|
||||
|
||||
/**
|
||||
* Allow one Count/State dialog.
|
||||
|
@ -215,10 +221,15 @@ public class NwrTransmitterDlg extends CaveSWTDialog implements
|
|||
* Parent shell.
|
||||
*/
|
||||
public NwrTransmitterDlg(Shell parent) {
|
||||
super(parent);
|
||||
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
|
||||
setText("NWR Transmitter");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
|
||||
*/
|
||||
@Override
|
||||
protected Layout constructShellLayout() {
|
||||
// Create the main layout for the shell.
|
||||
|
@ -229,11 +240,23 @@ public class NwrTransmitterDlg extends CaveSWTDialog implements
|
|||
return mainLayout;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
|
||||
*/
|
||||
@Override
|
||||
protected void disposed() {
|
||||
controlFont.dispose();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
||||
* .eclipse.swt.widgets.Shell)
|
||||
*/
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
setReturnValue(false);
|
||||
|
@ -584,7 +607,7 @@ public class NwrTransmitterDlg extends CaveSWTDialog implements
|
|||
closeBtn.setLayoutData(gd);
|
||||
closeBtn.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -654,7 +677,8 @@ public class NwrTransmitterDlg extends CaveSWTDialog implements
|
|||
}
|
||||
|
||||
} catch (VizException e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Uable to load static data. ", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -667,7 +691,7 @@ public class NwrTransmitterDlg extends CaveSWTDialog implements
|
|||
txData = HydroDBDataManager.getInstance().getData(
|
||||
NWRTransmitterData.class);
|
||||
} catch (VizException e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM, "Uable to load data. ", e);
|
||||
}
|
||||
|
||||
updateDisplay();
|
||||
|
@ -822,12 +846,8 @@ public class NwrTransmitterDlg extends CaveSWTDialog implements
|
|||
|
||||
successful = true;
|
||||
} catch (VizException e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
mb.setMessage("An error occurred while trying to save the City");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Uable to save city data. ", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -855,12 +875,8 @@ public class NwrTransmitterDlg extends CaveSWTDialog implements
|
|||
// Update county cache
|
||||
getSelectedCountiesData();
|
||||
} catch (VizException e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
mb.setMessage("An error occurred while trying to save the County");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Uable to save county data. ", e);
|
||||
}
|
||||
} else {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
|
@ -904,12 +920,8 @@ public class NwrTransmitterDlg extends CaveSWTDialog implements
|
|||
// Refresh the cache
|
||||
getDialogData();
|
||||
} catch (VizException e) {
|
||||
mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Delete");
|
||||
mb.setMessage("An error occurred while trying to delete the City");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Uable to delete city data. ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -945,12 +957,8 @@ public class NwrTransmitterDlg extends CaveSWTDialog implements
|
|||
// Refresh the cache
|
||||
getSelectedCountiesData();
|
||||
} catch (VizException e) {
|
||||
mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Delete");
|
||||
mb.setMessage("An error occurred while trying to delete the City");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Uable to delete county data. ", e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -1033,7 +1041,8 @@ public class NwrTransmitterDlg extends CaveSWTDialog implements
|
|||
updateDialogState(DialogState.NO_COUNTIES_SELECTED);
|
||||
}
|
||||
} catch (VizException e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Uable to load county data. ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1146,6 +1155,13 @@ public class NwrTransmitterDlg extends CaveSWTDialog implements
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.hydrobase.listeners.ICountyStateListener#notifyUpdate
|
||||
* (com.raytheon.viz.hydrocommon.data.CountiesData)
|
||||
*/
|
||||
@Override
|
||||
public void notifyUpdate(CountiesData selectedCountyState) {
|
||||
if (selectedCountyState.getCounty().startsWith("XXXXX")) {
|
||||
|
|
|
@ -32,10 +32,13 @@ import org.eclipse.swt.widgets.Group;
|
|||
import org.eclipse.swt.widgets.Layout;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
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.core.exception.VizException;
|
||||
import com.raytheon.viz.hydrobase.PreferencesData;
|
||||
import com.raytheon.viz.hydrobase.PreferencesDataManager;
|
||||
import com.raytheon.viz.hydrobase.PreferencesData.SortCriteria;
|
||||
import com.raytheon.viz.hydrobase.PreferencesDataManager;
|
||||
import com.raytheon.viz.hydrobase.listeners.IPreferencesListener;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
|
@ -47,6 +50,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 5, 2008 lvenable Initial creation
|
||||
* Apr 19, 2013 1790 rferrel Made dialog non-blocking.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -54,6 +58,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class PreferencesDlg extends CaveSWTDialog {
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(PreferencesDlg.class);
|
||||
|
||||
/**
|
||||
* Handbook V identifier check box.
|
||||
|
@ -108,7 +114,7 @@ public class PreferencesDlg extends CaveSWTDialog {
|
|||
/**
|
||||
* Field included array.
|
||||
*/
|
||||
private ArrayList<Button> fieldIncArray;
|
||||
private java.util.List<Button> fieldIncArray;
|
||||
|
||||
/**
|
||||
* Maximum number of checked check boxes.
|
||||
|
@ -118,19 +124,24 @@ public class PreferencesDlg extends CaveSWTDialog {
|
|||
/**
|
||||
* Listeners to notify main HB Dialog of settings
|
||||
*/
|
||||
private ArrayList<IPreferencesListener> preferencesListeners;
|
||||
private java.util.List<IPreferencesListener> preferencesListeners;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Non-blocking Constructor.
|
||||
*
|
||||
* @param parent
|
||||
* Parent shell.
|
||||
*/
|
||||
public PreferencesDlg(Shell parent) {
|
||||
super(parent);
|
||||
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
|
||||
setText("Preferences");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
|
||||
*/
|
||||
@Override
|
||||
protected Layout constructShellLayout() {
|
||||
// Create the main layout for the shell.
|
||||
|
@ -141,6 +152,13 @@ public class PreferencesDlg extends CaveSWTDialog {
|
|||
return mainLayout;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
||||
* .eclipse.swt.widgets.Shell)
|
||||
*/
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
setReturnValue(false);
|
||||
|
@ -273,7 +291,7 @@ public class PreferencesDlg extends CaveSWTDialog {
|
|||
public void widgetSelected(SelectionEvent event) {
|
||||
savePreferences();
|
||||
fireUpdateEvent();
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -283,7 +301,7 @@ public class PreferencesDlg extends CaveSWTDialog {
|
|||
cancelBtn.setLayoutData(gd);
|
||||
cancelBtn.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -410,9 +428,9 @@ public class PreferencesDlg extends CaveSWTDialog {
|
|||
PreferencesDataManager dm = PreferencesDataManager.getInstance();
|
||||
|
||||
// Save display columns
|
||||
dm.setSelectedColumns(stateCountyChk.getSelection(), basinChk
|
||||
.getSelection(), riverStreamChk.getSelection(), latLonChk
|
||||
.getSelection());
|
||||
dm.setSelectedColumns(stateCountyChk.getSelection(),
|
||||
basinChk.getSelection(), riverStreamChk.getSelection(),
|
||||
latLonChk.getSelection());
|
||||
|
||||
// Save sort preference
|
||||
if (stationRdo.getSelection())
|
||||
|
@ -423,14 +441,14 @@ public class PreferencesDlg extends CaveSWTDialog {
|
|||
dm.setSortCriteria(SortCriteria.STATE_COUNTY);
|
||||
|
||||
// Save dialog preferences
|
||||
dm.setTitleString(handbookVIdChk.getSelection(), locationNameChk
|
||||
.getSelection());
|
||||
dm.setTitleString(handbookVIdChk.getSelection(),
|
||||
locationNameChk.getSelection());
|
||||
|
||||
try {
|
||||
dm.savePreferences();
|
||||
} catch (VizException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to save preferences. ", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,9 @@ import org.eclipse.swt.widgets.MessageBox;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
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.core.exception.VizException;
|
||||
import com.raytheon.viz.hydrocommon.data.PublicationsData;
|
||||
import com.raytheon.viz.hydrocommon.datamanager.HydroDBDataManager;
|
||||
|
@ -57,6 +60,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 5, 2008 lvenable Initial creation.
|
||||
* 12/18/2008 1782 grichard Connected to IHFS DB.
|
||||
* Apr 19, 2013 1790 rferrel Made dialog non-blocking.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -64,6 +68,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class PublicationsDlg extends CaveSWTDialog implements IHydroDialog {
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(PublicationsDlg.class);
|
||||
|
||||
/**
|
||||
* Control font.
|
||||
|
@ -148,7 +154,7 @@ public class PublicationsDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
private SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Non-blocking Constructor.
|
||||
*
|
||||
* @param parent
|
||||
* Parent shell.
|
||||
|
@ -156,7 +162,7 @@ public class PublicationsDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
* Dialog title information.
|
||||
*/
|
||||
public PublicationsDlg(Shell parent, String titleInfo, String lid) {
|
||||
super(parent);
|
||||
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
|
||||
setText("Publications" + titleInfo);
|
||||
|
||||
this.lid = lid;
|
||||
|
@ -166,6 +172,11 @@ public class PublicationsDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
|
||||
*/
|
||||
@Override
|
||||
protected Layout constructShellLayout() {
|
||||
// Create the main layout for the shell.
|
||||
|
@ -176,14 +187,26 @@ public class PublicationsDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
return mainLayout;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
|
||||
*/
|
||||
@Override
|
||||
protected void disposed() {
|
||||
controlFont.dispose();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
||||
* .eclipse.swt.widgets.Shell)
|
||||
*/
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
setReturnValue(false);
|
||||
setReturnValue(lid);
|
||||
// Initialize all of the controls and layouts
|
||||
controlFont = new Font(shell.getDisplay(), "Monospace", 10, SWT.NORMAL);
|
||||
|
||||
|
@ -345,7 +368,7 @@ public class PublicationsDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
if (saveRecord()) {
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -370,7 +393,7 @@ public class PublicationsDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
cancelBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -415,8 +438,10 @@ public class PublicationsDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
return labelStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the publication data from the database that matched the location ID.
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.hydrobase.dialogs.IHydroDialog#getDialogData()
|
||||
*/
|
||||
@Override
|
||||
public void getDialogData() {
|
||||
|
@ -429,14 +454,18 @@ public class PublicationsDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
try {
|
||||
pubData = HydroDBDataManager.getInstance().getData(seedData);
|
||||
} catch (VizException e) {
|
||||
// e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to get publication data. ", e);
|
||||
}
|
||||
|
||||
updateDialogDisplay();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the publication list control.
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.hydrobase.dialogs.IHydroDialog#updateDialogDisplay()
|
||||
*/
|
||||
@Override
|
||||
public void updateDialogDisplay() {
|
||||
|
@ -465,8 +494,10 @@ public class PublicationsDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
updateDialogState();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the dialog's state.
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.hydrobase.dialogs.IHydroDialog#updateDialogState()
|
||||
*/
|
||||
@Override
|
||||
public void updateDialogState() {
|
||||
|
@ -486,8 +517,10 @@ public class PublicationsDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the publication information control.
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.hydrobase.dialogs.IHydroDialog#updateInformation()
|
||||
*/
|
||||
@Override
|
||||
public void updateInformation() {
|
||||
|
@ -501,10 +534,10 @@ public class PublicationsDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
.setText((currData.getPub() != null) ? currData.getPub() : "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the currently selected publication data.
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @return the publication data
|
||||
* @see com.raytheon.viz.hydrobase.dialogs.IHydroDialog#getSelectedDatum()
|
||||
*/
|
||||
@Override
|
||||
public PublicationsData getSelectedDatum() {
|
||||
|
@ -537,8 +570,12 @@ public class PublicationsDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
mb.open();
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the user inputs in the value text control.
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.hydrobase.dialogs.IHydroDialog#validateEntryData(org
|
||||
* .eclipse.swt.widgets.Text)
|
||||
*/
|
||||
@Override
|
||||
public boolean validateEntryData(Text tf) {
|
||||
|
@ -550,8 +587,10 @@ public class PublicationsDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the record to the database.
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.hydrobase.dialogs.IHydroDialog#saveRecord()
|
||||
*/
|
||||
@Override
|
||||
public boolean saveRecord() {
|
||||
|
@ -592,9 +631,6 @@ public class PublicationsDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
try {
|
||||
HydroDBDataManager.getInstance().putData(dataToSave);
|
||||
} catch (VizException e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
mb.setMessage("An error occurred while trying to save.");
|
||||
|
||||
String cause = e.getCause().getMessage();
|
||||
|
||||
|
@ -602,6 +638,9 @@ public class PublicationsDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
|
||||
// If the exception contain the SQL exception "ERROR:"
|
||||
if (causeStart > 0) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
mb.setMessage("An error occurred while trying to save.");
|
||||
int causeEnd = cause.indexOf("\n", causeStart);
|
||||
|
||||
cause = cause.substring(causeStart, causeEnd);
|
||||
|
@ -610,11 +649,12 @@ public class PublicationsDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
mb.setMessage("Please enter data for " + lid
|
||||
+ " in the River Gauge dialog first");
|
||||
}
|
||||
}
|
||||
|
||||
mb.open();
|
||||
} else {
|
||||
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to save publication data. ", e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -623,8 +663,10 @@ public class PublicationsDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the record from the database.
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.hydrobase.dialogs.IHydroDialog#deleteRecord()
|
||||
*/
|
||||
@Override
|
||||
public void deleteRecord() {
|
||||
|
@ -651,13 +693,8 @@ public class PublicationsDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
clearForm();
|
||||
|
||||
} catch (VizException e) {
|
||||
MessageBox mbDel = new MessageBox(shell, SWT.ICON_ERROR
|
||||
| SWT.OK);
|
||||
mbDel.setText("Unable to Delete");
|
||||
mbDel.setMessage("An error occurred while trying to delete.");
|
||||
mbDel.open();
|
||||
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to delete publication data. ", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -665,8 +702,10 @@ public class PublicationsDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
getDialogData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the text fields in the form.
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.hydrobase.dialogs.IHydroDialog#clearForm()
|
||||
*/
|
||||
@Override
|
||||
public void clearForm() {
|
||||
|
|
|
@ -23,15 +23,20 @@ import java.text.ParseException;
|
|||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.KeyEvent;
|
||||
import org.eclipse.swt.events.KeyListener;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.graphics.Cursor;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
|
@ -46,6 +51,10 @@ import org.eclipse.swt.widgets.MessageBox;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
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.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.viz.hydrocommon.HydroConstants;
|
||||
import com.raytheon.viz.hydrocommon.data.DataLimitData;
|
||||
|
@ -57,7 +66,6 @@ import com.raytheon.viz.hydrocommon.datamanager.QcAlertAlarmLimitsDataManager;
|
|||
import com.raytheon.viz.hydrocommon.util.HydroDataUtils;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
|
||||
/**
|
||||
* this class displays the QC Alert and Alarm dialog.
|
||||
*
|
||||
|
@ -71,13 +79,17 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* May 5, 2009 2181 mpduff Keep selection upon submit.
|
||||
* Jun 16,2010 5526 lbousaidi Start/End date not correct
|
||||
* Oct 27,2011 11305 lbousaidi change some logic to have physical
|
||||
* elements matches the selection of default limits *
|
||||
* elements matches the selection of default limits
|
||||
* Apr 19, 2013 1790 rferrel Make dialog non-blocking.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
* @version 1.0
|
||||
*/
|
||||
public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(QcAlertAlarmLimitsDlg.class);
|
||||
|
||||
/**
|
||||
* Control font.
|
||||
|
@ -229,7 +241,6 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
*/
|
||||
private int selection = -9999;
|
||||
|
||||
|
||||
/**
|
||||
* States for the dialog.
|
||||
*/
|
||||
|
@ -238,13 +249,18 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
};
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* System wait cursor no need to dispose.
|
||||
*/
|
||||
private Cursor waitCursor;
|
||||
|
||||
/**
|
||||
* Non-blocking Constructor.
|
||||
*
|
||||
* @param parent
|
||||
* Parent shell.
|
||||
*/
|
||||
public QcAlertAlarmLimitsDlg(Shell parent) {
|
||||
super(parent);
|
||||
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
|
||||
setText("Quality Control and Alert/Alarm Limits");
|
||||
|
||||
dateFormat1 = new SimpleDateFormat("MM/dd");
|
||||
|
@ -253,10 +269,13 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
dateFormat2 = new SimpleDateFormat("MM-dd");
|
||||
dateFormat2.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
|
||||
*/
|
||||
@Override
|
||||
protected Layout constructShellLayout() {
|
||||
// Create the main layout for the shell.
|
||||
|
@ -267,14 +286,29 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
return mainLayout;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
|
||||
*/
|
||||
@Override
|
||||
protected void disposed() {
|
||||
controlFont.dispose();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
||||
* .eclipse.swt.widgets.Shell)
|
||||
*/
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
setReturnValue(false);
|
||||
|
||||
waitCursor = shell.getDisplay().getSystemCursor(SWT.CURSOR_WAIT);
|
||||
|
||||
// Initialize all of the controls and layouts
|
||||
controlFont = new Font(shell.getDisplay(), "Monospace", 10, SWT.NORMAL);
|
||||
|
||||
|
@ -456,7 +490,7 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
// -----------------------------------------------------
|
||||
// Create the location, duration, and date controls
|
||||
// -----------------------------------------------------
|
||||
gd = new GridData(SWT.DEFAULT, SWT.TOP, false, true);
|
||||
gd = new GridData(SWT.FILL, SWT.TOP, true, true);
|
||||
Composite leftComp = new Composite(limitSelectedGroup, SWT.NONE);
|
||||
leftComp.setLayout(new GridLayout(2, false));
|
||||
leftComp.setLayoutData(gd);
|
||||
|
@ -479,7 +513,8 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
durationLbl.setLayoutData(gd);
|
||||
|
||||
durationCbo = new Combo(leftComp, SWT.DROP_DOWN | SWT.READ_ONLY);
|
||||
durationCbo.select(0);
|
||||
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
durationCbo.setLayoutData(gd);
|
||||
|
||||
// Start Date
|
||||
gd = new GridData(SWT.FILL, SWT.CENTER, false, true);
|
||||
|
@ -681,7 +716,7 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
if (saveRecord()) {
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -706,7 +741,7 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
cancelBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -781,28 +816,71 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
return text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data to populate GUI.
|
||||
*/
|
||||
private void initializeData() {
|
||||
|
||||
setBusy(true);
|
||||
|
||||
Job job = new Job("QcAlertAlarmLimits") {
|
||||
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
// Populate PhysElem
|
||||
try {
|
||||
for (String currPE : DataTrashCanDataManager.getInstance()
|
||||
.getPEList()) {
|
||||
final java.util.List<String> peList = DataTrashCanDataManager
|
||||
.getInstance().getPEList();
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
for (String currPE : peList) {
|
||||
physElemList.add(currPE);
|
||||
physElemSelItemList.add(currPE);
|
||||
|
||||
}
|
||||
|
||||
for (String currDur : QcAlertAlarmLimitsDataManager.getInstance()
|
||||
.getShefDur()) {
|
||||
durationCbo.add(currDur);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
final java.util.List<String> durList = QcAlertAlarmLimitsDataManager
|
||||
.getInstance().getShefDur();
|
||||
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
durationCbo.setItems(durList.toArray(new String[0]));
|
||||
updateDialogState(DialogStates.DEFAULT_LIMITS);
|
||||
loadData();
|
||||
} catch (VizException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to load data. ", e);
|
||||
} finally {
|
||||
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
setBusy(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
};
|
||||
job.schedule();
|
||||
}
|
||||
|
||||
private void setBusy(boolean busy) {
|
||||
Cursor cursor = null;
|
||||
if (busy) {
|
||||
cursor = waitCursor;
|
||||
}
|
||||
shell.setCursor(cursor);
|
||||
}
|
||||
|
||||
private void loadData() {
|
||||
|
@ -817,10 +895,12 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
if (currentlyDisplayingDefaultLimits()) {
|
||||
QcAlertAlarmLimitsDataManager man = QcAlertAlarmLimitsDataManager
|
||||
.getInstance();
|
||||
for (DataLimitData currData : man.getDefaultLimits(physElemChk
|
||||
.getSelection(), getSelectedPEs(), forceLoad)) {
|
||||
for (DataLimitData currData : man
|
||||
.getDefaultLimits(physElemChk.getSelection(),
|
||||
getSelectedPEs(), forceLoad)) {
|
||||
|
||||
//Start/End dates format will be changed to MM/DD only for display
|
||||
// Start/End dates format will be changed to MM/DD only for
|
||||
// display
|
||||
|
||||
dayStartChange = changeFormat(currData.getMonthDayStart(),
|
||||
dateFormat2, dateFormat1);
|
||||
|
@ -850,8 +930,8 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
.getInstance();
|
||||
for (LocationDataLimitData currData : man
|
||||
.getLocationLimits(locationChk.getSelection(),
|
||||
locationLimitTF.getText(), physElemChk
|
||||
.getSelection(), getSelectedPEs(),
|
||||
locationLimitTF.getText(),
|
||||
physElemChk.getSelection(), getSelectedPEs(),
|
||||
forceLoad)) {
|
||||
dayStartChange = changeFormat(currData.getMonthDayStart(),
|
||||
dateFormat2, dateFormat1);
|
||||
|
@ -868,15 +948,13 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
dateFormat1, dateFormat2);
|
||||
currData.setMonthDayStart(dayStartChange);
|
||||
currData.setMonthDayEnd(dayEndChange);
|
||||
}
|
||||
|
||||
limitsList.setSelection(0);
|
||||
updateLocationInformationDisplay(currData);
|
||||
|
||||
}
|
||||
getSelectedLimit();
|
||||
}
|
||||
} catch (VizException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM, "Unable to load data. ", e);
|
||||
}
|
||||
|
||||
if (limitsList.getItemCount() > 0) {
|
||||
|
@ -1009,17 +1087,18 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
}
|
||||
}
|
||||
|
||||
/** Get the Start/End dates and change the format from "MM-DD" to "MM/DD"
|
||||
/**
|
||||
* Get the Start/End dates and change the format from "MM-DD" to "MM/DD"
|
||||
*
|
||||
* only for the display.*/
|
||||
|
||||
|
||||
* only for the display.
|
||||
*/
|
||||
|
||||
try {
|
||||
if (currData.getMonthDayStart() != null) {
|
||||
dateSringStart = changeFormat(currData.getMonthDayStart(),
|
||||
dateFormat2, dateFormat1);
|
||||
startDateTF.setText(dateSringStart);}
|
||||
startDateTF.setText(dateSringStart);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Invalid Date");
|
||||
|
@ -1034,7 +1113,8 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
if (currData.getMonthDayEnd() != null) {
|
||||
dateStringEnd = changeFormat(currData.getMonthDayEnd(),
|
||||
dateFormat2, dateFormat1);
|
||||
endDateTF.setText(dateStringEnd);}
|
||||
endDateTF.setText(dateStringEnd);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Invalid Date");
|
||||
|
@ -1053,9 +1133,8 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
|
||||
}
|
||||
|
||||
|
||||
QcAlertAlarmLimitsDataManager man = QcAlertAlarmLimitsDataManager
|
||||
.getInstance();
|
||||
// QcAlertAlarmLimitsDataManager man = QcAlertAlarmLimitsDataManager
|
||||
// .getInstance();
|
||||
grossRangeMinTF.setText(HydroDataUtils.getDisplayString(currData
|
||||
.getGrossRangeMin()));
|
||||
grossRangeMaxTF.setText(HydroDataUtils.getDisplayString(currData
|
||||
|
@ -1107,10 +1186,11 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/** Get the Start/End dates and change the format from "MM-DD" to "MM/DD"
|
||||
/**
|
||||
* Get the Start/End dates and change the format from "MM-DD" to "MM/DD"
|
||||
*
|
||||
* only for the display.*/
|
||||
* only for the display.
|
||||
*/
|
||||
|
||||
try {
|
||||
|
||||
|
@ -1127,7 +1207,8 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
}
|
||||
|
||||
try {
|
||||
dateStringEnd = changeFormat(currData.getMonthDayEnd(), dateFormat2, dateFormat1);
|
||||
dateStringEnd = changeFormat(currData.getMonthDayEnd(),
|
||||
dateFormat2, dateFormat1);
|
||||
endDateTF.setText(dateStringEnd);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
@ -1138,7 +1219,6 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
mb.open();
|
||||
}
|
||||
|
||||
|
||||
// Get the PE
|
||||
String currPE = currData.getPe();
|
||||
for (int i = 0; i < physElemSelItemList.getItemCount(); i++) {
|
||||
|
@ -1148,8 +1228,8 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
}
|
||||
}
|
||||
|
||||
QcAlertAlarmLimitsDataManager man = QcAlertAlarmLimitsDataManager
|
||||
.getInstance();
|
||||
// QcAlertAlarmLimitsDataManager man = QcAlertAlarmLimitsDataManager
|
||||
// .getInstance();
|
||||
grossRangeMinTF.setText(HydroDataUtils.getDisplayString(currData
|
||||
.getGrossRangeMin()));
|
||||
grossRangeMaxTF.setText(HydroDataUtils.getDisplayString(currData
|
||||
|
@ -1207,7 +1287,8 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
|
||||
// change date format display
|
||||
|
||||
private String changeFormat(String initDateFormat, SimpleDateFormat dateF1, SimpleDateFormat dateF2) {
|
||||
private String changeFormat(String initDateFormat, SimpleDateFormat dateF1,
|
||||
SimpleDateFormat dateF2) {
|
||||
String finalDateFormat = null;
|
||||
Date dd1 = null;
|
||||
|
||||
|
@ -1219,8 +1300,8 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
dd1 = dateF1.parse(initDateFormat);
|
||||
|
||||
} catch (ParseException e) {
|
||||
// TODO Auto-generated catch block
|
||||
//e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM, "Error parsing data. ",
|
||||
e);
|
||||
}
|
||||
|
||||
finalDateFormat = dateF2.format(dd1);
|
||||
|
@ -1242,8 +1323,7 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
} else {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Location Does Not Exist");
|
||||
mb
|
||||
.setMessage("Please use Add Location from the Location Menu to add the location first.");
|
||||
mb.setMessage("Please use Add Location from the Location Menu to add the location first.");
|
||||
mb.open();
|
||||
|
||||
success = false;
|
||||
|
@ -1271,7 +1351,8 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
try {
|
||||
rval = HydroDBDataManager.getInstance().checkData(locData) > 0;
|
||||
} catch (VizException e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM, "Error in data check. ",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1290,12 +1371,8 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
|
||||
rval = true;
|
||||
} catch (VizException e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
mb.setMessage("An error occurred while trying to save");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM, "Unable to save data. ",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1315,12 +1392,8 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
|
||||
rval = true;
|
||||
} catch (VizException e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
mb.setMessage("An error occurred while trying to save");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM, "Unable to save data. ",
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1370,8 +1443,8 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
}
|
||||
|
||||
private boolean setSaveValues(DataLimitData dataToSave) {
|
||||
Date startDate=null;
|
||||
Date endDate=null;
|
||||
// Date startDate = null;
|
||||
// Date endDate = null;
|
||||
|
||||
// Make sure that PE is selected
|
||||
|
||||
|
@ -1389,7 +1462,6 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
dataToSave.setDur(getSelectedDuration());
|
||||
|
||||
// Validate date format
|
||||
|
@ -1408,13 +1480,11 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
try {
|
||||
if (!startDateTF.getText().equals("")) {
|
||||
|
||||
|
||||
displayStartDate = changeFormat(startDateTF.getText(),
|
||||
dateFormat1, dateFormat2);
|
||||
dataToSave.setMonthDayStart(displayStartDate);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Invalid Date");
|
||||
mb.setMessage("Please enter a valid Start date");
|
||||
|
@ -1436,8 +1506,8 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
try {
|
||||
if (!endDateTF.getText().equals("")) {
|
||||
|
||||
displayEndDate=changeFormat(endDateTF.getText(),
|
||||
dateFormat1,dateFormat2 );
|
||||
displayEndDate = changeFormat(endDateTF.getText(), dateFormat1,
|
||||
dateFormat2);
|
||||
dataToSave.setMonthDayEnd(displayEndDate);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -1450,20 +1520,7 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
return false;
|
||||
}
|
||||
|
||||
if ((startDate != null) && (endDate != null)
|
||||
&& startDate.after(endDate)) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Invalid Date");
|
||||
mb.setMessage("The end date must be >= the start date, up to\n"
|
||||
+ "a maximum end date of 12/31. Please make the\n"
|
||||
+ "required changes and re-Apply them.");
|
||||
|
||||
mb.open();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Double temp;
|
||||
Double temp = null;
|
||||
|
||||
temp = getDoubleFromTF(grossRangeMinTF, "Gross Range Min");
|
||||
if (temp == null) {
|
||||
|
@ -1578,6 +1635,9 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
return Integer.valueOf(temp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirm and delete entry.
|
||||
*/
|
||||
private void deleteRecord() {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION | SWT.OK
|
||||
| SWT.CANCEL);
|
||||
|
@ -1596,14 +1656,8 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
// Delete via the Hydro Data Manager
|
||||
HydroDBDataManager.getInstance().deleteRecord(currData);
|
||||
} catch (VizException e) {
|
||||
MessageBox mbDel = new MessageBox(shell, SWT.ICON_QUESTION
|
||||
| SWT.OK | SWT.CANCEL);
|
||||
mbDel.setText("Delete Error");
|
||||
mbDel
|
||||
.setMessage("An error occurred while trying to delete the entry");
|
||||
mbDel.open();
|
||||
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to delete data. ", e);
|
||||
}
|
||||
} else {
|
||||
LocationDataLimitData currData = QcAlertAlarmLimitsDataManager
|
||||
|
@ -1614,14 +1668,8 @@ public class QcAlertAlarmLimitsDlg extends CaveSWTDialog {
|
|||
// Delete via the Hydro Data Manager
|
||||
HydroDBDataManager.getInstance().deleteRecord(currData);
|
||||
} catch (VizException e) {
|
||||
MessageBox mbDel = new MessageBox(shell, SWT.ICON_QUESTION
|
||||
| SWT.OK | SWT.CANCEL);
|
||||
mbDel.setText("Delete Error");
|
||||
mbDel
|
||||
.setMessage("An error occurred while trying to delete the entry");
|
||||
mbDel.open();
|
||||
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to delete entry. ", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ package com.raytheon.viz.hydrocommon.datamanager;
|
|||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import com.raytheon.uf.common.dataquery.db.QueryResult;
|
||||
|
@ -38,6 +39,8 @@ import com.raytheon.viz.hydrocommon.util.HydroDataUtils;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 10, 2008 1661 askripsky Initial Creation
|
||||
* Apr 19, 2013 1790 rferrel Cleanup method interfaces;
|
||||
* part of non-blocking dialogs.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -86,7 +89,7 @@ public class LowWaterDataManager extends HydroDataManager {
|
|||
* @param recordsToDelete
|
||||
* @throws VizException
|
||||
*/
|
||||
public void deleteRecords(ArrayList<LowWaterData> recordsToDelete)
|
||||
public void deleteRecords(List<LowWaterData> recordsToDelete)
|
||||
throws VizException {
|
||||
for (LowWaterData currData : recordsToDelete) {
|
||||
deleteRecord(currData);
|
||||
|
@ -100,8 +103,8 @@ public class LowWaterDataManager extends HydroDataManager {
|
|||
* @throws VizException
|
||||
*/
|
||||
public void deleteRecord(LowWaterData recordToDelete) throws VizException {
|
||||
runStatement(String.format(DELETE_STATEMENT, HydroDataUtils
|
||||
.getPKStatement(recordToDelete)));
|
||||
runStatement(String.format(DELETE_STATEMENT,
|
||||
HydroDataUtils.getPKStatement(recordToDelete)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -117,8 +120,9 @@ public class LowWaterDataManager extends HydroDataManager {
|
|||
QueryResult result = runMappedQuery(SELECT_STATEMENT + " WHERE "
|
||||
+ HydroDataUtils.getPKStatement(data));
|
||||
|
||||
return (result.getResultCount() > 0) ? new LowWaterData(result
|
||||
.getRows()[0], result.getColumnNames()) : new LowWaterData();
|
||||
return (result.getResultCount() > 0) ? new LowWaterData(
|
||||
result.getRows()[0], result.getColumnNames())
|
||||
: new LowWaterData();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -129,9 +133,8 @@ public class LowWaterDataManager extends HydroDataManager {
|
|||
* @throws VizException
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<LowWaterData> getLowWaterData(String lid)
|
||||
throws VizException {
|
||||
ArrayList<LowWaterData> rval = new ArrayList<LowWaterData>();
|
||||
public List<LowWaterData> getLowWaterData(String lid) throws VizException {
|
||||
List<LowWaterData> rval = new ArrayList<LowWaterData>();
|
||||
|
||||
QueryResult result = runMappedQuery(SELECT_STATEMENT + " WHERE lid='"
|
||||
+ lid + "' ORDER BY stage DESC, lwdat DESC");
|
||||
|
@ -158,7 +161,8 @@ public class LowWaterDataManager extends HydroDataManager {
|
|||
}
|
||||
|
||||
private void updateLowWaterData(LowWaterData data) throws VizException {
|
||||
runStatement(String.format(UPDATE_STATEMENT,
|
||||
runStatement(String.format(
|
||||
UPDATE_STATEMENT,
|
||||
(data.getFlow() == LowWaterData.MISSING_VALUE) ? "null" : data
|
||||
.getFlow(), data.getRemark(),
|
||||
(data.getStage() == LowWaterData.MISSING_VALUE_D) ? "null"
|
||||
|
|
Loading…
Add table
Reference in a new issue