From 273f68e6bf1d6a6dcf4c0bde43cac0ef992c3062 Mon Sep 17 00:00:00 2001 From: Roger Ferrel Date: Thu, 15 Nov 2012 15:51:46 -0600 Subject: [PATCH] Issue #1298 Changes for non-blocking GhgAlertDlg. Change-Id: I1da7317ad69203a4160c806458fdbf99a7d9108d Former-commit-id: 7811b443766211bca371d9b2307f1d14ac06e985 [formerly b66bc0210abfe18cdf71139881136ee12c38af30] [formerly 800c1a69087c64856c212030ded9ca64c0724a9c] [formerly c0554d9686a66b285f3de01105ef036c2e698600 [formerly 800c1a69087c64856c212030ded9ca64c0724a9c [formerly b3c640da3fad8d1ce07e348b075b9b1a0468da37]]] Former-commit-id: c0554d9686a66b285f3de01105ef036c2e698600 Former-commit-id: f1224ad7a9ab994434fec5a5c2870efc11e20f61 [formerly 05f32527bd2e4fa152b7d95124a56c61a13eff68] Former-commit-id: 0a113321933eca365993dffea2ffa854216a8d5d --- .../raytheon/viz/ghg/monitor/GhgAlertDlg.java | 27 ++++++++++++------ .../viz/ghg/monitor/GhgMonitorDlg.java | 28 ++++++++++++++----- 2 files changed, 39 insertions(+), 16 deletions(-) diff --git a/cave/com.raytheon.viz.ghg/src/com/raytheon/viz/ghg/monitor/GhgAlertDlg.java b/cave/com.raytheon.viz.ghg/src/com/raytheon/viz/ghg/monitor/GhgAlertDlg.java index 7439b23936..40cb924411 100644 --- a/cave/com.raytheon.viz.ghg/src/com/raytheon/viz/ghg/monitor/GhgAlertDlg.java +++ b/cave/com.raytheon.viz.ghg/src/com/raytheon/viz/ghg/monitor/GhgAlertDlg.java @@ -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. * * * @@ -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(); } }); } diff --git a/cave/com.raytheon.viz.ghg/src/com/raytheon/viz/ghg/monitor/GhgMonitorDlg.java b/cave/com.raytheon.viz.ghg/src/com/raytheon/viz/ghg/monitor/GhgMonitorDlg.java index 3ad39a4dee..d32264bb5f 100644 --- a/cave/com.raytheon.viz.ghg/src/com/raytheon/viz/ghg/monitor/GhgMonitorDlg.java +++ b/cave/com.raytheon.viz.ghg/src/com/raytheon/viz/ghg/monitor/GhgMonitorDlg.java @@ -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. * * * @@ -124,6 +126,8 @@ public class GhgMonitorDlg extends CaveSWTDialog implements private static final Map 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() { - GhgConfigData configuration = GhgConfigData.getInstance(); - GhgAlertDlg alertDlg = new GhgAlertDlg(getShell()); - alertDlg.setAlerts(configuration.getAlerts()); - GhgAlertsConfigData rtnAlerts = (GhgAlertsConfigData) alertDlg.open(); + if (alertDlg == null) { + GhgConfigData configuration = GhgConfigData.getInstance(); + alertDlg = new GhgAlertDlg(getShell()); + alertDlg.setAlerts(configuration.getAlerts()); + alertDlg.setCloseCallback(new ICloseCallback() { - // null is returned if the dialog is canceled - if (rtnAlerts != null) { - configuration.setAlerts(rtnAlerts); + @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(); } /**