Issue #1298 Changes for non-blocking StoreTransmitDlg.
Changes from reviewer's coments. Change-Id: I34e111ee2abc8ca154334e9017ea448bfa6fa31f Former-commit-id:13c0fb3f3d
[formerly6445081aa9
] [formerly76109f3bf7
[formerly 35e8deb27aecf5c805f0c007e70c45d8cc9988cb]] Former-commit-id:76109f3bf7
Former-commit-id:e7cd99ff0d
This commit is contained in:
parent
398f71471d
commit
01899535e3
2 changed files with 35 additions and 47 deletions
|
@ -141,6 +141,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
* 31 AUG 2012 15037 mli Handle bad characters in text formatter definition
|
||||
* 07 Nov 2012 1298 rferrel Changes for non-blocking CallToActionsDlg.
|
||||
* Changes for non-blocking FindReplaceDlg.
|
||||
* Changes for non-blocking StoreTransmitDlg.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -1084,8 +1085,6 @@ public class ProductEditorComp extends Composite implements
|
|||
|
||||
// Store/transmit...
|
||||
boolean showStore = (action == Action.STORE) ? true : false;
|
||||
StoreTransmitDlg storeDlg = new StoreTransmitDlg(parent.getShell(),
|
||||
showStore, this, transmissionCB);
|
||||
String pid;
|
||||
if (showStore) {
|
||||
pid = guessTDBPil();
|
||||
|
@ -1096,7 +1095,13 @@ public class ProductEditorComp extends Composite implements
|
|||
pid = "kkkknnnxxx";
|
||||
}
|
||||
}
|
||||
storeDlg.open(pid);
|
||||
|
||||
// The dialog being opened is modal to the parent dialog. This will
|
||||
// prevent the launching of another dialog until the modal dialog is
|
||||
// closed.
|
||||
StoreTransmitDlg storeDlg = new StoreTransmitDlg(parent.getShell(),
|
||||
showStore, this, transmissionCB, pid);
|
||||
storeDlg.open();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,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.ProgressBar;
|
||||
|
@ -52,6 +51,7 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
|
|||
import com.raytheon.viz.core.mode.CAVEMode;
|
||||
import com.raytheon.viz.gfe.core.DataManager;
|
||||
import com.raytheon.viz.gfe.product.TextDBUtil;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
/**
|
||||
* Display the Store/Transmit dialog.
|
||||
|
@ -64,33 +64,20 @@ import com.raytheon.viz.gfe.product.TextDBUtil;
|
|||
* 19 FEB 2010 4132 ryu Product correction.
|
||||
* 28May2010 2187 cjeanbap Added StdTextProductFactory
|
||||
* functionality.
|
||||
* 09 NOV 2012 1298 rferrel Changes for non-blocking dialog.
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
* @version 1.0
|
||||
*
|
||||
*/
|
||||
public class StoreTransmitDlg extends Dialog implements IStoreTransmitProduct {
|
||||
public class StoreTransmitDlg extends CaveSWTDialog implements
|
||||
IStoreTransmitProduct {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(StoreTransmitDlg.class);
|
||||
|
||||
private static int SEQ_NUMBER = 0;
|
||||
|
||||
/**
|
||||
* Dialog shell.
|
||||
*/
|
||||
private Shell shell;
|
||||
|
||||
/**
|
||||
* The display control.
|
||||
*/
|
||||
private Display display;
|
||||
|
||||
/**
|
||||
* Return object when the shell is disposed.
|
||||
*/
|
||||
private String returnObj = null;
|
||||
|
||||
/**
|
||||
* PRoduct ID text control.
|
||||
*/
|
||||
|
@ -138,6 +125,8 @@ public class StoreTransmitDlg extends Dialog implements IStoreTransmitProduct {
|
|||
*/
|
||||
private ITransmissionState transmissionCB;
|
||||
|
||||
private String pid;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
@ -147,25 +136,20 @@ public class StoreTransmitDlg extends Dialog implements IStoreTransmitProduct {
|
|||
* Store flag. True is store, false is transmit.
|
||||
*/
|
||||
public StoreTransmitDlg(Shell parent, boolean storeDialog,
|
||||
ProductEditorComp editor, ITransmissionState transmissionCB) {
|
||||
super(parent, 0);
|
||||
ProductEditorComp editor, ITransmissionState transmissionCB,
|
||||
String pid) {
|
||||
super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL,
|
||||
CAVE.DO_NOT_BLOCK);
|
||||
|
||||
this.transmissionCB = transmissionCB;
|
||||
isStoreDialog = storeDialog;
|
||||
parentEditor = editor;
|
||||
this.productText = editor.getProductText();
|
||||
this.pid = pid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup and open the dialog.
|
||||
*
|
||||
* @return Return object.
|
||||
*/
|
||||
public Object open(String initialPid) {
|
||||
Shell parent = getParent();
|
||||
display = parent.getDisplay();
|
||||
shell = new Shell(parent, SWT.DIALOG_TRIM);
|
||||
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
String title = null;
|
||||
CAVEMode opMode = DataManager.getCurrentInstance().getOpMode();
|
||||
if (opMode.equals(CAVEMode.OPERATIONAL)) {
|
||||
|
@ -199,18 +183,12 @@ public class StoreTransmitDlg extends Dialog implements IStoreTransmitProduct {
|
|||
|
||||
// Initialize all of the controls and layouts
|
||||
initializeComponents();
|
||||
productIdTF.insert(initialPid);
|
||||
}
|
||||
|
||||
shell.pack();
|
||||
|
||||
shell.open();
|
||||
while (!shell.isDisposed()) {
|
||||
if (!display.readAndDispatch()) {
|
||||
display.sleep();
|
||||
}
|
||||
}
|
||||
|
||||
return returnObj;
|
||||
@Override
|
||||
protected void preOpened() {
|
||||
super.preOpened();
|
||||
productIdTF.insert(pid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -226,6 +204,8 @@ public class StoreTransmitDlg extends Dialog implements IStoreTransmitProduct {
|
|||
createMainControls();
|
||||
createBottomButtons();
|
||||
|
||||
Display display = shell.getParent().getDisplay();
|
||||
|
||||
countdownThread = new StoreTransmitCountdownThread(display, progBar,
|
||||
progressLbl, countdownText, this, isStoreDialog);
|
||||
}
|
||||
|
@ -327,6 +307,7 @@ public class StoreTransmitDlg extends Dialog implements IStoreTransmitProduct {
|
|||
if (countdownThread.isDone() == false) {
|
||||
countdownThread.cancelThread();
|
||||
progressLbl.setText(countdownText);
|
||||
Display display = shell.getParent().getDisplay();
|
||||
progressLbl.setBackground(display
|
||||
.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
|
||||
progressLbl.setForeground(display
|
||||
|
@ -334,8 +315,8 @@ public class StoreTransmitDlg extends Dialog implements IStoreTransmitProduct {
|
|||
}
|
||||
}
|
||||
|
||||
returnObj = null;
|
||||
shell.dispose();
|
||||
setReturnValue(null);
|
||||
close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -374,9 +355,11 @@ public class StoreTransmitDlg extends Dialog implements IStoreTransmitProduct {
|
|||
|
||||
// The asyncExec call is used to dispose of the shell since it is
|
||||
// called outside the GUI thread (count down thread).
|
||||
display.asyncExec(new Runnable() {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue