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.
* 08 Oct 2012 1229 rferrel Make sub-class of CaveSWTDialog and
* 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>
*
@ -277,14 +280,11 @@ public class AvnconfigDlg extends CaveSWTDialog {
monitorRulesBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
if (monCriteriaDlg == null
|| monCriteriaDlg.getParent().isDisposed()) {
if (mustCreate(monCriteriaDlg)) {
monCriteriaDlg = new MonitoringCriteriaDlg(shell);
monCriteriaDlg.open();
monCriteriaDlg = null;
} else {
monCriteriaDlg.getParent().forceActive();
monCriteriaDlg.getParent().forceFocus();
monCriteriaDlg.bringToTop();
}
}
});
@ -296,13 +296,11 @@ public class AvnconfigDlg extends CaveSWTDialog {
tafSiteInfoBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
if (siteInfoDlg == null || siteInfoDlg.getParent().isDisposed()) {
if (mustCreate(siteInfoDlg)) {
siteInfoDlg = new TafSiteInfoEditorDlg(shell);
siteInfoDlg.open();
siteInfoDlg = null;
} else {
siteInfoDlg.getParent().forceActive();
siteInfoDlg.getParent().forceFocus();
siteInfoDlg.bringToTop();
}
}
});
@ -314,13 +312,11 @@ public class AvnconfigDlg extends CaveSWTDialog {
tafProductsBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
if (productsDlg == null || productsDlg.getParent().isDisposed()) {
if (mustCreate(productsDlg)) {
productsDlg = new TafProductConfigDlg(shell);
productsDlg.open();
productsDlg = null;
} else {
productsDlg.getParent().forceActive();
productsDlg.getParent().forceFocus();
productsDlg.bringToTop();
}
}
});

View file

@ -35,8 +35,6 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
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.Shell;
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.viz.avncommon.AvnMessageMgr.StatusMessageType;
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
@ -59,6 +58,8 @@ import com.raytheon.viz.avnconfig.AvnConfigConstants.DataSource;
* 16 Mar 2011 8599 rferrel Create msgStatusComp then load tabs.
* 27 Sep 2011 10958 rferrel Display more details when handling
* ConfigurationException.
* 12 Oct 2012 1229 rferrel Convert to subclass of CaveSWTDialog
* and made non-blocking.
*
* </pre>
*
@ -66,16 +67,7 @@ import com.raytheon.viz.avnconfig.AvnConfigConstants.DataSource;
* @version 1.0
*
*/
public class MonitoringCriteriaDlg extends Dialog {
/**
* Dialog shell.
*/
private Shell shell;
/**
* The display control.
*/
private Display display;
public class MonitoringCriteriaDlg extends CaveSWTDialog {
/**
* Composite containing message status controls.
@ -115,20 +107,12 @@ public class MonitoringCriteriaDlg extends Dialog {
* Parent shell.
*/
public MonitoringCriteriaDlg(Shell parent) {
super(parent, 0);
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
setText("AvnFPS Monitoring Criteria");
}
/**
* Open method used to display the dialog.
*
* @return Null.
*/
public Object open() {
Shell parent = getParent();
display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM);
shell.setText("AvnFPS Monitoring Criteria");
@Override
protected void initializeComponents(Shell shell) {
// Create the main layout for the shell.
GridLayout mainLayout = new GridLayout(1, false);
mainLayout.marginHeight = 3;
@ -138,17 +122,6 @@ public class MonitoringCriteriaDlg extends Dialog {
// Initialize all of the controls and layouts
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.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
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.requests.ThriftClient;
import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
/**
* TAF product configuration dialog.
@ -66,6 +66,8 @@ import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType;
* 22 MAY 2008 1119 lvenable Initial creation
* 9 Jul 2010 5078 rferrel Added catches for File Not Found.
* 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>
*
@ -73,20 +75,10 @@ import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType;
* @version 1.0
*
*/
public class TafProductConfigDlg extends Dialog {
public class TafProductConfigDlg extends CaveSWTDialog {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(TafProductConfigDlg.class);
/**
* Dialog shell.
*/
private Shell shell;
/**
* The display control.
*/
private Display display;
/**
* Composite containing message status controls.
*/
@ -138,20 +130,12 @@ public class TafProductConfigDlg extends Dialog {
* @param parent
*/
public TafProductConfigDlg(Shell parent) {
super(parent, 0);
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK);
setText("AvnFPS TAF Product Configuration");
}
/**
* Open method used to display the dialog.
*
* @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");
@Override
protected void initializeComponents(Shell shell) {
// Create the main layout for the shell.
GridLayout mainLayout = new GridLayout(1, false);
mainLayout.marginHeight = 3;
@ -161,25 +145,18 @@ public class TafProductConfigDlg extends Dialog {
// Initialize all of the controls and layouts
initializeComponents();
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
@Override
protected void disposed() {
listFont.dispose();
return null;
}
/**
* Initialize the components on the display.
*/
private void initializeComponents() {
Display display = getParent().getDisplay();
listFont = new Font(display, "Monospace", 10, SWT.NORMAL);
createBottomMessageControls();

View file

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