Issue #1298 Changes for non-blocking GhgAlertDlg.

Change-Id: I1da7317ad69203a4160c806458fdbf99a7d9108d

Former-commit-id: 7811b44376 [formerly b66bc0210a] [formerly 800c1a6908] [formerly c0554d9686 [formerly 800c1a6908 [formerly b3c640da3fad8d1ce07e348b075b9b1a0468da37]]]
Former-commit-id: c0554d9686
Former-commit-id: f1224ad7a9ab994434fec5a5c2870efc11e20f61 [formerly 05f32527bd]
Former-commit-id: 0a11332193
This commit is contained in:
Roger Ferrel 2012-11-15 15:51:46 -06:00
parent 76d9479fb9
commit 273f68e6bf
2 changed files with 39 additions and 16 deletions

View file

@ -47,6 +47,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 25 MAR 2008 N/A lvenable Initial creation
* 15 NOV 2012 1298 rferrel Changes for non-blocking dialog.
*
* </pre>
*
@ -104,10 +105,15 @@ public class GhgAlertDlg extends CaveSWTDialog {
* Parent Shell.
*/
public GhgAlertDlg(Shell parent) {
super(parent);
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
setText("GHG Monitor Alert Dialog");
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
*/
@Override
protected Layout constructShellLayout() {
// Create the main layout for the shell.
@ -118,11 +124,13 @@ public class GhgAlertDlg extends CaveSWTDialog {
return mainLayout;
}
@Override
protected void disposed() {
setReturnValue(alerts);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
* .eclipse.swt.widgets.Shell)
*/
@Override
protected void initializeComponents(Shell shell) {
// Initialize all of the controls and layouts
@ -264,7 +272,8 @@ public class GhgAlertDlg extends CaveSWTDialog {
@Override
public void widgetSelected(SelectionEvent event) {
updateAlertingValues();
shell.dispose();
setReturnValue(alerts);
close();
}
});
@ -275,8 +284,8 @@ public class GhgAlertDlg extends CaveSWTDialog {
cancelBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
alerts = null;
shell.dispose();
setReturnValue(null);
close();
}
});
}

View file

@ -90,6 +90,7 @@ import com.raytheon.viz.ghg.monitor.filter.GhgFilterEngine;
import com.raytheon.viz.ghg.monitor.listener.GhgMonitorFilterChangeListener;
import com.raytheon.viz.ghg.monitor.listener.GhgMonitorZoneSelectionListener;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
import com.raytheon.viz.ui.statusline.EdgeLayout;
import com.raytheon.viz.ui.statusline.EdgeLayout.EdgeLayoutData;
import com.raytheon.viz.ui.statusline.EdgeLayout.EdgeLayoutData.EdgeAffinity;
@ -109,6 +110,7 @@ import com.raytheon.viz.ui.statusline.StatusStore;
* 25 MAR 2008 N/A lvenable Initial creation
* 17Jun2008 1157 MW Fegan Pass configuration to sub-dialogs.
* 15 Nov 2012 1298 rferrel Changes for non-blocking dialog.
* Changes for non-blocking GhgAlertDlg.
*
* </pre>
*
@ -124,6 +126,8 @@ public class GhgMonitorDlg extends CaveSWTDialog implements
private static final Map<String, GhgConfigData.DataEnum> labelToEnumMap;
private GhgAlertDlg alertDlg;
/**
* Active group one string.
*/
@ -1082,15 +1086,25 @@ public class GhgMonitorDlg extends CaveSWTDialog implements
* Display the Define Alerts dialog.
*/
private void showDefineAlertsDialog() {
if (alertDlg == null) {
GhgConfigData configuration = GhgConfigData.getInstance();
GhgAlertDlg alertDlg = new GhgAlertDlg(getShell());
alertDlg = new GhgAlertDlg(getShell());
alertDlg.setAlerts(configuration.getAlerts());
GhgAlertsConfigData rtnAlerts = (GhgAlertsConfigData) alertDlg.open();
alertDlg.setCloseCallback(new ICloseCallback() {
// null is returned if the dialog is canceled
if (rtnAlerts != null) {
@Override
public void dialogClosed(Object returnValue) {
if (returnValue instanceof GhgAlertsConfigData) {
GhgAlertsConfigData rtnAlerts = (GhgAlertsConfigData) returnValue;
GhgConfigData configuration = GhgConfigData
.getInstance();
configuration.setAlerts(rtnAlerts);
}
alertDlg = null;
}
});
}
alertDlg.open();
}
/**