ASM #15025 WRK product changes header to alternate- long-line pil in header block.

Change-Id: If5776bbddbf8b5eddf8dff85d913ce8a4862bd12

Former-commit-id: 3ab4df17a7fd40f93de6cb32798ee5a2385f4814
This commit is contained in:
Kiran.Shrestha 2015-04-03 16:19:10 +00:00
parent 099fba8402
commit 8f981c5fa4
2 changed files with 38 additions and 14 deletions

View file

@ -444,18 +444,16 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
if (null == CCCcode) {
wsfoIdTF.setText(textProd.getCccid());
} else {
wsfoIdTF.setText(CCCcode);
if (textProd.getProdId().getWmoid().isEmpty()
&& textProd.getProdId().getSite().isEmpty()) {
wsfoIdTF.setText(textProd.getCccid());
}
else
wsfoIdTF.setText(CCCcode);
}
} else {
wsfoIdTF.setText(textProd.getCccid());
}
if(textProd.getProduct() != null) {
if(textProd.getProduct().startsWith("ZCZC")) {
wsfoIdTF.setText(textProd.getCccid());
}
}
prodCatTF.setText(textProd.getNnnid());
prodDesignatorTF.setText(textProd.getXxxid());
}

View file

@ -5740,17 +5740,14 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
int numberOfLinesOfHeaderText = 2;
int afosNnnLimit = 2; // first three characters is AFOS NNN
int afosXxxLimit = 5; // second three characters is AFOS XXX
String prodText = textEditor.getText();
if (!prodText.startsWith("ZCZC")) {
/*
* DR15610 - Make sure that if the first line of the text product is not
* a WMO heading it is treated as part of the text body.
*/
String[] pieces = null;
if(textEditor.getText().startsWith("ZCZC"))
pieces = textEditor.getText().split("\r*\n", 1);
else
pieces = textEditor.getText().split("\r*\n", 2);
String[] pieces = textEditor.getText().split("\r*\n", 2);
if (pieces.length > 1) {
pieces[0] += "\n"; // WMOHeader expects this
}
@ -5850,6 +5847,35 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
textEditor.setText("");
}
}
} else {
/**
* If the first word begins with "ZCZC", it is a two-line header at least,
* it is "ZCZC CCNNNXXX adr\r\r\nTTAA00 KCCC DDHHMM bbb\r\r\n"
*/
int newLineIndex = prodText.indexOf("\n\n");
String first = prodText.substring(0, newLineIndex);
if (first.length() > 10 ) {
String rest = prodText.substring(newLineIndex+1);
headerTF.setText(first);
String cccnnnxxx = first.substring(5, 14);
setCurrentSiteId("");
setCurrentWmoId("");
setCurrentWsfoId(cccnnnxxx.substring(0, 3));
setCurrentProdCategory(cccnnnxxx.substring(3, 6));
setCurrentProdDesignator(cccnnnxxx.substring(6, 9));
try {
textEditor.setText(rest.trim());
textEditor.setEditable(true);
textEditor.setEditable(false);
} catch (IllegalArgumentException e) {
// There is no text product body, so set it to the empty string.
textEditor.setText("");
}
}
}
}
/**