Merge "Issue #1229 Changes for non-blocking /SendDialog." into development

Former-commit-id: 7c76c9e169 [formerly 7c76c9e169 [formerly 0f10e8442ad8cef0cb13e68aec158f8a6bb3d23e]]
Former-commit-id: 469a155107
Former-commit-id: 38d4ac0f89
This commit is contained in:
Nate Jensen 2012-10-10 15:35:30 -05:00 committed by Gerrit Code Review
commit 8fc59ae4bb
2 changed files with 73 additions and 49 deletions

View file

@ -217,6 +217,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* 08AGU2012 15613 zhao Modified highlightTAF() * 08AGU2012 15613 zhao Modified highlightTAF()
* 04OCT2012 1229 rferrel Changes for non-blocking LoaderDialog. * 04OCT2012 1229 rferrel Changes for non-blocking LoaderDialog.
* 09OCT2012 1229 rferrel Changes for non-blocking QcDialog. * 09OCT2012 1229 rferrel Changes for non-blocking QcDialog.
* 09OCT2012 1229 rferrel Changes for non-blocking SendDialog.
* *
* </pre> * </pre>
* *
@ -522,6 +523,8 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable,
private QcDialog qcDlg; private QcDialog qcDlg;
private SendDialog sendDlg;
/** /**
* Constructor. * Constructor.
* *
@ -896,6 +899,10 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable,
qcDlg.bringToTop(); qcDlg.bringToTop();
} }
if (sendDlg != null && sendDlg.getShell() != null
&& sendDlg.isDisposed() == false) {
sendDlg.bringToTop();
}
shell.setActive(); shell.setActive();
} }
@ -911,6 +918,9 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable,
if (qcDlg != null) { if (qcDlg != null) {
qcDlg.hide(); qcDlg.hide();
} }
if (sendDlg != null) {
sendDlg.hide();
}
} }
private void setVisible(boolean state) { private void setVisible(boolean state) {
@ -1776,14 +1786,27 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable,
printForecast(editorTafTabComp.getTextEditorControl() printForecast(editorTafTabComp.getTextEditorControl()
.getText()); .getText());
} }
SendDialog sendDlg = new SendDialog(shell,
editorTafTabComp, msgStatComp, sendCollectMI if (sendDlg == null || sendDlg.getShell() == null
.getSelection()); || sendDlg.isDisposed()) {
sendDlg.open(); sendDlg = new SendDialog(shell, editorTafTabComp,
// sendDlg sets the "taf sent" field only msgStatComp, sendCollectMI.getSelection());
if (editorTafTabComp.isTafSent()) { sendDlg.setCloseCallback(new ICloseCallback() {
editorTafTabComp.updateTafSent(true);
@Override
public void dialogClosed(Object returnValue) {
// sendDlg sets the "taf sent" field only
if (editorTafTabComp.isTafSent()) {
editorTafTabComp.updateTafSent(true);
}
sendDlg = null;
}
});
sendDlg.open();
} else {
sendDlg.bringToTop();
} }
} else { } else {
putMessageToForecaster("Cannot send forecast: Press Syntax before transmission"); putMessageToForecaster("Cannot send forecast: Press Syntax before transmission");
} }

View file

@ -69,6 +69,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* 4/15/2009 1982 grichard Provide feedback when saving a working TAF. * 4/15/2009 1982 grichard Provide feedback when saving a working TAF.
* 12/08/2011 11745 rferrel Updated header time to transmission time. * 12/08/2011 11745 rferrel Updated header time to transmission time.
* 08AUG2012 15613 zhao Determine proper BBB for transmission * 08AUG2012 15613 zhao Determine proper BBB for transmission
* 09OCT2012 1229 rferrel Make dialog non-blocking.
* *
* </pre> * </pre>
* *
@ -146,7 +147,7 @@ public class SendDialog extends CaveSWTDialog {
public SendDialog(Shell parent, EditorTafTabComp tabComp, public SendDialog(Shell parent, EditorTafTabComp tabComp,
IStatusSettable msgStatComp, boolean sendCollective) { IStatusSettable msgStatComp, boolean sendCollective) {
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, super(parent, SWT.DIALOG_TRIM | SWT.RESIZE,
CAVE.PERSPECTIVE_INDEPENDENT); CAVE.PERSPECTIVE_INDEPENDENT | CAVE.DO_NOT_BLOCK);
setText("AvnFPS Send"); setText("AvnFPS Send");
this.tabComp = tabComp; this.tabComp = tabComp;
@ -365,7 +366,7 @@ public class SendDialog extends CaveSWTDialog {
String siteWmoId = tabComp.getWmoId(); String siteWmoId = tabComp.getWmoId();
// WMO Site // WMO Site
String siteNode = null; String siteNode = null;
//java.util.List<String> stationIds = new ArrayList<String>(); // java.util.List<String> stationIds = new ArrayList<String>();
ArrayList<String> tafs = new ArrayList<String>(); ArrayList<String> tafs = new ArrayList<String>();
ArrayList<String> updatedTafs = new ArrayList<String>(); ArrayList<String> updatedTafs = new ArrayList<String>();
@ -407,11 +408,10 @@ public class SendDialog extends CaveSWTDialog {
* If "AAX" or "CCX" or "RRX", determine BBB for transmission * If "AAX" or "CCX" or "RRX", determine BBB for transmission
*/ */
String xmitBbb = bbb; String xmitBbb = bbb;
if ( bbb.equals("AAX") || bbb.equals("CCX") || bbb.equals("RRX") ) { if (bbb.equals("AAX") || bbb.equals("CCX") || bbb.equals("RRX")) {
String type = bbb.substring(0, 2); String type = bbb.substring(0, 2);
xmitBbb = getXmitBbb( type, siteId); xmitBbb = getXmitBbb(type, siteId);
} }
// Update Header Time to transmission time. // Update Header Time to transmission time.
tafText = TIMESTAMP_PATTERN.matcher(tafText).replaceFirst( tafText = TIMESTAMP_PATTERN.matcher(tafText).replaceFirst(
@ -467,40 +467,41 @@ public class SendDialog extends CaveSWTDialog {
shell.dispose(); shell.dispose();
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private String getXmitBbb(String type, String siteId) { private String getXmitBbb(String type, String siteId) {
try { try {
TafQueueRequest request = new TafQueueRequest(); TafQueueRequest request = new TafQueueRequest();
request.setType(Type.GET_LIST); request.setType(Type.GET_LIST);
request.setState(TafQueueRecord.TafQueueState.SENT); request.setState(TafQueueRecord.TafQueueState.SENT);
ServerResponse<java.util.List<String>> response = (ServerResponse<java.util.List<String>>) ThriftClient.sendRequest(request); ServerResponse<java.util.List<String>> response = (ServerResponse<java.util.List<String>>) ThriftClient
java.util.List<String> payload = response.getPayload(); .sendRequest(request);
String [] records = (String []) payload.toArray(new String[0]); java.util.List<String> payload = response.getPayload();
int numRecords = records.length; String[] records = (String[]) payload.toArray(new String[0]);
for ( int i = numRecords-1; i >=0; i-- ) { int numRecords = records.length;
if ( records[i].contains(siteId) ) { for (int i = numRecords - 1; i >= 0; i--) {
String [] texts = records[i].split("-"); if (records[i].contains(siteId)) {
String bbb = texts[texts.length-2]; String[] texts = records[i].split("-");
if ( bbb.equals(" ") ) { String bbb = texts[texts.length - 2];
return type+"A"; if (bbb.equals(" ")) {
} return type + "A";
if ( bbb.subSequence(0, 2).equals(type) ) { }
char[] newX = new char[] { bbb.charAt(2) }; if (bbb.subSequence(0, 2).equals(type)) {
if ( newX[0] == 'X' ) { char[] newX = new char[] { bbb.charAt(2) };
newX[0] = 'A'; if (newX[0] == 'X') {
} else { newX[0] = 'A';
newX[0]++; } else {
} newX[0]++;
return type + new String( newX ); }
} return type + new String(newX);
} }
} }
} catch (VizException e) { }
// TODO Auto-generated catch block } catch (VizException e) {
e.printStackTrace(); // TODO Auto-generated catch block
} e.printStackTrace();
}
return type + "A";
} return type + "A";
}
} }