Issue #1298 Changes for non-blocking CallToActionsDlg.
Change-Id: I4a141c0a3d00cab36b792f4471aaf7482c2fa8dc Former-commit-id:190922a233
[formerly 7e987f7743a068b14e3eb7149f933cdf56e59f61] Former-commit-id:81de6cd45b
This commit is contained in:
parent
24dd8a1bc7
commit
d6560d7730
2 changed files with 96 additions and 90 deletions
|
@ -36,7 +36,6 @@ import org.eclipse.swt.widgets.Composite;
|
|||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.gfe.StatusConstants;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
@ -52,6 +51,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 12 JAN 2010 DR3463 RT Initial creation
|
||||
* 07 Nov 2012 1298 rferrel Changes for non-blocking dialog.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -60,9 +60,10 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
|||
*
|
||||
*/
|
||||
public class CallToActionsDlg extends CaveJFACEDialog {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(CallToActionsDlg.class);
|
||||
private final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(CallToActionsDlg.class);
|
||||
|
||||
private static String psplitRE = "\n\\s*?(?:\n\\s*?)+";
|
||||
private final String psplitRE = "\n\\s*?(?:\n\\s*?)+";
|
||||
|
||||
/**
|
||||
* Composite containing the Product Editor controls.
|
||||
|
@ -86,7 +87,7 @@ public class CallToActionsDlg extends CaveJFACEDialog {
|
|||
String[] CtaText, ProductEditorComp productEditorComp) {
|
||||
super(parent);
|
||||
|
||||
this.setShellStyle(SWT.RESIZE);
|
||||
this.setShellStyle(SWT.DIALOG_TRIM | SWT.RESIZE | SWT.APPLICATION_MODAL);
|
||||
this.callToActionType = callToActionType;
|
||||
this.txt = CtaText;
|
||||
this.productEditorComp = productEditorComp;
|
||||
|
|
|
@ -116,6 +116,7 @@ import com.raytheon.viz.gfe.core.DataManager;
|
|||
import com.raytheon.viz.gfe.dialogs.formatterlauncher.ConfigData.productStateEnum;
|
||||
import com.raytheon.viz.gfe.product.ProductFileUtil;
|
||||
import com.raytheon.viz.gfe.product.TextDBUtil;
|
||||
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||
|
||||
/**
|
||||
* Composite containing the product editor controls.
|
||||
|
@ -138,6 +139,7 @@ import com.raytheon.viz.gfe.product.TextDBUtil;
|
|||
* 27 OCT 2010 5817 jnjanga Fix N.P.E caused when call getVTECActionCodes on non VTEC products.
|
||||
* 31 AUG 2012 15178 mli Add autoWrite and autoStore capability
|
||||
* 31 AUG 2012 15037 mli Handle bad characters in text formatter definition
|
||||
* 07 Nov 2012 1298 rferrel Changes for non-blocking CallToActionsDlg.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -147,10 +149,10 @@ import com.raytheon.viz.gfe.product.TextDBUtil;
|
|||
*/
|
||||
public class ProductEditorComp extends Composite implements
|
||||
INotificationObserver {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
private final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(ProductEditorComp.class);
|
||||
|
||||
private static final String EMPTY = "";
|
||||
private final String EMPTY = "";
|
||||
|
||||
/**
|
||||
* Parent composite.
|
||||
|
@ -296,27 +298,27 @@ public class ProductEditorComp extends Composite implements
|
|||
|
||||
private String autoSendAddress;
|
||||
|
||||
private String longLocalFmtStr = "hmm a z EEE MMM d yyyy";
|
||||
private final String longLocalFmtStr = "hmm a z EEE MMM d yyyy";
|
||||
|
||||
private TimeZone gmtTimeZone = TimeZone.getTimeZone("GMT");
|
||||
private final TimeZone gmtTimeZone = TimeZone.getTimeZone("GMT");
|
||||
|
||||
private int initialYear = year(SimulatedTime.getSystemTime().getTime());
|
||||
private final int initialYear = year(SimulatedTime.getSystemTime()
|
||||
.getTime());
|
||||
|
||||
// for CTA dialogs
|
||||
private String phenSig = null;
|
||||
|
||||
private boolean HazardCTA = false;
|
||||
|
||||
private boolean ProductCTA = false;
|
||||
|
||||
private boolean GenericCTA = false;
|
||||
private CallToActionsDlg ctaDialog;
|
||||
|
||||
private ProductDataStruct prodDataStruct;
|
||||
|
||||
private TimeZone localTimeZone;
|
||||
|
||||
private enum Action {
|
||||
STORE, TRANSMIT, AUTOSTORE };
|
||||
STORE, TRANSMIT, AUTOSTORE
|
||||
};
|
||||
|
||||
/**
|
||||
* Product transmission callback to report the state of transmitting a
|
||||
|
@ -324,17 +326,17 @@ public class ProductEditorComp extends Composite implements
|
|||
*/
|
||||
private ITransmissionState transmissionCB;
|
||||
|
||||
private SimpleDateFormat purgeTimeFmt = new SimpleDateFormat("ddHHmm");
|
||||
private final SimpleDateFormat purgeTimeFmt = new SimpleDateFormat("ddHHmm");
|
||||
|
||||
private SimpleDateFormat vtecTimeFmt = new SimpleDateFormat(
|
||||
private final SimpleDateFormat vtecTimeFmt = new SimpleDateFormat(
|
||||
"yyMMdd'T'HHmm'Z'");
|
||||
|
||||
private Pattern vtecRE = Pattern
|
||||
private final Pattern vtecRE = Pattern
|
||||
.compile("/[OTEX]\\.([A-Z]{3})\\.([A-Z]{4})\\.([A-Z]{2})\\."
|
||||
+ "([WAYSOFN])\\.([0-9]{4})\\.([0-9]{6})T([0-9]{4})Z-"
|
||||
+ "([0-9]{6})T([0-9]{4})Z/");
|
||||
|
||||
private Map<String, Map<String, Integer>> newYearETNs = new HashMap<String, Map<String, Integer>>();
|
||||
private final Map<String, Map<String, Integer>> newYearETNs = new HashMap<String, Map<String, Integer>>();
|
||||
|
||||
/**
|
||||
* Job to update times in product
|
||||
|
@ -356,14 +358,14 @@ public class ProductEditorComp extends Composite implements
|
|||
REG, PE, COR;
|
||||
}
|
||||
|
||||
private static final String[] REG_PTypes = { "rou", "AAA", "AAB", "AAC",
|
||||
"AAD", "AAE", "RRA", "RRB", "RRC" };
|
||||
private final String[] REG_PTypes = { "rou", "AAA", "AAB", "AAC", "AAD",
|
||||
"AAE", "RRA", "RRB", "RRC" };
|
||||
|
||||
private static final String[] PE_PTypes = { "res", "RRA", "RRB", "RRC" };
|
||||
private final String[] PE_PTypes = { "res", "RRA", "RRB", "RRC" };
|
||||
|
||||
private static final String[] COR_PTypes = { "CCA", "CCB", "CCC" };
|
||||
private final String[] COR_PTypes = { "CCA", "CCB", "CCC" };
|
||||
|
||||
private static final String ZERO_VTEC = "000000T0000Z";
|
||||
private final String ZERO_VTEC = "000000T0000Z";
|
||||
|
||||
private List<ActiveTableRecord> activeVtecRecords = null;
|
||||
|
||||
|
@ -1038,9 +1040,8 @@ public class ProductEditorComp extends Composite implements
|
|||
* Store or Transmit text product.
|
||||
*
|
||||
* @param action
|
||||
* STORE: show the Store dialog
|
||||
* TRANSMITT: shows the Transmit dialog.
|
||||
* AUTOSTORE: implement autoStore
|
||||
* STORE: show the Store dialog TRANSMITT: shows the Transmit
|
||||
* dialog. AUTOSTORE: implement autoStore
|
||||
*/
|
||||
private void storeTransmit(Action action) {
|
||||
|
||||
|
@ -1073,7 +1074,8 @@ public class ProductEditorComp extends Composite implements
|
|||
if (testVTEC) {
|
||||
devStore(textdbPil.substring(3));
|
||||
} else {
|
||||
TextDBUtil.storeProduct(textdbPil, getProductText(), testVTEC);
|
||||
TextDBUtil.storeProduct(textdbPil, getProductText(),
|
||||
testVTEC);
|
||||
}
|
||||
|
||||
return;
|
||||
|
@ -2279,7 +2281,8 @@ public class ProductEditorComp extends Composite implements
|
|||
String fname = null;
|
||||
if (productDefinition.get("outputFile") != null) {
|
||||
fname = getDefString("outputFile");
|
||||
if (fname.equals(EMPTY)) return;
|
||||
if (fname.equals(EMPTY))
|
||||
return;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
@ -2287,8 +2290,7 @@ public class ProductEditorComp extends Composite implements
|
|||
fname = fixfname(fname);
|
||||
|
||||
try {
|
||||
ProductFileUtil.writeFile(getProductText(), new File(
|
||||
fname));
|
||||
ProductFileUtil.writeFile(getProductText(), new File(fname));
|
||||
} catch (IOException e) {
|
||||
MessageBox mb = new MessageBox(parent.getShell(), SWT.OK
|
||||
| SWT.ICON_WARNING);
|
||||
|
@ -2309,8 +2311,7 @@ public class ProductEditorComp extends Composite implements
|
|||
|
||||
private String guessFilename() {
|
||||
if (productDefinition.get("outputFile") != null) {
|
||||
String basename = new File(
|
||||
getDefString("outputFile")).getName();
|
||||
String basename = new File(getDefString("outputFile")).getName();
|
||||
return basename;
|
||||
} else {
|
||||
return guessTDBPil();
|
||||
|
@ -2422,40 +2423,33 @@ public class ProductEditorComp extends Composite implements
|
|||
}
|
||||
|
||||
private void displayCallToActionsDialog(int callToActionType) {
|
||||
// Allow only one of the 3 types of dialogs to be displayed.
|
||||
if (ctaDialog != null && ctaDialog.getShell() != null
|
||||
&& !ctaDialog.isDisposed()) {
|
||||
ctaDialog.bringToTop();
|
||||
return;
|
||||
}
|
||||
|
||||
if (callToActionType == 1) {
|
||||
|
||||
if (!ProductCTA && !GenericCTA && !HazardCTA) {
|
||||
HazardCTA = true;
|
||||
CTAHazCB(callToActionType);
|
||||
HazardCTA = false;
|
||||
}
|
||||
}
|
||||
if (callToActionType == 2) {
|
||||
|
||||
if (!HazardCTA && !GenericCTA && !ProductCTA) {
|
||||
String[] Sig = new String[1];
|
||||
String pil = getDefString("pil");
|
||||
if (pil != null) {
|
||||
Sig[0] = pil.substring(0, 3);
|
||||
ProductCTA = true;
|
||||
CallToActionsDlg productCTAsDlg = new CallToActionsDlg(
|
||||
parent.getShell(), callToActionType, Sig, this);
|
||||
productCTAsDlg.open();
|
||||
ProductCTA = false;
|
||||
}
|
||||
ctaDialog = new CallToActionsDlg(parent.getShell(),
|
||||
callToActionType, Sig, this);
|
||||
ctaDialog.setBlockOnOpen(false);
|
||||
ctaDialog.open();
|
||||
}
|
||||
}
|
||||
if (callToActionType == 3) {
|
||||
|
||||
if (!ProductCTA && !HazardCTA && !GenericCTA) {
|
||||
GenericCTA = true;
|
||||
String[] Sig = new String[1];
|
||||
CallToActionsDlg genericCTAsDlg = new CallToActionsDlg(
|
||||
parent.getShell(), callToActionType, Sig, this);
|
||||
genericCTAsDlg.open();
|
||||
GenericCTA = false;
|
||||
}
|
||||
ctaDialog = new CallToActionsDlg(parent.getShell(),
|
||||
callToActionType, Sig, this);
|
||||
ctaDialog.setBlockOnOpen(false);
|
||||
ctaDialog.open();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2560,9 +2554,22 @@ public class ProductEditorComp extends Composite implements
|
|||
}
|
||||
}
|
||||
}// loop
|
||||
CallToActionsDlg hazardCTAsDlg = new CallToActionsDlg(
|
||||
parent.getShell(), callToActionType, Sig, this);
|
||||
hazardCTAsDlg.open();
|
||||
|
||||
HazardCTA = true;
|
||||
ctaDialog = new CallToActionsDlg(parent.getShell(),
|
||||
callToActionType, Sig, this);
|
||||
ctaDialog.setBlockOnOpen(false);
|
||||
ctaDialog.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
HazardCTA = false;
|
||||
ctaDialog = null;
|
||||
}
|
||||
});
|
||||
ctaDialog.open();
|
||||
// Found segment the cursor is in no need to check more segments.
|
||||
break;
|
||||
}// loop
|
||||
}
|
||||
|
||||
|
@ -2571,8 +2578,6 @@ public class ProductEditorComp extends Composite implements
|
|||
textEditorST = getTextEditorST();
|
||||
prodDataStruct = textComp.getProductDataStruct();
|
||||
|
||||
String product = getProductText();
|
||||
|
||||
int offset = textEditorST.getCaretOffset();
|
||||
if (offset >= (textEditorST.getCharCount() - 1)) {
|
||||
return;
|
||||
|
|
Loading…
Add table
Reference in a new issue