Issue #1578 Changes for non-blocking FilteringDlg and bug fix to TimeSeriesDlg.

Change-Id: Ib024fe2051d753c001bbd43079c629cc2cca8e9b

Former-commit-id: e0e27a3a0f [formerly a87fd5c9f6] [formerly 2c10f90df0] [formerly e0e27a3a0f [formerly a87fd5c9f6] [formerly 2c10f90df0] [formerly 0186ec3b68 [formerly 2c10f90df0 [formerly 1994880374ba0fcccedfde60bff6645acbafabae]]]]
Former-commit-id: 0186ec3b68
Former-commit-id: cfe1f28f17 [formerly 27339cbd7f] [formerly 5de58b070bbc6dae59fcade6741107c449d8280c [formerly 45d3bcb6e9]]
Former-commit-id: c2cc17bcfb1ec9c7235fa1d1f413180be9c90a51 [formerly 2fc55e62c5]
Former-commit-id: b221911a63
This commit is contained in:
Roger Ferrel 2013-02-07 11:11:29 -06:00
parent 8c527632b2
commit 91545e74a0
3 changed files with 120 additions and 51 deletions

View file

@ -34,6 +34,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.hydro.pointdatacontrol.data.PointControlPeTs; import com.raytheon.viz.hydro.pointdatacontrol.data.PointControlPeTs;
import com.raytheon.viz.hydro.pointdatacontrol.db.PDCDataManager; import com.raytheon.viz.hydro.pointdatacontrol.db.PDCDataManager;
@ -53,6 +56,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* 25 JAN 2011 7625 bkowal The dialog will now be a modal dialog * 25 JAN 2011 7625 bkowal The dialog will now be a modal dialog
* and it will include a title bar and * and it will include a title bar and
* close button. * close button.
* 07 FEB 2013 1578 rferrel Change for non-blocking dialog.
* *
* </pre> * </pre>
* *
@ -61,6 +65,10 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* *
*/ */
public class FilteringDlg extends CaveSWTDialog { public class FilteringDlg extends CaveSWTDialog {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(FilteringDlg.class);
/** Type sources to always include. */
private static final String[] HARD_CODED_TYPE_SOURCES = { "RG", "RP", "RM", private static final String[] HARD_CODED_TYPE_SOURCES = { "RG", "RP", "RM",
"RR", "RZ" }; "RR", "RZ" };
@ -122,7 +130,7 @@ public class FilteringDlg extends CaveSWTDialog {
*/ */
public FilteringDlg(Shell parent, String title, DialogType dialogType, public FilteringDlg(Shell parent, String title, DialogType dialogType,
String peSelection) { String peSelection) {
super(parent, SWT.DIALOG_TRIM | SWT.SYSTEM_MODAL); super(parent, SWT.DIALOG_TRIM | SWT.SYSTEM_MODAL, CAVE.DO_NOT_BLOCK);
setText(title); setText(title);
this.dialogType = dialogType; this.dialogType = dialogType;
@ -130,6 +138,11 @@ public class FilteringDlg extends CaveSWTDialog {
this.peSelection = peSelection; this.peSelection = peSelection;
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
*/
@Override @Override
protected Layout constructShellLayout() { protected Layout constructShellLayout() {
GridLayout mainLayout = new GridLayout(1, true); GridLayout mainLayout = new GridLayout(1, true);
@ -138,6 +151,13 @@ public class FilteringDlg extends CaveSWTDialog {
return mainLayout; return mainLayout;
} }
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
* .eclipse.swt.widgets.Shell)
*/
@Override @Override
protected void initializeComponents(Shell shell) { protected void initializeComponents(Shell shell) {
setReturnValue(false); setReturnValue(false);
@ -181,7 +201,7 @@ public class FilteringDlg extends CaveSWTDialog {
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
handleApply(); handleApply();
setReturnValue(true); setReturnValue(true);
shell.dispose(); close();
} }
}); });
@ -194,7 +214,7 @@ public class FilteringDlg extends CaveSWTDialog {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
setReturnValue(false); setReturnValue(false);
shell.dispose(); close();
} }
}); });
@ -367,9 +387,8 @@ public class FilteringDlg extends CaveSWTDialog {
ArrayList<String> tsList = new ArrayList<String>(); ArrayList<String> tsList = new ArrayList<String>();
// add all of the hard_coded_type_sources // add all of the hard_coded_type_sources
int i = 0; for (String ts : HARD_CODED_TYPE_SOURCES) {
for (i = 0; i < HARD_CODED_TYPE_SOURCES.length; i++) { tsList.add(ts);
tsList.add(HARD_CODED_TYPE_SOURCES[i]);
} }
if ((rs != null) && (rs.size() > 0)) { if ((rs != null) && (rs.size() > 0)) {
@ -429,7 +448,8 @@ public class FilteringDlg extends CaveSWTDialog {
} }
} }
} catch (VizException e) { } catch (VizException e) {
e.printStackTrace(); statusHandler.handle(Priority.PROBLEM, "Error populating list: "
+ e);
} }
} }

