Merge branch 'master_13.5.1' into omaha_13.5.1
Former-commit-id:d1fb06feb7
[formerlyecc9f77f42
] [formerlyd1fb06feb7
[formerlyecc9f77f42
] [formerly6b1989cb29
[formerly abb16b014694113cd7f2582542fd0d0f54a2da4e]]] Former-commit-id:6b1989cb29
Former-commit-id:fc6195bbf6
[formerlyc46f04dd72
] Former-commit-id:9a1b44efdc
This commit is contained in:
commit
4b29a16298
8 changed files with 144 additions and 100 deletions
|
@ -5,7 +5,10 @@
|
|||
|
||||
History:
|
||||
|
||||
07/25/2013 Greg Hull DR 15733 Created (and modified) from FontSizeCfg.xml and TextColorsCfg.xlm
|
||||
07/25/2013 Greg Hull DR 15733 Created (and modified) from FontSizeCfg.xml and TextColorsCfg.xml
|
||||
07/31/2013 B. Hebbard DR 15733 Changed highlightTextForegroundColor from "0, 0, 0" to "WHITE"
|
||||
(per Joshua Huber and Greg Hull)
|
||||
|
||||
|
||||
-->
|
||||
<textEditorCfg>
|
||||
|
@ -18,7 +21,7 @@
|
|||
-->
|
||||
<textForegroundColor>BLACK</textForegroundColor>
|
||||
<textBackgroundColor>WHITE</textBackgroundColor>
|
||||
<highlightTextForegroundColor>0, 0, 0</highlightTextForegroundColor>
|
||||
<highlightTextForegroundColor>WHITE</highlightTextForegroundColor>
|
||||
<highlightTextBackgroundColor>85, 152, 215</highlightTextBackgroundColor>
|
||||
|
||||
<!-- The fonts available under the Options menu. Only one should be selected -->
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.eclipse.swt.widgets.Event;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 7/1/06 chammack Initial Creation.
|
||||
* 08/02/2013 DR 16427 Qinglu Lin (David's approach) Added SYSTEM_RESOURCE_LOW(1) to InputPriority.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -39,8 +40,8 @@ import org.eclipse.swt.widgets.Event;
|
|||
public interface IInputHandler {
|
||||
|
||||
public static enum InputPriority {
|
||||
LOWEST(0), RESOURCE(3), SYSTEM_RESOURCE(4), PART(5), PERSPECTIVE(6), WINDOW(
|
||||
7);
|
||||
LOWEST(0), SYSTEM_RESOURCE_LOW(1), RESOURCE(3), SYSTEM_RESOURCE(4), PART(5), PERSPECTIVE(6),
|
||||
WINDOW(7);
|
||||
|
||||
public Integer value;
|
||||
|
||||
|
|
|
@ -71,6 +71,8 @@ import com.raytheon.viz.ui.actions.DummyAction;
|
|||
* drawn into the smaller pane.
|
||||
* Sep 4, 2012 15335 kshresth Will now display lightning/wind fields
|
||||
* when magnification set to 0
|
||||
* Aug 2, 2013 DR 16427 Qinglu Lin (David's approach) Changing InputPriority.SYSTEM_RESOURCE to
|
||||
* InputPriority.SYSTEM_RESOURCE_LOW in initInternal().
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -500,7 +502,7 @@ public class D2DLegendResource extends
|
|||
IDisplayPaneContainer rc = getResourceContainer();
|
||||
if (rc != null) {
|
||||
rc.registerMouseHandler(legendHandler,
|
||||
InputPriority.SYSTEM_RESOURCE);
|
||||
InputPriority.SYSTEM_RESOURCE_LOW);
|
||||
rc.registerMouseHandler(changeModeHandler, InputPriority.RESOURCE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,6 +144,7 @@ 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;
|
||||
import com.raytheon.uf.viz.core.notification.INotificationObserver;
|
||||
import com.raytheon.uf.viz.core.notification.NotificationException;
|
||||
|
@ -322,6 +323,7 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox;
|
|||
* 31JAN2013 1563 rferrel Force location of airport tooltip.
|
||||
* 31JAN2013 1568 rferrel Spell checker now tied to this dialog instead of parent.
|
||||
* 26Apr2013 16123 snaples Removed setFocus to TextEditor in postExecute method.
|
||||
* 07Jun2013 1981 mpduff Add user id to OUPRequest as it is now protected.
|
||||
* 20Jun2013 15733 XHuang Add functionalities that get Font size, Text colors from
|
||||
* *.xml files in localization;
|
||||
* add selection listener to catch the highlight words and
|
||||
|
@ -1380,6 +1382,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
private Color highlightBackground;
|
||||
|
||||
// protected Color color;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor with additional cave style rules
|
||||
*
|
||||
|
@ -5002,6 +5006,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
}
|
||||
req.setCheckBBB(true);
|
||||
req.setProduct(oup);
|
||||
req.setUser(UserController.getUserObject());
|
||||
|
||||
// Code in Run statement goes here!
|
||||
new Thread(new ThriftClientRunnable(req)).start();
|
||||
|
@ -5590,16 +5595,15 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
int afosXxxLimit = 5; // second three characters is AFOS XXX
|
||||
|
||||
/*
|
||||
* DR15610 - Make sure that if the first line of the
|
||||
* text product is not a WMO heading it is treated as
|
||||
* part of the text body.
|
||||
* DR15610 - Make sure that if the first line of the text product is not
|
||||
* a WMO heading it is treated as part of the text body.
|
||||
*/
|
||||
String[] pieces = textEditor.getText().split("\r*\n", 2);
|
||||
if (pieces.length > 1) {
|
||||
pieces[0] += "\n"; // WMOHeader expects this
|
||||
}
|
||||
WMOHeader header = new WMOHeader(pieces[0].getBytes(), null);
|
||||
if ( !header.isValid() ) {
|
||||
if (!header.isValid()) {
|
||||
headerTF.setText("");
|
||||
try {
|
||||
textEditor.setText(originalText);
|
||||
|
@ -5609,8 +5613,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
// There is no text product body, so set it to the empty string.
|
||||
textEditor.setText("");
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// TODO FIX PARSING
|
||||
|
||||
// First, set the current header by assuming that it usually
|
||||
|
@ -5618,7 +5621,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
// 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.
|
||||
// text product identifier. Otherwise it is a legacy AFOS
|
||||
// identifier.
|
||||
if (TextDisplayModel.getInstance().hasStdTextProduct(token)) {
|
||||
StdTextProduct textProd = TextDisplayModel.getInstance()
|
||||
.getStdTextProduct(token);
|
||||
|
@ -5628,14 +5632,16 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
start = textEditor.getOffsetAtLine(thisLine + 1);
|
||||
if ((textEditor.getText(start, start + afosNnnLimit)
|
||||
.equals(prodId.getNnnid()))
|
||||
&& (textEditor.getText(start + afosNnnLimit + 1, start
|
||||
+ afosXxxLimit).equals(prodId.getXxxid()))) {
|
||||
&& (textEditor.getText(start + afosNnnLimit + 1,
|
||||
start + afosXxxLimit).equals(prodId
|
||||
.getXxxid()))) {
|
||||
// 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")) {
|
||||
} 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 {
|
||||
|
@ -5675,8 +5681,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
String line = null;
|
||||
do {
|
||||
numberOfBlankLines++;
|
||||
line = textEditor.getLine(thisLine + numberOfLinesOfHeaderText
|
||||
+ 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'
|
||||
|
|
|
@ -88,6 +88,8 @@ public class AlertalarmStdTextProductUtil {
|
|||
setCurrentReportfile();
|
||||
|
||||
reportAlarm();
|
||||
|
||||
System.exit(reportWriter.getAlarmCount());
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -230,7 +232,7 @@ public class AlertalarmStdTextProductUtil {
|
|||
if (alarmCount > 0) {
|
||||
log.info(alarmCount + " alarms reported, report written to "
|
||||
+ reportWriter.getFilename());
|
||||
saveReportTotextDb();
|
||||
//saveReportTotextDb();
|
||||
} else {
|
||||
log.info("No alarms reported, info sent to "
|
||||
+ reportWriter.getFilename());
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.io.FileNotFoundException;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
@ -63,6 +64,7 @@ import com.raytheon.uf.edex.decodertools.core.filterimpl.PluginDataObjectFilter;
|
|||
* ---------- ------- -------- --------------------------
|
||||
* 1/10/2013 15497 wkwock Initial creation
|
||||
* 2/13/2013 1584 mpduff Fix creation of "dummy" config.
|
||||
* 08/08/2013 16408 wkwock Use different metar.cfg file and options
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -167,16 +169,13 @@ public class MetarToShefFilter {
|
|||
}
|
||||
}
|
||||
|
||||
private PluginDataObject[] filterARun(PluginDataObject[] reports,
|
||||
private PluginDataObject filterARun(PluginDataObject report,
|
||||
List<AbstractFilterElement> filterElements) {
|
||||
int reportCount = 0;
|
||||
if (reports != null) {
|
||||
|
||||
for (int i = 0; i < reports.length; i++) {
|
||||
if (report != null) {
|
||||
PluginDataObject r = null;
|
||||
boolean keep = true;
|
||||
for (AbstractFilterElement element : filterElements) {
|
||||
r = element.filter(reports[i]);
|
||||
r = element.filter(report);
|
||||
|
||||
// Only allow keep to be set to true. Once true it stays
|
||||
// that way.
|
||||
|
@ -200,26 +199,12 @@ public class MetarToShefFilter {
|
|||
}
|
||||
}
|
||||
if (keep) {
|
||||
reportCount++;
|
||||
report = r;
|
||||
} else {
|
||||
reports[i] = null;
|
||||
report = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (reportCount == 0) {
|
||||
reports = new PluginDataObject[0];
|
||||
} else {
|
||||
PluginDataObject[] newReports = new PluginDataObject[reportCount];
|
||||
int i = 0;
|
||||
// Copy in the reports that passed filtering.
|
||||
for (PluginDataObject report : reports) {
|
||||
if (report != null) {
|
||||
newReports[i++] = report;
|
||||
}
|
||||
}
|
||||
reports = newReports;
|
||||
}
|
||||
return reports;
|
||||
return report;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -228,19 +213,20 @@ public class MetarToShefFilter {
|
|||
*/
|
||||
// @Override
|
||||
public PluginDataObject[] filter(PluginDataObject[] reports) {
|
||||
PluginDataObject[] resultRpt = null;
|
||||
HashMap<String,MetarToShefRun> matchList = new HashMap<String,MetarToShefRun>();
|
||||
ArrayList<PluginDataObject> reportList = new ArrayList<PluginDataObject> ();
|
||||
for (PluginDataObject report : reports) {
|
||||
for (MetarToShefRun mtsr : metarToShefRun) {
|
||||
PluginDataObject[] tmpRprts = reports.clone();
|
||||
resultRpt = filterARun(tmpRprts, mtsr.getFilterElements());
|
||||
if (resultRpt != null && resultRpt.length >= 1) {
|
||||
logger.info("Report matchs in filter " + mtsr.getFilterName());
|
||||
MetarToShefTransformer.setCfgNOption(mtsr.getConfigFileName(),
|
||||
mtsr.getMetarToShefOptions());
|
||||
PluginDataObject resultRpt = filterARun(report, mtsr.getFilterElements());
|
||||
if (resultRpt != null ) {
|
||||
reportList.add(resultRpt);
|
||||
matchList.put(resultRpt.getDataURI(), mtsr);
|
||||
MetarToShefTransformer.setMatchList (matchList);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return resultRpt;
|
||||
}
|
||||
return (PluginDataObject[])reportList.toArray(new PluginDataObject[reportList.size()]);
|
||||
}
|
||||
|
||||
private void createDummyFilter() {
|
||||
|
|
|
@ -22,6 +22,7 @@ package com.raytheon.edex.transform.shef;
|
|||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.TimeZone;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -51,6 +52,7 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
|
|||
* AWIPS2 DR Work
|
||||
* 20120918 1185 jkorman Added save to archive capability.
|
||||
* Jan 30, 2010 15779 lbousaidi added 4 letter to station id for ACR
|
||||
* Aug 08, 2013 16408 wkwock Use different metar.cfg file and options
|
||||
* </pre>
|
||||
*
|
||||
* @author jkorman
|
||||
|
@ -81,9 +83,22 @@ public class MetarToShefTransformer extends
|
|||
private static final int P1_MIN = 50;
|
||||
private static final int P2_MAX = 5;
|
||||
|
||||
private static String cfgFileName="metar.cfg";
|
||||
private static String cmdLnOptions="";
|
||||
private static boolean refreshOptions=true;
|
||||
/*
|
||||
* Max list for optionsList and matchList to prevent memory leak.
|
||||
* (500 or any big number should be fine)
|
||||
*/
|
||||
private static final int MAX_LIST = 500;
|
||||
|
||||
/*
|
||||
* MetarToShefRun list which has metar.cfg file and options to used by conversion
|
||||
*/
|
||||
private static HashMap<String,MetarToShefRun> mtsrList = new HashMap<String,MetarToShefRun>();
|
||||
|
||||
/*
|
||||
* List of metar.cfg files + options.
|
||||
*/
|
||||
private HashMap<String,ObsToSHEFOptions> optionsList = new HashMap<String,ObsToSHEFOptions>();
|
||||
private ObsToSHEFOptions defaultOptions =null;
|
||||
|
||||
/**
|
||||
* Construct an instance of this transformer.
|
||||
|
@ -92,6 +107,7 @@ public class MetarToShefTransformer extends
|
|||
*/
|
||||
public MetarToShefTransformer(String cmdLine) {
|
||||
super(cmdLine, WMO_HEADER_FMT);
|
||||
defaultOptions = options;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -421,21 +437,38 @@ public class MetarToShefTransformer extends
|
|||
|
||||
public final byte[] transformMetar(MetarRecord report, Headers headers)
|
||||
throws TransformerException {
|
||||
if (refreshOptions) {
|
||||
logger.info("Metar to SHEF now use config file: "+cfgFileName+" with options:"+cmdLnOptions);
|
||||
options.setCfgFileName(cfgFileName);
|
||||
options.updateCommandLine(cmdLnOptions);
|
||||
options.updateOptions();
|
||||
refreshOptions=false;
|
||||
ObsToSHEFOptions tmpOptions=null;
|
||||
MetarToShefRun mtsr = mtsrList.get(report.getDataURI());
|
||||
if (mtsr==null) {
|
||||
tmpOptions = defaultOptions;
|
||||
} else {
|
||||
tmpOptions = optionsList.get(mtsr.getConfigFileName()+mtsr.getMetarToShefOptions());
|
||||
if (tmpOptions==null) {
|
||||
//just to prevent t memory leak
|
||||
if (optionsList.size()>MAX_LIST) {
|
||||
optionsList.clear();
|
||||
}
|
||||
tmpOptions = new ObsToSHEFOptions(mtsr.getConfigFileName(),mtsr.getMetarToShefOptions(),true);
|
||||
optionsList.put(mtsr.getConfigFileName()+mtsr.getMetarToShefOptions(), tmpOptions);
|
||||
}
|
||||
mtsrList.remove(report.getDataURI());
|
||||
}
|
||||
options=tmpOptions;
|
||||
logger.info("Metar to SHEF for "+report.getStationId()+" use config file: "+options.getCfgFileName()+" with options:"+mtsr.getMetarToShefOptions());
|
||||
configureArchiveDir();
|
||||
|
||||
return transformReport(report, headers);
|
||||
}
|
||||
|
||||
public static void setCfgNOption (String cfg, String options){
|
||||
cfgFileName=cfg;
|
||||
cmdLnOptions=options;
|
||||
refreshOptions=true;
|
||||
/*
|
||||
* set matchList
|
||||
*/
|
||||
public static void setMatchList (HashMap<String,MetarToShefRun> matchLst) {
|
||||
//should add to the list and remove after use. clear if reach certain big number
|
||||
if (mtsrList.size()>MAX_LIST) {
|
||||
mtsrList.clear();
|
||||
}
|
||||
|
||||
mtsrList.putAll(matchLst);
|
||||
}
|
||||
}
|
|
@ -58,6 +58,7 @@ import com.raytheon.uf.common.localization.PathManagerFactory;
|
|||
* ======================================
|
||||
* AWIPS2 DR Work
|
||||
* 20120918 1185 jkorman Added save to archive capability.
|
||||
* Aug 08, 2013 16408 wkwock Added get configuration file name function
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -66,9 +67,6 @@ import com.raytheon.uf.common.localization.PathManagerFactory;
|
|||
*/
|
||||
|
||||
public class ObsToSHEFOptions {
|
||||
// 1 minute update delta.
|
||||
private static final long UPDATE_DELTA = 60L * 1000L;
|
||||
|
||||
private static final String METAR_CFG = "metar.cfg";
|
||||
|
||||
private static final String ERROR_1_FMT = "Could not create {%s} context for file \"%s\"";
|
||||
|
@ -399,8 +397,6 @@ public class ObsToSHEFOptions {
|
|||
|
||||
private final boolean localized;
|
||||
|
||||
private long updateTime = 0;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param cmdLine
|
||||
|
@ -414,7 +410,20 @@ public class ObsToSHEFOptions {
|
|||
} else {
|
||||
readConfig(cfgFileName, optConfigContext);
|
||||
}
|
||||
updateTime = System.currentTimeMillis();
|
||||
}
|
||||
localized = useLocalized;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param cmdLine
|
||||
*/
|
||||
public ObsToSHEFOptions(String configFileName, String cmdLine, boolean useLocalized) {
|
||||
cfgFileName = configFileName;
|
||||
initOptions();
|
||||
parseCommandLine(cmdLine);
|
||||
if (useLocalized) {
|
||||
readConfig(cfgFileName, optConfigContext);
|
||||
}
|
||||
localized = useLocalized;
|
||||
}
|
||||
|
@ -845,16 +854,12 @@ public class ObsToSHEFOptions {
|
|||
* Check if the metar.cfg needs to be reread.
|
||||
*/
|
||||
public void updateOptions() {
|
||||
long cTime = System.currentTimeMillis() - updateTime;
|
||||
if (cTime > UPDATE_DELTA) {
|
||||
if (loaded && localized) {
|
||||
if (cfgFileName==null) {
|
||||
readConfig(METAR_CFG, optConfigContext);
|
||||
} else {
|
||||
readConfig(cfgFileName, optConfigContext);
|
||||
}
|
||||
updateTime = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -888,6 +893,8 @@ public class ObsToSHEFOptions {
|
|||
}else{
|
||||
readConfig(cfgFileName, optConfigContext);
|
||||
}
|
||||
} else {
|
||||
logger.warn("Uanble to read file "+cfgFileName);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -990,6 +997,10 @@ public class ObsToSHEFOptions {
|
|||
cfgFileName=fileName;
|
||||
}
|
||||
|
||||
public String getCfgFileName () {
|
||||
return cfgFileName;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
|
Loading…
Add table
Reference in a new issue