From 423099eb56d132f0643b0d0d3dcc50cd74a76486 Mon Sep 17 00:00:00 2001 From: Roger Ferrel Date: Tue, 9 Oct 2012 13:22:19 -0500 Subject: [PATCH] Issue #1229 Changes for non-blocking TafMonitorDlg. Reviewer comment changes. Change-Id: I54540db43041a837281e6abc3680ed8a22c38fce Former-commit-id: c684feebc7c80dc7b2f0e23c95dbab6efcc2f797 --- .../raytheon/viz/aviation/AviationDialog.java | 48 ++++++++++++------- .../viz/aviation/observer/TafMonitorDlg.java | 3 +- 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AviationDialog.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AviationDialog.java index 96d690a3a4..80c9406223 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AviationDialog.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AviationDialog.java @@ -95,6 +95,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback; * 8/31/2011 10837 rferrel Added checks to see if the avnImage * file exists. * 10/02/2012 1229 rferrel Made dialog non-blocking. + * 10/09/2012 1229 rferrel Changes for non-blocking TafMonitorDlg. * * * @@ -356,7 +357,7 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart { loadTafSiteConfig(); displayTafMonitorDialog(); } else { - tafMonitorDlg.showDialog(); + tafMonitorDlg.bringToTop(); } } }); @@ -585,7 +586,12 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart { */ @Override public void restartTafMonitor() { + // This prevents tafMonitorDlg from closing this shell when closing the + // TaMonitorDlg prior to the restart. + dlgCount.incrementAndGet(); if (tafMonitorDlg.closeDisplay() == false) { + // adjust the count. + dlgCount.decrementAndGet(); return; } @@ -618,7 +624,12 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart { } if (!emptyStationList) { + // This prevents tafMonitorDlg from closing this shell when closing + // the TaMonitorDlg prior to the restart. + dlgCount.incrementAndGet(); if (tafMonitorDlg.closeDisplay() == false) { + // adjust the count. + dlgCount.decrementAndGet(); return; } @@ -655,22 +666,25 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart { "Error no stations configured for " + product); } } else { - tafMonitorDlg = new TafMonitorDlg(shell, stationList, - productDisplayList); - tafMonitorDlg.open(); - tafMonitorDlg = null; + if (tafMonitorDlg == null || tafMonitorDlg.getShell() == null + || tafMonitorDlg.isDisposed()) { + tafMonitorDlg = new TafMonitorDlg(shell, stationList, + productDisplayList); + tafMonitorDlg.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + tafMonitorDlg = null; + if (dlgCount.decrementAndGet() == 0 + && !productDisplayList.isEmpty()) { + shell.dispose(); + } + } + }); + tafMonitorDlg.open(); + } else { + tafMonitorDlg.bringToTop(); + } } - - if (dlgCount.decrementAndGet() == 0 && !productDisplayList.isEmpty()) { - shell.dispose(); - } - } - - public void setFocus() { - shell.setFocus(); - } - - public void setVisible(boolean visible) { - shell.setVisible(visible); } } diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/observer/TafMonitorDlg.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/observer/TafMonitorDlg.java index 70263dec17..544dc3569d 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/observer/TafMonitorDlg.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/observer/TafMonitorDlg.java @@ -132,6 +132,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback; * 20JUL2012 14570 gzhang/zhao Added methods for highlighting in TAF viewer * 10/02/2012 1229 rferrel Changes to work with non-blocking WeatherPlotDialog. * 10/04/2012 1229 rferrel Changes for non-blocking ClimateMenuDlg. + * 10/09/2012 1229 rferrel Made dialog non-blocking. * * * @@ -252,7 +253,7 @@ public class TafMonitorDlg extends CaveSWTDialog { List productDispalyList) { super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.PERSPECTIVE_INDEPENDENT | CAVE.MODE_INDEPENDENT - | CAVE.INDEPENDENT_SHELL); + | CAVE.INDEPENDENT_SHELL | CAVE.DO_NOT_BLOCK); setText("AvnFPS Monitor"); this.stationList = stationList;