diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/AWIPSHeaderBlockDlg.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/AWIPSHeaderBlockDlg.java index 2164386d34..7b37b7e5fd 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/AWIPSHeaderBlockDlg.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/AWIPSHeaderBlockDlg.java @@ -708,13 +708,10 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements if (response == SWT.NO || parentEditor.isDisposed()) { return; } - parentEditor.enableSend(false); sendEnabled = false; if (isAfosPilComplete()) { unOfficialProd = true; } - } else { - parentEditor.enableSend(true); } // call the set methods diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/QCConfirmationMsg.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/QCConfirmationMsg.java deleted file mode 100644 index b1970fc363..0000000000 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/QCConfirmationMsg.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * 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. - * - *
- * - * SOFTWARE HISTORY - * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * Jul 23, 2013 2176 jsanchez Initial creation - * - *- * - * @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"; - } - -} diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/RemoteSiteRequestDlg.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/RemoteSiteRequestDlg.java deleted file mode 100644 index c8e470d32d..0000000000 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/RemoteSiteRequestDlg.java +++ /dev/null @@ -1,581 +0,0 @@ -/** - * 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.ArrayList; -import java.util.Calendar; -import java.util.GregorianCalendar; -import java.util.List; -import java.util.TimeZone; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.StyledText; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -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.Label; -import org.eclipse.swt.widgets.Layout; -import org.eclipse.swt.widgets.Shell; - -import com.raytheon.uf.common.dataplugin.text.AfosWmoIdDataContainer; -import com.raytheon.uf.common.dataplugin.text.db.AfosToAwips; -import com.raytheon.uf.common.dataplugin.text.db.StdTextProduct; -import com.raytheon.uf.common.dataplugin.text.request.GetWmoIdRequest; -import com.raytheon.uf.common.dataplugin.text.request.RemoteRetrievalRequest; -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.common.wmo.WMOHeader; -import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.requests.ThriftClient; -import com.raytheon.viz.texteditor.command.CommandFactory; -import com.raytheon.viz.texteditor.command.CommandFailedException; -import com.raytheon.viz.texteditor.msgs.IWmoIdSelectionCallback; -import com.raytheon.viz.ui.dialogs.CaveSWTDialog; -import com.raytheon.viz.ui.dialogs.ICloseCallback; - -/** - * The Remote Site Request dialog. - * - *
- * - * SOFTWARE HISTORY - * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * 9/13/07 368 lvenable Initial creation. - * 10/11/2007 482 grichard Reformatted file. - * 09/20/2012 1196 rferrel Changing dialogs being called to not block. - * 09/09/2014 3580 mapeters Removed IQueryTransport usage (no longer exists). - * Aug 31, 2015 4749 njensen Changed setCloseCallback to addCloseCallback - * - *- * - * @author lvenable - */ -public class RemoteSiteRequestDlg extends CaveSWTDialog implements - IWmoIdSelectionCallback { - private static final transient IUFStatusHandler statusHandler = UFStatus - .getHandler(RemoteSiteRequestDlg.class); - - private StyledText ttaaiiTF; - - private StyledText ccccTF; - - /** - * AFOS site ID text field. - */ - private StyledText wsfoIdTF; - - /** - * Product category text field. - */ - private StyledText productCatTF; - - /** - * Product designator text field. - */ - private StyledText prodDesignatorTF; - - /** - * Address text field. Defines the site where a text product or message is - * sent. - */ - private StyledText addresseeTF; - - private Button enterBtn; - - private String initialAfosID; - - private WmoIdSelectionDialog wmoIdSelectionDialog; - - boolean lookupAllowed = true; - - /** - * Constructor. - * - * @param parent - * Parent shell. - */ - public RemoteSiteRequestDlg(Shell parent) { - super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT - | CAVE.DO_NOT_BLOCK); - setText("Send Request"); - } - - @Override - protected Layout constructShellLayout() { - return new GridLayout(1, false); - } - - @Override - protected Object constructShellLayoutData() { - return new GridData(); - } - - @Override - protected void initializeComponents(Shell shell) { - createInputFields(); - createBottomButtons(); - checkEnableEnter(); - } - - /** - * Create the input fields. - */ - private void createInputFields() { - Composite topComp = new Composite(shell, SWT.NONE); - GridLayout gridLayout = new GridLayout(2, false); - gridLayout.marginLeft = 1; - gridLayout.marginTop = 1; - gridLayout.horizontalSpacing = 20; - topComp.setLayout(gridLayout); - GridData gd = null; - Label sepLbl = null; - - gd = new GridData(70, SWT.DEFAULT); - ttaaiiTF = new StyledText(topComp, SWT.BORDER | SWT.READ_ONLY); - ttaaiiTF.setTextLimit(6); - ttaaiiTF.setLayoutData(gd); - ttaaiiTF.setEnabled(false); - ttaaiiTF.setEditable(false); - ttaaiiTF.setBackground(shell.getBackground()); - - Label ttaaiiLbl = new Label(topComp, SWT.NONE); - ttaaiiLbl.setText("TTAAii"); - - gd = new GridData(45, SWT.DEFAULT); - ccccTF = new StyledText(topComp, SWT.BORDER | SWT.READ_ONLY); - ccccTF.setEnabled(false); - ccccTF.setEditable(false); - ccccTF.setLayoutData(gd); - ccccTF.setBackground(shell.getBackground()); - Label ccccLbl = new Label(topComp, SWT.NONE); - ccccLbl.setText("CCCC"); - - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - sepLbl = new Label(topComp, SWT.SEPARATOR | SWT.HORIZONTAL); - sepLbl.setLayoutData(gd); - - // Create the WSFO ID text field. - gd = new GridData(45, SWT.DEFAULT); - wsfoIdTF = new StyledText(topComp, SWT.BORDER); - wsfoIdTF.setTextLimit(3); - wsfoIdTF.setLayoutData(gd); - - Label wsfoIdLbl = new Label(topComp, SWT.NONE); - wsfoIdLbl.setText("WSFO Identification"); - - // Create the product category text field. - gd = new GridData(45, SWT.DEFAULT); - productCatTF = new StyledText(topComp, SWT.BORDER); - productCatTF.setTextLimit(3); - productCatTF.setLayoutData(gd); - - Label productCatLbl = new Label(topComp, SWT.NONE); - productCatLbl.setText("Product Category"); - - // Create the product designator text field. - gd = new GridData(45, SWT.DEFAULT); - prodDesignatorTF = new StyledText(topComp, SWT.BORDER); - prodDesignatorTF.setTextLimit(3); - prodDesignatorTF.setLayoutData(gd); - - Label prodDesignatorLbl = new Label(topComp, SWT.NONE); - prodDesignatorLbl.setText("Product Designator"); - - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - sepLbl = new Label(topComp, SWT.SEPARATOR | SWT.HORIZONTAL); - sepLbl.setLayoutData(gd); - - // Create the addressee text field. - gd = new GridData(45, SWT.DEFAULT); - addresseeTF = new StyledText(topComp, SWT.BORDER); - addresseeTF.setTextLimit(4); - addresseeTF.setText("DEF"); - addresseeTF.setLayoutData(gd); - - Label addresseeLbl = new Label(topComp, SWT.NONE); - addresseeLbl.setText("Addressee"); - - setupTextFieldListeners(); - - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - sepLbl = new Label(topComp, SWT.SEPARATOR | SWT.HORIZONTAL); - sepLbl.setLayoutData(gd); - - // TODO set fields should be moved to preOpen() - String ccc = ""; - String nnn = ""; - String xxx = ""; - try { - ccc = initialAfosID.substring(0, 3); - nnn = initialAfosID.substring(3, 6); - xxx = initialAfosID.substring(6); - } catch (Exception e) { - // ignore - } - wsfoIdTF.setText(ccc); - productCatTF.setText(nnn); - prodDesignatorTF.setText(xxx); - } - - private void setupTextFieldListeners() { - // forces all fields to uppercase and only allows numbers/digits - textFieldVerifyListener(wsfoIdTF); - textFieldVerifyListener(productCatTF); - textFieldVerifyListener(prodDesignatorTF); - textFieldVerifyListener(addresseeTF); - - // forces overwrite and arrow key traversal - textFieldKeyListener(wsfoIdTF, addresseeTF, productCatTF); - textFieldKeyListener(productCatTF, wsfoIdTF, prodDesignatorTF); - textFieldKeyListener(prodDesignatorTF, productCatTF, addresseeTF); - textFieldKeyListener(addresseeTF, prodDesignatorTF, wsfoIdTF); - - textFieldModifyListener(wsfoIdTF, productCatTF, true); - textFieldModifyListener(productCatTF, prodDesignatorTF, true); - textFieldModifyListener(prodDesignatorTF, addresseeTF, false); - } - - /** - * Create the bottom Enter and Cancel buttons. - */ - private void createBottomButtons() { - // Create a composite that will center added controls/composites. - Composite buttonArea = new Composite(shell, SWT.NONE); - buttonArea.setLayoutData(new GridData(SWT.CENTER, SWT.DEFAULT, true, - false)); - buttonArea.setLayout(new GridLayout(1, false)); - - // Create a composite to hold the enter and cancel buttons. - Composite buttons = new Composite(buttonArea, SWT.NONE); - buttons.setLayout(new GridLayout(2, true)); - - // Create the Enter button. - enterBtn = new Button(buttons, SWT.PUSH); - enterBtn.setLayoutData(new GridData(GridData.FILL_BOTH)); - enterBtn.setText("Enter"); - enterBtn.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - if (createReturnValue(false)) - shell.dispose(); - } - }); - - // Create the Cancel button. - Button cancelBtn = new Button(buttons, SWT.PUSH); - cancelBtn.setLayoutData(new GridData(GridData.FILL_BOTH)); - cancelBtn.setText("Cancel"); - cancelBtn.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - setReturnValue(null); - shell.dispose(); - } - }); - } - - private Calendar createCalRelativeTo(Calendar relative, - WMOHeader wmoHeader, int monthAdjustment) { - Calendar c = new GregorianCalendar(relative.getTimeZone()); - c.setTimeInMillis(relative.getTimeInMillis()); - c.add(GregorianCalendar.MONTH, monthAdjustment); - c.set(GregorianCalendar.DAY_OF_MONTH, wmoHeader.getDay()); - c.set(GregorianCalendar.HOUR_OF_DAY, wmoHeader.getHour()); - c.set(GregorianCalendar.MINUTE, wmoHeader.getMinute()); - c.set(GregorianCalendar.SECOND, 0); - c.set(GregorianCalendar.MILLISECOND, 0); - return c; - } - - private Calendar getCloserCalendar(Calendar reference, Calendar a, - Calendar b) { - return Math.abs(a.getTimeInMillis() - reference.getTimeInMillis()) < Math - .abs(b.getTimeInMillis() - reference.getTimeInMillis()) ? a : b; - } - - private boolean createReturnValue(boolean validateOnly) { - String ccc = wsfoIdTF.getText(); - String nnn = productCatTF.getText(); - String xxx = prodDesignatorTF.getText(); - String addr = addresseeTF.getText(); - if (ccc.length() != 3 || nnn.length() != 3 || xxx.length() < 1 - || xxx.length() > 3 || addr.length() < 1) - return false; - - if (validateOnly) - return true; - - String afosID = ccc + nnn + xxx; - GetWmoIdRequest request = new GetWmoIdRequest(); - request.setAfosId(afosID); - - RemoteRetrievalRequest req = new RemoteRetrievalRequest(); - // TODO: Translate addr via awipsSites.txt or siteDistLists.txt - req.setAddressee(addr); - req.setAfosID(afosID); - - List
- * - * SOFTWARE HISTORY - * - * Date Ticket# Engineer Description - * ------------ ---------- ----------- -------------------------- - * Jul 23, 2013 2176 jsanchez Initial creation - * - *- * - * @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(); - } - -} diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java index 798594aa84..d3d3528286 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java @@ -28,7 +28,6 @@ import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; -import java.io.FileInputStream; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; @@ -50,10 +49,8 @@ import javax.xml.bind.JAXB; import javax.xml.bind.JAXBException; import org.apache.commons.lang.StringUtils; -import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.dialogs.ErrorDialog; @@ -110,8 +107,6 @@ import org.eclipse.swt.widgets.Text; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.menus.IMenuService; -import com.raytheon.uf.common.activetable.SendPracticeProductRequest; -import com.raytheon.uf.common.dataplugin.text.RemoteRetrievalResponse; import com.raytheon.uf.common.dataplugin.text.alarms.AlarmAlertProduct; import com.raytheon.uf.common.dataplugin.text.db.MixedCaseProductSupport; import com.raytheon.uf.common.dataplugin.text.db.OperationalStdTextProduct; @@ -144,7 +139,6 @@ import com.raytheon.uf.common.time.SimulatedTime; import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.common.wmo.WMOHeader; import com.raytheon.uf.viz.core.VizApp; -import com.raytheon.uf.viz.core.auth.UserController; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.notification.jobs.NotificationManagerJob; import com.raytheon.uf.viz.core.requests.ThriftClient; @@ -162,7 +156,6 @@ import com.raytheon.viz.texteditor.command.CommandType; import com.raytheon.viz.texteditor.command.ICommand; import com.raytheon.viz.texteditor.command.IProductQueryCallback; import com.raytheon.viz.texteditor.command.ProductQueryJob; -import com.raytheon.viz.texteditor.dialogs.LineWrapCheckConfirmationMsg.AnswerChoices; import com.raytheon.viz.texteditor.msgs.IAfosBrowserCallback; import com.raytheon.viz.texteditor.msgs.IAwipsBrowserCallback; import com.raytheon.viz.texteditor.msgs.IRecoverEditSessionCallback; @@ -185,7 +178,6 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.ICloseCallback; import com.raytheon.viz.ui.dialogs.SWTMessageBox; -import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations; /** * Main Text Editor dialog. @@ -642,21 +634,6 @@ public class TextEditorDialog extends CaveSWTDialog */ private MenuItem printSelectionItem; - /** - * Fax All products menu item. - */ - private MenuItem faxAllItem; - - /** - * Fax selected aread menu item. - */ - private MenuItem faxSelectionItem; - - /** - * Configuration Auto fax menu item. - */ - private MenuItem configAutoFaxItem; - /** * Enter editor mode menu item. */ @@ -667,11 +644,6 @@ public class TextEditorDialog extends CaveSWTDialog */ private MenuItem saveItem; - /** - * Send and Exit menu item. - */ - private MenuItem sendExitEditorItem; - /** * Cancel editor item. */ @@ -687,21 +659,11 @@ public class TextEditorDialog extends CaveSWTDialog */ private MenuItem exportFromFileItem; - /** - * Request from remote site menu item. - */ - private MenuItem requestFromRemoteSiteItem; - /** * Recover edit session menu item. */ private MenuItem recoverEditSessionItem; - /** - * Re-send warning product menu item. - */ - private MenuItem resendWarningProductnItem; - /** * Close menu item. */ @@ -1092,21 +1054,11 @@ public class TextEditorDialog extends CaveSWTDialog */ private Button editorEditHeaderBtn; - /** - * Editor send button. - */ - private Button editorSendBtn; - /** * Editor cancel button. */ private Button editorCancelBtn; - /** - * Editor attach button. - */ - private Button editorAttachBtn; - /** * Editor insert/overwrite combo box. */ @@ -1308,16 +1260,6 @@ public class TextEditorDialog extends CaveSWTDialog */ private String addressee = "ALL"; - /** - * Name of any attachment file - */ - private String attachedFilename = null; - - /** - * Contents of an attachment file. - */ - private byte[] attachedFile = null; - /** * Edit options for a popup menu. */ @@ -1693,17 +1635,6 @@ public class TextEditorDialog extends CaveSWTDialog } }); - sendExitEditorItem = new MenuItem(fileMenu, SWT.NONE); - sendExitEditorItem.setText("Send && Exit Editor"); - sendExitEditorItem.setEnabled(false); - sendExitEditorItem.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - logInfo("File -> Send & Exit clicked"); - sendProduct(false); - } - }); - cancelEditorItem = new MenuItem(fileMenu, SWT.NONE); cancelEditorItem.setText("Cancel Editor"); cancelEditorItem.setEnabled(false); @@ -1735,33 +1666,6 @@ public class TextEditorDialog extends CaveSWTDialog } }); - new MenuItem(fileMenu, SWT.SEPARATOR); - - requestFromRemoteSiteItem = new MenuItem(fileMenu, SWT.NONE); - requestFromRemoteSiteItem.setText("Request From Remote Site..."); - requestFromRemoteSiteItem.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - RemoteSiteRequestDlg requestDlg = new RemoteSiteRequestDlg( - shell); - if (lastRemoteRetrievalRequest != null) { - requestDlg.setRequest(lastRemoteRetrievalRequest); - } - requestDlg.setCloseCallback(new ICloseCallback() { - - @Override - public void dialogClosed(Object returnValue) { - RemoteRetrievalRequest req = (RemoteRetrievalRequest) returnValue; - if (req != null) { - lastRemoteRetrievalRequest = req; - sendRemoteRetrievalRequest(req); - } - } - }); - requestDlg.open(); - } - }); - recoverEditSessionItem = new MenuItem(fileMenu, SWT.NONE); recoverEditSessionItem.setText("Recover Edit Sesssion..."); recoverEditSessionItem.addSelectionListener(new SelectionAdapter() { @@ -1777,19 +1681,6 @@ public class TextEditorDialog extends CaveSWTDialog new MenuItem(fileMenu, SWT.SEPARATOR); - resendWarningProductnItem = new MenuItem(fileMenu, SWT.NONE); - resendWarningProductnItem.setText("Resend Warning Product..."); - resendWarningProductnItem.setEnabled(false); - resendWarningProductnItem.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - logInfo("File -> Resend Warning Product... clicked"); - sendProduct(true); - } - }); - - new MenuItem(fileMenu, SWT.SEPARATOR); - closeItem = new MenuItem(fileMenu, SWT.NONE); closeItem.setText("Close\tAlt+F4"); closeItem.setAccelerator(SWT.ALT | SWT.F4); @@ -3647,19 +3538,6 @@ public class TextEditorDialog extends CaveSWTDialog } }); - // Add the Send button. - gd = new GridData(SWT.DEFAULT, SWT.DEFAULT); - editorSendBtn = new Button(editorBtnRowComp, SWT.PUSH); - editorSendBtn.setText("Send"); - editorSendBtn.setLayoutData(gd); - editorSendBtn.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - logInfo("Send button clicked"); - sendProduct(false); - } - }); - // Add the Cancel button. gd = new GridData(SWT.DEFAULT, SWT.DEFAULT); editorCancelBtn = new Button(editorBtnRowComp, SWT.PUSH); @@ -3673,18 +3551,6 @@ public class TextEditorDialog extends CaveSWTDialog } }); - // Add the Attach button. - gd = new GridData(SWT.DEFAULT, SWT.DEFAULT); - editorAttachBtn = new Button(editorBtnRowComp, SWT.PUSH); - editorAttachBtn.setText("Attach"); - editorAttachBtn.setLayoutData(gd); - editorAttachBtn.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - attachFile(); - } - }); - // Add the Insert/Overwrite combo box. gd = new GridData(SWT.DEFAULT, SWT.DEFAULT); editorInsertCmb = new Combo(editorBtnRowComp, @@ -4381,10 +4247,7 @@ public class TextEditorDialog extends CaveSWTDialog // fields to function properly. If focus is not set to a button, then // the text fields' listeners do not activate properly. enterEditorBtn.setFocus(); - statusBarLabel.setText(""); - attachedFile = null; - attachedFilename = null; return true; } @@ -4536,20 +4399,11 @@ public class TextEditorDialog extends CaveSWTDialog importFromFileItem.setEnabled(!inEditMode); recoverEditSessionItem.setEnabled(!inEditMode); - // --------------------------------- - // File Menu menu items - // Disabled when in editor mode - // --------------------------------- - resendWarningProductnItem - .setEnabled(!inEditMode && textEditor.getText() != null - && textEditor.getText().length() > 0); - // --------------------------------- // File Menu menu items // Enabled when in editor mode // --------------------------------- saveItem.setEnabled(inEditMode); - sendExitEditorItem.setEnabled(inEditMode); cancelEditorItem.setEnabled(inEditMode); // --------------------------------- @@ -4741,67 +4595,6 @@ public class TextEditorDialog extends CaveSWTDialog } } - /** - * Attaches the contents of a file to a product. - */ - private void attachFile() { - FileDialog dlg = new FileDialog(shell, SWT.OPEN); - dlg.setText("Attach File"); - dlg.setFilterNames(FILTER_NAMES); - dlg.setFilterExtensions(FILTER_EXTS); - if (attachedFilename != null && attachedFilename.trim().length() > 0) { - int startIndex = statusBarLabel.getText().indexOf(":") + 1; - int endIndex = statusBarLabel.getText().lastIndexOf(File.separator) - + 1; - String filterPath = statusBarLabel.getText().substring(startIndex, - endIndex); - dlg.setFilterPath(filterPath); - dlg.setFileName(statusBarLabel.getText().substring(startIndex)); - } - String fn = dlg.open(); - if (fn != null) { - try { - File file = new File(fn); - if (file.exists() && file.length() <= 50000 - && isTextFile(file)) { - try (FileInputStream in = new FileInputStream(file)) { - byte[] bytes = new byte[(int) file.length()]; - int offset = 0; - int numRead = 0; - while (offset < bytes.length - && (numRead = in.read(bytes, offset, - bytes.length - offset)) >= 0) { - offset += numRead; - } - attachedFile = bytes; - attachedFilename = fn - .substring(fn.lastIndexOf(File.separator) + 1); - statusBarLabel.setText("Attachment: " + fn); - } - } else { - StringBuilder sb = new StringBuilder(); - if (!file.exists()) { - sb.append("File does NOT exist!\n\n"); - } else if (file.length() > 50000) { - sb.append("File size is too large!\n\n"); - } else { - sb.append("File is NOT a text file!\n\n"); - } - userInformation(sb.toString() + fn); - } - } catch (Exception e) { - statusHandler.handle(Priority.PROBLEM, "Error attaching file", - e); - } - } else { - if (statusBarLabel.getText().startsWith("Attachment: ")) { - statusBarLabel.setText(""); - attachedFile = null; - attachedFilename = null; - } - } - } - /** * Export data to a file. */ @@ -4929,296 +4722,6 @@ public class TextEditorDialog extends CaveSWTDialog userInformation("Notice", information); } - /** - * Disseminate the product. - * - * @param resend - * true if product is to be resent - */ - synchronized private void sendProduct(final boolean resend) { - if (!validateTime()) { - return; - } - StdTextProduct prod = getStdTextProduct(); - if (warnGenFlag) { - QCConfirmationMsg qcMsg = new QCConfirmationMsg(); - if (!qcMsg.checkWarningInfo(headerTF.getText(), - textEditor.getText(), prod.getNnnid())) { - WarnGenConfirmationDlg wgcd = new WarnGenConfirmationDlg(shell, - qcMsg.getTitle(), qcMsg.getProductMessage(), - qcMsg.getModeMessage()); - wgcd.setCloseCallback(new ICloseCallback() { - - @Override - public void dialogClosed(Object returnValue) { - if (Boolean.TRUE.equals(returnValue)) { - finishSendProduct(resend); - } - - } - }); - wgcd.open(); - } else { - finishSendProduct(resend); - } - } else { - finishSendProduct(resend); - } - } - - /** - * This finishes preparing to send a product as part of normal compleation - * of sendProduct or as part of the call back when there is a problem with - * the WarnGen being sent. - * - * @param resend - */ - private void finishSendProduct(final boolean resend) { - if (statusBarLabel.getText().startsWith("Attachment:")) { - StringBuilder sb = new StringBuilder("An Attachment file ("); - int startIndex = "Attachment:".length() + 1; - sb.append(statusBarLabel.getText().substring(startIndex)); - sb.append(") will be transmitted with this message."); - int response = TextWSMessageBox.open(shell, "Notice", sb.toString(), - SWT.OK | SWT.CANCEL); - if (SWT.OK != response) { - return; - } - } - - // verify if product has already been resent - if (!verifyResendProduct()) { - return; - } - - // verify required fields - if (!verifyRequiredFields()) { - return; - } - - // verify wrapping - if (!verifyLineWidth(resend)) { - return; - } - - concludeSendProduct(resend); - } - - private void concludeSendProduct(final boolean resend) { - StdTextProduct prod = getStdTextProduct(); - if (TextEditorCfg.getTextEditorCfg().getValidateCharacterSet() - && !validateCharacterSet(prod.getNnnid())) { - return; - } - - if (isWarnGenDlg == true) { - String afosId = prod.getCccid() + prod.getNnnid() + prod.getXxxid(); - SendConfirmationMsg sendMsg = new SendConfirmationMsg(resend, - afosId, prod.getNnnid()); - - 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)) { - checkEmergencyProduct(resend); - } - } - }); - wgcd.open(); - } else { - checkEmergencyProduct(resend); - } - } - - /** - * 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(), - MixedCaseProductSupport.conditionalToUpper( - prod.getNnnid(), textEditor.getText()), - 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)) { - warngenCloseCallback(resend); - } - - } - }); - wgcd.open(); - } else { - warngenCloseCallback(resend); - } - } - - /** - * This is used by finishedSendProduct as the call back to the warnGen - * confirmaiton Dialog. - * - * @param resend - * @param result - */ - private void warngenCloseCallback(boolean resend) { - - StdTextProduct prod = getStdTextProduct(); - String body = MixedCaseProductSupport - .conditionalToUpper(prod.getNnnid(), textEditor.getText()); - CAVEMode mode = CAVEMode.getMode(); - boolean isOperational = CAVEMode.OPERATIONAL.equals(mode) - || CAVEMode.TEST.equals(mode); - if (isOperational) { - removeOptionalFields(); - - try { - updateTextEditor(body); - if ((inEditMode || resend) - && !saveEditedProduct(prod, false, resend, true) - .isEmpty()) { - inEditMode = false; - } - if (!resend) { - /* - * Update the vtec string in the message. It looks wrong to - * do this after saveEditedProduct, but it works because for - * this case (isOpertional && ! resend) case, - * saveEditedProduct, does not actually save anything. - */ - if (shouldSetETNtoNextValue(prod)) { - statusHandler.handle(Priority.INFO, - "Will increment ETN for this product."); - prod.setProduct(VtecUtil.getVtec( - removeSoftReturns(prod.getProduct()), true)); - } else { - statusHandler.handle(Priority.INFO, - "Will NOT increment ETN for this product."); - } - // Update editor so the proper send times are displayed. - textEditor.setText(prod.getProduct()); - } - - String product = prod.getProduct(); - - if (notify != null) { - notify.add(product); - } - - // Code in Run statement goes here! - //new Thread(new ThriftClientRunnable(req)).start(); - logInfo("Autowrap char size = " + charWrapCol); - logInfo("Sent product:\n" + product); - } catch (VizException e) { - statusHandler.handle(Priority.PROBLEM, - "Error transmitting text product", e); - } - } else { - try { - if (!resend) { - if (shouldSetETNtoNextValue(prod)) { - statusHandler.handle(Priority.INFO, - "Will increment ETN for this product."); - body = VtecUtil.getVtec( - removeSoftReturns(MixedCaseProductSupport - .conditionalToUpper(prod.getNnnid(), - textEditor.getText()))); - } else { - statusHandler.handle(Priority.INFO, - "Will NOT increment ETN for this product."); - } - } - updateTextEditor(body); - if ((inEditMode || resend) - && !saveEditedProduct(prod, false, resend, false) - .isEmpty()) { - inEditMode = false; - } - String practiceProd = TextDisplayModel.getInstance() - .getProduct(token); - textEditor.setText(practiceProd); - SendPracticeProductRequest req = new SendPracticeProductRequest(); - req.setProductText(practiceProd); - req.setNotifyGFE(true); - req.setDrtString(new SimpleDateFormat("yyyyMMdd_HHmm") - .format(SimulatedTime.getSystemTime().getTime())); - - ThriftClient.sendRequest(req); - } catch (VizException e) { - statusHandler.handle(Priority.PROBLEM, - "Error transmitting text product", e); - } - } - - if (inEditMode == false && resend == false) { - saved = true; - StdTextProductId finalProduct = this.getStdTextProduct() - .getProdId(); - String header = null; - if (finalProduct.getNnnid().equals("WRK") - && !finalProduct.getXxxid().startsWith("WG")) { - header = "ZCZC " + finalProduct.getCccid() - + finalProduct.getNnnid() + finalProduct.getXxxid() - + " " + getAddressee() + "\nTTAA00 " - + finalProduct.getSite() + " " - + finalProduct.getHdrtime(); - } else { - header = finalProduct.getWmoid() + " " + finalProduct.getSite() - + " " + finalProduct.getHdrtime() + "\n" - + finalProduct.getNnnid() + finalProduct.getXxxid(); - } - headerTF.setText(header); - cancelEditor(false); - } - } - - private EtnRules getETNRules() throws Exception { - LocalizationFile lf = PathManagerFactory.getPathManager() - .getStaticLocalizationFile(ETN_RULES_FILE); - if (lf == null) { - throw new Exception( - "ETN rules file (" + ETN_RULES_FILE + ") not found."); - } - try (InputStream stream = lf.openInputStream()) { - return JAXB.unmarshal(stream, EtnRules.class); - } - } - - private boolean shouldSetETNtoNextValue(StdTextProduct prod) { - List
- * - * SOFTWARE HISTORY - * - * Date Ticket# Engineer Description - * ------------ ---------- ---------- -------------------------- - * 27Jul2010 4773 cjeanbap Initial development - * 10Aug2010 2187 cjeanbap Removed warnGenFlag. - * 10Nov2011 11552 rferrel returnvalue no longer null - * 08/20/2012 DR 15340 D. Friedman Use callbacks for closing - * 09/24/2012 1196 rferrel Refactored to use close callback - * added to CaveSWTDialog. - * 17 Sep 2013 #2384 lvenable Fixed memory leak and utilized the disposed() - * method. - * May 29, 2015 #4441 randerso Fixed loading of images - * - *- * - * @author cjeanbap - */ -public class WarnGenConfirmationDlg extends CaveSWTDialog { - - /** - * Handler used for messges. - */ - private final transient IUFStatusHandler statusHandler = UFStatus - .getHandler(TextEditorDialog.class); - - private String productMessage; - - private String modeMessage; - - private CAVEMode mode; - - private String IMAGE_OPERATIONAL = "res/images/twsOper.gif"; - - private String IMAGE_TEST = "res/images/twsTest.gif"; - - private String IMAGE_PRACTICE = "res/images/twsPractice.gif"; - - private Image stopSign = null; - - /** - * Constructor. - * - * @param parentShell - * Parent shell. - * @param title - * Dialog title. - * @param productMessage - * Product message. - * @param modeMessage - * Mode message. - */ - protected WarnGenConfirmationDlg(Shell parentShell, String title, - String productMessage, String modeMessage) { - super(parentShell, SWT.DIALOG_TRIM | SWT.PRIMARY_MODAL, CAVE.NONE - | CAVE.DO_NOT_BLOCK); - - setText(title); - - this.productMessage = productMessage; - this.modeMessage = modeMessage; - this.mode = CAVEMode.getMode(); - setReturnValue(Boolean.FALSE); - } - - @Override - protected void initializeComponents(Shell shell) { - Composite mainComposite = new Composite(shell, SWT.NONE); - mainComposite.setLayout(new GridLayout(1, false)); - createImage(mainComposite); - createMessageLabel(mainComposite); - createButtonRow(mainComposite); - } - - private void createImage(Composite mainComposite) { - - String imagePath = null; - try { - if (mode.equals(CAVEMode.OPERATIONAL)) { - // add Live image - imagePath = IMAGE_OPERATIONAL; - } else if (mode.equals(CAVEMode.TEST)) { - // add Test image - imagePath = IMAGE_TEST; - } else if (mode.equals(CAVEMode.PRACTICE)) { - // add Practice image - imagePath = IMAGE_PRACTICE; - } else { - // unknown - imagePath = IMAGE_OPERATIONAL; - } - - ImageDescriptor id = Activator.imageDescriptorFromPlugin( - Activator.PLUGIN_ID, imagePath); - stopSign = id.createImage(mainComposite.getDisplay()); - Label stopSignLbl = new Label(mainComposite, 0); - stopSignLbl.setImage(stopSign); - } catch (Exception e) { - statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); - } - } - - private void createMessageLabel(Composite mainComposite) { - Label productMsgLbl = new Label(mainComposite, 0); - productMsgLbl.setText(this.productMessage); - Label modeMsgLbl = new Label(mainComposite, 0); - modeMsgLbl.setText(this.modeMessage); - - Label sepLbl = new Label(mainComposite, SWT.SEPARATOR | SWT.HORIZONTAL); - sepLbl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - } - - private void createButtonRow(Composite mainComposite) { - Composite buttonRowComp = new Composite(mainComposite, SWT.NONE); - buttonRowComp.setLayout(new GridLayout(2, true)); - buttonRowComp.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, - false)); - - // Add the Go Ahead (Save) button. - GridData gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false); - gd.widthHint = 100; - Button saveBtn = new Button(buttonRowComp, SWT.PUSH); - saveBtn.setText("Go Ahead!"); - saveBtn.setLayoutData(gd); - saveBtn.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - dispose(Boolean.TRUE); - } - }); - - // Add the Abort button. - gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false); - gd.widthHint = 100; - Button abortCutBtn = new Button(buttonRowComp, SWT.PUSH); - abortCutBtn.setText("Abort"); - abortCutBtn.setLayoutData(gd); - abortCutBtn.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - dispose(Boolean.FALSE); - } - }); - } - - private void dispose(Boolean returnValue) { - setReturnValue(returnValue); - close(); - } - - @Override - protected void disposed() { - if (stopSign != null) { - stopSign.dispose(); - } - } -} diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/WarngenConstants.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/WarngenConstants.java index e881a5f98c..3d2ecbbd05 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/WarngenConstants.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/WarngenConstants.java @@ -38,7 +38,7 @@ package com.raytheon.viz.warngen; public class WarngenConstants { - public static final int INSTRUCTIONS_HEIGHT = 40; + public static final int INSTRUCTIONS_HEIGHT = 20; public static final String INSTRUCTION_DRAG_STORM = "Move Centroid to Storm in any Frame"; diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenAction.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenAction.java index d1fa196bde..d021e12501 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenAction.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenAction.java @@ -95,29 +95,6 @@ public class WarngenAction extends AbstractGenericToolAction