Issue #1229 changes for non-blocking MonitoringCriteriaDlg, TafProductConfigDlg and TafSiteInfoEditorDlg.

Change-Id: If726affda56d435cc15506dcd3a5439f7f476e35

Former-commit-id: aba33acea4 [formerly f76e6d3eae] [formerly efb13c2b94] [formerly aba33acea4 [formerly f76e6d3eae] [formerly efb13c2b94] [formerly 42c7ef3ef6 [formerly efb13c2b94 [formerly 9e039290f43cff3faae208a39286c99e83978e17]]]]
Former-commit-id: 42c7ef3ef6
Former-commit-id: 6454410868 [formerly 62b6f1cf38] [formerly 399ccfccf8ad4b7847f84cd8675594ec3c4fc718 [formerly 901fc10336]]
Former-commit-id: 6c6c5da8460caa71eccff4964f71277d39809561 [formerly e72f086cbc]
Former-commit-id: ed06158d02
This commit is contained in:
Roger Ferrel 2012-10-12 14:11:16 -05:00
parent ea34a3896f
commit c7792e5517
4 changed files with 48 additions and 116 deletions

View file

@ -56,6 +56,9 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* 04 OCT 2012 1229 rferrel Work with non-blocking ClimateDataMenuDlg. * 04 OCT 2012 1229 rferrel Work with non-blocking ClimateDataMenuDlg.
* 08 Oct 2012 1229 rferrel Make sub-class of CaveSWTDialog and * 08 Oct 2012 1229 rferrel Make sub-class of CaveSWTDialog and
* make non-blocking. * make non-blocking.
* 11 Oct 2012 1229 rferrel Changes for non-blocking MonitoringCriteriaDlg.
* 12 Oct 2012 1229 rferrel Changes for non-blocking TafProductConfigDlg.
* 12 Oct 2012 1229 rferrel Changes for non-blocking TafSiteInfoEditorDlg.
* *
* </pre> * </pre>
* *
@ -277,14 +280,11 @@ public class AvnconfigDlg extends CaveSWTDialog {
monitorRulesBtn.addSelectionListener(new SelectionAdapter() { monitorRulesBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
if (monCriteriaDlg == null if (mustCreate(monCriteriaDlg)) {
|| monCriteriaDlg.getParent().isDisposed()) {
monCriteriaDlg = new MonitoringCriteriaDlg(shell); monCriteriaDlg = new MonitoringCriteriaDlg(shell);
monCriteriaDlg.open(); monCriteriaDlg.open();
monCriteriaDlg = null;
} else { } else {
monCriteriaDlg.getParent().forceActive(); monCriteriaDlg.bringToTop();
monCriteriaDlg.getParent().forceFocus();
} }
} }
}); });
@ -296,13 +296,11 @@ public class AvnconfigDlg extends CaveSWTDialog {
tafSiteInfoBtn.addSelectionListener(new SelectionAdapter() { tafSiteInfoBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
if (siteInfoDlg == null || siteInfoDlg.getParent().isDisposed()) { if (mustCreate(siteInfoDlg)) {
siteInfoDlg = new TafSiteInfoEditorDlg(shell); siteInfoDlg = new TafSiteInfoEditorDlg(shell);
siteInfoDlg.open(); siteInfoDlg.open();
siteInfoDlg = null;
} else { } else {
siteInfoDlg.getParent().forceActive(); siteInfoDlg.bringToTop();
siteInfoDlg.getParent().forceFocus();
} }
} }
}); });
@ -314,13 +312,11 @@ public class AvnconfigDlg extends CaveSWTDialog {
tafProductsBtn.addSelectionListener(new SelectionAdapter() { tafProductsBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
if (productsDlg == null || productsDlg.getParent().isDisposed()) { if (mustCreate(productsDlg)) {
productsDlg = new TafProductConfigDlg(shell); productsDlg = new TafProductConfigDlg(shell);
productsDlg.open(); productsDlg.open();
productsDlg = null;
} else { } else {
productsDlg.getParent().forceActive(); productsDlg.bringToTop();
productsDlg.getParent().forceFocus();
} }
} }
}); });

View file

