Issue #1298 Changes for non-blocking IssuanceSiteIdDlg.
Change-Id: I735b63606c3ca6f680f47bd61e55658b18c223ba Former-commit-id:fb742c6dbf
[formerly709798659d
] [formerlye26b14a84d
] [formerlyfb742c6dbf
[formerly709798659d
] [formerlye26b14a84d
] [formerly89617dda68
[formerlye26b14a84d
[formerly a2a52b7754d831406e591763930f419def7cb1eb]]]] Former-commit-id:89617dda68
Former-commit-id:ddeecc6e98
[formerly553344fb3b
] [formerly 905e3bb90604a5bd868eee7dd06299aedc0f819f [formerly05825bd6f3
]] Former-commit-id: b5165931eb57a4fadceb017392a53e8e879158a7 [formerlyf13bedab32
] Former-commit-id:e3b4a7d750
This commit is contained in:
parent
b24d461c8d
commit
4aeb7fd6d3
3 changed files with 57 additions and 63 deletions
|
@ -73,6 +73,7 @@ import com.raytheon.viz.gfe.dialogs.formatterlauncher.IssuanceSiteIdDlg;
|
|||
import com.raytheon.viz.gfe.dialogs.formatterlauncher.ProductAreaComp;
|
||||
import com.raytheon.viz.gfe.textformatter.TextProductManager;
|
||||
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
||||
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||
|
||||
/**
|
||||
* The formatter launcher dialog.
|
||||
|
@ -90,6 +91,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
|||
* Nov 22, 2011 8781 mli remove Processor menu
|
||||
* Jul 26, 2012 15165 ryu Set default db source when formatter has no db defined.
|
||||
* Oct 23, 2012 1287 rferrel Changes for non-blocking dialogs and code clean up.
|
||||
* Nov 08, 2012 1298 rferrel Changes for non-blocking IssuanceSiteIdDlg.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -102,6 +104,8 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements
|
|||
private final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(FormatterLauncherDialog.class);
|
||||
|
||||
private IssuanceSiteIdDlg issuedByDlg;
|
||||
|
||||
private final String BASELINE = "Baseline";
|
||||
|
||||
private final String CIVIL_EMERGENCY = "CivilEmergency";
|
||||
|
@ -410,12 +414,24 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements
|
|||
issuanceSiteMI.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
IssuanceSiteIdDlg issuedByDlg = new IssuanceSiteIdDlg(
|
||||
FormatterLauncherDialog.this.getShell());
|
||||
String issuedBy = textProductMgr.getIssuedBy();
|
||||
issuedBy = (String) issuedByDlg.open(issuedBy);
|
||||
if (issuedBy != null) {
|
||||
textProductMgr.setIssuedBy(issuedBy.toUpperCase());
|
||||
if (issuedByDlg == null || issuedByDlg.getShell() == null
|
||||
|| issuedByDlg.isDisposed()) {
|
||||
String issuedBy = textProductMgr.getIssuedBy();
|
||||
issuedByDlg = new IssuanceSiteIdDlg(
|
||||
FormatterLauncherDialog.this.getShell(), issuedBy);
|
||||
issuedByDlg.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof String) {
|
||||
textProductMgr.setIssuedBy(returnValue
|
||||
.toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
issuedByDlg.open();
|
||||
} else {
|
||||
issuedByDlg.bringToTop();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -72,10 +72,6 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
|||
public class FuzzValueDialog extends CaveJFACEDialog implements
|
||||
IDisplayedParmListChangedListener, IActivatedParmChangedListener {
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
|
||||
private Scale fuzzSlider;
|
||||
|
||||
private Composite top;
|
||||
|
|
|
@ -24,16 +24,18 @@ import org.eclipse.swt.events.KeyAdapter;
|
|||
import org.eclipse.swt.events.KeyEvent;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.VerifyEvent;
|
||||
import org.eclipse.swt.events.VerifyListener;
|
||||
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.Text;
|
||||
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
/**
|
||||
* Display the Issuance Site ID dialog.
|
||||
*
|
||||
|
@ -43,6 +45,7 @@ import org.eclipse.swt.widgets.Text;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 18 APR 2008 ### lvenable Initial creation
|
||||
* Jan 18 2010 3395 ryu Fix "issued by" functionality
|
||||
* Nov 08 2012 1298 rferrel Changes for non-blocking dialog.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -50,21 +53,7 @@ import org.eclipse.swt.widgets.Text;
|
|||
* @version 1.0
|
||||
*
|
||||
*/
|
||||
public class IssuanceSiteIdDlg extends Dialog {
|
||||
/**
|
||||
* Dialog shell.
|
||||
*/
|
||||
private Shell shell;
|
||||
|
||||
/**
|
||||
* The display control.
|
||||
*/
|
||||
private Display display;
|
||||
|
||||
/**
|
||||
* Return object when the shell is disposed.
|
||||
*/
|
||||
private String returnObj = null;
|
||||
public class IssuanceSiteIdDlg extends CaveSWTDialog {
|
||||
|
||||
/**
|
||||
* Site ID text control.
|
||||
|
@ -76,28 +65,21 @@ public class IssuanceSiteIdDlg extends Dialog {
|
|||
*/
|
||||
private Button okBtn;
|
||||
|
||||
private String issuedBy;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param parent
|
||||
* Parent Shell.
|
||||
*/
|
||||
public IssuanceSiteIdDlg(Shell parent) {
|
||||
super(parent, 0);
|
||||
public IssuanceSiteIdDlg(Shell parent, String issuedBy) {
|
||||
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
|
||||
this.issuedBy = issuedBy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup and open the dialog.
|
||||
*
|
||||
* @param issuedBy
|
||||
* Initial value for text field.
|
||||
* @return Return object.
|
||||
*/
|
||||
public Object open(String issuedBy) {
|
||||
Shell parent = getParent();
|
||||
display = parent.getDisplay();
|
||||
shell = new Shell(parent, SWT.DIALOG_TRIM);
|
||||
shell.setText("Issuance Site ID");
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
|
||||
// Create the main layout for the shell.
|
||||
GridLayout mainLayout = new GridLayout(1, false);
|
||||
|
@ -108,22 +90,19 @@ public class IssuanceSiteIdDlg extends Dialog {
|
|||
|
||||
// Initialize all of the controls and layouts
|
||||
initializeComponents();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void preOpened() {
|
||||
super.preOpened();
|
||||
shell.setText("Issuance Site ID");
|
||||
siteIdTF.insert(issuedBy);
|
||||
if (issuedBy.length() == 0 || issuedBy.length() == 3) {
|
||||
okBtn.setEnabled(true);
|
||||
}
|
||||
|
||||
shell.pack();
|
||||
|
||||
shell.open();
|
||||
while (!shell.isDisposed()) {
|
||||
if (!display.readAndDispatch()) {
|
||||
display.sleep();
|
||||
}
|
||||
}
|
||||
|
||||
return returnObj;
|
||||
siteIdTF.forceFocus();
|
||||
siteIdTF.selectAll();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -150,20 +129,23 @@ public class IssuanceSiteIdDlg extends Dialog {
|
|||
siteIdTF.setTextLimit(3);
|
||||
siteIdTF.setLayoutData(gd);
|
||||
siteIdTF.addKeyListener(new KeyAdapter() {
|
||||
@Override
|
||||
public void keyPressed(KeyEvent ke) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent ke) {
|
||||
if (siteIdTF.getText().length() > 0 &&
|
||||
siteIdTF.getText().length() < 3) {
|
||||
if (siteIdTF.getText().length() > 0
|
||||
&& siteIdTF.getText().length() < 3) {
|
||||
okBtn.setEnabled(false);
|
||||
} else {
|
||||
okBtn.setEnabled(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
siteIdTF.addVerifyListener(new VerifyListener() {
|
||||
|
||||
@Override
|
||||
public void verifyText(VerifyEvent e) {
|
||||
e.text = e.text.trim().toUpperCase();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -188,8 +170,8 @@ public class IssuanceSiteIdDlg extends Dialog {
|
|||
okBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
returnObj = siteIdTF.getText();
|
||||
shell.dispose();
|
||||
setReturnValue(siteIdTF.getText());
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -200,8 +182,8 @@ public class IssuanceSiteIdDlg extends Dialog {
|
|||
cancelBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
returnObj = null;
|
||||
shell.dispose();
|
||||
setReturnValue(null);
|
||||
close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue