diff --git a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/request/RpsListFormatter.java b/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/request/RpsListFormatter.java
index 2f7a7338c3..0640c69652 100644
--- a/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/request/RpsListFormatter.java
+++ b/RadarServer/com.raytheon.rcm.lib/src/com/raytheon/rcm/request/RpsListFormatter.java
@@ -28,93 +28,106 @@ import com.raytheon.rcm.products.ProductInfo.Selector;
import com.raytheon.rcm.products.RadarProduct;
import com.raytheon.rcm.products.RadarProduct.Param;
-
+/**
+ * Used to format a {@link RpsList} before it is written.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * ? ? ? Initial creation.
+ * Jan 20, 2016 5271 bkowal Include time span / end hour for products
+ * that use minutes for the time span.
+ *
+ *
+ */
public class RpsListFormatter {
- /* See AWIPS-1 ProductRequestList::writeList()
- *
- */
- public static void formatAwips1RpsList(RpsList list, String fileName, PrintWriter s) {
- RadarType radarType = list.getVcp() == 80 || list.getVcp() == 90 ?
- RadarType.TDWR : RadarType.WSR;
- Calendar cal = Calendar.getInstance();
- s.format("RPS List %s %s... %d products\n",
- fileName != null ? fileName : "",
- String.format("%1$tY:%1$tm:%1$td:%1$tH:%1$tM:%1$tS", cal),
- list.getRequests().length);
- s.print(" An RPS list contains the fields: Prod-Name, Mnemonic, Prod-Code\n" +
- " Number of Data Levels, Resolution, Layer Code, Elevation, Contour Interval,\n" +
- " Priority, Req Interval, Map, Lower Layer, Upper Layer, multCut, endHour, timeSpan\n" +
- " The record format is: '%-39s %-3s%4d%4d%6d %c%6d%7d%2d%2d%c%3d%3d %c%7d%7d'\n");
+ /*
+ * See AWIPS-1 ProductRequestList::writeList()
+ */
+ public static void formatAwips1RpsList(RpsList list, String fileName,
+ PrintWriter s) {
+ RadarType radarType = list.getVcp() == 80 || list.getVcp() == 90 ? RadarType.TDWR
+ : RadarType.WSR;
+ Calendar cal = Calendar.getInstance();
+ s.format("RPS List %s %s... %d products\n", fileName != null ? fileName
+ : "",
+ String.format("%1$tY:%1$tm:%1$td:%1$tH:%1$tM:%1$tS", cal), list
+ .getRequests().length);
+ s.print(" An RPS list contains the fields: Prod-Name, Mnemonic, Prod-Code\n"
+ + " Number of Data Levels, Resolution, Layer Code, Elevation, Contour Interval,\n"
+ + " Priority, Req Interval, Map, Lower Layer, Upper Layer, multCut, endHour, timeSpan\n"
+ + " The record format is: '%-39s %-3s%4d%4d%6d %c%6d%7d%2d%2d%c%3d%3d %c%7d%7d'\n");
- for (Request r : list.getRequests()) {
- s.println(formatAwips1Request(r, radarType));
- }
- }
-
- private static final char[] layerCodes = {'L', 'M', 'H'};
-
- public static String formatAwips1Request(Request r, RadarType radarType) {
- RadarProduct rp = ProductInfo.getInstance().selectOne(
- new Selector(radarType, null, (int) r.productCode, null));
-
- /* Could probably guess how to format the important parts, but this
- * is what AWIPS-1 does anyway...
- */
- if (rp == null)
- throw new IllegalArgumentException("Cannot format unknown product type " +
- r.productCode + ".");
-
- /* Note there is no check for rp.contains(ELEVATION) This
- * is fine for the current set of products that are available in
- * the RPS list editor...
- */
- /* // Mimic:
- if (_multCuts == 'Y' && _elev > 16384)
- {
- _elev -= 16384;
+ for (Request r : list.getRequests()) {
+ s.println(formatAwips1Request(r, radarType));
}
- */
- boolean multiCuts = false;
- int elev = r.pdw22;
- if (r.getElevationSelection() == Request.ALL_ELEVATIONS &&
- r.getElevationAngle() != 0) {
- elev = r.getElevationAngle();
- multiCuts = true;
- }
-
- char layerCode = '-';
- if (rp.layer != null) {
- try {
- layerCode = layerCodes[rp.layer - 1];
- } catch (ArrayIndexOutOfBoundsException e) {
- // nothing
- }
- }
- int lowerLayer = -1;
- int upperLayer = -1;
- if (rp.params.contains(Param.LAYER)) {
- lowerLayer = r.getBottomAltitude();
- upperLayer = r.getTopAltitude();
- } else if (rp.params.contains(Param.MINI_VOLUME)) {
- lowerLayer = r.getMiniVolume();
- }
- int endHour = -1;
- int timeSpan = -1;
- if (rp.params.contains(Param.TIME_SPAN)) {
- endHour = r.getEndHour();
- timeSpan = r.getTimeSpan();
- }
-
- return String.format("%-39.39s %-3.3s%4d%4d%6d %c%6d%7d%2d%2d%c%3d%3d %c%7d%7d",
- rp.name, rp.mnemonic,
- r.productCode,
- rp.levels != null ? rp.levels : 0,
- rp.resolution != null ? (int)(rp.resolution * 100) : 0,
- layerCode, elev, -1 /*contour interval*/,
- r.highPriority ? 1 : 0, r.interval,
- r.mapRequested ? 'Y' : 'N',
- lowerLayer, upperLayer,
- multiCuts ? 'Y' : 'N',
- endHour, timeSpan);
- }
+ }
+
+ private static final char[] layerCodes = { 'L', 'M', 'H' };
+
+ public static String formatAwips1Request(Request r, RadarType radarType) {
+ RadarProduct rp = ProductInfo.getInstance().selectOne(
+ new Selector(radarType, null, (int) r.productCode, null));
+
+ /*
+ * Could probably guess how to format the important parts, but this is
+ * what AWIPS-1 does anyway...
+ */
+ if (rp == null) {
+ throw new IllegalArgumentException(
+ "Cannot format unknown product type " + r.productCode + ".");
+ }
+
+ /*
+ * Note there is no check for rp.contains(ELEVATION) This is fine for
+ * the current set of products that are available in the RPS list
+ * editor...
+ */
+ /*
+ * // Mimic: if (_multCuts == 'Y' && _elev > 16384) { _elev -= 16384; }
+ */
+ boolean multiCuts = false;
+ int elev = r.pdw22;
+ if (r.getElevationSelection() == Request.ALL_ELEVATIONS
+ && r.getElevationAngle() != 0) {
+ elev = r.getElevationAngle();
+ multiCuts = true;
+ }
+
+ char layerCode = '-';
+ if (rp.layer != null) {
+ try {
+ layerCode = layerCodes[rp.layer - 1];
+ } catch (ArrayIndexOutOfBoundsException e) {
+ // nothing
+ }
+ }
+ int lowerLayer = -1;
+ int upperLayer = -1;
+ if (rp.params.contains(Param.LAYER)) {
+ lowerLayer = r.getBottomAltitude();
+ upperLayer = r.getTopAltitude();
+ } else if (rp.params.contains(Param.MINI_VOLUME)) {
+ lowerLayer = r.getMiniVolume();
+ }
+ int endHour = -1;
+ int timeSpan = -1;
+ if (rp.params.contains(Param.TIME_SPAN)
+ || rp.params.contains(Param.TIME_SPAN_MINUTES)) {
+ endHour = r.getEndHour();
+ timeSpan = r.getTimeSpan();
+ }
+
+ return String.format(
+ "%-39.39s %-3.3s%4d%4d%6d %c%6d%7d%2d%2d%c%3d%3d %c%7d%7d",
+ rp.name, rp.mnemonic, r.productCode,
+ rp.levels != null ? rp.levels : 0,
+ rp.resolution != null ? (int) (rp.resolution * 100) : 0,
+ layerCode, elev, -1 /* contour interval */, r.highPriority ? 1
+ : 0, r.interval, r.mapRequested ? 'Y' : 'N',
+ lowerLayer, upperLayer, multiCuts ? 'Y' : 'N', endHour,
+ timeSpan);
+ }
}
diff --git a/RadarServer/com.raytheon.rcm.server/src/com/raytheon/rcm/rpsmgr/RPSListManager.java b/RadarServer/com.raytheon.rcm.server/src/com/raytheon/rcm/rpsmgr/RPSListManager.java
index aa453a4fb7..817e5461c2 100755
--- a/RadarServer/com.raytheon.rcm.server/src/com/raytheon/rcm/rpsmgr/RPSListManager.java
+++ b/RadarServer/com.raytheon.rcm.server/src/com/raytheon/rcm/rpsmgr/RPSListManager.java
@@ -61,9 +61,9 @@ import com.raytheon.rcm.server.StatusManager.RadarStatus;
/**
* Manages current RPS lists and requests for changes to RPS lists.
- *
+ *
*
- *
+ *
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
@@ -73,8 +73,9 @@ import com.raytheon.rcm.server.StatusManager.RadarStatus;
* 2014-02-03 DR 14762 D. Friedman Handle updated national RPS lists.
* 2015-06-10 4498 nabowle Rename Util->RcmUtil
* 2015-09-08 DR 17944 D. Friedman Handle elevation list file updates.
+ * 2016-01-20 5271 bkowal Fix resource leak.
*
- *
+ *
*/
public class RPSListManager extends RadarEventAdapter {
@@ -181,11 +182,13 @@ public class RPSListManager extends RadarEventAdapter {
return "Error getting radar status";
}
- int[] cuts = ElevationInfo.getInstance().getScanElevations(radarID, currentVCP);
+ int[] cuts = ElevationInfo.getInstance().getScanElevations(radarID,
+ currentVCP);
if (cuts == null && RcmUtil.getRadarType(rc) == RadarType.WSR)
cuts = gsmCuts;
- if (list.getVcp() != RpsList.UNSPECIFIED_VCP && list.getVcp() != currentVCP) {
+ if (list.getVcp() != RpsList.UNSPECIFIED_VCP
+ && list.getVcp() != currentVCP) {
if (store)
return null; // TODO: Should warn instead.
else
@@ -240,13 +243,13 @@ public class RPSListManager extends RadarEventAdapter {
rpsList = null;
if (rpsList == null) {
- int[] cuts = ElevationInfo.getInstance().
- getScanElevations(rc.getRadarID(), gsm.vcp);
+ int[] cuts = ElevationInfo.getInstance().getScanElevations(
+ rc.getRadarID(), gsm.vcp);
if (cuts == null && RcmUtil.getRadarType(rc) == RadarType.WSR)
cuts = gsm.cuts;
- rpsList = getMergedRpsListForRadar(rc, gsm.opMode, gsm.vcp,
- cuts, null);
+ rpsList = getMergedRpsListForRadar(rc, gsm.opMode, gsm.vcp, cuts,
+ null);
// TODO: Should persist this (wouldn't need clone code)
if (rpsList != null)
@@ -259,7 +262,7 @@ public class RPSListManager extends RadarEventAdapter {
/**
* From AWIPS 1 ProductRequestList::addMiniVolumeProduct() (DCS 3411)
- *
+ *
* For TDWR VCP80, 2 products might be generated in one volume (2 mini
* volumes) for some products. Parameter lowerLayer is used to specify these
* 2 products: 1 - generated at mid volume; 2 - generated at end volume
@@ -267,7 +270,7 @@ public class RPSListManager extends RadarEventAdapter {
* implementation ---------------------------------------------------------
* Searches list for mini volume products, add a new entry with lowerLayer 1
* CZ(35-38),ET(41),VIL(57),STI(58),HI(59),TVS(61),MD(141),DMD(149)
- *
+ *
*/
/*
* This must be kept in sync with
@@ -279,8 +282,8 @@ public class RPSListManager extends RadarEventAdapter {
return;
/*
- * We want to put these products at the end of the list so that they
- * do not have priority over existing products.
+ * We want to put these products at the end of the list so that they do
+ * not have priority over existing products.
*/
Selector sel = new Selector();
sel.radarType = RadarType.TDWR;
@@ -290,8 +293,8 @@ public class RPSListManager extends RadarEventAdapter {
Request r = reqs.get(i);
sel.code = (int) r.productCode;
RadarProduct prod = ProductInfo.getInstance().selectOne(sel);
- if (prod != null && prod.params.contains(Param.MINI_VOLUME) &&
- r.getMiniVolume() != 1) {
+ if (prod != null && prod.params.contains(Param.MINI_VOLUME)
+ && r.getMiniVolume() != 1) {
Request r2 = r.clone();
r2.setMiniVolume(1);
reqs.add(r2);
@@ -321,14 +324,14 @@ public class RPSListManager extends RadarEventAdapter {
Log.warnf("Cannot determine maximum RPS list size for %s",
rc.getRadarID());
if (requestCount < 0)
- Log.warnf("Cannot number of requests in RPS list for %s", rc
- .getRadarID());
+ Log.warnf("Cannot number of requests in RPS list for %s",
+ rc.getRadarID());
if (maxSize >= 0 && requestCount >= 0 && requestCount > maxSize) {
int truncCount = 0;
int i;
for (i = reqs.length - 1; i >= 0; --i) {
- truncCount += RpsList.getRequestCount(reqs[i], rc.getRadarID(), rpsList.getVcp(),
- RcmUtil.getRadarType(rc));
+ truncCount += RpsList.getRequestCount(reqs[i], rc.getRadarID(),
+ rpsList.getVcp(), RcmUtil.getRadarType(rc));
if (requestCount - truncCount <= maxSize)
break;
}
@@ -337,8 +340,10 @@ public class RPSListManager extends RadarEventAdapter {
int originalCount = requestCount;
requestCount = requestCount - truncCount;
- Log.warnf("Truncated list for %s from %d entries (%d requests) to %d entries (%d requests)",
- rc.getRadarID(), reqs.length, originalCount, i, requestCount);
+ Log.warnf(
+ "Truncated list for %s from %d entries (%d requests) to %d entries (%d requests)",
+ rc.getRadarID(), reqs.length, originalCount, i,
+ requestCount);
// TODO: Also need to send a message to Guardian
reqs = Arrays.copyOf(reqs, i);
rpsList = new RpsList(rpsList.getOpMode(), rpsList.getVcp(), reqs);
@@ -346,8 +351,8 @@ public class RPSListManager extends RadarEventAdapter {
Log.warnf("Sending empty RPS list to %s", rc.getRadarID());
}
- Log.eventf("%s: Sending RPS list with %d entries (%d requests)", rc.getRadarID(),
- rpsList.getRequests().length, requestCount);
+ Log.eventf("%s: Sending RPS list with %d entries (%d requests)",
+ rc.getRadarID(), rpsList.getRequests().length, requestCount);
byte[] msg = ProductRequest.encode(rpsList.getRequests());
radarServer.getConnectionManager().sendMessageToRadar(rc.getRadarID(),
msg);
@@ -396,8 +401,7 @@ public class RPSListManager extends RadarEventAdapter {
path = new File(dir, rc.getRadarID().toUpperCase()
+ ".currentVCP");
fo = new FileOutputStream(path);
- try {
- PrintWriter p = new PrintWriter(fo);
+ try (PrintWriter p = new PrintWriter(fo)) {
p.printf("VCP%d\n", rpsList.getVcp());
p.flush();
} finally {
@@ -431,7 +435,7 @@ public class RPSListManager extends RadarEventAdapter {
/**
* Constructs a an RPS list for the given parameters, merging national and
* local lists as appropriate.
- *
+ *
* @param rc
* @param opMode
* @param vcp
@@ -487,14 +491,12 @@ public class RPSListManager extends RadarEventAdapter {
maybeAddSPGMiniVolumeProducts(rc, reqs, vcp);
/*
- * AWIPS 1 disabled duplicate merging for TDWRs because some requests
- * in the national RPS list would disappear. This was due to incorrect
- * handling of multi-elevation requests. AWIPS 2 handles
- * multi-elevation request correctly. (See DCS 3472, DRs 19386, 20239,
- * and 20244.)
- *
- * if (vcp == 80 || vcp == 90)
- * elevList = null;
+ * AWIPS 1 disabled duplicate merging for TDWRs because some requests in
+ * the national RPS list would disappear. This was due to incorrect
+ * handling of multi-elevation requests. AWIPS 2 handles multi-elevation
+ * request correctly. (See DCS 3472, DRs 19386, 20239, and 20244.)
+ *
+ * if (vcp == 80 || vcp == 90) elevList = null;
*/
RadarType radarType = RcmUtil.getRadarType(rc);
@@ -518,7 +520,7 @@ public class RPSListManager extends RadarEventAdapter {
* later multi-elevation request that subsumes it to be
* lost when the list is truncated to fix the maximum
* number of products.
- *
+ *
* On the other hand, this could cause products listed
* before index j to be lost because the RPG counts each
* elevation in a multi-elevation request as a separate
@@ -599,8 +601,8 @@ public class RPSListManager extends RadarEventAdapter {
private void resetRpsListForRadar(RadarConfig rc) {
String radarID = rc.getRadarID();
- RadarStatus status = radarServer.getStatusManager()
- .getRadarStatus(radarID);
+ RadarStatus status = radarServer.getStatusManager().getRadarStatus(
+ radarID);
byte[] gsmData = null;
if (status != null)
gsmData = status.getCurrentGSM();
@@ -609,10 +611,8 @@ public class RPSListManager extends RadarEventAdapter {
if (gsmData != null) {
handleGSM(rc, gsmData);
} else {
- Log.debugf(
- "RPS-relevant configuration changed for %s, but "
- + "it is not connected. Cannot send a list now.",
- radarID);
+ Log.debugf("RPS-relevant configuration changed for %s, but "
+ + "it is not connected. Cannot send a list now.", radarID);
}
}
}
diff --git a/build/deploy.edex.awips2/esb/conf/spring/edex-db.xml b/build/deploy.edex.awips2/esb/conf/spring/edex-db.xml
index 33b93f5c92..880c824e96 100644
--- a/build/deploy.edex.awips2/esb/conf/spring/edex-db.xml
+++ b/build/deploy.edex.awips2/esb/conf/spring/edex-db.xml
@@ -1,63 +1,64 @@
-
-
-
-
+
+
+
+
-
-
-
-
- com.raytheon.uf.common.dataplugin.text
- com.raytheon.uf.common.dataplugin.shef
- com.raytheon.edex.plugin.shef
- com.raytheon.uf.common.bmh
-
-
-
-
-
- file:///${edex.home}/conf/db/hibernateConfig/metadata/hibernate.cfg.xml
-
-
-
-
-
+
+
+
+
+ com.raytheon.uf.common.dataplugin.text
+ com.raytheon.uf.common.dataplugin.text.subscription
+ com.raytheon.uf.common.dataplugin.shef
+ com.raytheon.edex.plugin.shef
+ com.raytheon.uf.common.bmh
+
+
+
+
+
+ file:///${edex.home}/conf/db/hibernateConfig/metadata/hibernate.cfg.xml
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
-
-
-
- file:///${edex.home}/conf/db/hibernateConfig/maps/hibernate.cfg.xml
-
-
-
+
+
+
-
-
-
+
+
+
+ file:///${edex.home}/conf/db/hibernateConfig/maps/hibernate.cfg.xml
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build/deploy.edex.awips2/esb/etc/registry.sh b/build/deploy.edex.awips2/esb/etc/registry.sh
index 387afed6e3..dc533f725a 100644
--- a/build/deploy.edex.awips2/esb/etc/registry.sh
+++ b/build/deploy.edex.awips2/esb/etc/registry.sh
@@ -30,6 +30,7 @@ export EDEX_DEBUG_PORT=5012
export EDEX_JMX_PORT=1620
export LOG_CONF=logback-registry.xml
export MGMT_PORT=9605
+export HTTP_PORT=9588
export METADATA_POOL_MAX=20
export METADATA_POOL_TIMEOUT=60
diff --git a/build/deploy.edex.awips2/esb/etc/request.sh b/build/deploy.edex.awips2/esb/etc/request.sh
index adab74fc07..670a13ac07 100644
--- a/build/deploy.edex.awips2/esb/etc/request.sh
+++ b/build/deploy.edex.awips2/esb/etc/request.sh
@@ -33,3 +33,4 @@ export EDEX_DEBUG_PORT=5005
export EDEX_JMX_PORT=1616
export LOG_CONF=logback-request.xml
export MGMT_PORT=9601
+export HTTP_PORT=9581
diff --git a/build/deploy.edex.awips2/esb/etc/ebxmlRegistry.sh b/build/deploy.edex.awips2/esb/etc/sbnSimulator.sh
similarity index 83%
rename from build/deploy.edex.awips2/esb/etc/ebxmlRegistry.sh
rename to build/deploy.edex.awips2/esb/etc/sbnSimulator.sh
index 2467b3a59f..eada11f76a 100644
--- a/build/deploy.edex.awips2/esb/etc/ebxmlRegistry.sh
+++ b/build/deploy.edex.awips2/esb/etc/sbnSimulator.sh
@@ -22,16 +22,15 @@
export MAX_MEM=1536 # in Meg
if [ $HIGH_MEM == "on" ]; then
- export MAX_MEM=2048
+ export MAX_MEM=2560
fi
export MAX_PERM_SIZE=192m
-export EDEX_DEBUG_PORT=5012
-export EDEX_JMX_PORT=1620
-export LOG_CONF=logback-ebxmlRegistry.xml
-export MGMT_PORT=9605
+export EDEX_DEBUG_PORT=5013
+export LOG_CONF=logback-registry.xml
+export MGMT_PORT=9606
export METADATA_POOL_MAX=20
export METADATA_POOL_TIMEOUT=60
-export SOFT_REF_LRU_POLICY_MS_PER_MB=50
+export SOFT_REF_LRU_POLICY_MS_PER_MB=50
\ No newline at end of file
diff --git a/build/deploy.edex/DeployESB.groovy b/build/deploy.edex/DeployESB.groovy
index a227414174..a186d3b206 100644
--- a/build/deploy.edex/DeployESB.groovy
+++ b/build/deploy.edex/DeployESB.groovy
@@ -30,6 +30,7 @@ import groovy.util.logging.*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 4, 2014 3836 bkowal Initial Commit
+ * Dec 9, 2015 4216 dhladky Fix multi WA deploys
*
*
*
@@ -85,22 +86,7 @@ class DeployESB
architecture =
(System.getProperty("os.arch") == "amd64") ? "x86_64" : "x86"
}
- String esbLibIllusionPath = esbDirectory + File.separator + "lib" + File.separator +
- "lib_illusion" + File.separator + architecture
- if (new File(esbLibIllusionPath).exists() == false)
- {
- log.log(java.util.logging.Level.SEVERE,
- "Unable to find the illusion lib associated with architecture - " + architecture)
- System.exit(-1)
- }
-
- String libIllusionDestination = edexRootDirectory + File.separator +
- "lib" + File.separator + "lib_illusion"
- new File(libIllusionDestination).mkdirs()
- ant.copy( todir : libIllusionDestination, overwrite : true )
- {
- fileset( dir : esbLibIllusionPath )
- }
+
}
public static void deployEdexConfiguration(String edexRootDirectory, String esbDirectory)
diff --git a/build/deploy.edex/RunDeployInstall.groovy b/build/deploy.edex/RunDeployInstall.groovy
index 9919ce49ec..fbbdf9c871 100644
--- a/build/deploy.edex/RunDeployInstall.groovy
+++ b/build/deploy.edex/RunDeployInstall.groovy
@@ -44,6 +44,7 @@ import IPluginCustomDeployer
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 4, 2014 3836 bkowal Initial Commit
+ * Dec 9, 2015 4216 dhladky Fix multi WA deploy
*
*
*
@@ -124,7 +125,7 @@ class DeployInstall
// complete the esb deployment
// we need to determine the location of the build.edex project
- ProjectInformation projectInformation = this.projectInformationMap["build.edex"]
+ ProjectInformation projectInformation = this.projectInformationMap["deploy.edex.awips2"]
if (projectInformation == null)
{
log.log(java.util.logging.Level.SEVERE,
diff --git a/cave/build/p2-build.xml b/cave/build/p2-build.xml
index 1481823ac0..c11dc8e287 100644
--- a/cave/build/p2-build.xml
+++ b/cave/build/p2-build.xml
@@ -5,7 +5,7 @@
-
+
diff --git a/cave/build/tools/capture.bat b/cave/build/tools/capture.bat
new file mode 100644
index 0000000000..8a9df8421f
--- /dev/null
+++ b/cave/build/tools/capture.bat
@@ -0,0 +1,129 @@
+@echo OFF
+
+REM This is a MSFT Windows version of the CAVE capture script.
+REM This script will identify any running CAVE processes (cave.exe)
+REM and use Java to generate jstacks and (optionally) heap dumps
+REM for the process(es). All of the files generated by this capture
+REM script and any associated CAVE logs will be placed in a directory
+REM in the user's 'My Documents' directory.
+REM Usage: capture.bat [-d][-h]
+
+REM Verify that the location of the Java JDK is known.
+IF "%JAVA_JDK%" == "" (
+ echo ERROR: Unable to determine the location of the Java JDK. Use the JAVA_JDK Env Variable to set the location.
+ GOTO EOF
+)
+
+SET heap_dump=0
+
+REM Process and validate any command line parameters, displaying usage
+REM information if necessary.
+IF "%1" == "" GOTO run
+REM Verify that there is only one argument.
+IF NOT "%2" == "" GOTO usage
+REM Check for the -d argument.
+IF "%1" == "-d" (
+ SET heap_dump=1
+ GOTO run
+)
+REM Either an invalid argument or the -h argument.
+GOTO usage
+
+:usage
+echo Usage: %0 [-d][-h]
+echo -d: Enables the heap dump capture
+echo -h: Displays the usage message
+GOTO EOF
+
+:run
+SET jstack_iterations=15
+SET PROCESS=cave.exe
+
+REM Prepare Environment
+SET Path=%JAVA_JDK%\bin;%Path%
+
+REM Build a date/time string to use in the name for the capture directory.
+SET RND=%random%
+SET RND_DATETIME_FILE=%TMP%\awips2dt_%RND%.tmp
+REM Python is used to retrieve the current date and time because the order
+REM of the Windows date/time fields is not necessarily guaranteed and the
+REM Windows date/time fields can only be extracted using substring operations
+REM instead of -formatter- strings like Linux allows.
+python -c "from datetime import datetime; print datetime.now().strftime('%%Y%%m%%d_%%H%%M%%S');" > %RND_DATETIME_FILE%
+SET /p CAPTURE_DATETIME= < %RND_DATETIME_FILE%
+DEL %RND_DATETIME_FILE%
+
+SET CAPTURE_DIRECTORY=%userprofile%\capture_%CAPTURE_DATETIME%
+SET CAVEDATA_LOGS_DIRECTORY=%userprofile%\%logdir%
+SET CAPTURE_LOG=%CAPTURE_DIRECTORY%\capture_info.log
+
+REM Get the PID of any currently running CAVE process.
+for /f "tokens=2 delims=," %%F in ('tasklist /nh /fi "imagename eq %PROCESS%" /fo csv') do call :process_pid %%~F
+GOTO prepare_exit
+
+:process_pid
+IF NOT EXIST "%CAPTURE_DIRECTORY%" (MKDIR "%CAPTURE_DIRECTORY%")
+
+SET process_pid=%1
+SET jstack_counter=0
+echo Found %PROCESS% with pid %process_pid% ...
+echo Found %PROCESS% with pid %process_pid% ... >> %CAPTURE_LOG%
+:while_jstack
+if %jstack_counter% lss %jstack_iterations% (
+ set /a jstack_counter+=1
+ echo Completing jstack iteration %jstack_counter% ...
+ echo Completing jstack iteration %jstack_counter% ... >> %CAPTURE_LOG%
+
+ SET jstack_log=%CAPTURE_DIRECTORY%\pid_%process_pid%_jstack_%jstack_counter%.log
+ jstack -l %process_pid% >> "%jstack_log%"
+ echo Running command: jstack -l %process_pid% >> %CAPTURE_LOG%
+ IF ERRORLEVEL 1 (
+ echo jstack for pid %process_pid% failed to connect, rerunning with -F >> %CAPTURE_LOG%
+ echo jstack for pid %process_pid% failed to connect, rerunning with -F
+ echo Running command: jstack -l -F %process_pid% >> %CAPTURE_LOG%
+ jstack -l -F %process_pid% >> "%jstack_log%"
+ )
+
+ goto :while_jstack
+)
+
+REM Copy the CAVE logs for the pid to the capture directory.
+echo Running command: xcopy "%CAVEDATA_LOGS_DIRECTORY%\*pid_%process_pid%*.log" "%CAPTURE_DIRECTORY%" >> %CAPTURE_LOG%
+xcopy "%CAVEDATA_LOGS_DIRECTORY%\*pid_%process_pid%*.log" "%CAPTURE_DIRECTORY%" >> %CAPTURE_LOG%
+IF ERRORLEVEL 0 GOTO check_heap
+echo Failed to copy the CAVE logs files.
+echo Failed to copy the CAVE logs files. >> %CAPTURE_LOG%
+
+:check_heap
+REM Create a heap dump if the option has been enabled.
+IF %heap_dump% NEQ 1 (
+ echo Heap dumps have been disabled. >> %CAPTURE_LOG%
+ exit /b
+)
+
+SET heap_path=%CAPTURE_DIRECTORY%\pid_%process_pid%_heap.hprof
+SET dump_path=%CAPTURE_DIRECTORY%\pid_%process_pid%_dump.txt
+echo Running command: jmap -heap %process_pid% >> %CAPTURE_LOG%
+jmap -heap %process_pid% > %heap_path%
+
+echo Running command: jmap -dump:live,format=b,file=%dump_path% %process_pid% >> %CAPTURE_LOG%
+jmap -dump:live,format=b,file=%dump_path% %process_pid%
+IF ERRORLEVEL 1 (
+ echo jmap for pid %process_pid% failed to connect, rerunning with -F >> %CAPTURE_LOG%
+ echo jmap for pid %process_pid% failed to connect, rerunning with -F
+ echo Running command: jmap -dump:live,format=b,file=%dump_path% -F %process_pid% >> %CAPTURE_LOG%
+ jmap -dump:live,format=b,file=%dump_path% -F %process_pid%
+)
+
+REM end of process_pid sub-routine
+exit /b
+
+:prepare_exit
+
+IF NOT EXIST %CAPTURE_DIRECTORY% (GOTO EOF)
+echo Capture data is available in %CAPTURE_DIRECTORY% ...
+
+start "" "%CAPTURE_DIRECTORY%"
+PAUSE
+
+:EOF
diff --git a/cave/com.raytheon.uf.viz.acarssounding/src/com/raytheon/uf/viz/acarssounding/AcarsSndNSharpResourceData.java b/cave/com.raytheon.uf.viz.acarssounding/src/com/raytheon/uf/viz/acarssounding/AcarsSndNSharpResourceData.java
index 30c297da4b..7de7914170 100644
--- a/cave/com.raytheon.uf.viz.acarssounding/src/com/raytheon/uf/viz/acarssounding/AcarsSndNSharpResourceData.java
+++ b/cave/com.raytheon.uf.viz.acarssounding/src/com/raytheon/uf/viz/acarssounding/AcarsSndNSharpResourceData.java
@@ -63,6 +63,7 @@ import com.raytheon.uf.viz.d2d.nsharp.rsc.D2DNSharpResourceData;
* ------------ ---------- ----------- --------------------------
* Aug 15, 2013 bsteffen Initial creation
* Jul 23, 2014 3410 bclement preparePointInfo() calls unpackResultLocation()
+ * Dec 17, 2015 5215 dgilling Set point name to stationId.
*
*
*
@@ -78,21 +79,27 @@ public class AcarsSndNSharpResourceData extends D2DNSharpResourceData {
private static final String LATITUDE = "location.latitude";
+ private static final String STATION_ID = "location.stationId";
+
public AcarsSndNSharpResourceData() {
super("MDCRS");
}
@Override
protected void preparePointInfo() throws VizException {
- if (coordinate == null) {
+ if ((coordinate == null) || (pointName == null)) {
DbQueryRequest request = new DbQueryRequest();
request.setConstraints(getMetadataMap());
- request.addFields(new String[] { LONGITUDE, LATITUDE });
+ request.addFields(new String[] { STATION_ID, LONGITUDE, LATITUDE });
request.setDistinct(true);
DbQueryResponse response = (DbQueryResponse) ThriftClient
.sendRequest(request);
for (Map result : response.getResults()) {
+ if (pointName == null) {
+ pointName = (String) result.get(STATION_ID);
+ }
+
if (coordinate == null) {
coordinate = unpackResultLocation(result, LONGITUDE,
LATITUDE);
@@ -111,7 +118,8 @@ public class AcarsSndNSharpResourceData extends D2DNSharpResourceData {
request.addConstraint("dataTime", new RequestConstraint(new DataTime(
stnInfo.getReftime()).toString()));
try {
- DbQueryResponse response = (DbQueryResponse) ThriftClient.sendRequest(request);
+ DbQueryResponse response = (DbQueryResponse) ThriftClient
+ .sendRequest(request);
ACARSSoundingRecord[] records = response
.getEntityObjects(ACARSSoundingRecord.class);
if (records.length > 0) {
@@ -127,7 +135,8 @@ public class AcarsSndNSharpResourceData extends D2DNSharpResourceData {
builder.addTemperature(layer.getTemp(), SI.KELVIN);
}
if (layer.getWindDirection() != null) {
- builder.addWindDirection(layer.getWindDirection(), NonSI.DEGREE_ANGLE);
+ builder.addWindDirection(layer.getWindDirection(),
+ NonSI.DEGREE_ANGLE);
}
if (layer.getWindSpeed() != null) {
builder.addWindSpeed(layer.getWindSpeed(),
@@ -153,7 +162,7 @@ public class AcarsSndNSharpResourceData extends D2DNSharpResourceData {
} catch (VizException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
}
-
+
return null;
}
}
diff --git a/cave/com.raytheon.uf.viz.alertviz.ui/src/com/raytheon/uf/viz/alertviz/ui/dialogs/AlertMessageDlg.java b/cave/com.raytheon.uf.viz.alertviz.ui/src/com/raytheon/uf/viz/alertviz/ui/dialogs/AlertMessageDlg.java
index 8c2e07a68e..fac331bfbe 100644
--- a/cave/com.raytheon.uf.viz.alertviz.ui/src/com/raytheon/uf/viz/alertviz/ui/dialogs/AlertMessageDlg.java
+++ b/cave/com.raytheon.uf.viz.alertviz.ui/src/com/raytheon/uf/viz/alertviz/ui/dialogs/AlertMessageDlg.java
@@ -42,7 +42,6 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -101,6 +100,10 @@ import com.raytheon.uf.viz.alertviz.ui.audio.IAudioAction;
* 31 May 2011 8058 cjeanbap Kill sound based on TextMsgBox id.
* 26 Aug 2013 #2293 lvenable Fixed color memory leaks.
* 02 Jun 2015 4473 mschenke Remember dialog position
+ * 28 Oct 2015 5054 randerso Fix lots of multimonitor display issues.
+ * 14 Jan 2016 5054 randerso Fix the Tips window to display on the correct monitor
+ * Removed duplicate parent shell
+ * 25 Jan 2016 5054 randerso Converted to stand alone window
*
*
*
@@ -119,11 +122,6 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
private static final ScopedPreferenceStore dialogPrefs = new ScopedPreferenceStore(
InstanceScope.INSTANCE, Activator.PLUGIN_ID);
- /**
- * Parent shell.
- */
- private final Shell parentShell;
-
/**
* Local shell.
*/
@@ -150,9 +148,9 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
private Label resizeLabel;
/**
- * Location of the dialog on the screen.
+ * Mouse down location
*/
- private Point origin;
+ private Point mouseDownPt;
/**
* Show dialog flag.
@@ -169,26 +167,11 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
*/
private boolean resizeDialog = false;
- /**
- * Dialog location.
- */
- private Point dialogLoc;
-
/**
* ArrayList of TextMsgControlComp objects.
*/
private ArrayList txtMsgCompArray;
- /**
- * Starting X position.
- */
- private int startXpos = -1;
-
- /**
- * Screen width.
- */
- private int screenWidth = 0;
-
/**
* Text composite.
*/
@@ -247,20 +230,21 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
/**
* Constructor.
*
- * @param parentShell
- * Parent shell.
+ * @param display
+ * Parent display.
* @param audioCB
* Audio callback.
* @param showDialog
* Show dialog flag.
* @param configData
* Configuration data.
+ * @param alertAudioMgr
*/
- public AlertMessageDlg(Shell parentShell, IAudioAction audioCB,
+ public AlertMessageDlg(Display display, IAudioAction audioCB,
boolean showDialog, Configuration configData,
AlertAudioMgr alertAudioMgr) {
+ this.display = display;
this.showDialog = showDialog;
- this.parentShell = parentShell;
this.alertAudioMgr = alertAudioMgr;
this.audioCB = audioCB;
@@ -273,17 +257,21 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
}
}
+ /**
+ * @return the shell
+ */
+ public Shell getShell() {
+ return shell;
+ }
+
/**
* Open method used to display the dialog.
*
* @return True/False.
*/
public Object open() {
- display = parentShell.getDisplay();
-
- Shell shell1 = new Shell(parentShell, SWT.NO_TRIM);
- shell = new Shell(shell1, SWT.ON_TOP);
- shell.setLocation(getDialogPosition());
+ shell = new Shell(display, SWT.ON_TOP | SWT.NO_TRIM);
+ shell.setBounds(restoreDialogPosition());
shell.addDisposeListener(new DisposeListener() {
@Override
@@ -306,6 +294,7 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
shell.pack();
shell.open();
+ // force bar location to be within the display.
Point shellLoc = shell.getLocation();
Point shellSize = shell.getSize();
Display d = shell.getDisplay();
@@ -333,11 +322,18 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
return returnValue;
}
+ /**
+ * @return true if dialog is disposed
+ */
+ public boolean isDisposed() {
+ return (shell == null) || shell.isDisposed();
+ }
+
/**
* Dispose of all the message timers.
*/
public void dispose() {
- setDialogPosition(dialogLoc);
+ saveDialogPosition(shell.getBounds());
// Stop all of the message timers.
for (int i = 0; i < txtMsgCompArray.size(); i++) {
@@ -356,6 +352,10 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
monitor.dispose();
}
+ if (shell != null) {
+ shell.dispose();
+ }
+
ConfigurationManager.getInstance().getCustomLocalization()
.removeFileUpdatedObserver(this);
@@ -374,8 +374,6 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
* Initialize the components on the display.
*/
private void initializeComponents() {
- screenWidth = display.getPrimaryMonitor().getBounds().width;
-
TrayConfiguration.TrayMode tm = configData.getGlobalConfiguration()
.getMode();
boolean monitorOnly = (TrayConfiguration.TrayMode.MO.equals(tm) ? true
@@ -402,9 +400,6 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
mainComp.setLayout(gl);
mainComp.setLayoutData(gd);
- dialogLoc = shell.getLocation();
- origin = dialogLoc;
-
moveLabel = new Label(mainComp, SWT.NONE);
moveLabel.setImage(new Image(display, loadHandleImage()));
moveLabel.setToolTipText("Move");
@@ -531,8 +526,8 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
}
public void setMaxLogSize(final int maxLogSize) {
- if (txtMsgCompArray != null && txtMsgCompArray.size() > 0
- && maxLogSize != txtMsgCompArray.get(0).getMaxLogSize()) {
+ if ((txtMsgCompArray != null) && (txtMsgCompArray.size() > 0)
+ && (maxLogSize != txtMsgCompArray.get(0).getMaxLogSize())) {
for (TextMsgControlComp comp : txtMsgCompArray) {
comp.setMaxLogSize(maxLogSize);
}
@@ -547,31 +542,24 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
*/
@Override
public void mouseMove(MouseEvent e) {
- if ((Label) e.getSource() == moveLabel) {
- if (origin != null && moveDialog == true) {
- dialogLoc = display.map(shell, null, e.x, e.y);
- shell.setLocation(dialogLoc.x - origin.x, dialogLoc.y
- - origin.y);
- }
- } else if ((Label) e.getSource() == resizeLabel) {
- if (resizeDialog == true) {
- int newWidth = e.x - startXpos + shell.getSize().x;
-
- if (newWidth < 300) {
- return;
+ if (mouseDownPt != null) {
+ if ((Label) e.getSource() == moveLabel) {
+ if (moveDialog == true) {
+ Point dialogLoc = shell.getLocation();
+ dialogLoc.x = dialogLoc.x + (e.x - mouseDownPt.x);
+ dialogLoc.y = dialogLoc.y + (e.y - mouseDownPt.y);
+ shell.setLocation(dialogLoc);
}
+ } else if ((Label) e.getSource() == resizeLabel) {
+ if (resizeDialog == true) {
+ int newWidth = shell.getSize().x + (e.x - mouseDownPt.x);
- int shellLocationXCoord = shell.getLocation().x;
+ if (newWidth < 300) {
+ return;
+ }
- if (shellLocationXCoord > screenWidth) {
- shellLocationXCoord = shellLocationXCoord - screenWidth;
+ shell.setSize(newWidth, shell.getSize().y);
}
-
- if (newWidth >= (screenWidth - shellLocationXCoord)) {
- return;
- }
-
- shell.setSize(newWidth, shell.getSize().y);
}
}
}
@@ -585,13 +573,12 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
@Override
public void mouseDown(MouseEvent e) {
if (e.button != SWT.BUTTON3) {
- origin = new Point(e.x, e.y);
+ mouseDownPt = new Point(e.x, e.y);
if ((Label) e.getSource() == moveLabel) {
moveDialog = true;
} else if ((Label) e.getSource() == resizeLabel) {
resizeDialog = true;
- startXpos = e.x;
}
}
}
@@ -605,14 +592,12 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
@Override
public void mouseUp(MouseEvent e) {
if (e.button != SWT.BUTTON3) {
+ mouseDownPt = null;
if ((Label) e.getSource() == moveLabel) {
moveDialog = false;
- configData.getGlobalConfiguration().setPosition(
- shell.getBounds());
} else if ((Label) e.getSource() == resizeLabel) {
resizeDialog = false;
- startXpos = -1;
}
}
}
@@ -637,10 +622,6 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
public void showDialog(boolean showDialogFlag) {
showDialog = showDialogFlag;
- // if (showDialog == true) {
- // shell.setLocation(dialogLoc.x - origin.x, dialogLoc.y - origin.y);
- // }
-
shell.setVisible(showDialog);
}
@@ -661,7 +642,7 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
}
public void resetTabControl() {
- boolean isOpen = tabControlDlg != null && !tabControlDlg.isDisposed()
+ boolean isOpen = (tabControlDlg != null) && !tabControlDlg.isDisposed()
&& tabControlDlg.isOpened();
reLayout();
// TODO: Need to determine which tabs to open and populate them.
@@ -689,7 +670,7 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
RGB[] prevForeground = new RGB[size];
dispose();
for (int i = 0; i < txtMsgCompArray.size(); i++) {
- if (txtMsgCompArray.get(i) != null
+ if ((txtMsgCompArray.get(i) != null)
&& !txtMsgCompArray.get(i).isDisposed()) {
prevMessageText[i] = txtMsgCompArray.get(i)
.getMessageText();
@@ -707,15 +688,16 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
open();
result = true;
for (int i = 0; i < txtMsgCompArray.size(); i++) {
- if (i < prevMessageText.length && prevMessageText[i] != null) {
+ if ((i < prevMessageText.length)
+ && (prevMessageText[i] != null)) {
txtMsgCompArray.get(i).setMessageText(prevMessageText[i]);
- if (prevBackground[i] != null && prevForeground[i] != null) {
+ if ((prevBackground[i] != null)
+ && (prevForeground[i] != null)) {
txtMsgCompArray.get(i).setMessageTextBackAndForeground(
prevBackground[i], prevForeground[i]);
}
}
}
- setDialogLocation();
shell.update();
alertAudioMgr = null;
alertAudioMgr = new AlertAudioMgr(display,
@@ -982,13 +964,6 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
this.configData = configData;
}
- /**
- * Save the dialog location information.
- */
- public void saveDialogBounds() {
- configData.getGlobalConfiguration().setPosition(shell.getBounds());
- }
-
/**
* Is the message dlg enabled
*
@@ -1012,24 +987,23 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
return;
}
- Shell shell = new Shell();
- shell.addDisposeListener(new DisposeListener() {
+ infoTextShell = new Shell(this.shell.getDisplay());
+ infoTextShell.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
infoTextShell = null;
}
});
- infoTextShell = shell;
-
- shell.setLayout(new FillLayout());
- shell.setSize(800, 900);
-
- shell.setText(" AlertViz Tips! ");
+ infoTextShell.setMinimumSize(300, 200);
+ infoTextShell.setLayout(new GridLayout());
+ infoTextShell.setText(" AlertViz Tips! ");
// create the styled text widget
- StyledText widget = new StyledText(shell, SWT.MULTI | SWT.WRAP
+ StyledText widget = new StyledText(infoTextShell, SWT.MULTI
| SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
+ GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ widget.setLayoutData(layoutData);
widget.setText("----------------------------------------------\n"
+ " Here are some basic tips on how to use the AlertViz Main GUI: \n\n"
@@ -1069,7 +1043,26 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
+ "5 - Perhaps not even important enough for a notice of any kind. Informational. \n\n"
+ "------------------------------------------------------------\n\n");
- shell.open();
+ infoTextShell.layout();
+ infoTextShell.pack();
+
+ Rectangle b = this.shell.getBounds();
+ Monitor m = this.shell.getMonitor();
+
+ // attempt to position tips window above or below alertviz bar
+
+ // if tips window would be partially off screen it will be forced on
+ // screen by eclipse/window manager
+ if (b.y < (m.getBounds().height - (b.y + b.height))) {
+ // space below alertviz bar > than space above so position below
+ infoTextShell.setLocation(b.x, b.y + b.height);
+ } else {
+ // space above alertviz bar > than space below so position above
+ infoTextShell.setLocation(b.x, b.y
+ - infoTextShell.getBounds().height);
+ }
+
+ infoTextShell.open();
}
/**
@@ -1114,13 +1107,13 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
errorBtnBgColor = new Color(display, 237, 233, 227);
errorBtn.setBackground(errorBtnBgColor);
- if (tabControlDlg == null || tabControlDlg.isDisposed()) {
+ if ((tabControlDlg == null) || tabControlDlg.isDisposed()) {
tabControlDlg = TabControlDlg.getInstance(shell);
}
if (textMsgLog == null) {
String[] categories = new String[] { "Causes", "Catch", "Error",
"Exception" };
- textMsgLog = new TextMsgLog(parentShell, categories, 0, messageVec);
+ textMsgLog = new TextMsgLog(shell, categories, 0, messageVec);
textMsgLog.setIndex(0);
}
if (opened) {
@@ -1146,7 +1139,7 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
if (textMsgLog == null) {
String[] categories = new String[] { "Causes", "Catch", "Error",
"Exception" };
- textMsgLog = new TextMsgLog(parentShell, categories, 0, messageVec);
+ textMsgLog = new TextMsgLog(shell, categories, 0, messageVec);
textMsgLog.setIndex(0);
}
textMsgLog.addMessage(statMsg);
@@ -1173,14 +1166,14 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
for (Source source : sourceMap.values()) {
String name = source.getName();
- if (source.isMonitor() && name != null) {
+ if (source.isMonitor() && (name != null)) {
String imageFile = source.getConfigurationMonitor()
.getMonitorMetadata().getImageFile();
boolean omitMonitor = source.getConfigurationMonitor()
.getMonitorMetadata().getOmit();
AlertMonitor monitor = alertMonitors.get(name);
- if (imageFile != null
+ if ((imageFile != null)
&& (!imageFile.equals("null") && !imageFile.equals(""))) {
if (monitor != null) {
monitor.setImageName(imageFile);
@@ -1227,42 +1220,23 @@ public class AlertMessageDlg implements MouseMoveListener, MouseListener,
return map;
}
- public Rectangle getCurrentLocation() {
- Rectangle position = new Rectangle(dialogLoc.x, dialogLoc.y,
- parentShell.getBounds().width, parentShell.getBounds().height);
- return position;
- }
-
- private void setDialogLocation() {
- // get any monitors height; should be in an utility class also used in
- // TabControlDlg.
- Monitor any = (display.getMonitors())[0];
- Rectangle monSize = any.getBounds();
- int monY = monSize.height;
-
- Rectangle rect = shell.getBounds();
-
- if (shell.getBounds().y < 0) {
- shell.setLocation(rect.x, rect.y + 100);
- }
-
- if (shell.getBounds().y > (monY - 100)) {
- shell.setLocation(rect.x, rect.y - 100);
- }
- }
-
public AlertAudioMgr getAlertAudioManager() {
return alertAudioMgr;
}
- public static Point getDialogPosition() {
- return new Point(dialogPrefs.getInt(P_ALERT_MSG_DLG_POSITION + ".x"),
- dialogPrefs.getInt(P_ALERT_MSG_DLG_POSITION + ".y"));
+ public static Rectangle restoreDialogPosition() {
+ return new Rectangle(
+ dialogPrefs.getInt(P_ALERT_MSG_DLG_POSITION + ".x"),
+ dialogPrefs.getInt(P_ALERT_MSG_DLG_POSITION + ".y"),
+ dialogPrefs.getInt(P_ALERT_MSG_DLG_POSITION + ".width"),
+ dialogPrefs.getInt(P_ALERT_MSG_DLG_POSITION + ".height"));
}
- public static void setDialogPosition(Point p) {
- dialogPrefs.setValue(P_ALERT_MSG_DLG_POSITION + ".x", p.x);
- dialogPrefs.setValue(P_ALERT_MSG_DLG_POSITION + ".y", p.y);
+ public static void saveDialogPosition(Rectangle r) {
+ dialogPrefs.setValue(P_ALERT_MSG_DLG_POSITION + ".x", r.x);
+ dialogPrefs.setValue(P_ALERT_MSG_DLG_POSITION + ".y", r.y);
+ dialogPrefs.setValue(P_ALERT_MSG_DLG_POSITION + ".width", r.width);
+ dialogPrefs.setValue(P_ALERT_MSG_DLG_POSITION + ".height", r.height);
try {
dialogPrefs.save();
} catch (IOException e) {
diff --git a/cave/com.raytheon.uf.viz.alertviz.ui/src/com/raytheon/uf/viz/alertviz/ui/dialogs/AlertPopupMessageDlg.java b/cave/com.raytheon.uf.viz.alertviz.ui/src/com/raytheon/uf/viz/alertviz/ui/dialogs/AlertPopupMessageDlg.java
index edab9ff9b6..d3b93c1c2f 100644
--- a/cave/com.raytheon.uf.viz.alertviz.ui/src/com/raytheon/uf/viz/alertviz/ui/dialogs/AlertPopupMessageDlg.java
+++ b/cave/com.raytheon.uf.viz.alertviz.ui/src/com/raytheon/uf/viz/alertviz/ui/dialogs/AlertPopupMessageDlg.java
@@ -42,7 +42,6 @@ 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.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List;
@@ -71,6 +70,8 @@ import com.raytheon.uf.viz.alertviz.config.AlertMetadata;
* acknowledgeLastMessage().
* 20 Apr 2015 4311 lvenable Fixed text field to accept really long text strings.
* 29 Jun 2015 4311 randerso Reworking AlertViz dialogs to be resizable.
+ * 25 Jan 2016 5054 randerso Converted to stand alone window
+ * 08 Feb 2016 5312 randerso Deleted isDisposed() added isOpen()
*
*
*
@@ -78,8 +79,8 @@ import com.raytheon.uf.viz.alertviz.config.AlertMetadata;
* @version 1.0
*
*/
-public class AlertPopupMessageDlg extends Dialog implements MouseMoveListener,
- MouseListener, DisposeListener {
+public class AlertPopupMessageDlg implements MouseMoveListener, MouseListener,
+ DisposeListener {
private static final int MAX_INITIAL_LINES = 5;
private static final int WIDTH_IN_CHARS = 135;
@@ -282,8 +283,7 @@ public class AlertPopupMessageDlg extends Dialog implements MouseMoveListener,
/**
* Constructor.
*
- * @param parent
- * Parent shell.
+ * @param display
* @param statMsg
* Status message.
* @param expanded
@@ -293,9 +293,9 @@ public class AlertPopupMessageDlg extends Dialog implements MouseMoveListener,
* @param startUpRGB
* Color to be displayed at startup.
*/
- public AlertPopupMessageDlg(Shell parent, StatusMessage statMsg,
+ public AlertPopupMessageDlg(Display display, StatusMessage statMsg,
boolean expanded, Listener listener, RGB startUpRGB) {
- super(parent, 0);
+ this.display = display;
eventListener = listener;
statMsgArray.add(statMsg);
this.expanded = expanded;
@@ -308,10 +308,7 @@ public class AlertPopupMessageDlg extends Dialog implements MouseMoveListener,
* Initialize the shell
*/
private void initShell(RGB startUp) {
- Shell parent = getParent();
- display = parent.getDisplay();
-
- shell = new Shell(parent, SWT.ON_TOP | SWT.RESIZE);
+ shell = new Shell(display, SWT.ON_TOP | SWT.RESIZE);
shell.setText("Alert Visualization Popup Message Dialog");
shell.addDisposeListener(this);
@@ -1066,12 +1063,12 @@ public class AlertPopupMessageDlg extends Dialog implements MouseMoveListener,
}
/**
- * Returns if dialog is disposed.
+ * Returns true if dialog is open
*
- * @return True if disposed, false if not.
+ * @return True if open, false if not.
*/
- public boolean isDisposed() {
- return shell.isDisposed();
+ public boolean isOpen() {
+ return (shell != null) && !shell.isDisposed() && shell.isVisible();
}
}
diff --git a/cave/com.raytheon.uf.viz.alertviz.ui/src/com/raytheon/uf/viz/alertviz/ui/dialogs/AlertVisConfigDlg.java b/cave/com.raytheon.uf.viz.alertviz.ui/src/com/raytheon/uf/viz/alertviz/ui/dialogs/AlertVisConfigDlg.java
index e08bee1378..343f44d840 100644
--- a/cave/com.raytheon.uf.viz.alertviz.ui/src/com/raytheon/uf/viz/alertviz/ui/dialogs/AlertVisConfigDlg.java
+++ b/cave/com.raytheon.uf.viz.alertviz.ui/src/com/raytheon/uf/viz/alertviz/ui/dialogs/AlertVisConfigDlg.java
@@ -38,7 +38,6 @@ 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.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
@@ -100,6 +99,8 @@ import com.raytheon.uf.viz.alertviz.ui.dialogs.ConfigurationFileDlg.Function;
* 07 Feb 2013 15490 Xiaochuan Past this object to LayoutControlsComp.
* 26 Aug 2013 #2293 lvenable Fixed color memory leak and cleaned up some code.
* 23 Oct 2013 2303 bgonzale Old patch to fix tool tip layout.
+ * 28 Oct 2005 5054 randerso Removed bar position as it was written but never read
+ * 25 Jan 2016 5054 randerso Converted to stand alone window
*
*
*
@@ -107,8 +108,8 @@ import com.raytheon.uf.viz.alertviz.ui.dialogs.ConfigurationFileDlg.Function;
* @version 1.0
*
*/
-public class AlertVisConfigDlg extends Dialog implements
- IConfigurationChangedListener, INeedsSaveListener {
+public class AlertVisConfigDlg implements IConfigurationChangedListener,
+ INeedsSaveListener {
private final String CONFIG_LABEL = "Current Config: ";
@@ -264,16 +265,16 @@ public class AlertVisConfigDlg extends Dialog implements
/**
* Constructor.
*
- * @param parent
- * Parent shell.
+ * @param display
* @param configData
* Configuration data.
*/
- public AlertVisConfigDlg(Shell parent, final AlertMessageDlg alertMsgDlg,
- Configuration configData, ConfigContext configContext,
+ public AlertVisConfigDlg(Display display,
+ final AlertMessageDlg alertMsgDlg, Configuration configData,
+ ConfigContext configContext,
IConfigurationChangedListener configurationChangeListener,
IRestartListener restartListener) {
- super(parent, 0);
+ this.display = display;
this.configData = configData;
this.configContext = configContext;
sourceMap = configData.getSources();
@@ -306,8 +307,6 @@ public class AlertVisConfigDlg extends Dialog implements
* @return True/False.
*/
public Object open() {
- Shell parent = getParent();
- display = parent.getDisplay();
shell = new Shell(display, SWT.DIALOG_TRIM | SWT.MIN | SWT.RESIZE
| SWT.MAX);
shell.setText("Alert Visualization Configuration");
@@ -396,6 +395,7 @@ public class AlertVisConfigDlg extends Dialog implements
layoutControls = new LayoutControlsComp(layoutGroup, configData, this,
this);
layoutGroup.addMouseTrackListener(new MouseTrackAdapter() {
+ @Override
public void mouseHover(MouseEvent e) {
mttLayout.open();
}
@@ -418,6 +418,7 @@ public class AlertVisConfigDlg extends Dialog implements
mttCommonSetting = new MonitorToolTip(commonSettingsGroup, true);
commonSettingsGroup.addMouseTrackListener(new MouseTrackAdapter() {
+ @Override
public void mouseHover(MouseEvent e) {
mttCommonSetting.open();
}
@@ -632,6 +633,7 @@ public class AlertVisConfigDlg extends Dialog implements
mttSource = new MonitorToolTip(sourcesLbl, false);
sourcesLbl.addMouseTrackListener(new MouseTrackAdapter() {
+ @Override
public void mouseHover(MouseEvent e) {
mttSource.open();
}
@@ -686,6 +688,7 @@ public class AlertVisConfigDlg extends Dialog implements
sourcesList.setMenu(popupMenuSourceList);
popupMenuSourceList.addListener(SWT.Show, new Listener() {
+ @Override
public void handleEvent(Event event) {
MenuItem[] menuItems = popupMenuSourceList.getItems();
@@ -864,6 +867,7 @@ public class AlertVisConfigDlg extends Dialog implements
mttPriorities = new MonitorToolTip(priorityLbl, false);
priorityLbl.addMouseTrackListener(new MouseTrackAdapter() {
+ @Override
public void mouseHover(MouseEvent e) {
mttPriorities.open();
}
@@ -1134,7 +1138,7 @@ public class AlertVisConfigDlg extends Dialog implements
sourceMap.keySet());
Boolean saveInfo = (Boolean) newSrcCatDlg.open();
- if (saveInfo != null && saveInfo == true) {
+ if ((saveInfo != null) && (saveInfo == true)) {
String name = newSrcCatDlg.getTextKey();
String desc = newSrcCatDlg.getDescription();
@@ -1251,17 +1255,15 @@ public class AlertVisConfigDlg extends Dialog implements
gConfig.setMode(layoutControls.getSelectedLayoutTrayMode()); // Mandatory
// to be
// HERE!
- if (alertMsgDlg != null) {
- gConfig.setPosition(alertMsgDlg.getCurrentLocation());
- }
}
/**
* Populate the priority controls.
*/
private void populatePriorityControls() {
- if (priorityControls == null)
+ if (priorityControls == null) {
return;
+ }
int index = sourcesList.getSelectionIndex();
diff --git a/cave/com.raytheon.uf.viz.alertviz.ui/src/com/raytheon/uf/viz/alertviz/ui/dialogs/AlertVisualization.java b/cave/com.raytheon.uf.viz.alertviz.ui/src/com/raytheon/uf/viz/alertviz/ui/dialogs/AlertVisualization.java
index fe644671d8..0ff2c8bf47 100644
--- a/cave/com.raytheon.uf.viz.alertviz.ui/src/com/raytheon/uf/viz/alertviz/ui/dialogs/AlertVisualization.java
+++ b/cave/com.raytheon.uf.viz.alertviz.ui/src/com/raytheon/uf/viz/alertviz/ui/dialogs/AlertVisualization.java
@@ -22,12 +22,15 @@ package com.raytheon.uf.viz.alertviz.ui.dialogs;
import java.io.File;
import org.eclipse.equinox.app.IApplication;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MenuDetectEvent;
import org.eclipse.swt.events.MenuDetectListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;
@@ -35,7 +38,6 @@ import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.ToolTip;
import org.eclipse.swt.widgets.Tray;
@@ -96,6 +98,10 @@ import com.raytheon.uf.viz.core.VizApp;
* 18 Mar 2015 4234 njensen Remove reference to non-working python
* 03 Jun 2015 4473 njensen Updated for new AlertvizJob API
* 29 Jun 2015 4311 randerso Reworking AlertViz dialogs to be resizable.
+ * 28 Oct 2015 5054 randerso Call AlertVisualization.dispose() on restart so all the
+ * other dispose methods are called.
+ * 25 Jan 2016 5054 randerso Removed dummy parent shell
+ * 08 Feb 2016 5312 randerso Changed to build tray menu on demand
*
*
*
@@ -106,11 +112,6 @@ import com.raytheon.uf.viz.core.VizApp;
public class AlertVisualization implements ITimerAction, IAudioAction,
IAlertArrivedCallback, Listener, IConfigurationChangedListener,
IRestartListener {
- /**
- * Dialog shell.
- */
- protected Shell shell;
-
/**
* The display control.
*/
@@ -136,35 +137,10 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
*/
private TrayItem trayItem;
- /**
- * A pop-up menu for the tray item.
- */
- protected Menu trayItemMenu;
-
- /**
- * Show alert visualization menu item.
- */
- private MenuItem showAlertDialogMI;
-
- /**
- * Do not disturb menu item.
- */
- private MenuItem doNotDisturbMI;
-
- /**
- * Show alert dialog popup menu item
- */
- private MenuItem showPopup;
-
- /**
- * Acknowledge all alerts menu item
- */
- private MenuItem ackAll;
-
/**
* Alert message dialog.
*/
- private AlertMessageDlg alertMessageDlg;
+ protected AlertMessageDlg alertMessageDlg;
/**
* Text blink count variable.
@@ -211,6 +187,10 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
*/
private boolean showAlertDlg = true;
+ private boolean ackAll = false;
+
+ private boolean showPopup = false;
+
/**
* Tool tip.
*/
@@ -221,8 +201,6 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
*/
protected final boolean runningStandalone;
- private Rectangle prevLocation = null;
-
private ConfigContext configContext;
private Configuration prevConfigFile;
@@ -245,15 +223,6 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
showAlertDlg = Boolean.getBoolean("ShowAlertVizBar");
doNotDisturb = true;
}
- initShell();
- }
-
- /**
- * Initialize a main shell.
- */
- private void initShell() {
- shell = new Shell(display);
-
initializeComponents();
AlertvizJob.getInstance().addAlertArrivedCallback(this);
@@ -295,10 +264,6 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
alertMessageDlg.dispose();
}
- if (shell != null) {
- shell.dispose();
- }
-
if (display != null) {
display.dispose();
}
@@ -322,9 +287,9 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
* Initialize the alert message dialog.
*/
private void initAlertMessageDialog() {
- alertMessageDlg = new AlertMessageDlg(shell, this, showAlertDlg,
+ alertMessageDlg = new AlertMessageDlg(display, this, showAlertDlg,
configData, audioMgr);
- display.asyncExec(new Runnable() {
+ display.syncExec(new Runnable() {
@Override
public void run() {
alertMessageDlg.open();
@@ -361,14 +326,13 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
trayItem = new TrayItem(tray, SWT.NONE);
updateToolTip();
- trayItemMenu = new Menu(shell, SWT.POP_UP);
-
- createTrayMenuItems();
-
// Right click action
trayItem.addMenuDetectListener(new MenuDetectListener() {
@Override
public void menuDetected(MenuDetectEvent de) {
+ Menu trayItemMenu = new Menu(alertMessageDlg.getShell(),
+ SWT.POP_UP);
+ createTrayMenuItems(trayItemMenu);
trayItemMenu.setVisible(true);
}
});
@@ -389,10 +353,12 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
/**
* Create the tray menu items.
+ *
+ * @param menu
*/
- protected void createTrayMenuItems() {
+ protected void createTrayMenuItems(Menu menu) {
- showAlertDialogMI = new MenuItem(trayItemMenu, SWT.CHECK);
+ MenuItem showAlertDialogMI = new MenuItem(menu, SWT.CHECK);
showAlertDialogMI.setText("Show Alert Dialog");
showAlertDialogMI.setSelection(showAlertDlg);
showAlertDialogMI.addSelectionListener(new SelectionAdapter() {
@@ -411,20 +377,21 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
});
if (Boolean.getBoolean("SystemTray")) {
- doNotDisturbMI = new MenuItem(trayItemMenu, SWT.CHECK);
+ MenuItem doNotDisturbMI = new MenuItem(menu, SWT.CHECK);
doNotDisturbMI.setText("Do Not Disturb");
doNotDisturbMI.setSelection(doNotDisturb);
doNotDisturbMI.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
- doNotDisturb = doNotDisturbMI.getSelection();
+ MenuItem item = (MenuItem) event.widget;
+ doNotDisturb = item.getSelection();
}
});
}
- new MenuItem(trayItemMenu, SWT.SEPARATOR);
+ new MenuItem(menu, SWT.SEPARATOR);
- MenuItem configTrayMI = new MenuItem(trayItemMenu, SWT.NONE);
+ MenuItem configTrayMI = new MenuItem(menu, SWT.NONE);
configTrayMI.setText("Configuration...");
configTrayMI.addSelectionListener(new SelectionAdapter() {
@Override
@@ -433,7 +400,7 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
}
});
- MenuItem viewLogMI = new MenuItem(trayItemMenu, SWT.NONE);
+ MenuItem viewLogMI = new MenuItem(menu, SWT.NONE);
viewLogMI.setText("System Log...");
viewLogMI.addSelectionListener(new SelectionAdapter() {
SimpleLogViewer slv = null;
@@ -441,7 +408,7 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
@Override
public void widgetSelected(SelectionEvent event) {
if ((slv == null) || slv.isDisposed()) {
- slv = new SimpleLogViewer(shell);
+ slv = new SimpleLogViewer(display);
slv.open();
} else {
slv.bringToTop();
@@ -449,22 +416,23 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
}
});
- new MenuItem(trayItemMenu, SWT.SEPARATOR);
+ new MenuItem(menu, SWT.SEPARATOR);
- showPopup = new MenuItem(trayItemMenu, SWT.NONE);
- showPopup.setText("Show Alert Popup Dialog...");
- showPopup.setEnabled(false);
- showPopup.addSelectionListener(new SelectionAdapter() {
+ MenuItem showPopupMI = new MenuItem(menu, SWT.NONE);
+ showPopupMI.setText("Show Alert Popup Dialog...");
+ showPopupMI.setEnabled(showPopup && (alertPopupDlg != null)
+ && !alertPopupDlg.isOpen());
+ showPopupMI.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
openAlertPopupDialog();
}
});
- ackAll = new MenuItem(trayItemMenu, SWT.NONE);
- ackAll.setText("Acknowledge All Messages");
- ackAll.setEnabled(false);
- ackAll.addSelectionListener(new SelectionAdapter() {
+ MenuItem ackAllMI = new MenuItem(menu, SWT.NONE);
+ ackAllMI.setText("Acknowledge All Messages");
+ ackAllMI.setEnabled(ackAll);
+ ackAllMI.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
if (alertPopupDlg != null) {
@@ -479,16 +447,31 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
});
if (this.runningStandalone) {
- new MenuItem(trayItemMenu, SWT.SEPARATOR);
- MenuItem restartMI = new MenuItem(trayItemMenu, SWT.NONE);
+ new MenuItem(menu, SWT.SEPARATOR);
+ MenuItem restartMI = new MenuItem(menu, SWT.NONE);
restartMI.setText("Restart");
restartMI.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
- MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION
- | SWT.YES | SWT.NO);
- mb.setMessage("Any unsaved changes will be lost. Restart anyway?");
- if (mb.open() == SWT.YES) {
+ MessageDialog dialog = new MessageDialog(
+ alertMessageDlg.getShell(),
+ "Confirm Restart!",
+ null,
+ "Any unsaved changes will be lost. Restart anyway?",
+ MessageDialog.QUESTION, new String[] {
+ IDialogConstants.YES_LABEL,
+ IDialogConstants.NO_LABEL }, 0);
+
+ dialog.create();
+
+ // center dialog on display
+ Shell shell = dialog.getShell();
+ Point size = shell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Rectangle bounds = alertMessageDlg.getShell().getMonitor()
+ .getBounds();
+ shell.setLocation(bounds.x + ((bounds.width - size.x) / 2),
+ bounds.y + ((bounds.height - size.y) / 2));
+ if (dialog.open() == 0) {
restart();
}
}
@@ -586,7 +569,7 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
if ((configDlg != null) && !configDlg.isDisposed()) {
configDlg.close();
}
- configDlg = new AlertVisConfigDlg(shell, alertMessageDlg, configData,
+ configDlg = new AlertVisConfigDlg(display, alertMessageDlg, configData,
configContext, this, this);
configDlg.open();
}
@@ -608,7 +591,7 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
final AlertMetadata amd, final Category cat,
final TrayConfiguration gConfig) {
- if (shell.isDisposed()) {
+ if ((alertMessageDlg == null) || alertMessageDlg.isDisposed()) {
Container.logInternal(Priority.ERROR, statMsg.getMessage() + "\n"
+ statMsg.getDetails());
return;
@@ -690,10 +673,10 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
// Pop-up message
if (amd.isPopup() == true) {
if (alertPopupDlg == null) {
- alertPopupDlg = new AlertPopupMessageDlg(shell, statMsg,
+ alertPopupDlg = new AlertPopupMessageDlg(display, statMsg,
gConfig.isExpandedPopup(), this, amd.getBackground());
- showPopup.setEnabled(true);
- ackAll.setEnabled(true);
+ showPopup = true;
+ ackAll = true;
startBlinkTrayTimer();
} else {
alertPopupDlg.addNewMessage(statMsg, amd);
@@ -761,7 +744,8 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
toolTip.dispose();
}
- toolTip = new ToolTip(shell, SWT.BALLOON | SWT.ICON_WARNING);
+ toolTip = new ToolTip(alertMessageDlg.getShell(), SWT.BALLOON
+ | SWT.ICON_WARNING);
toolTip.setText(cat.getCategoryName());
toolTip.setMessage(statMsg.getMessage());
@@ -797,6 +781,9 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
}
}
+ /**
+ * @return the exit status
+ */
public Integer getExitStatus() {
return exitStatus;
}
@@ -809,8 +796,8 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
public void handleEvent(Event event) {
switch (event.type) {
case SWT.Hide:
- ackAll.setEnabled(true);
- showPopup.setEnabled(true);
+ ackAll = true;
+ showPopup = true;
startBlinkTrayTimer();
updateToolTip();
break;
@@ -819,8 +806,9 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
alertPopupDlg = null;
cancelTimer();
updateToolTip();
- ackAll.setEnabled(false);
- showPopup.setEnabled(false);
+
+ ackAll = false;
+ showPopup = false;
break;
default:
Container.logInternal(Priority.WARN, "Unexpected event type: "
@@ -838,7 +826,7 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
// such as Integer(1) the executable attempts to bring
// up an error screen before exiting with the error code.
exitStatus = IApplication.EXIT_RELAUNCH;
- display.dispose();
+ this.dispose();
}
}
@@ -848,19 +836,16 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
configData = ConfigurationManager.getInstance()
.getCurrentConfiguration();
configContext = ConfigurationManager.getInstance().getCurrentContext();
- if ((alertMessageDlg != null) && (showAlertDialogMI != null)) {
+ if (alertMessageDlg != null) {
alertMessageDlg.setConfigData(configData);
if (configData.isMonitorLayoutChanged(prevConfigFile)) {
if (alertMessageDlg.reLayout()) {
- showAlertDialogMI.setEnabled(true);
+ showAlertDlg = true;
}
prevConfigFile = configData.clone();
}
audioMgr = alertMessageDlg.getAlertAudioManager();
}
- // if (configDlg != null && !configDlg.isDisposed()) {
- // configDlg.restart(requestRestart);
- // }
}
/**
diff --git a/cave/com.raytheon.uf.viz.alertviz.ui/src/com/raytheon/uf/viz/alertviz/ui/dialogs/FileSelectDlg.java b/cave/com.raytheon.uf.viz.alertviz.ui/src/com/raytheon/uf/viz/alertviz/ui/dialogs/FileSelectDlg.java
index d6ca0ce033..73de31a51b 100644
--- a/cave/com.raytheon.uf.viz.alertviz.ui/src/com/raytheon/uf/viz/alertviz/ui/dialogs/FileSelectDlg.java
+++ b/cave/com.raytheon.uf.viz.alertviz.ui/src/com/raytheon/uf/viz/alertviz/ui/dialogs/FileSelectDlg.java
@@ -34,7 +34,6 @@ import java.util.Vector;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -55,7 +54,6 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.exception.LocalizationException;
-import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
@@ -73,6 +71,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* 07 Dec 2010 6531 cjeanbap Refactored class to be an Abstract class.
* 02 Mar 2011 5632 cjeanbap Update Listbox title text
* 06 May 2011 9101 cjeanbap Changed Constructor method signature.
+ * 12 Nov 2015 4834 njensen Changed LocalizationOpFailedException to LocalizationException
+ *
*
*
* @author lvenable
@@ -268,7 +268,7 @@ public class FileSelectDlg extends Dialog {
fileList.add(locFile.getFile(false).getName());
}
fileList.select(getIndex());
- fileList.addSelectionListener(new SelectionListener() {
+ fileList.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
selectedIndex = fileList.getSelectionIndex();
@@ -287,10 +287,6 @@ public class FileSelectDlg extends Dialog {
associatedTextBox.setText(name);
}
}
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- }
});
}
@@ -313,6 +309,7 @@ public class FileSelectDlg extends Dialog {
okBtn.setText("OK");
okBtn.setLayoutData(gd);
okBtn.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent event) {
returnObj = true;
shell.dispose();
@@ -324,6 +321,7 @@ public class FileSelectDlg extends Dialog {
cancelBtn.setText("Cancel");
cancelBtn.setLayoutData(gd);
cancelBtn.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent event) {
if (isSelected()) {
returnObj = false;
@@ -339,6 +337,7 @@ public class FileSelectDlg extends Dialog {
importNewBtn1.setText("Import");
importNewBtn1.setLayoutData(gd);
importNewBtn1.addSelectionListener(new SelectionAdapter() {
+ @Override
public void widgetSelected(SelectionEvent event) {
FileDialog newFileDlg = new FileDialog(shell, SWT.OPEN
| SWT.SINGLE);
@@ -368,10 +367,7 @@ public class FileSelectDlg extends Dialog {
}
setSelectedFile(newFile.getName());
}
- } catch (LocalizationOpFailedException e) {
- statusHandler.handle(Priority.PROBLEM,
- e.getLocalizedMessage(), e);
- } catch (IOException e) {
+ } catch (LocalizationException | IOException e) {
statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
@@ -382,7 +378,7 @@ public class FileSelectDlg extends Dialog {
}
private boolean saveToLocalizationFile(File file, LocalizationFile locFile)
- throws IOException, LocalizationOpFailedException {
+ throws IOException, LocalizationException {
File newFile = locFile.getFile();
InputStream in = new FileInputStream(file);
OutputStream out = new FileOutputStream(newFile);
diff --git a/cave/com.raytheon.uf.viz.alertviz.ui/src/com/raytheon/uf/viz/alertviz/ui/dialogs/SimpleLogViewer.java b/cave/com.raytheon.uf.viz.alertviz.ui/src/com/raytheon/uf/viz/alertviz/ui/dialogs/SimpleLogViewer.java
index e050c65880..27eebc25e8 100644
--- a/cave/com.raytheon.uf.viz.alertviz.ui/src/com/raytheon/uf/viz/alertviz/ui/dialogs/SimpleLogViewer.java
+++ b/cave/com.raytheon.uf.viz.alertviz.ui/src/com/raytheon/uf/viz/alertviz/ui/dialogs/SimpleLogViewer.java
@@ -20,9 +20,14 @@
package com.raytheon.uf.viz.alertviz.ui.dialogs;
import java.io.File;
+import java.io.PrintWriter;
+import java.io.StringWriter;
import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Collection;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.SWT;
@@ -36,7 +41,6 @@ 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.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.FileDialog;
@@ -71,6 +75,8 @@ import com.raytheon.uf.viz.alertviz.config.TrayConfiguration;
* Jun 02, 2015 4473 njensen Cleaned up warnings
* Jul 01, 2015 4473 njensen Fix update of table on alert arrival
* Jun 29, 2015 4311 randerso Reworking AlertViz dialogs to be resizable.
+ * Jan 25, 2016 5054 randerso Converted to stand alone window
+ * Feb 11, 2016 5314 dgilling Fix System Log functionality.
*
*
*
@@ -78,7 +84,7 @@ import com.raytheon.uf.viz.alertviz.config.TrayConfiguration;
* @version 1.0
*/
-public class SimpleLogViewer extends Dialog implements IAlertArrivedCallback {
+public class SimpleLogViewer implements IAlertArrivedCallback {
private Display display;
@@ -88,8 +94,6 @@ public class SimpleLogViewer extends Dialog implements IAlertArrivedCallback {
private Button showLog;
- int[] range;
-
private Table table;
private Color yellow;
@@ -104,13 +108,12 @@ public class SimpleLogViewer extends Dialog implements IAlertArrivedCallback {
/**
*
- * @param parent
+ * @param display
*/
- public SimpleLogViewer(Shell parent) {
- super(parent, SWT.NONE);
+ public SimpleLogViewer(Display display) {
first = true;
- display = parent.getDisplay();
+ this.display = display;
// Create a new shell object and set the text for the dialog.
shell = new Shell(display, SWT.DIALOG_TRIM | SWT.MIN | SWT.TITLE
@@ -171,15 +174,10 @@ public class SimpleLogViewer extends Dialog implements IAlertArrivedCallback {
columns[3].setWidth(100);
columns[4].setText("Message");
columns[4].setWidth(100);
+
int sz = 0;
try {
- range = SystemStatusHandler.getCurrentRange();
- if ((range[0] == 0) && (range[1] == 0)) {
- // database is empty
- sz = 0;
- } else {
- sz = (range[1] - range[0]) + 1;
- }
+ sz = SystemStatusHandler.getMessageCount();
} catch (AlertvizException e2) {
Container
.logInternal(
@@ -199,17 +197,27 @@ public class SimpleLogViewer extends Dialog implements IAlertArrivedCallback {
table.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
+ Integer pk = (Integer) e.item.getData();
int idx = table.getSelectionIndex();
+
StatusMessage sm = null;
try {
-
- sm = SystemStatusHandler.retrieveByPk(idx + range[0]);
+ /*
+ * This event is triggered during initialization before the
+ * first TableItem has been assigned a PK in its data field.
+ * So we fall back to item selection index just in case.
+ */
+ if (pk != null) {
+ sm = SystemStatusHandler.retrieveByPk(pk.intValue());
+ } else {
+ sm = SystemStatusHandler.retrieveByRowOffset(idx);
+ }
} catch (Exception e1) {
Container
.logInternal(
Priority.ERROR,
"SimpleLogViewer: exception retrieving StatusMessage by key from SystemStatusHandler: "
- + (idx + range[0]), e1);
+ + (idx + 1), e1);
}
detailsComp.displayDetails(sm);
}
@@ -227,12 +235,13 @@ public class SimpleLogViewer extends Dialog implements IAlertArrivedCallback {
int index = table.indexOf(item);
try {
StatusMessage sm = SystemStatusHandler
- .retrieveByPk(range[0] + index);
+ .retrieveByRowOffset(index);
item.setText(0, "" + sm.getEventTime().toString());
item.setText(1, "" + sm.getPriority().ordinal());
item.setText(2, sm.getSourceKey());
item.setText(3, sm.getCategory());
item.setText(4, sm.getMessage());
+ item.setData(Integer.valueOf(sm.getPk()));
if (sm.getPriority() == Priority.CRITICAL) {
item.setForeground(red);
@@ -247,14 +256,15 @@ public class SimpleLogViewer extends Dialog implements IAlertArrivedCallback {
}
} catch (AlertvizException e1) {
- Status s = new Status(IStatus.ERROR, Activator.PLUGIN_ID,
- "Error fetching the data", e1);
- ErrorDialog.openError(
- Display.getCurrent().getActiveShell(),
- "Error fetching data",
- "Error fetching the log data", s);
+ Container
+ .logInternal(
+ Priority.ERROR,
+ "SimpleLogViewer: exception retrieving StatusMessage by row offset from SystemStatusHandler: "
+ + index, e1);
+ errorDialogWithStackTrace(Display.getCurrent()
+ .getActiveShell(), "Error fetching data",
+ "Error fetching the log data", e1);
}
-
}
});
@@ -281,10 +291,12 @@ public class SimpleLogViewer extends Dialog implements IAlertArrivedCallback {
LogUtil.saveLogToFile(new File(fileName),
new Timestamp(0), Order.AFTER);
} catch (AlertvizException e1) {
- final Status s = new Status(IStatus.ERROR,
- Activator.PLUGIN_ID, "Error saving log", e1);
- ErrorDialog.openError(shell, "Error saving log",
- "Error saving log", s);
+ Container.logInternal(Priority.ERROR,
+ "SimpleLogViewer: exception saving log file: "
+ + fileName, e1);
+ errorDialogWithStackTrace(Display.getCurrent()
+ .getActiveShell(), "Error saving log",
+ "Error saving log", e1);
}
}
}
@@ -356,8 +368,11 @@ public class SimpleLogViewer extends Dialog implements IAlertArrivedCallback {
AlertvizJob.getInstance().addAlertArrivedCallback(this);
shell.open();
- table.showItem(table.getItem(table.getItemCount() - 1));
- table.select(table.getItemCount() - 1);
+
+ if (table.getItemCount() > 0) {
+ table.showItem(table.getItem(table.getItemCount() - 1));
+ table.select(table.getItemCount() - 1);
+ }
// Wait until the shell is disposed.
Display display = shell.getDisplay();
@@ -404,4 +419,26 @@ public class SimpleLogViewer extends Dialog implements IAlertArrivedCallback {
size.y += delta;
shell.setSize(size);
}
+
+ private static void errorDialogWithStackTrace(Shell parentShell,
+ String dialogTitle, String msg, Throwable t) {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
+ t.printStackTrace(pw);
+ String trace = sw.toString();
+
+ Collection childStatuses = new ArrayList<>();
+
+ String lineSep = System.getProperty("line.separator");
+ for (String line : trace.split(lineSep)) {
+ childStatuses.add(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ line));
+ }
+
+ MultiStatus ms = new MultiStatus(Activator.PLUGIN_ID, IStatus.ERROR,
+ childStatuses.toArray(new Status[0]), t.getLocalizedMessage(),
+ t);
+
+ ErrorDialog.openError(parentShell, dialogTitle, msg, ms);
+ }
}
diff --git a/cave/com.raytheon.uf.viz.alertviz.ui/src/com/raytheon/uf/viz/alertviz/ui/dialogs/TmpFileSelectDlg.java b/cave/com.raytheon.uf.viz.alertviz.ui/src/com/raytheon/uf/viz/alertviz/ui/dialogs/TmpFileSelectDlg.java
deleted file mode 100644
index 59cad56ce5..0000000000
--- a/cave/com.raytheon.uf.viz.alertviz.ui/src/com/raytheon/uf/viz/alertviz/ui/dialogs/TmpFileSelectDlg.java
+++ /dev/null
@@ -1,248 +0,0 @@
-package com.raytheon.uf.viz.alertviz.ui.dialogs;
-
-import java.io.File;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Font;
-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.Dialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.Shell;
-
-import com.raytheon.uf.common.localization.LocalizationFile;
-import com.raytheon.uf.common.localization.PathManagerFactory;
-
-public abstract class TmpFileSelectDlg extends Dialog {
-
- /**
- * Dialog shell.
- */
- private Shell shell;
-
- /**
- * The display control.
- */
- private Display display;
-
- /**
- * Control font.
- */
- private Font controlFont;
-
- /**
- * Sound file list control.
- */
- private List soundFileList;
-
- /**
- * Return object when the shell is disposed.
- */
- private Boolean returnObj = null;
-
- /**
- * Array of localization files.
- */
- private LocalizationFile[] locFiles;
-
- /**
- * Current sound file.
- */
- public File currentFile;
-
- /**
- * New sound file.
- */
- private File newFile;
-
- private String path;
-
- private String fileExtension;
-
- public TmpFileSelectDlg(Shell parent, int style) {
- super(parent, style);
- }
-
- /**
- * Open method used to display the dialog.
- *
- * @param audioFile
- * The name of the audio file, if null default to index 0.
- * @return True/False.
- */
- public Object open(String title, String actionFile) {
- Shell parent = getParent();
- display = parent.getDisplay();
- shell = new Shell(parent, SWT.TITLE);
- //shell.setText("Action File Selection");
-
- // Create the main layout for the shell.
- GridLayout mainLayout = new GridLayout(1, false);
- mainLayout.marginHeight = 2;
- mainLayout.marginWidth = 2;
- mainLayout.verticalSpacing = 2;
- shell.setLayout(mainLayout);
-
- // Initialize all of the controls and layouts
- initializeComponents();
-
- if (actionFile != null) {
- setSelectedAudioFile(actionFile);
- }
-
- shell.pack();
- shell.open();
-
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch()) {
- display.sleep();
- }
- }
-
- controlFont.dispose();
-
- return returnObj;
- }
-
- /**
- * Initialize the controls on the display.
- */
- private void initializeComponents() {
- controlFont = new Font(shell.getDisplay(), "Monospace", 10, SWT.NORMAL);
-
- createListControl();
- // Create the buttons at the bottom of the display.
- createBottomButtons();
-
- getAvailableFiles();
- }
-
- /**
- * Set the selected index of file list object based upon the
- * audio file.
- *
- * @param audioFile The name of the audio file.
- */
- private void setSelectedAudioFile(String audioFile) {
- String[] audioFiles = soundFileList.getItems();
- int index = 0;
- for (int i = 0; i < audioFiles.length; i++) {
- if (audioFile.endsWith(audioFiles[i])) {
- index = i;
- break;
- }
- }
- soundFileList.select(index);
- }
-
- /**
- * Create the list control.
- */
- private void createListControl() {
- GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
- Composite listComp = new Composite(shell, SWT.NONE);
- listComp.setLayout(new GridLayout(1, false));
- listComp.setLayoutData(gd);
-
- Label listLbl = new Label(listComp, SWT.NONE);
- listLbl.setText("Available Sound Files:");
-
- gd = new GridData(SWT.FILL, SWT.FILL, true, true);
- gd.widthHint = 400;
- gd.heightHint = 400;
- gd.horizontalSpan = 2;
- soundFileList = new List(listComp, SWT.BORDER | SWT.SINGLE
- | SWT.V_SCROLL | SWT.H_SCROLL);
- soundFileList.setLayoutData(gd);
- soundFileList.setFont(controlFont);
- }
-
- /**
- * Create the buttons at the bottom of the dialog.
- */
- private void createBottomButtons() {
- GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
- Composite mainButtonComp = new Composite(shell, SWT.NONE);
- mainButtonComp.setLayout(new GridLayout(1, false));
- mainButtonComp.setLayoutData(gd);
-
- gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, false);
- Composite buttonComp = new Composite(shell, SWT.NONE);
- buttonComp.setLayout(new GridLayout(2, false));
- buttonComp.setLayoutData(gd);
-
- gd = new GridData(100, SWT.DEFAULT);
- Button okBtn = new Button(buttonComp, SWT.PUSH);
- okBtn.setText("OK");
- okBtn.setLayoutData(gd);
- okBtn.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- if (soundFileList.getSelectionIndex() != 0) {
- newFile = locFiles[soundFileList.getSelectionIndex()].getFile();
- } else {
- newFile = locFiles[0].getFile();
- }
- returnObj = true;
- shell.dispose();
- }
- });
-
- gd = new GridData(100, SWT.DEFAULT);
- Button cancelBtn = new Button(buttonComp, SWT.PUSH);
- cancelBtn.setText("Cancel");
- cancelBtn.setLayoutData(gd);
- cancelBtn.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- returnObj = false;
- shell.dispose();
- }
- });
- }
-
- /**
- * Get the list of available sound files.
- */
- private void getAvailableFiles() {
- String[] extensions = new String[] { fileExtension };
- locFiles = PathManagerFactory.getPathManager().listStaticFiles(
- path, extensions, true, true);
-
- for (int i = 0; i < locFiles.length; i++) {
- soundFileList.add(locFiles[i].getName());
- }
-
- if (currentFile != null) {
- soundFileList.select(soundFileList.indexOf(currentFile
- .getName()));
- }
- }
-
- /**
- * Get the selected sound file.
- *
- * @return The sound file.
- */
- public File getSelectedFile() {
- return newFile;
- }
-
- public void setFileExtension(String fileExtension) {
- this.fileExtension = fileExtension;
- }
-
- public void setFile(String file) {
- if (file != null) {
- this.currentFile = new File(file);
- }
- }
-
- public void setFilesLocationPath(String path) {
- this.path = path;
- }
-}
\ No newline at end of file
diff --git a/cave/com.raytheon.uf.viz.alertviz/src/com/raytheon/uf/viz/alertviz/ConfigurationManager.java b/cave/com.raytheon.uf.viz.alertviz/src/com/raytheon/uf/viz/alertviz/ConfigurationManager.java
index c342b796a5..d8bae169e6 100644
--- a/cave/com.raytheon.uf.viz.alertviz/src/com/raytheon/uf/viz/alertviz/ConfigurationManager.java
+++ b/cave/com.raytheon.uf.viz.alertviz/src/com/raytheon/uf/viz/alertviz/ConfigurationManager.java
@@ -19,11 +19,8 @@
**/
package com.raytheon.uf.viz.alertviz;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.FileWriter;
import java.io.IOException;
+import java.io.InputStream;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -34,13 +31,15 @@ import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
+import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
-import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException;
+import com.raytheon.uf.common.localization.SaveableOutputStream;
+import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
@@ -58,14 +57,18 @@ import com.raytheon.uf.viz.alertviz.config.Source;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
- * Apr 7, 2010 mschenke Initial creation
+ * Apr 07, 2010 mschenke Initial creation
* Mar 16, 2011 6531 rferrel Start up loads host dependent
* configuration file.
- * Aug 28 2012 13528 Xiaochuan Using setNewConfiguration() to
+ * Aug 28, 2012 13528 Xiaochuan Using setNewConfiguration() to
* re-set configuration data and
* run notifyListeners().
- * Apr 07 2015 4346 rferrel Created {@link #retrieveBaseConfiguration()}.
+ * Apr 07, 2015 4346 rferrel Created {@link #retrieveBaseConfiguration}.
* May 20, 2015 4346 rjpeter Updated to also load from common_static.
+ * Nov 12, 2015 4834 njensen Changed LocalizationOpFailedException to LocalizationException
+ * Jan 11, 2016 5242 kbisanz Replaced calls to deprecated ILocalizationFile methods
+ * Feb 12, 2016 4834 bsteffen Fix multiple saves of the customConfiguration.
+ *
*
*
* @author mschenke
@@ -166,7 +169,7 @@ public class ConfigurationManager {
ConfigContext workstationContext = DEFAULT_WORKSTATION_CONFIG;
try {
- LocalizationFile file = getLocalizationFile(workstationContext);
+ ILocalizationFile file = getLocalizationFile(workstationContext);
if (file == null || !file.exists()) {
ConfigContext sourceContext = DEFAULT_SITE_CONFIG;
@@ -262,7 +265,7 @@ public class ConfigurationManager {
/**
* Delete the configuration passed in
*
- * @param name
+ * @param context
*/
public void deleteConfiguration(ConfigContext context) {
if (context.isBaseOrConfiguredLevel() || isDefaultConfig(context)) {
@@ -272,7 +275,7 @@ public class ConfigurationManager {
if (current.equals(context)) {
loadAsCurrent(DEFAULT_WORKSTATION_CONFIG);
}
- LocalizationFile file = getLocalizationFile(context);
+ ILocalizationFile file = getLocalizationFile(context);
try {
file.delete();
} catch (Exception e) {
@@ -317,10 +320,10 @@ public class ConfigurationManager {
private void loadFromLocalizationType(LocalizationType type) {
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext[] contexts = pm.getLocalSearchHierarchy(type);
- LocalizationFile[] files = pm.listFiles(contexts, CONFIG_DIR,
+ ILocalizationFile[] files = pm.listFiles(contexts, CONFIG_DIR,
EXTENSIONS, true, true); // Win32
- for (LocalizationFile file : files) {
+ for (ILocalizationFile file : files) {
LocalizationContext fileContext = file.getContext();
/*
@@ -329,8 +332,8 @@ public class ConfigurationManager {
*/
if ((fileContext.getLocalizationLevel() != LocalizationLevel.BASE)
|| ((fileContext.getLocalizationLevel() == LocalizationLevel.BASE) && DEFAULT_BASE_CONFIG
- .getLocalizationFileName().equals(file.getName()))) {
- String fileName = file.getName();
+ .getLocalizationFileName().equals(file.getPath()))) {
+ String fileName = file.getPath();
LocalizationContext locContext = file.getContext();
String name = fileName.substring(
fileName.lastIndexOf(IPathManager.SEPARATOR) + 1, // win32
@@ -362,7 +365,7 @@ public class ConfigurationManager {
}
public Configuration retrieveConfiguration(ConfigContext configContext) {
- LocalizationFile file = getLocalizationFile(configContext);
+ ILocalizationFile file = getLocalizationFile(configContext);
if (DEFAULT_BASE_CONFIG.equals(configContext)) {
if (baseConfiguration == null) {
baseConfiguration = retrieveBaseConfiguration();
@@ -379,7 +382,7 @@ public class ConfigurationManager {
* @return configuration
*/
private Configuration retrieveBaseConfiguration() {
- LocalizationFile file = getLocalizationFile(DEFAULT_BASE_CONFIG);
+ ILocalizationFile file = getLocalizationFile(DEFAULT_BASE_CONFIG);
Configuration configuration = retrieveConfiguration(file);
configuration = mergeBaseConfigurations(LocalizationType.CAVE_STATIC,
configuration);
@@ -393,12 +396,12 @@ public class ConfigurationManager {
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext context = pm.getContext(type,
LocalizationLevel.BASE);
- LocalizationFile[] files = pm.listFiles(context, CONFIG_DIR,
+ ILocalizationFile[] files = pm.listFiles(context, CONFIG_DIR,
EXTENSIONS, false, true);
- for (LocalizationFile f : files) {
+ for (ILocalizationFile f : files) {
// Merge other base files with the default.
if (!DEFAULT_BASE_CONFIG.getLocalizationFileName().equals(
- f.getName())) {
+ f.getPath())) {
Configuration fileConfig = retrieveConfiguration(f);
Configuration mergeConfig = configuration.mergeUnder(
fileConfig, true);
@@ -409,14 +412,11 @@ public class ConfigurationManager {
return configuration;
}
- public Configuration retrieveConfiguration(LocalizationFile file) {
+ public Configuration retrieveConfiguration(ILocalizationFile file) {
Configuration config = null;
- if (file != null) {
+ if (file != null && file.exists()) {
try {
- File actualFile = file.getFile();
- if (actualFile != null && actualFile.exists()) {
- config = (Configuration) deserializeFromFile(actualFile);
- }
+ config = (Configuration) deserializeFromFile(file);
} catch (SerializationException e) {
statusHandler.handle(Priority.CRITICAL,
"Error deserializing configuration xml", e);
@@ -427,18 +427,12 @@ public class ConfigurationManager {
private boolean saveToFile(ConfigContext cContext, Configuration config) {
boolean success = true;
- LocalizationFile file = getLocalizationFile(cContext);
+ ILocalizationFile file = getLocalizationFile(cContext);
try {
// do not attempt to save to base
if (file != null
&& file.getContext().getLocalizationLevel() != LocalizationLevel.BASE) {
- serializeToFile(config, file.getFile());
- if (!file.save()) {
- // failed to save delete the local copy and switch to the
- // default config.
- file.delete();
- success = false;
- }
+ serializeToFile(config, file);
}
} catch (SerializationException e) {
statusHandler.handle(Priority.CRITICAL,
@@ -468,62 +462,27 @@ public class ConfigurationManager {
}
}
- private void serializeToFile(Object obj, File file)
+ private void serializeToFile(Object obj, ILocalizationFile file)
throws SerializationException {
- FileWriter writer = null;
- Marshaller msh = marshaller;
- try {
- File dir = file.getParentFile();
- if (dir.isDirectory() == false) {
- dir.delete();
- dir.mkdirs();
- }
- msh.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, new Boolean(true));
- writer = new FileWriter(file);
- msh.marshal(obj, writer);
+ try (SaveableOutputStream os = file.openOutputStream()) {
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
+ new Boolean(true));
+ marshaller.marshal(obj, os);
+ os.save();
} catch (Exception e) {
throw new SerializationException(e);
- } finally {
- if (writer != null) {
- try {
- writer.close();
- } catch (IOException e) {
- // Log to internal Log4j log
- Container
- .logInternal(
- Priority.ERROR,
- "ConfigurationManager: exception closing file writer.",
- e);
- }
- }
}
}
- private Object deserializeFromFile(File file) throws SerializationException {
- FileReader reader = null;
- Unmarshaller msh = unmarshaller;
- try {
- reader = new FileReader(file);
- Object obj = msh.unmarshal(reader);
- return obj;
- } catch (FileNotFoundException e) {
+ private Object deserializeFromFile(ILocalizationFile file)
+ throws SerializationException {
+ try (InputStream is = file.openInputStream()) {
+ return unmarshaller.unmarshal(is);
+ } catch (LocalizationException | IOException | JAXBException e) {
Container.logInternal(Priority.ERROR,
- "AlertViz ConfigurationManager unable to find file: "
- + file.getAbsolutePath(), e);
+ "ConfigurationManager: Exception unmarshalling from file: "
+ + file.getPath(), e);
throw new SerializationException(e);
- } catch (JAXBException e) {
- Container.logInternal(Priority.ERROR,
- "ConfigurationManager: JAXB exception unmarshalling from file: "
- + file.getAbsolutePath(), e);
- throw new SerializationException(e);
- } finally {
- if (reader != null) {
- try {
- reader.close();
- } catch (IOException e) {
- // ignore
- }
- }
}
}
@@ -531,15 +490,12 @@ public class ConfigurationManager {
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext ctx = pm.getContext(LocalizationType.CAVE_STATIC,
LocalizationLevel.SITE);
- LocalizationFile file = pm.getLocalizationFile(ctx,
+ ILocalizationFile file = pm.getLocalizationFile(ctx,
ConfigContext.ALERTVIZ_DIR + IPathManager.SEPARATOR
+ "AlertVizForced.xml");
- File actualFile = file.getFile();
- // Win32: JHB put in check for length
- if (actualFile != null && actualFile.exists()
- && actualFile.length() > 0) {
- try {
- return (ForcedConfiguration) unmarshaller.unmarshal(actualFile);
+ if (file != null && file.exists()) {
+ try (InputStream is = file.openInputStream()) {
+ return (ForcedConfiguration) unmarshaller.unmarshal(is);
} catch (Exception e) {
statusHandler.handle(Priority.SIGNIFICANT,
"Error deserializing forced configuration", e);
@@ -569,10 +525,9 @@ public class ConfigurationManager {
}
private void updateCustom(boolean isRemove, Object obj) {
- LocalizationFile locFile = getCustomLocalization();
- File customFile = locFile.getFile();
+ ILocalizationFile locFile = getCustomLocalization();
try {
- customConfiguration = (Configuration) deserializeFromFile(customFile);
+ customConfiguration = (Configuration) deserializeFromFile(locFile);
if (obj instanceof Category) {
Map categories = customConfiguration
.getCategories();
@@ -594,12 +549,11 @@ public class ConfigurationManager {
}
customConfiguration.setSources(sources);
}
- serializeToFile(customConfiguration, customFile);
- locFile.save();
+ serializeToFile(customConfiguration, locFile);
+ /* Must reload fresh copy next time it is used. */
+ customLocalization = null;
} catch (SerializationException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
- } catch (LocalizationOpFailedException e) {
- statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
}
}
diff --git a/cave/com.raytheon.uf.viz.alertviz/src/com/raytheon/uf/viz/alertviz/Container.java b/cave/com.raytheon.uf.viz.alertviz/src/com/raytheon/uf/viz/alertviz/Container.java
index 1055429a89..8e39311a64 100755
--- a/cave/com.raytheon.uf.viz.alertviz/src/com/raytheon/uf/viz/alertviz/Container.java
+++ b/cave/com.raytheon.uf.viz.alertviz/src/com/raytheon/uf/viz/alertviz/Container.java
@@ -28,7 +28,6 @@ import org.apache.log4j.Logger;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.message.StatusMessage;
@@ -58,6 +57,7 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
* Jun 03, 2013 2026 randerso Fixed typo
* Jul 27, 2015 4654 skorolev Added a localization level filtration
* Sep 21, 2015 4654 njensen Made filter logic strict instead of eager
+ * Jan 14, 2016 5054 randerso Remove dummy shell
*
*
*
@@ -315,7 +315,7 @@ public class Container implements IConfigurationChangedListener {
}
// Status status = null;
- ErrorDialog.openError(new Shell(),
+ ErrorDialog.openError(null,
"Error saving to internal database",
"Serious internal error occurred", new Status(
IStatus.ERROR, Activator.PLUGIN_ID,
diff --git a/cave/com.raytheon.uf.viz.alertviz/src/com/raytheon/uf/viz/alertviz/SystemStatusHandler.java b/cave/com.raytheon.uf.viz.alertviz/src/com/raytheon/uf/viz/alertviz/SystemStatusHandler.java
index 3dc084ca28..e6855f447e 100644
--- a/cave/com.raytheon.uf.viz.alertviz/src/com/raytheon/uf/viz/alertviz/SystemStatusHandler.java
+++ b/cave/com.raytheon.uf.viz.alertviz/src/com/raytheon/uf/viz/alertviz/SystemStatusHandler.java
@@ -43,6 +43,7 @@ import com.raytheon.uf.viz.alertviz.internal.LogMessageDAO;
* Aug 26, 2013 2142 njensen Changed to use SLF4J
* Jul 02, 2014 3337 njensen Disabled logback packaging data
* May 22, 2015 4473 njensen Refactored
+ * Feb 11, 2016 5314 dgilling Add retrieveByRowOffset.
*
*
* @author chammack
@@ -122,16 +123,30 @@ public class SystemStatusHandler extends AbstractStatusHandler {
}
/**
- * Get the current range of persisted StatusMessages
+ * Retrieve a status message by row offset
*
+ * @param index
+ * The row offset, 0-based index.
+ * @return the status message
+ * @throws AlertvizException
+ * If an error occurred querying the database for the status
+ * message
+ */
+ public static StatusMessage retrieveByRowOffset(int index)
+ throws AlertvizException {
+ return LogMessageDAO.getInstance().loadByRowOffset(index);
+ }
+
+ /**
+ * Get the current number of persisted StatusMessages.
+ *
* NOTE: This only works when called from inside the alertviz container
*
- *
- * @return the range [min, max] of values
+ * @return
* @throws AlertvizException
*/
- public static int[] getCurrentRange() throws AlertvizException {
- return LogMessageDAO.getInstance().getLogRange();
+ public static int getMessageCount() throws AlertvizException {
+ return LogMessageDAO.getInstance().getMessageCount();
}
/**
@@ -148,5 +163,4 @@ public class SystemStatusHandler extends AbstractStatusHandler {
int count) throws AlertvizException {
return LogMessageDAO.getInstance().load(count, category);
}
-
}
diff --git a/cave/com.raytheon.uf.viz.alertviz/src/com/raytheon/uf/viz/alertviz/config/Configuration.java b/cave/com.raytheon.uf.viz.alertviz/src/com/raytheon/uf/viz/alertviz/config/Configuration.java
index 731121cff1..16eeadc243 100644
--- a/cave/com.raytheon.uf.viz.alertviz/src/com/raytheon/uf/viz/alertviz/config/Configuration.java
+++ b/cave/com.raytheon.uf.viz.alertviz/src/com/raytheon/uf/viz/alertviz/config/Configuration.java
@@ -31,7 +31,6 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
-import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.viz.alertviz.config.TrayConfiguration.TrayMode;
/**
@@ -49,6 +48,7 @@ import com.raytheon.uf.viz.alertviz.config.TrayConfiguration.TrayMode;
* May 3, 2011 9067 cjeanbap Add isMonitorLayoutChanged() method.
* Apr 27 2012 13744 Xiaochuan Update isMonitorLayoutChanged() to compare
* source size in Previous and current.
+ * Oct 28, 2005 5054 randerso removed bar position as it was written but never read
*
*
*
@@ -57,7 +57,7 @@ import com.raytheon.uf.viz.alertviz.config.TrayConfiguration.TrayMode;
*/
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement(name = "alertConfiguration")
-public class Configuration implements ISerializableObject {
+public class Configuration {
@XmlAttribute
private String name;
@@ -127,7 +127,7 @@ public class Configuration implements ISerializableObject {
* Look up a source
*
* @param componentName
- * @return
+ * @return the source
*/
public Source lookupSource(String componentName) {
return this.sourceMap.get(componentName);
@@ -137,7 +137,7 @@ public class Configuration implements ISerializableObject {
* Look up a category
*
* @param componentName
- * @return
+ * @return the category
*/
public Category lookupCategory(String componentName) {
return this.categoryMap.get(componentName);
@@ -148,7 +148,7 @@ public class Configuration implements ISerializableObject {
*
* This is usually used by serialization, not end users.
*
- * @param collection
+ * @param sources
*/
@XmlElement(name = "source")
public void setSourceCollection(Source[] sources) {
@@ -163,7 +163,7 @@ public class Configuration implements ISerializableObject {
*
* This is usually used by serialization, not end users.
*
- * @return
+ * @return the source collection
*/
public Source[] getSourceCollection() {
return sourceMap.values().toArray(new Source[sourceMap.size()]);
@@ -174,7 +174,7 @@ public class Configuration implements ISerializableObject {
*
* This is usually used by serialization, not end users.
*
- * @param collection
+ * @param categories
*/
@XmlElement(name = "category")
public void setCategoryCollection(Category[] categories) {
@@ -189,20 +189,27 @@ public class Configuration implements ISerializableObject {
*
* This is usually used by serialization, not end users.
*
- * @return
+ * @return the category collection
*/
public Category[] getCategoryCollection() {
return categoryMap.values().toArray(new Category[categoryMap.size()]);
}
+ /**
+ * @return the name
+ */
public String getName() {
return name;
}
+ /**
+ * @param name
+ */
public void setName(String name) {
this.name = name;
}
+ @Override
public Configuration clone() {
Configuration newConfig = new Configuration();
newConfig.name = name;
@@ -225,6 +232,7 @@ public class Configuration implements ISerializableObject {
return newConfig;
}
+ @Override
public String toString() {
String rval = getName() + ":\n";
rval += "\tTrayConfig:\n";
@@ -232,8 +240,7 @@ public class Configuration implements ISerializableObject {
+ globalConfiguration.getAudioDuration() + " blinkDuration="
+ globalConfiguration.getBlinkDuration() + " logLength="
+ globalConfiguration.getLogLength() + "\n";
- rval += "\t\t" + "mode=" + globalConfiguration.getMode() + " position="
- + globalConfiguration.getPosition() + "\n";
+ rval += "\t\t" + "mode=" + globalConfiguration.getMode() + "\n";
rval += "\t\t" + "categoryShown="
+ globalConfiguration.isCategoryShown() + " expandedPopup="
+ globalConfiguration.isExpandedPopup() + " priorityShown="
@@ -404,78 +411,80 @@ public class Configuration implements ISerializableObject {
}
return result;
}
-
+
/**
- * Determine if a Monitor was added/omitted (enable/disabled) and/or if the Layout of the
- * Alert Message Dialog was changed.
+ * Determine if a Monitor was added/omitted (enable/disabled) and/or if the
+ * Layout of the Alert Message Dialog was changed.
*
- * @param configData the current save Configuration Data.
- * @return boolean, true if either Monitor and/or Layout was changed otherwise false.
+ * @param configData
+ * the current save Configuration Data.
+ * @return boolean, true if either Monitor and/or Layout was changed
+ * otherwise false.
*/
- public boolean isMonitorLayoutChanged(Configuration configData) {
- boolean modified = false;
+ public boolean isMonitorLayoutChanged(Configuration configData) {
+ boolean modified = false;
- TrayMode prevLayoutMode = configData.getGlobalConfiguration().getMode();
- if (!prevLayoutMode.equals(this.getGlobalConfiguration().getMode())) {
- modified = true;
- }
+ TrayMode prevLayoutMode = configData.getGlobalConfiguration().getMode();
+ if (!prevLayoutMode.equals(this.getGlobalConfiguration().getMode())) {
+ modified = true;
+ }
- Map prevCategoryMap = configData.getCategories();
- for (Iterator categories = this.getCategories().keySet()
- .iterator(); categories.hasNext() && !modified;) {
- String categoryName = categories.next();
- Category prevCategory = prevCategoryMap.get(categoryName);
- Category newCategory = this.getCategories().get(categoryName);
- if (prevCategory != null && newCategory == null) {
- modified = true;
- } else if (prevCategory == null && newCategory != null) {
- modified = true;
- } else if (prevCategory != null && newCategory != null) {
- if (prevCategory.getTextBox() != newCategory.getTextBox()) {
- modified = true;
- }
- }
- }
+ Map prevCategoryMap = configData.getCategories();
+ for (Iterator categories = this.getCategories().keySet()
+ .iterator(); categories.hasNext() && !modified;) {
+ String categoryName = categories.next();
+ Category prevCategory = prevCategoryMap.get(categoryName);
+ Category newCategory = this.getCategories().get(categoryName);
+ if (prevCategory != null && newCategory == null) {
+ modified = true;
+ } else if (prevCategory == null && newCategory != null) {
+ modified = true;
+ } else if (prevCategory != null && newCategory != null) {
+ if (prevCategory.getTextBox() != newCategory.getTextBox()) {
+ modified = true;
+ }
+ }
+ }
- Map prevSources = configData.getSources();
+ Map prevSources = configData.getSources();
- if (prevSources.size() != this.getSources().size()) {
- modified = true;
- } else {
- for (Iterator sources = this.getSources().keySet()
- .iterator(); sources.hasNext() && !modified;) {
- String sourceName = sources.next();
- Source prevSource = prevSources.get(sourceName);
- Source newSource = this.getSources().get(sourceName);
- if (prevSource == null) {
- modified = true;
- } else if (prevSource != null && newSource != null) {
- MonitorMetadata newMonitorMetadata = newSource
- .getConfigurationMonitor().getMonitorMetadata();
- MonitorMetadata prevMonitorMetadata = prevSource
- .getConfigurationMonitor().getMonitorMetadata();
+ if (prevSources.size() != this.getSources().size()) {
+ modified = true;
+ } else {
+ for (Iterator sources = this.getSources().keySet()
+ .iterator(); sources.hasNext() && !modified;) {
+ String sourceName = sources.next();
+ Source prevSource = prevSources.get(sourceName);
+ Source newSource = this.getSources().get(sourceName);
+ if (prevSource == null) {
+ modified = true;
+ } else if (prevSource != null && newSource != null) {
+ MonitorMetadata newMonitorMetadata = newSource
+ .getConfigurationMonitor().getMonitorMetadata();
+ MonitorMetadata prevMonitorMetadata = prevSource
+ .getConfigurationMonitor().getMonitorMetadata();
- if (newMonitorMetadata != null
- && prevMonitorMetadata == null) {
- modified = true;
- } else if ((newMonitorMetadata.getOmit())
- && (prevMonitorMetadata.getOmit() == false)) {
- modified = true;
- }
- if ((newMonitorMetadata.getOmit() == false)
- && (prevMonitorMetadata.getOmit() == true)) {
- modified = true;
- } else if (newMonitorMetadata.getImageFile() != null
- && prevMonitorMetadata.getImageFile() == null) {
- modified = true;
- } else if (newMonitorMetadata.getImageFile() == null
- && prevMonitorMetadata.getImageFile() != null) {
- modified = true;
- }
- }
- }
- }
+ if (newMonitorMetadata != null
+ && prevMonitorMetadata == null) {
+ modified = true;
+ } else if ((newMonitorMetadata.getOmit())
+ && (prevMonitorMetadata.getOmit() == false)) {
+ modified = true;
+ }
+ if ((newMonitorMetadata.getOmit() == false)
+ && (prevMonitorMetadata.getOmit() == true)) {
+ modified = true;
+ } else if (newMonitorMetadata.getImageFile() != null
+ && prevMonitorMetadata.getImageFile() == null) {
+ modified = true;
+ } else if (newMonitorMetadata.getImageFile() == null
+ && prevMonitorMetadata.getImageFile() != null) {
+ modified = true;
+ }
+ }
+ }
+ }
- return modified;
- }
+ return modified;
+ }
}
diff --git a/cave/com.raytheon.uf.viz.alertviz/src/com/raytheon/uf/viz/alertviz/config/TrayConfiguration.java b/cave/com.raytheon.uf.viz.alertviz/src/com/raytheon/uf/viz/alertviz/config/TrayConfiguration.java
index e5a2ecc622..4244fc7dc1 100644
--- a/cave/com.raytheon.uf.viz.alertviz/src/com/raytheon/uf/viz/alertviz/config/TrayConfiguration.java
+++ b/cave/com.raytheon.uf.viz.alertviz/src/com/raytheon/uf/viz/alertviz/config/TrayConfiguration.java
@@ -23,10 +23,6 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
-import org.eclipse.swt.graphics.Rectangle;
-
-import com.raytheon.uf.common.serialization.ISerializableObject;
-
/**
* Global configuration items for alertviz
*
@@ -35,13 +31,14 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 18, 2008 1433 chammack Initial creation
+ * Oct 28, 2005 5054 randerso removed bar position as it was written but never read
*
*
* @author chammack
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
-public class TrayConfiguration implements ISerializableObject {
+public class TrayConfiguration {
/**
* The mode of the display:
@@ -109,21 +106,6 @@ public class TrayConfiguration implements ISerializableObject {
@XmlAttribute
private int logLength;
- /**
- * The position of the bar
- */
- @XmlAttribute
- private int xPosition;
-
- @XmlAttribute
- private int yPosition;
-
- @XmlAttribute
- private int width;
-
- @XmlAttribute
- private int height;
-
/**
* @return the mode
*/
@@ -154,28 +136,6 @@ public class TrayConfiguration implements ISerializableObject {
this.priorityShown = priorityShown;
}
- /**
- * @return the position
- */
- public Rectangle getPosition() {
- Rectangle position = null;
- if (xPosition >= 0 && yPosition >= 0 && width >= 1 && height >= 1) {
- position = new Rectangle(xPosition, yPosition, width, height);
- }
- return position;
- }
-
- /**
- * @param position
- * the position to set
- */
- public void setPosition(Rectangle position) {
- this.xPosition = position.x;
- this.yPosition = position.y;
- this.width = position.width;
- this.height = position.height;
- }
-
/**
* @return the sourceKeyShown
*/
@@ -259,59 +219,24 @@ public class TrayConfiguration implements ISerializableObject {
}
/**
- * @param messageLogLength
+ * @param logLength
* the messageLogLength to set
*/
public void setLogLength(int logLength) {
this.logLength = logLength;
}
- public int getXPosition() {
- return xPosition;
- }
-
- public void setXPosition(int position) {
- xPosition = position;
- }
-
- public int getYPosition() {
- return yPosition;
- }
-
- public void setYPosition(int position) {
- yPosition = position;
- }
-
- public int getWidth() {
- return width;
- }
-
- public void setWidth(int width) {
- this.width = width;
- }
-
- public int getHeight() {
- return height;
- }
-
- public void setHeight(int height) {
- this.height = height;
- }
-
+ @Override
public TrayConfiguration clone() {
TrayConfiguration newConfig = new TrayConfiguration();
newConfig.audioDuration = audioDuration;
newConfig.blinkDuration = blinkDuration;
newConfig.categoryShown = categoryShown;
newConfig.expandedPopup = expandedPopup;
- newConfig.height = height;
newConfig.logLength = logLength;
newConfig.mode = mode;
newConfig.priorityShown = priorityShown;
newConfig.sourceKeyShown = sourceKeyShown;
- newConfig.width = width;
- newConfig.xPosition = xPosition;
- newConfig.yPosition = yPosition;
return newConfig;
}
diff --git a/cave/com.raytheon.uf.viz.alertviz/src/com/raytheon/uf/viz/alertviz/internal/LogMessageDAO.java b/cave/com.raytheon.uf.viz.alertviz/src/com/raytheon/uf/viz/alertviz/internal/LogMessageDAO.java
index e6edd3f40e..d6e08aa5fb 100644
--- a/cave/com.raytheon.uf.viz.alertviz/src/com/raytheon/uf/viz/alertviz/internal/LogMessageDAO.java
+++ b/cave/com.raytheon.uf.viz.alertviz/src/com/raytheon/uf/viz/alertviz/internal/LogMessageDAO.java
@@ -50,6 +50,7 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 11, 2008 1433 chammack Initial creation
+ * Feb 11, 2016 5314 dgilling Add loadByRowOffset.
*
*
* @author chammack
@@ -64,11 +65,13 @@ public class LogMessageDAO {
private static final String SELECT_ALL_QUERY_BY_PK = "SELECT event_time, category, priority, message, details, source, pk, acknowledgedBy, acknowledgedAt FROM log WHERE pk = ?";
+ private static final String SELECT_ALL_QUERY_BY_ROW_OFFSET = "SELECT event_time, category, priority, message, details, source, pk, acknowledgedBy, acknowledgedAt FROM log ORDER BY pk OFFSET ? ROWS FETCH NEXT ROW ONLY";
+
private static final String PURGE_TIME_QUERY = "SELECT purge_time FROM dbMetadata";
private static final String PURGE_TIME_UPDATE = "UPDATE dbMetadata SET purge_time = ?";
- private static final String DATA_RANGE_QUERY = "SELECT MIN(pk), MAX(pk) FROM log";
+ private static final String MESSAGE_COUNT_QUERY = "SELECT COUNT(pk) FROM log";
private static final String SELECT_ALL_BY_DATE_AND_SOURCE_AFTER = "SELECT event_time, category, priority, message, details, source, pk, acknowledgedBy, acknowledgedAt FROM log WHERE event_time > ?";
@@ -353,6 +356,45 @@ public class LogMessageDAO {
}
}
+ /**
+ * Retrieves the specified status message from the message store using the
+ * specified index as a row offset.
+ *
+ * @param index
+ * The index of the message to retrieve
+ * @return The status message
+ * @throws AlertvizException
+ * If an error occurred retrieving the message from the message
+ * store.
+ */
+ public StatusMessage loadByRowOffset(int index) throws AlertvizException {
+ ResultSet rs = null;
+ PreparedStatement statement = null;
+ boolean errorOccurred = false;
+ try {
+ Connection conn = getConnection();
+ statement = conn.prepareStatement(SELECT_ALL_QUERY_BY_ROW_OFFSET);
+ statement.setInt(1, index);
+
+ rs = statement.executeQuery();
+
+ conn.commit();
+ return reconstituteResults(rs)[0];
+ } catch (SQLException e) {
+ errorOccurred = true;
+ throw new AlertvizException("Error loading " + index, e);
+ } catch (RuntimeException e) {
+ errorOccurred = true;
+ throw new AlertvizException("Error loading " + index, e);
+ } finally {
+ closeResultSet(rs);
+ closeStatement(statement);
+ if (errorOccurred) {
+ closeConnection();
+ }
+ }
+ }
+
public StatusMessage[] load(int count) throws AlertvizException {
ResultSet rs = null;
Statement statement = null;
@@ -383,15 +425,16 @@ public class LogMessageDAO {
boolean errorOccurred = false;
try {
Connection conn = getConnection();
- if (order == Order.BEFORE)
+ if (order == Order.BEFORE) {
statement = conn
.prepareStatement(SELECT_ALL_BY_DATE_AND_SOURCE_BEFORE);
- else if (order == Order.AFTER)
+ } else if (order == Order.AFTER) {
statement = conn
.prepareStatement(SELECT_ALL_BY_DATE_AND_SOURCE_AFTER);
- else
+ } else {
throw new IllegalArgumentException("Unsupported order : "
+ order);
+ }
statement.setMaxFieldSize(count);
statement.setTimestamp(1, filter);
@@ -477,7 +520,12 @@ public class LogMessageDAO {
}
}
- public int[] getLogRange() throws AlertvizException {
+ /**
+ * Retrieves the number of status messages in the message store.
+ *
+ * @return Total number of messages.
+ */
+ public int getMessageCount() throws AlertvizException {
ResultSet rs = null;
Statement statement = null;
boolean errorOccurred = false;
@@ -485,15 +533,12 @@ public class LogMessageDAO {
Connection conn = getConnection();
statement = conn.createStatement();
statement.setMaxFieldSize(1);
- rs = statement.executeQuery(DATA_RANGE_QUERY);
+ rs = statement.executeQuery(MESSAGE_COUNT_QUERY);
if (rs.next()) {
- int min = rs.getInt(1);
- int max = rs.getInt(2);
-
- return new int[] { min, max };
+ int count = rs.getInt(1);
+ return count;
}
conn.commit();
- return null;
} catch (SQLException e) {
errorOccurred = true;
throw new AlertvizException("Error getting time range ", e);
@@ -504,6 +549,8 @@ public class LogMessageDAO {
closeConnection();
}
}
+
+ return 0;
}
public Timestamp getLastPurgeTime() throws AlertvizException {
@@ -547,8 +594,9 @@ public class LogMessageDAO {
sm.setAcknowledgedBy(rs.getString(8));
Timestamp ts = rs.getTimestamp(9);
- if (ts != null)
+ if (ts != null) {
sm.setAcknowledgedAt(new Date(ts.getTime()));
+ }
retVal.add(sm);
}
diff --git a/cave/com.raytheon.uf.viz.archive.feature/feature.xml b/cave/com.raytheon.uf.viz.archive.feature/feature.xml
index 19dc9c07a9..0632b8c694 100644
--- a/cave/com.raytheon.uf.viz.archive.feature/feature.xml
+++ b/cave/com.raytheon.uf.viz.archive.feature/feature.xml
@@ -40,6 +40,6 @@
id="org.apache.commons.compress"
download-size="0"
install-size="0"
- version="1.5.0"/>
+ version="1.10.0"/>
diff --git a/cave/com.raytheon.uf.viz.archive/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.archive/META-INF/MANIFEST.MF
index be6e378e31..b97e565602 100644
--- a/cave/com.raytheon.uf.viz.archive/META-INF/MANIFEST.MF
+++ b/cave/com.raytheon.uf.viz.archive/META-INF/MANIFEST.MF
@@ -2,11 +2,11 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Archive
Bundle-SymbolicName: com.raytheon.uf.viz.archive;singleton:=true
-Bundle-Version: 1.14.0.qualifier
+Bundle-Version: 1.15.0.qualifier
Bundle-Vendor: RAYTHEON
Require-Bundle: org.eclipse.ui;bundle-version="3.8.2",
org.eclipse.core.runtime,
- org.apache.commons.lang;bundle-version="2.3.0",
+ org.apache.commons.lang3;bundle-version="3.4.0",
org.apache.commons.io;bundle-version="2.4.0",
com.raytheon.viz.ui;bundle-version="1.12.1174",
com.raytheon.uf.common.serialization;bundle-version="1.12.1174",
diff --git a/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/AbstractArchiveDlg.java b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/AbstractArchiveDlg.java
index 1b2c576996..a763217581 100644
--- a/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/AbstractArchiveDlg.java
+++ b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/AbstractArchiveDlg.java
@@ -49,7 +49,7 @@ import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
import com.raytheon.uf.common.archive.config.ArchiveConstants;
import com.raytheon.uf.common.archive.config.CategoryConfig;
import com.raytheon.uf.common.archive.config.DisplayData;
-import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException;
+import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.util.SizeUtil;
import com.raytheon.uf.viz.archive.data.ArchiveInfo;
import com.raytheon.uf.viz.archive.data.CategoryInfo;
@@ -83,6 +83,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Apr 10, 2014 3023 rferrel Added setTotalSelectedSize method.
* Apr 23, 2014 3045 rferrel Changes to prevent race condition while getting labels.
* Aug 26, 2014 3553 rferrel Force redisplay of table after getting all display labels.
+ * Nov 12, 2015 4834 njensen Changed LocalizationOpFailedException to LocalizationException
*
*
*
@@ -473,7 +474,7 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
String fileName = ArchiveConstants.selectFileName(type, selectName);
try {
manager.deleteSelection(fileName);
- } catch (LocalizationOpFailedException e) {
+ } catch (LocalizationException e) {
MessageDialog.openError(shell, "Case Error",
"Unable to delete file: " + fileName);
}
@@ -819,6 +820,7 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
*
* @param startTimeOffset
*/
+ @Override
public void setRetentionTimes(long startTimeOffset) {
// do nothing override by sub-classes
}
@@ -858,6 +860,7 @@ public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
/**
* Perform updates once all the display data is loaded.
*/
+ @Override
public void loadedAllDisplayData() {
VizApp.runAsync(new Runnable() {
diff --git a/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/ArchiveTableComp.java b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/ArchiveTableComp.java
index 921cbcccd8..d67f4884a1 100644
--- a/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/ArchiveTableComp.java
+++ b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/ArchiveTableComp.java
@@ -24,7 +24,7 @@ import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
-import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang3.ArrayUtils;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
diff --git a/cave/com.raytheon.uf.viz.aviation.advisory/src/com/raytheon/uf/viz/aviation/advisory/rsc/AdvisoryResource.java b/cave/com.raytheon.uf.viz.aviation.advisory/src/com/raytheon/uf/viz/aviation/advisory/rsc/AdvisoryResource.java
index f80012899a..09d298e52f 100644
--- a/cave/com.raytheon.uf.viz.aviation.advisory/src/com/raytheon/uf/viz/aviation/advisory/rsc/AdvisoryResource.java
+++ b/cave/com.raytheon.uf.viz.aviation.advisory/src/com/raytheon/uf/viz/aviation/advisory/rsc/AdvisoryResource.java
@@ -80,6 +80,7 @@ import com.vividsolutions.jts.geom.Polygon;
* Aug 14, 2014 3523 mapeters Updated deprecated {@link DrawableString#textStyle}
* assignments.
* Jul 7, 2015 10352 byin Added SymbolLoader to plot symbols
+ * Nov 05, 2015 5070 randerso Adjust font sizes for dpi scaling
*
*
* @author bsteffen
@@ -194,7 +195,7 @@ public class AdvisoryResource extends
if (font != null) {
font.dispose();
}
- this.font = target.initializeFont("Monospace", 10, new Style[] {});
+ this.font = target.initializeFont("Monospace", 8, new Style[] {});
this.symbolLoader = new SymbolLoader();
}
diff --git a/cave/com.raytheon.uf.viz.bufrsigwx/src/com/raytheon/uf/viz/bufrsigwx/rsc/SigWxResource.java b/cave/com.raytheon.uf.viz.bufrsigwx/src/com/raytheon/uf/viz/bufrsigwx/rsc/SigWxResource.java
index 489cfbe8e9..ffe3aac79f 100644
--- a/cave/com.raytheon.uf.viz.bufrsigwx/src/com/raytheon/uf/viz/bufrsigwx/rsc/SigWxResource.java
+++ b/cave/com.raytheon.uf.viz.bufrsigwx/src/com/raytheon/uf/viz/bufrsigwx/rsc/SigWxResource.java
@@ -29,8 +29,6 @@ import org.eclipse.swt.graphics.Rectangle;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.bufrsigwx.SigWxData;
-import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
-import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.pointdata.PointDataView;
@@ -56,6 +54,8 @@ import com.raytheon.viz.pointdata.PointDataRequest;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 28, 2009 3099 bsteffen Initial creation
+ * Nov 05, 2015 5070 randerso Adjust font sizes for dpi scaling
+ * Feb 04, 2015 5309 tgurney Remove dependency on dataURI
*
*
*
@@ -155,7 +155,7 @@ public abstract class SigWxResource extends
if (font != null) {
font.dispose();
}
- this.font = target.initializeFont("Monospace", 10,
+ this.font = target.initializeFont("Monospace", 8,
new Style[] { Style.BOLD });
}
@@ -167,21 +167,11 @@ public abstract class SigWxResource extends
* @throws VizException
*/
protected void updateRecords(DataTime dataTime) throws VizException {
-
- RequestConstraint constraint = new RequestConstraint();
-
- constraint.setConstraintType(ConstraintType.IN);
-
- for (SigWxData record : recordsToParse.get(dataTime)) {
- constraint.addToConstraintValueList(record.getDataURI());
- }
- Map constraints = new HashMap();
- constraints.put("dataURI", constraint);
// Request the point data
PointDataContainer pdc = PointDataRequest.requestPointDataAllLevels(
dataTime, resourceData.getMetadataMap().get("pluginName")
.getConstraintValue(), getParameters(), null,
- constraints);
+ resourceData.getMetadataMap());
if (recordsToDisplay.containsKey(dataTime)) {
recordsToDisplay.get(dataTime).combine(pdc);
} else {
diff --git a/cave/com.raytheon.uf.viz.common.core.feature/feature.xml b/cave/com.raytheon.uf.viz.common.core.feature/feature.xml
index 820badf50c..45ca8825bd 100644
--- a/cave/com.raytheon.uf.viz.common.core.feature/feature.xml
+++ b/cave/com.raytheon.uf.viz.common.core.feature/feature.xml
@@ -100,6 +100,13 @@
version="0.0.0"
unpack="false"/>
+
+
+
+
+
+
+
+
diff --git a/cave/com.raytheon.uf.viz.cwa/src/com/raytheon/uf/viz/cwa/rsc/CWAResource.java b/cave/com.raytheon.uf.viz.cwa/src/com/raytheon/uf/viz/cwa/rsc/CWAResource.java
index 5060b0b48a..a805bc9889 100644
--- a/cave/com.raytheon.uf.viz.cwa/src/com/raytheon/uf/viz/cwa/rsc/CWAResource.java
+++ b/cave/com.raytheon.uf.viz.cwa/src/com/raytheon/uf/viz/cwa/rsc/CWAResource.java
@@ -70,9 +70,9 @@ import com.vividsolutions.jts.geom.Polygon;
/**
* Resource for Center Weather Advisory
- *
+ *
*
- *
+ *
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
@@ -81,8 +81,10 @@ import com.vividsolutions.jts.geom.Polygon;
* compabilities.
* May 11, 2015 4379 nabowle Display all current CWAs for each frame.
* Jun 15, 2015 4379 nabowle Make last frame a live frame.
+ * Nov 05, 2015 5070 randerso Adjust font sizes for dpi scaling
+ *
*
- *
+ *
* @author jsanchez
* @version 1.0
*/
@@ -186,11 +188,11 @@ public class CWAResource extends
constraints.put(END, constraint);
// Request the point data
- this.pdc = PointDataRequest
- .requestPointDataAllLevels((DataTime) null,
+ this.pdc = PointDataRequest.requestPointDataAllLevels(
+ (DataTime) null,
resourceData.getMetadataMap().get("pluginName")
- .getConstraintValue(),
- getParameters(), null, constraints);
+ .getConstraintValue(), getParameters(), null,
+ constraints);
if (wfs != null) {
wfs.dispose();
@@ -249,7 +251,7 @@ public class CWAResource extends
/**
* Get the list of PointDataViews. PointDataViews that share an event id
* will be deduplicated to the most recent record for that event id.
- *
+ *
* @return The list of PointDataViews.
* @throws VizException
*/
@@ -332,7 +334,7 @@ public class CWAResource extends
/**
* Cancel the heart beat timer task
- *
+ *
* @param resource
*/
protected static void cancelRefreshTask(CWAResource resource) {
@@ -373,7 +375,7 @@ public class CWAResource extends
* Get the current/simulated time to the minute. Seconds and Milliseconds
* will be zero so a consistent time can be used each minute when retrieving
* from the frame map.
- *
+ *
* @return
*/
public static DataTime now() {
@@ -424,7 +426,7 @@ public class CWAResource extends
@Override
protected void initInternal(IGraphicsTarget target) throws VizException {
- this.font = target.initializeFont("Monospace", 11,
+ this.font = target.initializeFont("Monospace", 9,
new Style[] { Style.ITALIC });
updateLiveFrame(now());
scheduleRefreshTask(this);
@@ -516,7 +518,7 @@ public class CWAResource extends
/**
* Adds a new record to this resource
- *
+ *
* @param obj
*/
protected void addRecord(CWARecord obj) {
diff --git a/cave/com.raytheon.uf.viz.cwat/src/com/raytheon/uf/viz/cwat/CWATResource.java b/cave/com.raytheon.uf.viz.cwat/src/com/raytheon/uf/viz/cwat/CWATResource.java
index b0ed95e937..1b3ddb1d03 100644
--- a/cave/com.raytheon.uf.viz.cwat/src/com/raytheon/uf/viz/cwat/CWATResource.java
+++ b/cave/com.raytheon.uf.viz.cwat/src/com/raytheon/uf/viz/cwat/CWATResource.java
@@ -66,13 +66,13 @@ import com.vividsolutions.jts.geom.Coordinate;
*
*
*
* SOFTWARE HISTORY
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * Feb 09, 2009 njensen Initial creation
- * Mar 21, 2013 1638 mschenke Made map scales not tied to d2d
- * Mar 22, 2013 1638 mschenke Moved map scale code to MapScaleRenderableDisplay
- * Apr 06, 2015 ASM #17215 D. Friedman Implement clear to avoid removing time match basis
- * Sep 03, 2015 4779 njensen Removed DataScale references
+ *
+ * Date Ticket# Engineer Description
+ * ------------- -------- ---------- -------------------------------------------
+ * Feb 09, 2009 1960 njensen Initial creation
+ * Mar 21, 2013 1638 mschenke Made map scales not tied to d2d
+ * Mar 22, 2013 1638 mschenke Moved map scale code to
+ * MapScaleRenderableDisplay
+ * Apr 06, 2015 17215 dfriedman Implement clear to avoid removing time
+ * match basis
+ * Sep 03, 2015 4779 njensen Removed DataScale references
+ * Dec 03, 2015 5147 bsteffen Reset TimeMatcher on clear
*
*
*
* @author njensen
- * @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement
@@ -313,65 +312,21 @@ public class D2DMapRenderableDisplay extends MapScaleRenderableDisplay
}
/**
- * Like MapScaleRenderableDisplayer.clear, but avoids removing the time
- * match basis until other resources are removed. This reduces time matching
- * churn and reduces the chances of lockups.
- *
- * @see com.raytheon.uf.viz.core.maps.scales.MapScaleRenderableDisplay#clear()
+ * Replace the time matcher with a copy before clearing. The existing time
+ * matcher is carefully tracking information for the resources(especially
+ * the time match basis), replacing the timeMatcher saves time updating or
+ * removing the saved information since the resources will all be removed
+ * anyway.
*/
@Override
public void clear() {
- AbstractVizResource, ?> timeMatchBasis = null;
AbstractTimeMatcher timeMatcher = descriptor.getTimeMatcher();
if (timeMatcher instanceof D2DTimeMatcher) {
- timeMatchBasis = ((D2DTimeMatcher) timeMatcher).getTimeMatchBasis();
- }
- ManagedMapScale scale = MapScalesManager.getInstance().getScaleByName(
- getScaleName());
- if (scale != null) {
- ResourceList list = descriptor.getResourceList();
- for (ResourcePair rp : list) {
- if (rp.getProperties().isSystemResource() == false) {
- // Keep system resources
- if (rp.getResource() != timeMatchBasis) {
- list.remove(rp);
- }
- }
- }
- if (timeMatchBasis != null) {
- list.removeRsc(timeMatchBasis);
- }
- loadScale(scale);
- } else {
- // Map scale could not be found, default to remove all
- // non-map/system layers and reset display
- ResourceList list = descriptor.getResourceList();
- for (ResourcePair rp : list) {
- ResourceProperties props = rp.getProperties();
- if (props.isMapLayer() == false
- && props.isSystemResource() == false) {
- if (rp.getResource() != timeMatchBasis) {
- list.remove(rp);
- }
- } else {
- try {
- props.setVisible(true);
- rp.getResource().recycle();
- } catch (Throwable e) {
- props.setVisible(false);
- statusHandler.handle(Priority.PROBLEM, "Clear error: "
- + e.getMessage() + ":: The resource ["
- + rp.getResource().getSafeName()
- + "] has been disabled.", e);
- }
- }
- }
- if (timeMatchBasis != null) {
- list.removeRsc(timeMatchBasis);
- }
-
- scaleToClientArea(getBounds());
+ D2DTimeMatcher newTimeMatcher = new D2DTimeMatcher();
+ timeMatcher.copyFrom(newTimeMatcher);
+ descriptor.setTimeMatcher(newTimeMatcher);
}
+ super.clear();
}
}
diff --git a/cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/map/D2DSelectedPaneResource.java b/cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/map/D2DSelectedPaneResource.java
index a78021336d..e3c331c7d5 100644
--- a/cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/map/D2DSelectedPaneResource.java
+++ b/cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/map/D2DSelectedPaneResource.java
@@ -52,6 +52,7 @@ import com.raytheon.viz.ui.editor.IMultiPaneEditor;
* ------------ ---------- ----------- --------------------------
* Dec 20, 2010 mschenke Initial creation
* Aug 04, 2014 3489 mapeters Updated deprecated getStringBounds() calls.
+ * Nov 05, 2015 5070 randerso Adjust font sizes for dpi scaling
*
*
*
@@ -131,12 +132,10 @@ public class D2DSelectedPaneResource extends
/ paintProps.getCanvasBounds().height;
stringL.basics.x = stringI.basics.x = plus.basics.x = paintProps
- .getView()
- .getExtent().getMinX()
+ .getView().getExtent().getMinX()
+ (LEFT_OFFSET * ratioX);
stringL.basics.y = stringI.basics.y = plus.basics.y = paintProps
- .getView()
- .getExtent().getMaxY()
+ .getView().getExtent().getMaxY()
- (BOTTOM_OFFSET * ratioY);
if (editor.getNumberofPanes() > 1
@@ -178,7 +177,7 @@ public class D2DSelectedPaneResource extends
*/
@Override
protected void initInternal(IGraphicsTarget target) throws VizException {
- font = target.initializeFont(Font.MONOSPACED, 24,
+ font = target.initializeFont(Font.MONOSPACED, 20,
new Style[] { Style.BOLD });
stringL = new DrawableString("L", L_COLOR);
diff --git a/cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/time/D2DTimeMatcher.java b/cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/time/D2DTimeMatcher.java
index 3964711678..90fbdae60c 100644
--- a/cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/time/D2DTimeMatcher.java
+++ b/cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/time/D2DTimeMatcher.java
@@ -28,12 +28,15 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.concurrent.atomic.AtomicReference;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
-import org.apache.commons.lang.Validate;
+import org.apache.commons.lang3.Validate;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.status.IUFStatusHandler;
@@ -47,7 +50,6 @@ import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.core.VizConstants;
import com.raytheon.uf.viz.core.comm.PerspectiveSpecificLoadProperties;
-import com.raytheon.uf.viz.core.drawables.AbstractDescriptor;
import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.drawables.IDescriptor.FramesInfo;
@@ -71,28 +73,29 @@ import com.raytheon.uf.viz.d2d.core.D2DLoadProperties;
*
*
* SOFTWARE HISTORY
- * Date Ticket# Engineer Description
- * ------------- -------- ----------- --------------------------
- * Feb 10, 2009 chammack Initial creation
- * Jul 03, 2013 2159 bsteffen Synchronize TimeCache access.
- * Aug 9, 2013 16448 D. Friedman Validate time match basis in
- * redoTimeMatching
- * May 5, 2014 17201 D. Friedman Make same-radar time matching work more
- * like A1.
- * May 5, 2014 3265 bsteffen Better handling of resources returning
- * null dataTimes.
- * May 13, 2015 4461 bsteffen Move the logic to change frames into the
- * FrameCoordinator.
- * Jul 14, 2015 DR 13900 D. Friedman Validate descriptor of time match basis
- * before time matching it.
- * Jul 30, 2015 17761 D. Friedman Allow resources to return data times based
- * on base frame times.
- * Sep 10, 2015 4856 njensen Removed unnecessary code
+ *
+ * Date Ticket# Engineer Description
+ * ------------- -------- ---------- -------------------------------------------
+ * Feb 10, 2009 1959 chammack Initial creation
+ * Jul 03, 2013 2159 bsteffen Synchronize TimeCache access.
+ * Aug 09, 2013 16448 dfriedman Validate time match basis in
+ * redoTimeMatching
+ * May 05, 2014 17201 dfriedman Make same-radar time matching work more
+ * like A1.
+ * May 05, 2014 3265 bsteffen Better handling of resources returning null
+ * dataTimes.
+ * May 13, 2015 4461 bsteffen Move the logic to change frames into the
+ * FrameCoordinator.
+ * Jul 14, 2015 13900 dfriedman Validate descriptor of time match basis
+ * before time matching it.
+ * Jul 30, 2015 17761 dfriedman Allow resources to return data times based
+ * on base frame times.
+ * Sep 10, 2015 4856 njensen Removed unnecessary code
+ * Dec 03, 2015 5147 bsteffen Make timeMatchBasis atomic.
*
*
*
* @author chammack
- * @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public class D2DTimeMatcher extends AbstractTimeMatcher {
@@ -108,7 +111,8 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
/**
* The last set of times that the resource with these properties was
* matched against. As long as we are matching against these same times
- * then lastFrameTimes is valid.
+ * then lastFrameTimes is valid. This will be null for the
+ * TimeMatchBasis.
*/
private DataTime[] lastBaseTimes;
@@ -144,21 +148,21 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
}
/**
- * the rsc that determines the frame times to be displayed, i.e. other
+ * The resource that determines the frame times to be displayed, i.e. other
* resources on the same descriptor will time match against the
- * timeMatchBasis
+ * timeMatchBasis. This is an atomic reference to allow safe concurrent
+ * modification. It is never safe to assume that 2 calls to get will return
+ * the same value so complex operations(such as redoTimeMatching) will need
+ * to get a reference to the basis once at the beginning of the operation
+ * and use that reference throughout the operation.
*/
- protected transient AbstractVizResource, ?> timeMatchBasis;
+ protected final AtomicReference> timeMatchBasisRef = new AtomicReference<>();
private final IDisposeListener timeMatchBasisDisposeListener = new IDisposeListener() {
@Override
public void disposed(AbstractVizResource, ?> resource) {
- if ((resource == timeMatchBasis)) {
- synchronized (D2DTimeMatcher.this) {
- timeMatchBasis = null;
- }
- }
+ timeMatchBasisRef.compareAndSet(resource, null);
}
};
@@ -187,9 +191,6 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
private final Map, TimeCache> timeCacheMap = new IdentityHashMap, D2DTimeMatcher.TimeCache>();
- /**
- * Default Constructor.
- */
public D2DTimeMatcher() {
super();
try {
@@ -218,9 +219,6 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
* Checks if a resource is contained in the {@link IResourceGroup}
* recursively checking for {@link IResourceGroup}s in the group's list
*
- * @param group
- * @param resource
- * @return
*/
private boolean contained(IResourceGroup group,
AbstractVizResource, ?> resource) {
@@ -241,52 +239,40 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
}
@Override
- public void redoTimeMatching(IDescriptor descriptor) throws VizException {
+ public void redoTimeMatching(IDescriptor descriptor) {
synchronized (this) {
- if ((timeMatchBasis != null)
- && (timeMatchBasis.getDescriptor() == descriptor)
- && !validateTimeMatchBasis(descriptor)) {
- changeTimeMatchBasis(null);
- }
- if (timeMatchBasis != null) {
- IDescriptor tmDescriptor = timeMatchBasis.getDescriptor();
- if (tmDescriptor != null) {
- if (tmDescriptor != descriptor
- && tmDescriptor.getTimeMatcher() == this
- && hasContainer(descriptor)) {
- if (validateDescriptor(tmDescriptor)) {
- redoTimeMatching(tmDescriptor);
- } else {
- changeTimeMatchBasis(null);
- }
- } else if (contained(tmDescriptor, timeMatchBasis) == false) {
- // Checks to ensure the timeMatchBasis is not "orphaned"
- timeMatchBasis = null;
- }
- }
- }
- // Find the times for the time match basis.
- DataTime[] timeSteps = findBasisTimes(descriptor.getResourceList(),
- descriptor.getNumberOfFrames());
- if (timeSteps == null) {
+ /* Find the times for the time match basis. */
+ Pair, DataTime[]> basisInfo = findBasisTimes(descriptor);
+ if (basisInfo == null) {
descriptor.setFramesInfo(new FramesInfo(null, -1));
return;
}
+ AbstractVizResource, ?> timeMatchBasis = basisInfo.getLeft();
+ DataTime[] timeSteps = basisInfo.getRight();
Map, DataTime[]> resourceTimeMap = new HashMap, DataTime[]>();
resourceTimeMap.put(timeMatchBasis, timeSteps);
- // Find times for every other resource
+ /* Find the times for the time match basis. */
Iterator pairIterator = descriptor.getResourceList()
.listIterator();
while (pairIterator.hasNext()) {
AbstractVizResource, ?> rsc = pairIterator.next()
.getResource();
- recursiveOverlay(descriptor, new FramesInfo(timeSteps, -1,
- resourceTimeMap), rsc, resourceTimeMap);
+ recursiveOverlay(descriptor, timeMatchBasis, new FramesInfo(
+ timeSteps, -1, resourceTimeMap), rsc, resourceTimeMap);
}
- // Update the descriptor to the new times.
+ if (descriptor.getTimeMatcher() != this) {
+ /*
+ * The descriptor has switched to a new time matcher so the
+ * results of this operation are no longer relevant and are
+ * discarded. This can happen when the display is cleared.
+ */
+ return;
+ }
+
+ /* Update the descriptor to the new times. */
if ((timeMatchBasis.getDescriptor() != null)
&& (timeMatchBasis.getDescriptor() != descriptor)) {
int idx = timeMatchBasis.getDescriptor().getFramesInfo()
@@ -303,7 +289,7 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
resourceTimeMap));
}
- // Add Remove data for all the resources.
+ /* Add Remove data for all the resources. */
for (Entry, DataTime[]> entry : resourceTimeMap
.entrySet()) {
if (entry.getKey().getDescriptor() == descriptor) {
@@ -319,17 +305,22 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
*
* @param descriptor
* the descriptor that is being updated
+ * @param timeMatchBasis
+ * the current timeMatchBasis, used to ensure that it is not time
+ * matched again, even if it is located in a IResourceGroup
+ * @param framesInfo
+ * the matched times for the rsc passed in will be added to the
+ * map of this FramesInfo
* @param rsc
* the resource being updated.
* @param frameTimesSoure
* map of all previously time matched resources that may be used
* to determine the frame times
- * @throws VizException
*/
private void recursiveOverlay(IDescriptor descriptor,
- FramesInfo framesInfo, AbstractVizResource, ?> rsc,
- Map, DataTime[]> frameTimesSoure)
- throws VizException {
+ AbstractVizResource, ?> timeMatchBasis, FramesInfo framesInfo,
+ AbstractVizResource, ?> rsc,
+ Map, DataTime[]> frameTimesSoure) {
if (rsc == null) {
return;
}
@@ -338,7 +329,8 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
frameTimesSoure);
for (ResourcePair rp : ((IResourceGroup) rsc).getResourceList()) {
AbstractVizResource, ?> rsc1 = rp.getResource();
- recursiveOverlay(descriptor, framesInfo, rsc1, completed);
+ recursiveOverlay(descriptor, timeMatchBasis, framesInfo, rsc1,
+ completed);
}
}
@@ -347,8 +339,8 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
.getLoadProperties());
TimeCache timeCache = getTimeCache(rsc);
synchronized (timeCache) {
- DataTime[] timeSteps = getFrameTimes(descriptor, framesInfo,
- frameTimesSoure);
+ DataTime[] timeSteps = getFrameTimes(descriptor,
+ timeMatchBasis, framesInfo, frameTimesSoure);
if (Arrays.equals(timeSteps, timeCache.getLastBaseTimes())) {
framesInfo.getTimeMap().put(rsc,
timeCache.getLastFrameTimes());
@@ -378,15 +370,10 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
/**
* Determine the times to match this resource against, for single panel this
- * is the timeMatchBasisTimes, for four panel it is a bit more complex.
- *
- * @param descriptor
- * @param frameInfo
- * @param frameTimesSoure
- * @return
+ * is the timeMatchBasis times, for four panel it is a bit more complex.
*/
private DataTime[] getFrameTimes(IDescriptor descriptor,
- FramesInfo frameInfo,
+ AbstractVizResource, ?> timeMatchBasis, FramesInfo frameInfo,
Map, DataTime[]> frameTimesSource) {
DataTime[] descTimes = frameInfo.getFrameTimes();
if ((timeMatchBasis != null)
@@ -394,17 +381,19 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
return descTimes;
}
- // If the time match basis is not in this descriptor we should instead
- // fall back on the first resource in this descriptor which has times
- // for this frame. This concept was adopted from Frame::dataTime() in
- // the A1 source.
+ /*
+ * If the time match basis is not in this descriptor we should instead
+ * fall back on the first resource in this descriptor which has times
+ * for this frame. This concept was adopted from Frame::dataTime() in
+ * the A1 source.
+ */
DataTime[] times = new DataTime[frameInfo.getFrameCount()];
for (ResourcePair rp : descriptor.getResourceList()) {
DataTime[] rscTimes = frameTimesSource.get(rp.getResource());
if ((rscTimes == null) || (rscTimes.length != times.length)) {
if (rp.getResource() instanceof IResourceGroup) {
- // Descend into resource groups.
+ /* Descend into resource groups. */
for (ResourcePair rp1 : ((IResourceGroup) rp.getResource())
.getResourceList()) {
rscTimes = frameTimesSource.get(rp1.getResource());
@@ -437,32 +426,85 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
/**
* Attempts to find the frame times for a time match basis, if time match
* basis is not defined attempts to find a new time match basis. Returns
- * null if no Time Match basis can be found.
- *
- * @param descriptor
- * @param resourceList
- * @return
- * @throws VizException
+ * null if no Time Match basis can be found. This method will update the
+ * {@link #timeMatchBasisRef} if needed.
*/
- private DataTime[] findBasisTimes(ResourceList resourceList,
- int numberOfFrames) throws VizException {
- if (timeMatchBasis != null) {
- TimeCache timeCache = getTimeCache(timeMatchBasis);
- DataTime[] times = null;
- synchronized (timeCache) {
- times = timeCache.getLastFrameTimes();
- if ((times == null) || (timeCache.getLastBaseTimes() != null)
- || (timeCache.getLastFrameCount() != numberOfFrames)) {
- times = makeEmptyLoadList(numberOfFrames, timeMatchBasis);
- timeCache.setTimes(null, times, numberOfFrames);
+ private Pair, DataTime[]> findBasisTimes(
+ IDescriptor descriptor) {
+ int numberOfFrames = descriptor.getNumberOfFrames();
+ AbstractVizResource, ?> timeMatchBasis = timeMatchBasisRef.get();
+ if (timeMatchBasis == null) {
+ Pair, DataTime[]> pair = findNewBasis(
+ descriptor.getResourceList(), numberOfFrames);
+ if (pair != null) {
+ AbstractVizResource, ?> rsc = pair.getLeft();
+ configureBasis(rsc);
+ if (!timeMatchBasisRef.compareAndSet(null, rsc)) {
+ unconfigureBasis(rsc);
}
}
- if (times != null) {
- return times;
- } else {
- timeMatchBasis = null;
+ return pair;
+ }
+
+ IDescriptor tmDescriptor = timeMatchBasis.getDescriptor();
+ if ((tmDescriptor == descriptor)
+ && !validateTimeMatchBasis(descriptor, timeMatchBasis)) {
+ changeTimeMatchBasis(null);
+ return findBasisTimes(descriptor);
+ }
+ if (tmDescriptor != null) {
+ if (tmDescriptor != descriptor
+ && tmDescriptor.getTimeMatcher() == this
+ && hasContainer(descriptor)) {
+ if (validateDescriptor(tmDescriptor)) {
+ redoTimeMatching(tmDescriptor);
+ } else {
+ changeTimeMatchBasis(null);
+ return findBasisTimes(descriptor);
+ }
+ } else if (contained(tmDescriptor, timeMatchBasis) == false) {
+ /* Checks to ensure the timeMatchBasis is not "orphaned" */
+ timeMatchBasisRef.compareAndSet(timeMatchBasis, null);
+ return findBasisTimes(descriptor);
}
}
+ TimeCache timeCache = getTimeCache(timeMatchBasis);
+ DataTime[] times = null;
+ synchronized (timeCache) {
+ times = timeCache.getLastFrameTimes();
+ if ((times == null) || (timeCache.getLastBaseTimes() != null)
+ || (timeCache.getLastFrameCount() != numberOfFrames)) {
+ times = makeEmptyLoadList(numberOfFrames, timeMatchBasis);
+ timeCache.setTimes(null, times, numberOfFrames);
+ }
+ }
+ if (times != null) {
+ return new ImmutablePair, DataTime[]>(
+ timeMatchBasis, times);
+ } else {
+ /*
+ * This might fail if another thread has assigned a basis while this
+ * method was looking for one. In this case the current operation
+ * will proceed with the wrong basis. Proceed anyway since the basis
+ * that was chosen would have been the correct basis when this
+ * method began. Whatever operation set the basis should have
+ * initiated redoTimeMatching which will run after this and assign
+ * times with the new basis.
+ */
+ timeMatchBasisRef.compareAndSet(timeMatchBasis, null);
+ return findBasisTimes(descriptor);
+ }
+ }
+
+ /**
+ * Recursive operation to search for a resource that is able to be the time
+ * match basis. Returns the resource and the matched times for that
+ * resource. If no resources is able to be the timeMatchBasis then null is
+ * returned. This method does not actually change {@link #timeMatchBasisRef}
+ * .
+ */
+ public Pair, DataTime[]> findNewBasis(
+ ResourceList resourceList, int numberOfFrames) {
Iterator pairIterator = resourceList.iterator();
while (pairIterator.hasNext()) {
ResourcePair pair = pairIterator.next();
@@ -476,13 +518,12 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
}
if (rsc.getResourceData() instanceof IResourceGroup) {
- DataTime[] times = findBasisTimes(
- ((IResourceGroup) rsc.getResourceData())
- .getResourceList(),
- numberOfFrames);
+ IResourceGroup group = (IResourceGroup) rsc.getResourceData();
+ Pair, DataTime[]> resultPair = findNewBasis(
+ group.getResourceList(), numberOfFrames);
- if (times != null) {
- return times;
+ if (resultPair != null) {
+ return resultPair;
}
} else {
DataTime[] times = makeEmptyLoadList(numberOfFrames, rsc);
@@ -491,7 +532,8 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
synchronized (cache) {
cache.setTimes(null, times, numberOfFrames);
}
- return times;
+ return new ImmutablePair, DataTime[]>(
+ rsc, times);
}
}
}
@@ -499,21 +541,11 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
}
/**
- * Make an empty load list for a resource, if this is successful the
- * resource will be defined as the time match basis
- *
- * @param descriptor
- * @param rsc
- * @return
- * @throws VizException
+ * Make an empty load list for a resource. Only a time match basis should
+ * use this method for getting matched times.
*/
private DataTime[] makeEmptyLoadList(int numberOfFrames,
- AbstractVizResource, ?> rsc) throws VizException {
- if ((timeMatchBasis != null) && (rsc != timeMatchBasis)) {
- throw new IllegalArgumentException(
- "Cannot make Empty Load List for a resource which is not the Time Match Basis.");
- }
-
+ AbstractVizResource, ?> rsc) {
TimeMatchingConfiguration config = getConfiguration(
rsc.getLoadProperties()).clone();
if ((config.getDataTimes() == null)
@@ -531,19 +563,14 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
if ((timeSteps == null) || (timeSteps.length == 0)) {
return null;
}
- changeTimeMatchBasis(rsc);
return timeSteps;
}
/**
* Remove unused times from a resource and add in any new times.
- *
- * @param rsc
- * @param timeSteps
- * @throws VizException
*/
private void timeMatchUpdate(AbstractVizResource, ?> rsc,
- DataTime[] timeSteps) throws VizException {
+ DataTime[] timeSteps) {
if (rsc.getResourceData() instanceof IResourceGroup) {
for (ResourcePair tmp : ((IResourceGroup) rsc.getResourceData())
@@ -562,9 +589,6 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
/**
* Find the Time Matching Configuration for this resource. If one can't be
* found, return an empty configuration.
- *
- * @param properties
- * @return
*/
private TimeMatchingConfiguration getConfiguration(LoadProperties properties) {
if (properties == null) {
@@ -582,6 +606,11 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
return new TimeMatchingConfiguration();
}
+ /**
+ * Thread safe access to {@link #timeCacheMap}. If the map has no entry for
+ * this resource then a new {@link TimeCache} is created, added to the map,
+ * and returned.
+ */
private TimeCache getTimeCache(AbstractVizResource, ?> resource) {
synchronized (timeCacheMap) {
TimeCache cache = timeCacheMap.get(resource);
@@ -596,8 +625,6 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
/**
* Populates all unset fields of the configuration with defaults except
* dataTimes, dataTimes should be set before calling this function.
- *
- * @param config
*/
private void populateConfiguration(TimeMatchingConfiguration config) {
Arrays.sort(config.getDataTimes());
@@ -626,29 +653,33 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
}
/**
- * Retrieves the latest times from a time sequence resource
+ * Retrieves the latest times from a resource
*
- * If the resource is also requestable, we check the catalog for the latest
- * product times.
+ * If the resource data is an {@link AbstractRequestableResourceData} then
+ * this will query for the available times.
*
- * @param rsc
- * @param timeSteps
- * @return
- * @throws VizException
*/
protected DataTime[] getLatestTimes(AbstractVizResource, ?> rsc,
- DataTime[] timeSteps) throws VizException {
+ DataTime[] timeSteps) {
DataTime[] availableTimes = null;
- // If resource is handling requests itself, just return the datatimes
- // listed in the resource
+ /*
+ * If resource is handling requests itself, just return the datatimes
+ * listed in the resource
+ */
AbstractResourceData resourceData = rsc.getResourceData();
if (resourceData instanceof AbstractRequestableResourceData) {
AbstractRequestableResourceData req = (AbstractRequestableResourceData) resourceData;
if (req.isRequeryNecessaryOnTimeMatch()
|| (rsc.getDataTimes() == null)
|| (rsc.getDataTimes().length == 0)) {
- availableTimes = req.getAvailableTimes();
+ try {
+ availableTimes = req.getAvailableTimes();
+ } catch (VizException e) {
+ statusHandler
+ .error("Unable to query times for "
+ + rsc.getSafeName(), e);
+ }
}
}
@@ -662,7 +693,7 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
/**
* Prunes data that is no longer used by calling
- * AbstractVizResource.remove(DataTime).
+ * {@link AbstractVizResource#remove(DataTime)}
*
* @param rsc
* the resource to prune
@@ -715,10 +746,9 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
* available dataTimes
* @param resource
* the resource to update
- * @throws VizException
*/
private void updateResourceWithLatest(DataTime[] dataTimes,
- AbstractVizResource, ?> resource) throws VizException {
+ AbstractVizResource, ?> resource) {
Validate.notNull(resource, "Resource must not be null");
if (resource.getResourceData() == null) {
return;
@@ -735,10 +765,16 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
* place to break things.
*/
Arrays.sort(dt, new DataTimeComparator());
- PluginDataObject[] pdo = arrd.getLatestPluginDataObjects(dataTimes,
- dt);
- if (pdo.length > 0) {
- resource.getResourceData().update(pdo);
+ try {
+ PluginDataObject[] pdo = arrd.getLatestPluginDataObjects(
+ dataTimes, dt);
+ if (pdo.length > 0) {
+ resource.getResourceData().update(pdo);
+ }
+ } catch (VizException e) {
+ statusHandler.error(
+ "Unable to update data for " + resource.getSafeName(),
+ e);
}
}
@@ -747,40 +783,40 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
@Override
public void handleRemove(AbstractVizResource, ?> resource,
IDescriptor descriptor) {
- if ((resource == timeMatchBasis)
- && (descriptor instanceof AbstractDescriptor)) {
- synchronized (this) {
- timeMatchBasis = null;
- }
- }
+ timeMatchBasisRef.compareAndSet(resource, null);
synchronized (timeCacheMap) {
timeCacheMap.remove(resource);
}
}
- /**
- * @return the loadMode
- */
public LoadMode getLoadMode() {
return loadMode;
}
- /**
- * @param loadMode
- * the loadMode to set
- */
public void setLoadMode(LoadMode loadMode) {
this.loadMode = loadMode;
}
+ /**
+ * Attempt to match the provided availableTimes against the current state of
+ * the time matcher. This can be used while loading a resource to determine
+ * if any matching times are possible and for preloading any data for those
+ * times.
+ *
+ * This method is also responsible for using the
+ * AbstractTimeMatchingConfigurationFactory for this matcher to configure
+ * the time match settings. The final times the resource displays may change
+ * if other resources are being loaded concurrently. When a resource is done
+ * loading {@link #redoTimeMatching(IDescriptor)} must be used to properly
+ * add the resource to the {@link FramesInfo} of the {@link IDescriptor}.
+ */
@Override
public DataTime[] initialLoad(LoadProperties loadProps,
DataTime[] availableTimes, IDescriptor descriptor)
throws VizException {
-
DataTime[] dataTimesToLoad = null;
-
TimeMatchingConfiguration config = null;
+ AbstractVizResource, ?> timeMatchBasis = timeMatchBasisRef.get();
if (timeMatchBasis == null) {
config = configFactory.getConfiguration(loadProps, this,
availableTimes, descriptor);
@@ -810,8 +846,8 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
}
populateConfiguration(config);
DataTime[] existingDataTimes = getFrameTimes(descriptor,
- descriptor.getFramesInfo(), descriptor.getFramesInfo()
- .getTimeMap());
+ timeMatchBasis, descriptor.getFramesInfo(), descriptor
+ .getFramesInfo().getTimeMap());
TimeMatcher tm = new TimeMatcher();
dataTimesToLoad = tm.makeOverlayList(config.getDataTimes(),
@@ -821,7 +857,7 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
if ((timeMatchBasis.getDescriptor() != null)
&& (timeMatchBasis.getDescriptor() != descriptor)) {
- // Still use my times, but the index from the time match basis
+ /* Still use my times, but the index from the time match basis */
FramesInfo myFi = descriptor.getFramesInfo();
FramesInfo tmFi = timeMatchBasis.getDescriptor()
.getFramesInfo();
@@ -836,90 +872,77 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
/**
* Changes the time match basis for the time matcher to be the specified
* resource
- *
- * @param resource
*/
public void changeTimeMatchBasis(AbstractVizResource, ?> resource) {
- if (timeMatchBasis != resource) {
- if (timeMatchBasis != null) {
- TimeMatchingConfiguration config = getConfiguration(timeMatchBasis
- .getLoadProperties());
- config.setTimeMatchBasis(false);
- TimeCache timeCache = getTimeCache(timeMatchBasis);
- synchronized (timeCache) {
- timeCache.setTimes(null, null);
- }
- timeMatchBasis
- .unregisterListener(timeMatchBasisDisposeListener);
- }
-
- timeMatchBasis = resource;
-
- if (timeMatchBasis != null) {
- TimeMatchingConfiguration config = getConfiguration(timeMatchBasis
- .getLoadProperties());
- config.setTimeMatchBasis(true);
- TimeCache timeCache = getTimeCache(timeMatchBasis);
- synchronized (timeCache) {
- timeCache.setTimes(null, null);
- }
- timeMatchBasis.registerListener(timeMatchBasisDisposeListener);
- }
+ if (resource != null) {
+ configureBasis(resource);
+ }
+ AbstractVizResource, ?> prev = timeMatchBasisRef.getAndSet(resource);
+ if (prev != null) {
+ unconfigureBasis(prev);
}
}
/**
- * Returns the time match basis for the D2DTimeMatcher
- *
- * @return
+ * Used to setup the {@link TimeMatchingConfiguration} and
+ * {@link #timeMatchBasisDisposeListener} for a new timeMatchBasis. This
+ * should be used before modifying the {@link TimeMatchBasisRef}.
*/
- public AbstractVizResource, ?> getTimeMatchBasis() {
- return timeMatchBasis;
- }
-
- public boolean hasTimeMatchBasis() {
- return (timeMatchBasis != null);
+ private void configureBasis(AbstractVizResource, ?> newBasis) {
+ TimeMatchingConfiguration config = getConfiguration(newBasis
+ .getLoadProperties());
+ config.setTimeMatchBasis(true);
+ TimeCache timeCache = getTimeCache(newBasis);
+ synchronized (timeCache) {
+ timeCache.setTimes(null, null);
+ }
+ newBasis.registerListener(timeMatchBasisDisposeListener);
}
/**
- * @return the clockFilter
+ * Used to revert the {@link TimeMatchingConfiguration} and
+ * {@link #timeMatchBasisDisposeListener} when a timeMatchBasis is removed.
+ * This should be used after modifying the {@link TimeMatchBasisRef}.
*/
+ private void unconfigureBasis(AbstractVizResource, ?> oldBasis) {
+ TimeMatchingConfiguration config = getConfiguration(oldBasis
+ .getLoadProperties());
+ config.setTimeMatchBasis(false);
+ TimeCache timeCache = getTimeCache(oldBasis);
+ synchronized (timeCache) {
+ timeCache.setTimes(null, null);
+ }
+ oldBasis.unregisterListener(timeMatchBasisDisposeListener);
+ }
+
+ public AbstractVizResource, ?> getTimeMatchBasis() {
+ return timeMatchBasisRef.get();
+ }
+
+ public boolean hasTimeMatchBasis() {
+ return (timeMatchBasisRef.get() != null);
+ }
+
public Date getClockFilter() {
return clockFilter;
}
- /**
- * @return the forecastFilter
- */
public long getForecastFilter() {
return forecastFilter;
}
- /**
- * @return the deltaFilter
- */
public long getDeltaFilter() {
return deltaFilter;
}
- /**
- * @return the isTimeOptionsSelected
- */
public boolean isTimeOptionsSelected() {
return isTimeOptionsSelected;
}
- /**
- * @param isTimeOptionsSelected
- * the isTimeOptionsSelected to set
- */
public void setTimeOptionsSelected(boolean isTimeOptionsSelected) {
this.isTimeOptionsSelected = isTimeOptionsSelected;
}
- /**
- * @return the dataTimeDialogManager
- */
public AbstractTimeMatchingConfigurationFactory getTimeMatchingConfigurationFactory() {
return configFactory;
}
@@ -927,7 +950,7 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
@Override
public List getDisplayLoadOrder(
List displays) {
- // if any of the displays have a set time match basis then load it first
+ /* if any of the displays have a set time match basis then load it first */
AbstractRenderableDisplay basisDisplay = null;
for (AbstractRenderableDisplay display : displays) {
if (getBasisResourcePair(display.getDescriptor().getResourceList()) != null) {
@@ -947,8 +970,10 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
@Override
public List getResourceLoadOrder(List resources) {
- // if any of the resources are set as the time match basis then load it
- // first
+ /*
+ * if any of the resources are set as the time match basis then load it
+ * first
+ */
ResourcePair basisPair = getBasisResourcePair(resources);
if (basisPair != null) {
List results = new ArrayList(resources);
@@ -979,7 +1004,7 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
public void copyFrom(AbstractTimeMatcher timeMatcher) {
if (timeMatcher instanceof D2DTimeMatcher) {
D2DTimeMatcher d2d = (D2DTimeMatcher) timeMatcher;
- if (timeMatchBasis == null) {
+ if (timeMatchBasisRef.get() == null) {
this.clockFilter = d2d.clockFilter;
this.forecastFilter = d2d.forecastFilter;
this.deltaFilter = d2d.deltaFilter;
@@ -994,7 +1019,8 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
configFactory.resetMultiload();
}
- private boolean validateTimeMatchBasis(IDescriptor descriptor) {
+ private static boolean validateTimeMatchBasis(IDescriptor descriptor,
+ AbstractVizResource, ?> timeMatchBasis) {
/*
* If a resource is shared by multiple panels (this can be the case with
* tools, at least), then it is necessary to search all of them as
@@ -1010,18 +1036,21 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
IDescriptor paneDescriptor = paneDisplay != null ? paneDisplay
.getDescriptor() : null;
if ((paneDescriptor != null)
- && validateTimeMatchBasis(paneDescriptor
- .getResourceList())) {
+ && validateTimeMatchBasis(
+ paneDescriptor.getResourceList(),
+ timeMatchBasis)) {
return true;
}
}
} else {
- return validateTimeMatchBasis(descriptor.getResourceList());
+ return validateTimeMatchBasis(descriptor.getResourceList(),
+ timeMatchBasis);
}
return false;
}
- private boolean validateTimeMatchBasis(ResourceList list) {
+ private static boolean validateTimeMatchBasis(ResourceList list,
+ AbstractVizResource, ?> timeMatchBasis) {
for (ResourcePair rp : list) {
AbstractVizResource, ?> rsc = rp.getResource();
if (rsc == timeMatchBasis) {
@@ -1031,8 +1060,9 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
continue;
} else if ((rsc != null)
&& (rsc.getResourceData() instanceof IResourceGroup)) {
- if (validateTimeMatchBasis(((IResourceGroup) rsc
- .getResourceData()).getResourceList())) {
+ IResourceGroup group = (IResourceGroup) rsc.getResourceData();
+ if (validateTimeMatchBasis(group.getResourceList(),
+ timeMatchBasis)) {
return true;
}
}
@@ -1045,7 +1075,7 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
return display.getContainer() != null;
}
- private boolean validateDescriptor(IDescriptor descriptor) {
+ private static boolean validateDescriptor(IDescriptor descriptor) {
IRenderableDisplay display = descriptor.getRenderableDisplay();
IDisplayPaneContainer container = display != null ? display
.getContainer() : null;
@@ -1054,8 +1084,9 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
IRenderableDisplay paneDisplay = pane.getRenderableDisplay();
IDescriptor paneDescriptor = paneDisplay != null ? paneDisplay
.getDescriptor() : null;
- if (paneDescriptor == descriptor)
+ if (paneDescriptor == descriptor) {
return true;
+ }
}
}
return false;
diff --git a/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseAlaska.xml b/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseAlaska.xml
index 019d9de459..07b5cabc6e 100644
--- a/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseAlaska.xml
+++ b/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseAlaska.xml
@@ -31,7 +31,7 @@
@@ -86,7 +86,7 @@
diff --git a/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseAtlantic.xml b/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseAtlantic.xml
index 92d6c70827..d948049008 100644
--- a/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseAtlantic.xml
+++ b/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseAtlantic.xml
@@ -77,13 +77,13 @@
@@ -108,12 +108,12 @@
diff --git a/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseAustralia.xml b/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseAustralia.xml
index 410b2f3aee..df94e87ab6 100644
--- a/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseAustralia.xml
+++ b/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseAustralia.xml
@@ -20,7 +20,7 @@
-->
@@ -155,7 +155,7 @@
diff --git a/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseCanadaEastern.xml b/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseCanadaEastern.xml
index 47048c0dec..4b8432767b 100644
--- a/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseCanadaEastern.xml
+++ b/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseCanadaEastern.xml
@@ -70,7 +70,7 @@
@@ -95,7 +95,7 @@
diff --git a/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseJapan.xml b/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseJapan.xml
index 160001720f..e74356312f 100644
--- a/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseJapan.xml
+++ b/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseJapan.xml
@@ -158,7 +158,7 @@
@@ -168,7 +168,7 @@
diff --git a/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseMexico.xml b/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseMexico.xml
index 01b6a6b107..7f17296169 100644
--- a/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseMexico.xml
+++ b/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseMexico.xml
@@ -30,12 +30,12 @@
@@ -45,7 +45,7 @@
@@ -70,12 +70,12 @@
diff --git a/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/basePacificEast.xml b/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/basePacificEast.xml
index 929c254b29..c171550d6f 100644
--- a/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/basePacificEast.xml
+++ b/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/basePacificEast.xml
@@ -81,7 +81,7 @@
diff --git a/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/basePacificWest.xml b/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/basePacificWest.xml
index 6e030771ab..84b79c272f 100644
--- a/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/basePacificWest.xml
+++ b/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/basePacificWest.xml
@@ -25,7 +25,7 @@
@@ -72,12 +72,12 @@
@@ -122,7 +122,7 @@
diff --git a/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseRussia.xml b/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseRussia.xml
index 8b73228ba9..19a3506607 100644
--- a/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseRussia.xml
+++ b/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseRussia.xml
@@ -20,7 +20,7 @@
-->
@@ -135,12 +135,12 @@
diff --git a/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseUSCentral.xml b/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseUSCentral.xml
index f54605d3b6..bd7806397a 100644
--- a/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseUSCentral.xml
+++ b/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseUSCentral.xml
@@ -65,7 +65,7 @@
@@ -100,7 +100,7 @@
@@ -115,7 +115,7 @@
diff --git a/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseUSEastern.xml b/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseUSEastern.xml
index c86d43ca8b..fcdb113247 100644
--- a/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseUSEastern.xml
+++ b/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseUSEastern.xml
@@ -165,7 +165,7 @@
diff --git a/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseUSWestern.xml b/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseUSWestern.xml
index 6c2a17173d..48deeec1fd 100644
--- a/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseUSWestern.xml
+++ b/cave/com.raytheon.uf.viz.d2d.nsharp/localization/menus/upperair/baseUSWestern.xml
@@ -35,12 +35,12 @@
@@ -65,7 +65,7 @@
@@ -130,7 +130,7 @@
diff --git a/cave/com.raytheon.uf.viz.d2d.ui.ncephydro/localization/bundles/ncepHydro/SvrWxPlot.xml b/cave/com.raytheon.uf.viz.d2d.ui.ncephydro/localization/bundles/ncepHydro/SvrWxPlot.xml
index 75e85c838a..8dbd836c72 100644
--- a/cave/com.raytheon.uf.viz.d2d.ui.ncephydro/localization/bundles/ncepHydro/SvrWxPlot.xml
+++ b/cave/com.raytheon.uf.viz.d2d.ui.ncephydro/localization/bundles/ncepHydro/SvrWxPlot.xml
@@ -45,6 +45,11 @@
+
+
+
+
+
@@ -69,6 +74,11 @@
+
+
+
+
+
@@ -93,6 +103,11 @@
+
+
+
+
+
diff --git a/cave/com.raytheon.uf.viz.d2d.ui.ncephydro/localization/menus/ncepHydro/tpc/hurricane.xml b/cave/com.raytheon.uf.viz.d2d.ui.ncephydro/localization/menus/ncepHydro/tpc/hurricane.xml
index a1ffaef8e0..a5dfb1bbb6 100644
--- a/cave/com.raytheon.uf.viz.d2d.ui.ncephydro/localization/menus/ncepHydro/tpc/hurricane.xml
+++ b/cave/com.raytheon.uf.viz.d2d.ui.ncephydro/localization/menus/ncepHydro/tpc/hurricane.xml
@@ -28,12 +28,12 @@
-
+
-
+
diff --git a/cave/com.raytheon.uf.viz.d2d.ui.upperair/localization/menus/upperair/baseAddedFeatures.xml b/cave/com.raytheon.uf.viz.d2d.ui.upperair/localization/menus/upperair/baseAddedFeatures.xml
index 1070174a41..4d41a96981 100644
--- a/cave/com.raytheon.uf.viz.d2d.ui.upperair/localization/menus/upperair/baseAddedFeatures.xml
+++ b/cave/com.raytheon.uf.viz.d2d.ui.upperair/localization/menus/upperair/baseAddedFeatures.xml
@@ -19,12 +19,4 @@
further_licensing_information.
-->
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/cave/com.raytheon.uf.viz.d2d.ui.upperair/localization/menus/upperair/baseNPNPlot.xml b/cave/com.raytheon.uf.viz.d2d.ui.upperair/localization/menus/upperair/baseNPNPlot.xml
index 6d0ea12fb6..beb3f22bfa 100644
--- a/cave/com.raytheon.uf.viz.d2d.ui.upperair/localization/menus/upperair/baseNPNPlot.xml
+++ b/cave/com.raytheon.uf.viz.d2d.ui.upperair/localization/menus/upperair/baseNPNPlot.xml
@@ -98,7 +98,6 @@
-
+
\ No newline at end of file
diff --git a/cave/com.raytheon.uf.viz.d2d.ui.upperair/localization/menus/upperair/baseRadar.xml b/cave/com.raytheon.uf.viz.d2d.ui.upperair/localization/menus/upperair/baseRadar.xml
index 6d94615b29..a911376543 100644
--- a/cave/com.raytheon.uf.viz.d2d.ui.upperair/localization/menus/upperair/baseRadar.xml
+++ b/cave/com.raytheon.uf.viz.d2d.ui.upperair/localization/menus/upperair/baseRadar.xml
@@ -168,6 +168,5 @@
-
\ No newline at end of file
diff --git a/cave/com.raytheon.uf.viz.d2d.ui/plugin.xml b/cave/com.raytheon.uf.viz.d2d.ui/plugin.xml
index 91b3c6cb3d..cfa8627d00 100644
--- a/cave/com.raytheon.uf.viz.d2d.ui/plugin.xml
+++ b/cave/com.raytheon.uf.viz.d2d.ui/plugin.xml
@@ -268,14 +268,42 @@
definitionId="com.raytheon.uf.viz.d2d.ui.inD2DActionSet">
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+