Issue #1229 Change for non-blocking ClimateMenuDlg.

Code review changes.

Change-Id: Id926af90436c06f20a6d2f607c70b96a4917f828

Former-commit-id: b5f18d1e559a5016dcc4a4e9e409f2f8642ccd32
This commit is contained in:
Roger Ferrel 2012-10-04 16:15:55 -05:00
parent d0c760764f
commit 6cb6860600
3 changed files with 28 additions and 11 deletions

View file

@ -63,6 +63,7 @@ import com.raytheon.viz.avnconfig.AvnConfigFileUtil;
import com.raytheon.viz.avnconfig.ITafSiteConfig;
import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
/**
* The Aviation Dialog class that displays the start up menu for AvnFPS.
@ -356,8 +357,8 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart {
@Override
public void widgetSelected(SelectionEvent event) {
shell.setVisible(false);
if (climateMenuDlg == null
|| climateMenuDlg.getShell().isDisposed()) {
if (climateMenuDlg == null || climateMenuDlg.getShell() == null
|| climateMenuDlg.isDisposed()) {
// Create an array of message types
StatusMessageType[] msgTypes = new StatusMessageType[4];
msgTypes[0] = StatusMessageType.Metar;
@ -368,13 +369,19 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart {
// Create the climate menu dialog.
dlgCount.incrementAndGet();
climateMenuDlg = new ClimateMenuDlg(shell, msgTypes, null);
climateMenuDlg.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
climateMenuDlg = null;
if (dlgCount.decrementAndGet() == 0) {
shell.dispose();
}
}
});
climateMenuDlg.open();
climateMenuDlg = null;
if (dlgCount.decrementAndGet() == 0) {
shell.dispose();
}
} else {
climateMenuDlg.showDialog();
climateMenuDlg.bringToTop();
}
}
});

View file

@ -66,6 +66,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* in initializeComponents
* 10/12/2010 6009 rferrel Code clean up from making TafSiteConfig
* a singleton
* 10/04/2012 1129 rferrel Made non-blocking.
*
* </pre>
*
@ -114,7 +115,8 @@ public class ClimateMenuDlg extends CaveSWTDialog {
*/
public ClimateMenuDlg(Shell parent, StatusMessageType[] statusMsgTypes,
RGB statusCompRGB) {
super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT);
super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT
| CAVE.DO_NOT_BLOCK);
setText("AvnFPS Climate Menu");
this.statusMsgTypes = statusMsgTypes;

View file

@ -131,6 +131,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* 11/29/2011 11612 rferrel Added observers to update viewer tabs.
* 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.
*
* </pre>
*
@ -237,6 +238,8 @@ public class TafMonitorDlg extends CaveSWTDialog {
private List<String> productDisplayList;
private ClimateMenuDlg climateMenuDlg;
/**
* Constructor.
*
@ -619,9 +622,14 @@ public class TafMonitorDlg extends CaveSWTDialog {
msgTypes[2] = StatusMessageType.TafMonCigVis;
msgTypes[3] = StatusMessageType.TafMonCigVisTrend;
ClimateMenuDlg climateMenuDlg = new ClimateMenuDlg(shell,
msgTypes, configMgr.getDefaultBackgroundRGB());
climateMenuDlg.open();
if (climateMenuDlg == null || climateMenuDlg.getShell() == null
|| climateMenuDlg.isDisposed()) {
climateMenuDlg = new ClimateMenuDlg(shell, msgTypes,
configMgr.getDefaultBackgroundRGB());
climateMenuDlg.open();
} else {
climateMenuDlg.bringToTop();
}
}
});