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