View file

@ -78,6 +78,7 @@ import com.raytheon.viz.hydrocommon.colorscalemgr.NamedColorSetGroup;
import com.raytheon.viz.hydrocommon.events.StationDisplayUpdateEvent; import com.raytheon.viz.hydrocommon.events.StationDisplayUpdateEvent;
import com.raytheon.viz.hydrocommon.pdc.PDCOptionData; import com.raytheon.viz.hydrocommon.pdc.PDCOptionData;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
/** /**
* This class displays the Point Data Control dialog for Hydroview. * This class displays the Point Data Control dialog for Hydroview.
@ -96,13 +97,15 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* The actionListeners for certain controls * The actionListeners for certain controls
* have been updated so that they will set it * have been updated so that they will set it
* to true when an update is actually required. * to true when an update is actually required.
* *
* 03 OCT 2012 #15395 Added code to handle TimeStep when default is set * 03 OCT 2012 #15395 Added code to handle TimeStep when default is set
* to be "30 minutes Instantaneous" in the database. * to be "30 minutes Instantaneous" in the database.
* 09 OCT 2012 #15396 Fixed Instantaneous precip index so legend and map display * 09 OCT 2012 #15396 Fixed Instantaneous precip index so legend and map display
* will change each time duration is incremented or decremented * will change each time duration is incremented or decremented
* for the "30 minutes Instantaneous" rainfall map . * for the "30 minutes Instantaneous" rainfall map .
* 04 Dec 2012 15602 wkwock Fix Hrs hour capped at 100. * 04 Dec 2012 15602 wkwock Fix Hrs hour capped at 100.
* 07 Feb 2013 1578 rferrel Changes for non-blocking FilteringDlg.
* (TODO More code clean up when this dialog is converted.)
* *
* </pre> * </pre>
* *
@ -166,6 +169,15 @@ public class PointDataControlDlg extends CaveSWTDialog {
// WIND // WIND
"WIND SPEED", "WIND DIRECTION" }; "WIND SPEED", "WIND DIRECTION" };
/** Filter dialog for Type/Source. */
private FilteringDlg typeSourceDlg;
/** Filter dialog for Service Area. */
private FilteringDlg serviceDlg;
/** Filter dialog for Data Source . */
private FilteringDlg dataSourceDlg;
/** /**
* The Stack Composite. * The Stack Composite.
*/ */
@ -606,10 +618,12 @@ public class PointDataControlDlg extends CaveSWTDialog {
timeTF.setText(dateTimeFmt.format(cal.getTime())); timeTF.setText(dateTimeFmt.format(cal.getTime()));
populatePresetData(null); populatePresetData(null);
/* this is when in the database, the timeStep is set to be the /*
default one */ * this is when in the database, the timeStep is set to be the default
* one
*/
if (timeStepRdo.getSelection() == true) { if (timeStepRdo.getSelection() == true) {
handleQueryModeSelection(PDCConstants.QueryMode.TIME_STEP_MODE); handleQueryModeSelection(PDCConstants.QueryMode.TIME_STEP_MODE);
previousQueryMode = PDCConstants.QueryMode.TIME_STEP_MODE; previousQueryMode = PDCConstants.QueryMode.TIME_STEP_MODE;
@ -874,18 +888,18 @@ public class PointDataControlDlg extends CaveSWTDialog {
upPrecipBtn.addSelectionListener(new SelectionAdapter() { upPrecipBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
PDCOptionData pcOptions = PDCOptionData.getInstance(); PDCOptionData pcOptions = PDCOptionData.getInstance();
if (precipIndex >= HydroConstants.InstPrecipSelection.values().length - 1) { if (precipIndex >= HydroConstants.InstPrecipSelection.values().length - 1) {
precipIndex = 0; precipIndex = 0;
} else { } else {
precipIndex++; precipIndex++;
if (precipIndex == HydroConstants.InstPrecipSelection. if (precipIndex == HydroConstants.InstPrecipSelection
values().length - 1) { .values().length - 1) {
precipIndex=0; precipIndex = 0;
} }
} }
pcOptions.setInstPrecipAccumTimeSelection(precipIndex); pcOptions.setInstPrecipAccumTimeSelection(precipIndex);
setInstPrecipAccumText(); setInstPrecipAccumText();
shell.setCursor(waitCursor); shell.setCursor(waitCursor);
updateData = true; updateData = true;
@ -899,20 +913,19 @@ public class PointDataControlDlg extends CaveSWTDialog {
downPrecipBtn.addSelectionListener(new SelectionAdapter() { downPrecipBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
PDCOptionData pcOptions = PDCOptionData.getInstance(); PDCOptionData pcOptions = PDCOptionData.getInstance();
if (precipIndex == 0) { if (precipIndex == 0) {
precipIndex = HydroConstants.InstPrecipSelection. precipIndex = HydroConstants.InstPrecipSelection.values().length - 1;
values().length - 1; if (precipIndex == HydroConstants.InstPrecipSelection
if (precipIndex == HydroConstants.InstPrecipSelection. .values().length - 1) {
values().length - 1) { precipIndex = HydroConstants.InstPrecipSelection
precipIndex=HydroConstants.InstPrecipSelection. .values().length - 2;
values().length - 2; }
}
} else { } else {
precipIndex--; precipIndex--;
} }
pcOptions.setInstPrecipAccumTimeSelection(precipIndex); pcOptions.setInstPrecipAccumTimeSelection(precipIndex);
setInstPrecipAccumText(); setInstPrecipAccumText();
shell.setCursor(waitCursor); shell.setCursor(waitCursor);
@ -1117,17 +1130,21 @@ public class PointDataControlDlg extends CaveSWTDialog {
typeSourceBtn.addSelectionListener(new SelectionAdapter() { typeSourceBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
FilteringDlg typeSourceDlg = new FilteringDlg(shell, if (typeSourceDlg == null) {
"Type Source Selection Dialog", typeSourceDlg = new FilteringDlg(shell,
FilteringDlg.DialogType.TYPE_SOURCE, "Type Source Selection Dialog",
physicalElementCbo.getItem(physicalElementCbo FilteringDlg.DialogType.TYPE_SOURCE,
.getSelectionIndex())); physicalElementCbo.getItem(physicalElementCbo
boolean redraw = (Boolean) typeSourceDlg.open(); .getSelectionIndex()));
if (redraw) { typeSourceDlg.setCloseCallback(new ICloseCallback() {
shell.setCursor(waitCursor);
drawMap(); @Override
shell.setCursor(arrowCursor); public void dialogClosed(Object returnValue) {
redrawCheck(returnValue);
}
});
} }
typeSourceDlg.open();
} }
}); });
@ -1188,14 +1205,18 @@ public class PointDataControlDlg extends CaveSWTDialog {
serviceAreaBtn.addSelectionListener(new SelectionAdapter() { serviceAreaBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
FilteringDlg serviceDlg = new FilteringDlg(shell, if (serviceDlg == null) {
"Service Area", FilteringDlg.DialogType.SERVICE_AREA); serviceDlg = new FilteringDlg(shell, "Service Area",
boolean redraw = (Boolean) serviceDlg.open(); FilteringDlg.DialogType.SERVICE_AREA);
if (redraw) { serviceDlg.setCloseCallback(new ICloseCallback() {
shell.setCursor(waitCursor);
drawMap(); @Override
shell.setCursor(arrowCursor); public void dialogClosed(Object returnValue) {
redrawCheck(returnValue);
}
});
} }
serviceDlg.open();
} }
}); });
@ -1225,14 +1246,18 @@ public class PointDataControlDlg extends CaveSWTDialog {
dataSourceBtn.addSelectionListener(new SelectionAdapter() { dataSourceBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
FilteringDlg dataSourceDlg = new FilteringDlg(shell, if (dataSourceDlg == null) {
"Data Source", FilteringDlg.DialogType.DATA_SOURCE); dataSourceDlg = new FilteringDlg(shell, "Data Source",
boolean redraw = (Boolean) dataSourceDlg.open(); FilteringDlg.DialogType.DATA_SOURCE);
if (redraw) { dataSourceDlg.setCloseCallback(new ICloseCallback() {
shell.setCursor(waitCursor);
drawMap(); @Override
shell.setCursor(arrowCursor); public void dialogClosed(Object returnValue) {
redrawCheck(returnValue);
}
});
} }
dataSourceDlg.open();
} }
}); });
@ -2891,6 +2916,23 @@ public class PointDataControlDlg extends CaveSWTDialog {
return mode; return mode;
} }
/**
* Determine if a redraw needs to be performed.
*
* @param returnValue
* - return value from the Filtering dialog.
*/
private void redrawCheck(Object returnValue) {
if (returnValue instanceof Boolean) {
boolean redraw = (Boolean) returnValue;
if (redraw) {
shell.setCursor(waitCursor);
drawMap();
shell.setCursor(arrowCursor);
}
}
}
/** /**
* Set the Instantaneous precip accum time option. * Set the Instantaneous precip accum time option.
*/ */

View file

@ -989,6 +989,7 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
stnLayoutDisplayed = true; stnLayoutDisplayed = true;
} }
prevModeIdx = modeCbo.getSelectionIndex(); prevModeIdx = modeCbo.getSelectionIndex();
checkBottomButtons();
} }
} }
}); });
@ -1487,7 +1488,13 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
* Update the enable status of the bottom buttons. * Update the enable status of the bottom buttons.
*/ */
private void checkBottomButtons() { private void checkBottomButtons() {
boolean enabled = topDataList.getSelectionIndex() >= 0; boolean enabled = false;
if (modeCbo.getText().equals(PREDEFINED_GROUP)) {
enabled = true;
} else {
enabled = topDataList.getSelectionCount() > 0;
}
graphButton.setEnabled(enabled); graphButton.setEnabled(enabled);
tableButton.setEnabled(enabled); tableButton.setEnabled(enabled);
bothButton.setEnabled(enabled); bothButton.setEnabled(enabled);