@ -35,8 +35,6 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder; import org.eclipse.swt.widgets.TabFolder;
@ -46,6 +44,7 @@ import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.common.localization.exception.LocalizationException; import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType; import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType;
import com.raytheon.viz.avnconfig.AvnConfigConstants.DataSource; import com.raytheon.viz.avnconfig.AvnConfigConstants.DataSource;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
/** /**
* Dialog displaying the monitoring criteria controls. The dialog has a tab * Dialog displaying the monitoring criteria controls. The dialog has a tab
@ -59,6 +58,8 @@ import com.raytheon.viz.avnconfig.AvnConfigConstants.DataSource;
* 16 Mar 2011 8599 rferrel Create msgStatusComp then load tabs. * 16 Mar 2011 8599 rferrel Create msgStatusComp then load tabs.
* 27 Sep 2011 10958 rferrel Display more details when handling * 27 Sep 2011 10958 rferrel Display more details when handling
* ConfigurationException. * ConfigurationException.
* 12 Oct 2012 1229 rferrel Convert to subclass of CaveSWTDialog
* and made non-blocking.
* *
* </pre> * </pre>
* *
@ -66,16 +67,7 @@ import com.raytheon.viz.avnconfig.AvnConfigConstants.DataSource;
* @version 1.0 * @version 1.0
* *
*/ */
public class MonitoringCriteriaDlg extends Dialog { public class MonitoringCriteriaDlg extends CaveSWTDialog {
/**
* Dialog shell.
*/
private Shell shell;
/**
* The display control.
*/
private Display display;
/** /**
* Composite containing message status controls. * Composite containing message status controls.
@ -115,20 +107,12 @@ public class MonitoringCriteriaDlg extends Dialog {
* Parent shell. * Parent shell.
*/ */
public MonitoringCriteriaDlg(Shell parent) { public MonitoringCriteriaDlg(Shell parent) {
super(parent, 0); super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
setText("AvnFPS Monitoring Criteria");
} }
/** @Override
* Open method used to display the dialog. protected void initializeComponents(Shell shell) {
*
* @return Null.
*/
public Object open() {
Shell parent = getParent();
display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM);
shell.setText("AvnFPS Monitoring Criteria");
// Create the main layout for the shell. // Create the main layout for the shell.
GridLayout mainLayout = new GridLayout(1, false); GridLayout mainLayout = new GridLayout(1, false);
mainLayout.marginHeight = 3; mainLayout.marginHeight = 3;
@ -138,17 +122,6 @@ public class MonitoringCriteriaDlg extends Dialog {
// Initialize all of the controls and layouts // Initialize all of the controls and layouts
initializeComponents(); initializeComponents();
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return null;
} }
/** /**

View file

@ -36,7 +36,6 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
@ -55,6 +54,7 @@ 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.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType; import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
/** /**
* TAF product configuration dialog. * TAF product configuration dialog.
@ -66,6 +66,8 @@ import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType;
* 22 MAY 2008 1119 lvenable Initial creation * 22 MAY 2008 1119 lvenable Initial creation
* 9 Jul 2010 5078 rferrel Added catches for File Not Found. * 9 Jul 2010 5078 rferrel Added catches for File Not Found.
* 1 Oct 2010 4345 rferrel Cleanup to work like AWIPS I. * 1 Oct 2010 4345 rferrel Cleanup to work like AWIPS I.
* 12 Oct 2012 1229 rferrel Convert to CaveSWTDialog subclass
* and make non-blocking.
* *
* </pre> * </pre>
* *
@ -73,20 +75,10 @@ import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType;
* @version 1.0 * @version 1.0
* *
*/ */
public class TafProductConfigDlg extends Dialog { public class TafProductConfigDlg extends CaveSWTDialog {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(TafProductConfigDlg.class); .getHandler(TafProductConfigDlg.class);
/**
* Dialog shell.
*/
private Shell shell;
/**
* The display control.
*/
private Display display;
/** /**
* Composite containing message status controls. * Composite containing message status controls.
*/ */
@ -138,20 +130,12 @@ public class TafProductConfigDlg extends Dialog {
* @param parent * @param parent
*/ */
public TafProductConfigDlg(Shell parent) { public TafProductConfigDlg(Shell parent) {
super(parent, 0); super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK);
setText("AvnFPS TAF Product Configuration");
} }
/** @Override
* Open method used to display the dialog. protected void initializeComponents(Shell shell) {
*
* @return Null.
*/
public Object open() {
Shell parent = getParent();
display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE);
shell.setText("AvnFPS TAF Product Configuration");
// Create the main layout for the shell. // Create the main layout for the shell.
GridLayout mainLayout = new GridLayout(1, false); GridLayout mainLayout = new GridLayout(1, false);
mainLayout.marginHeight = 3; mainLayout.marginHeight = 3;
@ -161,25 +145,18 @@ public class TafProductConfigDlg extends Dialog {
// Initialize all of the controls and layouts // Initialize all of the controls and layouts
initializeComponents(); initializeComponents();
}
shell.pack(); @Override
protected void disposed() {
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
listFont.dispose(); listFont.dispose();
return null;
} }
/** /**
* Initialize the components on the display. * Initialize the components on the display.
*/ */
private void initializeComponents() { private void initializeComponents() {
Display display = getParent().getDisplay();
listFont = new Font(display, "Monospace", 10, SWT.NORMAL); listFont = new Font(display, "Monospace", 10, SWT.NORMAL);
createBottomMessageControls(); createBottomMessageControls();

View file

@ -39,7 +39,6 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
@ -63,6 +62,7 @@ import com.raytheon.uf.viz.core.comm.Loader;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType; import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.vividsolutions.jts.geom.Point; import com.vividsolutions.jts.geom.Point;
/** /**
@ -78,6 +78,8 @@ import com.vividsolutions.jts.geom.Point;
* Make and Edit buttons to work. * Make and Edit buttons to work.
* 10 Dec 2010 7662 rferrel Create and use getObStation. * 10 Dec 2010 7662 rferrel Create and use getObStation.
* 9 May 2011 8856 rferrel Code cleanup * 9 May 2011 8856 rferrel Code cleanup
* 12 Oct 2012 1229 rferrel Now a subclass of CaveSWTDialog
* and made non-blocking.
* *
* </pre> * </pre>
* *
@ -85,7 +87,7 @@ import com.vividsolutions.jts.geom.Point;
* @version 1.0 * @version 1.0
* *
*/ */
public class TafSiteInfoEditorDlg extends Dialog { public class TafSiteInfoEditorDlg extends CaveSWTDialog {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(TafSiteInfoEditorDlg.class); .getHandler(TafSiteInfoEditorDlg.class);
@ -94,16 +96,6 @@ public class TafSiteInfoEditorDlg extends Dialog {
*/ */
private final static String[] START_HOURS = { "00", "06", "12", "18" }; private final static String[] START_HOURS = { "00", "06", "12", "18" };
/**
* Dialog shell.
*/
private Shell shell;
/**
* The display control.
*/
private Display display;
/** /**
* Composite containing message status controls. * Composite containing message status controls.
*/ */
@ -248,19 +240,12 @@ public class TafSiteInfoEditorDlg extends Dialog {
* Parent shell. * Parent shell.
*/ */
public TafSiteInfoEditorDlg(Shell parent) { public TafSiteInfoEditorDlg(Shell parent) {
super(parent, 0); super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
setText("AvnFPS TAF Site Info Editor");
} }
/** @Override
* Open method used to display the dialog. protected void initializeComponents(Shell shell) {
*
* @return Null.
*/
public Object open() {
Shell parent = getParent();
display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM);
shell.setText("AvnFPS TAF Site Info Editor");
// Create the main layout for the shell. // Create the main layout for the shell.
GridLayout mainLayout = new GridLayout(1, false); GridLayout mainLayout = new GridLayout(1, false);
@ -271,25 +256,25 @@ public class TafSiteInfoEditorDlg extends Dialog {
// Initialize all of the controls and layouts // Initialize all of the controls and layouts
initializeComponents(); initializeComponents();
}
shell.pack(); @Override
protected void disposed() {
shell.open(); if (incorrectColor != null) {
while (!shell.isDisposed()) { incorrectColor.dispose();
if (!display.readAndDispatch()) {
display.sleep();
}
} }
incorrectColor.dispose(); if (correctColor != null) {
correctColor.dispose();
return null; }
} }
/** /**
* Initialize the components on the display. * Initialize the components on the display.
*/ */
private void initializeComponents() { private void initializeComponents() {
Display display = getParent().getDisplay();
incorrectColor = new Color(display, new RGB(255, 215, 220)); incorrectColor = new Color(display, new RGB(255, 215, 220));
createTopControls(); createTopControls();
@ -1109,6 +1094,7 @@ public class TafSiteInfoEditorDlg extends Dialog {
* @return boolean - True if all the data is valid. * @return boolean - True if all the data is valid.
*/ */
private boolean validateData() { private boolean validateData() {
Display display = getParent().getDisplay();
boolean isValid = true; boolean isValid = true;
correctColor = new Color(display, new RGB(255, 255, 255)); correctColor = new Color(display, new RGB(255, 255, 255));