From fa95ba0228d5125a2808ce2812c9cbcf6fd1ab67 Mon Sep 17 00:00:00 2001 From: mjames-upc Date: Thu, 7 Jun 2018 15:53:26 -0600 Subject: [PATCH 01/18] postgis version update --- rpms/awips2.core/Installer.database/component.spec | 2 +- rpms/awips2.core/Installer.maps-database/component.spec | 2 +- rpms/awips2.core/Installer.ncep-database/component.spec | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rpms/awips2.core/Installer.database/component.spec b/rpms/awips2.core/Installer.database/component.spec index 5503f16b17..0660ef5cb0 100644 --- a/rpms/awips2.core/Installer.database/component.spec +++ b/rpms/awips2.core/Installer.database/component.spec @@ -270,7 +270,7 @@ execute_initial_sql_script ${SQL_SHARE_DIR}/initial_setup_server.sql > /dev/null /awips2/psql/bin/psql -U awips -d metadata -c "CREATE EXTENSION postgis;" > /dev/null 2>&1 /awips2/psql/bin/psql -U awips -d metadata -c "CREATE EXTENSION postgis_topology;" > /dev/null 2>&1 -execute_psql_sql_script /awips2/postgresql/share/contrib/postgis-2.2/legacy.sql metadata > /dev/null 2>&1 +execute_psql_sql_script /awips2/postgresql/share/contrib/postgis-2.4/legacy.sql metadata > /dev/null 2>&1 execute_psql_sql_script ${SQL_SHARE_DIR}/permissions.sql metadata > /dev/null 2>&1 execute_psql_sql_script ${SQL_SHARE_DIR}/fxatext.sql metadata > /dev/null 2>&1 diff --git a/rpms/awips2.core/Installer.maps-database/component.spec b/rpms/awips2.core/Installer.maps-database/component.spec index a71dd0c76b..796f9e5873 100644 --- a/rpms/awips2.core/Installer.maps-database/component.spec +++ b/rpms/awips2.core/Installer.maps-database/component.spec @@ -170,7 +170,7 @@ if [ "${MAPS_DB_EXISTS}" = "false" ]; then fi # Do we still need legacy? - SQL_FILE="/awips2/postgresql/share/contrib/postgis-2.0/legacy.sql" + SQL_FILE="/awips2/postgresql/share/contrib/postgis-2.4/legacy.sql" su - ${DB_OWNER} -c \ "${PSQL} -d maps -U awips -q -p 5432 -f ${SQL_FILE}" >> ${SQL_LOG} 2>&1 if [ $? -ne 0 ]; then diff --git a/rpms/awips2.core/Installer.ncep-database/component.spec b/rpms/awips2.core/Installer.ncep-database/component.spec index 990ceda87b..16c9dcb5d1 100644 --- a/rpms/awips2.core/Installer.ncep-database/component.spec +++ b/rpms/awips2.core/Installer.ncep-database/component.spec @@ -82,7 +82,7 @@ DB_OWNER=`ls -ld ${AWIPS2_DATA_DIRECTORY} | grep -w 'data' | awk '{print $3}'` # Our log file SQL_LOG="${DATABASE_INSTALL}/sqlScripts/share/sql/ncep/ncep_sql_install.log" SQL_SHARE_DIR="${DATABASE_INSTALL}/sqlScripts/share/sql/ncep" -LEGACY_SQL="/awips2/postgresql/share/contrib/postgis-2.0/legacy.sql" +LEGACY_SQL="/awips2/postgresql/share/contrib/postgis-2.4/legacy.sql" # Determine if PostgreSQL is running. I_STARTED_POSTGRESQL="NO" From e7a530ec295941d20638683404815e6418831752 Mon Sep 17 00:00:00 2001 From: mjames-upc Date: Thu, 7 Jun 2018 15:53:59 -0600 Subject: [PATCH 02/18] awips-ade docker build requires geos-devel --- build/awips-ade/Dockerfile.awips-ade.el6 | 2 +- build/awips-ade/Dockerfile.awips-ade.el7 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/awips-ade/Dockerfile.awips-ade.el6 b/build/awips-ade/Dockerfile.awips-ade.el6 index 476cb4b030..100cb12f30 100644 --- a/build/awips-ade/Dockerfile.awips-ade.el6 +++ b/build/awips-ade/Dockerfile.awips-ade.el6 @@ -16,7 +16,7 @@ RUN yum clean all -y ENV systemDeps="wget rsync git net-tools" ENV rpmDeps="gcc gcc-c++ rpm-build readline-devel createrepo" ENV qpidDeps="boost-devel cmake make ruby libuuid-devel" -ENV pythonDeps="tk-devel tcl-devel atlas-devel compat-libf2c-34 libgfortran geos libpng-devel freetype" +ENV pythonDeps="tk-devel tcl-devel atlas-devel compat-libf2c-34 libgfortran geos-devel libpng-devel freetype" ENV awipsDeps="netcdf netcdf-devel hdf5-devel lzo-devel bzip2-devel qt-devel" ENV httpDeps="autoconf findutils libselinux-devel libxml2-devel lua-devel openldap-devel openssl-devel pcre-devel pkgconfig perl zlib-devel apr-util-devel apr-devel" diff --git a/build/awips-ade/Dockerfile.awips-ade.el7 b/build/awips-ade/Dockerfile.awips-ade.el7 index 1d49db923a..7b99b676d1 100644 --- a/build/awips-ade/Dockerfile.awips-ade.el7 +++ b/build/awips-ade/Dockerfile.awips-ade.el7 @@ -16,7 +16,7 @@ RUN yum clean all -y ENV systemDeps="wget rsync git net-tools" ENV rpmDeps="gcc gcc-c++ rpm-build readline-devel createrepo" ENV qpidDeps="boost-devel cmake make ruby libuuid-devel" -ENV pythonDeps="tk-devel tcl-devel atlas-devel compat-libf2c-34 libgfortran geos libpng-devel freetype" +ENV pythonDeps="tk-devel tcl-devel atlas-devel compat-libf2c-34 libgfortran geos-devel libpng-devel freetype" ENV awipsDeps="netcdf netcdf-devel hdf5-devel lzo-devel bzip2-devel qt-devel" ENV httpDeps="autoconf findutils libselinux-devel libxml2-devel lua-devel openldap-devel openssl-devel pcre-devel pkgconfig perl zlib-devel apr-util-devel apr-devel" From b60c28d762c62b51dc178bc3aec9053b047b9620 Mon Sep 17 00:00:00 2001 From: mjames-upc Date: Thu, 7 Jun 2018 15:54:24 -0600 Subject: [PATCH 03/18] cull unused decoder plugins from com.raytheon.uf.edex.dataplugins.feature --- .../feature.xml | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/edexOsgi/com.raytheon.uf.edex.dataplugins.feature/feature.xml b/edexOsgi/com.raytheon.uf.edex.dataplugins.feature/feature.xml index 416466da9d..2a091992e1 100644 --- a/edexOsgi/com.raytheon.uf.edex.dataplugins.feature/feature.xml +++ b/edexOsgi/com.raytheon.uf.edex.dataplugins.feature/feature.xml @@ -198,14 +198,14 @@ install-size="0" version="0.0.0" unpack="false"/> - + - + - + - + - + - + - + - + - + - + - + Date: Thu, 7 Jun 2018 15:54:55 -0600 Subject: [PATCH 04/18] mute success log messages in DataStoreRepacker --- .../com/raytheon/uf/edex/maintenance/DataStoreRepacker.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/edexOsgi/com.raytheon.uf.edex.maintenance/src/com/raytheon/uf/edex/maintenance/DataStoreRepacker.java b/edexOsgi/com.raytheon.uf.edex.maintenance/src/com/raytheon/uf/edex/maintenance/DataStoreRepacker.java index 922264427e..1744947f33 100644 --- a/edexOsgi/com.raytheon.uf.edex.maintenance/src/com/raytheon/uf/edex/maintenance/DataStoreRepacker.java +++ b/edexOsgi/com.raytheon.uf.edex.maintenance/src/com/raytheon/uf/edex/maintenance/DataStoreRepacker.java @@ -82,13 +82,9 @@ public class DataStoreRepacker extends IDataStore ds = DataStoreFactory.getDataStore(new File(plugin)); try { - statusHandler.info("Starting repack of " + plugin - + " datastore"); long time = TimeUtil.currentTimeMillis(); ds.repack(compression); long etime = TimeUtil.currentTimeMillis(); - statusHandler.info("Completed repack of " + plugin - + " datastore. Took: " + (etime - time) + " ms"); } catch (StorageException e) { statusHandler.handle(Priority.PROBLEM, "Failed to repack datastore for plugin " + plugin, e); From 7fd4fa9c1a469249e1b0e855f286cd223f6325dd Mon Sep 17 00:00:00 2001 From: mjames-upc Date: Thu, 7 Jun 2018 15:55:12 -0600 Subject: [PATCH 05/18] cots/foss doc update --- docs/appendix/appendix-cots.md | 76 ++++++++++++++-------------------- 1 file changed, 32 insertions(+), 44 deletions(-) diff --git a/docs/appendix/appendix-cots.md b/docs/appendix/appendix-cots.md index f34a24a5ad..bbee3193ad 100644 --- a/docs/appendix/appendix-cots.md +++ b/docs/appendix/appendix-cots.md @@ -1,21 +1,20 @@ COTS and FOSS used in AWIPS -Component|Version|Description ----------|:-----:|---------- -ActiveMQ|5.3.0|JMS (still used by AlertViz and internally in parts of Camel) -Apache Batik|1.6|Batik is a Java-based toolkit for applications or applets that want to use images in the Scalable Vector Graphics (SVG) format for various purposes, such as display, generation or manipulation. -Apache MINA |1.1.7| Network application framework -Apache WSS4J |1.6.5| Web Services Security -Ant |1.7.1| Java Build Tool -Ant-Contrib |1.0b3| Additional useful tasks and types for Ant -Antlr |2.7.6| Parser generator +Component |Version|Description +--------------|:-----:|---------- +ActiveMQ |5.12.0 |JMS (still used by AlertViz and internally in parts of Camel) +Apache Batik |1.8 |Batik is a Java-based toolkit for applications or applets that want to use images in the Scalable Vector Graphics (SVG) format for various purposes, such as display, generation or manipulation. +Apache MINA |1.1.7 | Network application framework +Apache WSS4J |1.6.5 | Web Services Security +Ant |1.9.6 | Java Build Tool +Ant-Contrib |1.0b3 | Additional useful tasks and types for Ant +Antlr |2.7.6 | Parser generator Atomikos TransactionEssentials |3.6.2 | Transaction management system Bitstream Vera Fonts |1.10| Font library from Gnome bzip2 |none |Stream compression algorithm C3p0 |0.9.1 |c3p0 is an easy-to-use library for making traditional JDBC drivers "enterprise-ready" by augmenting them with functionality defined by the jdbc3 spec and the optional extensions to jdbc2. Camel |2.4 |Enterprise Service Bus cglib |2.2| Byte Code Generation Library is high level API to generate and transform JAVA byte code. -CherryPy |3.1.2| Object-oriented HTTP framework commons-beanutils |1.8.3| Apache Common Libraries commons-codec |1.4.1| Apache Common Libraries commons-collection |3.2| Apache Common Libraries @@ -29,14 +28,15 @@ commons-logging |1.1.1| Apache Common Libraries commons-management |1.0| Apache Common Libraries commons-pool |1.3| Apache Common Libraries commons-validator |1.2| Apache Common Libraries +cycler|0.10.0|Python library for composable style cycles +Cython|0.27.2|Superset of the Python programming language, designed to give C-like performance with code that is mostly written in Python +dateutil|2.6.1|Python extension to the standard datetime module dom4j |1.6.1| An open source library for working with XML, XPath, and XSLT on the Java platform using the Java Collections Framework dwr (direct web remoting) Getahead |1.1.3| Java open source library -Eclipse |3.6.1| Java IDE -Eclipse CDT |5.0.2| C/C++ IDE for Eclipse +Eclipse |4.5.1| Java IDE ehcache |1.3.0 |Caching Support -GEOS |3.0.2| Geometry Engine, Required for PostGIS +GEOS |3.6.2| Geometry Engine, Required for PostGIS GeoTools Java API |2.6.4| Java API for Manipulation of Geospatial Data -Geronimo-jms |1.1 spec 1.1.1| Server runtime framework GRIBJava |8.0| Grib Java Decoder h5py |1.3.0| HDF5 for Python hdf5 |1.8.4-patch1| Core HDF5 APIs @@ -46,61 +46,49 @@ IzPack |4.2.0| Installer creator for EDEX JAI |1.1.3| Java API for Image Manipulation JAI – Image I/O |1.1| Plug-ins for JAI Jasper |1.900.1| JPEG-2000 codec -Java |1.6u46| Kit for both 32-bit and 64-bit -javax.mail |1.4.3| mail modeling classes -javax.measure |1.0-beta-2| Strong types for measurements -javax.persistence |1.0.0| persistence classes and interfaces -javax.vecmath |1.3.1| Coordinates and vectors +Java |1.8u101| Kit for both 32-bit and 64-bit Jep |2.3+| Java Python interface -jetty |7.2.2| Jetty provides an HTTP server, HTTP client, and javax.servlet container -jGrapht |0.6.0| JGraphT is a free Java graph library that provides mathematical graphtheory objects and algorithms -JMock |2.0.0| Java Mock Object Framework -jna (java native access) |3.09| JNA provides Java programs easy access to native shared libraries (DLLs on Windows) without writing anything but Java code—no JNI or native code is required. This functionality is comparable to Windows' Platform/Invoke and Python's ctypes. Access is dynamic at runtime without code generation. -jogl |1.1.1-rc8| Provides hardware-supported 3D graphics -Jscience |4.3.1| Library for Scientific Calculations and Visualizations +jogamp |2.3.2| Provides hardware-supported 3D graphics JTS Topology Suite |1.10| Java API for 2D spatial data -JUnit |4.10| Java Unit Test Framework lapack |3.0.0| Linear Algebra Package for python -ldm |6.11.2, 6.11.6| Local Data Manager +ldm |6.13.6| Local Data Manager Log4J |1.2.16| Logging Component used by Commons Logging libgfortran |4.1.2| Fortran Library -matplotlib |0.99.1.1-r7813| Python 2D Plotting Library +matplotlib |1.5.3| Python 2D Plotting Library Mozilla Rhino |1.6R7| Implementation of JavaScript embedded in Java NCEP Grib2 Libraries|| Libraries for decoding & encoding data in GRIB2 format     cnvgrib |1.1.8 and 11.9| Fortran GRIB1 <--> GRIB2 conversion utility     g2clib |1.1.8| "C" grib2 encoder/decoder     g2lib |1.1.8 and 1.1.9| Fortran grib2 encoder/decoder and search/indexing routines     w3lib |1.6 and 1.7.1| Fortran grib1 encoder/decoder and utilities -nose |0.11.1| Python unittest extension -NumPy |1.3.0 |Numerical Python Scientific package for Python +NumPy |1.9.3 |Numerical Python Scientific package for Python objectweb asm |2.1| ASM is an all-purpose Java bytecode manipulation and analysis framework. It can be used to modify existing classes or dynamically generate classes, directly in binary form -Openfire |3.7.1| Collaboration Server – Not used but eventually will replace Wildfire. Only 3.7 approved. -pil |1.1.6| Python Imaging Library -PostGIS |1.3.5| Geographic Object Support for PostgreSQL -PostgreSQL |9.2.3, 9.2.4| Database -Proj |4.6.1| Cartographic Projections library -pupynere |1.0.13| Python module for reading and writing NetCDF files +PostGIS |2.4.4| Geographic Object Support for PostgreSQL +PostgreSQL |9.5.13| Database +Proj |5.1.0| Cartographic Projections library pydev |1.5| Python Development Environment -PyTables |2.1.2| Python package for managing hierarchical datasets -Python |2.7.1| Dynamic programming language +PyParsing|2.2.0|Python class library for the easy construction of recursive-descent parsers +PyTables |3.4.2| Python package for managing hierarchical datasets +pytz|2015.4|World Timezone Definitions for Python +Python |2.7.13| Dynamic programming language Python megawidgets |1.3.2| Toolkit for building high-level compound widgets in Python using the Tkinter module -Qpid |0.18| Open Source AMQP (Advanced Message Queuing Protocol) Messaging -SciPy |0.7.0| Python Library of Scientific Tools -ScientificPython |2.8| Python library for common tasks in scientific computing +Python Setuptools|28.6.0|Tools to download, build, install, upgrade, and uninstall Python packages +Qpid |6.1.4| Open Source AMQP (Advanced Message Queuing Protocol) Messaging +ScientificPython |2.8.1| Python library for common tasks in scientific computing +Shapely|1.6.4| Python package for manipulation and analysis of planar geometric objects. +Six|1.11.0|Python 2 and 3 Compatibility Library slf4j |1.6.1| The Simple Logging Facade for Java or (SLF4J) serves as a simple facade or abstraction for various logging frameworks smack |2.2.1| Smack is an Open Source XMPP (Jabber) client library for instant messaging and presence. stomp.py |revision 18| Python client library for accessing messaging servers Spring Framework OSGI |1.2.0| dynamic modules Spring Framework |2.5.6 |Layered Java/J2EE application platform -stomp.py |revision 18| Python client libarary for accessing messaging servers Subclipse |1.4.8| Eclipse plugin for Subversion support SWT Add-ons |0.1.1| Add-ons for Eclipse SWT widgets Symphony OGNL |2.7.3| Object-Graph Navigation Language; an expression language for getting/setting properties of Java objects. Thrift |20080411p1-3| Binary Serialization Framework Tomcat Native |1.1.17| Library for native memory control -TPG |3.1.2| Parser generator for Python utilconcurrent |1.3.2| Utility classes Velocity |1.5.0| Templating Engine -werkzeug |0.6.2| Python WSGI utility library +werkzeug |0.12.1| Python WSGI utility library Wildfire |3.1.1| Collaboration Server xmltask |1.15.1| Facility for automatically editing XML files as part of an Ant build From 5795a00b3c5b1032700e498e9517d0c0ac72f053 Mon Sep 17 00:00:00 2001 From: Michael James Date: Thu, 7 Jun 2018 16:10:21 -0600 Subject: [PATCH 06/18] remove timer logging from radar decoder --- .../raytheon/edex/plugin/radar/RadarDecoder.java | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/edexOsgi/com.raytheon.edex.plugin.radar/src/com/raytheon/edex/plugin/radar/RadarDecoder.java b/edexOsgi/com.raytheon.edex.plugin.radar/src/com/raytheon/edex/plugin/radar/RadarDecoder.java index 73afa110cb..740e3120c3 100644 --- a/edexOsgi/com.raytheon.edex.plugin.radar/src/com/raytheon/edex/plugin/radar/RadarDecoder.java +++ b/edexOsgi/com.raytheon.edex.plugin.radar/src/com/raytheon/edex/plugin/radar/RadarDecoder.java @@ -64,13 +64,10 @@ import com.raytheon.uf.common.dataplugin.radar.util.TiltAngleBin; import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.LocalizationContext; import com.raytheon.uf.common.localization.PathManagerFactory; -import com.raytheon.uf.common.status.IPerformanceStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.PerformanceStatus; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.common.time.util.ITimer; import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.common.wmo.AFOSProductId; import com.raytheon.uf.common.wmo.WMOHeader; @@ -151,9 +148,6 @@ public class RadarDecoder { private final String RADAR = "RADAR"; - private final IPerformanceStatusHandler perfLog = PerformanceStatus - .getHandler("Radar:"); - public RadarDecoder() throws DecoderException { String dir = ""; @@ -193,9 +187,6 @@ public class RadarDecoder { // decode the product String arch = new String(messageData, 0, 4); - ITimer timer = TimeUtil.getTimer(); - - timer.start(); // for level2 data, this does not happen very often if (LEVEL_TWO_IDENTS.contains(arch)) { decodeLevelTwoData(messageData, recordList); @@ -408,10 +399,6 @@ public class RadarDecoder { } finalizeRecord(record); - - timer.stop(); - perfLog.logDuration("Time to Decode", timer.getElapsedTime()); - recordList.add(record); } From e6c6643204ee3b158c5a982776f9dc35c189b85b Mon Sep 17 00:00:00 2001 From: Michael James Date: Thu, 7 Jun 2018 18:02:47 -0600 Subject: [PATCH 07/18] warngen JMS workaround, fixes #217 --- .../common/stormtrack/StormTrackDisplay.java | 18 +- .../viz/warngen/comm/WarningSender.java | 282 ------------------ .../viz/warngen/gui/WarngenDialog.java | 43 ++- 3 files changed, 38 insertions(+), 305 deletions(-) delete mode 100644 cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/comm/WarningSender.java diff --git a/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/common/stormtrack/StormTrackDisplay.java b/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/common/stormtrack/StormTrackDisplay.java index 57c6f0c83e..54f7814164 100644 --- a/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/common/stormtrack/StormTrackDisplay.java +++ b/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/common/stormtrack/StormTrackDisplay.java @@ -121,6 +121,7 @@ import com.vividsolutions.jts.geom.LineString; * if there is no storm motion. * 03-18-2016 ASM #18751 D. Friedman Followup for #18421: Do not set StormTrackState.oneStormAngle * when motion is zero. + * 06-07-2018 mjames@ucar Do not post data. * * * @@ -1001,7 +1002,6 @@ public class StormTrackDisplay implements IRenderable { } state.speed = speed; - postData(state); } private void generateNewTrackInfo(StormTrackState state, int anchorIndex, @@ -1154,7 +1154,6 @@ public class StormTrackDisplay implements IRenderable { state.timePoints = timePoints; state.futurePoints = futurePoints; - postData(state); } private Coordinate updateAnchorPoint(StormTrackState currentState, @@ -1468,19 +1467,4 @@ public class StormTrackDisplay implements IRenderable { return (360 + angle) % 360; } - private void postData(StormTrackState state) { - if (!(state.speed > 0)) { - return; - } - StormTrackData data = new StormTrackData(); - Coordinate[] coords = new Coordinate[state.timePoints.length]; - for (int i = 0; i < coords.length; ++i) { - coords[i] = new Coordinate(state.timePoints[i].coord); - } - data.setCoordinates(coords); - data.setMotionDirection(state.angle); - data.setMotionSpeed((int) mpsToKts.convert(state.speed)); - dataManager.setStormTrackData(data); - } - } diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/comm/WarningSender.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/comm/WarningSender.java deleted file mode 100644 index 777be074b9..0000000000 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/comm/WarningSender.java +++ /dev/null @@ -1,282 +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.warngen.comm; - -import java.net.UnknownHostException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.TimeZone; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.jms.BytesMessage; -import javax.jms.Connection; -import javax.jms.DeliveryMode; -import javax.jms.JMSException; -import javax.jms.MessageProducer; -import javax.jms.Session; - -import com.raytheon.uf.common.dataplugin.text.request.InsertStdTextProductRequest; -import com.raytheon.uf.common.serialization.SerializationUtil; -import com.raytheon.uf.common.status.IPerformanceStatusHandler; -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.PerformanceStatus; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.common.status.UFStatus.Priority; -import com.raytheon.uf.viz.core.comm.JMSConnection; -import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.localization.LocalizationManager; -import com.raytheon.uf.viz.core.requests.ThriftClient; -import com.raytheon.viz.core.mode.CAVEMode; -import com.raytheon.viz.texteditor.TextWorkstationConstants; -import com.raytheon.viz.texteditor.msgs.IWarngenObserver; -import com.raytheon.viz.texteditor.util.SiteAbbreviationUtil; - -/** - * Sends warning products to text workstation and text database. - * - *
- * 
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Nov 11, 2009            mschenke    Initial creation
- * 01Jun2010    2187       cjeanbap    Added operational mode functionality
- * 02Aug2010    2187       cjeanbap    Update variable/method signature to be consistent.
- * 04Oct2010    7193       cjeanbap    Add time-to-live value to MessageProducer.
- * Sep 13, 2013 2368       rjpeter     Set delivery mode to PERSISTENT.
- * May  7, 2015 ASM #17438 D. Friedman Clean up debug and performance logging.
- * Sep 03, 2015 4784       rjpeter     Set notifySubscriptions on sendToTextDatabase.
- * Jun 15, 2017 ----       mjames@ucar Force practice mode.
- * 
- * - * @author mschenke - * @version 1.0 - */ - -public class WarningSender implements IWarngenObserver { - private static final transient IUFStatusHandler statusHandler = UFStatus - .getHandler(WarningSender.class); - - private static final IPerformanceStatusHandler perfLog = PerformanceStatus - .getHandler("WG:"); - - private final String hostName = null; - - private boolean notifyError; - - private static final long MILLISECONDS_PER_SECOND = 1000; - - private static final long SECONDS_PER_MINUTE = 60; - - private static final long TTL_MINUTES = 5; - - private static Pattern PATTERN = Pattern.compile("(\\d{1,1})"); - - private static final SimpleDateFormat sdf; - - static { - sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); - sdf.setTimeZone(TimeZone.getTimeZone("GMT")); - } - - /* - * (non-Javadoc) Incoming message was not a binary - * - * @see - * com.raytheon.viz.texteditor.msgs.IWarngenObserver#setTextWarngenDisplay - * (java.lang.String) - */ - @Override - public void setTextWarngenDisplay(String warning, boolean ne) { - this.notifyError = ne; - - String number = "0"; - String host = TextWorkstationConstants.getId(); - long t0 = System.currentTimeMillis(); - String siteNode = SiteAbbreviationUtil.getSiteNode(LocalizationManager - .getInstance().getCurrentSite()); - perfLog.logDuration("Get site node time", - System.currentTimeMillis() - t0); - if (host == null) { - statusHandler.handle(Priority.ERROR, - "Text Workstation host not set in preferences."); - } else { - Matcher m = PATTERN.matcher(host); - if (m.find()) { - number = m.group(); - } - } - - String id = siteNode + "WRKWG" + number; - boolean sentToTextDatabase = false; - - try { - boolean messageNotSent = true; - int connectCount = 0; - t0 = System.currentTimeMillis(); - byte[] data = SerializationUtil.transformToThrift(id + ":" - + warning); - while (messageNotSent && (connectCount < 4)) { - Session s = null; - MessageProducer mp = null; - Connection conn = null; - try { - conn = JMSConnection.getInstance().getFactory() - .createConnection(); - s = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE); - mp = s.createProducer(s - .createQueue(TextWorkstationConstants - .getDestinationTextWorkstationQueueName())); - mp.setTimeToLive(TTL_MINUTES * SECONDS_PER_MINUTE - * MILLISECONDS_PER_SECOND); - BytesMessage m = s.createBytesMessage(); - m.writeBytes(data); - m.setJMSDeliveryMode(DeliveryMode.PERSISTENT); - mp.send(m); - long t1 = System.currentTimeMillis(); - perfLog.log(id + " sent to text workstation in " - + (t1 - t0) + "ms in " + (connectCount + 1) - + (connectCount > 0 ? " tries" : " try")); - messageNotSent = false; - } catch (JMSException e) { - if (notifyError) { - statusHandler - .handle(Priority.PROBLEM, - "Error trying to send product [" - + id - + "] to Text Workstation. Attempting to reconnect. ", - e); - notifyError = false; - } - } finally { - if (mp != null) { - try { - mp.close(); - mp = null; - } catch (Exception e) { - mp = null; - } - } - if (s != null) { - try { - s.close(); - s = null; - } catch (Exception e) { - s = null; - } - } - if (conn != null) { - try { - conn.close(); - conn = null; - } catch (Exception e) { - conn = null; - } - } - } - if (messageNotSent) { - if (!sentToTextDatabase) { - try { - sendToTextDatabase(id, warning); - sentToTextDatabase = true; - } catch (Exception e) { - statusHandler.handle(Priority.PROBLEM, - "Error trying to save product [" + id - + "] to Text Database: ", e); - } - } - - connectCount++; - switch (connectCount) { - case 1: - Thread.sleep(1000); - break; - case 2: - Thread.sleep(5 * 1000); - break; - case 3: - Thread.sleep(30 * 1000); - break; - case 4: - statusHandler.handle(Priority.PROBLEM, - "Could not reconnect (" + id - + ") after 3 tries: "); - break; - } - } - } - - if (!sentToTextDatabase) { - try { - sendToTextDatabase(id, warning); - sentToTextDatabase = true; - } catch (Exception e) { - statusHandler.handle(Priority.PROBLEM, - "Error trying to save product [" + id - + "] to Text Database: ", e); - } - } - } catch (UnknownHostException uhe) { - if (notifyError) { - statusHandler.handle(Priority.PROBLEM, - "unable to map hostname, " + hostName - + ", to an ip address", uhe); - notifyError = false; - } - - } catch (Exception e) { - statusHandler.handle(Priority.PROBLEM, - "Error trying to send product [" + id - + "] to Text Workstation: ", e); - } - - } - - /** - * Saves a product to the text database. - * - * @param id - * @param warning - * @throws VizException - */ - public static void sendToTextDatabase(String id, String warning) - throws VizException { - boolean operationalMode = false; - - // Generate StdTextProduct and insert into db - long t0 = System.currentTimeMillis(); - InsertStdTextProductRequest request = new InsertStdTextProductRequest(id, warning, - operationalMode); - request.setNotifySubscriptions(true); - ThriftClient.sendRequest(request); - - perfLog.logDuration(id + " save to textdb", - System.currentTimeMillis() - t0); - } - - public static String getCurTimeString() { - String rval = null; - synchronized (sdf) { - rval = sdf.format(new Date()); - } - return rval; - } -} diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java index 8c7363f017..55e5d678c6 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java @@ -87,11 +87,12 @@ import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.localization.LocalizationManager; import com.raytheon.uf.viz.core.maps.MapManager; import com.raytheon.uf.viz.core.requests.ThriftClient; -import com.raytheon.uf.viz.d2d.ui.map.SideView; import com.raytheon.viz.awipstools.common.stormtrack.StormTrackState.DisplayType; import com.raytheon.viz.awipstools.common.stormtrack.StormTrackState.Mode; import com.raytheon.viz.core.mode.CAVEMode; -import com.raytheon.viz.texteditor.msgs.IWarngenObserver; +import com.raytheon.viz.texteditor.TextWorkstationConstants; +import com.raytheon.viz.texteditor.dialogs.TextEditorDialog; +import com.raytheon.viz.texteditor.util.SiteAbbreviationUtil; import com.raytheon.viz.texteditor.util.VtecUtil; import com.raytheon.viz.ui.EditorUtil; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; @@ -100,7 +101,6 @@ import com.raytheon.viz.ui.input.EditableManager; import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations; import com.raytheon.viz.warngen.Activator; import com.raytheon.viz.warngen.WarngenConstants; -import com.raytheon.viz.warngen.comm.WarningSender; import com.raytheon.viz.warngen.gis.PolygonUtil; import com.raytheon.viz.warngen.template.TemplateRunner; import com.raytheon.viz.warngen.util.CurrentWarnings; @@ -189,6 +189,7 @@ import com.vividsolutions.jts.geom.Polygon; * Feb 16, 2016 DR 17531 Qinglu Lin Added overloaded setTrackLocked(boolean, boolean), updated expSelected(). * Jul 07, 2016 DR 5665 Jon Schmid Corrected WarngenLayer duration save and restore when selecting new TrackType. * Jun 25, 2017 mjames@ucar Simple dialog. + * Jun 07, 2018 mjames@ucar Bypass JMS messaging and send directly to a textWS window. * * * @author chammack @@ -214,6 +215,8 @@ public class WarngenDialog extends CaveSWTDialog implements private static final int FONT_HEIGHT = 9; + private static Pattern PATTERN = Pattern.compile("(\\d{1,1})"); + private class TemplateRunnerInitJob extends Job { private final String site; @@ -339,7 +342,7 @@ public class WarngenDialog extends CaveSWTDialog implements private boolean invalidFollowUpAction = false; - private final IWarngenObserver wed = new WarningSender(); + private TextEditorDialog wgDlg; /** Bullet list font. */ private Font bulletListFont = null; @@ -1264,7 +1267,7 @@ public class WarngenDialog extends CaveSWTDialog implements try { String result = resultContainer[0]; if (result != null) { - wed.setTextWarngenDisplay(result, true); + setTextWarngenDisplay(result); updateWarngenUIState(result); } else { statusHandler.handle(Priority.PROBLEM, @@ -1290,7 +1293,35 @@ public class WarngenDialog extends CaveSWTDialog implements } } - private boolean checkDamSelection() { + protected void setTextWarngenDisplay(String warning) { + String number = "0"; + String host = TextWorkstationConstants.getId(); + String siteNode = SiteAbbreviationUtil.getSiteNode(LocalizationManager + .getInstance().getCurrentSite()); + if (host == null) { + statusHandler.handle(Priority.ERROR, + "Text Workstation host not set in preferences."); + } else { + Matcher m = PATTERN.matcher(host); + if (m.find()) { + number = m.group(); + } + } + String id = siteNode + "WRKWG" + number; + try { + String product = id + ":" + warning; + if (wgDlg == null) { + wgDlg = new TextEditorDialog(getShell(), "Text Warngen", false, + "9", true); + } + wgDlg.showWarngenProduct(product, null); + } catch (Exception e) { + statusHandler.handle(Priority.PROBLEM, + "Error trying to send product [" + id + "] to Text Workstation: ", e); + } + } + + private boolean checkDamSelection() { if (bulletListManager.isDamNameSeletcted() && (bulletListManager.isDamCauseSelected() == false)) { /* From be2111f70c678aeb013e7c3d006b63b9946d7c8f Mon Sep 17 00:00:00 2001 From: Michael James Date: Fri, 8 Jun 2018 11:15:06 -0600 Subject: [PATCH 08/18] warngen ui cleanup --- .../dialogs/AWIPSHeaderBlockDlg.java | 3 - .../texteditor/dialogs/QCConfirmationMsg.java | 66 -- .../dialogs/RemoteSiteRequestDlg.java | 581 -------------- .../dialogs/SendConfirmationMsg.java | 102 --- .../texteditor/dialogs/TextEditorDialog.java | 745 +----------------- .../dialogs/WarnGenConfirmationDlg.java | 203 ----- .../viz/warngen/WarngenConstants.java | 2 +- .../viz/warngen/gui/WarngenAction.java | 23 - .../viz/warngen/gui/WarngenDialog.java | 249 ++---- 9 files changed, 78 insertions(+), 1896 deletions(-) delete mode 100644 cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/QCConfirmationMsg.java delete mode 100644 cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/RemoteSiteRequestDlg.java delete mode 100644 cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/SendConfirmationMsg.java delete mode 100644 cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/WarnGenConfirmationDlg.java 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 latest = null; - try { - latest = CommandFactory.getAfosCommand(req.getAfosID()) - .executeCommand(); - } catch (CommandFailedException e) { - statusHandler.handle(Priority.PROBLEM, - "Error retrieving metatdata", e); - // but keep going... - } - - if (latest != null && latest.size() > 0) { - Calendar c = new GregorianCalendar(TimeZone.getTimeZone("GMT")); - c.setTimeInMillis(latest.get(0).getRefTime()); - req.setMostRecentTime(c.getTimeInMillis()); // default - try { - WMOHeader wmo = new WMOHeader(latest.get(0).getProduct() - .getBytes()); - Calendar t = getCloserCalendar(c, - createCalRelativeTo(c, wmo, 0), - createCalRelativeTo(c, wmo, 1)); - t = getCloserCalendar(c, t, createCalRelativeTo(c, wmo, -1)); - req.setMostRecentTime(t.getTimeInMillis()); - } catch (Exception e) { - statusHandler.handle(Priority.PROBLEM, - "Error determining product time", e); - } - } else - req.setMostRecentTime(0); - - String ttaaii = ttaaiiTF.getText(); - String cccc = ccccTF.getText(); - if (ttaaii.length() > 0 && cccc.length() > 0) { - req.setWmoHeader(ttaaii + " " + cccc); - } else { - req.setWmoHeader(""); - } - - req.setValidTime(System.currentTimeMillis() + 600 * 1000); // Current - // time plus - // 10 minutes - - setReturnValue(req); - return true; - } - - private void textFieldKeyListener(final StyledText tf, - final StyledText previousTF, final StyledText nextTF) { - tf.addKeyListener(new KeyAdapter() { - - @Override - public void keyPressed(KeyEvent e) { - char c = e.character; - - if (Character.isLetterOrDigit(c) || Character.isSpaceChar(c)) { - int pos = tf.getCaretOffset(); - String text = tf.getText(); - - if (text.length() > pos) { - StringBuilder b = new StringBuilder(text); - b.deleteCharAt(pos); - tf.setText(b.toString()); - tf.setSelection(pos); - } - } else if (e.keyCode == SWT.ARROW_UP) { - previousTF.setFocus(); - previousTF.selectAll(); - } else if (e.keyCode == SWT.ARROW_DOWN) { - nextTF.setFocus(); - nextTF.selectAll(); - } - } - }); - } - - private void textFieldVerifyListener(final StyledText tf) { - tf.addVerifyListener(new VerifyListener() { - @Override - public void verifyText(VerifyEvent e) { - e.text = e.text.toUpperCase(); - StringBuilder b = null; - int posMod = 0; - char[] chars = e.text.toCharArray(); - for (int i = 0; i < chars.length; i++) { - char c = chars[i]; - if (!Character.isLetterOrDigit(c) - && !Character.isSpaceChar(c)) { - if (b == null) { - b = new StringBuilder(e.text); - } - b.deleteCharAt(i - posMod++); - } - } - - if (b != null) { - e.text = b.toString(); - } - } - }); - } - - private void textFieldModifyListener(final StyledText tf, - final StyledText nextTF, final boolean limitCheck) { - tf.addModifyListener(new ModifyListener() { - @Override - public void modifyText(ModifyEvent event) { - if (!limitCheck || tf.getCharCount() == tf.getTextLimit()) { - if (wmoIdSelectionDialog == null) { - lookupWmoIDs(); - } else { - wmoIdSelectionDialog.close(); - wmoIdSelectionDialog = null; - lookupWmoIDs(); - } - } else { - if (wmoIdSelectionDialog != null) { - wmoIdSelectionDialog.close(); - wmoIdSelectionDialog = null; - } - setWmoId("", ""); - checkEnableEnter(); - } - - if (!isDisposed()) { - if (tf.getCaretOffset() == tf.getTextLimit()) { - nextTF.setFocus(); - nextTF.selectAll(); - } - - checkEnableEnter(); - } - } - }); - } - - private void lookupWmoIDs() { - if (lookupAllowed && wsfoIdTF.getCharCount() == wsfoIdTF.getTextLimit() - && productCatTF.getCharCount() == productCatTF.getTextLimit() - && prodDesignatorTF.getText().length() > 0) { - GetWmoIdRequest request = new GetWmoIdRequest(); - request.setAfosId(wsfoIdTF.getText() + productCatTF.getText() - + prodDesignatorTF.getText()); - lookupAllowed = false; - - try { - Object response = ThriftClient.sendRequest(request); - if (response != null) { - if (response instanceof AfosWmoIdDataContainer) { - AfosWmoIdDataContainer container = (AfosWmoIdDataContainer) response; - if (container.getErrorMessage() != null) { - statusHandler - .handle(Priority.PROBLEM, - "Error occurred looking up WMO IDs\nMessage from server[" - + container - .getErrorMessage() - + "]"); - } - - java.util.List list = container - .getIdList(); - - if (list.size() > 1) { - ArrayList ttaaiiIds = new ArrayList( - list.size()); - ArrayList ccccIds = new ArrayList( - list.size()); - for (AfosToAwips id : list) { - ttaaiiIds.add(id.getWmottaaii()); - ccccIds.add(id.getWmocccc()); - } - - wmoIdSelectionDialog = new WmoIdSelectionDialog( - shell, this, ttaaiiIds, ccccIds); - wmoIdSelectionDialog - .addCloseCallback(new ICloseCallback() { - - @Override - public void dialogClosed( - Object returnValue) { - lookupAllowed = true; - wmoIdSelectionDialog = null; - } - }); - wmoIdSelectionDialog.setBlockOnOpen(false); - wmoIdSelectionDialog.open(); - return; - } else if (list.size() == 1) { - AfosToAwips id = list.get(0); - setWmoId(id.getWmottaaii(), id.getWmocccc()); - } else { - setWmoId("", ""); - } - checkEnableEnter(); - } else { - statusHandler.handle(Priority.PROBLEM, - "Received unhandled WMO Id lookup response from server. Received obj of type [" - + response.getClass() + "], contents[" - + response + "]"); - } - } - } catch (VizException e) { - statusHandler.handle(Priority.PROBLEM, - "Error occurred looking up WMO IDs", e); - } - - lookupAllowed = true; - } - } - - public void setRequest(RemoteRetrievalRequest lastRemoteRetrievalRequest) { - initialAfosID = null; - if (lastRemoteRetrievalRequest != null) - initialAfosID = lastRemoteRetrievalRequest.getAfosID(); - } - - private void checkEnableEnter() { - boolean enabled = false; - if (enterBtn != null && !isDisposed()) { - if (ttaaiiTF.getCharCount() > 0 && ccccTF.getCharCount() > 0 - && addresseeTF.getCharCount() > 0) { - enabled = true; - } - enterBtn.setEnabled(enabled); - } - } - - @Override - public void setWmoId(String ttaaii, String cccc) { - ttaaiiTF.setText(ttaaii); - ccccTF.setText(cccc); - checkEnableEnter(); - } -} diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/SendConfirmationMsg.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/SendConfirmationMsg.java deleted file mode 100644 index 374c7852ca..0000000000 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/SendConfirmationMsg.java +++ /dev/null @@ -1,102 +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.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. - * - *
- * 
- * 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 excludedPhenSigs = null; - try { - excludedPhenSigs = getETNRules().getExcludePhenSigs(); - } catch (Exception e) { - statusHandler.handle(Priority.WARN, - "Error loading ETN assignment rules. Will use default rules.", - e); - excludedPhenSigs = defaultNoETNIncrementPhenSigs; - } - boolean result = true; - VtecObject vo = VtecUtil.parseMessage(prod.getProduct()); - if (vo != null && excludedPhenSigs != null - && excludedPhenSigs.contains(vo.getPhensig())) { - result = false; - } - return result; - } - - /** * Recreates the original message by combining the header and the body from * the edit windows. @@ -6320,8 +5823,6 @@ public class TextEditorDialog extends CaveSWTDialog // Automatically open the editor window with returned data. if (enterEditor) { enterEditor(); - } else { - resendWarningProductnItem.setEnabled(true); } } } @@ -6548,8 +6049,6 @@ public class TextEditorDialog extends CaveSWTDialog if (statusBarLabel.getText().contains("Attachment: ")) { statusBarLabel.setText(""); - attachedFile = null; - attachedFilename = null; } } @@ -7216,49 +6715,6 @@ public class TextEditorDialog extends CaveSWTDialog updateButtonology(commandText); } - private boolean validateCharacterSet(String nnn) { - boolean rval = true; - - Pattern UPPER_PATTERN = Pattern.compile("[^" + Pattern.quote( - TextEditorCfg.getTextEditorCfg().getUpperCaseValidCharcters()) - + "]"); - - Pattern MIXED_PATTERN = Pattern.compile("[^" + Pattern.quote( - TextEditorCfg.getTextEditorCfg().getMixedCaseValidCharacters()) - + "]"); - - String body = textEditor.getText(); - Pattern pattern; - if (MixedCaseProductSupport.isMixedCase(nnn)) { - pattern = MIXED_PATTERN; - } else { - body = body.toUpperCase(); - pattern = UPPER_PATTERN; - } - - String[] separatedLines = body.split("\n"); - int lineNum = 0; - for (String line : separatedLines) { - lineNum++; - Matcher matcher = pattern.matcher(line); - if (matcher.find()) { - rval = false; - - String errorMsg = "Illegal character '" + matcher.group() - + "' on line " + lineNum + ", column " - + (matcher.start() + 1); - userInformation(errorMsg); - if (!textEditor.isDisposed()) { - int offset = body.indexOf(matcher.group()); - textEditor.setSelection(offset, offset + 1); - textEditor.redraw(); - textEditor.setFocus(); - } - } - } - return rval; - } - /** * Checks product to verify all required fields have been filled in. * @@ -7275,7 +6731,7 @@ public class TextEditorDialog extends CaveSWTDialog if (endIndex >= startIndex) { rval = false; userInformation( - "You must modify the selected region before sending or saving the product."); + "Product requires changes before saving"); if (!textEditor.isDisposed()) { textEditor.setSelection(startIndex, endIndex + 3); textEditor.setFocus(); @@ -7286,29 +6742,6 @@ public class TextEditorDialog extends CaveSWTDialog return rval; } - /** - * Checks to see if a product can be resent. - * - * @return true when product can be resent - */ - private boolean verifyResendProduct() { - boolean resend = true; - - String body = textEditor.getText(); - StdTextProduct stdTextProduct = TextDisplayModel.getInstance() - .getStdTextProduct(token); - if (body == null || body.length() == 0) { - userInformation("Resend Warning Product Error", - "There is no product to send. \n Action aborted!"); - resend = false; - } else if (isProductForbiddenToEdit(stdTextProduct, - "Resend Warning Product Error", false)) { - resend = false; - } - - return resend; - } - /** * Add RESENT to the end of the MND line */ @@ -7340,20 +6773,6 @@ public class TextEditorDialog extends CaveSWTDialog return sb.toString(); } - private void removeOptionalFields() { - String text = textEditor.getText(); - int startIndex = text.indexOf("!--"); - int endIndex = text.indexOf("--!", startIndex); - while (startIndex >= 0 && endIndex >= startIndex) { - String part1 = text.substring(0, startIndex).trim(); - String part2 = text.substring(endIndex + 3).trim(); - text = part1 + "\n\n" + part2; - startIndex = text.indexOf("!--"); - endIndex = text.indexOf("--!", startIndex); - } - textEditor.setText(text); - } - /* * This class handles a timer to auto save a product to a file. */ @@ -7765,17 +7184,6 @@ public class TextEditorDialog extends CaveSWTDialog } } - /* - * This class handles sending a request to a Thrift Client. - */ - private class ThriftClientRunnable implements Runnable { - - @Override - public void run() { - - } - } - /* * (non-Javadoc) * @@ -8513,71 +7921,6 @@ public class TextEditorDialog extends CaveSWTDialog return lineText; } - /** - * Determine if the contents of a file contains a text field. - * - * @param file - * @return - * @throws IOException - */ - private boolean isTextFile(File file) throws IOException { - boolean result = false; - - byte[] bytesFromFile = getBytesFromFile(file); - for (byte b : bytesFromFile) { - if (b == 0x09 || b == 0x0A || b == 0x0C || b == 0x0D - || b >= 0x20 && b <= 0x7E) { - result = true; - break; - } - } - - return result; - } - - /** - * Get the contents of file as a byte array. - * - * @param file - * @return bytes - * @throws IOException - */ - private byte[] getBytesFromFile(File file) throws IOException { - byte[] bytes = null; - - try (InputStream is = new FileInputStream(file)) { - - // Get the size of the file - long length = file.length(); - - if (length > Integer.MAX_VALUE) { - // File is too large - } - - // Create the byte array to hold the data - bytes = new byte[(int) length]; - - // Read in the bytes - int offset = 0; - int numRead = 0; - while (offset < bytes.length && (numRead = is.read(bytes, offset, - bytes.length - offset)) >= 0) { - offset += numRead; - } - - // Ensure all the bytes have been read in - if (offset < bytes.length) { - throw new IOException( - "Could not completely read file " + file.getName()); - } - } catch (Exception ex) { - statusHandler.handle(Priority.PROBLEM, - "Error opening input stream.", ex); - } - - return bytes; - } - private void clearButtons() { if (autoWrapMenuItem != null) { Menu menu = autoWrapMenuItem.getMenu(); @@ -8587,15 +7930,6 @@ public class TextEditorDialog extends CaveSWTDialog } } - /** - * Set the enable state of the editor's send button. - * - * @param state - */ - public void enableSend(boolean state) { - editorSendBtn.setEnabled(state); - } - /** * Queue a afosId and who to noify. * @@ -8651,32 +7985,6 @@ public class TextEditorDialog extends CaveSWTDialog return retval; } - /** - * Retrieve a product from a remote site instead of the local server. - * - * @param req - */ - private void sendRemoteRetrievalRequest(final RemoteRetrievalRequest req) { - Job job = new Job("Remote Product Request") { - @Override - protected IStatus run(IProgressMonitor monitor) { - try { - RemoteRetrievalResponse response = (RemoteRetrievalResponse) ThriftClient - .sendRequest(req); - statusHandler.handle( - response.isOk() ? Priority.INFO : Priority.ERROR, - response.getStatusMessage()); - } catch (VizException e) { - statusHandler.error("Remote request failed", e); - } - return Status.OK_STATUS; - } - }; - job.setPriority(Job.LONG); - job.setSystem(true); - job.schedule(); - } - /** * Check of the bbb string to make it the empty string when it is for a * normal product. @@ -8699,7 +8007,6 @@ public class TextEditorDialog extends CaveSWTDialog editorCopyBtn.setEnabled(false); editorPasteBtn.setEnabled(false); editorFillBtn.setEnabled(false); - editorAttachBtn.setEnabled(false); overStrikeItem.setEnabled(false); if (!isTemplateOverwriteModeSet) { if (overwriteMode) { @@ -8716,7 +8023,6 @@ public class TextEditorDialog extends CaveSWTDialog editorCopyBtn.setEnabled(true); editorPasteBtn.setEnabled(true); editorFillBtn.setEnabled(true); - editorAttachBtn.setEnabled(true); if (isTemplateOverwriteModeSet && !overwriteMode) { textEditor.invokeAction(ST.TOGGLE_OVERWRITE); isTemplateOverwriteModeSet = false; @@ -8772,12 +8078,6 @@ public class TextEditorDialog extends CaveSWTDialog * @return true when able to send text product */ private boolean validateTime() { - if (shell != null && !shell.isDisposed() && shell.isVisible() - && !SimulatedTimeOperations.isTransmitAllowed()) { - SimulatedTimeOperations.displayFeatureLevelWarning(shell, - "Send Text Product"); - return false; - } return true; } @@ -8866,49 +8166,6 @@ public class TextEditorDialog extends CaveSWTDialog return paddingPatternList; } - private boolean verifyLineWidth(final boolean resend) { - int lineToWrap = findLineToWrap(); - if (lineToWrap == -1) { - return true; - } - LineWrapCheckConfirmationMsg lineWrapCheckConfirmationMsg = new LineWrapCheckConfirmationMsg( - shell); - lineWrapCheckConfirmationMsg.setCloseCallback(new ICloseCallback() { - - @Override - public void dialogClosed(Object returnValue) { - if (AnswerChoices.EDIT.equals(returnValue)) { - // do nothing - } else if (AnswerChoices.FIX.equals(returnValue)) { - while (findLineToWrap() > -1) { - int lineToWrap = findLineToWrap(); - // recompileRegex might not have been called - if (standardWrapRegex == null) { - recompileRegex(); - } - rewrapInternal(lineToWrap); - } - concludeSendProduct(resend); - } else if (AnswerChoices.SEND.equals(returnValue)) { - concludeSendProduct(resend); - } - } - }); - lineWrapCheckConfirmationMsg.open(); - return false; - } - - private int findLineToWrap() { - int rval = -1; - for (int i = 0; i < textEditor.getLineCount(); ++i) { - String line = textEditor.getLine(i).trim(); - if (line.length() > charWrapCol) { - return i; - } - } - return rval; - } - private void logInfo(String s) { statusHandler.handle(Priority.INFO, "Text " + token + " TextEditorDialog (UI Trace) - " + s); } diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/WarnGenConfirmationDlg.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/WarnGenConfirmationDlg.java deleted file mode 100644 index 004488e6ba..0000000000 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/WarnGenConfirmationDlg.java +++ /dev/null @@ -1,203 +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 org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -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.Shell; - -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.viz.core.mode.CAVEMode; -import com.raytheon.viz.texteditor.Activator; -import com.raytheon.viz.ui.dialogs.CaveSWTDialog; - -/** - * Main Text Editor dialog. - * - *
- * 
- * 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 { @Override public Object execute(ExecutionEvent arg0) throws ExecutionException { - - if ((textWorkstationDlg == null) || textWorkstationDlg.isDisposed()) { - textWorkstationDlg = new TextWorkstationDlg(Display.getCurrent()); - textWorkstationDlg.setCloseCallback(new ICloseCallback() { - - @Override - public void dialogClosed(Object returnValue) { - textWorkstationDlg = null; - } - }); - textWorkstationDlg.open(); - } else { - textWorkstationDlg.bringToTop(); - } - - if (!SimulatedTimeOperations.isTransmitAllowed()) { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); - SimulatedTimeOperations - .displayFeatureLevelWarning(shell, "WarnGen"); - return null; - } - return super.execute(arg0); } } diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java index 55e5d678c6..0f92687aa3 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java @@ -85,7 +85,6 @@ import com.raytheon.uf.viz.core.IDisplayPaneContainer; import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.localization.LocalizationManager; -import com.raytheon.uf.viz.core.maps.MapManager; import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.viz.awipstools.common.stormtrack.StormTrackState.DisplayType; import com.raytheon.viz.awipstools.common.stormtrack.StormTrackState.Mode; @@ -96,7 +95,6 @@ import com.raytheon.viz.texteditor.util.SiteAbbreviationUtil; import com.raytheon.viz.texteditor.util.VtecUtil; import com.raytheon.viz.ui.EditorUtil; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; -import com.raytheon.viz.ui.dialogs.ICloseCallback; import com.raytheon.viz.ui.input.EditableManager; import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations; import com.raytheon.viz.warngen.Activator; @@ -239,15 +237,6 @@ public class WarngenDialog extends CaveSWTDialog implements private static String UPDATELISTTEXT = "UPDATE LIST "; - /** "OK" button text */ - private static final String OK_BTN_LABEL = "Create Text"; - - /** "Restart" button text */ - private static final String RS_BTN_LABEL = "Reset"; - - /** "Cancel" button text */ - private static final String CLOSE_BUTTON_LABEL = "Close"; - private static final double MIN_LATLON_DIFF = 1.0E-5; private static final double MIN_DIFF = 1.0E-8; @@ -258,8 +247,6 @@ public class WarngenDialog extends CaveSWTDialog implements final DateFormat df = new SimpleDateFormat("HH:mm EEE d-MMM"); - private final java.util.List mapsLoaded = new ArrayList(); - private Button okButton; private final BulletListManager bulletListManager; @@ -292,8 +279,6 @@ public class WarngenDialog extends CaveSWTDialog implements private Button fromTrack; - private Button warnedAreaVisible; - private Button[] mainProductBtns; private Button other; @@ -308,10 +293,6 @@ public class WarngenDialog extends CaveSWTDialog implements private Button track; - private Button changeBtn; - - private ValidPeriodDialog validPeriodDlg; - private boolean boxEditable = true; private boolean trackEditable = true; @@ -332,9 +313,9 @@ public class WarngenDialog extends CaveSWTDialog implements private Button restartBtn; - private Text start; - - private Text end; + private Label validPeriod; + + private static String SEP = " to "; private Text instructionsBox; @@ -487,18 +468,48 @@ public class WarngenDialog extends CaveSWTDialog implements /** * @param mainComposite + * + * + * + private void createRedrawBoxGroup(Composite mainComposite) { + + Group redrawBox = new Group(mainComposite, SWT.NONE); + + GridLayout gl = new GridLayout(1, false); + gl.verticalSpacing = 2; + gl.marginHeight = 1; + redrawBox.setLayout(gl); + redrawBox.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, + 1)); + + Composite redrawFrom = new Composite(redrawBox, SWT.NONE); + int columns = debug ? 4 : 3; + redrawFrom.setLayout(new GridLayout(columns, false)); + redrawFrom.setLayoutData(new GridData(SWT.DEFAULT, SWT.FILL, false, + true)); + + createRedrawFromControls(redrawFrom); + } + * */ private void createTimeRangeGroup(Composite mainComposite) { + Group timeRange = new Group(mainComposite, SWT.NONE); - timeRange.setText("Time Range"); - timeRange.setLayout(new GridLayout(6, false)); - - Label dur = new Label(timeRange, SWT.BOLD); - dur.setText("Duration:"); - + GridLayout gl = new GridLayout(1, false); + gl.verticalSpacing = 2; + gl.marginHeight = 1; + timeRange.setLayout(gl); + timeRange.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, + 1)); + + Composite timeRangeComp = new Composite(timeRange, SWT.NONE); + timeRangeComp.setLayout(new GridLayout(3, false)); + timeRangeComp.setLayoutData(new GridData(SWT.DEFAULT, SWT.FILL, false, + true)); + GridData gd = new GridData(); - gd.horizontalSpan = 3; - durationList = new Combo(timeRange, SWT.READ_ONLY); + gd.horizontalSpan = 1; + durationList = new Combo(timeRangeComp, SWT.READ_ONLY); WarngenConfiguration config = warngenLayer.getConfiguration(); if (config.getDefaultDuration() != 0) { setDefaultDuration(config.getDefaultDuration()); @@ -507,7 +518,7 @@ public class WarngenDialog extends CaveSWTDialog implements } setDurations(config.getDurations()); durationList.setText(defaultDuration.displayString); - durationList.setLayoutData(gd); + //durationList.setLayoutData(gd); durationList.setEnabled(config.isEnableDuration()); startTime = TimeUtil.newCalendar(); @@ -515,26 +526,12 @@ public class WarngenDialog extends CaveSWTDialog implements defaultDuration.minutes); gd = new GridData(); - gd.horizontalSpan = 3; - start = new Text(timeRange, SWT.BORDER | SWT.READ_ONLY); - start.setLayoutData(gd); - start.setText(df.format(this.startTime.getTime())); - - new Label(timeRange, SWT.NONE).setText(" to "); - - end = new Text(timeRange, SWT.BORDER | SWT.READ_ONLY); - end.setText(df.format(this.endTime.getTime())); - - changeBtn = new Button(timeRange, SWT.PUSH); - changeBtn.setText("Change..."); - changeBtn.setEnabled(!config.isEnableDuration()); - changeBtn.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - changeSelected(); - } - }); - + gd.horizontalSpan = 2; + validPeriod = new Label(timeRangeComp, SWT.FILL); + //validPeriod.setLayoutData(gd); + validPeriod.setText( df.format(this.startTime.getTime()) + + SEP + df.format(this.endTime.getTime())); + durationList.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -545,7 +542,6 @@ public class WarngenDialog extends CaveSWTDialog implements private void createProductTypeGroup(Composite mainComposite) { productType = new Group(mainComposite, SWT.NONE); - productType.setText("Product type"); GridLayout gl = new GridLayout(2, false); gl.verticalSpacing = 2; gl.marginHeight = 1; @@ -563,12 +559,10 @@ public class WarngenDialog extends CaveSWTDialog implements other.setText("Other:"); other.setEnabled(true); other.addSelectionListener(new SelectionAdapter() { - @Override public void widgetSelected(SelectionEvent arg0) { otherSelected(); } - }); otherProductListCbo = new Combo(productType, SWT.READ_ONLY @@ -683,27 +677,16 @@ public class WarngenDialog extends CaveSWTDialog implements } private void createRedrawBoxGroup(Composite mainComposite) { + Group redrawBox = new Group(mainComposite, SWT.NONE); + GridLayout gl = new GridLayout(1, false); gl.verticalSpacing = 2; gl.marginHeight = 1; redrawBox.setLayout(gl); - redrawBox.setText("Redraw Box on Screen from:"); redrawBox.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); - warnedAreaVisible = new Button(redrawBox, SWT.CHECK); - warnedAreaVisible.setText("Warned Area Visible"); - warnedAreaVisible.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, true, - true, 1, 1)); - warnedAreaVisible.setSelection(true); - warnedAreaVisible.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - warnedAreaVisibleToggled(); - } - }); - Composite redrawFrom = new Composite(redrawBox, SWT.NONE); int columns = debug ? 4 : 3; redrawFrom.setLayout(new GridLayout(columns, false)); @@ -721,9 +704,7 @@ public class WarngenDialog extends CaveSWTDialog implements public void widgetSelected(SelectionEvent e) { redrawFromTrack(); } - }); - fromWarned = new Button(redrawFrom, SWT.PUSH); fromWarned.setText("Warned/Hatched Area"); fromWarned.setEnabled(true); @@ -732,9 +713,7 @@ public class WarngenDialog extends CaveSWTDialog implements public void widgetSelected(SelectionEvent e) { redrawFromWarned(); } - }); - damBreakThreatArea = new Button(redrawFrom, SWT.PUSH); damBreakThreatArea.setText("Dam Break Threat Area"); damBreakThreatArea.setEnabled(false); @@ -769,24 +748,16 @@ public class WarngenDialog extends CaveSWTDialog implements private void createBackupTrackEditGroups(Composite mainComposite) { Composite backupTrackEditComp = new Composite(mainComposite, SWT.NONE); + backupTrackEditComp.setLayout(new GridLayout(3, false)); backupTrackEditComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + + backupTrackEditComp.setBackground(Display. + getCurrent().getSystemColor(SWT.COLOR_TRANSPARENT)); - createReset(backupTrackEditComp); - createTrackGroup(backupTrackEditComp); - createEditGroup(backupTrackEditComp); - - } - - /** - * Create the reset button - * - * @param backupTrackEditComp - */ - private void createReset(Composite backupTrackEditComp) { restartBtn = new Button(backupTrackEditComp, SWT.PUSH); - restartBtn.setText(RS_BTN_LABEL); + restartBtn.setText("Reset"); GridData gd = new GridData(SWT.CENTER, SWT.CENTER, true, true); gd.widthHint = 100; restartBtn.setLayoutData(gd); @@ -796,22 +767,27 @@ public class WarngenDialog extends CaveSWTDialog implements resetPressed(); } }); + createTrackGroup(backupTrackEditComp); + createEditGroup(backupTrackEditComp); } - private void createTrackGroup(Composite backupTrackEditComp) { Group trackGroup = new Group(backupTrackEditComp, SWT.NONE); GridLayout gl = new GridLayout(1, false); gl.verticalSpacing = 2; gl.marginHeight = 1; trackGroup.setLayout(gl); - trackGroup.setText("Track type"); trackGroup.setLayoutData(new GridData(SWT.DEFAULT, SWT.FILL, false, true)); - + trackGroup.setBackgroundMode(SWT.INHERIT_NONE); + /* + trackGroup.setBackground(Display. + getCurrent().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); + */ + oneStorm = new Button(trackGroup, SWT.RADIO); - oneStorm.setText("One Storm"); + oneStorm.setText("Single Storm"); oneStorm.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent arg0) { @@ -850,7 +826,6 @@ public class WarngenDialog extends CaveSWTDialog implements gl.verticalSpacing = 2; gl.marginHeight = 1; editGroup.setLayout(gl); - editGroup.setText("Edit"); editGroup .setLayoutData(new GridData(SWT.DEFAULT, SWT.FILL, false, true)); @@ -899,7 +874,7 @@ public class WarngenDialog extends CaveSWTDialog implements true)); okButton = new Button(buttonComp, SWT.PUSH); - okButton.setText(OK_BTN_LABEL); + okButton.setText("Create Text"); GridData gd = new GridData(SWT.CENTER, SWT.CENTER, true, true); gd.widthHint = 100; okButton.setLayoutData(gd); @@ -917,7 +892,7 @@ public class WarngenDialog extends CaveSWTDialog implements }); Button btn = new Button(buttonComp, SWT.PUSH); - btn.setText(CLOSE_BUTTON_LABEL); + btn.setText("Close"); gd = new GridData(SWT.CENTER, SWT.CENTER, true, true); gd.widthHint = 100; btn.setLayoutData(gd); @@ -1532,14 +1507,6 @@ public class WarngenDialog extends CaveSWTDialog implements realizeEditableState(); } - /** - * Whether to warn area visible was toggled - */ - private void warnedAreaVisibleToggled() { - warngenLayer.setShouldDrawShaded(warnedAreaVisible.getSelection()); - warngenLayer.issueRefresh(); - } - /** * Responsible for drawing a pre-defined warning polygon (coords) on the * WarnGen layer. @@ -1672,7 +1639,6 @@ public class WarngenDialog extends CaveSWTDialog implements boolean enableDuration = warngenLayer.getConfiguration() .isEnableDuration(); durationList.setEnabled(enableDuration); - changeBtn.setEnabled(!enableDuration); recreateDurations(durationList); // Current selection doesn't matter anymore @@ -1731,7 +1697,8 @@ public class WarngenDialog extends CaveSWTDialog implements durList.setText(defaultDuration.displayString); if (warngenLayer.getConfiguration().isEnableDuration()) { endTime = DurationUtil.calcEndTime(startTime, defaultDuration.minutes); - end.setText(df.format(endTime.getTime())); + validPeriod.setText( df.format(startTime.getTime()) + + SEP + df.format(endTime.getTime())); } warngenLayer.getStormTrackState().newDuration = defaultDuration.minutes; @@ -1947,39 +1914,6 @@ public class WarngenDialog extends CaveSWTDialog implements // TODO : this pack/layout maybe causing the issue } - private void changeSelected() { - statusHandler.debug("changeSelected"); - if ((validPeriodDlg == null) || validPeriodDlg.isDisposed()) { - validPeriodDlg = new ValidPeriodDialog(shell, (Calendar) startTime.clone(), (Calendar) endTime.clone()); - validPeriodDlg.setCloseCallback(new ICloseCallback() { - - @Override - public void dialogClosed(Object returnValue) { - int duration = (Integer) returnValue; - statusHandler.debug("changeSelected.dialogClosed: " - + duration); - if (duration != -1) { - durationList.setEnabled(false); - if (warngenLayer.getConfiguration().isEnableDuration()) { - endTime.add(Calendar.MINUTE, duration); - } else { - endTime = (Calendar) validPeriodDlg.getEndTime().clone(); - } - end.setText(df.format(endTime.getTime())); - warngenLayer.getStormTrackState().newDuration = duration; - warngenLayer.getStormTrackState().geomChanged = true; - warngenLayer.issueRefresh(); - changeStartEndTimes(); - } - validPeriodDlg = null; - } - }); - validPeriodDlg.open(); - } else { - validPeriodDlg.bringToTop(); - } - } - /** * */ @@ -1990,7 +1924,8 @@ public class WarngenDialog extends CaveSWTDialog implements endTime = DurationUtil.calcEndTime(extEndTime != null ? extEndTime : startTime, ((DurationData) durationList.getData(selection)).minutes); - end.setText(df.format(endTime.getTime())); + validPeriod.setText( df.format(startTime.getTime()) + + SEP + df.format(endTime.getTime())); warngenLayer.getStormTrackState().newDuration = ((DurationData) durationList .getData(selection)).minutes; @@ -2018,38 +1953,6 @@ public class WarngenDialog extends CaveSWTDialog implements // updateMaps(bulletListManager.getMapsToLoad()); } - private void updateMaps(ArrayList mapsToLoad) { - /* Load maps */ - for (String str : mapsToLoad) { - if (!mapsLoaded.contains(str)) { - MapManager.getInstance(warngenLayer.getDescriptor()) - .loadMapByName(str); - mapsLoaded.add(str); - } - } - /* Unload maps */ - ArrayList mapsToUnload = new ArrayList(); - for (String str : mapsLoaded) { - if (!mapsToLoad.contains(str)) { - MapManager.getInstance(warngenLayer.getDescriptor()).unloadMap( - str); - mapsToUnload.add(str); - } - } - for (String str : mapsToUnload) { - mapsLoaded.remove(str); - } - - /* Load maps */ - for (String str : mapsToLoad) { - if (!mapsLoaded.contains(str)) { - MapManager.getInstance(warngenLayer.getDescriptor()) - .loadMapByName(str); - mapsLoaded.add(str); - } - } - } - /** * Timer to update the start and stop time for warngen. */ @@ -2127,7 +2030,7 @@ public class WarngenDialog extends CaveSWTDialog implements .getData(updateListCbo.getItem(updateListCbo .getSelectionIndex())); startTime = TimeUtil.newCalendar(); - start.setText(df.format(startTime.getTime())); + if ((fd == null) || (WarningAction.valueOf(fd.getAct()) == WarningAction.NEW)) { endTime = DurationUtil.calcEndTime(startTime, duration); @@ -2136,7 +2039,8 @@ public class WarngenDialog extends CaveSWTDialog implements endTime = DurationUtil.calcEndTime(extEndTime, duration); } } - end.setText(df.format(endTime.getTime())); + validPeriod.setText( df.format(startTime.getTime()) + + SEP + df.format(endTime.getTime())); } } @@ -2344,7 +2248,6 @@ public class WarngenDialog extends CaveSWTDialog implements boolean enableDuration = warngenLayer.getConfiguration() .isEnableDuration(); durationList.setEnabled(enableDuration); - changeBtn.setEnabled(!enableDuration); AbstractWarningRecord newWarn = CurrentWarnings.getInstance( warngenLayer.getLocalizedSite()).getNewestByTracking( @@ -2374,18 +2277,18 @@ public class WarngenDialog extends CaveSWTDialog implements private void setTimesFromFollowup(Date startDate, Date endDate) { // Sets the Time Range start and end times on dialog - start.setText(df.format(startDate)); startTime.setTime(startDate); - end.setText(df.format(endDate)); endTime.setTime(endDate); endTime.add(Calendar.MILLISECOND, 1); + validPeriod.setText( df.format(startTime.getTime()) + + SEP + df.format(endTime.getTime())); + // Sets the duration value on the dialog int durationInMinutes = (int) (endDate.getTime() - startDate.getTime()) / (60 * 1000); durationList.setText(String.valueOf(durationInMinutes)); durationList.setEnabled(false); - changeBtn.setEnabled(false); warngenLayer.getStormTrackState().endTime = endTime; } From 6eae4791eb3bdbe565d4fc045cf6c9b1f8835d39 Mon Sep 17 00:00:00 2001 From: Michael James Date: Fri, 8 Jun 2018 11:15:39 -0600 Subject: [PATCH 09/18] d2d NSHARP does not require pgen tools --- .../viz/d2d/nsharp/display/map/D2DNsharpMapMouseHandler.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cave/com.raytheon.uf.viz.d2d.nsharp/src/com/raytheon/uf/viz/d2d/nsharp/display/map/D2DNsharpMapMouseHandler.java b/cave/com.raytheon.uf.viz.d2d.nsharp/src/com/raytheon/uf/viz/d2d/nsharp/display/map/D2DNsharpMapMouseHandler.java index 6dd2b68c96..391ca11976 100644 --- a/cave/com.raytheon.uf.viz.d2d.nsharp/src/com/raytheon/uf/viz/d2d/nsharp/display/map/D2DNsharpMapMouseHandler.java +++ b/cave/com.raytheon.uf.viz.d2d.nsharp/src/com/raytheon/uf/viz/d2d/nsharp/display/map/D2DNsharpMapMouseHandler.java @@ -25,7 +25,6 @@ import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer; import gov.noaa.nws.ncep.ui.nsharp.NsharpStationInfo; import gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor; import gov.noaa.nws.ncep.ui.nsharp.display.map.NsharpObservedSoundingQuery; -import gov.noaa.nws.ncep.ui.pgen.tools.InputHandlerDefaultImpl; import java.util.ArrayList; import java.util.HashMap; @@ -41,13 +40,13 @@ import org.geotools.referencing.GeodeticCalculator; 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.map.IMapDescriptor; import com.raytheon.uf.viz.d2d.nsharp.display.D2DNsharpLoadDialog; import com.raytheon.viz.ui.editor.AbstractEditor; +import com.raytheon.viz.ui.input.InputAdapter; import com.vividsolutions.jts.geom.Coordinate; -public class D2DNsharpMapMouseHandler extends InputHandlerDefaultImpl { +public class D2DNsharpMapMouseHandler extends InputAdapter { private static final IUFStatusHandler statusHandler = UFStatus .getHandler(D2DNsharpMapMouseHandler.class); From d752efd0c19cb9adb63b0b4ad81e93c2cbf0c4a3 Mon Sep 17 00:00:00 2001 From: Michael James Date: Fri, 8 Jun 2018 12:42:13 -0600 Subject: [PATCH 10/18] d2d nsharp deps --- cave/com.raytheon.uf.viz.d2d.nsharp/META-INF/MANIFEST.MF | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cave/com.raytheon.uf.viz.d2d.nsharp/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.d2d.nsharp/META-INF/MANIFEST.MF index 7a5e63c6cb..81de46e29c 100644 --- a/cave/com.raytheon.uf.viz.d2d.nsharp/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.d2d.nsharp/META-INF/MANIFEST.MF @@ -24,12 +24,10 @@ Require-Bundle: com.raytheon.uf.viz.core;bundle-version="1.14.0", com.raytheon.uf.viz.image.export;bundle-version="1.14.0", org.eclipse.core.runtime;bundle-version="3.8.0", com.raytheon.viz.volumebrowser;bundle-version="1.15.0", - gov.noaa.nws.ncep.ui.pgen, org.eclipse.e4.ui.model.workbench;bundle-version="1.1.100" Export-Package: com.raytheon.uf.viz.d2d.nsharp, com.raytheon.uf.viz.d2d.nsharp.display, com.raytheon.uf.viz.d2d.nsharp.rsc, com.raytheon.uf.viz.d2d.nsharp.vb Bundle-ClassPath: com.raytheon.uf.viz.d2d.nsharp.jar -Import-Package: gov.noaa.nws.ncep.ui.pgen.display, - gov.noaa.nws.ncep.viz.soundingrequest +Import-Package: gov.noaa.nws.ncep.viz.soundingrequest From 99a533e27b6d0f3cca42a38d7ca2a741690cb8e1 Mon Sep 17 00:00:00 2001 From: Michael James Date: Fri, 8 Jun 2018 12:49:38 -0600 Subject: [PATCH 11/18] rm laps tools --- .../menus/tools/baseTools-menuL.xml | 3 +- cave/com.raytheon.viz.awipstools/plugin.xml | 8 - .../awipstools/ui/action/LapsToolsAction.java | 117 -- .../awipstools/ui/action/LapsToolsData.java | 294 ----- .../viz/awipstools/ui/action/LapsToolsIO.java | 242 ---- .../awipstools/ui/dialog/LAPSToolsDlg.java | 1077 ----------------- .../awipstools/ui/layer/LapsToolLayer.java | 371 ------ 7 files changed, 2 insertions(+), 2110 deletions(-) delete mode 100644 cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/ui/action/LapsToolsAction.java delete mode 100644 cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/ui/action/LapsToolsData.java delete mode 100644 cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/ui/action/LapsToolsIO.java delete mode 100644 cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/ui/dialog/LAPSToolsDlg.java delete mode 100644 cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/ui/layer/LapsToolLayer.java diff --git a/cave/com.raytheon.viz.awipstools/localization/menus/tools/baseTools-menuL.xml b/cave/com.raytheon.viz.awipstools/localization/menus/tools/baseTools-menuL.xml index 8f2c434ab0..e9bc3b9c7c 100644 --- a/cave/com.raytheon.viz.awipstools/localization/menus/tools/baseTools-menuL.xml +++ b/cave/com.raytheon.viz.awipstools/localization/menus/tools/baseTools-menuL.xml @@ -20,10 +20,11 @@ --> + - - - - - - - - - - - - - - glm - - - - - - - - - java.lang.Throwable - - - - - - diff --git a/edexOsgi/gov.nasa.msfc.sport.edex.plugin.glmdecoder/src/gov/nasa/msfc/sport/edex/glmdecoder/decoder/GLMDecoder.java b/edexOsgi/gov.nasa.msfc.sport.edex.plugin.glmdecoder/src/gov/nasa/msfc/sport/edex/glmdecoder/decoder/GLMDecoder.java deleted file mode 100644 index bf0a498394..0000000000 --- a/edexOsgi/gov.nasa.msfc.sport.edex.plugin.glmdecoder/src/gov/nasa/msfc/sport/edex/glmdecoder/decoder/GLMDecoder.java +++ /dev/null @@ -1,241 +0,0 @@ -package gov.nasa.msfc.sport.edex.glmdecoder.decoder; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Date; -import java.util.GregorianCalendar; -import java.util.List; -import java.util.TimeZone; - -import ucar.ma2.Array; -import ucar.nc2.NetcdfFile; -import ucar.nc2.Variable; - -import com.raytheon.uf.common.dataplugin.PluginDataObject; -import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord; -import com.raytheon.uf.common.dataplugin.binlightning.impl.LightningStrikePoint; -import com.raytheon.uf.common.dataplugin.binlightning.impl.LtgMsgType; -import com.raytheon.uf.common.dataplugin.binlightning.impl.LtgStrikeType; -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.common.wmo.WMOHeader; - -/** - * The Class GLMDecoder decodes the GLM Netcdf format files. The decoder - * extracts flash, groups, and events and encodes them into BinLightningRecords. - */ -public class GLMDecoder { - - /** The Constant handler for logging. */ - private static final IUFStatusHandler handler = UFStatus - .getHandler(GLMDecoder.class); - - /** The Constant Greenwich Mean Time zone. */ - private static final TimeZone gmt = TimeZone.getTimeZone("GMT"); - - /** - * The Enum Type to indentify various types of decoded types of detections. - */ - private static enum Type { - - /** The flash lightning element. */ - FLASH("flash", "flash_time_offset_of_first_event"), - /** The event lightning element. */ - EVENT("event", "event_time_offset"), - /** The group lightning element. */ - GROUP("group", "group_time_offset"); - - /** The name. */ - public final String name; - - /** The offset name. */ - public final String offsetName; - - /** - * Instantiates a new type. - * - * @param name - * the name of the lightning type - * @param offsetName - * the offset name of the variable in the netcdf file that - * describes the offset of time for the particular record. - */ - Type(String name, String offsetName) { - this.name = name; - this.offsetName = offsetName; - } - } - - /** - * Decode the netcdf data from ingest and return the lightning flashes, - * groups and events from the input netcdf GLM file. - * - * @param data - * the data input array of the netcdf input file. - * @return the plugin data object[] that contains all of the flashes, - * groups, and events in the file. They are of type - * BinLightningRecord. - */ - public PluginDataObject[] decode(byte[] data) { - WMOHeader wmoHdr = new WMOHeader(data); - if (wmoHdr.isValid()) { - data = removeWMOHeader(data, wmoHdr); - } - NetcdfFile netCdfFile = null; - List records = new ArrayList(); - try { - netCdfFile = NetcdfFile.openInMemory(null, data); - - Date productTime = decodeProductTime(netCdfFile); - List flashes = decode(Type.FLASH, netCdfFile, - productTime); - List groups = decode(Type.GROUP, netCdfFile, - productTime); - List events = decode(Type.EVENT, netCdfFile, - productTime); - - if (events != null) { - BinLightningRecord eventsRecord = new BinLightningRecord(events); - eventsRecord.setSource("GLMev"); - records.add(eventsRecord); - } - - if (flashes != null) { - BinLightningRecord flashrecord = new BinLightningRecord(flashes); - flashrecord.setSource("GLMfl"); - records.add(flashrecord); - } - if (groups != null) { - BinLightningRecord groupsRecord = new BinLightningRecord(groups); - groupsRecord.setSource("GLMgr"); - records.add(groupsRecord); - } - - } catch (IOException e) { - handler.error(e.getMessage()); - } finally { - if (netCdfFile != null) { - try { - netCdfFile.close(); - } catch (IOException e) { - - } - } - } - int size = records.size(); - PluginDataObject[] objs = new PluginDataObject[size]; - return records.toArray(objs); - } - - /** - * Removes the wmo header. - * - * @param data - * the data input array. - * @param wmoHdr - * the wmo hdr - * @return the byte[] of the data without the WMOHeader - */ - private byte[] removeWMOHeader(byte[] data, WMOHeader wmoHdr) { - return Arrays.copyOfRange(data, wmoHdr.getMessageDataStart(), - data.length); - } - - /** - * Decode product time which is the basis for all other time measurements in - * the file. The times are based on January 1, 2000 at 12Z. - * - * @param netCdfFile - * the net cdf file input - * @return the date for the basis of the file - * @throws IOException - * Signals that an I/O exception has occurred. - */ - private Date decodeProductTime(NetcdfFile netCdfFile) throws IOException { - Variable product_time_var = netCdfFile.findVariable("product_time"); - - GregorianCalendar cal = new GregorianCalendar(gmt); - // Dates are based on seconds since January 1, 2000 at 12Z - cal.set(2000, 0, 1, 12, 0, 0); - int secondstimesince2000 = (int) product_time_var.readScalarFloat(); - cal.add(Calendar.SECOND, secondstimesince2000); - Date date = cal.getTime(); - return date; - - } - - /** - * Decode actual elements in the file. The method decodes flashes, events, - * and groups from the netcdf file. - * - * @param type - * the type to decode, can be group, flash or event. - * @param netCdfFile - * the net cdf file to read the data. - * @param producttime - * the producttime is the basis time for the file. - * @return the list of plugin objects that represent the lightning element - * type decoded. - */ - private List decode(Type type, NetcdfFile netCdfFile, - Date producttime) { - List points = new ArrayList(); - - Variable lon = netCdfFile.findVariable(type.name + "_lon"); - Variable lat = netCdfFile.findVariable(type.name + "_lat"); - double event_lon_scale_factor = 1; - double event_lon_add_offset = 0; - double event_lat_scale_factor = 1; - double event_lat_add_offset = 0; - if (type == Type.EVENT) { - event_lon_scale_factor = lon.findAttribute("scale_factor") - .getNumericValue().doubleValue(); - event_lon_add_offset = lon.findAttribute("add_offset") - .getNumericValue().doubleValue(); - event_lat_scale_factor = lat.findAttribute("scale_factor") - .getNumericValue().doubleValue(); - event_lat_add_offset = lat.findAttribute("add_offset") - .getNumericValue().doubleValue(); - } - - Variable offset = netCdfFile.findVariable(type.offsetName); - try { - Array lon_array = lon.read(); - Array lat_array = lat.read(); - Array offset_array = offset.read(); - - while (lon_array.hasNext() && lat_array.hasNext() - && offset_array.hasNext()) { - float lonValue; - float latValue; - - if (type == Type.EVENT) { - int lon_short = ucar.ma2.DataType - .unsignedShortToInt(lon_array.nextShort()); - lonValue = (float) (lon_short * event_lon_scale_factor + event_lon_add_offset); - latValue = (float) (ucar.ma2.DataType - .unsignedShortToInt(lat_array.nextShort()) - * event_lat_scale_factor + event_lat_add_offset); - } else { - lonValue = lon_array.nextFloat(); - latValue = lat_array.nextFloat(); - } - - short offsetValue = offset_array.nextShort(); - GregorianCalendar cal = new GregorianCalendar(gmt); - cal.setTimeInMillis(producttime.getTime() + offsetValue); - LightningStrikePoint point = new LightningStrikePoint(latValue, - lonValue, cal, LtgMsgType.TOTAL_LIGHTNING); - point.setType(LtgStrikeType.TOTAL_FLASH); - points.add(point); - } - - } catch (IOException e) { - handler.error(e.getMessage()); - } - return points; - } - -} diff --git a/edexOsgi/gov.nasa.msfc.sport.edex.plugin.glmdecoder/test/TestGLMDecoder.java b/edexOsgi/gov.nasa.msfc.sport.edex.plugin.glmdecoder/test/TestGLMDecoder.java deleted file mode 100644 index b679ebdd0d..0000000000 --- a/edexOsgi/gov.nasa.msfc.sport.edex.plugin.glmdecoder/test/TestGLMDecoder.java +++ /dev/null @@ -1,38 +0,0 @@ -import gov.nasa.msfc.sport.edex.glmdecoder.decoder.GLMDecoder; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; - -import com.raytheon.uf.common.dataplugin.PluginDataObject; - -public class TestGLMDecoder { - - public void processFile(String file) { - try { - byte[] array = readFileInAsByteArray(file); - GLMDecoder decoder = new GLMDecoder(); - PluginDataObject[] objects = decoder.decode(array); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - public byte[] readFileInAsByteArray(String file) throws IOException { - Path path = Paths.get(file); - - return Files.readAllBytes(path); - - } - - public static void main(String[] args) { - TestGLMDecoder testDecoder = new TestGLMDecoder(); - testDecoder - .processFile("/data1/awips/sampledata/GLM/OR_GLM-L2-LCFA_G16_s20151831153096_e20151831153297_c20152020147422.nc"); - testDecoder - .processFile("/data1/awips/sampledata/GLM/newsamples/glm/IXTR99_KNES_190001_18889.2015081900"); - } - -} diff --git a/edexOsgi/gov.nasa.msfc.sport.edex.plugin.glmdecoder/utility/common_static/base/distribution/glm.xml b/edexOsgi/gov.nasa.msfc.sport.edex.plugin.glmdecoder/utility/common_static/base/distribution/glm.xml deleted file mode 100644 index d215030948..0000000000 --- a/edexOsgi/gov.nasa.msfc.sport.edex.plugin.glmdecoder/utility/common_static/base/distribution/glm.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - OR_GLM-L2-LCFA_G16 - ^IXTR99 KNES - From caf036f8adac527bb6a35aa8bf73da2a5e26f0bc Mon Sep 17 00:00:00 2001 From: mjames-upc Date: Mon, 11 Jun 2018 09:02:14 -0600 Subject: [PATCH 16/18] sportlma incl in dataplugin feature set --- .../feature.xml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/edexOsgi/com.raytheon.uf.edex.dataplugins.feature/feature.xml b/edexOsgi/com.raytheon.uf.edex.dataplugins.feature/feature.xml index 2a091992e1..3befc6ecc3 100644 --- a/edexOsgi/com.raytheon.uf.edex.dataplugins.feature/feature.xml +++ b/edexOsgi/com.raytheon.uf.edex.dataplugins.feature/feature.xml @@ -758,7 +758,14 @@ install-size="0" version="0.0.0" unpack="false"/> - + Date: Mon, 11 Jun 2018 13:07:47 -0600 Subject: [PATCH 17/18] cleanup WarnGen dialog --- .../viz/warngen/gui/WarngenDialog.java | 43 ++++--------------- 1 file changed, 9 insertions(+), 34 deletions(-) diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java index 0f92687aa3..4c10cba74f 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java @@ -466,32 +466,6 @@ public class WarngenDialog extends CaveSWTDialog implements startTimeTimer(); } - /** - * @param mainComposite - * - * - * - private void createRedrawBoxGroup(Composite mainComposite) { - - Group redrawBox = new Group(mainComposite, SWT.NONE); - - GridLayout gl = new GridLayout(1, false); - gl.verticalSpacing = 2; - gl.marginHeight = 1; - redrawBox.setLayout(gl); - redrawBox.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, - 1)); - - Composite redrawFrom = new Composite(redrawBox, SWT.NONE); - int columns = debug ? 4 : 3; - redrawFrom.setLayout(new GridLayout(columns, false)); - redrawFrom.setLayoutData(new GridData(SWT.DEFAULT, SWT.FILL, false, - true)); - - createRedrawFromControls(redrawFrom); - } - * - */ private void createTimeRangeGroup(Composite mainComposite) { Group timeRange = new Group(mainComposite, SWT.NONE); @@ -675,7 +649,11 @@ public class WarngenDialog extends CaveSWTDialog implements }); } } - + + /** + * + * @param mainComposite + */ private void createRedrawBoxGroup(Composite mainComposite) { Group redrawBox = new Group(mainComposite, SWT.NONE); @@ -696,6 +674,10 @@ public class WarngenDialog extends CaveSWTDialog implements createRedrawFromControls(redrawFrom); } + /** + * + * @param redrawFrom + */ private void createRedrawFromControls(Composite redrawFrom) { fromTrack = new Button(redrawFrom, SWT.PUSH); fromTrack.setText("Track"); @@ -752,9 +734,6 @@ public class WarngenDialog extends CaveSWTDialog implements backupTrackEditComp.setLayout(new GridLayout(3, false)); backupTrackEditComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); - - backupTrackEditComp.setBackground(Display. - getCurrent().getSystemColor(SWT.COLOR_TRANSPARENT)); restartBtn = new Button(backupTrackEditComp, SWT.PUSH); restartBtn.setText("Reset"); @@ -781,10 +760,6 @@ public class WarngenDialog extends CaveSWTDialog implements trackGroup.setLayoutData(new GridData(SWT.DEFAULT, SWT.FILL, false, true)); trackGroup.setBackgroundMode(SWT.INHERIT_NONE); - /* - trackGroup.setBackground(Display. - getCurrent().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); - */ oneStorm = new Button(trackGroup, SWT.RADIO); oneStorm.setText("Single Storm"); From 318849c278be2896b522bf3675169fb9fdc482bd Mon Sep 17 00:00:00 2001 From: mjames-upc Date: Tue, 12 Jun 2018 11:14:41 -0600 Subject: [PATCH 18/18] correct ip addresses in distributed-computing.md --- docs/edex/distributed-computing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/edex/distributed-computing.md b/docs/edex/distributed-computing.md index 525bb502de..ccf121e7bb 100644 --- a/docs/edex/distributed-computing.md +++ b/docs/edex/distributed-computing.md @@ -133,7 +133,7 @@ Since this Database/Request server is not running the main *edexIngest* JVM, we ## Ingest/Decode Server !!! note "Specs" - * IP address **10.0.0.9** + * IP address **10.0.0.7** * CentOS 6.9 * m1.xxlarge (CPU: 44, Mem: 120 GB)