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