Issue #1790 Changes for non-blocking dialogs CountyStateDlg, CountyZoneUgcDlg, DataAdjustFactorDlg, DataIngestFilterDlg, DataPurgeParamsDlg and DatumDlg; also changes to hydro data mangagers to remove ArrayList for method interfaces.
Change-Id: Id5f56669045afd402bed893c13977641ef59835b Former-commit-id:ec275df412
[formerlyc761fd0938
[formerly 23bf9839c60aa33d7bf43492b72acbeedcf518b9]] Former-commit-id:c761fd0938
Former-commit-id:2bcc5e655c
This commit is contained in:
parent
9409fd486d
commit
2d0155e16d
38 changed files with 1362 additions and 1049 deletions
|
@ -72,7 +72,7 @@ public class FcstPointGroupDlg extends CaveSWTDialog {
|
|||
/**
|
||||
* Cache of forecast groups
|
||||
*/
|
||||
private ArrayList<RPFFcstGroupData> fcstGroups;
|
||||
private java.util.List<RPFFcstGroupData> fcstGroups;
|
||||
|
||||
/**
|
||||
* Previously selected group
|
||||
|
@ -82,7 +82,7 @@ public class FcstPointGroupDlg extends CaveSWTDialog {
|
|||
/**
|
||||
* List of listeners to group assignment changes
|
||||
*/
|
||||
private ArrayList<IForecastGroupAssignmentListener> fcstGroupListeners;
|
||||
private java.util.List<IForecastGroupAssignmentListener> fcstGroupListeners;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -236,8 +236,7 @@ public class FcstPointGroupDlg extends CaveSWTDialog {
|
|||
}
|
||||
} else {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb
|
||||
.setMessage("No forecast groups have been defined under \"Setup\"");
|
||||
mb.setMessage("No forecast groups have been defined under \"Setup\"");
|
||||
mb.open();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,6 +134,11 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
* Changes for non-blocking AdministrationDlg.
|
||||
* Changes for non-blocking ArealDefinitionsDlg.
|
||||
* Changes for non-blocking BenchmarkDlg.
|
||||
* Changes for non-blocking CountyZoneUgcDlg.
|
||||
* Changes for non-blocking DataAdjustFactorDlg.
|
||||
* Changes for non-blocking DataIngestFilterDlg.
|
||||
* Changes for non-blocking DataPurgeParamsDlg.
|
||||
* Changes for non-blocking DatumDlg .
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -171,6 +176,31 @@ public class HydroBaseDlg extends CaveSWTDialog implements IGetSortType,
|
|||
*/
|
||||
private final Map<String, BenchmarkDlg> benchmarkDlgMap = new HashMap<String, BenchmarkDlg>();
|
||||
|
||||
/**
|
||||
* Allow one County/Zone UGC dialog per location.
|
||||
*/
|
||||
private final Map<String, CountyZoneUgcDlg> czDlgMap = new HashMap<String, CountyZoneUgcDlg>();;
|
||||
|
||||
/**
|
||||
* Allow one Data Adjustment Factor dialog.
|
||||
*/
|
||||
private DataAdjustFactorDlg dataAdjustDlg;
|
||||
|
||||
/**
|
||||
* Allow one Ingest Filter Dialog.
|
||||
*/
|
||||
private DataIngestFilterDlg dataIngestDlg;
|
||||
|
||||
/*
|
||||
* Allow one data purge paramertres dialog.
|
||||
*/
|
||||
private DataPurgeParamsDlg dataPurgeDlg;
|
||||
|
||||
/**
|
||||
* Allow one dataum dialog per station.
|
||||
*/
|
||||
private final Map<String, DatumDlg> datumDlgMap = new HashMap<String, DatumDlg>();
|
||||
|
||||
/**
|
||||
* Flood category menu item.
|
||||
*/
|
||||
|
@ -499,9 +529,26 @@ public class HydroBaseDlg extends CaveSWTDialog implements IGetSortType,
|
|||
countyZoneUgcMI.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
CountyZoneUgcDlg czDlg = new CountyZoneUgcDlg(shell,
|
||||
getStationAndName(), getSelectedLocation().getStation());
|
||||
czDlg.open();
|
||||
String lid = getSelectedLocation().getStation();
|
||||
CountyZoneUgcDlg czDlg = czDlgMap.get(lid);
|
||||
if (czDlg == null) {
|
||||
czDlg = new CountyZoneUgcDlg(shell, getStationAndName(),
|
||||
lid);
|
||||
czDlg.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof String) {
|
||||
String lid = returnValue.toString();
|
||||
czDlgMap.remove(lid);
|
||||
}
|
||||
}
|
||||
});
|
||||
czDlgMap.put(lid, czDlg);
|
||||
czDlg.open();
|
||||
} else {
|
||||
czDlg.bringToTop();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -724,9 +771,25 @@ public class HydroBaseDlg extends CaveSWTDialog implements IGetSortType,
|
|||
datumMI.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
DatumDlg datumDlg = new DatumDlg(shell, getStationAndName(),
|
||||
getSelectedLocation().getStation());
|
||||
datumDlg.open();
|
||||
String lid = getSelectedLocation().getStation();
|
||||
DatumDlg datumDlg = datumDlgMap.get(lid);
|
||||
if (datumDlg == null) {
|
||||
datumDlg = new DatumDlg(shell, getStationAndName(), lid);
|
||||
datumDlg.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof String) {
|
||||
String lid = returnValue.toString();
|
||||
datumDlgMap.remove(lid);
|
||||
}
|
||||
}
|
||||
});
|
||||
datumDlgMap.put(lid, datumDlg);
|
||||
datumDlg.open();
|
||||
} else {
|
||||
datumDlg.bringToTop();
|
||||
}
|
||||
}
|
||||
});
|
||||
riverGageMenuItems.add(datumMI);
|
||||
|
@ -838,9 +901,12 @@ public class HydroBaseDlg extends CaveSWTDialog implements IGetSortType,
|
|||
ingestFilterMI.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
DataIngestFilterDlg dataIngetsDlg = new DataIngestFilterDlg(
|
||||
shell);
|
||||
dataIngetsDlg.open();
|
||||
if (dataIngestDlg == null || dataIngestDlg.isDisposed()) {
|
||||
dataIngestDlg = new DataIngestFilterDlg(shell);
|
||||
dataIngestDlg.open();
|
||||
} else {
|
||||
dataIngestDlg.bringToTop();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -850,9 +916,12 @@ public class HydroBaseDlg extends CaveSWTDialog implements IGetSortType,
|
|||
adjustmentFactorsMI.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
DataAdjustFactorDlg dataAdjustDlg = new DataAdjustFactorDlg(
|
||||
shell);
|
||||
dataAdjustDlg.open();
|
||||
if (dataAdjustDlg == null || dataAdjustDlg.isDisposed()) {
|
||||
dataAdjustDlg = new DataAdjustFactorDlg(shell);
|
||||
dataAdjustDlg.open();
|
||||
} else {
|
||||
dataAdjustDlg.bringToTop();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -874,8 +943,12 @@ public class HydroBaseDlg extends CaveSWTDialog implements IGetSortType,
|
|||
purgeParamsMI.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
DataPurgeParamsDlg dataPurgeDlg = new DataPurgeParamsDlg(shell);
|
||||
dataPurgeDlg.open();
|
||||
if (dataPurgeDlg == null || dataPurgeDlg.isDisposed()) {
|
||||
dataPurgeDlg = new DataPurgeParamsDlg(shell);
|
||||
dataPurgeDlg.open();
|
||||
} else {
|
||||
dataPurgeDlg.bringToTop();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1702,7 +1775,7 @@ public class HydroBaseDlg extends CaveSWTDialog implements IGetSortType,
|
|||
private String getPassword() {
|
||||
String pw = null;
|
||||
try {
|
||||
ArrayList<AdministrationData> data = HydroDBDataManager
|
||||
java.util.List<AdministrationData> data = HydroDBDataManager
|
||||
.getInstance().getData(AdministrationData.class);
|
||||
|
||||
// if no data is returned, clear the current display data
|
||||
|
|
|
@ -389,7 +389,7 @@ public class AddModifyLocationDlg extends CaveSWTDialog implements
|
|||
/**
|
||||
* Listeners to notify main HB Dialog of station list changes
|
||||
*/
|
||||
private ArrayList<IStationListener> stationListeners;
|
||||
private java.util.List<IStationListener> stationListeners;
|
||||
|
||||
/**
|
||||
* States for the dialog
|
||||
|
@ -1300,7 +1300,7 @@ public class AddModifyLocationDlg extends CaveSWTDialog implements
|
|||
StationClassData seedData = new StationClassData();
|
||||
seedData.setLid(lid);
|
||||
|
||||
ArrayList<StationClassData> classData = new ArrayList<StationClassData>();
|
||||
java.util.List<StationClassData> classData = new ArrayList<StationClassData>();
|
||||
try {
|
||||
classData = HydroDBDataManager.getInstance().getData(seedData);
|
||||
|
||||
|
@ -1494,7 +1494,7 @@ public class AddModifyLocationDlg extends CaveSWTDialog implements
|
|||
coopAgencyOfficeList.removeAll();
|
||||
|
||||
try {
|
||||
ArrayList<String> offices = AddModifyLocationDataManager
|
||||
java.util.List<String> offices = AddModifyLocationDataManager
|
||||
.getInstance().getSelectedAgenciesAndOffices(lid);
|
||||
|
||||
for (String currOffice : offices) {
|
||||
|
@ -1578,7 +1578,7 @@ public class AddModifyLocationDlg extends CaveSWTDialog implements
|
|||
private void setDefaultHsaWfo() {
|
||||
// If adding location, HSA and WFO default to Admin table values
|
||||
try {
|
||||
ArrayList<AdministrationData> data = HydroDBDataManager
|
||||
java.util.List<AdministrationData> data = HydroDBDataManager
|
||||
.getInstance().getData(AdministrationData.class);
|
||||
|
||||
if (data.size() > 0) {
|
||||
|
|
|
@ -21,7 +21,6 @@ package com.raytheon.viz.hydrobase.dialogs;
|
|||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
|
||||
|
@ -342,7 +341,7 @@ public class AdministrationDlg extends CaveSWTDialog {
|
|||
|
||||
private void getAdministrationData() {
|
||||
try {
|
||||
ArrayList<AdministrationData> data = HydroDBDataManager
|
||||
java.util.List<AdministrationData> data = HydroDBDataManager
|
||||
.getInstance().getData(AdministrationData.class);
|
||||
|
||||
// if no data is returned, clear the current display data
|
||||
|
|
|
@ -121,7 +121,7 @@ public class BenchmarkDlg extends CaveSWTDialog {
|
|||
/**
|
||||
* Benchmark data for the current location.
|
||||
*/
|
||||
private ArrayList<BenchmarkData> benchData;
|
||||
private java.util.List<BenchmarkData> benchData;
|
||||
|
||||
/**
|
||||
* Dialog states.
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
**/
|
||||
package com.raytheon.viz.hydrobase.dialogs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
|
@ -105,12 +103,12 @@ public class CoopAgencyOfficeDlg extends CaveSWTDialog {
|
|||
/**
|
||||
* Cache of available agencies/offices
|
||||
*/
|
||||
private ArrayList<AgencyOfficeData> availData;
|
||||
private java.util.List<AgencyOfficeData> availData;
|
||||
|
||||
/**
|
||||
* Cache of selected agencies/offices
|
||||
*/
|
||||
private ArrayList<LocationAgencyOfficeData> selectedData;
|
||||
private java.util.List<LocationAgencyOfficeData> selectedData;
|
||||
|
||||
/**
|
||||
* Non-blocking Constructor.
|
||||
|
|
|
@ -72,12 +72,12 @@ public class CountyStateDlg extends CaveSWTDialog {
|
|||
/**
|
||||
* Hold the county/state data
|
||||
*/
|
||||
private ArrayList<CountiesData> countiesData;
|
||||
private java.util.List<CountiesData> countiesData;
|
||||
|
||||
/**
|
||||
* List of listeners for changes
|
||||
*/
|
||||
private ArrayList<ICountyStateListener> countyStateListeners;
|
||||
private java.util.List<ICountyStateListener> countyStateListeners;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
|
|
@ -33,6 +33,9 @@ import org.eclipse.swt.widgets.Layout;
|
|||
import org.eclipse.swt.widgets.List;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.viz.hydrocommon.data.CountiesData;
|
||||
import com.raytheon.viz.hydrocommon.data.CountyInfoData;
|
||||
|
@ -51,6 +54,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* 02 Sep 2008 lvenable Initial creation.
|
||||
* 30 Dec 2008 1802 askripsk Connect to database.
|
||||
* 04 Dec 2012 15522 wkwock Fix incorrect zones and not able to add
|
||||
* 18 Apr 2013 1790 rferrel Make dialog non-blocking.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -59,6 +63,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
*
|
||||
*/
|
||||
public class CountyZoneUgcDlg extends CaveSWTDialog {
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(CountyZoneUgcDlg.class);
|
||||
|
||||
/**
|
||||
* Control font.
|
||||
|
@ -96,11 +102,13 @@ public class CountyZoneUgcDlg extends CaveSWTDialog {
|
|||
private Button clearBtn;
|
||||
|
||||
/**
|
||||
* for keep track whether selected zones are initialized. false is not initialized.
|
||||
* For keep track whether selected zones are initialized. false is not
|
||||
* initialized.
|
||||
*/
|
||||
private boolean zonesFlag = false;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Non-blocking Constructor.
|
||||
*
|
||||
* @param parent
|
||||
* Parent shell.
|
||||
|
@ -108,12 +116,17 @@ public class CountyZoneUgcDlg extends CaveSWTDialog {
|
|||
* Dialog title information.
|
||||
*/
|
||||
public CountyZoneUgcDlg(Shell parent, String titleInfo, String lid) {
|
||||
super(parent);
|
||||
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
|
||||
setText("County/Zone UGC" + titleInfo);
|
||||
|
||||
setReturnValue(lid);
|
||||
CountyZoneUgcDataManager.getInstance().setLid(lid);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
|
||||
*/
|
||||
@Override
|
||||
protected Layout constructShellLayout() {
|
||||
// Create the main layout for the shell.
|
||||
|
@ -124,6 +137,11 @@ public class CountyZoneUgcDlg extends CaveSWTDialog {
|
|||
return mainLayout;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
|
||||
*/
|
||||
@Override
|
||||
protected void disposed() {
|
||||
controlFont.dispose();
|
||||
|
@ -131,7 +149,6 @@ public class CountyZoneUgcDlg extends CaveSWTDialog {
|
|||
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
setReturnValue(false);
|
||||
|
||||
controlFont = new Font(shell.getDisplay(), "Monospace", 10, SWT.NORMAL);
|
||||
|
||||
|
@ -162,9 +179,9 @@ public class CountyZoneUgcDlg extends CaveSWTDialog {
|
|||
selectionCbo.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
if (!zonesFlag) {
|
||||
getZoneData();
|
||||
}
|
||||
if (!zonesFlag) {
|
||||
getZoneData();
|
||||
}
|
||||
updateDisplay();
|
||||
}
|
||||
});
|
||||
|
@ -272,7 +289,7 @@ public class CountyZoneUgcDlg extends CaveSWTDialog {
|
|||
okBtn.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
saveRecords();
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -292,7 +309,7 @@ public class CountyZoneUgcDlg extends CaveSWTDialog {
|
|||
cancelBtn.setLayoutData(gd);
|
||||
cancelBtn.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -326,7 +343,8 @@ public class CountyZoneUgcDlg extends CaveSWTDialog {
|
|||
try {
|
||||
CountyZoneUgcDataManager.getInstance().getCountiesSelected(true);
|
||||
} catch (VizException e) {
|
||||
e.printStackTrace();
|
||||
statusHandler
|
||||
.handle(Priority.PROBLEM, "Unable to county data. ", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -336,9 +354,9 @@ public class CountyZoneUgcDlg extends CaveSWTDialog {
|
|||
private void getZoneData() {
|
||||
try {
|
||||
CountyZoneUgcDataManager.getInstance().getZonesSelected(true);
|
||||
zonesFlag=true;
|
||||
zonesFlag = true;
|
||||
} catch (VizException e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM, "Unable to zone data. ", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -365,24 +383,25 @@ public class CountyZoneUgcDlg extends CaveSWTDialog {
|
|||
try {
|
||||
for (CountiesData availCounty : CountyZoneUgcDataManager
|
||||
.getInstance().getCountiesAvailable()) {
|
||||
availableList.add(String.format(countyFormat, availCounty
|
||||
.getCountyNumber(), availCounty.getCounty(),
|
||||
availableList.add(String.format(countyFormat,
|
||||
availCounty.getCountyNumber(), availCounty.getCounty(),
|
||||
availCounty.getState()));
|
||||
}
|
||||
|
||||
for (CountyInfoData selectedCounty : CountyZoneUgcDataManager
|
||||
.getInstance().getCountiesSelected()) {
|
||||
selectedList.add(String.format(countyFormat, selectedCounty
|
||||
.getCountyNumber(), selectedCounty.getCounty(),
|
||||
selectedCounty.getState()));
|
||||
selectedList.add(String.format(countyFormat,
|
||||
selectedCounty.getCountyNumber(),
|
||||
selectedCounty.getCounty(), selectedCounty.getState()));
|
||||
}
|
||||
} catch (VizException e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to get county data. ", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Displayes the current Zone data.
|
||||
* Displays the current Zone data.
|
||||
*/
|
||||
private void updateZoneDisplay() {
|
||||
String zoneFormat = "%3s %-20s %2s";
|
||||
|
@ -390,19 +409,22 @@ public class CountyZoneUgcDlg extends CaveSWTDialog {
|
|||
try {
|
||||
for (EligZoneData availZone : CountyZoneUgcDataManager
|
||||
.getInstance().getZonesAvailable()) {
|
||||
availableList.add(String.format(zoneFormat, availZone
|
||||
.getZoneNumber(), availZone.getDescription(), availZone
|
||||
.getState()));
|
||||
availableList.add(String.format(zoneFormat,
|
||||
availZone.getZoneNumber(), availZone.getDescription(),
|
||||
availZone.getState()));
|
||||
}
|
||||
|
||||
for (ZoneInfoData selectedZone : CountyZoneUgcDataManager
|
||||
.getInstance().getZonesSelected()) {
|
||||
selectedList.add(String.format(zoneFormat, selectedZone
|
||||
.getZoneNumber(), selectedZone.getDescription(),
|
||||
selectedZone.getState()));
|
||||
selectedList
|
||||
.add(String.format(zoneFormat,
|
||||
selectedZone.getZoneNumber(),
|
||||
selectedZone.getDescription(),
|
||||
selectedZone.getState()));
|
||||
}
|
||||
} catch (VizException e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to get county data. ", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -432,6 +454,9 @@ public class CountyZoneUgcDlg extends CaveSWTDialog {
|
|||
updateDisplay();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the selected record and update display.
|
||||
*/
|
||||
private void deleteRecord() {
|
||||
int selectedIndex = selectedList.getSelectionIndex();
|
||||
|
||||
|
@ -448,6 +473,9 @@ public class CountyZoneUgcDlg extends CaveSWTDialog {
|
|||
updateDisplay();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all the records and update the display.
|
||||
*/
|
||||
private void clearRecords() {
|
||||
if (countiesDisplayed()) {
|
||||
CountyZoneUgcDataManager.getInstance().clearSelectedCounties();
|
||||
|
@ -458,6 +486,9 @@ public class CountyZoneUgcDlg extends CaveSWTDialog {
|
|||
updateDisplay();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save records to the manager.
|
||||
*/
|
||||
private void saveRecords() {
|
||||
try {
|
||||
if (countiesDisplayed()) {
|
||||
|
@ -466,8 +497,8 @@ public class CountyZoneUgcDlg extends CaveSWTDialog {
|
|||
CountyZoneUgcDataManager.getInstance().saveZones();
|
||||
}
|
||||
} catch (VizException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
statusHandler
|
||||
.handle(Priority.PROBLEM, "Unable to save records ", e);
|
||||
}
|
||||
|
||||
getDialogData();
|
||||
|
|
|
@ -36,11 +36,14 @@ import org.eclipse.swt.widgets.Group;
|
|||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Layout;
|
||||
import org.eclipse.swt.widgets.List;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.MessageBox;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.swt.widgets.*;
|
||||
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.viz.hydrocommon.HydroConstants;
|
||||
import com.raytheon.viz.hydrocommon.data.DataAdjustFactorData;
|
||||
|
@ -64,6 +67,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Mar 05, 2010 1928 mpduff Added additional form validation.
|
||||
* Oct 26, 2010 5937 Judy Wang Converted lower case to upper
|
||||
* case in Location box.
|
||||
* Apr 18, 2013 1790 rferrel Make dialog non-blocking.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -71,6 +75,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class DataAdjustFactorDlg extends CaveSWTDialog {
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(DataAdjustFactorDlg.class);
|
||||
|
||||
/**
|
||||
* Control font.
|
||||
|
@ -134,10 +140,15 @@ public class DataAdjustFactorDlg extends CaveSWTDialog {
|
|||
* Parent shell.
|
||||
*/
|
||||
public DataAdjustFactorDlg(Shell parent) {
|
||||
super(parent);
|
||||
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
|
||||
setText("Data Adjustment Factors");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
|
||||
*/
|
||||
@Override
|
||||
protected Layout constructShellLayout() {
|
||||
GridLayout mainLayout = new GridLayout(1, false);
|
||||
|
@ -147,11 +158,23 @@ public class DataAdjustFactorDlg extends CaveSWTDialog {
|
|||
return mainLayout;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
|
||||
*/
|
||||
@Override
|
||||
protected void disposed() {
|
||||
controlFont.dispose();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
||||
* .eclipse.swt.widgets.Shell)
|
||||
*/
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
setReturnValue(false);
|
||||
|
@ -236,21 +259,21 @@ public class DataAdjustFactorDlg extends CaveSWTDialog {
|
|||
locationTF = new Text(selectedItemGroup, SWT.BORDER);
|
||||
locationTF.setLayoutData(gd);
|
||||
locationTF.setTextLimit(8);
|
||||
locationTF.addListener(SWT.Verify, new Listener(){
|
||||
public void handleEvent(Event e){
|
||||
String newStr = e.text;
|
||||
char[] newChars = new char[newStr.length()];
|
||||
newStr.getChars(0, newChars.length, newChars, 0);
|
||||
for (int i = 0; i < newChars.length; i++){
|
||||
if (!('0' <= newChars[i] && newChars[i] <= '9') &&
|
||||
!('a' <= newChars[i] && newChars[i] <= 'z') &&
|
||||
!('A' <= newChars[i] && newChars[i] <= 'Z')) {
|
||||
e.doit = false;
|
||||
}
|
||||
}
|
||||
e.text = e.text.toUpperCase();
|
||||
}
|
||||
});
|
||||
locationTF.addListener(SWT.Verify, new Listener() {
|
||||
public void handleEvent(Event e) {
|
||||
String newStr = e.text;
|
||||
char[] newChars = new char[newStr.length()];
|
||||
newStr.getChars(0, newChars.length, newChars, 0);
|
||||
for (int i = 0; i < newChars.length; i++) {
|
||||
if (!('0' <= newChars[i] && newChars[i] <= '9')
|
||||
&& !('a' <= newChars[i] && newChars[i] <= 'z')
|
||||
&& !('A' <= newChars[i] && newChars[i] <= 'Z')) {
|
||||
e.doit = false;
|
||||
}
|
||||
}
|
||||
e.text = e.text.toUpperCase();
|
||||
}
|
||||
});
|
||||
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
gd.verticalSpan = 4;
|
||||
Label filler = new Label(selectedItemGroup, SWT.NONE);
|
||||
|
@ -377,7 +400,7 @@ public class DataAdjustFactorDlg extends CaveSWTDialog {
|
|||
closeBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -440,8 +463,8 @@ public class DataAdjustFactorDlg extends CaveSWTDialog {
|
|||
}
|
||||
|
||||
} catch (VizException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Problem getting dialog data ", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -482,8 +505,8 @@ public class DataAdjustFactorDlg extends CaveSWTDialog {
|
|||
peList.add(currPE);
|
||||
}
|
||||
} catch (VizException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Problem loading static data ", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -553,8 +576,7 @@ public class DataAdjustFactorDlg extends CaveSWTDialog {
|
|||
|
||||
getDialogData(true);
|
||||
} catch (VizException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM, "Probem saving record ");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -609,8 +631,8 @@ public class DataAdjustFactorDlg extends CaveSWTDialog {
|
|||
}
|
||||
|
||||
// Divisor
|
||||
divisorTF.setText(HydroDataUtils
|
||||
.getDisplayString(currData.getDivisor()));
|
||||
divisorTF
|
||||
.setText(HydroDataUtils.getDisplayString(currData.getDivisor()));
|
||||
|
||||
// Base
|
||||
baseTF.setText(HydroDataUtils.getDisplayString(currData.getBase()));
|
||||
|
@ -693,7 +715,8 @@ public class DataAdjustFactorDlg extends CaveSWTDialog {
|
|||
try {
|
||||
HydroDBDataManager.getInstance().deleteRecord(currData);
|
||||
} catch (VizException e) {
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Problem deleting record ", e);
|
||||
}
|
||||
|
||||
getDialogData(true);
|
||||
|
@ -704,6 +727,12 @@ public class DataAdjustFactorDlg extends CaveSWTDialog {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display error message.
|
||||
*
|
||||
* @param title
|
||||
* @param message
|
||||
*/
|
||||
private void showMessage(String title, String message) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText(title);
|
||||
|
|
|
@ -20,14 +20,20 @@
|
|||
package com.raytheon.viz.hydrobase.dialogs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.KeyEvent;
|
||||
import org.eclipse.swt.events.KeyListener;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.graphics.Cursor;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
|
@ -44,6 +50,10 @@ import org.eclipse.swt.widgets.Shell;
|
|||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
import com.raytheon.uf.common.dataquery.db.QueryResult;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.viz.hydrocommon.HydroConstants;
|
||||
import com.raytheon.viz.hydrocommon.data.DataIngestFilterData;
|
||||
|
@ -63,6 +73,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 4, 2008 lvenable Initial creation
|
||||
* Dec 11, 2008 1787 askripsk Connect to DB
|
||||
* Apr 18, 2013 1790 rferrel Make dialog non-blocking.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -70,6 +81,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class DataIngestFilterDlg extends CaveSWTDialog {
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(DataIngestFilterDlg.class);
|
||||
|
||||
/**
|
||||
* Control font.
|
||||
|
@ -263,6 +276,16 @@ public class DataIngestFilterDlg extends CaveSWTDialog {
|
|||
ADD_RECORD, NO_DATA, DATA_AVAILABLE
|
||||
}
|
||||
|
||||
/**
|
||||
* Set to display's wait cursor. No need to dispose.
|
||||
*/
|
||||
private Cursor waitCursor;
|
||||
|
||||
/**
|
||||
* Used by setBusy to determine which cursor to display.
|
||||
*/
|
||||
private AtomicInteger busyCnt = new AtomicInteger(0);
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
@ -270,10 +293,15 @@ public class DataIngestFilterDlg extends CaveSWTDialog {
|
|||
* Parent shell.
|
||||
*/
|
||||
public DataIngestFilterDlg(Shell parent) {
|
||||
super(parent);
|
||||
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
|
||||
setText("Data Ingest Filter");
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
|
||||
*/
|
||||
@Override
|
||||
protected Layout constructShellLayout() {
|
||||
GridLayout mainLayout = new GridLayout(1, false);
|
||||
|
@ -283,15 +311,29 @@ public class DataIngestFilterDlg extends CaveSWTDialog {
|
|||
return mainLayout;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
|
||||
*/
|
||||
@Override
|
||||
protected void disposed() {
|
||||
controlFont.dispose();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
||||
* .eclipse.swt.widgets.Shell)
|
||||
*/
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
setReturnValue(false);
|
||||
|
||||
waitCursor = shell.getDisplay().getSystemCursor(SWT.CURSOR_WAIT);
|
||||
|
||||
controlFont = new Font(shell.getDisplay(), "Monospace", 10, SWT.NORMAL);
|
||||
selectedItemControls = new ArrayList<Control>();
|
||||
|
||||
|
@ -300,9 +342,17 @@ public class DataIngestFilterDlg extends CaveSWTDialog {
|
|||
createSelectedItemGroup();
|
||||
|
||||
createBottomButtons();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialog#preOpened()
|
||||
*/
|
||||
@Override
|
||||
protected void preOpened() {
|
||||
super.preOpened();
|
||||
populateStaticData();
|
||||
|
||||
populateLists(true);
|
||||
}
|
||||
|
||||
|
@ -798,7 +848,7 @@ public class DataIngestFilterDlg extends CaveSWTDialog {
|
|||
okBtn.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
if (saveRecord()) {
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -821,7 +871,7 @@ public class DataIngestFilterDlg extends CaveSWTDialog {
|
|||
cancelBtn.setLayoutData(gd);
|
||||
cancelBtn.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -889,19 +939,12 @@ public class DataIngestFilterDlg extends CaveSWTDialog {
|
|||
physElemSelectedList.add(currPE);
|
||||
}
|
||||
} catch (VizException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Problem populating static data ", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates the main ingest filter list with data from the database cache.
|
||||
*/
|
||||
private void populateLists() {
|
||||
populateLists(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates the main ingest filter list with data from the database.
|
||||
*
|
||||
|
@ -911,32 +954,98 @@ public class DataIngestFilterDlg extends CaveSWTDialog {
|
|||
*/
|
||||
private void populateLists(boolean forceLoad) {
|
||||
ingestDataList.removeAll();
|
||||
setBusy(true);
|
||||
|
||||
DataIngestFilterDataManager man = DataIngestFilterDataManager
|
||||
.getInstance();
|
||||
getIngestFilter(physElemChk.getSelection(), getSelectedPEs(),
|
||||
locationChk.getSelection(), locationFilterTF.getText(),
|
||||
switchesChk.getSelection(), masterFilterChk.getSelection(),
|
||||
ofsFilterChk.getSelection(), mpeFilterChk.getSelection(),
|
||||
typeSrcChk.getSelection(),
|
||||
getSelectedStringValue(typeSrcFilterCbo), forceLoad);
|
||||
}
|
||||
|
||||
try {
|
||||
ArrayList<DataIngestFilterData> temp = man.getIngestFilter(
|
||||
physElemChk.getSelection(), getSelectedPEs(), locationChk
|
||||
.getSelection(), locationFilterTF.getText(),
|
||||
switchesChk.getSelection(), masterFilterChk.getSelection(),
|
||||
ofsFilterChk.getSelection(), mpeFilterChk.getSelection(),
|
||||
typeSrcChk.getSelection(),
|
||||
getSelectedStringValue(typeSrcFilterCbo), forceLoad);
|
||||
/**
|
||||
* Queries manager for data to populate the ingest data list off the UI
|
||||
* thread.
|
||||
*
|
||||
* @param physElemChkSelection
|
||||
* @param selectedPEs
|
||||
* @param locationChkSelection
|
||||
* @param locationFilterText
|
||||
* @param switchesChkSelection
|
||||
* @param masterFilterChkSelection
|
||||
* @param ofsFilterChkSelection
|
||||
* @param mpeFilterChkSelection
|
||||
* @param typeSrcChkSelection
|
||||
* @param typeSrcFilterCboValue
|
||||
* @param forceLoad
|
||||
*/
|
||||
private void getIngestFilter(final boolean physElemChkSelection,
|
||||
final java.util.List<String> selectedPEs,
|
||||
final boolean locationChkSelection,
|
||||
final String locationFilterText,
|
||||
final boolean switchesChkSelection,
|
||||
final boolean masterFilterChkSelection,
|
||||
final boolean ofsFilterChkSelection,
|
||||
final boolean mpeFilterChkSelection,
|
||||
final boolean typeSrcChkSelection,
|
||||
final String typeSrcFilterCboValue, final boolean forceLoad) {
|
||||
|
||||
for (DataIngestFilterData currData : temp) {
|
||||
Job job = new Job("") {
|
||||
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
|
||||
DataIngestFilterDataManager man = DataIngestFilterDataManager
|
||||
.getInstance();
|
||||
java.util.List<DataIngestFilterData> temp = null;
|
||||
try {
|
||||
temp = man.getIngestFilter(physElemChkSelection,
|
||||
selectedPEs, locationChkSelection,
|
||||
locationFilterText, switchesChkSelection,
|
||||
masterFilterChkSelection, ofsFilterChkSelection,
|
||||
mpeFilterChkSelection, typeSrcChkSelection,
|
||||
typeSrcFilterCboValue, forceLoad);
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Problem filter list ", e);
|
||||
} finally {
|
||||
final java.util.List<DataIngestFilterData> t = temp;
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
updatePopulateList(t);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
};
|
||||
job.schedule();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the ingest data list.
|
||||
*
|
||||
* @param difData
|
||||
*/
|
||||
private void updatePopulateList(java.util.List<DataIngestFilterData> difData) {
|
||||
if (difData != null) {
|
||||
DataIngestFilterDataManager man = DataIngestFilterDataManager
|
||||
.getInstance();
|
||||
for (DataIngestFilterData currData : difData) {
|
||||
ingestDataList.add(man.getIngestFilterString(currData));
|
||||
}
|
||||
} catch (VizException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (ingestDataList.getItemCount() > 0) {
|
||||
updateDialogState(DialogStates.DATA_AVAILABLE);
|
||||
} else {
|
||||
updateDialogState(DialogStates.NO_DATA);
|
||||
if (ingestDataList.getItemCount() > 0) {
|
||||
updateDialogState(DialogStates.DATA_AVAILABLE);
|
||||
} else {
|
||||
updateDialogState(DialogStates.NO_DATA);
|
||||
}
|
||||
}
|
||||
setBusy(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -944,9 +1053,9 @@ public class DataIngestFilterDlg extends CaveSWTDialog {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
private ArrayList<String> getSelectedPEs() {
|
||||
private java.util.List<String> getSelectedPEs() {
|
||||
int[] selectedInd = physElemFilterList.getSelectionIndices();
|
||||
ArrayList<String> peFilter = new ArrayList<String>();
|
||||
java.util.List<String> peFilter = new ArrayList<String>();
|
||||
|
||||
for (int i : selectedInd) {
|
||||
peFilter.add(physElemFilterList.getItem(i).split(" ")[0]
|
||||
|
@ -1071,12 +1180,7 @@ public class DataIngestFilterDlg extends CaveSWTDialog {
|
|||
successful = true;
|
||||
}
|
||||
} catch (VizException e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
mb.setMessage("An error occurred while saving");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM, "Problem saving record ", e);
|
||||
}
|
||||
|
||||
populateLists(true);
|
||||
|
@ -1108,8 +1212,8 @@ public class DataIngestFilterDlg extends CaveSWTDialog {
|
|||
mb.open();
|
||||
}
|
||||
} catch (VizException e) {
|
||||
// don't care, just return false
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Problem checking constraints ", e);
|
||||
}
|
||||
|
||||
return rval;
|
||||
|
@ -1217,13 +1321,8 @@ public class DataIngestFilterDlg extends CaveSWTDialog {
|
|||
|
||||
populateLists(true);
|
||||
} catch (VizException e) {
|
||||
MessageBox mbErr = new MessageBox(shell, SWT.ICON_ERROR
|
||||
| SWT.OK);
|
||||
mbErr.setText("Unable to Save");
|
||||
mbErr.setMessage("An error occurred while saving");
|
||||
mbErr.open();
|
||||
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Problem savings switches ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1267,14 +1366,8 @@ public class DataIngestFilterDlg extends CaveSWTDialog {
|
|||
// Synchronize StnClass table
|
||||
StnClassSyncUtil.setStnClass(selectedData.getLid());
|
||||
} catch (VizException e) {
|
||||
MessageBox mbErr = new MessageBox(shell, SWT.ICON_ERROR
|
||||
| SWT.OK);
|
||||
mbErr.setText("Delete Failure");
|
||||
mbErr
|
||||
.setMessage("An error occurred while trying to delete the record.");
|
||||
mbErr.open();
|
||||
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Problem deleting record ", e);
|
||||
}
|
||||
|
||||
populateLists(true);
|
||||
|
@ -1331,4 +1424,18 @@ public class DataIngestFilterDlg extends CaveSWTDialog {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine what cursor to display.
|
||||
*
|
||||
* @param busy
|
||||
*/
|
||||
private void setBusy(boolean busy) {
|
||||
if (busy) {
|
||||
busyCnt.incrementAndGet();
|
||||
shell.setCursor(waitCursor);
|
||||
} else if (busyCnt.decrementAndGet() == 0) {
|
||||
shell.setCursor(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,12 +20,17 @@
|
|||
package com.raytheon.viz.hydrobase.dialogs;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.TimeZone;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.graphics.Cursor;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
|
@ -39,6 +44,10 @@ import org.eclipse.swt.widgets.MessageBox;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.viz.hydrocommon.HydroConstants;
|
||||
import com.raytheon.viz.hydrocommon.data.PurgeDynData;
|
||||
|
@ -58,6 +67,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Sep 4, 2008 lvenable Initial creation
|
||||
* Dec 17, 2008 1787 askripsk Connected to Database.
|
||||
* May 6, 2009 2181 mpduff Keep selection upon submit.
|
||||
* Apr 18, 2013 1790 rferrel Make dialog non-blocking.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -65,6 +75,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class DataPurgeParamsDlg extends CaveSWTDialog {
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(DataPurgeParamsDlg.class);
|
||||
|
||||
/**
|
||||
* Location data list control.
|
||||
|
@ -134,12 +146,12 @@ public class DataPurgeParamsDlg extends CaveSWTDialog {
|
|||
/**
|
||||
* Cache of data for Location Data Purge Parameters
|
||||
*/
|
||||
private ArrayList<PurgeDynData> locDataPurgeParams;
|
||||
private java.util.List<PurgeDynData> locDataPurgeParams;
|
||||
|
||||
/**
|
||||
* Cache of data for Text Product Purge Parameters
|
||||
*/
|
||||
private ArrayList<PurgeProductData> textProdPurgeParams;
|
||||
private java.util.List<PurgeProductData> textProdPurgeParams;
|
||||
|
||||
/**
|
||||
* Date format for text products.
|
||||
|
@ -151,6 +163,16 @@ public class DataPurgeParamsDlg extends CaveSWTDialog {
|
|||
*/
|
||||
private int selectionIndex = -999;
|
||||
|
||||
/**
|
||||
* System wait cursor. No need to dispose.
|
||||
*/
|
||||
Cursor waitCursor;
|
||||
|
||||
/**
|
||||
* Use by setBusy to determine cursor display.
|
||||
*/
|
||||
AtomicInteger busyCnt = new AtomicInteger(0);
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
@ -158,13 +180,18 @@ public class DataPurgeParamsDlg extends CaveSWTDialog {
|
|||
* Parent shell.
|
||||
*/
|
||||
public DataPurgeParamsDlg(Shell parent) {
|
||||
super(parent);
|
||||
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
|
||||
setText("Data Purge Parameters");
|
||||
|
||||
textDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
textDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
|
||||
*/
|
||||
@Override
|
||||
protected Layout constructShellLayout() {
|
||||
// Create the main layout for the shell.
|
||||
|
@ -175,14 +202,29 @@ public class DataPurgeParamsDlg extends CaveSWTDialog {
|
|||
return mainLayout;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
|
||||
*/
|
||||
@Override
|
||||
protected void disposed() {
|
||||
controlFont.dispose();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
||||
* .eclipse.swt.widgets.Shell)
|
||||
*/
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
setReturnValue(false);
|
||||
|
||||
waitCursor = shell.getDisplay().getSystemCursor(SWT.CURSOR_WAIT);
|
||||
|
||||
// Initialize all of the controls and layouts
|
||||
controlFont = new Font(shell.getDisplay(), "Monospace", 10, SWT.NORMAL);
|
||||
|
||||
|
@ -385,7 +427,7 @@ public class DataPurgeParamsDlg extends CaveSWTDialog {
|
|||
closeBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -445,31 +487,88 @@ public class DataPurgeParamsDlg extends CaveSWTDialog {
|
|||
return labelStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve purge data and update the display.
|
||||
*
|
||||
*/
|
||||
private void getDialogData() {
|
||||
getLocDialogData();
|
||||
getTextDialogData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Purge Dyn Data and update the display.
|
||||
*/
|
||||
private void getLocDialogData() {
|
||||
try {
|
||||
locDataPurgeParams = HydroDBDataManager.getInstance().getData(
|
||||
PurgeDynData.class);
|
||||
setBusy(true);
|
||||
|
||||
updateLocDialogDisplay();
|
||||
} catch (VizException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// Remove from UI thread.
|
||||
Job job = new Job("") {
|
||||
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
try {
|
||||
locDataPurgeParams = HydroDBDataManager.getInstance()
|
||||
.getData(PurgeDynData.class);
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updateLocDialogDisplay();
|
||||
}
|
||||
});
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Problems getting location data. ", e);
|
||||
} finally {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setBusy(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
};
|
||||
job.schedule();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve Purge Product data and update the display.
|
||||
*/
|
||||
private void getTextDialogData() {
|
||||
try {
|
||||
textProdPurgeParams = HydroDBDataManager.getInstance().getData(
|
||||
PurgeProductData.class);
|
||||
setBusy(true);
|
||||
|
||||
updateTextDialogDisplay();
|
||||
} catch (VizException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// Remove from UI thread.
|
||||
Job job = new Job("") {
|
||||
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
try {
|
||||
textProdPurgeParams = HydroDBDataManager.getInstance()
|
||||
.getData(PurgeProductData.class);
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
updateTextDialogDisplay();
|
||||
}
|
||||
});
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Problems getting purge data. ", e);
|
||||
} finally {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setBusy(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
};
|
||||
job.schedule();
|
||||
}
|
||||
|
||||
private void updateLocDialogDisplay() {
|
||||
|
@ -508,6 +607,12 @@ public class DataPurgeParamsDlg extends CaveSWTDialog {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the Purge Dyn Data for display.
|
||||
*
|
||||
* @param currData
|
||||
* @return
|
||||
*/
|
||||
private String getDisplayString(PurgeDynData currData) {
|
||||
String displayFormat = "%-18s %-8s (%5s) %-8s (%5s) %-18.18s";
|
||||
|
||||
|
@ -532,12 +637,19 @@ public class DataPurgeParamsDlg extends CaveSWTDialog {
|
|||
String dayHoursBackup = String.format("%5d/%2d", numDays, numHours);
|
||||
|
||||
return String.format(displayFormat, currData.getTableName(),
|
||||
dayHoursHost, HydroDataUtils.getDisplayString(currData
|
||||
.getHostHours()), dayHoursBackup, HydroDataUtils
|
||||
.getDisplayString(currData.getBackupHours()), currData
|
||||
.getTimeColumnName());
|
||||
dayHoursHost,
|
||||
HydroDataUtils.getDisplayString(currData.getHostHours()),
|
||||
dayHoursBackup,
|
||||
HydroDataUtils.getDisplayString(currData.getBackupHours()),
|
||||
currData.getTimeColumnName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the purge product data for display.
|
||||
*
|
||||
* @param currData
|
||||
* @return
|
||||
*/
|
||||
private String getDisplayString(PurgeProductData currData) {
|
||||
String displayFormat = "%-10s %6s %-19s %-19s";
|
||||
|
||||
|
@ -557,6 +669,9 @@ public class DataPurgeParamsDlg extends CaveSWTDialog {
|
|||
prodTime, postTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update purge information for selected location.
|
||||
*/
|
||||
private void updateLocationInformationDisplay() {
|
||||
PurgeDynData currData = getCurrentlySelectedLocation();
|
||||
|
||||
|
@ -570,6 +685,9 @@ public class DataPurgeParamsDlg extends CaveSWTDialog {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update purge information for selected text product.
|
||||
*/
|
||||
private void updateTextInformationDisplay() {
|
||||
PurgeProductData currData = getCurrentlySelectedText();
|
||||
|
||||
|
@ -580,6 +698,10 @@ public class DataPurgeParamsDlg extends CaveSWTDialog {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return selected location purge data or null if none
|
||||
*/
|
||||
private PurgeDynData getCurrentlySelectedLocation() {
|
||||
PurgeDynData rval = null;
|
||||
|
||||
|
@ -590,6 +712,10 @@ public class DataPurgeParamsDlg extends CaveSWTDialog {
|
|||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return selected text product purge data or null if none
|
||||
*/
|
||||
private PurgeProductData getCurrentlySelectedText() {
|
||||
PurgeProductData rval = null;
|
||||
|
||||
|
@ -601,6 +727,9 @@ public class DataPurgeParamsDlg extends CaveSWTDialog {
|
|||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save current purged data.
|
||||
*/
|
||||
private void saveLocRecord() {
|
||||
PurgeDynData currData = new PurgeDynData();
|
||||
|
||||
|
@ -620,16 +749,15 @@ public class DataPurgeParamsDlg extends CaveSWTDialog {
|
|||
|
||||
getLocDialogData();
|
||||
} catch (VizException e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
mb.setMessage("An error occurred while trying to save.");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Problems saving data. ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Save a record.
|
||||
*/
|
||||
private void saveTextRecord() {
|
||||
PurgeProductData currData = new PurgeProductData();
|
||||
|
||||
|
@ -647,24 +775,21 @@ public class DataPurgeParamsDlg extends CaveSWTDialog {
|
|||
|
||||
getTextDialogData();
|
||||
} catch (VizException e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR
|
||||
| SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
mb.setMessage("An error occurred while trying to save.");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Problems saving data. ", e);
|
||||
}
|
||||
} else {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
mb
|
||||
.setMessage("Please enter data for Product ID and Versions To Keep.");
|
||||
mb.setMessage("Please enter data for Product ID and Versions To Keep.");
|
||||
mb.open();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a record.
|
||||
*/
|
||||
private void deleteTextRecord() {
|
||||
PurgeProductData currData = getCurrentlySelectedText();
|
||||
|
||||
|
@ -682,13 +807,8 @@ public class DataPurgeParamsDlg extends CaveSWTDialog {
|
|||
selectionIndex = 0;
|
||||
getTextDialogData();
|
||||
} catch (VizException e) {
|
||||
mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Delete");
|
||||
mb
|
||||
.setMessage("An error occurred while trying to delete item.");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Problems deleteing data. ", e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -698,4 +818,18 @@ public class DataPurgeParamsDlg extends CaveSWTDialog {
|
|||
mb.open();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine what cursor to display.
|
||||
*
|
||||
* @param busy
|
||||
*/
|
||||
private void setBusy(boolean busy) {
|
||||
if (busy) {
|
||||
busyCnt.incrementAndGet();
|
||||
shell.setCursor(waitCursor);
|
||||
} else if (busyCnt.decrementAndGet() == 0) {
|
||||
shell.setCursor(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ package com.raytheon.viz.hydrobase.dialogs;
|
|||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
|
@ -40,6 +39,9 @@ import org.eclipse.swt.widgets.MessageBox;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.viz.hydrocommon.HydroConstants;
|
||||
import com.raytheon.viz.hydrocommon.data.DatumData;
|
||||
|
@ -56,6 +58,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Sep 4, 2008 lvenable Initial creation
|
||||
* Dec 5, 2008 1744 askripsky Connected to DB
|
||||
* 12/19/2008 1782 grichard Implemented IHydroDialog
|
||||
* Apr 18, 2013 1790 rferrel Changes for non-blocking dialog.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -63,6 +66,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class DatumDlg extends CaveSWTDialog implements IHydroDialog {
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(DatumDlg.class);
|
||||
|
||||
/**
|
||||
* Control font.
|
||||
|
@ -96,7 +101,7 @@ public class DatumDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
|
||||
private DialogStates dialogState;
|
||||
|
||||
private ArrayList<DatumData> locationDatum;
|
||||
private java.util.List<DatumData> locationDatum;
|
||||
|
||||
private String lid;
|
||||
|
||||
|
@ -134,7 +139,7 @@ public class DatumDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
setReturnValue(false);
|
||||
setReturnValue(lid);
|
||||
// Initialize all of the controls and layouts
|
||||
initializeComponents();
|
||||
|
||||
|
@ -257,7 +262,7 @@ public class DatumDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
closeBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -286,8 +291,8 @@ public class DatumDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
try {
|
||||
locationDatum = HydroDBDataManager.getInstance().getData(seedData);
|
||||
} catch (VizException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Problem getting Datum data. ", e);
|
||||
}
|
||||
|
||||
updateDialogDisplay();
|
||||
|
@ -345,8 +350,7 @@ public class DatumDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
.format(currData.getDate()) : "");
|
||||
elevationTF
|
||||
.setText((currData.getElevation() != HydroConstants.MISSING_VALUE) ? Double
|
||||
.toString(currData.getElevation())
|
||||
: "");
|
||||
.toString(currData.getElevation()) : "");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -391,16 +395,15 @@ public class DatumDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
try {
|
||||
HydroDBDataManager.getInstance().putData(dataToSave);
|
||||
} catch (VizException e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
mb.setMessage("An error occurred while trying to save.");
|
||||
|
||||
String cause = e.getCause().getMessage();
|
||||
|
||||
int causeStart = cause.indexOf("ERROR:");
|
||||
|
||||
// If the exception contain the SQL exception "ERROR:"
|
||||
if (causeStart > 0) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
mb.setMessage("An error occurred while trying to save.");
|
||||
|
||||
int causeEnd = cause.indexOf("\n", causeStart);
|
||||
|
||||
cause = cause.substring(causeStart, causeEnd);
|
||||
|
@ -409,11 +412,11 @@ public class DatumDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
mb.setMessage("Please enter data for " + lid
|
||||
+ " in the River Gauge dialog first");
|
||||
}
|
||||
mb.open();
|
||||
} else {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Problem saving record. ", e);
|
||||
}
|
||||
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -439,13 +442,8 @@ public class DatumDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
dateTF.setText("");
|
||||
elevationTF.setText("");
|
||||
} catch (VizException e) {
|
||||
MessageBox mbDel = new MessageBox(shell, SWT.ICON_ERROR
|
||||
| SWT.OK);
|
||||
mbDel.setText("Unable to Delete");
|
||||
mbDel.setMessage("An error occurred while trying to delete.");
|
||||
mbDel.open();
|
||||
|
||||
e.printStackTrace();
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Problem deleting record. ", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -106,8 +106,9 @@ public class GageHistoryDlg extends CaveSWTDialog {
|
|||
* Location text control.
|
||||
*/
|
||||
private Text locationTF;
|
||||
|
||||
private String currentLocText=null;
|
||||
|
||||
private String currentLocText = null;
|
||||
|
||||
/**
|
||||
* OK button.
|
||||
*/
|
||||
|
@ -126,7 +127,7 @@ public class GageHistoryDlg extends CaveSWTDialog {
|
|||
/**
|
||||
* Cache of Gages
|
||||
*/
|
||||
private ArrayList<GageDBData> gageData;
|
||||
private java.util.List<GageDBData> gageData;
|
||||
|
||||
/**
|
||||
* Date format
|
||||
|
@ -322,16 +323,15 @@ public class GageHistoryDlg extends CaveSWTDialog {
|
|||
locationTF = new Text(locationGroup, SWT.BORDER | SWT.MULTI | SWT.WRAP);
|
||||
locationTF.setLayoutData(gd);
|
||||
locationTF.setTextLimit(255);
|
||||
currentLocText=locationTF.getText();
|
||||
currentLocText = locationTF.getText();
|
||||
ModifyListener listener = new ModifyListener() {
|
||||
public void modifyText(ModifyEvent e) {
|
||||
if (locationTF.getText().length()>255){
|
||||
locationTF.setText(currentLocText);
|
||||
shell.getDisplay().beep();
|
||||
}
|
||||
else
|
||||
currentLocText=locationTF.getText();
|
||||
}
|
||||
public void modifyText(ModifyEvent e) {
|
||||
if (locationTF.getText().length() > 255) {
|
||||
locationTF.setText(currentLocText);
|
||||
shell.getDisplay().beep();
|
||||
} else
|
||||
currentLocText = locationTF.getText();
|
||||
}
|
||||
};
|
||||
|
||||
locationTF.addModifyListener(listener);
|
||||
|
@ -449,9 +449,9 @@ public class GageHistoryDlg extends CaveSWTDialog {
|
|||
}
|
||||
}
|
||||
|
||||
private ArrayList<String> getGageData(String table, String column)
|
||||
private java.util.List<String> getGageData(String table, String column)
|
||||
throws VizException {
|
||||
ArrayList<String> rval = new ArrayList<String>();
|
||||
java.util.List<String> rval = new ArrayList<String>();
|
||||
|
||||
String query = "SELECT %s FROM %s ORDER BY %s";
|
||||
query = String.format(query, column, table, column);
|
||||
|
@ -490,8 +490,8 @@ public class GageHistoryDlg extends CaveSWTDialog {
|
|||
for (GageDBData currData : gageData) {
|
||||
endDate = (currData.getEndDate() != null) ? dateFormat
|
||||
.format(currData.getEndDate()) : "";
|
||||
dataList.add(String.format(format, currData.getType(), currData
|
||||
.getOwner(),
|
||||
dataList.add(String.format(format, currData.getType(),
|
||||
currData.getOwner(),
|
||||
dateFormat.format(currData.getBeginDate()), endDate));
|
||||
}
|
||||
|
||||
|
@ -564,8 +564,7 @@ public class GageHistoryDlg extends CaveSWTDialog {
|
|||
} catch (ParseException e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
mb
|
||||
.setMessage("Please enter the Begin Date\nin the form: YYYY-MM-DD");
|
||||
mb.setMessage("Please enter the Begin Date\nin the form: YYYY-MM-DD");
|
||||
mb.open();
|
||||
|
||||
return successful;
|
||||
|
@ -581,8 +580,7 @@ public class GageHistoryDlg extends CaveSWTDialog {
|
|||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR
|
||||
| SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
mb
|
||||
.setMessage("Please enter the End Date\nin the form: YYYY-MM-DD");
|
||||
mb.setMessage("Please enter the End Date\nin the form: YYYY-MM-DD");
|
||||
mb.open();
|
||||
|
||||
return successful;
|
||||
|
@ -612,8 +610,7 @@ public class GageHistoryDlg extends CaveSWTDialog {
|
|||
} catch (VizException e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
mb
|
||||
.setMessage("An error occurred while trying to save the City");
|
||||
mb.setMessage("An error occurred while trying to save the City");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
|
@ -643,8 +640,7 @@ public class GageHistoryDlg extends CaveSWTDialog {
|
|||
} catch (VizException e) {
|
||||
mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Delete");
|
||||
mb
|
||||
.setMessage("An error occurred while trying to delete the entry");
|
||||
mb.setMessage("An error occurred while trying to delete the entry");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -102,7 +102,7 @@ public class HydroGenConfigDlg extends CaveSWTDialog {
|
|||
/**
|
||||
* Cache of display data.
|
||||
*/
|
||||
private ArrayList<HydroGenStationData> stationData;
|
||||
private java.util.List<HydroGenStationData> stationData;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -354,9 +354,9 @@ public class HydroGenConfigDlg extends CaveSWTDialog {
|
|||
|
||||
String displayStr;
|
||||
for (HydroGenStationData currData : stationData) {
|
||||
displayStr = String.format(format, currData.getLid(), currData
|
||||
.getHsa(), currData.getPe(), currData.getTs(), currData
|
||||
.getForecastTs());
|
||||
displayStr = String.format(format, currData.getLid(),
|
||||
currData.getHsa(), currData.getPe(), currData.getTs(),
|
||||
currData.getForecastTs());
|
||||
|
||||
locationList.add(displayStr);
|
||||
}
|
||||
|
@ -368,8 +368,8 @@ public class HydroGenConfigDlg extends CaveSWTDialog {
|
|||
* @return The display string for the TS.
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<String> getShefTs() throws VizException {
|
||||
ArrayList<String> rval = new ArrayList<String>();
|
||||
public java.util.List<String> getShefTs() throws VizException {
|
||||
java.util.List<String> rval = new ArrayList<String>();
|
||||
|
||||
String tsQuery = "SELECT name, ts FROM shefts WHERE ts LIKE 'P%' or ts LIKE 'R%' ORDER BY ts";
|
||||
|
||||
|
@ -395,8 +395,8 @@ public class HydroGenConfigDlg extends CaveSWTDialog {
|
|||
* @return The display string for the TS.
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<String> getShefFcstTs() throws VizException {
|
||||
ArrayList<String> rval = new ArrayList<String>();
|
||||
public java.util.List<String> getShefFcstTs() throws VizException {
|
||||
java.util.List<String> rval = new ArrayList<String>();
|
||||
|
||||
String tsQuery = "SELECT name, ts FROM shefts WHERE ts LIKE 'C%' or ts LIKE 'F%' ORDER BY ts";
|
||||
|
||||
|
@ -492,8 +492,7 @@ public class HydroGenConfigDlg extends CaveSWTDialog {
|
|||
} catch (VizException e) {
|
||||
mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Delete");
|
||||
mb
|
||||
.setMessage("An error occurred while trying to delete the record.");
|
||||
mb.setMessage("An error occurred while trying to delete the record.");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
|
@ -615,8 +614,7 @@ public class HydroGenConfigDlg extends CaveSWTDialog {
|
|||
} else {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
mb
|
||||
.setMessage("The location must be add via the River Gauge dialog first.");
|
||||
mb.setMessage("The location must be added via the River Gauge dialog first.");
|
||||
mb.open();
|
||||
}
|
||||
} catch (VizException e) {
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
**/
|
||||
package com.raytheon.viz.hydrobase.dialogs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
|
@ -186,17 +184,17 @@ public class NwrTransmitterDlg extends CaveSWTDialog implements
|
|||
/**
|
||||
* Cache of available counties
|
||||
*/
|
||||
private ArrayList<CountiesData> availableCounties;
|
||||
private java.util.List<CountiesData> availableCounties;
|
||||
|
||||
/**
|
||||
* Cache of Transmitters
|
||||
*/
|
||||
private ArrayList<NWRTransmitterData> txData;
|
||||
private java.util.List<NWRTransmitterData> txData;
|
||||
|
||||
/**
|
||||
* Cache of Transmitter's Counties
|
||||
*/
|
||||
private ArrayList<CountyTransmitData> selectedCounties;
|
||||
private java.util.List<CountyTransmitData> selectedCounties;
|
||||
|
||||
/**
|
||||
* Cache of selected county and state
|
||||
|
|
|
@ -21,7 +21,6 @@ package com.raytheon.viz.hydrobase.dialogs;
|
|||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
|
@ -136,7 +135,7 @@ public class PublicationsDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
/**
|
||||
* Publications Data.
|
||||
*/
|
||||
private ArrayList<PublicationsData> pubData;
|
||||
private java.util.List<PublicationsData> pubData;
|
||||
|
||||
/**
|
||||
* Location Identifier.
|
||||
|
@ -571,8 +570,7 @@ public class PublicationsDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
} catch (ParseException e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Invalid Date");
|
||||
mb
|
||||
.setMessage("Please enter a valid date in the form: MM/DD/YYYY");
|
||||
mb.setMessage("Please enter a valid date in the form: MM/DD/YYYY");
|
||||
mb.open();
|
||||
return false;
|
||||
}
|
||||
|
@ -584,8 +582,7 @@ public class PublicationsDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
} catch (ParseException e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Invalid Date");
|
||||
mb
|
||||
.setMessage("Please enter a valid date in the form: MM/DD/YYYY");
|
||||
mb.setMessage("Please enter a valid date in the form: MM/DD/YYYY");
|
||||
mb.open();
|
||||
return false;
|
||||
}
|
||||
|
@ -647,8 +644,7 @@ public class PublicationsDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
MessageBox mbDel = new MessageBox(shell, SWT.ICON_ERROR
|
||||
| SWT.OK);
|
||||
mbDel.setText("Unable to Delete");
|
||||
mbDel
|
||||
.setMessage("No item is selected in the publications list");
|
||||
mbDel.setMessage("No item is selected in the publications list");
|
||||
mbDel.open();
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
**/
|
||||
package com.raytheon.viz.hydrobase.dialogs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
|
@ -144,7 +142,7 @@ public class RadarLocationsDlg extends CaveSWTDialog {
|
|||
/**
|
||||
* Cache of Radar Locations
|
||||
*/
|
||||
private ArrayList<RadarLocData> radarData;
|
||||
private java.util.List<RadarLocData> radarData;
|
||||
|
||||
/**
|
||||
* States of the dialog
|
||||
|
@ -466,10 +464,10 @@ public class RadarLocationsDlg extends CaveSWTDialog {
|
|||
.getLatLonDisplayString(currLoc.getLatitude()),
|
||||
HydroDataUtils.getLatLonDisplayString(currLoc
|
||||
.getLongitude()), HydroDataUtils
|
||||
.getDisplayString("%s", "%6.1f", currLoc
|
||||
.getElevation()), HydroDataUtils
|
||||
.getDisplayString("%s", "%5.1f", currLoc
|
||||
.getTowerHeight()), currLoc
|
||||
.getDisplayString("%s", "%6.1f",
|
||||
currLoc.getElevation()), HydroDataUtils
|
||||
.getDisplayString("%s", "%5.1f",
|
||||
currLoc.getTowerHeight()), currLoc
|
||||
.getUseRadar(), currLoc.getOfficeID()));
|
||||
}
|
||||
|
||||
|
@ -590,8 +588,7 @@ public class RadarLocationsDlg extends CaveSWTDialog {
|
|||
} catch (VizException e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
mb
|
||||
.setMessage("An error occurred while trying to save the Radar Location");
|
||||
mb.setMessage("An error occurred while trying to save the Radar Location");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
|
@ -610,12 +607,11 @@ public class RadarLocationsDlg extends CaveSWTDialog {
|
|||
MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION | SWT.OK
|
||||
| SWT.CANCEL);
|
||||
mb.setText("Delete Confirmation");
|
||||
mb
|
||||
.setMessage("WARNING: You are about to delete radar information \n"
|
||||
+ "from multiple tables. Are you sure you want to do this? \n\n"
|
||||
+ "(Note: If you delete this radar now, you will NOT be able to \n"
|
||||
+ "recover the non-default values for the affected tables.) \n\n"
|
||||
+ "If you do not wish to delete at this time, click \"Cancel\".");
|
||||
mb.setMessage("WARNING: You are about to delete radar information \n"
|
||||
+ "from multiple tables. Are you sure you want to do this? \n\n"
|
||||
+ "(Note: If you delete this radar now, you will NOT be able to \n"
|
||||
+ "recover the non-default values for the affected tables.) \n\n"
|
||||
+ "If you do not wish to delete at this time, click \"Cancel\".");
|
||||
|
||||
int result = mb.open();
|
||||
|
||||
|
@ -631,8 +627,7 @@ public class RadarLocationsDlg extends CaveSWTDialog {
|
|||
} catch (VizException e) {
|
||||
mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Delete");
|
||||
mb
|
||||
.setMessage("An error occurred while trying to delete the City");
|
||||
mb.setMessage("An error occurred while trying to delete the City");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
**/
|
||||
package com.raytheon.viz.hydrobase.dialogs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
|
@ -98,12 +96,12 @@ public class ReferenceFieldsDlg extends CaveSWTDialog {
|
|||
/**
|
||||
* Dam Type Data.
|
||||
*/
|
||||
private ArrayList<DamTypeData> damTypeData;
|
||||
private java.util.List<DamTypeData> damTypeData;
|
||||
|
||||
/**
|
||||
* Reservoir Owner Data.
|
||||
*/
|
||||
private ArrayList<ReservoirOwnerData> resOwnerData;
|
||||
private java.util.List<ReservoirOwnerData> resOwnerData;
|
||||
|
||||
private final int OWNER = 0;
|
||||
|
||||
|
@ -389,8 +387,7 @@ public class ReferenceFieldsDlg extends CaveSWTDialog {
|
|||
if (dataList.getSelectionIndex() < 0) {
|
||||
MessageBox mb = new MessageBox(getParent(), SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Delete Error");
|
||||
mb
|
||||
.setMessage("You need to select an item from the list for deletion.");
|
||||
mb.setMessage("You need to select an item from the list for deletion.");
|
||||
mb.open();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
**/
|
||||
package com.raytheon.viz.hydrobase.dialogs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
|
@ -51,7 +49,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Sep 8, 2008 lvenable Initial creation.
|
||||
* 12/19/2008 1782 grichard Connected to IHFS DB.
|
||||
* Nov 03 2011 11273 lbousaidi make changes to update an existing entry
|
||||
* without creating new entry
|
||||
* without creating new entry
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -105,16 +103,14 @@ public class ReferencesDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
/**
|
||||
* Array of reference data.
|
||||
*/
|
||||
private ArrayList<ReferencesData> referenceData;
|
||||
private java.util.List<ReferencesData> referenceData;
|
||||
|
||||
/**
|
||||
* Location ID.
|
||||
*/
|
||||
private String lid;
|
||||
|
||||
private boolean newInsert=false;
|
||||
|
||||
|
||||
|
||||
private boolean newInsert = false;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -273,7 +269,7 @@ public class ReferencesDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
newBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
newInsert=true;
|
||||
newInsert = true;
|
||||
clearForm();
|
||||
okBtn.setEnabled(true);
|
||||
applyBtn.setEnabled(true);
|
||||
|
@ -426,22 +422,21 @@ public class ReferencesDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
|
||||
// Save to DB
|
||||
try {
|
||||
if ((referenceList.getSelectionIndex() < 0) &&
|
||||
(newInsert)) {
|
||||
HydroDBDataManager.getInstance().putData(dataToSave);
|
||||
newInsert=false;
|
||||
} else {
|
||||
|
||||
//Data Listed
|
||||
ReferencesData dataDisplayed = new ReferencesData();
|
||||
dataDisplayed.setLid(lid);
|
||||
dataDisplayed.setReference(referenceList.
|
||||
getItem(referenceList.getSelectionIndex()));
|
||||
HydroDBDataManager.getInstance().
|
||||
putNewData(dataToSave, dataDisplayed, newInsert);
|
||||
referenceList.setSelection(referenceList.getSelectionIndex());
|
||||
newInsert=false;
|
||||
}
|
||||
if ((referenceList.getSelectionIndex() < 0) && (newInsert)) {
|
||||
HydroDBDataManager.getInstance().putData(dataToSave);
|
||||
newInsert = false;
|
||||
} else {
|
||||
|
||||
// Data Listed
|
||||
ReferencesData dataDisplayed = new ReferencesData();
|
||||
dataDisplayed.setLid(lid);
|
||||
dataDisplayed.setReference(referenceList.getItem(referenceList
|
||||
.getSelectionIndex()));
|
||||
HydroDBDataManager.getInstance().putNewData(dataToSave,
|
||||
dataDisplayed, newInsert);
|
||||
referenceList.setSelection(referenceList.getSelectionIndex());
|
||||
newInsert = false;
|
||||
}
|
||||
} catch (VizException e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
|
@ -495,8 +490,7 @@ public class ReferencesDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
MessageBox mbDel = new MessageBox(shell, SWT.ICON_ERROR
|
||||
| SWT.OK);
|
||||
mbDel.setText("Unable to Delete");
|
||||
mbDel
|
||||
.setMessage("No item is selected in the reference list");
|
||||
mbDel.setMessage("No item is selected in the reference list");
|
||||
mbDel.open();
|
||||
}
|
||||
|
||||
|
@ -515,12 +509,11 @@ public class ReferencesDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
|
||||
// Refresh the data
|
||||
getDialogData();
|
||||
|
||||
if (referenceList.getItemCount() !=0 ) {
|
||||
referenceList.setSelection(0);
|
||||
updateInformation();
|
||||
}
|
||||
|
||||
|
||||
if (referenceList.getItemCount() != 0) {
|
||||
referenceList.setSelection(0);
|
||||
updateInformation();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ package com.raytheon.viz.hydrobase.dialogs;
|
|||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
|
@ -212,17 +211,17 @@ public class ReservoirDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
/**
|
||||
* Dam Type Data.
|
||||
*/
|
||||
private ArrayList<DamTypeData> damTypesData;
|
||||
private java.util.List<DamTypeData> damTypesData;
|
||||
|
||||
/**
|
||||
* Reservoir Owner Data.
|
||||
*/
|
||||
private ArrayList<ReservoirOwnerData> resOwnerData;
|
||||
private java.util.List<ReservoirOwnerData> resOwnerData;
|
||||
|
||||
/**
|
||||
* Reservoir Data.
|
||||
*/
|
||||
private ArrayList<ReservoirData> resData;
|
||||
private java.util.List<ReservoirData> resData;
|
||||
|
||||
/**
|
||||
* Location Identifier.
|
||||
|
@ -718,8 +717,7 @@ public class ReservoirDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
topTF.setText(HydroDataUtils.getDisplayString(currData.getTop()));
|
||||
maxSurchargeTF.setText(HydroDataUtils.getDisplayString(currData
|
||||
.getSurchg()));
|
||||
gatesTF.setText(HydroDataUtils
|
||||
.getDisplayString(currData.getGates()));
|
||||
gatesTF.setText(HydroDataUtils.getDisplayString(currData.getGates()));
|
||||
impoundTF.setText((currData.getImpounded() != null) ? dateFormat
|
||||
.format(currData.getImpounded()) : "");
|
||||
floodControlChk
|
||||
|
@ -827,18 +825,17 @@ public class ReservoirDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
* @return true if form is correctly filled out
|
||||
*/
|
||||
private boolean validateDateForm() {
|
||||
boolean isValid = true;
|
||||
boolean isValid = true;
|
||||
|
||||
if (impoundTF.getText().equals("")) {
|
||||
isValid = false;
|
||||
if (impoundTF.getText().equals("")) {
|
||||
isValid = false;
|
||||
}
|
||||
|
||||
if (!isValid) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Invalid Date");
|
||||
mb
|
||||
.setMessage("Please enter a valid date in the form:MM/DD/YYYY");
|
||||
|
||||
mb.setMessage("Please enter a valid date in the form:MM/DD/YYYY");
|
||||
|
||||
mb.open();
|
||||
}
|
||||
|
||||
|
@ -859,31 +856,32 @@ public class ReservoirDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
dataToSave.setType(typeCbo.getText());
|
||||
dataToSave.setOwner(ownerCbo.getText());
|
||||
if (!deadTF.getText().equals("")) {
|
||||
dataToSave.setDeadpool(Double.parseDouble(deadTF.getText()));
|
||||
dataToSave.setDeadpool(Double.parseDouble(deadTF.getText()));
|
||||
}
|
||||
if (!conservationTF.getText().equals("")){
|
||||
dataToSave.setConserpool(Double.parseDouble(conservationTF.getText()));
|
||||
if (!conservationTF.getText().equals("")) {
|
||||
dataToSave.setConserpool(Double.parseDouble(conservationTF
|
||||
.getText()));
|
||||
}
|
||||
if (!floodTF.getText().equals("")){
|
||||
dataToSave.setFloodpool(Double.parseDouble(floodTF.getText()));
|
||||
if (!floodTF.getText().equals("")) {
|
||||
dataToSave.setFloodpool(Double.parseDouble(floodTF.getText()));
|
||||
}
|
||||
if (!spillwayTF.getText().equals("")) {
|
||||
dataToSave.setSpillway(Double.parseDouble(spillwayTF.getText()));
|
||||
dataToSave.setSpillway(Double.parseDouble(spillwayTF.getText()));
|
||||
}
|
||||
if (!sillTF.getText().equals("")) {
|
||||
dataToSave.setSill(Double.parseDouble(sillTF.getText()));
|
||||
dataToSave.setSill(Double.parseDouble(sillTF.getText()));
|
||||
}
|
||||
if (!reservoirTF.getText().equals("")) {
|
||||
dataToSave.setElev(Double.parseDouble(reservoirTF.getText()));
|
||||
dataToSave.setElev(Double.parseDouble(reservoirTF.getText()));
|
||||
}
|
||||
if (!topTF.getText().equals("")) {
|
||||
dataToSave.setTop(Double.parseDouble(topTF.getText()));
|
||||
dataToSave.setTop(Double.parseDouble(topTF.getText()));
|
||||
}
|
||||
if (!maxSurchargeTF.getText().equals("")) {
|
||||
dataToSave.setSurchg(Double.parseDouble(maxSurchargeTF.getText()));
|
||||
dataToSave.setSurchg(Double.parseDouble(maxSurchargeTF.getText()));
|
||||
}
|
||||
if (!gatesTF.getText().equals("")) {
|
||||
dataToSave.setGates(Integer.parseInt(gatesTF.getText()));
|
||||
dataToSave.setGates(Integer.parseInt(gatesTF.getText()));
|
||||
}
|
||||
if (!impoundTF.getText().equals("")) {
|
||||
try {
|
||||
|
@ -892,8 +890,7 @@ public class ReservoirDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
} catch (ParseException e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Invalid Date");
|
||||
mb
|
||||
.setMessage("Please enter a valid date in the form: MM/DD/YYYY");
|
||||
mb.setMessage("Please enter a valid date in the form: MM/DD/YYYY");
|
||||
mb.open();
|
||||
return false;
|
||||
}
|
||||
|
@ -975,8 +972,7 @@ public class ReservoirDlg extends CaveSWTDialog implements IHydroDialog {
|
|||
MessageBox mbDel = new MessageBox(shell, SWT.ICON_ERROR
|
||||
| SWT.OK);
|
||||
mbDel.setText("Unable to Delete");
|
||||
mbDel
|
||||
.setMessage("No item is selected in the reservoir list");
|
||||
mbDel.setMessage("No item is selected in the reservoir list");
|
||||
mbDel.open();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ package com.raytheon.viz.hydrobase.dialogs;
|
|||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
|
@ -290,10 +289,10 @@ public class RiverGageDlg extends CaveSWTDialog implements
|
|||
* Value for no Forecast Group assignment
|
||||
*/
|
||||
private final String NO_FCST_GROUP_SELECTED = "(Not a Forecast Point)";
|
||||
|
||||
|
||||
/** Original latitude value */
|
||||
private String origLat;
|
||||
|
||||
|
||||
/** Original longitude value */
|
||||
private String origLon;
|
||||
|
||||
|
@ -307,12 +306,13 @@ public class RiverGageDlg extends CaveSWTDialog implements
|
|||
/**
|
||||
* text from the remark text box
|
||||
*/
|
||||
private String currentRemarkText=null;
|
||||
|
||||
private String currentRemarkText = null;
|
||||
|
||||
/**
|
||||
* maximum number of character allowed in the remark text box
|
||||
*/
|
||||
private final int MAX_REMARK_CHAR=255;
|
||||
private final int MAX_REMARK_CHAR = 255;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
@ -633,20 +633,21 @@ public class RiverGageDlg extends CaveSWTDialog implements
|
|||
remarksTF.setLayoutData(gd);
|
||||
remarksTF.setFont(controlFont);
|
||||
remarksTF.setTextLimit(MAX_REMARK_CHAR);
|
||||
|
||||
/*Note: use this method to control number of character in remarkTF
|
||||
* because a bug in the Text class.
|
||||
* See https://bugs.eclipse.org/bugs/show_bug.cgi?id=43004*/
|
||||
currentRemarkText=remarksTF.getText();
|
||||
|
||||
/*
|
||||
* Note: use this method to control number of character in remarkTF
|
||||
* because a bug in the Text class. See
|
||||
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=43004
|
||||
*/
|
||||
currentRemarkText = remarksTF.getText();
|
||||
ModifyListener listener = new ModifyListener() {
|
||||
public void modifyText(ModifyEvent e) {
|
||||
if (remarksTF.getText().length()>MAX_REMARK_CHAR){
|
||||
remarksTF.setText(currentRemarkText);
|
||||
shell.getDisplay().beep();
|
||||
}
|
||||
else
|
||||
currentRemarkText=remarksTF.getText();
|
||||
}
|
||||
public void modifyText(ModifyEvent e) {
|
||||
if (remarksTF.getText().length() > MAX_REMARK_CHAR) {
|
||||
remarksTF.setText(currentRemarkText);
|
||||
shell.getDisplay().beep();
|
||||
} else
|
||||
currentRemarkText = remarksTF.getText();
|
||||
}
|
||||
};
|
||||
|
||||
remarksTF.addModifyListener(listener);
|
||||
|
@ -900,14 +901,14 @@ public class RiverGageDlg extends CaveSWTDialog implements
|
|||
RiverStatData seedData = new RiverStatData();
|
||||
seedData.setLid(lid);
|
||||
|
||||
ArrayList<RiverStatData> data = null;
|
||||
java.util.List<RiverStatData> data = null;
|
||||
try {
|
||||
data = HydroDBDataManager.getInstance().getData(seedData);
|
||||
|
||||
RPFFcstPointData seedDataGroup = new RPFFcstPointData();
|
||||
seedDataGroup.setLid(lid);
|
||||
|
||||
ArrayList<RPFFcstPointData> dataGroup = HydroDBDataManager
|
||||
java.util.List<RPFFcstPointData> dataGroup = HydroDBDataManager
|
||||
.getInstance().getData(seedDataGroup);
|
||||
|
||||
if (dataGroup.size() > 0) {
|
||||
|
@ -940,17 +941,15 @@ public class RiverGageDlg extends CaveSWTDialog implements
|
|||
|
||||
// Lat/Lon
|
||||
latitudeTF
|
||||
.setText((riverGageData.getLatitude() != HydroConstants.MISSING_VALUE) ?
|
||||
String.valueOf(riverGageData.getLatitude())
|
||||
: "");
|
||||
.setText((riverGageData.getLatitude() != HydroConstants.MISSING_VALUE) ? String
|
||||
.valueOf(riverGageData.getLatitude()) : "");
|
||||
origLat = latitudeTF.getText();
|
||||
|
||||
|
||||
longitudeTF
|
||||
.setText((riverGageData.getLongitude() != HydroConstants.MISSING_VALUE) ?
|
||||
String.valueOf(riverGageData.getLongitude())
|
||||
: "");
|
||||
.setText((riverGageData.getLongitude() != HydroConstants.MISSING_VALUE) ? String
|
||||
.valueOf(riverGageData.getLongitude()) : "");
|
||||
origLon = longitudeTF.getText();
|
||||
|
||||
|
||||
// Drainage Area
|
||||
drainageAreaTF.setText(HydroDataUtils
|
||||
.getDisplayString(riverGageData.getDrainageArea()));
|
||||
|
@ -1161,58 +1160,58 @@ public class RiverGageDlg extends CaveSWTDialog implements
|
|||
// Latitude
|
||||
String latTxt = latitudeTF.getText();
|
||||
if (!latTxt.equals(origLat)) {
|
||||
double lat = HydroConstants.MISSING_VALUE;
|
||||
if (!latTxt.equals("")) {
|
||||
boolean invalidLat = false;
|
||||
|
||||
try {
|
||||
lat = GeoUtil.getInstance().cvt_spaced_format(latTxt, 0);
|
||||
} catch (Exception e) {
|
||||
invalidLat = true;
|
||||
}
|
||||
|
||||
if ((lat < -90) || (lat > 90) || invalidLat) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Invalid Value");
|
||||
mb
|
||||
.setMessage("Please enter a VALID (-90 to 90) Latitude\nin the form: DD MM SS");
|
||||
mb.open();
|
||||
|
||||
return successful;
|
||||
}
|
||||
}
|
||||
newData.setLatitude(lat);
|
||||
double lat = HydroConstants.MISSING_VALUE;
|
||||
if (!latTxt.equals("")) {
|
||||
boolean invalidLat = false;
|
||||
|
||||
try {
|
||||
lat = GeoUtil.getInstance().cvt_spaced_format(latTxt, 0);
|
||||
} catch (Exception e) {
|
||||
invalidLat = true;
|
||||
}
|
||||
|
||||
if ((lat < -90) || (lat > 90) || invalidLat) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR
|
||||
| SWT.OK);
|
||||
mb.setText("Invalid Value");
|
||||
mb.setMessage("Please enter a VALID (-90 to 90) Latitude\nin the form: DD MM SS");
|
||||
mb.open();
|
||||
|
||||
return successful;
|
||||
}
|
||||
}
|
||||
newData.setLatitude(lat);
|
||||
} else {
|
||||
newData.setLatitude(this.riverGageData.getLatitude());
|
||||
newData.setLatitude(this.riverGageData.getLatitude());
|
||||
}
|
||||
|
||||
|
||||
// Longitude
|
||||
String lonTxt = longitudeTF.getText();
|
||||
if (!lonTxt.equals(origLon)) {
|
||||
double lon = HydroConstants.MISSING_VALUE;
|
||||
if (!lonTxt.equals("")) {
|
||||
boolean invalidLon = false;
|
||||
|
||||
try {
|
||||
lon = GeoUtil.getInstance().cvt_spaced_format(lonTxt, 0);
|
||||
} catch (Exception e) {
|
||||
invalidLon = true;
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if ((lon > 180) || (lon < -180) || invalidLon) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Invalid Value");
|
||||
mb
|
||||
.setMessage("Please enter a VALID (-180 to 180) Longitude\nin the form: DD MM SS");
|
||||
mb.open();
|
||||
|
||||
return successful;
|
||||
}
|
||||
}
|
||||
newData.setLongitude(lon);
|
||||
double lon = HydroConstants.MISSING_VALUE;
|
||||
if (!lonTxt.equals("")) {
|
||||
boolean invalidLon = false;
|
||||
|
||||
try {
|
||||
lon = GeoUtil.getInstance().cvt_spaced_format(lonTxt, 0);
|
||||
} catch (Exception e) {
|
||||
invalidLon = true;
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if ((lon > 180) || (lon < -180) || invalidLon) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR
|
||||
| SWT.OK);
|
||||
mb.setText("Invalid Value");
|
||||
mb.setMessage("Please enter a VALID (-180 to 180) Longitude\nin the form: DD MM SS");
|
||||
mb.open();
|
||||
|
||||
return successful;
|
||||
}
|
||||
}
|
||||
newData.setLongitude(lon);
|
||||
} else {
|
||||
newData.setLongitude(riverGageData.getLongitude());
|
||||
newData.setLongitude(riverGageData.getLongitude());
|
||||
}
|
||||
|
||||
// Remarks
|
||||
|
@ -1279,13 +1278,11 @@ public class RiverGageDlg extends CaveSWTDialog implements
|
|||
// Rating Date
|
||||
if (!dateRatingTF.getText().equals("")) {
|
||||
try {
|
||||
newData.setDateOfRating(dateFormat
|
||||
.parse(dateRatingTF.getText()));
|
||||
newData.setDateOfRating(dateFormat.parse(dateRatingTF.getText()));
|
||||
} catch (ParseException e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Invalid Value");
|
||||
mb
|
||||
.setMessage("Please enter a Date of Rating\nin the form: YYYY-MM-DD");
|
||||
mb.setMessage("Please enter a Date of Rating\nin the form: YYYY-MM-DD");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
|
@ -1325,8 +1322,7 @@ public class RiverGageDlg extends CaveSWTDialog implements
|
|||
} catch (VizException e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
mb
|
||||
.setMessage("An error occurred while trying to save the River Gage");
|
||||
mb.setMessage("An error occurred while trying to save the River Gage");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
|
@ -1392,8 +1388,8 @@ public class RiverGageDlg extends CaveSWTDialog implements
|
|||
RPFFcstPointData seedData = new RPFFcstPointData();
|
||||
seedData.setLid(lid);
|
||||
|
||||
ArrayList<RPFFcstPointData> data = HydroDBDataManager.getInstance()
|
||||
.getData(seedData);
|
||||
java.util.List<RPFFcstPointData> data = HydroDBDataManager
|
||||
.getInstance().getData(seedData);
|
||||
|
||||
if (data.size() > 0) {
|
||||
// Should be only one record per lid
|
||||
|
@ -1426,8 +1422,7 @@ public class RiverGageDlg extends CaveSWTDialog implements
|
|||
} catch (VizException e) {
|
||||
mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Delete");
|
||||
mb
|
||||
.setMessage("An error occurred while trying to delete the River Gage");
|
||||
mb.setMessage("An error occurred while trying to delete the River Gage");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -177,12 +177,12 @@ public class RiverProFcstGrpPointsDlg extends CaveSWTDialog {
|
|||
/**
|
||||
* The group info
|
||||
*/
|
||||
private ArrayList<RPFFcstGroupData> groupData;
|
||||
private java.util.List<RPFFcstGroupData> groupData;
|
||||
|
||||
/**
|
||||
* The point info for each group
|
||||
*/
|
||||
private HashMap<String, ArrayList<RPFFcstPointData>> pointData;
|
||||
private HashMap<String, java.util.List<RPFFcstPointData>> pointData;
|
||||
|
||||
/**
|
||||
* States for the dialog
|
||||
|
@ -551,8 +551,8 @@ public class RiverProFcstGrpPointsDlg extends CaveSWTDialog {
|
|||
secondaryHsaList.removeAll();
|
||||
|
||||
try {
|
||||
ArrayList<String> hsa = AddModifyLocationDataManager.getInstance()
|
||||
.getHSAs();
|
||||
java.util.List<String> hsa = AddModifyLocationDataManager
|
||||
.getInstance().getHSAs();
|
||||
|
||||
for (String currHSA : hsa) {
|
||||
primaryHsaList.add(currHSA);
|
||||
|
@ -574,25 +574,25 @@ public class RiverProFcstGrpPointsDlg extends CaveSWTDialog {
|
|||
RPFFcstGroupData.class);
|
||||
|
||||
// Initialize the Point map
|
||||
pointData = new HashMap<String, ArrayList<RPFFcstPointData>>();
|
||||
pointData = new HashMap<String, java.util.List<RPFFcstPointData>>();
|
||||
|
||||
// Get the point info
|
||||
ArrayList<RPFFcstPointData> temp = HydroDBDataManager.getInstance()
|
||||
.getData(RPFFcstPointData.class);
|
||||
java.util.List<RPFFcstPointData> temp = HydroDBDataManager
|
||||
.getInstance().getData(RPFFcstPointData.class);
|
||||
|
||||
ArrayList<RPFFcstPointData> tempArr;
|
||||
java.util.List<RPFFcstPointData> tempArr;
|
||||
for (RPFFcstPointData currPoint : temp) {
|
||||
// Get the ArrayList for the Group ID
|
||||
// Get the List for the Group ID
|
||||
if (pointData.containsKey(currPoint.getGroupID())) {
|
||||
tempArr = pointData.get(currPoint.getGroupID());
|
||||
} else {
|
||||
tempArr = new ArrayList<RPFFcstPointData>();
|
||||
}
|
||||
|
||||
// Add the point to the ArrayList
|
||||
// Add the point to the List
|
||||
tempArr.add(currPoint);
|
||||
|
||||
// Store the ArrayList in the point data
|
||||
// Store the List in the point data
|
||||
pointData.put(currPoint.getGroupID(), tempArr);
|
||||
}
|
||||
|
||||
|
@ -630,9 +630,10 @@ public class RiverProFcstGrpPointsDlg extends CaveSWTDialog {
|
|||
private String getDisplayString(RPFFcstGroupData currGroup) {
|
||||
String rval = "%-8.8s %-32.32s %-4.4s %-1s";
|
||||
|
||||
return String.format(rval, currGroup.getGroupID(), currGroup
|
||||
.getGroupName(), HydroDataUtils.getDisplayString(currGroup
|
||||
.getOrdinal()), currGroup.getRecommendAll());
|
||||
return String.format(rval, currGroup.getGroupID(),
|
||||
currGroup.getGroupName(),
|
||||
HydroDataUtils.getDisplayString(currGroup.getOrdinal()),
|
||||
currGroup.getRecommendAll());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -645,15 +646,20 @@ public class RiverProFcstGrpPointsDlg extends CaveSWTDialog {
|
|||
private String getDisplayString(RPFFcstPointData currPoint) {
|
||||
String rval = "%-8s %-30.30s %3.3s %-3s %s %-3.3s %-3.3s %-6.6s %-6.6s %6.6s";
|
||||
|
||||
return String.format(rval, currPoint.getLid(), currPoint.getLidName(),
|
||||
return String.format(
|
||||
rval,
|
||||
currPoint.getLid(),
|
||||
currPoint.getLidName(),
|
||||
HydroDataUtils.getDisplayString(currPoint.getOrdinal()),
|
||||
currPoint.getRecordType(), HydroDataUtils.getDisplayString(
|
||||
"%s", "%.2f", currPoint.getChangeThreshold()),
|
||||
currPoint.getPrimaryBackup(), currPoint.getSecondaryBackup(),
|
||||
currPoint.getRecordType(),
|
||||
HydroDataUtils.getDisplayString("%s", "%.2f",
|
||||
currPoint.getChangeThreshold()),
|
||||
currPoint.getPrimaryBackup(),
|
||||
currPoint.getSecondaryBackup(),
|
||||
HydroDataUtils.getDisplayString(currPoint.getBackHours()),
|
||||
HydroDataUtils.getDisplayString(currPoint.getForwardHours()),
|
||||
HydroDataUtils.getDisplayString("%s", "%6.1f", currPoint
|
||||
.getAdjustEndHours()));
|
||||
HydroDataUtils.getDisplayString("%s", "%6.1f",
|
||||
currPoint.getAdjustEndHours()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -696,10 +702,9 @@ public class RiverProFcstGrpPointsDlg extends CaveSWTDialog {
|
|||
}
|
||||
|
||||
updateDialogState(DialogStates.POINTS_AVAILABLE);
|
||||
|
||||
if (fcstPointList.getItemCount() > 0 )
|
||||
{
|
||||
fcstPointList.setSelection(0);
|
||||
|
||||
if (fcstPointList.getItemCount() > 0) {
|
||||
fcstPointList.setSelection(0);
|
||||
}
|
||||
} else {
|
||||
updateDialogState(DialogStates.NO_POINTS);
|
||||
|
@ -942,9 +947,8 @@ public class RiverProFcstGrpPointsDlg extends CaveSWTDialog {
|
|||
MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION | SWT.OK
|
||||
| SWT.CANCEL);
|
||||
mb.setText("Delete Confirmation");
|
||||
mb
|
||||
.setMessage("Do you want to delete this Forecast Group?\n"
|
||||
+ "(This will remove all Forecast Point associations to this Group.)");
|
||||
mb.setMessage("Do you want to delete this Forecast Group?\n"
|
||||
+ "(This will remove all Forecast Point associations to this Group.)");
|
||||
|
||||
int result = mb.open();
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
**/
|
||||
package com.raytheon.viz.hydrobase.dialogs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
|
@ -313,8 +311,8 @@ public class RiverProGenParamsDlg extends CaveSWTDialog {
|
|||
|
||||
private void getDialogData() {
|
||||
try {
|
||||
ArrayList<RPFParamData> data = HydroDBDataManager.getInstance()
|
||||
.getData(RPFParamData.class);
|
||||
java.util.List<RPFParamData> data = HydroDBDataManager
|
||||
.getInstance().getData(RPFParamData.class);
|
||||
|
||||
if (data != null && data.size() > 0) {
|
||||
// There should only be one record
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
**/
|
||||
package com.raytheon.viz.hydrobase.dialogs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
|
@ -186,17 +184,17 @@ public class StatesCountiesZonesDlg extends CaveSWTDialog {
|
|||
/**
|
||||
* Zone Cache
|
||||
*/
|
||||
private ArrayList<EligZoneData> zoneData;
|
||||
private java.util.List<EligZoneData> zoneData;
|
||||
|
||||
/**
|
||||
* County Cache
|
||||
*/
|
||||
private ArrayList<CountiesData> countyData;
|
||||
private java.util.List<CountiesData> countyData;
|
||||
|
||||
/**
|
||||
* State Cache
|
||||
*/
|
||||
private ArrayList<StateData> stateData;
|
||||
private java.util.List<StateData> stateData;
|
||||
|
||||
/**
|
||||
* Display states for the dialog
|
||||
|
@ -801,8 +799,7 @@ public class StatesCountiesZonesDlg extends CaveSWTDialog {
|
|||
} catch (VizException e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
mb
|
||||
.setMessage("An error occurred while trying to save the State");
|
||||
mb.setMessage("An error occurred while trying to save the State");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
|
@ -840,8 +837,7 @@ public class StatesCountiesZonesDlg extends CaveSWTDialog {
|
|||
} catch (VizException e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
mb
|
||||
.setMessage("An error occurred while trying to save the County");
|
||||
mb.setMessage("An error occurred while trying to save the County");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
|
@ -869,8 +865,7 @@ public class StatesCountiesZonesDlg extends CaveSWTDialog {
|
|||
} catch (VizException e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
mb
|
||||
.setMessage("An error occurred while trying to save the Zone");
|
||||
mb.setMessage("An error occurred while trying to save the Zone");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
|
@ -911,8 +906,7 @@ public class StatesCountiesZonesDlg extends CaveSWTDialog {
|
|||
} catch (VizException e) {
|
||||
mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Delete");
|
||||
mb
|
||||
.setMessage("An error occurred while trying to delete the State");
|
||||
mb.setMessage("An error occurred while trying to delete the State");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
|
@ -946,8 +940,7 @@ public class StatesCountiesZonesDlg extends CaveSWTDialog {
|
|||
} catch (VizException e) {
|
||||
mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Delete");
|
||||
mb
|
||||
.setMessage("An error occurred while trying to delete the County");
|
||||
mb.setMessage("An error occurred while trying to delete the County");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
|
@ -981,8 +974,7 @@ public class StatesCountiesZonesDlg extends CaveSWTDialog {
|
|||
} catch (VizException e) {
|
||||
mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Delete");
|
||||
mb
|
||||
.setMessage("An error occurred while trying to delete the Zone");
|
||||
mb.setMessage("An error occurred while trying to delete the Zone");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
|
@ -1061,8 +1053,8 @@ public class StatesCountiesZonesDlg extends CaveSWTDialog {
|
|||
// Check if WFO Exists
|
||||
if (data.getResultCount() > 0) {
|
||||
data = HydroDBDataManager.getInstance().runMappedQuery(
|
||||
String.format(stateQuery, countiesStateTF
|
||||
.getText()));
|
||||
String.format(stateQuery,
|
||||
countiesStateTF.getText()));
|
||||
|
||||
// Check if State Exists
|
||||
if (data.getResultCount() > 0) {
|
||||
|
@ -1085,8 +1077,7 @@ public class StatesCountiesZonesDlg extends CaveSWTDialog {
|
|||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR
|
||||
| SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
mb
|
||||
.setMessage("Please choose a Secondary Backup that exists.");
|
||||
mb.setMessage("Please choose a Secondary Backup that exists.");
|
||||
mb.open();
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -22,6 +22,7 @@ package com.raytheon.viz.hydrocommon.colorscalemgr;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
|
@ -35,7 +36,9 @@ import org.eclipse.swt.graphics.RGB;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 29 NOV 2007 373 lvenable Initial creation
|
||||
* 29 NOV 2007 373 lvenable Initial creation.
|
||||
* 18 APR 2013 1790 rferrel Clean up method interfaces;
|
||||
* part of non-blocking dialogs.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -122,7 +125,7 @@ public class ColorDataTypeSets {
|
|||
* Data type key.
|
||||
* @return Array of color set data (updated).
|
||||
*/
|
||||
public ArrayList<ColorScaleData> getColorScaleDataArray(String dataTypeKey) {
|
||||
public List<ColorScaleData> getColorScaleDataArray(String dataTypeKey) {
|
||||
ColorScaleSets colorSets = dataTypeMap.get(dataTypeKey);
|
||||
if (colorSets == null) {
|
||||
return new ArrayList<ColorScaleData>();
|
||||
|
@ -138,8 +141,7 @@ public class ColorDataTypeSets {
|
|||
* Data type key.
|
||||
* @return Array of color set data (used).
|
||||
*/
|
||||
public ArrayList<ColorScaleData> getUsedColorScaleDataArray(
|
||||
String dataTypeKey) {
|
||||
public List<ColorScaleData> getUsedColorScaleDataArray(String dataTypeKey) {
|
||||
ColorScaleSets colorSets = dataTypeMap.get(dataTypeKey);
|
||||
if (colorSets == null) {
|
||||
return new ArrayList<ColorScaleData>();
|
||||
|
|
|
@ -54,8 +54,6 @@ import com.raytheon.uf.common.status.UFStatus;
|
|||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.RGBColors;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.viz.hydrocommon.Activator;
|
||||
import com.raytheon.viz.hydrocommon.constants.StatusConstants;
|
||||
import com.raytheon.viz.hydrocommon.data.ColorValueData;
|
||||
import com.raytheon.viz.hydrocommon.datamanager.HydroDBDataManager;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
@ -70,7 +68,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* 29 NOV 2007 373 lvenable Initial creation
|
||||
* 23 Feb 2011 5400 lbousaidi fixed issues in color/value bar
|
||||
* 11 Mar 2013 15065 lbousaidi fixed issue with both color legend
|
||||
* disappearing after save
|
||||
* disappearing after save
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
|
@ -78,7 +76,9 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
*
|
||||
*/
|
||||
public class ColorScaleMgrDlg extends CaveSWTDialog {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(ColorScaleMgrDlg.class);
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(ColorScaleMgrDlg.class);
|
||||
|
||||
private static final String OFFICE = "Office";
|
||||
|
||||
private static final String DEFAULT = "Default";
|
||||
|
@ -110,12 +110,12 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
|||
/**
|
||||
* Updated Color/Value array of color and value labels.
|
||||
*/
|
||||
private ArrayList<ColorValueLabels> colorValLblArray;
|
||||
private java.util.List<ColorValueLabels> colorValLblArray;
|
||||
|
||||
/**
|
||||
* Used Color/Value array of color and value labels.
|
||||
*/
|
||||
private ArrayList<ColorValueLabels> usedColorValLblArray;
|
||||
private java.util.List<ColorValueLabels> usedColorValLblArray;
|
||||
|
||||
/**
|
||||
* Source combo box.
|
||||
|
@ -228,7 +228,7 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
|||
*/
|
||||
private Combo browseDurationCbo;
|
||||
|
||||
private ArrayList<ColorValueLabels> browseColorValLblArray;
|
||||
private java.util.List<ColorValueLabels> browseColorValLblArray;
|
||||
|
||||
private Composite browseLabelComp;
|
||||
|
||||
|
@ -749,7 +749,7 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
|||
changeBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
if (valueTF.getText() == null || valueTF.getText().equals("")) {
|
||||
if (valueTF.getText() == null || valueTF.getText().equals("")) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_WARNING
|
||||
| SWT.OK);
|
||||
mb.setText("Choose a value");
|
||||
|
@ -757,7 +757,7 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
|||
mb.open();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
String source = getSource();
|
||||
changeColor(currentColor.getRGB(), source);
|
||||
updateColorValueLabelBar();
|
||||
|
@ -1094,7 +1094,7 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
|||
private void createEditColorDisplay(Composite parentComp) {
|
||||
String source = getSource();
|
||||
|
||||
ArrayList<ColorScaleData> updatedColorSet = editColorData
|
||||
java.util.List<ColorScaleData> updatedColorSet = editColorData
|
||||
.getColorScaleDataArray(source, selectedDurationInSeconds + "_"
|
||||
+ dataTypeCbo.getText());
|
||||
|
||||
|
@ -1134,7 +1134,7 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
|||
private void createBrowseEditColorDisplay(Composite parentComp) {
|
||||
String source = getSource();
|
||||
|
||||
ArrayList<ColorScaleData> updatedColorSet = editColorData
|
||||
java.util.List<ColorScaleData> updatedColorSet = editColorData
|
||||
.getColorScaleDataArray(source, selectedBrowseDurationInSeconds
|
||||
+ "_" + browseDataTypeCbo.getText());
|
||||
|
||||
|
@ -1269,7 +1269,7 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
|||
* Parent composite.
|
||||
*/
|
||||
private void createUsedColorDisplay(Composite parentComp) {
|
||||
ArrayList<ColorScaleData> usedColorSet = editColorData
|
||||
java.util.List<ColorScaleData> usedColorSet = editColorData
|
||||
.getUsedColorScaleDataArray(sourceCbo.getText(),
|
||||
selectedDurationInSeconds + "_" + dataTypeCbo.getText());
|
||||
|
||||
|
@ -1419,9 +1419,11 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
|||
durationCbo.add("0");
|
||||
} else {
|
||||
// HERE is the NULL Pointer
|
||||
String dataType = colorManager.getDataTypeName(dataTypeCbo.getText());
|
||||
String dataType = colorManager.getDataTypeName(dataTypeCbo
|
||||
.getText());
|
||||
Set<String> durations = editColorData.getColorDataTypeSets(
|
||||
sourceKey).getDurations(colorManager.getDescription(dataType));
|
||||
sourceKey).getDurations(
|
||||
colorManager.getDescription(dataType));
|
||||
Iterator<String> i = durations.iterator();
|
||||
while (i.hasNext()) {
|
||||
addDuration(i.next());
|
||||
|
@ -1436,7 +1438,7 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
|||
*/
|
||||
private void updateBrowseDurationCombo() {
|
||||
String source = getSource();
|
||||
ArrayList<String> durations;
|
||||
java.util.List<String> durations;
|
||||
if (source.equals(DEFAULT)) {
|
||||
durations = new ArrayList<String>();
|
||||
durations.add("0");
|
||||
|
@ -1465,17 +1467,16 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
|||
|
||||
String source = getSource();
|
||||
|
||||
ArrayList<ColorScaleData> updatedColorSet = editColorData
|
||||
java.util.List<ColorScaleData> updatedColorSet = editColorData
|
||||
.getColorScaleDataArray(source, selectedDurationInSeconds + "_"
|
||||
+ dataTypeCbo.getText());
|
||||
// ArrayList<ColorScaleData> updatedColorSet = editColorData
|
||||
// java.util.List<ColorScaleData> updatedColorSet = editColorData
|
||||
// .getColorScaleDataArray(source, durationCbo.getText() + "_"
|
||||
// + dataTypeCbo.getText());
|
||||
|
||||
if (updatedColorSet.size()==0) {
|
||||
updatedColorSet = editColorData
|
||||
.getColorScaleDataArray(source, 0 + "_"
|
||||
+ dataTypeCbo.getText());
|
||||
|
||||
if (updatedColorSet.size() == 0) {
|
||||
updatedColorSet = editColorData.getColorScaleDataArray(source, 0
|
||||
+ "_" + dataTypeCbo.getText());
|
||||
}
|
||||
int numCols = updatedColorSet.size();
|
||||
|
||||
|
@ -1515,7 +1516,7 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
|||
|
||||
String source = getSource();
|
||||
|
||||
ArrayList<ColorScaleData> updatedColorSet = editColorData
|
||||
java.util.List<ColorScaleData> updatedColorSet = editColorData
|
||||
.getColorScaleDataArray(source, selectedBrowseDurationInSeconds
|
||||
+ "_" + browseDataTypeCbo.getText());
|
||||
if (updatedColorSet == null) {
|
||||
|
@ -1560,18 +1561,17 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
|||
|
||||
String source = getSource();
|
||||
|
||||
// ArrayList<ColorScaleData> updatedColorSet = editColorData
|
||||
// java.util.List<ColorScaleData> updatedColorSet = editColorData
|
||||
// .getUsedColorScaleDataArray(source, durationCbo.getText() + "_"
|
||||
// + dataTypeCbo.getText());
|
||||
ArrayList<ColorScaleData> updatedColorSet = editColorData
|
||||
java.util.List<ColorScaleData> updatedColorSet = editColorData
|
||||
.getUsedColorScaleDataArray(source, selectedDurationInSeconds
|
||||
+ "_" + dataTypeCbo.getText());
|
||||
|
||||
//use default color
|
||||
if (updatedColorSet.size() == 0 ) {
|
||||
updatedColorSet = editColorData
|
||||
.getUsedColorScaleDataArray(source, 0
|
||||
+ "_" + dataTypeCbo.getText());
|
||||
|
||||
// use default color
|
||||
if (updatedColorSet.size() == 0) {
|
||||
updatedColorSet = editColorData.getUsedColorScaleDataArray(source,
|
||||
0 + "_" + dataTypeCbo.getText());
|
||||
}
|
||||
int numCols = updatedColorSet.size();
|
||||
|
||||
|
@ -1713,7 +1713,7 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
|||
*/
|
||||
private boolean populateUserIdCombo() {
|
||||
userIdCbo.removeAll();
|
||||
ArrayList<String> userIds = colorManager.getUsers();
|
||||
java.util.List<String> userIds = colorManager.getUsers();
|
||||
if (userIds.size() == 0) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -1739,7 +1739,7 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
|||
private boolean createColorData(String user) {
|
||||
ColorDataTypeSets dataTypeSets = new ColorDataTypeSets();
|
||||
// get all datatypes this user has saved data for
|
||||
ArrayList<String> userDataTypes = colorManager.getDataTypes(user);
|
||||
java.util.List<String> userDataTypes = colorManager.getDataTypes(user);
|
||||
|
||||
if (userDataTypes.size() == 0) {
|
||||
return false;
|
||||
|
@ -1753,8 +1753,8 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
|||
// for each datatype in database...
|
||||
for (String dataType : userDataTypes) {
|
||||
// get all durations for this datatype and this user
|
||||
ArrayList<String> durations = colorManager.getDurations(userId,
|
||||
dataType);
|
||||
java.util.List<String> durations = colorManager.getDurations(
|
||||
userId, dataType);
|
||||
|
||||
// for each duration for datatype
|
||||
for (String duration : durations) {
|
||||
|
@ -1767,13 +1767,13 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
|||
|
||||
try {
|
||||
// actually get the data from database
|
||||
ArrayList<ColorValueData> data = manager.getData(cvd);
|
||||
java.util.List<ColorValueData> data = manager.getData(cvd);
|
||||
// sort data by double value because data is stored as
|
||||
// String
|
||||
// see ColorValueData class for compareTo function
|
||||
Collections.sort(data);
|
||||
ColorScaleSets colorScaleSets = new ColorScaleSets();
|
||||
ArrayList<ColorScaleData> origList = new ArrayList<ColorScaleData>();
|
||||
java.util.List<ColorScaleData> origList = new ArrayList<ColorScaleData>();
|
||||
|
||||
for (ColorValueData colorValue : data) {
|
||||
ColorScaleData csd = new ColorScaleData();
|
||||
|
@ -1792,7 +1792,7 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
|||
}
|
||||
origList.add(csd);
|
||||
}
|
||||
ArrayList<ColorScaleData> usedList = new ArrayList<ColorScaleData>();
|
||||
java.util.List<ColorScaleData> usedList = new ArrayList<ColorScaleData>();
|
||||
usedList.addAll(origList);
|
||||
|
||||
colorScaleSets.setOriginalArray(origList);
|
||||
|
@ -1800,8 +1800,9 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
|||
|
||||
// Right now last data will be only data to show up
|
||||
// Need to incorporate duration into key for dataTypeSets
|
||||
dataTypeSets.addDataTypeColorSets(
|
||||
duration + "_" + colorManager.getDescription(dataType), colorScaleSets);
|
||||
dataTypeSets.addDataTypeColorSets(duration + "_"
|
||||
+ colorManager.getDescription(dataType),
|
||||
colorScaleSets);
|
||||
} catch (VizException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -1840,7 +1841,8 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
|||
* Creates the default color data
|
||||
*/
|
||||
private void createDefaultData() {
|
||||
ArrayList<String> defaultDataTypes = colorManager.getDefaultDataTypes();
|
||||
java.util.List<String> defaultDataTypes = colorManager
|
||||
.getDefaultDataTypes();
|
||||
|
||||
editColorData = new EditColorData();
|
||||
|
||||
|
@ -1848,7 +1850,7 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
|||
|
||||
for (int i = 0; i < defaultDataTypes.size(); i++) {
|
||||
ColorScaleSets colorScaleSets = new ColorScaleSets();
|
||||
ArrayList<ColorScaleData> origList = colorManager
|
||||
java.util.List<ColorScaleData> origList = colorManager
|
||||
.getDefaultColorScaleData(defaultDataTypes.get(i));
|
||||
|
||||
colorScaleSets.setOriginalArray(origList);
|
||||
|
@ -1889,10 +1891,11 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
|||
Iterator<String> i = dataTypes.iterator();
|
||||
while (i.hasNext()) {
|
||||
String dt = i.next();
|
||||
//add a check in case there is a typo in dataType the it will be null
|
||||
if (!dt.contains("null")) {
|
||||
dataTypeCbo.add(colorManager.getDescription(dt));
|
||||
}
|
||||
// add a check in case there is a typo in dataType the it will be
|
||||
// null
|
||||
if (!dt.contains("null")) {
|
||||
dataTypeCbo.add(colorManager.getDescription(dt));
|
||||
}
|
||||
}
|
||||
|
||||
if (dataTypeCbo.getItemCount() == 0) {
|
||||
|
@ -1975,11 +1978,11 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
|||
} else {
|
||||
createColorData(user);
|
||||
}
|
||||
|
||||
updateDurationCombo();
|
||||
updateColorValueLabelBar();
|
||||
|
||||
setReturnValue(true);
|
||||
|
||||
updateDurationCombo();
|
||||
updateColorValueLabelBar();
|
||||
|
||||
setReturnValue(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2002,8 +2005,8 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
|||
updateSaveDataTypeCombo();
|
||||
updateUsedColorSetGroupText();
|
||||
} catch (Throwable t) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error parsing duration: " + durationCbo.getText(), t);
|
||||
statusHandler.handle(Priority.PROBLEM, "Error parsing duration: "
|
||||
+ durationCbo.getText(), t);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2043,7 +2046,7 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
|||
String dataType = dataTypeCbo.getText();
|
||||
String duration = selectedDurationInSeconds.toString();
|
||||
String dataTypeKey = duration + "_" + dataType;
|
||||
ArrayList<ColorScaleData> data = editColorData
|
||||
java.util.List<ColorScaleData> data = editColorData
|
||||
.getUsedColorScaleDataArray(source, duration + "_" + dataType);
|
||||
ColorValueData cvd = new ColorValueData();
|
||||
cvd.setApplicationName(colorManager.getApplicationName());
|
||||
|
@ -2156,8 +2159,8 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
|||
durationCbo
|
||||
.add(String.valueOf(Integer.parseInt(durInSeconds) / 3600));
|
||||
} catch (Throwable t) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error parsing duration: " + durInSeconds, t);
|
||||
statusHandler.handle(Priority.PROBLEM, "Error parsing duration: "
|
||||
+ durInSeconds, t);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2166,8 +2169,8 @@ public class ColorScaleMgrDlg extends CaveSWTDialog {
|
|||
browseDurationCbo
|
||||
.add(String.valueOf(Integer.parseInt(durInSeconds) / 3600));
|
||||
} catch (Throwable t) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error parsing duration: " + durInSeconds, t);
|
||||
statusHandler.handle(Priority.PROBLEM, "Error parsing duration: "
|
||||
+ durInSeconds, t);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
package com.raytheon.viz.hydrocommon.colorscalemgr;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
|
||||
|
@ -45,6 +46,8 @@ import org.eclipse.swt.graphics.RGB;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 29 NOV 2007 373 lvenable Initial creation
|
||||
* 18 APR 2013 1790 rferrel Cleanup method interfaces;
|
||||
* part of non-blocking dialogs.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -56,17 +59,17 @@ public class ColorScaleSets {
|
|||
/**
|
||||
* Array containing the original color set data.
|
||||
*/
|
||||
private ArrayList<ColorScaleData> originalColorSet;
|
||||
private List<ColorScaleData> originalColorSet;
|
||||
|
||||
/**
|
||||
* Array containing updates to the color set data.
|
||||
*/
|
||||
private ArrayList<ColorScaleData> updatedColorSet;
|
||||
private List<ColorScaleData> updatedColorSet;
|
||||
|
||||
/**
|
||||
* Array containing the used color set data.
|
||||
*/
|
||||
private ArrayList<ColorScaleData> usedColorSet;
|
||||
private List<ColorScaleData> usedColorSet;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -85,8 +88,8 @@ public class ColorScaleSets {
|
|||
* @param usedColorSet
|
||||
* Used color set array.
|
||||
*/
|
||||
public ColorScaleSets(ArrayList<ColorScaleData> originalColorSet,
|
||||
ArrayList<ColorScaleData> usedColorSet) {
|
||||
public ColorScaleSets(List<ColorScaleData> originalColorSet,
|
||||
List<ColorScaleData> usedColorSet) {
|
||||
this.originalColorSet = new ArrayList<ColorScaleData>(originalColorSet);
|
||||
updatedColorSet = new ArrayList<ColorScaleData>(originalColorSet);
|
||||
this.usedColorSet = new ArrayList<ColorScaleData>(usedColorSet);
|
||||
|
@ -173,7 +176,7 @@ public class ColorScaleSets {
|
|||
* @param array
|
||||
* Array of color scale data.
|
||||
*/
|
||||
public void setOriginalArray(ArrayList<ColorScaleData> array) {
|
||||
public void setOriginalArray(List<ColorScaleData> array) {
|
||||
originalColorSet = new ArrayList<ColorScaleData>(array);
|
||||
updatedColorSet = new ArrayList<ColorScaleData>(array);
|
||||
}
|
||||
|
@ -184,7 +187,7 @@ public class ColorScaleSets {
|
|||
* @param array
|
||||
* Array of color scale data.
|
||||
*/
|
||||
public void setUsedArray(ArrayList<ColorScaleData> array) {
|
||||
public void setUsedArray(List<ColorScaleData> array) {
|
||||
usedColorSet = new ArrayList<ColorScaleData>(array);
|
||||
}
|
||||
|
||||
|
@ -243,7 +246,7 @@ public class ColorScaleSets {
|
|||
*
|
||||
* @return The update color scale data array.
|
||||
*/
|
||||
public ArrayList<ColorScaleData> getUpdatedColorSetArray() {
|
||||
public List<ColorScaleData> getUpdatedColorSetArray() {
|
||||
return updatedColorSet;
|
||||
}
|
||||
|
||||
|
@ -252,7 +255,7 @@ public class ColorScaleSets {
|
|||
*
|
||||
* @return The used color scale data array.
|
||||
*/
|
||||
public ArrayList<ColorScaleData> getUsedColorSetArray() {
|
||||
public List<ColorScaleData> getUsedColorSetArray() {
|
||||
return usedColorSet;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
|
||||
package com.raytheon.viz.hydrocommon.colorscalemgr;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
||||
|
@ -36,6 +36,8 @@ import org.eclipse.swt.graphics.RGB;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 29 NOV 2007 373 lvenable Initial creation
|
||||
* 18 APR 2013 1790 rferrel Cleanup method interfaces;
|
||||
* part of non-blocking dialogs.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -115,7 +117,7 @@ public class EditColorData {
|
|||
* Data type key.
|
||||
* @return Updated color scale data array.
|
||||
*/
|
||||
public ArrayList<ColorScaleData> getColorScaleDataArray(String sourceKey,
|
||||
public List<ColorScaleData> getColorScaleDataArray(String sourceKey,
|
||||
String dataTypeKey) {
|
||||
return sourceMap.get(sourceKey).getColorScaleDataArray(dataTypeKey);
|
||||
}
|
||||
|
@ -129,8 +131,8 @@ public class EditColorData {
|
|||
* Data type key.
|
||||
* @return Used color scale data array.
|
||||
*/
|
||||
public ArrayList<ColorScaleData> getUsedColorScaleDataArray(
|
||||
String sourceKey, String dataTypeKey) {
|
||||
public List<ColorScaleData> getUsedColorScaleDataArray(String sourceKey,
|
||||
String dataTypeKey) {
|
||||
return sourceMap.get(sourceKey).getColorScaleDataArray(dataTypeKey);
|
||||
}
|
||||
|
||||
|
@ -161,8 +163,8 @@ public class EditColorData {
|
|||
* @param dblVal
|
||||
* Scale value.
|
||||
*/
|
||||
public void updateColorValue(String sourceKey, String dataTypeKey,
|
||||
RGB rgb, double dblVal) {
|
||||
public void updateColorValue(String sourceKey, String dataTypeKey, RGB rgb,
|
||||
double dblVal) {
|
||||
sourceMap.get(sourceKey).addUpdateColorValue(dataTypeKey, rgb, dblVal);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
**/
|
||||
package com.raytheon.viz.hydrocommon.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.dataquery.db.QueryResultRow;
|
||||
|
@ -37,6 +37,8 @@ import com.raytheon.viz.hydrocommon.datamanager.HydroDBDataManager;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 19, 2008 1787 askripsky Initial creation
|
||||
* Mar 08, 2012 14600 wkwock Delete one lid instead of one group
|
||||
* 18 APR 2013 1790 rferrel Cleanup method interfaces;
|
||||
* part of non-blocking dialogs.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -137,8 +139,8 @@ public class RPFFcstPointData extends HydroDBData implements IHydroDBData {
|
|||
setGroupID(getDBValue("group_id", data, dataMap, ""));
|
||||
setOrdinal(getDBValue("ordinal", data, dataMap,
|
||||
HydroConstants.MISSING_VALUE));
|
||||
setChangeThreshold(getDBValue("chg_threshold", data, dataMap, Double
|
||||
.valueOf(HydroConstants.MISSING_VALUE)));
|
||||
setChangeThreshold(getDBValue("chg_threshold", data, dataMap,
|
||||
Double.valueOf(HydroConstants.MISSING_VALUE)));
|
||||
setRecordType(getDBValue("rec_type", data, dataMap, ""));
|
||||
setPrimaryBackup(getDBValue("primary_back", data, dataMap, ""));
|
||||
setSecondaryBackup(getDBValue("secondary_back", data, dataMap, ""));
|
||||
|
@ -160,8 +162,8 @@ public class RPFFcstPointData extends HydroDBData implements IHydroDBData {
|
|||
}
|
||||
|
||||
try {
|
||||
ArrayList<RPFParamData> data = HydroDBDataManager.getInstance()
|
||||
.getData(RPFParamData.class);
|
||||
List<RPFParamData> data = HydroDBDataManager.getInstance().getData(
|
||||
RPFParamData.class);
|
||||
|
||||
if (data != null && data.size() > 0) {
|
||||
// There should only be one record
|
||||
|
@ -379,8 +381,8 @@ public class RPFFcstPointData extends HydroDBData implements IHydroDBData {
|
|||
|
||||
@Override
|
||||
public String getDeleteStatement() {
|
||||
return "DELETE FROM rpffcstpoint WHERE lid="+getDBString(lid)+" and group_id="
|
||||
+ getDBString(groupID);
|
||||
return "DELETE FROM rpffcstpoint WHERE lid=" + getDBString(lid)
|
||||
+ " and group_id=" + getDBString(groupID);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,6 +21,7 @@ package com.raytheon.viz.hydrocommon.datamanager;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -46,7 +47,9 @@ import com.raytheon.viz.hydrocommon.data.LocationData;
|
|||
* location table instead of hsa table.
|
||||
* Oct 05, 2011 15333 lbousaidi changed the queries that retrieves the HSAs from
|
||||
* the database.
|
||||
*
|
||||
* Apr 18, 2013 1790 rferrel Cleanup method interfaces;
|
||||
* part of non-blocking dialogs.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author askripsky
|
||||
|
@ -55,9 +58,10 @@ import com.raytheon.viz.hydrocommon.data.LocationData;
|
|||
|
||||
public class AddModifyLocationDataManager extends HydroDataManager {
|
||||
protected static AddModifyLocationDataManager manager = null;
|
||||
|
||||
private static final String[] rval = { "AT", "N", "NNE", "NE", "ENE", "E", "ESE", "SE",
|
||||
"SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW" };
|
||||
|
||||
private static final String[] rval = { "AT", "N", "NNE", "NE", "ENE", "E",
|
||||
"ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW",
|
||||
"NNW" };
|
||||
|
||||
/**
|
||||
* Private constructor.
|
||||
|
@ -95,8 +99,8 @@ public class AddModifyLocationDataManager extends HydroDataManager {
|
|||
LocationData locData = new LocationData();
|
||||
locData.setLid(lid);
|
||||
|
||||
ArrayList<LocationData> data = HydroDBDataManager.getInstance()
|
||||
.getData(locData);
|
||||
List<LocationData> data = HydroDBDataManager.getInstance().getData(
|
||||
locData);
|
||||
|
||||
if ((data != null) && (data.size() > 0)) {
|
||||
locData = data.get(0);
|
||||
|
@ -122,8 +126,8 @@ public class AddModifyLocationDataManager extends HydroDataManager {
|
|||
* @return The networks from the DB
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<String> getNetworks() throws VizException {
|
||||
ArrayList<String> rval = new ArrayList<String>();
|
||||
public List<String> getNetworks() throws VizException {
|
||||
List<String> rval = new ArrayList<String>();
|
||||
|
||||
String query = "Select network from network order by network";
|
||||
|
||||
|
@ -146,8 +150,8 @@ public class AddModifyLocationDataManager extends HydroDataManager {
|
|||
* @return The rfcs from the DB
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<String> getRFCs() throws VizException {
|
||||
ArrayList<String> rval = new ArrayList<String>();
|
||||
public List<String> getRFCs() throws VizException {
|
||||
List<String> rval = new ArrayList<String>();
|
||||
|
||||
String query = "Select rfc from rfc order by rfc";
|
||||
|
||||
|
@ -170,10 +174,10 @@ public class AddModifyLocationDataManager extends HydroDataManager {
|
|||
* @return The HSAs from the DB
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<String> getHSAs() throws VizException {
|
||||
ArrayList<String> rval = new ArrayList<String>();
|
||||
public List<String> getHSAs() throws VizException {
|
||||
List<String> rval = new ArrayList<String>();
|
||||
|
||||
String query= "SELECT DISTINCT upper(hsa) from hsa order by upper (hsa)";
|
||||
String query = "SELECT DISTINCT upper(hsa) from hsa order by upper (hsa)";
|
||||
QueryResult data = HydroDBDataManager.getInstance().runMappedQuery(
|
||||
query);
|
||||
|
||||
|
@ -193,8 +197,8 @@ public class AddModifyLocationDataManager extends HydroDataManager {
|
|||
* @return The HSAs from the DB
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<String> getHSAsForFilter() throws VizException {
|
||||
ArrayList<String> rval = new ArrayList<String>();
|
||||
public List<String> getHSAsForFilter() throws VizException {
|
||||
List<String> rval = new ArrayList<String>();
|
||||
|
||||
String query = "Select distinct(hsa) from location order by hsa";
|
||||
|
||||
|
@ -217,11 +221,11 @@ public class AddModifyLocationDataManager extends HydroDataManager {
|
|||
* @return The WFOs from the DB
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<String> getWFOs() throws VizException {
|
||||
ArrayList<String> rval = new ArrayList<String>();
|
||||
|
||||
String query= "SELECT DISTINCT upper(wfo) from wfo order by upper (wfo)";
|
||||
|
||||
public List<String> getWFOs() throws VizException {
|
||||
List<String> rval = new ArrayList<String>();
|
||||
|
||||
String query = "SELECT DISTINCT upper(wfo) from wfo order by upper (wfo)";
|
||||
|
||||
QueryResult data = HydroDBDataManager.getInstance().runMappedQuery(
|
||||
query);
|
||||
|
||||
|
@ -241,8 +245,8 @@ public class AddModifyLocationDataManager extends HydroDataManager {
|
|||
* @return The Time Zones from the DB
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<String> getTimeZones() throws VizException {
|
||||
ArrayList<String> rval = new ArrayList<String>();
|
||||
public List<String> getTimeZones() throws VizException {
|
||||
List<String> rval = new ArrayList<String>();
|
||||
|
||||
String query = "Select tzone, name from timezone order by tzone";
|
||||
|
||||
|
@ -273,9 +277,8 @@ public class AddModifyLocationDataManager extends HydroDataManager {
|
|||
* @return
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<String> getAvailableAgenciesAndOffices()
|
||||
throws VizException {
|
||||
ArrayList<String> rval = new ArrayList<String>();
|
||||
public List<String> getAvailableAgenciesAndOffices() throws VizException {
|
||||
List<String> rval = new ArrayList<String>();
|
||||
|
||||
String agencyCode;
|
||||
String office;
|
||||
|
@ -297,7 +300,7 @@ public class AddModifyLocationDataManager extends HydroDataManager {
|
|||
* @return
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<AgencyOfficeData> getAvailableAgenciesAndOfficesData()
|
||||
public List<AgencyOfficeData> getAvailableAgenciesAndOfficesData()
|
||||
throws VizException {
|
||||
return HydroDBDataManager.getInstance().getData(AgencyOfficeData.class);
|
||||
}
|
||||
|
@ -308,7 +311,7 @@ public class AddModifyLocationDataManager extends HydroDataManager {
|
|||
* @return
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<LocationAgencyOfficeData> getSelectedAgenciesAndOfficesData(
|
||||
public List<LocationAgencyOfficeData> getSelectedAgenciesAndOfficesData(
|
||||
String lid) throws VizException {
|
||||
LocationAgencyOfficeData dataToGet = new LocationAgencyOfficeData();
|
||||
dataToGet.setLid(lid);
|
||||
|
@ -322,9 +325,9 @@ public class AddModifyLocationDataManager extends HydroDataManager {
|
|||
* @return
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<String> getSelectedAgenciesAndOffices(String lid)
|
||||
public List<String> getSelectedAgenciesAndOffices(String lid)
|
||||
throws VizException {
|
||||
ArrayList<String> rval = new ArrayList<String>();
|
||||
List<String> rval = new ArrayList<String>();
|
||||
|
||||
String agencyCode;
|
||||
String office;
|
||||
|
@ -416,7 +419,7 @@ public class AddModifyLocationDataManager extends HydroDataManager {
|
|||
|
||||
// Verify Lid exists
|
||||
if (locationExists(sourceLocation)) {
|
||||
|
||||
|
||||
/*
|
||||
* Copy all necessary information.
|
||||
*/
|
||||
|
@ -573,16 +576,18 @@ public class AddModifyLocationDataManager extends HydroDataManager {
|
|||
return (rowCount > 0);
|
||||
}
|
||||
|
||||
private void copyTableData(String sourceLid, String destinationLid, String table) {
|
||||
private void copyTableData(String sourceLid, String destinationLid,
|
||||
String table) {
|
||||
// Get the columns for the table
|
||||
final String columnQuery = "SELECT column_name FROM information_schema.columns WHERE table_name = '" + table + "' ORDER BY ordinal_position";
|
||||
final String columnQuery = "SELECT column_name FROM information_schema.columns WHERE table_name = '"
|
||||
+ table + "' ORDER BY ordinal_position";
|
||||
|
||||
List<Object[]> columns = runQuery(columnQuery);
|
||||
|
||||
ArrayList<Object[]> columns = runQuery(columnQuery);
|
||||
|
||||
// Dynamically create the select statement to
|
||||
// get the data out
|
||||
// get the data out
|
||||
StringBuffer query = new StringBuffer("select ");
|
||||
|
||||
|
||||
for (int i = 0; i < columns.size(); i++) {
|
||||
Object[] oa = columns.get(i);
|
||||
if (i == 0) {
|
||||
|
@ -591,14 +596,14 @@ public class AddModifyLocationDataManager extends HydroDataManager {
|
|||
query.append(", " + oa[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
query.append(" from " + table + " where lid = '" + sourceLid + "'");
|
||||
|
||||
|
||||
// execute the dynamically created query
|
||||
ArrayList<Object[]> rs = runQuery(query.toString());
|
||||
|
||||
List<Object[]> rs = runQuery(query.toString());
|
||||
|
||||
// Get the data from the query and dynamically build
|
||||
// an insert statement
|
||||
// an insert statement
|
||||
StringBuilder insert = new StringBuilder("insert into " + table + " (");
|
||||
if ((rs != null) && (rs.size() > 0)) {
|
||||
for (int i = 0; i < columns.size(); i++) {
|
||||
|
@ -609,17 +614,17 @@ public class AddModifyLocationDataManager extends HydroDataManager {
|
|||
insert.append(", " + oa[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
insert.append(") values (");
|
||||
String insertBegin = insert.toString();
|
||||
for (Object[] oa: rs) {
|
||||
for (Object[] oa : rs) {
|
||||
insert.setLength(0);
|
||||
insert.append(insertBegin);
|
||||
for (int i = 0; i < oa.length; i++) {
|
||||
for (int i = 0; i < oa.length; i++) {
|
||||
if (i == 0) {
|
||||
insert.append("'" + destinationLid + "'");
|
||||
} else {
|
||||
if (oa[i] instanceof String) {
|
||||
if (oa[i] instanceof String) {
|
||||
String s = (String) oa[i];
|
||||
if (s.contains("'")) {
|
||||
s = s.replace("'", "''");
|
||||
|
@ -627,17 +632,19 @@ public class AddModifyLocationDataManager extends HydroDataManager {
|
|||
if (s.indexOf("\"") > 0) {
|
||||
s = s.replace("\"", "\\\"");
|
||||
}
|
||||
|
||||
|
||||
insert.append(", '" + s + "'");
|
||||
} else if (oa[i] instanceof Date) {
|
||||
insert.append(", '" + HydroConstants.DATE_FORMAT.format(oa[i]) + "'");
|
||||
insert.append(", '"
|
||||
+ HydroConstants.DATE_FORMAT.format(oa[i])
|
||||
+ "'");
|
||||
} else {
|
||||
insert.append(", " + oa[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
insert.append(")");
|
||||
|
||||
|
||||
try {
|
||||
runStatement(insert.toString());
|
||||
} catch (VizException e) {
|
||||
|
|
|
@ -21,6 +21,7 @@ package com.raytheon.viz.hydrocommon.datamanager;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.viz.hydrocommon.data.CountiesData;
|
||||
|
@ -38,6 +39,8 @@ import com.raytheon.viz.hydrocommon.data.ZoneInfoData;
|
|||
* Jan 5, 2009 1802 askripsky Initial Creation
|
||||
* Sep 11,2012 15362 wkwock Fix selected zones
|
||||
* Dec 4, 2012 15522 wkwock Fix added zones
|
||||
* Apr 18,2013 1790 rferrel Cleanup method interfaces;
|
||||
* part of non-blocking dialogs.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -46,259 +49,259 @@ import com.raytheon.viz.hydrocommon.data.ZoneInfoData;
|
|||
*/
|
||||
|
||||
public class CountyZoneUgcDataManager {
|
||||
protected static CountyZoneUgcDataManager manager = null;
|
||||
protected static CountyZoneUgcDataManager manager = null;
|
||||
|
||||
// Cache for selected counties
|
||||
private ArrayList<CountyInfoData> countiesSelected = null;
|
||||
// Cache for selected counties
|
||||
private List<CountyInfoData> countiesSelected = null;
|
||||
|
||||
// Cache for available counties
|
||||
private ArrayList<CountiesData> countiesAvailable = null;
|
||||
// Cache for available counties
|
||||
private List<CountiesData> countiesAvailable = null;
|
||||
|
||||
// Cache for selected zones
|
||||
private ArrayList<ZoneInfoData> zonesSelected = null;
|
||||
// Cache for selected zones
|
||||
private List<ZoneInfoData> zonesSelected = null;
|
||||
|
||||
// Cache for available zones
|
||||
private ArrayList<EligZoneData> zonesAvailable = null;
|
||||
// Cache for available zones
|
||||
private List<EligZoneData> zonesAvailable = null;
|
||||
|
||||
// Counties/Zones for this Location
|
||||
private String lid = "";
|
||||
// Counties/Zones for this Location
|
||||
private String lid = "";
|
||||
|
||||
/**
|
||||
* Private constructor.
|
||||
*/
|
||||
private CountyZoneUgcDataManager() {
|
||||
}
|
||||
/**
|
||||
* Private constructor.
|
||||
*/
|
||||
private CountyZoneUgcDataManager() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Singleton pattern of data manager.
|
||||
*
|
||||
* @return manager
|
||||
*/
|
||||
public static synchronized CountyZoneUgcDataManager getInstance() {
|
||||
if (manager == null) {
|
||||
manager = new CountyZoneUgcDataManager();
|
||||
}
|
||||
/**
|
||||
* Singleton pattern of data manager.
|
||||
*
|
||||
* @return manager
|
||||
*/
|
||||
public static synchronized CountyZoneUgcDataManager getInstance() {
|
||||
if (manager == null) {
|
||||
manager = new CountyZoneUgcDataManager();
|
||||
}
|
||||
|
||||
return (CountyZoneUgcDataManager) manager;
|
||||
}
|
||||
return (CountyZoneUgcDataManager) manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the location for the data.
|
||||
*
|
||||
* @param lid
|
||||
* The location for the counties/zones
|
||||
*/
|
||||
public void setLid(String lid) {
|
||||
this.lid = lid;
|
||||
}
|
||||
/**
|
||||
* Sets the location for the data.
|
||||
*
|
||||
* @param lid
|
||||
* The location for the counties/zones
|
||||
*/
|
||||
public void setLid(String lid) {
|
||||
this.lid = lid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the available counties.
|
||||
*
|
||||
* @return The counties available.
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<CountiesData> getCountiesAvailable() throws VizException {
|
||||
if (countiesAvailable == null) {
|
||||
countiesAvailable = HydroDBDataManager.getInstance().getData(
|
||||
CountiesData.class);
|
||||
}
|
||||
/**
|
||||
* Gets the available counties.
|
||||
*
|
||||
* @return The counties available.
|
||||
* @throws VizException
|
||||
*/
|
||||
public List<CountiesData> getCountiesAvailable() throws VizException {
|
||||
if (countiesAvailable == null) {
|
||||
countiesAvailable = HydroDBDataManager.getInstance().getData(
|
||||
CountiesData.class);
|
||||
}
|
||||
|
||||
return countiesAvailable;
|
||||
}
|
||||
return countiesAvailable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the selected counties.
|
||||
*
|
||||
* @return The counties selected.
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<CountyInfoData> getCountiesSelected() throws VizException {
|
||||
return getCountiesSelected(false);
|
||||
}
|
||||
/**
|
||||
* Gets the selected counties.
|
||||
*
|
||||
* @return The counties selected.
|
||||
* @throws VizException
|
||||
*/
|
||||
public List<CountyInfoData> getCountiesSelected() throws VizException {
|
||||
return getCountiesSelected(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the selected counties.
|
||||
*
|
||||
* @return The counties selected.
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<CountyInfoData> getCountiesSelected(boolean forceLoad)
|
||||
throws VizException {
|
||||
if (countiesSelected == null || forceLoad) {
|
||||
CountyInfoData seedData = new CountyInfoData();
|
||||
seedData.setLid(lid);
|
||||
/**
|
||||
* Gets the selected counties.
|
||||
*
|
||||
* @return The counties selected.
|
||||
* @throws VizException
|
||||
*/
|
||||
public List<CountyInfoData> getCountiesSelected(boolean forceLoad)
|
||||
throws VizException {
|
||||
if (countiesSelected == null || forceLoad) {
|
||||
CountyInfoData seedData = new CountyInfoData();
|
||||
seedData.setLid(lid);
|
||||
|
||||
countiesSelected = HydroDBDataManager.getInstance().getData(
|
||||
seedData);
|
||||
}
|
||||
countiesSelected = HydroDBDataManager.getInstance().getData(
|
||||
seedData);
|
||||
}
|
||||
|
||||
Collections.sort(countiesSelected);
|
||||
Collections.sort(countiesSelected);
|
||||
|
||||
return countiesSelected;
|
||||
}
|
||||
return countiesSelected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the available zones.
|
||||
*
|
||||
* @return The zones available.
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<EligZoneData> getZonesAvailable() throws VizException {
|
||||
if (zonesAvailable == null) {
|
||||
zonesAvailable = HydroDBDataManager.getInstance().getData(
|
||||
EligZoneData.class);
|
||||
}
|
||||
/**
|
||||
* Gets the available zones.
|
||||
*
|
||||
* @return The zones available.
|
||||
* @throws VizException
|
||||
*/
|
||||
public List<EligZoneData> getZonesAvailable() throws VizException {
|
||||
if (zonesAvailable == null) {
|
||||
zonesAvailable = HydroDBDataManager.getInstance().getData(
|
||||
EligZoneData.class);
|
||||
}
|
||||
|
||||
return zonesAvailable;
|
||||
}
|
||||
return zonesAvailable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the selected Zones.
|
||||
*
|
||||
* @return The zones selected.
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<ZoneInfoData> getZonesSelected() throws VizException {
|
||||
return getZonesSelected(false);
|
||||
}
|
||||
/**
|
||||
* Gets the selected Zones.
|
||||
*
|
||||
* @return The zones selected.
|
||||
* @throws VizException
|
||||
*/
|
||||
public List<ZoneInfoData> getZonesSelected() throws VizException {
|
||||
return getZonesSelected(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the selected Zones.
|
||||
*
|
||||
* @return The zones selected.
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<ZoneInfoData> getZonesSelected(boolean forceLoad)
|
||||
throws VizException {
|
||||
if (zonesSelected == null || forceLoad) {
|
||||
ZoneInfoData seedData = new ZoneInfoData();
|
||||
seedData.setLid(lid);
|
||||
/**
|
||||
* Gets the selected Zones.
|
||||
*
|
||||
* @return The zones selected.
|
||||
* @throws VizException
|
||||
*/
|
||||
public List<ZoneInfoData> getZonesSelected(boolean forceLoad)
|
||||
throws VizException {
|
||||
if (zonesSelected == null || forceLoad) {
|
||||
ZoneInfoData seedData = new ZoneInfoData();
|
||||
seedData.setLid(lid);
|
||||
|
||||
zonesSelected = HydroDBDataManager.getInstance().getData(seedData);
|
||||
}
|
||||
zonesSelected = HydroDBDataManager.getInstance().getData(seedData);
|
||||
}
|
||||
|
||||
Collections.sort(zonesSelected);
|
||||
Collections.sort(zonesSelected);
|
||||
|
||||
return zonesSelected;
|
||||
}
|
||||
return zonesSelected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the available county to the selected counties.
|
||||
*
|
||||
* @param selectedAvailableCounty
|
||||
* The index of the selected available county to select.
|
||||
*/
|
||||
public void addSelectedCounty(int selectedAvailableCounty) {
|
||||
CountiesData availableCounty = countiesAvailable
|
||||
.get(selectedAvailableCounty);
|
||||
/**
|
||||
* Adds the available county to the selected counties.
|
||||
*
|
||||
* @param selectedAvailableCounty
|
||||
* The index of the selected available county to select.
|
||||
*/
|
||||
public void addSelectedCounty(int selectedAvailableCounty) {
|
||||
CountiesData availableCounty = countiesAvailable
|
||||
.get(selectedAvailableCounty);
|
||||
|
||||
CountyInfoData countyToAdd = new CountyInfoData();
|
||||
countyToAdd.setLid(lid);
|
||||
countyToAdd.setState(availableCounty.getState());
|
||||
countyToAdd.setCounty(availableCounty.getCounty());
|
||||
countyToAdd.setCountyNumber(availableCounty.getCountyNumber());
|
||||
CountyInfoData countyToAdd = new CountyInfoData();
|
||||
countyToAdd.setLid(lid);
|
||||
countyToAdd.setState(availableCounty.getState());
|
||||
countyToAdd.setCounty(availableCounty.getCounty());
|
||||
countyToAdd.setCountyNumber(availableCounty.getCountyNumber());
|
||||
|
||||
if (!countiesSelected.contains(countyToAdd)) {
|
||||
countiesSelected.add(countyToAdd);
|
||||
}
|
||||
}
|
||||
if (!countiesSelected.contains(countyToAdd)) {
|
||||
countiesSelected.add(countyToAdd);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the available zone to the selected zones.
|
||||
*
|
||||
* @param selectedAvailableZone
|
||||
* The index of the selected available zone to select.
|
||||
*/
|
||||
public void addSelectedZone(int selectedAvailableZone) {
|
||||
EligZoneData availableZone = zonesAvailable.get(selectedAvailableZone);
|
||||
/**
|
||||
* Adds the available zone to the selected zones.
|
||||
*
|
||||
* @param selectedAvailableZone
|
||||
* The index of the selected available zone to select.
|
||||
*/
|
||||
public void addSelectedZone(int selectedAvailableZone) {
|
||||
EligZoneData availableZone = zonesAvailable.get(selectedAvailableZone);
|
||||
|
||||
ZoneInfoData zoneToAdd = new ZoneInfoData();
|
||||
zoneToAdd.setLid(lid);
|
||||
zoneToAdd.setState(availableZone.getState());
|
||||
zoneToAdd.setZoneNumber(availableZone.getZoneNumber());
|
||||
zoneToAdd.setDescription(availableZone.getDescription());
|
||||
ZoneInfoData zoneToAdd = new ZoneInfoData();
|
||||
zoneToAdd.setLid(lid);
|
||||
zoneToAdd.setState(availableZone.getState());
|
||||
zoneToAdd.setZoneNumber(availableZone.getZoneNumber());
|
||||
zoneToAdd.setDescription(availableZone.getDescription());
|
||||
|
||||
if (!zonesSelected.contains(zoneToAdd)) {
|
||||
zonesSelected.add(zoneToAdd);
|
||||
}
|
||||
}
|
||||
if (!zonesSelected.contains(zoneToAdd)) {
|
||||
zonesSelected.add(zoneToAdd);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all existing counties for the station and inserts all of selected
|
||||
* counties.
|
||||
*
|
||||
* @throws VizException
|
||||
*/
|
||||
public void saveCounties() throws VizException {
|
||||
// Remove all counties for the lid
|
||||
CountyInfoData dataToDelete = new CountyInfoData();
|
||||
dataToDelete.setLid(lid);
|
||||
HydroDBDataManager.getInstance().deleteRecord(dataToDelete);
|
||||
/**
|
||||
* Removes all existing counties for the station and inserts all of selected
|
||||
* counties.
|
||||
*
|
||||
* @throws VizException
|
||||
*/
|
||||
public void saveCounties() throws VizException {
|
||||
// Remove all counties for the lid
|
||||
CountyInfoData dataToDelete = new CountyInfoData();
|
||||
dataToDelete.setLid(lid);
|
||||
HydroDBDataManager.getInstance().deleteRecord(dataToDelete);
|
||||
|
||||
// Insert the currently selected counties
|
||||
for (CountyInfoData currCounty : countiesSelected) {
|
||||
HydroDBDataManager.getInstance().putData(currCounty);
|
||||
}
|
||||
}
|
||||
// Insert the currently selected counties
|
||||
for (CountyInfoData currCounty : countiesSelected) {
|
||||
HydroDBDataManager.getInstance().putData(currCounty);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all existing zones for the station and inserts all of selected
|
||||
* zones.
|
||||
*
|
||||
* @throws VizException
|
||||
*/
|
||||
public void saveZones() throws VizException {
|
||||
// Remove all zones for the lid
|
||||
ZoneInfoData dataToDelete = new ZoneInfoData();
|
||||
dataToDelete.setLid(lid);
|
||||
HydroDBDataManager.getInstance().deleteRecord(dataToDelete);
|
||||
/**
|
||||
* Removes all existing zones for the station and inserts all of selected
|
||||
* zones.
|
||||
*
|
||||
* @throws VizException
|
||||
*/
|
||||
public void saveZones() throws VizException {
|
||||
// Remove all zones for the lid
|
||||
ZoneInfoData dataToDelete = new ZoneInfoData();
|
||||
dataToDelete.setLid(lid);
|
||||
HydroDBDataManager.getInstance().deleteRecord(dataToDelete);
|
||||
|
||||
// Insert the currently selected zones
|
||||
for (ZoneInfoData currZone : zonesSelected) {
|
||||
HydroDBDataManager.getInstance().putData(currZone);
|
||||
}
|
||||
}
|
||||
// Insert the currently selected zones
|
||||
for (ZoneInfoData currZone : zonesSelected) {
|
||||
HydroDBDataManager.getInstance().putData(currZone);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the selected county.
|
||||
*
|
||||
* @param selectedIndex
|
||||
* The county to be removed.
|
||||
*/
|
||||
public void removeSelectedCounty(int selectedIndex) {
|
||||
countiesSelected.remove(selectedIndex);
|
||||
}
|
||||
/**
|
||||
* Removes the selected county.
|
||||
*
|
||||
* @param selectedIndex
|
||||
* The county to be removed.
|
||||
*/
|
||||
public void removeSelectedCounty(int selectedIndex) {
|
||||
countiesSelected.remove(selectedIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the selected zone.
|
||||
*
|
||||
* @param selectedIndex
|
||||
* The zone to be removed.
|
||||
*/
|
||||
public void removeSelectedZone(int selectedIndex) {
|
||||
zonesSelected.remove(selectedIndex);
|
||||
}
|
||||
/**
|
||||
* Removes the selected zone.
|
||||
*
|
||||
* @param selectedIndex
|
||||
* The zone to be removed.
|
||||
*/
|
||||
public void removeSelectedZone(int selectedIndex) {
|
||||
zonesSelected.remove(selectedIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all selected counties.
|
||||
*/
|
||||
public void clearSelectedCounties() {
|
||||
if (countiesSelected != null) {
|
||||
countiesSelected.clear();
|
||||
} else {
|
||||
countiesSelected = new ArrayList<CountyInfoData>();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Removes all selected counties.
|
||||
*/
|
||||
public void clearSelectedCounties() {
|
||||
if (countiesSelected != null) {
|
||||
countiesSelected.clear();
|
||||
} else {
|
||||
countiesSelected = new ArrayList<CountyInfoData>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all selected zones.
|
||||
*/
|
||||
public void clearSelectedZones() {
|
||||
if (zonesSelected != null) {
|
||||
zonesSelected.clear();
|
||||
} else {
|
||||
zonesSelected = new ArrayList<ZoneInfoData>();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Removes all selected zones.
|
||||
*/
|
||||
public void clearSelectedZones() {
|
||||
if (zonesSelected != null) {
|
||||
zonesSelected.clear();
|
||||
} else {
|
||||
zonesSelected = new ArrayList<ZoneInfoData>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package com.raytheon.viz.hydrocommon.datamanager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.dataquery.db.QueryResult;
|
||||
import com.raytheon.uf.common.dataquery.db.QueryResultRow;
|
||||
|
@ -35,6 +36,8 @@ import com.raytheon.viz.hydrocommon.util.HydroDataUtils;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 15, 2008 1787 askripsky Initial Creation
|
||||
* Apr 18, 2013 1790 rferrel Cleanup method interfaces;
|
||||
* part of non-blocking dialogs.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -45,7 +48,7 @@ import com.raytheon.viz.hydrocommon.util.HydroDataUtils;
|
|||
public class DataAdjustFactorDataManager {
|
||||
private static DataAdjustFactorDataManager manager = null;
|
||||
|
||||
private ArrayList<DataAdjustFactorData> adjustFactorData = null;
|
||||
private List<DataAdjustFactorData> adjustFactorData = null;
|
||||
|
||||
/**
|
||||
* Private constructor.
|
||||
|
@ -72,8 +75,8 @@ public class DataAdjustFactorDataManager {
|
|||
* @return The duration from the DB
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<String> getShefDur() throws VizException {
|
||||
ArrayList<String> rval = new ArrayList<String>();
|
||||
public List<String> getShefDur() throws VizException {
|
||||
List<String> rval = new ArrayList<String>();
|
||||
|
||||
String durQuery = "SELECT name, dur FROM shefdur ORDER BY dur";
|
||||
|
||||
|
@ -99,8 +102,8 @@ public class DataAdjustFactorDataManager {
|
|||
* @return The type sources from the DB
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<String> getShefTs() throws VizException {
|
||||
ArrayList<String> rval = new ArrayList<String>();
|
||||
public List<String> getShefTs() throws VizException {
|
||||
List<String> rval = new ArrayList<String>();
|
||||
|
||||
String tsQuery = "SELECT name, ts FROM shefts ORDER BY ts";
|
||||
|
||||
|
@ -126,8 +129,8 @@ public class DataAdjustFactorDataManager {
|
|||
* @return The extremum from the DB
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<String> getShefExtremum() throws VizException {
|
||||
ArrayList<String> rval = new ArrayList<String>();
|
||||
public List<String> getShefExtremum() throws VizException {
|
||||
List<String> rval = new ArrayList<String>();
|
||||
|
||||
String extQuery = "SELECT name, extremum FROM shefex ORDER BY extremum";
|
||||
|
||||
|
@ -147,12 +150,11 @@ public class DataAdjustFactorDataManager {
|
|||
return rval;
|
||||
}
|
||||
|
||||
public ArrayList<DataAdjustFactorData> getAdjustFactorData()
|
||||
throws VizException {
|
||||
public List<DataAdjustFactorData> getAdjustFactorData() throws VizException {
|
||||
return getAdjustFactorData(false);
|
||||
}
|
||||
|
||||
public ArrayList<DataAdjustFactorData> getAdjustFactorData(boolean forceLoad)
|
||||
public List<DataAdjustFactorData> getAdjustFactorData(boolean forceLoad)
|
||||
throws VizException {
|
||||
if (adjustFactorData == null || forceLoad) {
|
||||
adjustFactorData = HydroDBDataManager.getInstance().getData(
|
||||
|
@ -179,8 +181,10 @@ public class DataAdjustFactorDataManager {
|
|||
data.append(String.format("%2s ", currData.getPe()));
|
||||
|
||||
// Duration
|
||||
data.append(String.format("%s ", HydroDataUtils.getDisplayString(
|
||||
"%4s", "%d", currData.getDuration())));
|
||||
data.append(String.format(
|
||||
"%s ",
|
||||
HydroDataUtils.getDisplayString("%4s", "%d",
|
||||
currData.getDuration())));
|
||||
|
||||
// TS
|
||||
data.append(String.format("%2s ", currData.getTypeSource()));
|
||||
|
@ -189,20 +193,28 @@ public class DataAdjustFactorDataManager {
|
|||
data.append(String.format("%2s ", currData.getExtremum()));
|
||||
|
||||
// Divisor
|
||||
data.append(String.format("%s ", HydroDataUtils.getDisplayString(
|
||||
"%11s", "%.3f", currData.getDivisor())));
|
||||
data.append(String.format(
|
||||
"%s ",
|
||||
HydroDataUtils.getDisplayString("%11s", "%.3f",
|
||||
currData.getDivisor())));
|
||||
|
||||
// Base
|
||||
data.append(String.format("%s ", HydroDataUtils.getDisplayString(
|
||||
"%11s", "%.3f", currData.getBase())));
|
||||
data.append(String.format(
|
||||
"%s ",
|
||||
HydroDataUtils.getDisplayString("%11s", "%.3f",
|
||||
currData.getBase())));
|
||||
|
||||
// Multiplier
|
||||
data.append(String.format("%s ", HydroDataUtils.getDisplayString(
|
||||
"%11s", "%.3f", currData.getMultiplier())));
|
||||
data.append(String.format(
|
||||
"%s ",
|
||||
HydroDataUtils.getDisplayString("%11s", "%.3f",
|
||||
currData.getMultiplier())));
|
||||
|
||||
// Adder
|
||||
data.append(String.format("%s ", HydroDataUtils.getDisplayString(
|
||||
"%11s", "%.3f", currData.getAdder())));
|
||||
data.append(String.format(
|
||||
"%s ",
|
||||
HydroDataUtils.getDisplayString("%11s", "%.3f",
|
||||
currData.getAdder())));
|
||||
|
||||
return data.toString();
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package com.raytheon.viz.hydrocommon.datamanager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.dataquery.db.QueryResult;
|
||||
import com.raytheon.uf.common.dataquery.db.QueryResultRow;
|
||||
|
@ -35,6 +36,7 @@ import com.raytheon.viz.hydrocommon.data.DataIngestFilterData;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 11, 2008 1787 askripsky Initial Creation
|
||||
* Apr 18, 2013 1790 rferrel Code clean up with non-blocking dialogs.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -43,9 +45,9 @@ import com.raytheon.viz.hydrocommon.data.DataIngestFilterData;
|
|||
*/
|
||||
|
||||
public class DataIngestFilterDataManager {
|
||||
private static DataIngestFilterDataManager manager = null;
|
||||
private static DataIngestFilterDataManager manager = new DataIngestFilterDataManager();
|
||||
|
||||
private ArrayList<DataIngestFilterData> ingestFilterData = null;
|
||||
private List<DataIngestFilterData> ingestFilterData = null;
|
||||
|
||||
/**
|
||||
* Private constructor.
|
||||
|
@ -59,10 +61,6 @@ public class DataIngestFilterDataManager {
|
|||
* @return manager
|
||||
*/
|
||||
public static synchronized DataIngestFilterDataManager getInstance() {
|
||||
if (manager == null) {
|
||||
manager = new DataIngestFilterDataManager();
|
||||
}
|
||||
|
||||
return manager;
|
||||
}
|
||||
|
||||
|
@ -72,8 +70,8 @@ public class DataIngestFilterDataManager {
|
|||
* @return The duration from the DB
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<String> getShefDur() throws VizException {
|
||||
ArrayList<String> rval = new ArrayList<String>();
|
||||
public List<String> getShefDur() throws VizException {
|
||||
List<String> rval = new ArrayList<String>();
|
||||
|
||||
String durQuery = "SELECT name, dur FROM shefdur ORDER BY dur";
|
||||
|
||||
|
@ -99,8 +97,8 @@ public class DataIngestFilterDataManager {
|
|||
* @return The type sources from the DB
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<String> getShefTs() throws VizException {
|
||||
ArrayList<String> rval = new ArrayList<String>();
|
||||
public List<String> getShefTs() throws VizException {
|
||||
List<String> rval = new ArrayList<String>();
|
||||
|
||||
String tsQuery = "SELECT name, ts FROM shefts ORDER BY ts";
|
||||
|
||||
|
@ -126,8 +124,8 @@ public class DataIngestFilterDataManager {
|
|||
* @return The extremum from the DB
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<String> getShefExtremum() throws VizException {
|
||||
ArrayList<String> rval = new ArrayList<String>();
|
||||
public List<String> getShefExtremum() throws VizException {
|
||||
List<String> rval = new ArrayList<String>();
|
||||
|
||||
String extQuery = "SELECT name, extremum FROM shefex ORDER BY extremum";
|
||||
|
||||
|
@ -173,8 +171,8 @@ public class DataIngestFilterDataManager {
|
|||
* @return The filtered ingest filter data.
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<DataIngestFilterData> getIngestFilter(boolean filterByPE,
|
||||
ArrayList<String> selectedPE, boolean filterByLocation,
|
||||
public List<DataIngestFilterData> getIngestFilter(boolean filterByPE,
|
||||
List<String> selectedPE, boolean filterByLocation,
|
||||
String selectedLocation, boolean filterBySwitches,
|
||||
boolean filterByIngest, boolean filterByOFS, boolean filterByMPE,
|
||||
boolean filterByTS, String selectedTS) throws VizException {
|
||||
|
@ -211,15 +209,14 @@ public class DataIngestFilterDataManager {
|
|||
* @return The filtered ingest filter data.
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<DataIngestFilterData> getIngestFilter(boolean filterByPE,
|
||||
ArrayList<String> selectedPE, boolean filterByLocation,
|
||||
public List<DataIngestFilterData> getIngestFilter(boolean filterByPE,
|
||||
List<String> selectedPE, boolean filterByLocation,
|
||||
String selectedLocation, boolean filterBySwitches,
|
||||
boolean filterByIngest, boolean filterByOFS, boolean filterByMPE,
|
||||
boolean filterByTS, String selectedTS, boolean forceLoad)
|
||||
throws VizException {
|
||||
if ((ingestFilterData == null) || forceLoad) {
|
||||
DataIngestFilterData seedData = new DataIngestFilterData();
|
||||
// seedData.setResultLimit(150);
|
||||
|
||||
StringBuffer whereClause = new StringBuffer();
|
||||
if (filterByLocation) {
|
||||
|
@ -287,8 +284,8 @@ public class DataIngestFilterDataManager {
|
|||
String dataFormat = "%-9S %-4S %-6S %-7S %-6S %-7S %-5S %-5S %-5S";
|
||||
|
||||
return String.format(dataFormat, currData.getLid(), currData.getPe(),
|
||||
getDisplayString(currData.getDuration()), currData
|
||||
.getTypeSource(), currData.getExtremum(),
|
||||
getDisplayString(currData.getDuration()),
|
||||
currData.getTypeSource(), currData.getExtremum(),
|
||||
getDisplayString(currData.getTsRank()), currData.getIngest(),
|
||||
currData.getOfsInput(), currData.getStg2Input());
|
||||
}
|
||||
|
@ -302,8 +299,8 @@ public class DataIngestFilterDataManager {
|
|||
* @return The corresponding string or "" if the value is MISSING_VALUE
|
||||
*/
|
||||
public String getDisplayString(Double val) {
|
||||
String temp = (Double.compare(val, Double
|
||||
.valueOf(HydroConstants.MISSING_VALUE)) != 0) ? Double
|
||||
String temp = (Double.compare(val,
|
||||
Double.valueOf(HydroConstants.MISSING_VALUE)) != 0) ? Double
|
||||
.toString(val) : "";
|
||||
|
||||
return temp;
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.lang.reflect.Constructor;
|
|||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.dataquery.db.QueryResult;
|
||||
|
@ -40,6 +41,7 @@ import com.raytheon.viz.hydrocommon.data.HydroDBData;
|
|||
* Nov 17, 2008 1697 askripsky Initial Creation
|
||||
* Nov 21, 2008 1697 askripsky Changed to use reflection and filter generic methods
|
||||
* Nov 03, 2011 11273 lbousaidi added updateNewData and putNewData.
|
||||
* Apr 18, 2013 1790 rferrel Code cleanup part of non-blocking dialogs.
|
||||
* </pre>
|
||||
*
|
||||
* @author askripsky
|
||||
|
@ -47,7 +49,7 @@ import com.raytheon.viz.hydrocommon.data.HydroDBData;
|
|||
*/
|
||||
|
||||
public class HydroDBDataManager extends HydroDataManager {
|
||||
private static HydroDBDataManager manager = null;
|
||||
private static final HydroDBDataManager manager = new HydroDBDataManager();
|
||||
|
||||
/**
|
||||
* Private constructor.
|
||||
|
@ -61,10 +63,6 @@ public class HydroDBDataManager extends HydroDataManager {
|
|||
* @return manager
|
||||
*/
|
||||
public static synchronized HydroDBDataManager getInstance() {
|
||||
if (manager == null) {
|
||||
manager = new HydroDBDataManager();
|
||||
}
|
||||
|
||||
return manager;
|
||||
}
|
||||
|
||||
|
@ -74,8 +72,8 @@ public class HydroDBDataManager extends HydroDataManager {
|
|||
* @param recordsToDelete
|
||||
* @throws VizException
|
||||
*/
|
||||
public <T extends HydroDBData> void deleteRecords(
|
||||
ArrayList<T> recordsToDelete) throws VizException {
|
||||
public <T extends HydroDBData> void deleteRecords(List<T> recordsToDelete)
|
||||
throws VizException {
|
||||
for (T currData : recordsToDelete) {
|
||||
deleteRecord(currData);
|
||||
}
|
||||
|
@ -91,8 +89,8 @@ public class HydroDBDataManager extends HydroDataManager {
|
|||
public <T extends HydroDBData> void deleteRecord(T recordToDelete)
|
||||
throws VizException {
|
||||
try {
|
||||
String deleteQuery = (String) recordToDelete.getClass().getMethod(
|
||||
"getDeleteStatement").invoke(recordToDelete);
|
||||
String deleteQuery = (String) recordToDelete.getClass()
|
||||
.getMethod("getDeleteStatement").invoke(recordToDelete);
|
||||
|
||||
runStatement(deleteQuery);
|
||||
} catch (Exception e) {
|
||||
|
@ -105,13 +103,13 @@ public class HydroDBDataManager extends HydroDataManager {
|
|||
*
|
||||
* @param clazz
|
||||
* The data type to run the query for.
|
||||
* @return ArrayList containing the data type that is passed in containing
|
||||
* data from the DB.
|
||||
* @return List containing the data type that is passed in containing data
|
||||
* from the DB.
|
||||
* @throws VizException
|
||||
*/
|
||||
public <T extends HydroDBData> ArrayList<T> getData(Class<T> clazz)
|
||||
public <T extends HydroDBData> List<T> getData(Class<T> clazz)
|
||||
throws VizException {
|
||||
ArrayList<T> rval = new ArrayList<T>();
|
||||
List<T> rval = new ArrayList<T>();
|
||||
|
||||
try {
|
||||
String selectStatement = (String) clazz.getMethod(
|
||||
|
@ -124,8 +122,8 @@ public class HydroDBDataManager extends HydroDataManager {
|
|||
|
||||
if (result.getResultCount() > 0) {
|
||||
for (QueryResultRow currRow : result.getRows()) {
|
||||
rval.add(dataConstructor.newInstance(currRow, result
|
||||
.getColumnNames()));
|
||||
rval.add(dataConstructor.newInstance(currRow,
|
||||
result.getColumnNames()));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -154,18 +152,17 @@ public class HydroDBDataManager extends HydroDataManager {
|
|||
*
|
||||
* @param clazz
|
||||
* The data type to run the query for.
|
||||
* @return ArrayList containing the data type that is passed in containing
|
||||
* data from the DB.
|
||||
* @return List containing the data type that is passed in containing data
|
||||
* from the DB.
|
||||
* @throws VizException
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends HydroDBData> ArrayList<T> getData(T data)
|
||||
throws VizException {
|
||||
ArrayList<T> rval = new ArrayList<T>();
|
||||
public <T extends HydroDBData> List<T> getData(T data) throws VizException {
|
||||
List<T> rval = new ArrayList<T>();
|
||||
|
||||
try {
|
||||
String selectQuery = (String) data.getClass().getMethod(
|
||||
"getConstrainedSelectStatement").invoke(data);
|
||||
String selectQuery = (String) data.getClass()
|
||||
.getMethod("getConstrainedSelectStatement").invoke(data);
|
||||
|
||||
QueryResult result = runMappedQuery(selectQuery);
|
||||
|
||||
|
@ -174,8 +171,8 @@ public class HydroDBDataManager extends HydroDataManager {
|
|||
.getClass());
|
||||
|
||||
for (QueryResultRow currRow : result.getRows()) {
|
||||
rval.add(dataConstructor.newInstance(currRow, result
|
||||
.getColumnNames()));
|
||||
rval.add(dataConstructor.newInstance(currRow,
|
||||
result.getColumnNames()));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -219,8 +216,8 @@ public class HydroDBDataManager extends HydroDataManager {
|
|||
public <T extends HydroDBData> void updateData(T data) throws VizException {
|
||||
try {
|
||||
// Get the update statement with the values filled in
|
||||
String updateQuery = (String) data.getClass().getMethod(
|
||||
"getUpdateStatement").invoke(data);
|
||||
String updateQuery = (String) data.getClass()
|
||||
.getMethod("getUpdateStatement").invoke(data);
|
||||
|
||||
if (updateQuery != null) {
|
||||
runStatement(updateQuery);
|
||||
|
@ -238,25 +235,27 @@ public class HydroDBDataManager extends HydroDataManager {
|
|||
* @param updateData
|
||||
* @throws VizException
|
||||
* */
|
||||
public <T extends HydroDBData> void updateNewData(T newData, T updateData) throws VizException {
|
||||
try {
|
||||
|
||||
String updateQuery = (String) newData.getClass().getMethod(
|
||||
"getUpdateStatement").invoke(newData);
|
||||
|
||||
String pkquery= (String) updateData.getClass().getMethod(
|
||||
"getPKStatement").invoke(updateData);
|
||||
|
||||
String updateQueryToRun= updateQuery + "WHERE " + pkquery ;
|
||||
|
||||
if (updateQueryToRun != null) {
|
||||
runStatement(updateQueryToRun);
|
||||
}
|
||||
public <T extends HydroDBData> void updateNewData(T newData, T updateData)
|
||||
throws VizException {
|
||||
try {
|
||||
|
||||
String updateQuery = (String) newData.getClass()
|
||||
.getMethod("getUpdateStatement").invoke(newData);
|
||||
|
||||
String pkquery = (String) updateData.getClass()
|
||||
.getMethod("getPKStatement").invoke(updateData);
|
||||
|
||||
String updateQueryToRun = updateQuery + "WHERE " + pkquery;
|
||||
|
||||
if (updateQueryToRun != null) {
|
||||
runStatement(updateQueryToRun);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts into the respective DB table with the data passed in.
|
||||
*
|
||||
|
@ -319,29 +318,30 @@ public class HydroDBDataManager extends HydroDataManager {
|
|||
insertData(newData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks to see if the newData passed in already exists in the DB based on the
|
||||
* primary key for the data's respective table. If the data exists, an
|
||||
* UPDATE is performed by replacing the updateData with NewData.
|
||||
* If not, an INSERT of newData is performed.
|
||||
* Checks to see if the newData passed in already exists in the DB based on
|
||||
* the primary key for the data's respective table. If the data exists, an
|
||||
* UPDATE is performed by replacing the updateData with NewData. If not, an
|
||||
* INSERT of newData is performed.
|
||||
*
|
||||
* @param <T>
|
||||
* @param lid
|
||||
* @param newData
|
||||
* @throws VizException
|
||||
*/
|
||||
public <T extends HydroDBData> void putNewData(T newData, T updateData, boolean insert) throws VizException {
|
||||
// Check if it's going to be an update
|
||||
|
||||
if ((insert) && (checkData(newData)==0) ) {
|
||||
// Do an insert
|
||||
insertData(newData);
|
||||
|
||||
} else if (checkData(updateData) > 0) {
|
||||
// Do an update
|
||||
updateNewData(newData, updateData);
|
||||
public <T extends HydroDBData> void putNewData(T newData, T updateData,
|
||||
boolean insert) throws VizException {
|
||||
// Check if it's going to be an update
|
||||
|
||||
if ((insert) && (checkData(newData) == 0)) {
|
||||
// Do an insert
|
||||
insertData(newData);
|
||||
|
||||
} else if (checkData(updateData) > 0) {
|
||||
// Do an update
|
||||
updateNewData(newData, updateData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package com.raytheon.viz.hydrocommon.datamanager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.dataquery.db.QueryResult;
|
||||
import com.raytheon.uf.common.dataquery.db.QueryResultRow;
|
||||
|
@ -36,6 +37,8 @@ import com.raytheon.viz.hydrocommon.util.HydroDataUtils;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 8, 2008 1697 askripsky Initial Creation
|
||||
* Apr 18,2013 1790 rferrel Cleanup method interfaces;
|
||||
* part of non-blocking dialogs.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -46,13 +49,13 @@ import com.raytheon.viz.hydrocommon.util.HydroDataUtils;
|
|||
public class QcAlertAlarmLimitsDataManager {
|
||||
protected static QcAlertAlarmLimitsDataManager manager = null;
|
||||
|
||||
private ArrayList<DataLimitData> defaultData = null;
|
||||
private List<DataLimitData> defaultData = null;
|
||||
|
||||
private ArrayList<DataLimitData> defaultDataFiltered = null;
|
||||
private List<DataLimitData> defaultDataFiltered = null;
|
||||
|
||||
private ArrayList<LocationDataLimitData> locationData = null;
|
||||
private List<LocationDataLimitData> locationData = null;
|
||||
|
||||
private ArrayList<LocationDataLimitData> locationDataFiltered = null;
|
||||
private List<LocationDataLimitData> locationDataFiltered = null;
|
||||
|
||||
/**
|
||||
* Private constructor.
|
||||
|
@ -79,8 +82,8 @@ public class QcAlertAlarmLimitsDataManager {
|
|||
* @return The duration from the DB
|
||||
* @throws VizException
|
||||
*/
|
||||
public ArrayList<String> getShefDur() throws VizException {
|
||||
ArrayList<String> rval = new ArrayList<String>();
|
||||
public List<String> getShefDur() throws VizException {
|
||||
List<String> rval = new ArrayList<String>();
|
||||
|
||||
String durQuery = "SELECT name, dur FROM shefdur ORDER BY dur";
|
||||
|
||||
|
@ -100,14 +103,13 @@ public class QcAlertAlarmLimitsDataManager {
|
|||
return rval;
|
||||
}
|
||||
|
||||
public ArrayList<DataLimitData> getDefaultLimits(boolean filterByPE,
|
||||
ArrayList<String> selectedPE) throws VizException {
|
||||
public List<DataLimitData> getDefaultLimits(boolean filterByPE,
|
||||
List<String> selectedPE) throws VizException {
|
||||
return getDefaultLimits(filterByPE, selectedPE, false);
|
||||
}
|
||||
|
||||
public ArrayList<DataLimitData> getDefaultLimits(boolean filterByPE,
|
||||
ArrayList<String> selectedPE, boolean forceLoad)
|
||||
throws VizException {
|
||||
public List<DataLimitData> getDefaultLimits(boolean filterByPE,
|
||||
List<String> selectedPE, boolean forceLoad) throws VizException {
|
||||
if (defaultData == null || forceLoad) {
|
||||
defaultData = HydroDBDataManager.getInstance().getData(
|
||||
DataLimitData.class);
|
||||
|
@ -134,8 +136,8 @@ public class QcAlertAlarmLimitsDataManager {
|
|||
|
||||
// PE Dur MonthStart MonthEnd
|
||||
defaultString.append(String.format("%13s%7s%7s%8s ", currData.getPe(),
|
||||
currData.getDur(), currData.getMonthDayStart(), currData
|
||||
.getMonthDayEnd()));
|
||||
currData.getDur(), currData.getMonthDayStart(),
|
||||
currData.getMonthDayEnd()));
|
||||
|
||||
// Gross Min/Max
|
||||
defaultString.append(HydroDataUtils.getDisplayString("%9s", "%9.1f",
|
||||
|
@ -186,17 +188,16 @@ public class QcAlertAlarmLimitsDataManager {
|
|||
return defaultString.toString();
|
||||
}
|
||||
|
||||
public ArrayList<LocationDataLimitData> getLocationLimits(
|
||||
boolean filterByLID, String lidFilter, boolean filterByPE,
|
||||
ArrayList<String> selectedPE) throws VizException {
|
||||
public List<LocationDataLimitData> getLocationLimits(boolean filterByLID,
|
||||
String lidFilter, boolean filterByPE, List<String> selectedPE)
|
||||
throws VizException {
|
||||
return getLocationLimits(filterByLID, lidFilter, filterByPE,
|
||||
selectedPE, false);
|
||||
}
|
||||
|
||||
public ArrayList<LocationDataLimitData> getLocationLimits(
|
||||
boolean filterByLID, String lidFilter, boolean filterByPE,
|
||||
ArrayList<String> selectedPE, boolean forceLoad)
|
||||
throws VizException {
|
||||
public List<LocationDataLimitData> getLocationLimits(boolean filterByLID,
|
||||
String lidFilter, boolean filterByPE, List<String> selectedPE,
|
||||
boolean forceLoad) throws VizException {
|
||||
if (locationData == null || forceLoad) {
|
||||
locationData = HydroDBDataManager.getInstance().getData(
|
||||
LocationDataLimitData.class);
|
||||
|
@ -228,9 +229,9 @@ public class QcAlertAlarmLimitsDataManager {
|
|||
StringBuffer defaultString = new StringBuffer();
|
||||
|
||||
// PE Dur MonthStart MonthEnd
|
||||
defaultString.append(String.format("%-10s%3s%7s%7s%8s ", currData
|
||||
.getLid(), currData.getPe(), currData.getDur(), currData
|
||||
.getMonthDayStart(), currData.getMonthDayEnd()));
|
||||
defaultString.append(String.format("%-10s%3s%7s%7s%8s ",
|
||||
currData.getLid(), currData.getPe(), currData.getDur(),
|
||||
currData.getMonthDayStart(), currData.getMonthDayEnd()));
|
||||
|
||||
// Gross Min/Max
|
||||
defaultString.append(HydroDataUtils.getDisplayString("%9s", "%9.1f",
|
||||
|
@ -281,7 +282,7 @@ public class QcAlertAlarmLimitsDataManager {
|
|||
return defaultString.toString();
|
||||
}
|
||||
|
||||
private void filterDefaultByPE(ArrayList<String> selectedPE) {
|
||||
private void filterDefaultByPE(List<String> selectedPE) {
|
||||
if (defaultDataFiltered == null) {
|
||||
defaultDataFiltered = new ArrayList<DataLimitData>();
|
||||
}
|
||||
|
@ -297,9 +298,9 @@ public class QcAlertAlarmLimitsDataManager {
|
|||
}
|
||||
}
|
||||
|
||||
private void filterLocationByPE(ArrayList<String> selectedPE) {
|
||||
private void filterLocationByPE(List<String> selectedPE) {
|
||||
// Temp array to hold values that will stay
|
||||
ArrayList<LocationDataLimitData> temp = new ArrayList<LocationDataLimitData>();
|
||||
List<LocationDataLimitData> temp = new ArrayList<LocationDataLimitData>();
|
||||
|
||||
for (String peFilter : selectedPE) {
|
||||
for (LocationDataLimitData currData : locationDataFiltered) {
|
||||
|
@ -314,11 +315,11 @@ public class QcAlertAlarmLimitsDataManager {
|
|||
|
||||
private void filterLocationByLID(String lidFilter) {
|
||||
// Temp array to hold values that will stay
|
||||
ArrayList<LocationDataLimitData> temp = new ArrayList<LocationDataLimitData>();
|
||||
List<LocationDataLimitData> temp = new ArrayList<LocationDataLimitData>();
|
||||
|
||||
for (LocationDataLimitData currData : locationDataFiltered) {
|
||||
if (currData.getLid().toUpperCase().contains(
|
||||
lidFilter.toUpperCase())) {
|
||||
if (currData.getLid().toUpperCase()
|
||||
.contains(lidFilter.toUpperCase())) {
|
||||
temp.add(currData);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import java.lang.reflect.InvocationTargetException;
|
|||
import java.lang.reflect.Method;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
|
@ -1109,8 +1108,8 @@ public class DataSourcesDlg extends CaveSWTDialog {
|
|||
}
|
||||
|
||||
// Select the first option
|
||||
dataList.getClass().getMethod("select", int.class).invoke(dataList,
|
||||
0);
|
||||
dataList.getClass().getMethod("select", int.class)
|
||||
.invoke(dataList, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1131,8 +1130,8 @@ public class DataSourcesDlg extends CaveSWTDialog {
|
|||
seedData.setLid(lid);
|
||||
|
||||
try {
|
||||
ArrayList<DcpData> data = HydroDBDataManager.getInstance().getData(
|
||||
seedData);
|
||||
java.util.List<DcpData> data = HydroDBDataManager.getInstance()
|
||||
.getData(seedData);
|
||||
|
||||
if (data.size() > 0) {
|
||||
// There will only be one record per lid
|
||||
|
@ -1152,8 +1151,8 @@ public class DataSourcesDlg extends CaveSWTDialog {
|
|||
seedData.setLid(lid);
|
||||
|
||||
try {
|
||||
ArrayList<ObserverData> data = HydroDBDataManager.getInstance()
|
||||
.getData(seedData);
|
||||
java.util.List<ObserverData> data = HydroDBDataManager
|
||||
.getInstance().getData(seedData);
|
||||
|
||||
if (data.size() > 0) {
|
||||
// There will only be one record per lid
|
||||
|
@ -1173,7 +1172,7 @@ public class DataSourcesDlg extends CaveSWTDialog {
|
|||
seedData.setLid(lid);
|
||||
|
||||
try {
|
||||
ArrayList<TelemData> data = HydroDBDataManager.getInstance()
|
||||
java.util.List<TelemData> data = HydroDBDataManager.getInstance()
|
||||
.getData(seedData);
|
||||
|
||||
if (data.size() > 0) {
|
||||
|
@ -1258,8 +1257,8 @@ public class DataSourcesDlg extends CaveSWTDialog {
|
|||
emailTF.setText(obsData.getEmail());
|
||||
|
||||
// Date of service
|
||||
dosTF.setText(HydroDataUtils.getDisplayString(obsData
|
||||
.getDateOfService(), isoDate));
|
||||
dosTF.setText(HydroDataUtils.getDisplayString(
|
||||
obsData.getDateOfService(), isoDate));
|
||||
|
||||
// Phone Numbers
|
||||
homePhoneTF.setText(obsData.getHomePhone());
|
||||
|
@ -1389,8 +1388,7 @@ public class DataSourcesDlg extends CaveSWTDialog {
|
|||
} catch (ParseException e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Invalid Date");
|
||||
mb
|
||||
.setMessage("Please enter a Service Date in the form: YYYY-MM-DD");
|
||||
mb.setMessage("Please enter a Service Date in the form: YYYY-MM-DD");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.io.BufferedWriter;
|
|||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
|
@ -60,10 +59,7 @@ import org.eclipse.swt.widgets.Shell;
|
|||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
import com.raytheon.uf.common.dataquery.db.QueryResult;
|
||||
import com.raytheon.uf.viz.core.catalog.DirectDbQuery;
|
||||
import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.viz.hydrocommon.HydroConstants;
|
||||
import com.raytheon.viz.hydrocommon.data.FloodStatementData;
|
||||
import com.raytheon.viz.hydrocommon.data.LocationData;
|
||||
import com.raytheon.viz.hydrocommon.datamanager.HydroDBDataManager;
|
||||
|
@ -148,10 +144,11 @@ public class ImpactStatementDlg extends CaveSWTDialog {
|
|||
* Text editor control.
|
||||
*/
|
||||
private StyledText textEditor;
|
||||
|
||||
/**
|
||||
* text from the remark text box
|
||||
*/
|
||||
private String currentImpactText=null;
|
||||
private String currentImpactText = null;
|
||||
|
||||
/**
|
||||
* OK button.
|
||||
|
@ -201,7 +198,7 @@ public class ImpactStatementDlg extends CaveSWTDialog {
|
|||
/**
|
||||
* Cache of data for location
|
||||
*/
|
||||
private ArrayList<FloodStatementData> statementData;
|
||||
private java.util.List<FloodStatementData> statementData;
|
||||
|
||||
/**
|
||||
* Used by the print methods
|
||||
|
@ -224,8 +221,6 @@ public class ImpactStatementDlg extends CaveSWTDialog {
|
|||
|
||||
private int index, end;
|
||||
|
||||
private String tabs;
|
||||
|
||||
private StringBuffer wordBuffer;
|
||||
|
||||
private GC gc;
|
||||
|
@ -466,16 +461,15 @@ public class ImpactStatementDlg extends CaveSWTDialog {
|
|||
textEditor.setEditable(fullControl);
|
||||
textEditor.setWordWrap(true);
|
||||
textEditor.setTextLimit(512);
|
||||
currentImpactText=textEditor.getText();
|
||||
currentImpactText = textEditor.getText();
|
||||
ModifyListener listener = new ModifyListener() {
|
||||
public void modifyText(ModifyEvent e) {
|
||||
if (textEditor.getText().length()>512){
|
||||
textEditor.setText(currentImpactText);
|
||||
shell.getDisplay().beep();
|
||||
}
|
||||
else
|
||||
currentImpactText=textEditor.getText();
|
||||
}
|
||||
public void modifyText(ModifyEvent e) {
|
||||
if (textEditor.getText().length() > 512) {
|
||||
textEditor.setText(currentImpactText);
|
||||
shell.getDisplay().beep();
|
||||
} else
|
||||
currentImpactText = textEditor.getText();
|
||||
}
|
||||
};
|
||||
|
||||
textEditor.addModifyListener(listener);
|
||||
|
@ -628,39 +622,6 @@ public class ImpactStatementDlg extends CaveSWTDialog {
|
|||
return labelStr;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// Query the Floodstmt Table in the IHFS database using SQL.
|
||||
// ---------------------------------------------------------
|
||||
private void queryFloodstmt() {
|
||||
// ---------------------------------
|
||||
// Populate data list
|
||||
// ---------------------------------
|
||||
|
||||
String fmtStr = "%8S %13S %25S %11S %29S";
|
||||
String myQuery = "select * from floodstmt where lid = '" + lid + "'";
|
||||
|
||||
ArrayList<Object[]> data;
|
||||
try {
|
||||
data = (ArrayList<Object[]>) DirectDbQuery.executeQuery(myQuery,
|
||||
HydroConstants.IHFS, QueryLanguage.SQL);
|
||||
for (Object[] rowData : data) {
|
||||
String risingIndicator;
|
||||
if (rowData[3].toString().equals("R")) {
|
||||
risingIndicator = RISING;
|
||||
} else {
|
||||
risingIndicator = FALLING;
|
||||
}
|
||||
|
||||
String tmpStr = String.format(fmtStr, rowData[1].toString(),
|
||||
rowData[6].toString(), rowData[4].toString(),
|
||||
rowData[5].toString(), risingIndicator);
|
||||
dataList.add(tmpStr);
|
||||
}
|
||||
} catch (VizException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------
|
||||
// Populate characteristics of selected statement.
|
||||
// -----------------------------------------------
|
||||
|
@ -728,8 +689,8 @@ public class ImpactStatementDlg extends CaveSWTDialog {
|
|||
|
||||
return String.format(fmtStr, currStatement.getImpactValue(),
|
||||
currStatement.getImpactPE(), currStatement.getDateStart(),
|
||||
currStatement.getDateEnd(), (currStatement.getRiseFall()
|
||||
.equals("R")) ? RISING : FALLING);
|
||||
currStatement.getDateEnd(),
|
||||
(currStatement.getRiseFall().equals("R")) ? RISING : FALLING);
|
||||
}
|
||||
|
||||
private void clearInformation() {
|
||||
|
@ -774,8 +735,7 @@ public class ImpactStatementDlg extends CaveSWTDialog {
|
|||
} catch (VizException e) {
|
||||
mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Delete");
|
||||
mb
|
||||
.setMessage("An error occurred while trying to delete the record.");
|
||||
mb.setMessage("An error occurred while trying to delete the record.");
|
||||
mb.open();
|
||||
|
||||
e.printStackTrace();
|
||||
|
@ -830,9 +790,7 @@ public class ImpactStatementDlg extends CaveSWTDialog {
|
|||
+ endDayTF.getText();
|
||||
|
||||
try {
|
||||
newData
|
||||
.setDateEnd(dateFormat
|
||||
.format(dateFormat.parse(endDate)));
|
||||
newData.setDateEnd(dateFormat.format(dateFormat.parse(endDate)));
|
||||
} catch (Exception e) {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
|
@ -958,7 +916,7 @@ public class ImpactStatementDlg extends CaveSWTDialog {
|
|||
|
||||
LocationData seedData = new LocationData();
|
||||
seedData.setLid(lid);
|
||||
ArrayList<LocationData> locData = null;
|
||||
java.util.List<LocationData> locData = null;
|
||||
try {
|
||||
locData = HydroDBDataManager.getInstance().getData(seedData);
|
||||
} catch (VizException e) {
|
||||
|
@ -969,14 +927,13 @@ public class ImpactStatementDlg extends CaveSWTDialog {
|
|||
// Should only be one record for the LID
|
||||
LocationData currLoc = locData.get(0);
|
||||
|
||||
outputStr.append(String.format("%s %s - %s COUNTY, %s\n", currLoc
|
||||
.getLid(), currLoc.getName(), currLoc.getCounty(), currLoc
|
||||
.getState()));
|
||||
outputStr.append(String.format("%s %s - %s COUNTY, %s\n",
|
||||
currLoc.getLid(), currLoc.getName(), currLoc.getCounty(),
|
||||
currLoc.getState()));
|
||||
} else {
|
||||
outputStr
|
||||
.append(String
|
||||
.format(
|
||||
"The name, county, and state for station %s are not available.\n",
|
||||
.format("The name, county, and state for station %s are not available.\n",
|
||||
lid));
|
||||
}
|
||||
|
||||
|
@ -986,12 +943,12 @@ public class ImpactStatementDlg extends CaveSWTDialog {
|
|||
SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm");
|
||||
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
Date now = Calendar.getInstance(TimeZone.getTimeZone("GMT")).getTime();
|
||||
outputStr.append(String.format("GENERATED %s\n\n\n", dateFormat
|
||||
.format(now)));
|
||||
outputStr.append(String.format("GENERATED %s\n\n\n",
|
||||
dateFormat.format(now)));
|
||||
|
||||
for (FloodStatementData currStatement : statementData) {
|
||||
outputStr.append(String.format("IMPACT PE: %s ", currStatement
|
||||
.getImpactPE()));
|
||||
outputStr.append(String.format("IMPACT PE: %s ",
|
||||
currStatement.getImpactPE()));
|
||||
|
||||
if (currStatement.getImpactPE().equals("QR")) {
|
||||
outputStr.append(String.format("IMPACT VALUE: %9.2f CFS. ",
|
||||
|
@ -1217,8 +1174,7 @@ public class ImpactStatementDlg extends CaveSWTDialog {
|
|||
} else {
|
||||
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
|
||||
mb.setText("Unable to Save");
|
||||
mb
|
||||
.setMessage("Data for the location must be add via the River Gauge dialog first.");
|
||||
mb.setMessage("Data for the location must be add via the River Gauge dialog first.");
|
||||
mb.open();
|
||||
}
|
||||
} catch (VizException e) {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
**/
|
||||
package com.raytheon.viz.hydrocommon.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.dataquery.db.QueryResult;
|
||||
import com.raytheon.uf.common.dataquery.db.QueryResultRow;
|
||||
|
@ -42,6 +42,8 @@ import com.raytheon.viz.hydrocommon.datamanager.HydroDBDataManager;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 13, 2009 1802 askripsk Initial creation
|
||||
* Apr 18, 2013 1790 rferrel Cleanup method interfaces;
|
||||
* part of non-blocking dialogs.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -71,8 +73,8 @@ public class StnClassSyncUtil {
|
|||
TelemData telemSeedData = new TelemData();
|
||||
telemSeedData.setLid(lid);
|
||||
|
||||
ArrayList<TelemData> telemData = HydroDBDataManager.getInstance()
|
||||
.getData(telemSeedData);
|
||||
List<TelemData> telemData = HydroDBDataManager.getInstance().getData(
|
||||
telemSeedData);
|
||||
|
||||
int telemCount = telemData.size();
|
||||
if (telemCount != 0) {
|
||||
|
@ -156,7 +158,7 @@ public class StnClassSyncUtil {
|
|||
ingestSeedData.setWhereClause(" WHERE lid= '" + lid
|
||||
+ "' AND ingest= 'T'");
|
||||
|
||||
ArrayList<DataIngestFilterData> ingestFilterData = HydroDBDataManager
|
||||
List<DataIngestFilterData> ingestFilterData = HydroDBDataManager
|
||||
.getInstance().getData(ingestSeedData);
|
||||
|
||||
if (ingestFilterData.size() > 0) {
|
||||
|
@ -337,8 +339,8 @@ public class StnClassSyncUtil {
|
|||
* @return The number of PEs in the ingest filter list that starts with the
|
||||
* specified PE prefix.
|
||||
*/
|
||||
private static int getPECount(
|
||||
ArrayList<DataIngestFilterData> ingestFilterData, String currPE) {
|
||||
private static int getPECount(List<DataIngestFilterData> ingestFilterData,
|
||||
String currPE) {
|
||||
int peCount = 0;
|
||||
|
||||
for (DataIngestFilterData currFilter : ingestFilterData) {
|
||||
|
|
Loading…
Add table
Reference in a new issue