Issue #1229 Changes for stand along componets using non-blocking dialogs.

Change-Id: Ie394cc559501359074c15c60779331d9e922379a

Former-commit-id: 3f007ecd4def67cb8152f60ee0dec9656a90a03d
This commit is contained in:
Roger Ferrel 2012-10-18 16:07:50 -05:00
parent 8a574a91cf
commit 2d9805411f
10 changed files with 98 additions and 53 deletions

View file

@ -22,8 +22,7 @@ package com.raytheon.viz.aviation;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import com.raytheon.viz.ui.dialogs.CaveSWTDialogBase.CAVE; import com.raytheon.viz.ui.personalities.awips.AbstractCAVEDialogComponent;
import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
/** /**
* This class starts AviationDialog as a stand alone component with runtime mode * This class starts AviationDialog as a stand alone component with runtime mode
@ -37,6 +36,8 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 28, 2011 mschenke Initial creation * Apr 28, 2011 mschenke Initial creation
* Oct 08, 2012 1229 rferrel Make a blocking dialog. * Oct 08, 2012 1229 rferrel Make a blocking dialog.
* Oct 17, 2012 1229 rferrel Changes for non-blocking
* AviationDialog.
* *
* </pre> * </pre>
* *
@ -44,7 +45,7 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
* @version 1.0 * @version 1.0
*/ */
public class AviationComponent extends AbstractCAVEComponent { public class AviationComponent extends AbstractCAVEDialogComponent {
/* /*
* (non-Javadoc) * (non-Javadoc)
@ -56,8 +57,9 @@ public class AviationComponent extends AbstractCAVEComponent {
@Override @Override
protected void startInternal(String componentName) throws Exception { protected void startInternal(String componentName) throws Exception {
AviationDialog aviationDlg = new AviationDialog(new Shell( AviationDialog aviationDlg = new AviationDialog(new Shell(
Display.getCurrent()), CAVE.NONE); Display.getCurrent()));
aviationDlg.open(); aviationDlg.open();
blockUntilClosed(aviationDlg);
} }
/* /*

View file

@ -27,7 +27,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import javax.xml.bind.JAXB; import javax.xml.bind.JAXB;
import org.eclipse.core.runtime.Assert;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionEvent;
@ -165,7 +164,7 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart {
public static boolean USERTRANSMIT = true; public static boolean USERTRANSMIT = true;
/** /**
* List control containing forcaster names. * List control containing forecaster names.
*/ */
private List forecasterList; private List forecasterList;
@ -178,25 +177,10 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart {
* Create a non-blocking dialog. * Create a non-blocking dialog.
* *
* @param parent * @param parent
* Parent Shell.
*/ */
public AviationDialog(Shell parent) { public AviationDialog(Shell parent) {
this(parent, CAVE.DO_NOT_BLOCK);
}
/**
* Create dialog specifying NONE for blocking and DO_NOT_BLOCK for
* non-blocking dialog.
*
* @param parent
* @param block
* - CAVE.DO_NOT_BLOCK or CAVE.NONE
*/
public AviationDialog(Shell parent, int block) {
super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT
| CAVE.INDEPENDENT_SHELL | block); | CAVE.INDEPENDENT_SHELL | CAVE.DO_NOT_BLOCK);
// Do not allow other CAVE styles to be passed to this constructor.
Assert.isTrue(block == CAVE.DO_NOT_BLOCK || block == CAVE.NONE);
setText("AvnFPS Menu"); setText("AvnFPS Menu");
ForecastModel.getInstance().setBackupRestartUtility(this); ForecastModel.getInstance().setBackupRestartUtility(this);

View file

@ -22,7 +22,7 @@ package com.raytheon.viz.aviation;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; import com.raytheon.viz.ui.personalities.awips.AbstractCAVEDialogComponent;
/** /**
* This class is a run configuration component to launch the AvnFPS monitor. * This class is a run configuration component to launch the AvnFPS monitor.
@ -34,14 +34,15 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 28, 2011 mschenke Initial creation * Apr 28, 2011 mschenke Initial creation
* * Oct 17, 2012 1229 rferrel Changes for non-blocking
* AvnconfigDlg.
* </pre> * </pre>
* *
* @author mschenke * @author mschenke
* @version 1.0 * @version 1.0
*/ */
public class AvnconfigComponent extends AbstractCAVEComponent { public class AvnconfigComponent extends AbstractCAVEDialogComponent {
/* /*
* (non-Javadoc) * (non-Javadoc)
@ -55,6 +56,7 @@ public class AvnconfigComponent extends AbstractCAVEComponent {
AvnconfigDlg avnfspSetupDlg = new AvnconfigDlg(new Shell( AvnconfigDlg avnfspSetupDlg = new AvnconfigDlg(new Shell(
Display.getCurrent())); Display.getCurrent()));
avnfspSetupDlg.open(); avnfspSetupDlg.open();
blockUntilClosed(avnfspSetupDlg);
} }
/* /*

View file

@ -27,7 +27,7 @@ import org.eclipse.swt.widgets.Shell;
import com.raytheon.viz.aviation.climatology.CigVisDistributionDlg; import com.raytheon.viz.aviation.climatology.CigVisDistributionDlg;
import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType; import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType;
import com.raytheon.viz.avnconfig.TafSiteConfigFactory; import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; import com.raytheon.viz.ui.personalities.awips.AbstractCAVEDialogComponent;
/** /**
* This is a component class for launching the CigVisDistributionDlg dialog. * This is a component class for launching the CigVisDistributionDlg dialog.
@ -39,6 +39,8 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 28, 2011 mschenke Initial creation * Apr 28, 2011 mschenke Initial creation
* Oct 17, 2012 1229 rferrel Changes for non-blocking
* CigVisDistributionDlg.
* *
* </pre> * </pre>
* *
@ -46,7 +48,7 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
* @version 1.0 * @version 1.0
*/ */
public class CigVisDistComponent extends AbstractCAVEComponent { public class CigVisDistComponent extends AbstractCAVEDialogComponent {
/* /*
* (non-Javadoc) * (non-Javadoc)
@ -63,6 +65,7 @@ public class CigVisDistComponent extends AbstractCAVEComponent {
new Shell(Display.getCurrent()), siteList, new Shell(Display.getCurrent()), siteList,
StatusMessageType.Metar, null); StatusMessageType.Metar, null);
cigVisDistDialog.open(); cigVisDistDialog.open();
blockUntilClosed(cigVisDistDialog);
} }
/* /*

View file

@ -27,7 +27,7 @@ import org.eclipse.swt.widgets.Shell;
import com.raytheon.viz.aviation.climatology.CigVisTrendDlg; import com.raytheon.viz.aviation.climatology.CigVisTrendDlg;
import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType; import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType;
import com.raytheon.viz.avnconfig.TafSiteConfigFactory; import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; import com.raytheon.viz.ui.personalities.awips.AbstractCAVEDialogComponent;
/** /**
* This is a component class for lanuching the CigVisTrendDlg dialog. * This is a component class for lanuching the CigVisTrendDlg dialog.
@ -39,14 +39,15 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 28, 2011 mschenke Initial creation * Apr 28, 2011 mschenke Initial creation
* * Oct 17, 2012 1229 rferrel Changes for non-blocking
* CigVisTrendDlg.
* </pre> * </pre>
* *
* @author mschenke * @author mschenke
* @version 1.0 * @version 1.0
*/ */
public class CigVisTrendComponent extends AbstractCAVEComponent { public class CigVisTrendComponent extends AbstractCAVEDialogComponent {
/* /*
* (non-Javadoc) * (non-Javadoc)
@ -62,6 +63,7 @@ public class CigVisTrendComponent extends AbstractCAVEComponent {
CigVisTrendDlg cigVisTrendDialog = new CigVisTrendDlg(new Shell( CigVisTrendDlg cigVisTrendDialog = new CigVisTrendDlg(new Shell(
Display.getCurrent()), siteList, StatusMessageType.Metar, null); Display.getCurrent()), siteList, StatusMessageType.Metar, null);
cigVisTrendDialog.open(); cigVisTrendDialog.open();
blockUntilClosed(cigVisTrendDialog);
} }
/* /*

View file

@ -27,7 +27,7 @@ import org.eclipse.swt.widgets.Shell;
import com.raytheon.viz.aviation.climatology.MetarDisplayDialog; import com.raytheon.viz.aviation.climatology.MetarDisplayDialog;
import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType; import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType;
import com.raytheon.viz.avnconfig.TafSiteConfigFactory; import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; import com.raytheon.viz.ui.personalities.awips.AbstractCAVEDialogComponent;
/** /**
* This is a component class for launching the Climate's MetarDisplayDialog. * This is a component class for launching the Climate's MetarDisplayDialog.
@ -39,6 +39,8 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 28, 2011 mschenke Initial creation * Apr 28, 2011 mschenke Initial creation
* Oct 17, 2012 1229 rferrel Changes for non-blocking
* MetarDisplayDialog.
* *
* </pre> * </pre>
* *
@ -46,7 +48,7 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
* @version 1.0 * @version 1.0
*/ */
public class MetarComponent extends AbstractCAVEComponent { public class MetarComponent extends AbstractCAVEDialogComponent {
/* /*
* (non-Javadoc) * (non-Javadoc)
@ -62,6 +64,7 @@ public class MetarComponent extends AbstractCAVEComponent {
MetarDisplayDialog metarDialog = new MetarDisplayDialog(new Shell( MetarDisplayDialog metarDialog = new MetarDisplayDialog(new Shell(
Display.getCurrent()), siteList, StatusMessageType.Metar, null); Display.getCurrent()), siteList, StatusMessageType.Metar, null);
metarDialog.open(); metarDialog.open();
blockUntilClosed(metarDialog);
} }
/* /*

View file

@ -27,7 +27,7 @@ import org.eclipse.swt.widgets.Shell;
import com.raytheon.viz.aviation.climatology.WindRosePlotDlg; import com.raytheon.viz.aviation.climatology.WindRosePlotDlg;
import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType; import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType;
import com.raytheon.viz.avnconfig.TafSiteConfigFactory; import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; import com.raytheon.viz.ui.personalities.awips.AbstractCAVEDialogComponent;
/** /**
* Component class for launching the Climate's WindRoseDlg. * Component class for launching the Climate's WindRoseDlg.
@ -39,6 +39,8 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 28, 2011 mschenke Initial creation * Apr 28, 2011 mschenke Initial creation
* Oct 17, 2012 1229 rferrel Changes for non-blocking
* WindRosePlotDlg.
* *
* </pre> * </pre>
* *
@ -46,7 +48,7 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
* @version 1.0 * @version 1.0
*/ */
public class WindRoseComponent extends AbstractCAVEComponent { public class WindRoseComponent extends AbstractCAVEDialogComponent {
/* /*
* (non-Javadoc) * (non-Javadoc)
@ -63,6 +65,7 @@ public class WindRoseComponent extends AbstractCAVEComponent {
Display.getCurrent()), siteList, StatusMessageType.WindRose, Display.getCurrent()), siteList, StatusMessageType.WindRose,
null); null);
windRoseDialog.open(); windRoseDialog.open();
blockUntilClosed(windRoseDialog);
} }
/* /*

View file

@ -4,8 +4,7 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.serialization.SerializationUtil; import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.viz.ui.dialogs.CaveSWTDialogBase.CAVE; import com.raytheon.viz.ui.personalities.awips.AbstractCAVEDialogComponent;
import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
/** /**
* This software was developed and / or modified by Raytheon Company, * This software was developed and / or modified by Raytheon Company,
@ -28,7 +27,8 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
**/ **/
/** /**
* TODO Add Description * This class used to made a stand alone Text workstation.
*
* *
* <pre> * <pre>
* *
@ -38,6 +38,8 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 28, 2011 mschenke Initial creation * Apr 28, 2011 mschenke Initial creation
* Oct 02, 2012 1229 rferrel Make a blocking dialog. * Oct 02, 2012 1229 rferrel Make a blocking dialog.
* Oct 17, 2012 1229 rferrel Changes for non-blocking
* TextWorkstationDlg.
* *
* </pre> * </pre>
* *
@ -45,7 +47,7 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
* @version 1.0 * @version 1.0
*/ */
public class TextWorkstationComponent extends AbstractCAVEComponent { public class TextWorkstationComponent extends AbstractCAVEDialogComponent {
/* /*
* (non-Javadoc) * (non-Javadoc)
@ -58,8 +60,9 @@ public class TextWorkstationComponent extends AbstractCAVEComponent {
protected void startInternal(String componentName) throws Exception { protected void startInternal(String componentName) throws Exception {
SerializationUtil.getJaxbContext(); SerializationUtil.getJaxbContext();
TextWorkstationDlg textWorkstationDlg = new TextWorkstationDlg( TextWorkstationDlg textWorkstationDlg = new TextWorkstationDlg(
new Shell(Display.getCurrent()), CAVE.NONE); new Shell(Display.getCurrent()));
textWorkstationDlg.open(); textWorkstationDlg.open();
blockUntilClosed(textWorkstationDlg);
} }
/* /*

View file

@ -28,7 +28,6 @@ import java.util.TimeZone;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
import org.eclipse.core.runtime.Assert;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionEvent;
@ -143,15 +142,6 @@ public class TextWorkstationDlg extends CaveSWTDialog implements
/** Select user ID dialog */ /** Select user ID dialog */
private SelectUserIdDlg userIdDlg; private SelectUserIdDlg userIdDlg;
/**
* Create a non-blocking dialog
*
* @param parent
*/
public TextWorkstationDlg(Shell parent) {
this(parent, CAVE.DO_NOT_BLOCK);
}
/** /**
* Create dialog specifying NONE for blocking and DO_NOT_BLOCK for * Create dialog specifying NONE for blocking and DO_NOT_BLOCK for
* non-blocking dialog. * non-blocking dialog.
@ -160,12 +150,11 @@ public class TextWorkstationDlg extends CaveSWTDialog implements
* @param block * @param block
* - CAVE.DO_NOT_BLOCK or CAVE.NONE * - CAVE.DO_NOT_BLOCK or CAVE.NONE
*/ */
public TextWorkstationDlg(Shell parent, int block) { public TextWorkstationDlg(Shell parent) {
super(parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.RESIZE, super(parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.RESIZE,
CAVE.PERSPECTIVE_INDEPENDENT | CAVE.INDEPENDENT_SHELL | block); CAVE.PERSPECTIVE_INDEPENDENT | CAVE.INDEPENDENT_SHELL
| CAVE.DO_NOT_BLOCK);
// Do not allow other CAVE styles to be passed to this constructor.
Assert.isTrue(block == CAVE.DO_NOT_BLOCK || block == CAVE.NONE);
setText("Text Workstation"); setText("Text Workstation");
TextDisplayModel.getInstance().setTextAviation( TextDisplayModel.getInstance().setTextAviation(

View file

@ -0,0 +1,54 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.viz.ui.personalities.awips;
import org.eclipse.swt.widgets.Display;
import com.raytheon.viz.ui.dialogs.CaveSWTDialogBase;
/**
* This abstract class provides a way to wait for a non-blocking dialog to
* dispose before continuing. Since having more then one dialog blocking causes
* problems the intended uses is to block the top level dialog of a component
* running in stand alone mode.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 18, 2012 1229 rferrel Initial creation
*
* </pre>
*
* @author rferrel
* @version 1.0
*/
public abstract class AbstractCAVEDialogComponent extends AbstractCAVEComponent {
protected void blockUntilClosed(CaveSWTDialogBase dlg) {
while (!dlg.isDisposed()) {
if (!Display.getCurrent().readAndDispatch()) {
Display.getCurrent().sleep();
}
}
}
}