Issue #2176 Implemented emergency warning products.
Change-Id: Icde169adbcfc5c409319649d63d222044a35dae2 Former-commit-id:7d74ba5ee1
[formerly7d74ba5ee1
[formerly 36df6339cc00afc5935746a4a47b0e9e8c641f85]] Former-commit-id:67ce90c14a
Former-commit-id:4b38e3786d
This commit is contained in:
parent
90866d6c06
commit
869fbdc7fc
10 changed files with 833 additions and 352 deletions
|
@ -24,7 +24,8 @@ Require-Bundle: org.eclipse.ui,
|
|||
com.raytheon.uf.common.site;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0",
|
||||
com.raytheon.uf.viz.localization,
|
||||
com.raytheon.uf.common.auth;bundle-version="1.12.1174"
|
||||
com.raytheon.uf.common.auth;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.dataplugin.warning;bundle-version="1.12.1174"
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: com.raytheon.viz.texteditor,
|
||||
com.raytheon.viz.texteditor.alarmalert.dialogs,
|
||||
|
|
|
@ -0,0 +1,196 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.viz.texteditor.dialogs;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.activetable.ActiveTableMode;
|
||||
import com.raytheon.uf.common.activetable.ActiveTableRecord;
|
||||
import com.raytheon.uf.common.activetable.GetActiveTableRequest;
|
||||
import com.raytheon.uf.common.activetable.GetActiveTableResponse;
|
||||
import com.raytheon.uf.common.dataplugin.warning.WarningRecord.WarningAction;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
import com.raytheon.viz.core.mode.CAVEMode;
|
||||
import com.raytheon.viz.texteditor.util.VtecObject;
|
||||
import com.raytheon.viz.texteditor.util.VtecUtil;
|
||||
|
||||
/**
|
||||
* Produces the product message and mode message for the warngen confirmation
|
||||
* dialog for emergency warnings.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 23, 2013 2176 jsanchez Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author jsanchez
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class EmergencyConfirmationMsg implements IWarnGenConfirmationable {
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(EmergencyConfirmationMsg.class);
|
||||
|
||||
private String productMessage;
|
||||
|
||||
private static class EmergencyType {
|
||||
|
||||
private static final EmergencyType TORNADO = new EmergencyType(
|
||||
"TORNADO EMERGENCY", "TO.W");
|
||||
|
||||
private static final EmergencyType FLASH_FLOOD = new EmergencyType(
|
||||
"FLASH FLOOD EMERGENCY", "FF.W");
|
||||
|
||||
private final String value;
|
||||
|
||||
private final String phensig;
|
||||
|
||||
private final static EmergencyType[] values = new EmergencyType[] {
|
||||
TORNADO, FLASH_FLOOD };
|
||||
|
||||
private EmergencyType(String type, String phensig) {
|
||||
this.value = type;
|
||||
this.phensig = phensig;
|
||||
}
|
||||
|
||||
public static EmergencyType valueOf(String phensig) {
|
||||
EmergencyType type = null;
|
||||
for (EmergencyType t : values) {
|
||||
if (t.phensig.equals(phensig)) {
|
||||
type = t;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return type;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Orders the ActiveTableRecord based on the issue time (ascending)
|
||||
*/
|
||||
private class ActiveTableRecordComparator implements
|
||||
Comparator<ActiveTableRecord> {
|
||||
|
||||
@Override
|
||||
public int compare(ActiveTableRecord o1, ActiveTableRecord o2) {
|
||||
return o1.getIssueTime().compareTo(o2.getIssueTime());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkWarningInfo(String header, String body, String nnn) {
|
||||
VtecObject vtec = VtecUtil.parseMessage(body);
|
||||
EmergencyType type = null;
|
||||
WarningAction action = null;
|
||||
if (vtec != null) {
|
||||
type = EmergencyType.valueOf(vtec.getPhensig());
|
||||
action = WarningAction.valueOf(vtec.getAction());
|
||||
if (action == WarningAction.CAN && body.split("\\$\\$").length > 2) {
|
||||
// It is possible for a warning products to have two segments: a
|
||||
// CAN and a CON.'$$' denotes the end of one segment. VtecUtil
|
||||
// only grabs the first VTEC. If there are multiple segments CAN
|
||||
// should always be the first VTEC
|
||||
action = WarningAction.CANCON;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the warning product is a valid EmergencyType.
|
||||
if (type != null) {
|
||||
boolean currentEmergency = body.contains("EMERGENCY");
|
||||
if (action == WarningAction.NEW && currentEmergency) {
|
||||
// Only occurs when the warning is first issued and not any
|
||||
// other action
|
||||
productMessage = "This is a " + type.value;
|
||||
} else if (action == WarningAction.CON
|
||||
|| action == WarningAction.EXT
|
||||
|| action == WarningAction.CANCON) {
|
||||
// Check if the warning was an upgrade or downgrade in the
|
||||
// emergency warning for continuation, extension (FFW), or a
|
||||
// cancel
|
||||
// and continuation.
|
||||
GetActiveTableRequest request = new GetActiveTableRequest();
|
||||
if (CAVEMode.getMode().equals(CAVEMode.PRACTICE)) {
|
||||
request.setMode(ActiveTableMode.PRACTICE);
|
||||
} else {
|
||||
request.setMode(ActiveTableMode.OPERATIONAL);
|
||||
}
|
||||
request.setSiteID(vtec.getOffice());
|
||||
request.setPhensigList(vtec.getPhensig());
|
||||
request.setEtn(String.format("%04d", vtec.getSequence()));
|
||||
try {
|
||||
GetActiveTableResponse response = (GetActiveTableResponse) ThriftClient
|
||||
.sendRequest(request);
|
||||
List<ActiveTableRecord> records = response.getActiveTable();
|
||||
// There should be existing records since this is for follow
|
||||
// ups. This is just a precaution
|
||||
if (records != null && !records.isEmpty()) {
|
||||
// Get latest active table record
|
||||
Collections.sort(records,
|
||||
new ActiveTableRecordComparator());
|
||||
ActiveTableRecord record = records
|
||||
.get(records.size() - 1);
|
||||
boolean wasEmergency = record.getRawmessage().contains(
|
||||
"EMERGENCY");
|
||||
if (!wasEmergency && currentEmergency) {
|
||||
productMessage = "This is an upgrade of a "
|
||||
+ type.value;
|
||||
} else if (wasEmergency && !currentEmergency) {
|
||||
productMessage = "This is a downgrade of a "
|
||||
+ type.value;
|
||||
}
|
||||
}
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.ERROR,
|
||||
"Error making request to active table.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return productMessage == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return "Severe Weather Product";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProductMessage() {
|
||||
return productMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModeMessage() {
|
||||
return "Should we proceed?\n";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.viz.texteditor.dialogs;
|
||||
|
||||
/**
|
||||
* Interface to retrieve the WarnGen Confirmation Dialog message values.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 23, 2013 2176 jsanchez Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author jsanchez
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface IWarnGenConfirmationable {
|
||||
/**
|
||||
* Returns true if the WarnGen Confirmation Dialog needs to pop-up.
|
||||
*
|
||||
* @param header
|
||||
* @param body
|
||||
* @param nnn
|
||||
* @return
|
||||
*/
|
||||
public boolean checkWarningInfo(String header, String body, String nnn);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the title for the WarnGen Confirmation Dialog
|
||||
*/
|
||||
public String getTitle();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the product message in the WarnGen Confirmation Dialog
|
||||
*/
|
||||
public String getProductMessage();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the mode message in the WarnGen Confirmation Dialog
|
||||
*/
|
||||
public String getModeMessage();
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.viz.texteditor.dialogs;
|
||||
|
||||
import com.raytheon.viz.texteditor.qc.QualityControl;
|
||||
|
||||
/**
|
||||
* Produces the product message and mode message for the warngen confirmation
|
||||
* dialog for warnings failing QC.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 23, 2013 2176 jsanchez Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author jsanchez
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class QCConfirmationMsg implements IWarnGenConfirmationable {
|
||||
|
||||
private QualityControl qcCheck = new QualityControl();
|
||||
|
||||
@Override
|
||||
public boolean checkWarningInfo(String header, String body, String nnn) {
|
||||
return qcCheck.checkWarningInfo(header, body, nnn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return "Problem Detected by QC";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProductMessage() {
|
||||
return qcCheck.getErrorMessage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModeMessage() {
|
||||
return "Do you really want to Send?\n";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.viz.texteditor.dialogs;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.raytheon.viz.core.mode.CAVEMode;
|
||||
import com.raytheon.viz.texteditor.qc.QualityControl;
|
||||
|
||||
/**
|
||||
* Produces the product message and mode message for the warngen confirmation
|
||||
* dialog for sending a warning.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 23, 2013 2176 jsanchez Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author jsanchez
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SendConfirmationMsg implements IWarnGenConfirmationable {
|
||||
|
||||
private String title;
|
||||
|
||||
private boolean resend;
|
||||
|
||||
private String afosId;
|
||||
|
||||
public SendConfirmationMsg(boolean resend, String afosId, String nnn) {
|
||||
this.resend = resend;
|
||||
this.afosId = afosId;
|
||||
title = QualityControl.getProductWarningType(nnn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkWarningInfo(String header, String body, String nnn) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProductMessage() {
|
||||
StringBuilder productMessage = new StringBuilder();
|
||||
if (resend) {
|
||||
productMessage.append("You are about to RESEND a " + afosId + "\n");
|
||||
productMessage.append(title).append(".\n");
|
||||
} else {
|
||||
productMessage.append("You are about to SEND a " + afosId + "\n");
|
||||
productMessage.append(title).append(".\n");
|
||||
}
|
||||
return productMessage.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModeMessage() {
|
||||
CAVEMode mode = CAVEMode.getMode();
|
||||
StringBuilder modeMessage = new StringBuilder();
|
||||
modeMessage.append("The workstation is in ").append(mode)
|
||||
.append(" mode.");
|
||||
if (resend) {
|
||||
modeMessage.append("\nThere is no QC check for resend product.");
|
||||
}
|
||||
|
||||
Pattern p = Pattern.compile(".\\%[s].");
|
||||
Matcher m = p.matcher(TextEditorDialog.STORED_SENT_MSG);
|
||||
boolean result = (CAVEMode.OPERATIONAL.equals(mode) || CAVEMode.TEST
|
||||
.equals(mode));
|
||||
modeMessage.append(result ? m.replaceAll(" ") : m.replaceAll(" not "));
|
||||
|
||||
return modeMessage.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -85,8 +85,8 @@ import org.eclipse.swt.events.ShellAdapter;
|
|||
import org.eclipse.swt.events.ShellEvent;
|
||||
import org.eclipse.swt.events.VerifyEvent;
|
||||
import org.eclipse.swt.events.VerifyListener;
|
||||
import org.eclipse.swt.graphics.Cursor;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.Cursor;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
import org.eclipse.swt.graphics.FontData;
|
||||
import org.eclipse.swt.graphics.FontMetrics;
|
||||
|
@ -100,7 +100,6 @@ import org.eclipse.swt.layout.RowLayout;
|
|||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.FileDialog;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
|
@ -142,7 +141,6 @@ import com.raytheon.uf.common.time.SimulatedTime;
|
|||
import com.raytheon.uf.edex.decodertools.time.TimeTools;
|
||||
import com.raytheon.uf.edex.services.textdbsrv.IQueryTransport;
|
||||
import com.raytheon.uf.edex.wmo.message.WMOHeader;
|
||||
// import com.raytheon.uf.viz.core.RGBColors;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.auth.UserController;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
@ -176,7 +174,6 @@ import com.raytheon.viz.texteditor.msgs.ITextEditorCallback;
|
|||
import com.raytheon.viz.texteditor.msgs.IWmoBrowserCallback;
|
||||
import com.raytheon.viz.texteditor.notify.NotifyExpiration;
|
||||
import com.raytheon.viz.texteditor.print.PrintDisplay;
|
||||
import com.raytheon.viz.texteditor.qc.QualityControl;
|
||||
import com.raytheon.viz.texteditor.scripting.dialogs.IScriptEditor;
|
||||
import com.raytheon.viz.texteditor.scripting.dialogs.IScriptEditorObserver;
|
||||
import com.raytheon.viz.texteditor.scripting.dialogs.ScriptEditorDialog;
|
||||
|
@ -191,6 +188,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||
import com.raytheon.viz.ui.dialogs.SWTMessageBox;
|
||||
|
||||
// import com.raytheon.uf.viz.core.RGBColors;
|
||||
|
||||
/**
|
||||
* Main Text Editor dialog.
|
||||
*
|
||||
|
@ -328,6 +327,7 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox;
|
|||
* *.xml files in localization;
|
||||
* add selection listener to catch the highlight words and
|
||||
* set the highlight colors.
|
||||
* 23Jul2013 2176 jsanchez Added a new confirmation message for emergency warnings.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -378,8 +378,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
|
||||
private final int HIGHLIGHT_BG = SWT.COLOR_RED;
|
||||
|
||||
// Color red = shell.getDisplay().getSystemColor(SWT.COLOR_RED);
|
||||
// Color black = shell.getDisplay().getSystemColor(SWT.COLOR_BLACK);
|
||||
// Color red = shell.getDisplay().getSystemColor(SWT.COLOR_RED);
|
||||
// Color black = shell.getDisplay().getSystemColor(SWT.COLOR_BLACK);
|
||||
|
||||
/**
|
||||
* The length of BEGIN_ELEMENT_TAG.
|
||||
|
@ -791,19 +791,19 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
/**
|
||||
* Small font menu item.
|
||||
*/
|
||||
// private MenuItem smallFontItem;
|
||||
// private MenuItem smallFontItem;
|
||||
|
||||
/**
|
||||
* Medium font menu item.
|
||||
*/
|
||||
// private MenuItem mediumFontItem;
|
||||
// private MenuItem mediumFontItem;
|
||||
|
||||
/**
|
||||
* Large font menu item.
|
||||
*/
|
||||
// private MenuItem largeFontItem;
|
||||
// private MenuItem largeFontItem;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Overstrike (overwrite) menu item.
|
||||
*/
|
||||
private MenuItem overStrikeItem;
|
||||
|
@ -1304,7 +1304,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
* Currently active popupItems.
|
||||
*/
|
||||
private static final boolean[] isPopItemDefault = { true, false, true,
|
||||
false };
|
||||
false };
|
||||
|
||||
/**
|
||||
* Indictes this instance of dialog if for a warnGen.
|
||||
|
@ -1384,12 +1384,14 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
private boolean isPreviousLineWrapped;
|
||||
|
||||
private Color textForeground;
|
||||
|
||||
private Color textBackground;
|
||||
|
||||
private Color highlightForeground;
|
||||
|
||||
private Color highlightBackground;
|
||||
|
||||
// protected Color color;
|
||||
|
||||
// protected Color color;
|
||||
|
||||
/**
|
||||
* Constructor with additional cave style rules
|
||||
|
@ -2872,7 +2874,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
private void createAutoWrapSubMenu(Menu autoWrapSubMenu) {
|
||||
AutoWrapCfg autoWrapcfg = getAutoWrapCfg();
|
||||
for (WrapButtonCfg buttonCfg : autoWrapcfg.getButtons()) {
|
||||
MenuItem item = new MenuItem(autoWrapSubMenu, SWT.RADIO);
|
||||
MenuItem item = new MenuItem(autoWrapSubMenu, SWT.RADIO);
|
||||
item.setText(buttonCfg.getLabelName());
|
||||
item.setSelection(buttonCfg.isSelected());
|
||||
item.setData(buttonCfg);
|
||||
|
@ -2960,110 +2962,111 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
* The font size sub menu.
|
||||
*/
|
||||
private void createFontSizeSubMenu(Menu fontSizeSubMenu) {
|
||||
int selectFontSize = DEFAULT_FUNT_SIZE;
|
||||
int selectFontSize = DEFAULT_FUNT_SIZE;
|
||||
|
||||
FontSizeCfg fontSizeCfg = getFontSizeCfg();
|
||||
for (SizeButtonCfg buttonCfg : fontSizeCfg.getButtons()) {
|
||||
FontSizeCfg fontSizeCfg = getFontSizeCfg();
|
||||
for (SizeButtonCfg buttonCfg : fontSizeCfg.getButtons()) {
|
||||
MenuItem item = new MenuItem(fontSizeSubMenu, SWT.RADIO);
|
||||
item.setText(buttonCfg.getLabelName());
|
||||
item.setSelection(buttonCfg.isSelected());
|
||||
item.setData(buttonCfg);
|
||||
if (buttonCfg.isSizeEnabled() && buttonCfg.isSelected()) {
|
||||
selectFontSize = buttonCfg.getFontSize();
|
||||
item.setSelection(true);
|
||||
setDefaultFont(selectFontSize);
|
||||
selectFontSize = buttonCfg.getFontSize();
|
||||
item.setSelection(true);
|
||||
setDefaultFont(selectFontSize);
|
||||
}
|
||||
|
||||
item.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
MenuItem item = (MenuItem) event.getSource();
|
||||
if (item.getSelection()) {
|
||||
int selectFontSize = ( (SizeButtonCfg) item.getData()).getFontSize();
|
||||
setDefaultFont(selectFontSize);
|
||||
MenuItem item = (MenuItem) event.getSource();
|
||||
if (item.getSelection()) {
|
||||
int selectFontSize = ((SizeButtonCfg) item.getData())
|
||||
.getFontSize();
|
||||
setDefaultFont(selectFontSize);
|
||||
|
||||
textEditor.setFont(dftFont);
|
||||
headerTF.setFont(dftFont);
|
||||
}
|
||||
textEditor.setFont(dftFont);
|
||||
headerTF.setFont(dftFont);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private FontSizeCfg getFontSizeCfg() {
|
||||
FontSizeCfg fontSizeCfg = null;
|
||||
private FontSizeCfg getFontSizeCfg() {
|
||||
FontSizeCfg fontSizeCfg = null;
|
||||
|
||||
try {
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
File path = pm.getStaticFile("textws/gui/FontSizeCfg.xml");
|
||||
fontSizeCfg = JAXB.unmarshal(path, FontSizeCfg.class);
|
||||
try {
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
File path = pm.getStaticFile("textws/gui/FontSizeCfg.xml");
|
||||
fontSizeCfg = JAXB.unmarshal(path, FontSizeCfg.class);
|
||||
|
||||
} catch (Exception e) {
|
||||
IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(TextEditorDialog.class);
|
||||
statusHandler.handle(Priority.ERROR,
|
||||
"Unable to parse Autowrap menu configuration.", e);
|
||||
fontSizeCfg = new FontSizeCfg();
|
||||
} catch (Exception e) {
|
||||
IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(TextEditorDialog.class);
|
||||
statusHandler.handle(Priority.ERROR,
|
||||
"Unable to parse Autowrap menu configuration.", e);
|
||||
fontSizeCfg = new FontSizeCfg();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Perform Sanity Checks on configuration.
|
||||
StringBuilder message = new StringBuilder();
|
||||
// Perform Sanity Checks on configuration.
|
||||
StringBuilder message = new StringBuilder();
|
||||
|
||||
// Check buttonCfg values.
|
||||
int selectionCnt = 0;
|
||||
String selectionLabel = null;
|
||||
if (fontSizeCfg.getButtons() != null) {
|
||||
for (SizeButtonCfg buttonCfg : fontSizeCfg.getButtons()) {
|
||||
if (buttonCfg.isSelected()) {
|
||||
++selectionCnt;
|
||||
if (selectionCnt == 1) {
|
||||
selectionLabel = buttonCfg.getLabelName();
|
||||
} else {
|
||||
buttonCfg.setSelected(false);
|
||||
}
|
||||
}
|
||||
// Check buttonCfg values.
|
||||
int selectionCnt = 0;
|
||||
String selectionLabel = null;
|
||||
if (fontSizeCfg.getButtons() != null) {
|
||||
for (SizeButtonCfg buttonCfg : fontSizeCfg.getButtons()) {
|
||||
if (buttonCfg.isSelected()) {
|
||||
++selectionCnt;
|
||||
if (selectionCnt == 1) {
|
||||
selectionLabel = buttonCfg.getLabelName();
|
||||
} else {
|
||||
buttonCfg.setSelected(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (buttonCfg.isSizeEnabled()) {
|
||||
int fntSize = buttonCfg.getFontSize();
|
||||
if (fntSize <= 0) {
|
||||
message.append("Item \"")
|
||||
.append(buttonCfg.getLabelName())
|
||||
.append("\" bad fntSize value (")
|
||||
.append(buttonCfg.getFontSize())
|
||||
.append(") changing to ")
|
||||
.append(DEFAULT_FUNT_SIZE).append("\n");
|
||||
buttonCfg.setFontSize(DEFAULT_FUNT_SIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (buttonCfg.isSizeEnabled()) {
|
||||
int fntSize = buttonCfg.getFontSize();
|
||||
if (fntSize <= 0) {
|
||||
message.append("Item \"")
|
||||
.append(buttonCfg.getLabelName())
|
||||
.append("\" bad fntSize value (")
|
||||
.append(buttonCfg.getFontSize())
|
||||
.append(") changing to ")
|
||||
.append(DEFAULT_FUNT_SIZE).append("\n");
|
||||
buttonCfg.setFontSize(DEFAULT_FUNT_SIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (selectionCnt == 0 && fontSizeCfg.getButtons().size() > 0) {
|
||||
SizeButtonCfg buttonCfg = fontSizeCfg.getButtons().get(0);
|
||||
message.append("No button selected. Selecting top item \"")
|
||||
.append(buttonCfg.getLabelName()).append("\"\n");
|
||||
buttonCfg.setSelected(true);
|
||||
} else if (selectionCnt > 1) {
|
||||
message.append(selectionCnt)
|
||||
.append(" items selected; will select item \"")
|
||||
.append(selectionLabel).append("\"\n");
|
||||
}
|
||||
if (selectionCnt == 0 && fontSizeCfg.getButtons().size() > 0) {
|
||||
SizeButtonCfg buttonCfg = fontSizeCfg.getButtons().get(0);
|
||||
message.append("No button selected. Selecting top item \"")
|
||||
.append(buttonCfg.getLabelName()).append("\"\n");
|
||||
buttonCfg.setSelected(true);
|
||||
} else if (selectionCnt > 1) {
|
||||
message.append(selectionCnt)
|
||||
.append(" items selected; will select item \"")
|
||||
.append(selectionLabel).append("\"\n");
|
||||
}
|
||||
|
||||
if (message.length() > 0) {
|
||||
message.insert(0, "FontSize problem(s): ");
|
||||
IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(TextEditorDialog.class);
|
||||
statusHandler.handle(Priority.PROBLEM, message.toString());
|
||||
}
|
||||
}
|
||||
if (message.length() > 0) {
|
||||
message.insert(0, "FontSize problem(s): ");
|
||||
IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(TextEditorDialog.class);
|
||||
statusHandler.handle(Priority.PROBLEM, message.toString());
|
||||
}
|
||||
}
|
||||
|
||||
return fontSizeCfg;
|
||||
return fontSizeCfg;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void setDefaultFont(int fontSize) {
|
||||
dftFont = new Font(getDisplay(), "Courier", fontSize, SWT.NORMAL);
|
||||
dftFont = new Font(getDisplay(), "Courier", fontSize, SWT.NORMAL);
|
||||
|
||||
}
|
||||
|
||||
|
@ -3835,19 +3838,20 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
textEditor.addSelectionListener(new SelectionListener() {
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
System.out.println("\ntextEditor default selection event --" + e.toString());
|
||||
System.out.println("\ntextEditor default selection event --"
|
||||
+ e.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
|
||||
StyledText stylText = (StyledText) e.getSource();
|
||||
StyledText stylText = (StyledText) e.getSource();
|
||||
|
||||
// String slctText = stylText.getSelectionText();
|
||||
// int length = slctText.length();
|
||||
// String slctText = stylText.getSelectionText();
|
||||
// int length = slctText.length();
|
||||
|
||||
stylText.setSelectionBackground(highlightBackground);
|
||||
stylText.setSelectionForeground(highlightForeground);
|
||||
stylText.setSelectionBackground(highlightBackground);
|
||||
stylText.setSelectionForeground(highlightForeground);
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -3916,8 +3920,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
public void verifyKey(VerifyEvent event) {
|
||||
// Ignore edit keys when not in edit mode.
|
||||
if (textEditor.getEditable() == false) {
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (event.keyCode == SWT.DEL || event.keyCode == SWT.BS
|
||||
|| event.keyCode == SWT.SHIFT) {
|
||||
// Do nothing...
|
||||
|
@ -4017,7 +4021,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
}
|
||||
|
||||
if (e.button == 3) {
|
||||
processPopup();
|
||||
processPopup();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4050,14 +4054,14 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
StringBuilder message = new StringBuilder();
|
||||
|
||||
for (TextColorElement textElm : textColorsCfg.getTextColorElements()) {
|
||||
String prmtName = textElm.getParamName();
|
||||
String prmtName = textElm.getParamName();
|
||||
if (prmtName == null) {
|
||||
message.append("Item \"paramName\" problem!\n");
|
||||
message.append("Item \"paramName\" problem!\n");
|
||||
|
||||
}
|
||||
|
||||
if( textElm.getColor() == null ) {
|
||||
message.append("Item \"color\" data enter problem!\n");
|
||||
if (textElm.getColor() == null) {
|
||||
message.append("Item \"color\" data enter problem!\n");
|
||||
}
|
||||
|
||||
if (message.length() > 0) {
|
||||
|
@ -4067,92 +4071,97 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
statusHandler.handle(Priority.PROBLEM, message.toString());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return textColorsCfg;
|
||||
return textColorsCfg;
|
||||
|
||||
}
|
||||
|
||||
private void setDefaultTextColor(TextColorsCfg clrCfg) {
|
||||
|
||||
for (TextColorElement textElm : clrCfg.getTextColorElements()) {
|
||||
for (TextColorElement textElm : clrCfg.getTextColorElements()) {
|
||||
|
||||
String paramName = textElm.getParamName().trim();
|
||||
if( paramName.equalsIgnoreCase("textBG")) {
|
||||
if ( textElm.getColor() != null)
|
||||
textBackground = new Color(shell.getDisplay(), textElm.getColor());
|
||||
else
|
||||
textBackground = shell.getDisplay().getSystemColor(UPDATE_BG);
|
||||
String paramName = textElm.getParamName().trim();
|
||||
if (paramName.equalsIgnoreCase("textBG")) {
|
||||
if (textElm.getColor() != null)
|
||||
textBackground = new Color(shell.getDisplay(),
|
||||
textElm.getColor());
|
||||
else
|
||||
textBackground = shell.getDisplay().getSystemColor(
|
||||
UPDATE_BG);
|
||||
|
||||
}
|
||||
else if( paramName.equalsIgnoreCase("textFG")) {
|
||||
if ( textElm.getColor() != null)
|
||||
textForeground = new Color(shell.getDisplay(), textElm.getColor());
|
||||
else
|
||||
textForeground = shell.getDisplay().getSystemColor(UPDATE_FG);
|
||||
}
|
||||
else if( paramName.equalsIgnoreCase("highlightBG")) {
|
||||
if ( textElm.getColor() != null)
|
||||
highlightBackground = new Color(shell.getDisplay(), textElm.getColor());
|
||||
else
|
||||
highlightBackground = shell.getDisplay().getSystemColor(HIGHLIGHT_BG);
|
||||
}
|
||||
else if( paramName.equalsIgnoreCase("highlightFG")) {
|
||||
if ( textElm.getColor() != null)
|
||||
highlightForeground = new Color(shell.getDisplay(), textElm.getColor());
|
||||
else
|
||||
highlightForeground = shell.getDisplay().getSystemColor(UPDATE_FG);
|
||||
}
|
||||
} else if (paramName.equalsIgnoreCase("textFG")) {
|
||||
if (textElm.getColor() != null)
|
||||
textForeground = new Color(shell.getDisplay(),
|
||||
textElm.getColor());
|
||||
else
|
||||
textForeground = shell.getDisplay().getSystemColor(
|
||||
UPDATE_FG);
|
||||
} else if (paramName.equalsIgnoreCase("highlightBG")) {
|
||||
if (textElm.getColor() != null)
|
||||
highlightBackground = new Color(shell.getDisplay(),
|
||||
textElm.getColor());
|
||||
else
|
||||
highlightBackground = shell.getDisplay().getSystemColor(
|
||||
HIGHLIGHT_BG);
|
||||
} else if (paramName.equalsIgnoreCase("highlightFG")) {
|
||||
if (textElm.getColor() != null)
|
||||
highlightForeground = new Color(shell.getDisplay(),
|
||||
textElm.getColor());
|
||||
else
|
||||
highlightForeground = shell.getDisplay().getSystemColor(
|
||||
UPDATE_FG);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the user choice from the popup list. DR14842 - re-written
|
||||
*/
|
||||
private void processPopup() {
|
||||
Menu menu = new Menu(shell, SWT.POP_UP);
|
||||
List<String> items = Arrays.asList(popupItems);
|
||||
for (String pi : popupItems) {
|
||||
MenuItem mi = new MenuItem(menu, SWT.PUSH);
|
||||
mi.setText(pi);
|
||||
if (isEditMode()) {
|
||||
mi.setEnabled(true);
|
||||
} else {
|
||||
mi.setEnabled(isPopItemDefault[items.indexOf(pi)]);
|
||||
}
|
||||
mi.addListener(SWT.Selection, new Listener() {
|
||||
private void processPopup() {
|
||||
Menu menu = new Menu(shell, SWT.POP_UP);
|
||||
List<String> items = Arrays.asList(popupItems);
|
||||
for (String pi : popupItems) {
|
||||
MenuItem mi = new MenuItem(menu, SWT.PUSH);
|
||||
mi.setText(pi);
|
||||
if (isEditMode()) {
|
||||
mi.setEnabled(true);
|
||||
} else {
|
||||
mi.setEnabled(isPopItemDefault[items.indexOf(pi)]);
|
||||
}
|
||||
mi.addListener(SWT.Selection, new Listener() {
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
handleSelection(event);
|
||||
}
|
||||
});
|
||||
}
|
||||
menu.setVisible(true);
|
||||
}
|
||||
public void handleEvent(Event event) {
|
||||
handleSelection(event);
|
||||
}
|
||||
});
|
||||
}
|
||||
menu.setVisible(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the selection from the popup menu
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
protected void handleSelection(Event event) {
|
||||
MenuItem item = (MenuItem) event.widget;
|
||||
String choice = item.getText();
|
||||
if (choice != null) {
|
||||
if (popupItems[0].equals(choice)) {
|
||||
textEditor.selectAll();
|
||||
} else if (popupItems[1].equals(choice)) {
|
||||
cutText();
|
||||
} else if (popupItems[2].equals(choice)) {
|
||||
copyText();
|
||||
} else if (popupItems[3].equals(choice)) {
|
||||
pasteText();
|
||||
}
|
||||
textEditor.update();
|
||||
}
|
||||
}
|
||||
protected void handleSelection(Event event) {
|
||||
MenuItem item = (MenuItem) event.widget;
|
||||
String choice = item.getText();
|
||||
if (choice != null) {
|
||||
if (popupItems[0].equals(choice)) {
|
||||
textEditor.selectAll();
|
||||
} else if (popupItems[1].equals(choice)) {
|
||||
cutText();
|
||||
} else if (popupItems[2].equals(choice)) {
|
||||
copyText();
|
||||
} else if (popupItems[3].equals(choice)) {
|
||||
pasteText();
|
||||
}
|
||||
textEditor.update();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* creates the bar containing the script runner controls.
|
||||
|
@ -4967,47 +4976,31 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
* true if product is to be resent
|
||||
*/
|
||||
synchronized private void sendProduct(final boolean resend) {
|
||||
final CAVEMode mode = CAVEMode.getMode();
|
||||
StdTextProduct prod = getStdTextProduct();
|
||||
String afosId = prod.getCccid() + prod.getNnnid() + prod.getXxxid();
|
||||
final String title = QualityControl.getProductWarningType(prod
|
||||
.getNnnid());
|
||||
final StringBuilder productMessage = new StringBuilder();
|
||||
|
||||
final StringBuilder modeMessage = new StringBuilder();
|
||||
modeMessage.append("The workstation is in ").append(mode)
|
||||
.append(" mode.");
|
||||
|
||||
if (resend) {
|
||||
productMessage.append("You are about to RESEND a " + afosId + "\n");
|
||||
productMessage.append(title).append(".\n");
|
||||
modeMessage.append("\nThere is no QC check for resend product.");
|
||||
} else if (warnGenFlag) {
|
||||
productMessage.append("You are about to SEND a " + afosId + "\n");
|
||||
productMessage.append(title).append(".\n");
|
||||
|
||||
QualityControl qcCheck = new QualityControl();
|
||||
if (qcCheck.checkWarningInfo(headerTF.getText().toUpperCase(),
|
||||
textEditor.getText().toUpperCase(), prod.getNnnid()) == false) {
|
||||
if (warnGenFlag) {
|
||||
QCConfirmationMsg qcMsg = new QCConfirmationMsg();
|
||||
if (!qcMsg.checkWarningInfo(headerTF.getText().toUpperCase(),
|
||||
textEditor.getText().toUpperCase(), prod.getNnnid())) {
|
||||
WarnGenConfirmationDlg wgcd = new WarnGenConfirmationDlg(shell,
|
||||
"Problem Detected by QC", qcCheck.getErrorMessage(),
|
||||
"Do you really want to Send?\n", mode);
|
||||
qcMsg.getTitle(), qcMsg.getProductMessage(),
|
||||
qcMsg.getModeMessage());
|
||||
wgcd.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (Boolean.TRUE.equals(returnValue))
|
||||
finishSendProduct(resend, title, mode,
|
||||
productMessage, modeMessage);
|
||||
if (Boolean.TRUE.equals(returnValue)) {
|
||||
checkEmergencyProduct(resend);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
wgcd.open();
|
||||
|
||||
return;
|
||||
} else {
|
||||
checkEmergencyProduct(resend);
|
||||
}
|
||||
} else {
|
||||
finishSendProduct(resend);
|
||||
}
|
||||
finishSendProduct(resend, title, mode, productMessage, modeMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5016,21 +5009,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
* the WarnGen being sent.
|
||||
*
|
||||
* @param resend
|
||||
* @param title
|
||||
* @param mode
|
||||
* @param productMessage
|
||||
* @param modeMessage
|
||||
*/
|
||||
private void finishSendProduct(final boolean resend, String title,
|
||||
CAVEMode mode, StringBuilder productMessage,
|
||||
StringBuilder modeMessage) {
|
||||
Pattern p = Pattern.compile(".\\%[s].");
|
||||
Matcher m = p.matcher(STORED_SENT_MSG);
|
||||
|
||||
final boolean result = (CAVEMode.OPERATIONAL.equals(mode) || CAVEMode.TEST
|
||||
.equals(mode));
|
||||
modeMessage.append(result ? m.replaceAll(" ") : m.replaceAll(" not "));
|
||||
|
||||
private void finishSendProduct(final boolean resend) {
|
||||
if (statusBarLabel.getText().startsWith("Attachment:")) {
|
||||
StringBuilder sb = new StringBuilder("An Attachment file (");
|
||||
int startIndex = "Attachment:".length() + 1;
|
||||
|
@ -5053,21 +5033,58 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
if (!verifyRequiredFields()) {
|
||||
return;
|
||||
}
|
||||
StdTextProduct prod = getStdTextProduct();
|
||||
String afosId = prod.getCccid() + prod.getNnnid() + prod.getXxxid();
|
||||
SendConfirmationMsg sendMsg = new SendConfirmationMsg(resend, afosId,
|
||||
prod.getNnnid());
|
||||
|
||||
WarnGenConfirmationDlg wgcd = new WarnGenConfirmationDlg(shell, title,
|
||||
productMessage.toString(), modeMessage.toString(), mode);
|
||||
WarnGenConfirmationDlg wgcd = new WarnGenConfirmationDlg(shell,
|
||||
sendMsg.getTitle(), sendMsg.getProductMessage(),
|
||||
sendMsg.getModeMessage());
|
||||
wgcd.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (Boolean.TRUE.equals(returnValue)) {
|
||||
warngenCloseCallback(resend, result);
|
||||
warngenCloseCallback(resend);
|
||||
}
|
||||
}
|
||||
});
|
||||
wgcd.open();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the product is a emergency warning product and opens up the
|
||||
* WarnGen Confirmation Dialog if necessary.
|
||||
*
|
||||
* @param resend
|
||||
* true if product is to be resent
|
||||
*/
|
||||
private void checkEmergencyProduct(final boolean resend) {
|
||||
StdTextProduct prod = getStdTextProduct();
|
||||
EmergencyConfirmationMsg emergencyMsg = new EmergencyConfirmationMsg();
|
||||
if (emergencyMsg.checkWarningInfo(headerTF.getText().toUpperCase(),
|
||||
textEditor.getText().toUpperCase(), prod.getNnnid()) == false) {
|
||||
|
||||
WarnGenConfirmationDlg wgcd = new WarnGenConfirmationDlg(shell,
|
||||
emergencyMsg.getTitle(), emergencyMsg.getProductMessage(),
|
||||
emergencyMsg.getModeMessage());
|
||||
wgcd.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (Boolean.TRUE.equals(returnValue)) {
|
||||
finishSendProduct(resend);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
wgcd.open();
|
||||
} else {
|
||||
finishSendProduct(resend);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This is used by finishedSendProduct as the call back to the warnGen
|
||||
* confirmaiton Dialog.
|
||||
|
@ -5075,10 +5092,13 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
* @param resend
|
||||
* @param result
|
||||
*/
|
||||
private void warngenCloseCallback(boolean resend, boolean isOperational) {
|
||||
private void warngenCloseCallback(boolean resend) {
|
||||
|
||||
// DR14553 (make upper case in product)
|
||||
String body = textEditor.getText().toUpperCase();
|
||||
CAVEMode mode = CAVEMode.getMode();
|
||||
boolean isOperational = (CAVEMode.OPERATIONAL.equals(mode) || CAVEMode.TEST
|
||||
.equals(mode));
|
||||
if (isOperational) {
|
||||
removeOptionalFields();
|
||||
|
||||
|
@ -5731,88 +5751,89 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
textEditor.setText("");
|
||||
}
|
||||
} else {
|
||||
// TODO FIX PARSING
|
||||
// TODO FIX PARSING
|
||||
|
||||
// First, set the current header by assuming that it usually
|
||||
// consists of the first two lines of text in the text product,
|
||||
// though there will be exceptions to that "rule" as handled below.
|
||||
// So, obtain the AFOS NNNxxx. If it's where it is supposed to be
|
||||
// in the new format, then the existing header is already an AWIPS
|
||||
// First, set the current header by assuming that it usually
|
||||
// consists of the first two lines of text in the text product,
|
||||
// though there will be exceptions to that "rule" as handled below.
|
||||
// So, obtain the AFOS NNNxxx. If it's where it is supposed to be
|
||||
// in the new format, then the existing header is already an AWIPS
|
||||
// text product identifier. Otherwise it is a legacy AFOS
|
||||
// identifier.
|
||||
if (TextDisplayModel.getInstance().hasStdTextProduct(token)) {
|
||||
StdTextProduct textProd = TextDisplayModel.getInstance()
|
||||
.getStdTextProduct(token);
|
||||
StdTextProductId prodId = textProd.getProdId();
|
||||
try {
|
||||
// start of second line of text
|
||||
start = textEditor.getOffsetAtLine(thisLine + 1);
|
||||
if ((textEditor.getText(start, start + afosNnnLimit)
|
||||
.equals(prodId.getNnnid()))
|
||||
if (TextDisplayModel.getInstance().hasStdTextProduct(token)) {
|
||||
StdTextProduct textProd = TextDisplayModel.getInstance()
|
||||
.getStdTextProduct(token);
|
||||
StdTextProductId prodId = textProd.getProdId();
|
||||
try {
|
||||
// start of second line of text
|
||||
start = textEditor.getOffsetAtLine(thisLine + 1);
|
||||
if ((textEditor.getText(start, start + afosNnnLimit)
|
||||
.equals(prodId.getNnnid()))
|
||||
&& (textEditor.getText(start + afosNnnLimit + 1,
|
||||
start + afosXxxLimit).equals(prodId
|
||||
.getXxxid()))) {
|
||||
// Text matches the products nnnid and xxxid
|
||||
numberOfLinesOfHeaderText = 2;
|
||||
// Text matches the products nnnid and xxxid
|
||||
numberOfLinesOfHeaderText = 2;
|
||||
} else if (textEditor.getText(start,
|
||||
start + afosNnnLimit + 2).equals(
|
||||
AFOSParser.DRAFT_PIL)
|
||||
|| textEditor.getText(start,
|
||||
start + afosNnnLimit + 2).equals("TTAA0")) {
|
||||
// Text matches temporary WRKWG#
|
||||
numberOfLinesOfHeaderText = 2;
|
||||
} else {
|
||||
// Text matches temporary WRKWG#
|
||||
numberOfLinesOfHeaderText = 2;
|
||||
} else {
|
||||
// Assume this header block is a legacy AFOS identifier.
|
||||
numberOfLinesOfHeaderText = 1;
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
// Assume this header block is a legacy AFOS identifier.
|
||||
numberOfLinesOfHeaderText = 1;
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
// Assume this header block is a legacy AFOS identifier.
|
||||
numberOfLinesOfHeaderText = 1;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
start = 0;
|
||||
finish = textEditor.getOffsetAtLine(thisLine
|
||||
+ numberOfLinesOfHeaderText) - 1;
|
||||
} catch (IllegalArgumentException e) {
|
||||
// The text does not span enough lines so use the full extent
|
||||
// of the product.
|
||||
finish = textEditor.getCharCount() - 1;
|
||||
}
|
||||
try {
|
||||
start = 0;
|
||||
finish = textEditor.getOffsetAtLine(thisLine
|
||||
+ numberOfLinesOfHeaderText) - 1;
|
||||
} catch (IllegalArgumentException e) {
|
||||
// The text does not span enough lines so use the full extent
|
||||
// of the product.
|
||||
finish = textEditor.getCharCount() - 1;
|
||||
}
|
||||
|
||||
// Set the content of the header block to consist of just the header of
|
||||
// the text product... it will get reunited with the body when it is
|
||||
// saved.
|
||||
if (finish > start) {
|
||||
headerTF.setText(textEditor.getText(start, finish));
|
||||
} else {
|
||||
headerTF.setText("");
|
||||
}
|
||||
// Set the content of the header block to consist of just the header
|
||||
// of
|
||||
// the text product... it will get reunited with the body when it is
|
||||
// saved.
|
||||
if (finish > start) {
|
||||
headerTF.setText(textEditor.getText(start, finish));
|
||||
} else {
|
||||
headerTF.setText("");
|
||||
}
|
||||
|
||||
// Next, set the current body by assuming that it always
|
||||
// consists of the rest of the text product beyond the line(s)
|
||||
// of text in the header.
|
||||
try {
|
||||
int numberOfBlankLines = -1;
|
||||
String line = null;
|
||||
do {
|
||||
numberOfBlankLines++;
|
||||
// Next, set the current body by assuming that it always
|
||||
// consists of the rest of the text product beyond the line(s)
|
||||
// of text in the header.
|
||||
try {
|
||||
int numberOfBlankLines = -1;
|
||||
String line = null;
|
||||
do {
|
||||
numberOfBlankLines++;
|
||||
line = textEditor.getLine(thisLine
|
||||
+ numberOfLinesOfHeaderText + numberOfBlankLines);
|
||||
} while (line.length() == 0 || line.equals(""));
|
||||
// Note: 'st' is a reference to 'textEditor'...
|
||||
// delelete the header from the text in 'textEditor'
|
||||
finish = textEditor.getOffsetAtLine(thisLine
|
||||
+ numberOfLinesOfHeaderText + numberOfBlankLines);
|
||||
textEditor.setSelection(start, finish);
|
||||
textEditor.setEditable(true);
|
||||
textEditor.invokeAction(SWT.DEL);
|
||||
textEditor.setEditable(false);
|
||||
} catch (IllegalArgumentException e) {
|
||||
// There is no text product body, so set it to the empty string.
|
||||
textEditor.setText("");
|
||||
}
|
||||
} while (line.length() == 0 || line.equals(""));
|
||||
// Note: 'st' is a reference to 'textEditor'...
|
||||
// delelete the header from the text in 'textEditor'
|
||||
finish = textEditor.getOffsetAtLine(thisLine
|
||||
+ numberOfLinesOfHeaderText + numberOfBlankLines);
|
||||
textEditor.setSelection(start, finish);
|
||||
textEditor.setEditable(true);
|
||||
textEditor.invokeAction(SWT.DEL);
|
||||
textEditor.setEditable(false);
|
||||
} catch (IllegalArgumentException e) {
|
||||
// There is no text product body, so set it to the empty string.
|
||||
textEditor.setText("");
|
||||
}
|
||||
}
|
||||
// set editor status flags
|
||||
dirty = false;
|
||||
|
@ -6024,9 +6045,9 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
statusBarLabel.update();
|
||||
setBusy(true);
|
||||
|
||||
if (queryTransport == null) {
|
||||
queryTransport = TextEditorUtil.getTextDbsrvTransport();
|
||||
}
|
||||
if (queryTransport == null) {
|
||||
queryTransport = TextEditorUtil.getTextDbsrvTransport();
|
||||
}
|
||||
productQueryJob.addRequest(command, isObsUpdated);
|
||||
}
|
||||
|
||||
|
@ -7713,7 +7734,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
headerTF.setFont(shell.getFont());
|
||||
|
||||
if (dftFont != null) {
|
||||
dftFont.dispose();
|
||||
dftFont.dispose();
|
||||
}
|
||||
|
||||
if (clipboard != null) {
|
||||
|
@ -8305,7 +8326,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
private void displayAirportTooltip(Point location) {
|
||||
String word = parseProduct(textEditor, location.y);
|
||||
if (word != null) {
|
||||
String result = AfosBrowserModel.getInstance().getNodeHelp(word);
|
||||
String result = AfosBrowserModel.getInstance().getNodeHelp(word);
|
||||
if (result != null) {
|
||||
// dispaly below and to the right of location.
|
||||
location.x += 5;
|
||||
|
@ -8331,29 +8352,29 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
|
||||
String result = new String("");
|
||||
try {
|
||||
char c = lineText.charAt(0);
|
||||
if ((c == 'M') || (c == 'S') || (c == 'T')) {
|
||||
char c = lineText.charAt(0);
|
||||
if ((c == 'M') || (c == 'S') || (c == 'T')) {
|
||||
// # Most obs start with METAR, SPECI, TESTM, or TESTS. Skip
|
||||
// over
|
||||
// that tag,
|
||||
// # a space, and the K or P, to get to the 3-char station ID.
|
||||
if (lineText.length() > 10) {
|
||||
result = lineText.substring(7, 10);
|
||||
} else {
|
||||
result = lineText.substring(lineText.length() - 3);
|
||||
}
|
||||
} else if ((c == 'W') || (c == 'Y')) {
|
||||
// that tag,
|
||||
// # a space, and the K or P, to get to the 3-char station ID.
|
||||
if (lineText.length() > 10) {
|
||||
result = lineText.substring(7, 10);
|
||||
} else {
|
||||
result = lineText.substring(lineText.length() - 3);
|
||||
}
|
||||
} else if ((c == 'W') || (c == 'Y')) {
|
||||
// # Canadian SAOs have 3-character IDs, starting with W or Y.
|
||||
// Grab
|
||||
// 'em.
|
||||
result = lineText.substring(0, 3);
|
||||
} else {
|
||||
// 'em.
|
||||
result = lineText.substring(0, 3);
|
||||
} else {
|
||||
// # Some military obs don't get tagged. Skip the K or P and get
|
||||
// 3
|
||||
// chars.
|
||||
int wordLineStart = 1;
|
||||
result = lineText.substring(wordLineStart, wordLineStart + 4);
|
||||
}
|
||||
// chars.
|
||||
int wordLineStart = 1;
|
||||
result = lineText.substring(wordLineStart, wordLineStart + 4);
|
||||
}
|
||||
} catch (StringIndexOutOfBoundsException ex) {
|
||||
// User has non METAR/SAO products and the parsing failed.
|
||||
result = null;
|
||||
|
|
|
@ -71,7 +71,7 @@ public class WarnGenConfirmationDlg extends CaveSWTDialog {
|
|||
private String IMAGE_PRACTICE = "res/images/twsPractice.gif";
|
||||
|
||||
protected WarnGenConfirmationDlg(Shell parentShell, String title,
|
||||
String productMessage, String modeMessage, CAVEMode mode) {
|
||||
String productMessage, String modeMessage) {
|
||||
super(parentShell, SWT.DIALOG_TRIM | SWT.PRIMARY_MODAL, CAVE.NONE
|
||||
| CAVE.DO_NOT_BLOCK);
|
||||
|
||||
|
@ -79,7 +79,7 @@ public class WarnGenConfirmationDlg extends CaveSWTDialog {
|
|||
|
||||
this.productMessage = productMessage;
|
||||
this.modeMessage = modeMessage;
|
||||
this.mode = mode;
|
||||
this.mode = CAVEMode.getMode();
|
||||
setReturnValue(Boolean.FALSE);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ import com.raytheon.uf.common.time.util.TimeUtil;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Initial creation
|
||||
* May 7, 2013 1973 rferrel Changes to properly display Issue Time.
|
||||
* Jul 22, 2013 2176 jsanchez Added EMER to the display string in the update list.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -92,6 +93,9 @@ public class FollowupData extends WarningRecord {
|
|||
rval.append(buildExpStr(status, record));
|
||||
}
|
||||
|
||||
if (record.getRawmessage().contains("EMERGENCY")) {
|
||||
rval.append(" EMER");
|
||||
}
|
||||
equvialentString = rval.substring(0,
|
||||
record.getProductClass().equals("T") ? 20 : 18);
|
||||
|
||||
|
|
|
@ -72,6 +72,7 @@ import com.vividsolutions.jts.geom.Geometry;
|
|||
* May 10, 2013 1951 rjpeter Updated ugcZones references
|
||||
* May 31, 2013 DR 16264 D. Friedman Fix query in prepare method.
|
||||
* Jun 05, 2013 DR 16279 D. Friedman Fix updating of issuance time for followups.
|
||||
* Jul 22, 2013 2176 jsanchez Set the raw message for an EXT.
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
|
@ -312,6 +313,7 @@ public class CurrentWarnings {
|
|||
if (rval != null) {
|
||||
rval.setEndTime(warning.getEndTime());
|
||||
rval.setIssueTime(warning.getIssueTime());
|
||||
rval.setRawmessage(warning.getRawmessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,6 +79,7 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
|
|||
* Apr 18, 2013 1877 jsanchez Had the child classes set the comparator. Fixed a null pointer.
|
||||
* Remove frameAltered condition in matchesFrame. It prevented entries from being displayed.
|
||||
* Check if geometry is null when inspecting.
|
||||
* Jul 22, 2013 2176 jsanchez Updated the wire frame and text for EMERGENCY warnings.
|
||||
* </pre>
|
||||
*
|
||||
* @author jsanchez
|
||||
|
@ -358,14 +359,23 @@ public abstract class AbstractWWAResource extends
|
|||
}
|
||||
|
||||
if (entry != null && entry.wireframeShape != null) {
|
||||
LineStyle lineStyle = (record.getProductClass() != null && record
|
||||
.getProductClass().equals("T")) ? LineStyle.DASHED
|
||||
: LineStyle.SOLID;
|
||||
LineStyle lineStyle = LineStyle.SOLID;
|
||||
if (record.getProductClass() != null
|
||||
&& record.getProductClass().equals("T")) {
|
||||
lineStyle = LineStyle.DASHED;
|
||||
}
|
||||
|
||||
int outlineWidth = getCapability(OutlineCapability.class)
|
||||
.getOutlineWidth();
|
||||
// Make wire frame outline thicker for EMERGENCY warnings
|
||||
if (record.getRawmessage().contains("EMERGENCY")) {
|
||||
outlineWidth *= 2;
|
||||
}
|
||||
|
||||
target.drawWireframeShape(
|
||||
entry.wireframeShape,
|
||||
getCapability(ColorableCapability.class).getColor(),
|
||||
getCapability(OutlineCapability.class)
|
||||
.getOutlineWidth(), lineStyle);
|
||||
outlineWidth, lineStyle);
|
||||
} else if (entry != null && entry.shadedShape != null) {
|
||||
target.drawShadedShape(entry.shadedShape, 1);
|
||||
}
|
||||
|
@ -409,6 +419,14 @@ public abstract class AbstractWWAResource extends
|
|||
params.magnification = getCapability(
|
||||
MagnificationCapability.class).getMagnification();
|
||||
target.drawStrings(params);
|
||||
|
||||
// Draws the string again to have it appear bolder
|
||||
if (textToPrintReversed[2].endsWith("EMER")) {
|
||||
params.setText(new String[] { "", "", "EMER", "" },
|
||||
color);
|
||||
target.drawStrings(params);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -581,7 +599,11 @@ public abstract class AbstractWWAResource extends
|
|||
}
|
||||
textToPrint[0] += "." + record.getEtn();
|
||||
|
||||
textToPrint[1] = record.getPil();
|
||||
if (record.getRawmessage().contains("EMERGENCY")) {
|
||||
textToPrint[1] = record.getPil() + " EMER";
|
||||
} else {
|
||||
textToPrint[1] = record.getPil();
|
||||
}
|
||||
|
||||
SimpleDateFormat startFormat = DEFAULT_FORMAT;
|
||||
SimpleDateFormat endFormat = DEFAULT_FORMAT;
|
||||
|
|
Loading…
Add table
Reference in a new issue