Merge branch 'omaha_14.2.1' (14.2.1-8) into development

Conflicts:
	cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/localization/LocalizationManager.java
	cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/ui/zoneselector/ZoneSelectorResource.java
	cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/GeneralGridData.java
	cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java
	edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/config/gfe/serverConfig.py
	edexOsgi/com.raytheon.edex.plugin.textlightning/src/com/raytheon/edex/plugin/textlightning/impl/TextLightningParser.java
	edexOsgi/com.raytheon.uf.common.comm/src/com/raytheon/uf/common/comm/HttpClient.java
	edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/response/GridResponseData.java
	edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/util/PDOUtil.java
	edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/src/com/raytheon/uf/edex/datadelivery/bandwidth/sbn/SbnSimulator.java

Change-Id: Ia74f80ced9091ff0497ccc6d93e876b5a9807f75

Former-commit-id: 0e25ae35c1 [formerly a47eaa9af45db41391fe46e36ec0793f70d06ad6]
Former-commit-id: 1c150e6e8b
This commit is contained in:
Richard Peter 2014-02-27 15:18:26 -06:00
commit f13c86bc3e
380 changed files with 11663 additions and 6763 deletions

View file

@ -107,6 +107,40 @@
</max-perm> </max-perm>
</ini-substitutions> </ini-substitutions>
</memory-setting> </memory-setting>
<memory-setting>
<command-line-args>
<first-arg>-component</first-arg>
<second-arg>servicebackup</second-arg>
</command-line-args>
<ini-substitutions>
<max-memory>
<value>256M</value>
</max-memory>
<max-perm>
<value>128m</value>
</max-perm>
</ini-substitutions>
</memory-setting>
<memory-setting>
<command-line-args>
<first-arg>-perspective</first-arg>
<second-arg>National Centers</second-arg>
</command-line-args>
<ini-substitutions>
<max-memory>
<value>1536M</value>
</max-memory>
<max-perm>
<value>DEFAULT</value>
</max-perm>
</ini-substitutions>
</memory-setting>
</arch.x86> </arch.x86>
<arch.x86_64> <arch.x86_64>
@ -182,6 +216,40 @@
</max-perm> </max-perm>
</ini-substitutions> </ini-substitutions>
</memory-setting> </memory-setting>
<memory-setting>
<command-line-args>
<first-arg>-component</first-arg>
<second-arg>servicebackup</second-arg>
</command-line-args>
<ini-substitutions>
<max-memory>
<value>256M</value>
</max-memory>
<max-perm>
<value>128m</value>
</max-perm>
</ini-substitutions>
</memory-setting>
<memory-setting>
<command-line-args>
<first-arg>-perspective</first-arg>
<second-arg>National Centers</second-arg>
</command-line-args>
<ini-substitutions>
<max-memory>
<value>2048M</value>
</max-memory>
<max-perm>
<value>DEFAULT</value>
</max-perm>
</ini-substitutions>
</memory-setting>
</arch.x86_64> </arch.x86_64>
</cave-memory-settings> </cave-memory-settings>

View file

@ -1,5 +0,0 @@
s2s
default : SKY_COVER_00
1 : SKY_COVER_00
4 : SKY_COVER_08
7 : SKY_COVER_06

View file

@ -1,13 +0,0 @@
s2s
0 : SKY_COVER_00
1 : SKY_COVER_02
2 : SKY_COVER_03
4 : SKY_COVER_08
5 : SKY_COVER_00
6 : SKY_COVER_05
8 : SKY_COVER_09
9 : SKY_COVER_03
11 : SKY_COVER_03
12 : SKY_COVER_02
13 : SKY_COVER_02
14 : SKY_COVER_00

View file

@ -1,11 +0,0 @@
s2s
SEV : ICING_08
MODSEV : ICING_06
MOD : ICING_05
LGTMOD : ICING_04
LGT : ICING_03
TRACELGT: ICING_02
TRACE : ICING_01
NEG : ICING_00

View file

@ -1,10 +0,0 @@
s2s
0 : PRESSURE_TENDENCY_00
1 : PRESSURE_TENDENCY_01
2 : PRESSURE_TENDENCY_02
3 : PRESSURE_TENDENCY_03
4 : PRESSURE_TENDENCY_04
5 : PRESSURE_TENDENCY_05
6 : PRESSURE_TENDENCY_06
7 : PRESSURE_TENDENCY_07
8 : PRESSURE_TENDENCY_08

View file

@ -1,11 +0,0 @@
s2s
default : SKY_COVER_10
BLNK : SKY_COVER_10
SKC : SKY_COVER_00
CLR : SKY_COVER_00
FEW : SKY_COVER_02
SCT : SKY_COVER_03
BKN : SKY_COVER_06
OVC : SKY_COVER_08
OBS : SKY_COVER_09
VV : SKY_COVER_09

View file

@ -1,10 +0,0 @@
s2s
default : SKY_COVER_10
1 : SKY_COVER_10
2 : SKY_COVER_00
3 : SKY_COVER_00
4 : SKY_COVER_03
5 : SKY_COVER_02
6 : SKY_COVER_06
7 : SKY_COVER_08
8 : SKY_COVER_09

View file

@ -1,9 +0,0 @@
s2s
EXTRM :TURBULENCE_7
SEV :TURBULENCE_6
MODSEV:TURBULENCE_5
MOD :TURBULENCE_4
LGTMOD:TURBULENCE_3
LGT :TURBULENCE_2
NEGLGT:TURBULENCE_1
NEG :TURBULENCE_0

View file

@ -1,71 +0,0 @@
s2s
-SHRA : PRESENT_WX_080
+SHRA : PRESENT_WX_082
SHRA : PRESENT_WX_081
-SHSN : PRESENT_WX_085
+SHSN : PRESENT_WX_086
SHSN : PRESENT_WX_086
-TSRA : PRESENT_WX_095
+TSRA : PRESENT_WX_097
TSRA : PRESENT_WX_095
-TSSN : PRESENT_WX_095
+TSSN : PRESENT_WX_097
TSSN : PRESENT_WX_095
FZRASN : PRESENT_WX_066
BCBR : PRESENT_WX_010
MIBR : PRESENT_WX_010
BR : PRESENT_WX_010
FZFG : PRESENT_WX_048
BCFG : PRESENT_WX_041
MIFG : PRESENT_WX_044
FG : PRESENT_WX_045
TS : PRESENT_WX_095
+TS : PRESENT_WX_097
FC : PRESENT_WX_019
+FC : PRESENT_WX_019
PO : PRESENT_WX_008
DRSN : PRESENT_WX_036
+DRSN : PRESENT_WX_037
BLSN : PRESENT_WX_038
+BLSN : PRESENT_WX_039
FU : PRESENT_WX_004
HZ : PRESENT_WX_005
-SH : PRESENT_WX_080
SH : PRESENT_WX_081
DU : PRESENT_WX_006
SA : PRESENT_WX_007
SS : PRESENT_WX_009
DS : PRESENT_WX_009
+SS : PRESENT_WX_009
+DS : PRESENT_WX_009
-FZRA : PRESENT_WX_066
-FZDZ : PRESENT_WX_056
FZRA : PRESENT_WX_067
FZDZ : PRESENT_WX_057
GR : PRESENT_WX_088
IC : PRESENT_WX_078
PE : PRESENT_WX_079
PL : PRESENT_WX_079
GS : PRESENT_WX_087
DZRA : PRESENT_WX_058
RADZ : PRESENT_WX_058
RASN : PRESENT_WX_069
SNRA : PRESENT_WX_069
-RA : PRESENT_WX_061
+RA : PRESENT_WX_065
RA : PRESENT_WX_063
-DZ : PRESENT_WX_051
+DZ : PRESENT_WX_055
DZ : PRESENT_WX_053
-SN : PRESENT_WX_071
+SN : PRESENT_WX_075
SN : PRESENT_WX_073
-UP : PRESENT_WX_203
+UP : PRESENT_WX_203
UP : PRESENT_WX_203
IP : PRESENT_WX_079
SG : PRESENT_WX_077
VA : PRESENT_WX_201
PRFG : PRESENT_WX_044
SQ : PRESENT_WX_018
BLDU : PRESENT_WX_007

View file

@ -85,8 +85,10 @@ if [ -f /awips2/java/jre/lib/amd64/server/libjvm.so ]; then
fi fi
#run a loop for alertviz #run a loop for alertviz
while [ $exitVal -ne 0 ] count=0
while [ $exitVal -ne 0 -a $count -lt 10 ]
do do
count=`expr $count + 1`
curTime=`date +%Y%m%d_%H%M%S` curTime=`date +%Y%m%d_%H%M%S`
LOGFILE=${LOGDIR}/alertviz_${curTime}_console.log LOGFILE=${LOGDIR}/alertviz_${curTime}_console.log
export LOGFILE_ALERTVIZ=${LOGDIR}/alertviz_${curTime}_admin.log export LOGFILE_ALERTVIZ=${LOGDIR}/alertviz_${curTime}_admin.log

View file

@ -28,6 +28,8 @@
# cave sessions. # cave sessions.
# Dec 05, 2013 #2590 dgilling Modified so gfeclient.sh can be wrapped # Dec 05, 2013 #2590 dgilling Modified so gfeclient.sh can be wrapped
# around this script. # around this script.
# Jan 24, 2014 #2739 bsteffen Log exit status
# Jan 30, 2014 #2593 bclement warns based on memory usage, fixed for INI files with spaces
# #
# #
@ -45,6 +47,8 @@ JAVA_INSTALL="/awips2/java"
PYTHON_INSTALL="/awips2/python" PYTHON_INSTALL="/awips2/python"
export AWIPS_INSTALL_DIR="${CAVE_INSTALL}" export AWIPS_INSTALL_DIR="${CAVE_INSTALL}"
MAX_MEM_PROPORTION="0.9"
source ${CAVE_INSTALL}/caveUtil.sh source ${CAVE_INSTALL}/caveUtil.sh
RC=$? RC=$?
if [ ${RC} -ne 0 ]; then if [ ${RC} -ne 0 ]; then
@ -61,6 +65,9 @@ copyVizShutdownUtilIfNecessary
# delete any old disk caches in the background # delete any old disk caches in the background
deleteOldCaveDiskCaches & deleteOldCaveDiskCaches &
# Enable core dumps
ulimit -c unlimited
export LD_LIBRARY_PATH=${JAVA_INSTALL}/lib:${PYTHON_INSTALL}/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=${JAVA_INSTALL}/lib:${PYTHON_INSTALL}/lib:$LD_LIBRARY_PATH
export LD_PRELOAD=libpython.so export LD_PRELOAD=libpython.so
if [[ -z "$CALLED_EXTEND_LIB_PATH" ]]; then if [[ -z "$CALLED_EXTEND_LIB_PATH" ]]; then
@ -109,20 +116,39 @@ export TEXTWS=`hostname | sed -e 's/lx/xt/g'`
hostName=`hostname -s` hostName=`hostname -s`
if [[ $hostName =~ xt.* ]]; then
export IGNORE_NUM_CAVES=1
fi
# check number of running caves # check number of running caves
if [[ -z $IGNORE_NUM_CAVES ]]; then if [[ -z $IGNORE_NUM_CAVES ]]; then
# free usually reports below on G threshold (11 instead of 12G), giving the 3 cave recommended in field # get total memory on system in bytes
mem=( `free -g | grep "Mem:"` ) mem=( `free -b | grep "Mem:"` )
mem=${mem[1]} mem=${mem[1]}
let _maxCaves=mem/3 # get max amount of system memory used before we warn
memThreshold=$(echo "$mem * $MAX_MEM_PROPORTION" | bc)
# remove decimal
printf -v memThreshold "%.0f" "$memThreshold"
# get launcher.ini argument determined by user arguments
lookupINI "$@"
launcherRegex='--launcher.ini\s(.+\.ini)'
# default to cave.ini
targetIni="/awips2/cave/cave.ini"
if [[ $CAVE_INI_ARG =~ $launcherRegex ]]
then
targetIni="${BASH_REMATCH[1]}"
fi
# read max memory that could be used by this instance
memOfLaunchingCave=$(readMemFromIni "$targetIni")
# read total max memory of caves already running
getTotalMemOfRunningCaves
# add them together
_totalAfterStart=$(($memOfLaunchingCave + $_totalRunningMem))
if [[ "$_totalAfterStart" -ge "$memThreshold" ]]; then
# convert to megs for display
memOfLaunchingCave=$(($memOfLaunchingCave / $BYTES_IN_MB))
_totalRunningMem=$(($_totalRunningMem / $BYTES_IN_MB))
getPidsOfMyRunningCaves getPidsOfMyRunningCaves
if [[ "$_numPids" -ge "$_maxCaves" ]]; then memMsg="$_numPids CAVE applications already running with a combined max memory of ${_totalRunningMem}MB. "
zenity --question --title "Max CAVE sessions already running" --text "$_numPids CAVE sessions already running. Starting more may impact system performance and stability.\n\nProceed?" memMsg+="The requested application has a max memory requirement of ${memOfLaunchingCave}MB. "
memMsg+="Starting may impact system performance and stability.\n\nProceed?"
zenity --question --title "Low Available Memory for Application" --text "$memMsg"
cancel="$?" cancel="$?"
if [[ "$cancel" == "1" ]]; then if [[ "$cancel" == "1" ]]; then
@ -172,9 +198,13 @@ if [ ! -d $LOGDIR ]; then
mkdir -p $LOGDIR mkdir -p $LOGDIR
fi fi
export pid=$$
curTime=`date +%Y%m%d_%H%M%S` curTime=`date +%Y%m%d_%H%M%S`
# At this point fork so that log files can be set up with the process pid and
# this process can log the exit status of cave.
(
export pid=`/bin/bash -c 'echo $PPID'`
LOGFILE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_console.log" LOGFILE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_console.log"
export LOGFILE_CAVE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_alertviz.log" export LOGFILE_CAVE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_alertviz.log"
export LOGFILE_PERFORMANCE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_perf.log" export LOGFILE_PERFORMANCE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_perf.log"
@ -213,8 +243,14 @@ if [[ "${runMonitorThreads}" == "true" ]] ; then
fi fi
if [[ "${redirect}" == "true" ]] ; then if [[ "${redirect}" == "true" ]] ; then
exec ${CAVE_INSTALL}/cave ${ARCH_ARGS} ${SWITCHES} ${CAVE_INI_ARG} "${USER_ARGS[@]}" > ${LOGFILE} 2>&1 exec ${CAVE_INSTALL}/cave ${ARCH_ARGS} ${SWITCHES} "${CAVE_INI_ARG}" "${USER_ARGS[@]}" > ${LOGFILE} 2>&1
else else
exec ${CAVE_INSTALL}/cave ${ARCH_ARGS} ${SWITCHES} ${CAVE_INI_ARG} "${USER_ARGS[@]}" 2>&1 | tee ${LOGFILE} exec ${CAVE_INSTALL}/cave ${ARCH_ARGS} ${SWITCHES} "${CAVE_INI_ARG}" "${USER_ARGS[@]}" 2>&1 | tee ${LOGFILE}
fi fi
) &
pid=$!
LOGFILE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_console.log"
logExitStatus $pid $LOGFILE

View file

@ -25,6 +25,10 @@
# Dec 05, 2013 #2593 rjpeter Fix getPidsOfMyRunningCaves # Dec 05, 2013 #2593 rjpeter Fix getPidsOfMyRunningCaves
# Dec 05, 2013 #2590 dgilling Modified extendLibraryPath() to export a # Dec 05, 2013 #2590 dgilling Modified extendLibraryPath() to export a
# var if it's already been run. # var if it's already been run.
# Jan 24, 2014 #2739 bsteffen Add method to log exit status of process.
# Jan 30, 2014 #2593 bclement extracted generic part of getPidsOfMyRunningCaves into forEachRunningCave
# added methods for reading max memory from .ini files
# fixes for INI files with spaces
# #
# #
@ -39,6 +43,10 @@ fi
# This script will be sourced by cave.sh. # This script will be sourced by cave.sh.
export CAVE_INI_ARG= export CAVE_INI_ARG=
BYTES_IN_KB=1024
BYTES_IN_MB=1048576
BYTES_IN_GB=1073741824
function lookupINI() function lookupINI()
{ {
# Arguments: # Arguments:
@ -55,7 +63,7 @@ function lookupINI()
position=$(( $position + 1 )) position=$(( $position + 1 ))
nextArg=${!position} nextArg=${!position}
retrieveAssociatedINI ${arg} ${nextArg} retrieveAssociatedINI ${arg} "${nextArg}"
RC=$? RC=$?
if [ ${RC} -eq 0 ]; then if [ ${RC} -eq 0 ]; then
export CAVE_INI_ARG="--launcher.ini /awips2/cave/${ASSOCIATED_INI}" export CAVE_INI_ARG="--launcher.ini /awips2/cave/${ASSOCIATED_INI}"
@ -116,8 +124,8 @@ function copyVizShutdownUtilIfNecessary()
chmod a+x ${HOME}/.kde/shutdown/${VIZ_UTILITY_SCRIPT} chmod a+x ${HOME}/.kde/shutdown/${VIZ_UTILITY_SCRIPT}
} }
# returns _numPids and array _pids containing the pids of the currently running cave sessions. # takes a function as an argument and calls the function passing in the ps string of the process
function getPidsOfMyRunningCaves() function forEachRunningCave()
{ {
local user=`whoami` local user=`whoami`
local caveProcs=`ps -ef | grep -E "(/awips2/cave|/usr/local/viz)/cave " | grep -v "grep" | grep $user` local caveProcs=`ps -ef | grep -E "(/awips2/cave|/usr/local/viz)/cave " | grep -v "grep" | grep $user`
@ -125,17 +133,89 @@ function getPidsOfMyRunningCaves()
# preserve IFS and set it to line feed only # preserve IFS and set it to line feed only
local PREV_IFS=$IFS local PREV_IFS=$IFS
IFS=$'\n' IFS=$'\n'
_numPids=0
# grab the pids for future use
for caveProc in $caveProcs for caveProc in $caveProcs
do do
_pids[$_numPids]=`echo $caveProc | awk '{print $2}'` "$@" $caveProc
let "_numPids+=1"
done done
IFS=$PREV_IFS IFS=$PREV_IFS
} }
# takes in ps string of cave process, stores pid in _pids and increments _numPids
function processPidOfCave()
{
_pids[$_numPids]=`echo $1 | awk '{print $2}'`
let "_numPids+=1"
}
# returns _numPids and array _pids containing the pids of the currently running cave sessions.
function getPidsOfMyRunningCaves()
{
_numPids=0
forEachRunningCave processPidOfCave
}
# takes a name of an ini file as an argument, echos the memory (in bytes) from file (or default)
function readMemFromIni()
{
local inifile="$1"
local mem
local unit
local regex='^[^#]*-Xmx([0-9]+)([bBkKmMgG])?'
# read ini file line by line looking for Xmx arg
while read -r line
do
if [[ $line =~ $regex ]]
then
mem=${BASH_REMATCH[1]}
unit=${BASH_REMATCH[2]}
break
fi
done < "$inifile"
# convert to bytes
case "$unit" in
[kK])
mem=$(($mem * $BYTES_IN_KB))
;;
[mM])
mem=$(($mem * $BYTES_IN_MB))
;;
[gG])
mem=$(($mem * $BYTES_IN_GB))
;;
esac
regex='^[0-9]+$'
if [[ ! $mem =~ $regex ]]
then
# we couldn't find a valid Xmx value
# java default is usually 1G
mem=1073741824
fi
echo $mem
}
# takes in ps string of cave process, reads Xmx from ini and adds bytes to _totalRunninMem
function addMemOfCave()
{
local inifile
# get ini file from process string
local regex='--launcher.ini\s(.+\.ini)'
if [[ $1 =~ $regex ]]
then
inifile="${BASH_REMATCH[1]}"
else
inifile="/awips2/cave/cave.ini"
fi
let "_totalRunningMem+=$(readMemFromIni "$inifile")"
}
# finds total max memory of running caves in bytes and places it in _totalRunningMem
function getTotalMemOfRunningCaves()
{
_totalRunningMem=0
forEachRunningCave addMemOfCave
}
function deleteOldCaveDiskCaches() function deleteOldCaveDiskCaches()
{ {
local curDir=`pwd` local curDir=`pwd`
@ -193,3 +273,28 @@ function deleteOldCaveDiskCaches()
cd $curDir cd $curDir
} }
# log the exit status and time to a log file, requires 2 args pid and log file
function logExitStatus()
{
pid=$1
logFile=$2
trap 'kill $pid' SIGHUP SIGINT SIGQUIT SIGTERM
wait $pid
exitCode=$?
curTime=`date --rfc-3339=seconds`
echo Exited at $curTime with an exit status of $exitCode >> $logFile
# If a core file was generated attempt to save it to a better place
coreFile=core.$pid
if [ -f "$coreFile" ]; then
basePath="/data/fxa/cave"
hostName=`hostname -s`
hostPath="$basePath/$hostName/"
mkdir -p $hostPath
if [ -d "$hostPath" ]; then
cp $coreFile $hostPath
fi
fi
}

View file

@ -81,6 +81,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* archive and category directory and * archive and category directory and
* implementation of compression. * implementation of compression.
* Oct 08, 2013 2442 rferrel Remove category directory. * Oct 08, 2013 2442 rferrel Remove category directory.
* Feb 04, 2013 2270 rferrel Move HDF files to parent's directory.
* *
* </pre> * </pre>
* *
@ -89,6 +90,10 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
*/ */
public class GenerateCaseDlg extends CaveSWTDialog { public class GenerateCaseDlg extends CaveSWTDialog {
/** Extension for HDF files. */
private static final String hdfExt = ".h5";
private final IUFStatusHandler statusHandler = UFStatus private final IUFStatusHandler statusHandler = UFStatus
.getHandler(GenerateCaseDlg.class); .getHandler(GenerateCaseDlg.class);
@ -539,6 +544,11 @@ public class GenerateCaseDlg extends CaveSWTDialog {
new File(destination, file)); new File(destination, file));
} }
} else { } else {
// DR 2270 bump HDF files up a directory.
if (destination.getName().endsWith(hdfExt)) {
destination = new File(destination.getParentFile()
.getParentFile(), destination.getName());
}
FileUtil.copyFile(source, destination); FileUtil.copyFile(source, destination);
destination.setLastModified(source.lastModified()); destination.setLastModified(source.lastModified());
} }
@ -652,6 +662,13 @@ public class GenerateCaseDlg extends CaveSWTDialog {
addTarFiles(file.listFiles()); addTarFiles(file.listFiles());
} }
} else { } else {
// DR 2270 bump HDF files up a directory.
if (name.endsWith(hdfExt)) {
File destination = new File(file.getParentFile()
.getParentFile(), file.getName());
name = destination.getAbsolutePath().substring(
startRelativePath);
}
TarArchiveEntry entry = new TarArchiveEntry(file, name); TarArchiveEntry entry = new TarArchiveEntry(file, name);
entry.setSize(file.length()); entry.setSize(file.length());
FileInputStream fileStream = null; FileInputStream fileStream = null;

View file

@ -21,10 +21,6 @@
package com.raytheon.uf.viz.core; package com.raytheon.uf.viz.core;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
@ -52,6 +48,7 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
* Jan 14, 2013 1469 bkowal Removed the hdf5 data directory. * Jan 14, 2013 1469 bkowal Removed the hdf5 data directory.
* Aug 27, 2013 2295 bkowal Removed the jms server property; added * Aug 27, 2013 2295 bkowal Removed the jms server property; added
* jms connection string * jms connection string
* Feb 17, 2014 2812 njensen getHostName() now uses getWsId()'s hostname
* *
* </pre> * </pre>
* *
@ -255,45 +252,20 @@ public final class VizApp {
private static String host = null; private static String host = null;
/** /**
* Gets the ip address of the host machine calling the function * Gets the host name from the WsId of the host machine calling the function
* *
* @return * @return
*/ */
public static synchronized String getHostName() { public static synchronized String getHostName() {
if (host == null) { if (host == null) {
InetAddress addrToUse = null; host = getWsId().getHostName();
boolean found = false; if (host == null) {
try {
Enumeration<NetworkInterface> nis = NetworkInterface
.getNetworkInterfaces();
while (nis.hasMoreElements() && !found) {
NetworkInterface ni = nis.nextElement();
ni.isVirtual();
ni.isUp();
Enumeration<InetAddress> addrs = ni.getInetAddresses();
while (addrs.hasMoreElements() && !found) {
InetAddress addr = addrs.nextElement();
if (addr.isLinkLocalAddress() == false
&& addr.isSiteLocalAddress() == false
&& addr.isLoopbackAddress() == false) {
addrToUse = addr;
found = true;
}
}
}
} catch (SocketException e) {
e.printStackTrace();
}
if (addrToUse == null) {
String hostname = System.getenv("HOSTNAME"); String hostname = System.getenv("HOSTNAME");
if (hostname != null && hostname.trim().length() == 0) { if (hostname != null && hostname.trim().length() > 0) {
host = hostname; host = hostname;
} else { } else {
host = "localhost"; host = "localhost";
} }
} else {
host = addrToUse.getHostName();
} }
} }
return host; return host;

View file

@ -19,6 +19,10 @@
**/ **/
package com.raytheon.uf.viz.core.comm; package com.raytheon.uf.viz.core.comm;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.comm.IHttpsCredentialsHandler; import com.raytheon.uf.common.comm.IHttpsCredentialsHandler;
import com.raytheon.uf.viz.core.auth.UserController; import com.raytheon.uf.viz.core.auth.UserController;
@ -34,6 +38,7 @@ import com.raytheon.uf.viz.core.auth.UserController;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Mar 04, 2013 1786 mpduff Initial creation. * Mar 04, 2013 1786 mpduff Initial creation.
* Jun 07, 2013 1981 mpduff Save user's username in UserController. * Jun 07, 2013 1981 mpduff Save user's username in UserController.
* Feb 10, 2014 2704 njensen Added credentialsFailed()
* *
* </pre> * </pre>
* *
@ -59,4 +64,11 @@ public class CaveHttpsCredentialsHandler implements IHttpsCredentialsHandler {
UserController.updateUserData(credentials[0]); UserController.updateUserData(credentials[0]);
return credentials; return credentials;
} }
@Override
public void credentialsFailed() {
MessageDialog.openError(new Shell(Display.getDefault()),
"Login failed",
"Invalid username and/or password. Please try again.");
}
} }

View file

@ -20,9 +20,7 @@
package com.raytheon.uf.viz.core.comm; package com.raytheon.uf.viz.core.comm;
import java.net.URI; import java.net.URI;
import java.text.SimpleDateFormat;
import java.util.Collections; import java.util.Collections;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -55,7 +53,8 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
* Mar 22, 2013 1786 mpduff Changed to use HttpClient for * Mar 22, 2013 1786 mpduff Changed to use HttpClient for
* connectivity. * connectivity.
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking. * Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Jan 15, 2013 njensen Added printConnectivityProblems() * Jan 15, 2014 njensen Added printConnectivityProblems()
* Feb 04, 2014 2704 njensen Check JMS capability, return exceptions with results
* *
* </pre> * </pre>
* *
@ -77,9 +76,16 @@ public class ConnectivityManager {
public String server; public String server;
public Exception exception;
public ConnectivityResult(boolean hc, String server) { public ConnectivityResult(boolean hc, String server) {
this(hc, server, null);
}
public ConnectivityResult(boolean hc, String server, Exception e) {
this.hasConnectivity = hc; this.hasConnectivity = hc;
this.server = server; this.server = server;
this.exception = e;
} }
} }
@ -94,6 +100,7 @@ public class ConnectivityManager {
public static void checkHttpServer(String server, public static void checkHttpServer(String server,
IConnectivityCallback callback) { IConnectivityCallback callback) {
boolean good = false; boolean good = false;
Exception exc = null;
try { try {
HttpClient client = HttpClient.getInstance(); HttpClient client = HttpClient.getInstance();
HttpGet request = new HttpGet(); HttpGet request = new HttpGet();
@ -101,9 +108,9 @@ public class ConnectivityManager {
client.executeRequest(request); client.executeRequest(request);
good = true; good = true;
} catch (Exception e) { } catch (Exception e) {
printConnectivityProblem(server, "http", e); exc = e;
} }
callback.connectionChecked(new ConnectivityResult(good, server)); callback.connectionChecked(new ConnectivityResult(good, server, exc));
} }
/** /**
@ -115,12 +122,13 @@ public class ConnectivityManager {
public static void checkLocalizationServer(String server, public static void checkLocalizationServer(String server,
IConnectivityCallback callback) { IConnectivityCallback callback) {
boolean good = false; boolean good = false;
Exception exc = null;
try { try {
good = checkLocalizationServer(server, true) != null; good = checkLocalizationServer(server, true) != null;
} catch (Exception e) { } catch (Exception e) {
printConnectivityProblem(server, "localization", e); exc = e;
} }
callback.connectionChecked(new ConnectivityResult(good, server)); callback.connectionChecked(new ConnectivityResult(good, server, exc));
} }
/** /**
@ -142,47 +150,49 @@ public class ConnectivityManager {
.sendRequest(req, server); .sendRequest(req, server);
getServersResponseCache.put(server, resp); getServersResponseCache.put(server, resp);
return resp; return resp;
} }
/** /**
* Checks the connectivity of the given server * Checks the connectivity of the given alert service
* *
* @param server * @param server
* server to check * server to check
* @return whether quit was selected. TODO: need to return two booleans, one * @return whether quit was selected. TODO: need to return two booleans, one
* for quit and one for connectivity * for quit and one for connectivity
*/ */
public static void checkJmsServer(String server, public static void checkAlertService(String server,
IConnectivityCallback callback) { IConnectivityCallback callback) {
boolean good = true; boolean good = true;
Exception exc = null;
try { try {
ActiveMQConnectionFactory f = new ActiveMQConnectionFactory(server); ActiveMQConnectionFactory f = new ActiveMQConnectionFactory(server);
f.createConnection().close(); f.createConnection().close();
} catch (JMSException e) { } catch (JMSException e) {
printConnectivityProblem(server, "JMS", e); exc = e;
good = false; good = false;
} }
callback.connectionChecked(new ConnectivityResult(good, server)); callback.connectionChecked(new ConnectivityResult(good, server, exc));
} }
/** /**
* Prints the connectivity exception to the console, to help with diagnosing * Checks the connectivity of the given JMS server
* connection issues
* *
* @param server * @param connectionString
* the server address it attempted to connect to * @param callback
* @param serverType
* the type of server it attempted to connect to
* @param e
* the exception that occurred
*/ */
private static void printConnectivityProblem(String server, public static void checkJmsServer(String connectionString,
String serverType, Exception e) { IConnectivityCallback callback) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); boolean good = true;
System.out.println(sdf.format(new Date()) + " MAY NOT BE AN ERROR:"); Exception exc = null;
System.out.println("Couldn't connect to " + serverType + " server at " try {
+ server); JMSConnection jms = new JMSConnection(connectionString);
e.printStackTrace(System.out); jms.getFactory().createConnection().close();
} catch (JMSException e) {
exc = e;
good = false;
} }
callback.connectionChecked(new ConnectivityResult(good,
connectionString, exc));
}
} }

View file

@ -42,7 +42,8 @@ import org.eclipse.ui.PlatformUI;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Mar 6, 2013 1786 mpduff Initial creation * Mar 06, 2013 1786 mpduff Initial creation
* Feb 10, 2014 2704 njensen Allow message to expand size of dialog
* *
* </pre> * </pre>
* *
@ -50,6 +51,7 @@ import org.eclipse.ui.PlatformUI;
* @version 1.0 * @version 1.0
*/ */
public class HttpsLoginDlg extends Dialog { public class HttpsLoginDlg extends Dialog {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Shell shell; private Shell shell;
@ -76,7 +78,7 @@ public class HttpsLoginDlg extends Dialog {
*/ */
public HttpsLoginDlg(String message) { public HttpsLoginDlg(String message) {
super(new Shell(Display.getDefault(), SWT.TITLE)); super(new Shell(Display.getDefault(), SWT.TITLE));
this.message = message; this.message = message.replace("\"", "");
} }
/** /**
@ -112,7 +114,9 @@ public class HttpsLoginDlg extends Dialog {
comp.setLayout(new GridLayout(2, false)); comp.setLayout(new GridLayout(2, false));
GridData gd = new GridData(SWT.RIGHT, SWT.None, true, true); GridData gd = new GridData(SWT.RIGHT, SWT.None, true, true);
if (message == null || message.length() < 50) {
gd.widthHint = 500; gd.widthHint = 500;
}
gd.horizontalSpan = 2; gd.horizontalSpan = 2;
Label authMessage = new Label(comp, SWT.CENTER); Label authMessage = new Label(comp, SWT.CENTER);

View file

@ -19,11 +19,17 @@
**/ **/
package com.raytheon.uf.viz.core.localization; package com.raytheon.uf.viz.core.localization;
import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.PrintStream;
import java.net.UnknownHostException;
import java.util.regex.Pattern;
import org.apache.http.conn.HttpHostConnectException;
import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPersistentPreferenceStore; import org.eclipse.jface.preference.IPersistentPreferenceStore;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.VerifyEvent; import org.eclipse.swt.events.VerifyEvent;
@ -41,6 +47,8 @@ import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.common.comm.HttpServerException;
import com.raytheon.uf.common.comm.InvalidURIException;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
@ -58,6 +66,9 @@ import com.raytheon.uf.viz.core.comm.IConnectivityCallback;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 05, 2009 mschenke Initial creation * Aug 05, 2009 mschenke Initial creation
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking. * Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Feb 04, 2014 2704 njensen Shifted some private fields/methods to protected,
* Added status and details, better site validation
* Feb 17, 2014 2704 njensen Changed some alertviz fields to protected
* *
* </pre> * </pre>
* *
@ -66,16 +77,23 @@ import com.raytheon.uf.viz.core.comm.IConnectivityCallback;
*/ */
public class ConnectivityPreferenceDialog extends Dialog { public class ConnectivityPreferenceDialog extends Dialog {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(ConnectivityPreferenceDialog.class, "CAVE"); .getHandler(ConnectivityPreferenceDialog.class, "CAVE");
protected static final Pattern VALID_SITENAME = Pattern
.compile("^[A-Za-z0-9._-]+$");
private class LocalizationCallback implements IConnectivityCallback { private class LocalizationCallback implements IConnectivityCallback {
@Override @Override
public void connectionChecked(ConnectivityResult results) { public void connectionChecked(ConnectivityResult results) {
localizationGood = results.hasConnectivity; localizationGood = results.hasConnectivity;
appendDetails(buildDetails(results));
if (!results.hasConnectivity && status == null) {
status = buildErrorMessage(results);
}
} }
} }
private class AlertVizCallback implements IConnectivityCallback { private class AlertVizCallback implements IConnectivityCallback {
@ -83,31 +101,32 @@ public class ConnectivityPreferenceDialog extends Dialog {
@Override @Override
public void connectionChecked(ConnectivityResult results) { public void connectionChecked(ConnectivityResult results) {
alertVizGood = results.hasConnectivity; alertVizGood = results.hasConnectivity;
appendDetails(buildDetails(results));
if (!results.hasConnectivity && status == null) {
status = buildErrorMessage(results);
}
} }
} }
/**
* Set time dialog shell
*/
private Shell shell; private Shell shell;
/** /**
* Display component * Display component
*/ */
private Display display; protected Display display;
private Label localizationLabel; private Label localizationLabel;
private Text localizationText; protected Text localizationText;
private String localization = ""; private String localization = "";
private boolean localizationGood = false; private boolean localizationGood = false;
private Text alertVizText; protected Text alertVizText;
private String alertVizServer = null; protected String alertVizServer = null;
private boolean alertVizGood = true; private boolean alertVizGood = true;
@ -115,10 +134,16 @@ public class ConnectivityPreferenceDialog extends Dialog {
private String site = ""; private String site = "";
private Text siteText; protected Text siteText;
private Label statusLabel;
private boolean canceled = false; private boolean canceled = false;
private Composite detailsComp;
private StyledText detailsText;
private IConnectivityCallback localizationCallback = new LocalizationCallback(); private IConnectivityCallback localizationCallback = new LocalizationCallback();
private IConnectivityCallback alertCallback = new AlertVizCallback(); private IConnectivityCallback alertCallback = new AlertVizCallback();
@ -126,14 +151,20 @@ public class ConnectivityPreferenceDialog extends Dialog {
/** /**
* Title of the dialog. * Title of the dialog.
*/ */
private static final String dialogTitle = "Connectivity Preferences"; private String title;
public ConnectivityPreferenceDialog(boolean checkAlertViz) { protected String status;
this(new Shell(Display.getDefault()), checkAlertViz);
protected String details;
public ConnectivityPreferenceDialog(boolean checkAlertViz, String title) {
this(new Shell(Display.getDefault()), checkAlertViz, title);
} }
public ConnectivityPreferenceDialog(Shell parentShell, boolean checkAlertViz) { public ConnectivityPreferenceDialog(Shell parentShell,
boolean checkAlertViz, String title) {
super(parentShell); super(parentShell);
this.title = title;
localization = LocalizationManager.getInstance() localization = LocalizationManager.getInstance()
.getLocalizationServer(); .getLocalizationServer();
site = LocalizationManager.getInstance().getSite(); site = LocalizationManager.getInstance().getSite();
@ -155,8 +186,8 @@ public class ConnectivityPreferenceDialog extends Dialog {
if (!validate()) { if (!validate()) {
Shell parent = getParent(); Shell parent = getParent();
display = parent.getDisplay(); display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM); shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE);
shell.setText(dialogTitle); shell.setText(title);
// Create the main layout for the shell. // Create the main layout for the shell.
GridLayout mainLayout = new GridLayout(1, true); GridLayout mainLayout = new GridLayout(1, true);
@ -165,6 +196,9 @@ public class ConnectivityPreferenceDialog extends Dialog {
initializeComponents(); initializeComponents();
shell.pack(); shell.pack();
shell.setMinimumSize(shell.getBounds().width,
shell.getBounds().height);
updateStatus(false, status, details);
shell.open(); shell.open();
while (!shell.isDisposed()) { while (!shell.isDisposed()) {
@ -177,16 +211,69 @@ public class ConnectivityPreferenceDialog extends Dialog {
} }
private void initializeComponents() { private void initializeComponents() {
createErrorText();
Composite textBoxComp = new Composite(shell, SWT.NONE); Composite textBoxComp = new Composite(shell, SWT.NONE);
textBoxComp.setLayout(new GridLayout(2, false)); textBoxComp.setLayout(new GridLayout(2, false));
createTextBoxes(textBoxComp); createTextBoxes(textBoxComp);
createStatusText();
createBottomButtons(); createBottomButtons();
} }
private void createErrorText() { /**
Label label = new Label(shell, SWT.CENTER); * Creates the status label, text, and details button
label.setText("Error: Unable to connect to localization server"); */
protected void createStatusText() {
Composite comp = new Composite(shell, SWT.NONE);
comp.setLayout(new GridLayout(3, false));
comp.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
Label lbl = new Label(comp, SWT.NONE);
lbl.setText("Status:");
GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
statusLabel = new Label(comp, SWT.BORDER);
statusLabel.setLayoutData(gd);
statusLabel.setText("");
final Button detailsButton = new Button(comp, SWT.TOGGLE);
detailsButton.setText("Details");
detailsButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (detailsComp.isVisible()) {
((GridData) detailsComp.getLayoutData()).exclude = true;
detailsComp.setVisible(false);
shell.pack();
} else {
((GridData) detailsComp.getLayoutData()).exclude = false;
((GridData) detailsComp.getLayoutData()).widthHint = detailsComp
.getBounds().width;
detailsComp.setVisible(true);
shell.pack();
}
}
});
createDetailsText();
}
/**
* Creates the expanding details text
*/
protected void createDetailsText() {
detailsComp = new Composite(shell, SWT.NONE);
detailsComp.setLayout(new GridLayout(1, false));
detailsComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.heightHint = 150;
detailsText = new StyledText(detailsComp, SWT.BORDER | SWT.MULTI
| SWT.H_SCROLL | SWT.V_SCROLL);
detailsText.setText("");
detailsText.setLayoutData(gd);
/*
* Hide the composite
*/
((GridData) detailsComp.getLayoutData()).exclude = true;
detailsComp.setVisible(false);
} }
protected void createTextBoxes(Composite textBoxComp) { protected void createTextBoxes(Composite textBoxComp) {
@ -194,12 +281,12 @@ public class ConnectivityPreferenceDialog extends Dialog {
localizationLabel = new Label(textBoxComp, SWT.RIGHT); localizationLabel = new Label(textBoxComp, SWT.RIGHT);
localizationLabel.setText("Localization Server:"); localizationLabel.setText("Localization Server:");
GridData gd = new GridData(SWT.RIGHT, SWT.None, true, true); GridData gd = new GridData(SWT.RIGHT, SWT.CENTER, true, true);
gd.widthHint = 150; gd.widthHint = 150;
localizationLabel.setLayoutData(gd); localizationLabel.setLayoutData(gd);
localizationText = new Text(textBoxComp, SWT.NONE); localizationText = new Text(textBoxComp, SWT.BORDER);
gd = new GridData(SWT.RIGHT, SWT.None, true, true); gd = new GridData(SWT.LEFT, SWT.None, true, true);
gd.widthHint = 300; gd.widthHint = 300;
localizationText.setLayoutData(gd); localizationText.setLayoutData(gd);
localizationText.setText(localization == null ? "" : localization); localizationText.setText(localization == null ? "" : localization);
@ -207,17 +294,18 @@ public class ConnectivityPreferenceDialog extends Dialog {
Label label = new Label(textBoxComp, SWT.RIGHT); Label label = new Label(textBoxComp, SWT.RIGHT);
label.setText("Site:"); label.setText("Site:");
gd = new GridData(SWT.RIGHT, SWT.None, true, true); gd = new GridData(SWT.RIGHT, SWT.CENTER, true, true);
gd.widthHint = 150; gd.widthHint = 150;
label.setLayoutData(gd); label.setLayoutData(gd);
siteText = new Text(textBoxComp, SWT.NONE); siteText = new Text(textBoxComp, SWT.BORDER);
siteText.addVerifyListener(new VerifyListener() { siteText.addVerifyListener(new VerifyListener() {
@Override
public void verifyText(VerifyEvent e) { public void verifyText(VerifyEvent e) {
e.text = e.text.toUpperCase(); e.text = e.text.toUpperCase();
} }
}); });
gd = new GridData(SWT.RIGHT, SWT.None, true, true); gd = new GridData(SWT.LEFT, SWT.None, true, true);
gd.widthHint = 300; gd.widthHint = 300;
siteText.setLayoutData(gd); siteText.setLayoutData(gd);
siteText.setText(site == null ? "" : site); siteText.setText(site == null ? "" : site);
@ -299,7 +387,7 @@ public class ConnectivityPreferenceDialog extends Dialog {
shell.setVisible(false); shell.setVisible(false);
MessageDialog MessageDialog
.openError( .openError(
null, shell,
"Connectivity Error", "Connectivity Error",
"Unable to validate localization preferences, please enter valid options or quit the application"); "Unable to validate localization preferences, please enter valid options or quit the application");
shell.setVisible(true); shell.setVisible(true);
@ -327,6 +415,8 @@ public class ConnectivityPreferenceDialog extends Dialog {
} }
public boolean validate() { public boolean validate() {
status = null;
details = null;
if (localizationText != null && !localizationText.isDisposed() if (localizationText != null && !localizationText.isDisposed()
&& localizationText.isEnabled()) { && localizationText.isEnabled()) {
String localization = localizationText.getText().trim(); String localization = localizationText.getText().trim();
@ -360,20 +450,28 @@ public class ConnectivityPreferenceDialog extends Dialog {
} else { } else {
validateSite(); validateSite();
} }
return siteGood && localizationGood && alertVizGood;
boolean everythingGood = siteGood && localizationGood && alertVizGood;
updateStatus(everythingGood, status, details);
return everythingGood;
} }
private void validateLocalization() { private void validateLocalization() {
ConnectivityManager.checkLocalizationServer(localization, localizationCallback); ConnectivityManager.checkLocalizationServer(localization,
localizationCallback);
} }
private void validateAlertviz() { protected void validateAlertviz() {
ConnectivityManager.checkJmsServer(alertVizServer, alertCallback); ConnectivityManager.checkAlertService(alertVizServer, alertCallback);
} }
private void validateSite() { protected void validateSite() {
if (site == null || site.trim().equals("")) { if (site == null || site.trim().length() == 0
|| !VALID_SITENAME.matcher(site).find()) {
siteGood = false; siteGood = false;
if (status == null) {
status = "Invalid Site ID";
}
} else { } else {
siteGood = true; siteGood = true;
} }
@ -387,6 +485,20 @@ public class ConnectivityPreferenceDialog extends Dialog {
} }
} }
/**
* Gets the color for the status label
*
* @param isGood
* @return
*/
protected Color getForegroundColor(boolean isGood) {
if (isGood) {
return display.getSystemColor(SWT.COLOR_DARK_GREEN);
} else {
return display.getSystemColor(SWT.COLOR_DARK_RED);
}
}
public String getLocalization() { public String getLocalization() {
return localization; return localization;
} }
@ -438,4 +550,118 @@ public class ConnectivityPreferenceDialog extends Dialog {
localizationText.setEnabled(enabled); localizationText.setEnabled(enabled);
} }
} }
/**
* Builds a details string based on a stacktrace of connectivity results. If
* there is no exception with the results, this returns the empty string.
*
* @param results
* @return
*/
protected String buildDetails(ConnectivityResult results) {
StringBuilder sb = new StringBuilder();
if (results.exception != null) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
results.exception.printStackTrace(ps);
String stack = baos.toString();
ps.close();
sb.append(stack);
}
return sb.toString();
}
/**
* Adds new details to the details field without overwriting it
*
* @param newDetails
*/
protected void appendDetails(String newDetails) {
if (details == null) {
details = "";
}
if (details.length() > 0) {
details += "\n\n\n";
}
details += newDetails;
}
/**
* Creates an error message for the status label by attempting to find the
* most relevant error message from the exception's stacktrace.
*
* @param result
* @return
*/
protected String buildErrorMessage(ConnectivityResult result) {
StringBuilder sb = new StringBuilder();
Exception prettyErrExc = result.exception;
/*
* Loop through the Caused Bys and try to find one that is the most
* useful for the label. This is totally arbitrary and corresponds to
* what njensen predicted would be most useful.
*/
while (prettyErrExc != null) {
if (prettyErrExc instanceof HttpHostConnectException
|| prettyErrExc instanceof InvalidURIException) {
sb.append(prettyErrExc.getMessage());
break;
}
if (prettyErrExc instanceof UnknownHostException) {
sb.append("Unknown host: " + prettyErrExc.getMessage());
break;
} else if (prettyErrExc instanceof HttpServerException) {
sb.append("Server returned Error ");
String emsg = prettyErrExc.getMessage();
int titleIndex = emsg.indexOf("<title>");
if (titleIndex > -1) {
String httpMsg = emsg.substring(titleIndex + 7,
emsg.indexOf("</title>"));
sb.append(httpMsg);
} else {
int statusCode = ((HttpServerException) prettyErrExc)
.getStatusCode();
sb.append(statusCode);
break;
}
}
prettyErrExc = (Exception) prettyErrExc.getCause();
}
if (sb.length() == 0) {
if (result.exception != null
&& result.exception.getMessage() != null) {
sb.append(result.exception.getMessage());
} else {
sb.append("Connectivity Error");
}
}
return sb.toString();
}
/**
* Updates the status label and details of the connectivity dialog
*
* @param good
* @param status
* @param details
*/
protected void updateStatus(boolean good, String status, String details) {
if (statusLabel != null && !statusLabel.isDisposed()
&& detailsText != null && !detailsText.isDisposed()) {
statusLabel.setForeground(getForegroundColor(good));
detailsText.setText(details != null ? details : "");
if (good) {
statusLabel.setText("Successful connection");
} else {
if (status != null) {
statusLabel.setText(status);
} else {
// shoudln't be able to reach this but just in case
statusLabel.setText("Connection error");
}
}
}
}
} }

View file

@ -52,6 +52,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking. * Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Aug 27, 2013 2295 bkowal The entire jms connection string is now * Aug 27, 2013 2295 bkowal The entire jms connection string is now
* provided by EDEX. * provided by EDEX.
* Feb 04, 2014 2704 njensen Pass connectivity dialog title
* *
* </pre> * </pre>
* *
@ -108,7 +109,7 @@ public class LocalizationInitializer {
protected void setupServers() throws VizException { protected void setupServers() throws VizException {
if (promptUI) { if (promptUI) {
ConnectivityPreferenceDialog dlg = new ConnectivityPreferenceDialog( ConnectivityPreferenceDialog dlg = new ConnectivityPreferenceDialog(
checkAlertviz); checkAlertviz, "Connectivity Preferences");
if (dlg.open() == true) { if (dlg.open() == true) {
System.exit(0); System.exit(0);
} }

View file

@ -96,6 +96,7 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking. * Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Aug 27, 2013 2295 bkowal The entire jms connection string is now * Aug 27, 2013 2295 bkowal The entire jms connection string is now
* provided by EDEX. * provided by EDEX.
* Feb 04, 2014 2704 njensen Allow setting server without saving
* Feb 06, 2014 2761 mnash Add region localization level * Feb 06, 2014 2761 mnash Add region localization level
* *
* </pre> * </pre>
@ -233,15 +234,35 @@ public class LocalizationManager implements IPropertyChangeListener {
} }
} }
/**
* Sets the localization server and saves the setting
*
* @param currentServer
* the localization URI
*/
public void setCurrentServer(String currentServer) { public void setCurrentServer(String currentServer) {
setCurrentServer(currentServer, true);
}
/**
* Sets the localization server
*
* @param currentServer
* the localization URI
* @param save
* whether or not to save the setting
*/
public void setCurrentServer(String currentServer, boolean save) {
if (!this.currentServer.equals(currentServer)) { if (!this.currentServer.equals(currentServer)) {
this.currentServer = currentServer; this.currentServer = currentServer;
if (!overrideServer) { if (!overrideServer) {
localizationStore.putValue( localizationStore.putValue(
LocalizationConstants.P_LOCALIZATION_HTTP_SERVER, LocalizationConstants.P_LOCALIZATION_HTTP_SERVER,
this.currentServer); this.currentServer);
if (save) {
applyChanges(); applyChanges();
} }
}
try { try {
GetServersResponse resp = ConnectivityManager GetServersResponse resp = ConnectivityManager

View file

@ -236,7 +236,7 @@ public class LocalizationPreferences extends FieldEditorPreferencePage
if (alertEditor != null) { if (alertEditor != null) {
text = alertEditor.getTextControl(getFieldEditorParent()); text = alertEditor.getTextControl(getFieldEditorParent());
ConnectivityManager.checkJmsServer(text.getText().trim(), ConnectivityManager.checkAlertService(text.getText().trim(),
new IConnectivityCallback() { new IConnectivityCallback() {
@Override @Override
public void connectionChecked(ConnectivityResult results) { public void connectionChecked(ConnectivityResult results) {
@ -260,6 +260,7 @@ public class LocalizationPreferences extends FieldEditorPreferencePage
* @see * @see
* org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) * org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
*/ */
@Override
public void init(IWorkbench workbench) { public void init(IWorkbench workbench) {
} }

View file

@ -86,7 +86,7 @@ public class LocalizationServerEditor extends StringFieldEditor implements
ConnectivityManager.checkHttpServer(this.getTextControl().getText(), ConnectivityManager.checkHttpServer(this.getTextControl().getText(),
this); this);
} else { } else {
ConnectivityManager.checkJmsServer(this.getTextControl().getText(), ConnectivityManager.checkAlertService(this.getTextControl().getText(),
this); this);
} }
if (!good) { if (!good) {

View file

@ -20,19 +20,18 @@
package com.raytheon.uf.viz.core.reflect; package com.raytheon.uf.viz.core.reflect;
import java.io.File; import java.io.File;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.regex.Pattern;
import org.osgi.framework.Bundle; import org.osgi.framework.Bundle;
import org.osgi.framework.Constants; import org.osgi.framework.namespace.BundleNamespace;
import org.osgi.framework.namespace.PackageNamespace;
import org.osgi.framework.wiring.BundleWire;
import org.osgi.framework.wiring.BundleWiring; import org.osgi.framework.wiring.BundleWiring;
import org.reflections.scanners.SubTypesScanner; import org.reflections.scanners.SubTypesScanner;
@ -56,6 +55,7 @@ import com.raytheon.uf.viz.core.Activator;
* Oct 18, 2013 2491 bsteffen Initial creation * Oct 18, 2013 2491 bsteffen Initial creation
* Dec 10, 2013 2602 bsteffen Add null checks to detect unloaded * Dec 10, 2013 2602 bsteffen Add null checks to detect unloaded
* bundles. * bundles.
* Feb 03, 2013 2764 bsteffen Use OSGi API to get dependencies.
* *
* </pre> * </pre>
* *
@ -68,15 +68,11 @@ public class SubClassLocator implements ISubClassLocator {
private static final String CACHE_FILENAME = "subclassCache.txt"; private static final String CACHE_FILENAME = "subclassCache.txt";
private static final Pattern COMMA_SPLIT = Pattern.compile("[,]");
private static final Pattern SEMICOLON_SPLIT = Pattern.compile("[;]");
private final Map<String, BundleReflections> reflectionLookup = new HashMap<String, BundleReflections>(); private final Map<String, BundleReflections> reflectionLookup = new HashMap<String, BundleReflections>();
private final Map<String, Bundle> bundleLookup = new HashMap<String, Bundle>(); private final Map<String, Bundle> bundleLookup = new HashMap<String, Bundle>();
private final Map<String, List<Bundle>> requiredBundles = new HashMap<String, List<Bundle>>(); private final Map<String, Collection<Bundle>> requiredBundles = new HashMap<String, Collection<Bundle>>();
private final BundleClassCache cache; private final BundleClassCache cache;
@ -167,7 +163,8 @@ public class SubClassLocator implements ISubClassLocator {
Set<Class<?>> dependencies = getRequiredSubclasses(base, bundle, Set<Class<?>> dependencies = getRequiredSubclasses(base, bundle,
recursiveClasses); recursiveClasses);
/* Must pass dependencies in so type heirarchy is complete. */ /* Must pass dependencies in so type heirarchy is complete. */
Set<Class<?>> owned = loadSubClassesReflectively(bundle, dependencies); Set<Class<?>> owned = loadSubClassesReflectively(bundle,
dependencies);
/* populate the cache */ /* populate the cache */
ownedNames = new String[owned.size()]; ownedNames = new String[owned.size()];
int index = 0; int index = 0;
@ -188,8 +185,7 @@ public class SubClassLocator implements ISubClassLocator {
Arrays.asList(ownedNames)); Arrays.asList(ownedNames));
if (includeRequiredSubclasses) { if (includeRequiredSubclasses) {
Set<Class<?>> dependencies = getRequiredSubclasses(base, Set<Class<?>> dependencies = getRequiredSubclasses(base,
bundle, bundle, recursiveClasses);
recursiveClasses);
Set<Class<?>> all = new HashSet<Class<?>>(dependencies); Set<Class<?>> all = new HashSet<Class<?>>(dependencies);
all.addAll(owned); all.addAll(owned);
recursiveClasses.put(bundleName, all); recursiveClasses.put(bundleName, all);
@ -287,31 +283,32 @@ public class SubClassLocator implements ISubClassLocator {
} }
/** /**
* Parse bundle header to get all required bundles * Get back all the bundles this bundle depends on.
* *
* @param bundle * @param bundle
* the bundle * the bundle
* @return bundles required by bundle. * @return bundles required by bundle.
*/ */
private List<Bundle> getRequiredBundles(Bundle bundle) { private Collection<Bundle> getRequiredBundles(Bundle bundle) {
String bundleName = bundle.getSymbolicName(); String bundleName = bundle.getSymbolicName();
List<Bundle> required = requiredBundles.get(bundle); Collection<Bundle> required = requiredBundles.get(bundleName);
if (required == null) { if (required == null) {
required = new ArrayList<Bundle>(); required = new HashSet<Bundle>();
String requiredBundlesHeader = bundle.getHeaders().get( BundleWiring bundleWiring = bundle.adapt(BundleWiring.class);
Constants.REQUIRE_BUNDLE); if (bundleWiring != null) {
if (requiredBundlesHeader != null) { /* Get Required bundles */
String[] requiredBundles = COMMA_SPLIT for (BundleWire bw : bundleWiring
.split(requiredBundlesHeader); .getRequiredWires(BundleNamespace.BUNDLE_NAMESPACE)) {
for (String requiredBundleName : requiredBundles) { required.add(bw.getProviderWiring().getBundle());
String[] nameParts = SEMICOLON_SPLIT }
.split(requiredBundleName); /* Get Bundles through import package */
Bundle reqBundle = bundleLookup.get(nameParts[0]); for (BundleWire bw : bundleWiring
if (reqBundle != null) { .getRequiredWires(PackageNamespace.PACKAGE_NAMESPACE)) {
required.add(reqBundle); required.add(bw.getProviderWiring().getBundle());
}
} }
} }
/* Avoid recursion */
required.remove(bundle);
requiredBundles.put(bundleName, required); requiredBundles.put(bundleName, required);
} }

View file

@ -36,6 +36,7 @@ import org.geotools.referencing.crs.DefaultGeographicCRS;
import org.opengis.referencing.operation.MathTransform; import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.TransformException; import org.opengis.referencing.operation.TransformException;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
import com.raytheon.uf.common.geospatial.CRSCache; import com.raytheon.uf.common.geospatial.CRSCache;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
@ -64,13 +65,16 @@ import com.vividsolutions.jts.geom.Coordinate;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ----------- -----------------------------------------
* Aug 8, 2012 mschenke Initial creation * Aug 08, 2012 mschenke Initial creation
* May 28, 2013 2037 njensen Made imageMap concurrent to fix leak * May 28, 2013 2037 njensen Made imageMap concurrent to fix leak
* Jun 20, 2013 2122 mschenke Fixed null pointer in interrogate and made * Jun 20, 2013 2122 mschenke Fixed null pointer in interrogate and
* canceling jobs safer * made canceling jobs safer
* Oct 16, 2013 2333 mschenke Added auto NaN checking for interrogation * Oct 16, 2013 2333 mschenke Added auto NaN checking for interrogation
* Nov 14, 2013 2492 mschenke Added more interrogate methods that take units * Nov 14, 2013 2492 mschenke Added more interrogate methods that take
* units
* Feb 07, 2014 2211 bsteffen Fix sampling units when data mapping is
* enabled.
* *
* </pre> * </pre>
* *
@ -539,55 +543,65 @@ public class TileSetRenderable implements IRenderable {
public double interrogate(Coordinate coordinate, Unit<?> resultUnit, public double interrogate(Coordinate coordinate, Unit<?> resultUnit,
double nanValue) throws VizException { double nanValue) throws VizException {
double dataValue = Double.NaN; double dataValue = Double.NaN;
TileLevel level = tileSet.getTileLevel(lastPaintedLevel);
double[] grid = null;
try { try {
double[] local = new double[2]; double[] local = new double[2];
llToLocalProj llToLocalProj
.transform(new double[] { coordinate.x, coordinate.y }, 0, .transform(new double[] { coordinate.x, coordinate.y }, 0,
local, 0, 1); local, 0, 1);
double localX = local[0]; grid = level.crsToGrid(local[0], local[1]);
double localY = local[1]; } catch (TransformException e) {
throw new VizException("Error interrogating ", e);
}
IColormappedImage cmapImage = null;
TileLevel level = tileSet.getTileLevel(lastPaintedLevel);
double[] grid = level.crsToGrid(localX, localY);
Tile tile = level.getTile(grid[0], grid[1]); Tile tile = level.getTile(grid[0], grid[1]);
if (tile != null) { if (tile != null) {
DrawableImage di = imageMap.get(tile); DrawableImage di = imageMap.get(tile);
if (di != null) { if (di != null) {
IImage image = di.getImage(); IImage image = di.getImage();
if (image instanceof IColormappedImage) { if (image instanceof IColormappedImage) {
IColormappedImage cmapImage = (IColormappedImage) image; cmapImage = (IColormappedImage) image;
dataValue = cmapImage.getValue( }
(int) grid[0] % tileSize, (int) grid[1] }
% tileSize); }
if (cmapImage != null) {
dataValue = cmapImage.getValue((int) grid[0] % tileSize,
(int) grid[1] % tileSize);
if (dataValue == nanValue) { if (dataValue == nanValue) {
dataValue = Double.NaN; dataValue = Double.NaN;
} else { } else {
ColorMapParameters parameters = cmapImage
.getColorMapParameters();
Unit<?> dataUnit = cmapImage.getDataUnit(); Unit<?> dataUnit = cmapImage.getDataUnit();
if (parameters.getDataMapping() != null) {
/*
* Ignore dataUnit, use colorMapUnit which is derived from
* the data mapping
*/
dataUnit = parameters.getColorMapUnit();
}
if (resultUnit != null && dataUnit != null if (resultUnit != null && dataUnit != null
&& dataUnit.equals(resultUnit) == false) { && dataUnit.equals(resultUnit) == false) {
if (resultUnit.isCompatible(dataUnit)) { if (resultUnit.isCompatible(dataUnit)) {
dataValue = dataUnit.getConverterTo( dataValue = dataUnit.getConverterTo(resultUnit)
resultUnit).convert(dataValue); .convert(dataValue);
} else { } else {
throw new IllegalArgumentException( UnitFormat uf = UnitFormat.getUCUMInstance();
"Unable to interrogate tile set. " String message = String
+ String.format( .format("Unable to interrogate tile set. Desired unit (%s) is not compatible with data unit (%s).",
"Desired unit (%s) is not compatible with data unit (%s).", uf.format(resultUnit),
UnitFormat uf.format(dataUnit));
.getUCUMInstance() throw new IllegalArgumentException(message);
.format(resultUnit),
UnitFormat
.getUCUMInstance()
.format(dataUnit)));
} }
} }
} }
} }
}
}
} catch (TransformException e) {
throw new VizException("Error interrogating ", e);
}
return dataValue; return dataValue;
} }
} }

View file

@ -43,11 +43,11 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.BinOffset; import com.raytheon.uf.common.time.BinOffset;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.DisplayType; import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.ResourceType; import com.raytheon.uf.viz.core.rsc.ResourceType;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
import com.raytheon.uf.viz.productbrowser.AbstractRequestableProductBrowserDataDefinition; import com.raytheon.uf.viz.productbrowser.AbstractRequestableProductBrowserDataDefinition;
import com.raytheon.uf.viz.productbrowser.ProductBrowserLabel; import com.raytheon.uf.viz.productbrowser.ProductBrowserLabel;
import com.raytheon.uf.viz.productbrowser.ProductBrowserPreference; import com.raytheon.uf.viz.productbrowser.ProductBrowserPreference;
@ -74,6 +74,7 @@ import com.raytheon.viz.pointdata.util.PointDataInventory;
* Nov 19, 2013 2458 mpduff Only pull subscriptions for the local site * Nov 19, 2013 2458 mpduff Only pull subscriptions for the local site
* Nov 21, 2013 2554 dhladky Restored ADHOC's to working. * Nov 21, 2013 2554 dhladky Restored ADHOC's to working.
* Jan 14, 2014 2459 mpduff Change Subscription status code * Jan 14, 2014 2459 mpduff Change Subscription status code
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
* *
* </pre> * </pre>
* *
@ -439,8 +440,8 @@ public class DataDeliveryProductBrowserDataDefinition
final ISubscriptionHandler handler = RegistryObjectHandlers final ISubscriptionHandler handler = RegistryObjectHandlers
.get(ISubscriptionHandler.class); .get(ISubscriptionHandler.class);
try { try {
subList = handler.getByFilters(null, LocalizationManager subList = handler.getByFilters(null,
.getInstance().getCurrentSite()); DataDeliveryUtils.getDataDeliveryId());
} catch (RegistryHandlerException e) { } catch (RegistryHandlerException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
} }

View file

@ -26,7 +26,6 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI; import org.eclipse.ui.PlatformUI;
import com.raytheon.uf.viz.datadelivery.bandwidth.ui.BandwidthUtilizationDlg; import com.raytheon.uf.viz.datadelivery.bandwidth.ui.BandwidthUtilizationDlg;
import com.raytheon.uf.viz.datadelivery.bandwidth.ui.GraphDataUtil;
/** /**
* Action handler for the bandwidth scheduling graph. * Action handler for the bandwidth scheduling graph.
@ -40,6 +39,7 @@ import com.raytheon.uf.viz.datadelivery.bandwidth.ui.GraphDataUtil;
* Nov 25, 2012 1269 mpduff Initial creation. * Nov 25, 2012 1269 mpduff Initial creation.
* Dec 13, 2012 1269 lvenable Updated to use a graph utility for the graph data. * Dec 13, 2012 1269 lvenable Updated to use a graph utility for the graph data.
* Oct 28, 2013 2430 mpduff Removed redraw if already open. * Oct 28, 2013 2430 mpduff Removed redraw if already open.
* Jan 29, 2014 2722 mpduff Don't get graph data up front.
* *
* </pre> * </pre>
* *
@ -58,11 +58,9 @@ public class BandwidthScheduleGraphAction extends AbstractHandler {
@Override @Override
public Object execute(ExecutionEvent event) throws ExecutionException { public Object execute(ExecutionEvent event) throws ExecutionException {
if (dlg == null || dlg.isDisposed()) { if (dlg == null || dlg.isDisposed()) {
GraphDataUtil gdu = new GraphDataUtil(null);
gdu.retrieveData();
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell(); .getShell();
dlg = new BandwidthUtilizationDlg(shell, gdu); dlg = new BandwidthUtilizationDlg(shell);
dlg.open(); dlg.open();
} else { } else {
dlg.open(); dlg.open();

View file

@ -31,11 +31,11 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.auth.UserController; import com.raytheon.uf.viz.core.auth.UserController;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices; import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices;
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionManagerFilter; import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionManagerFilter;
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerDlg; import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerDlg;
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerFilters; import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerFilters;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
/** /**
* Subscription Manager Dialog Action class. * Subscription Manager Dialog Action class.
@ -51,6 +51,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerFilters;
* May 28, 2013 1650 djohnson Allow using filters for the Subscription Manager Dialog. * May 28, 2013 1650 djohnson Allow using filters for the Subscription Manager Dialog.
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions. * Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
* Sep 04, 2013 2330 bgonzale execute now filters subscriptions by current site id. * Sep 04, 2013 2330 bgonzale execute now filters subscriptions by current site id.
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
* *
* *
* </pre> * </pre>
@ -81,7 +82,7 @@ public class SubscriptionManagerAction extends AbstractHandler {
@Override @Override
public Object execute(ExecutionEvent arg0) { public Object execute(ExecutionEvent arg0) {
return loadSubscriptionManager(SubscriptionManagerFilters return loadSubscriptionManager(SubscriptionManagerFilters
.getBySiteId(LocalizationManager.getInstance().getCurrentSite())); .getBySiteId(DataDeliveryUtils.getDataDeliveryId()));
} }
/** /**

View file

@ -103,7 +103,8 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* Nov 19, 2013 1531 mpduff Made graph resizable. * Nov 19, 2013 1531 mpduff Made graph resizable.
* Nov 25, 2013 2545 mpduff Default to Opsnet if Network not available yet. * Nov 25, 2013 2545 mpduff Default to Opsnet if Network not available yet.
* Dec 17, 2013 2633 mpduff Fix redraw problems.. * Dec 17, 2013 2633 mpduff Fix redraw problems..
* Jan 09, 2013 2633 mpduff On resize keep graph at bottom so data are always visible. * Jan 09, 2014 2633 mpduff On resize keep graph at bottom so data are always visible.
* Jan 29, 2014 2722 mpduff Changed how graph data are requested.
* </pre> * </pre>
* *
* @author lvenable * @author lvenable
@ -250,13 +251,13 @@ public class BandwidthCanvasComp extends Composite implements IDialogClosed,
* @param graphDataUtil * @param graphDataUtil
* Bandwidth graph data object * Bandwidth graph data object
*/ */
public BandwidthCanvasComp(Composite parentComp, GraphDataUtil graphDataUtil) { public BandwidthCanvasComp(Composite parentComp) {
super(parentComp, SWT.BORDER); super(parentComp, SWT.BORDER);
this.parentComp = parentComp; this.parentComp = parentComp;
this.display = this.parentComp.getDisplay(); this.display = this.parentComp.getDisplay();
this.graphDataUtil = graphDataUtil; this.graphDataUtil = new GraphDataUtil(this);
this.bgd = this.graphDataUtil.getGraphData(false); this.bgd = this.graphDataUtil.getGraphData();
init(); init();
} }
@ -265,7 +266,6 @@ public class BandwidthCanvasComp extends Composite implements IDialogClosed,
* Initialize method. * Initialize method.
*/ */
private void init() { private void init() {
this.graphDataUtil.setDataUpdateCallback(this);
NotificationManagerJob.addObserver("notify.msg", this); NotificationManagerJob.addObserver("notify.msg", this);
this.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); this.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
@ -1409,7 +1409,7 @@ public class BandwidthCanvasComp extends Composite implements IDialogClosed,
* @param graphData * @param graphData
* Bandwidth graph data. * Bandwidth graph data.
*/ */
public void setGraphData(BandwidthGraphData graphData) { private void setGraphData(BandwidthGraphData graphData) {
this.bgd = graphData; this.bgd = graphData;
generateCanvasSettings(); generateCanvasSettings();
@ -1527,14 +1527,15 @@ public class BandwidthCanvasComp extends Composite implements IDialogClosed,
// Do a full update every 10 minutes // Do a full update every 10 minutes
if (fullUpdateMinuteCount > 10) { if (fullUpdateMinuteCount > 10) {
graphDataUtil.requestGraphDataUsingThread(); graphDataUtil.requestGraphDataUsingThread();
fullUpdateMinuteCount = 0;
} }
} }
} }
} }
/** /**
* This method will update the subscription table with any updates, * This method will update the graph with any updates, deletions, or new
* deletions, or new subscriptions. * subscriptions.
*/ */
@Override @Override
public void notificationArrived(NotificationMessage[] messages) { public void notificationArrived(NotificationMessage[] messages) {
@ -1559,7 +1560,7 @@ public class BandwidthCanvasComp extends Composite implements IDialogClosed,
VizApp.runAsync(new Runnable() { VizApp.runAsync(new Runnable() {
@Override @Override
public void run() { public void run() {
setGraphData(graphDataUtil.getGraphData(true)); setGraphData(graphDataUtil.getGraphData());
updateCanvasSettings(); updateCanvasSettings();
updateCanvases(); updateCanvases();
layout(); layout();

View file

@ -53,6 +53,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Dec 13, 2012 1269 lvenable Fixes and updates. * Dec 13, 2012 1269 lvenable Fixes and updates.
* Oct 28, 2013 2430 mpduff Add % of bandwidth utilized graph. * Oct 28, 2013 2430 mpduff Add % of bandwidth utilized graph.
* Nov 19, 2013 1531 mpduff Made resizable. * Nov 19, 2013 1531 mpduff Made resizable.
* Jan 29, 2014 2722 mpduff GraphDataUtil not in this class.
* *
* </pre> * </pre>
* *
@ -77,9 +78,6 @@ public class BandwidthUtilizationDlg extends CaveSWTDialog {
/** Graph composite */ /** Graph composite */
private BandwidthCanvasComp canvasComp; private BandwidthCanvasComp canvasComp;
/** Graph data utility class */
private final GraphDataUtil graphDataUtil;
private MenuItem displayOpsNetMI; private MenuItem displayOpsNetMI;
private MenuItem displaySbnMI; private MenuItem displaySbnMI;
@ -92,12 +90,10 @@ public class BandwidthUtilizationDlg extends CaveSWTDialog {
* @param graphDataUtil * @param graphDataUtil
* Graph data utility object * Graph data utility object
*/ */
public BandwidthUtilizationDlg(Shell parent, GraphDataUtil graphDataUtil) { public BandwidthUtilizationDlg(Shell parent) {
super(parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.RESIZE, CAVE.DO_NOT_BLOCK super(parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.RESIZE, CAVE.DO_NOT_BLOCK
| CAVE.INDEPENDENT_SHELL); | CAVE.INDEPENDENT_SHELL);
setText("Bandwidth Utilization"); setText("Bandwidth Utilization");
this.graphDataUtil = graphDataUtil;
} }
/** /**
@ -133,7 +129,7 @@ public class BandwidthUtilizationDlg extends CaveSWTDialog {
mainComp.setLayout(gl); mainComp.setLayout(gl);
mainComp.setLayoutData(gd); mainComp.setLayoutData(gd);
canvasComp = new BandwidthCanvasComp(mainComp, graphDataUtil); canvasComp = new BandwidthCanvasComp(mainComp);
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false); gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
gl = new GridLayout(1, false); gl = new GridLayout(1, false);

View file

@ -46,6 +46,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* Dec 12, 2012 1269 lvenable Initial creation * Dec 12, 2012 1269 lvenable Initial creation
* Feb 14, 2013 1596 djohnson Remove sysouts, correct statusHandler class, handle null response. * Feb 14, 2013 1596 djohnson Remove sysouts, correct statusHandler class, handle null response.
* Mar 26, 2013 1827 djohnson Graph data should be requested from data delivery. * Mar 26, 2013 1827 djohnson Graph data should be requested from data delivery.
* Jan 29, 2014 2722 mpduff Callback is now passed in.
* *
* </pre> * </pre>
* *
@ -67,7 +68,7 @@ public class GraphDataUtil implements Runnable {
private BandwidthGraphData graphData; private BandwidthGraphData graphData;
/** Callback called when the data has been updated */ /** Callback called when the data has been updated */
private IDataUpdated dataUpdatedCB; private final IDataUpdated dataUpdatedCB;
/** Executor service used for the threaded data retrieval */ /** Executor service used for the threaded data retrieval */
private final ExecutorService service = Executors.newSingleThreadExecutor(); private final ExecutorService service = Executors.newSingleThreadExecutor();
@ -83,21 +84,10 @@ public class GraphDataUtil implements Runnable {
this.dataUpdatedCB = dataUpdatedCB; this.dataUpdatedCB = dataUpdatedCB;
} }
/**
* Set the updated data callback.
*
* @param dataUpdatedCB
* Call back called when the data has been updated via separate
* thread.
*/
public void setDataUpdateCallback(IDataUpdated dataUpdatedCB) {
this.dataUpdatedCB = dataUpdatedCB;
}
/** /**
* Perform a data retrieval on the UI thread. * Perform a data retrieval on the UI thread.
*/ */
public void retrieveData() { private void retrieveData() {
response = sendRequest(request); response = sendRequest(request);
if (response != null) { if (response != null) {
@ -115,10 +105,11 @@ public class GraphDataUtil implements Runnable {
* returning the data. * returning the data.
* @return Bandwidth graph data. * @return Bandwidth graph data.
*/ */
public BandwidthGraphData getGraphData(boolean newData) { public BandwidthGraphData getGraphData() {
if (newData || graphData == null) { if (graphData == null) {
retrieveData(); retrieveData();
} }
return graphData; return graphData;
} }

View file

@ -48,7 +48,6 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.util.FileUtil; import com.raytheon.uf.common.util.FileUtil;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.notification.NotificationMessage; import com.raytheon.uf.viz.core.notification.NotificationMessage;
import com.raytheon.uf.viz.datadelivery.common.ui.IDialogClosed; import com.raytheon.uf.viz.datadelivery.common.ui.IDialogClosed;
import com.raytheon.uf.viz.datadelivery.common.ui.SortImages.SortDirection; import com.raytheon.uf.viz.datadelivery.common.ui.SortImages.SortDirection;
@ -57,6 +56,7 @@ import com.raytheon.uf.viz.datadelivery.common.ui.TableComp;
import com.raytheon.uf.viz.datadelivery.common.ui.TableCompConfig; import com.raytheon.uf.viz.datadelivery.common.ui.TableCompConfig;
import com.raytheon.uf.viz.datadelivery.common.ui.TableDataManager; import com.raytheon.uf.viz.datadelivery.common.ui.TableDataManager;
import com.raytheon.uf.viz.datadelivery.common.ui.ViewDetailsDlg; import com.raytheon.uf.viz.datadelivery.common.ui.ViewDetailsDlg;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.BrowserColumnNames; import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.BrowserColumnNames;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE; import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
@ -85,6 +85,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
* Feb 15, 2013 1638 mschenke Moved Util.EOL into FileUtil * Feb 15, 2013 1638 mschenke Moved Util.EOL into FileUtil
* Apr 10, 2013 1891 djohnson Declare variable as List. * Apr 10, 2013 1891 djohnson Declare variable as List.
* Sep 11, 2013 2352 mpduff Add siteId to getSubscribedToDataSetNames method. * Sep 11, 2013 2352 mpduff Add siteId to getSubscribedToDataSetNames method.
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
* *
* </pre> * </pre>
* *
@ -627,7 +628,7 @@ public class BrowserTableComp extends TableComp implements IDialogClosed {
try { try {
datasetNames = DataDeliveryHandlers.getSubscriptionHandler() datasetNames = DataDeliveryHandlers.getSubscriptionHandler()
.getSubscribedToDataSetNames( .getSubscribedToDataSetNames(
LocalizationManager.getInstance().getCurrentSite()); DataDeliveryUtils.getDataDeliveryId());
} catch (RegistryHandlerException e) { } catch (RegistryHandlerException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Unable to retrieve subscription dataset names!", e); "Unable to retrieve subscription dataset names!", e);

View file

@ -19,6 +19,10 @@
**/ **/
package com.raytheon.uf.viz.datadelivery.common.ui; package com.raytheon.uf.viz.datadelivery.common.ui;
import java.util.List;
import com.raytheon.uf.viz.datadelivery.notification.NotificationRowData;
/** /**
* Table find interface. * Table find interface.
* *
@ -30,6 +34,7 @@ package com.raytheon.uf.viz.datadelivery.common.ui;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* May 7, 2012 jpiatt Initial creation. * May 7, 2012 jpiatt Initial creation.
* Sep 26, 2013 2417 mpduff Add clearSelection method. * Sep 26, 2013 2417 mpduff Add clearSelection method.
* Feb 07, 2014 2453 mpduff Added getCurrentSelectionIndex method.
* </pre> * </pre>
* *
* @author jpiatt * @author jpiatt
@ -38,26 +43,34 @@ package com.raytheon.uf.viz.datadelivery.common.ui;
public interface ITableFind { public interface ITableFind {
/** /**
* handleFind call * handle page selection
*/ */
void handlePageSelection(); void handlePageSelection();
/** /**
* handleFind call * select a row
* *
* @param index * @param index
*/ */
void selectIndex(int index); void selectRow(NotificationRowData row);
/** /**
* handleFind call * handle multiple rows
* *
* @param indices * @param indices
*/ */
void selectIndices(int[] indices); void selectRows(List<NotificationRowData> rows);
/** /**
* Clear any table selections. * Clear any table selections.
*/ */
void clearSelections(); void clearSelections();
/**
* Get the currently selected index within the data array, not the visible
* table.
*
* @return
*/
int getCurrentSelectionIndex();
} }

View file

@ -30,6 +30,7 @@ package com.raytheon.uf.viz.datadelivery.common.ui;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jun 06, 2012 lvenable Initial creation * Jun 06, 2012 lvenable Initial creation
* Apr 10, 2013 1891 djohnson Declare variable as List. * Apr 10, 2013 1891 djohnson Declare variable as List.
* Feb 07, 2014 2453 mpduff Added getSize().
* *
* </pre> * </pre>
* *
@ -132,8 +133,7 @@ public class TableDataManager<T extends ITableData<T>> implements ISortTable {
public T getDataRow(int index) { public T getDataRow(int index) {
if (index >= 0 && index < tableData.size()) { if (index >= 0 && index < tableData.size()) {
return tableData.get(index); return tableData.get(index);
} } else {
else {
return tableData.get(0); return tableData.get(0);
} }
} }
@ -187,4 +187,13 @@ public class TableDataManager<T extends ITableData<T>> implements ISortTable {
public SortDirection getSortDirection() { public SortDirection getSortDirection() {
return currentSortDirection; return currentSortDirection;
} }
/**
* Get the size of the data array.
*
* @return The size
*/
public int getSize() {
return this.tableData.size();
}
} }

View file

@ -97,6 +97,7 @@ import com.raytheon.viz.ui.widgets.duallist.IUpdate;
* May 28, 2013 1650 djohnson More information when failing to schedule subscriptions. * May 28, 2013 1650 djohnson More information when failing to schedule subscriptions.
* Jun 13, 2013 2108 mpduff Refactored DataSizeUtils. * Jun 13, 2013 2108 mpduff Refactored DataSizeUtils.
* Oct 28, 2013 2292 mpduff Change overlap services. * Oct 28, 2013 2292 mpduff Change overlap services.
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
* </pre> * </pre>
* *
* @author jpiatt * @author jpiatt
@ -410,8 +411,7 @@ public class UserSelectComp extends Composite implements IUpdate, IDisplay,
subscription.setCoverage(cov); subscription.setCoverage(cov);
} }
subscription.addOfficeID(LocalizationManager.getInstance() subscription.addOfficeID(DataDeliveryUtils.getDataDeliveryId());
.getCurrentSite());
if (sizeUtils != null) { if (sizeUtils != null) {
subscription.setDataSetSize(sizeUtils subscription.setDataSetSize(sizeUtils
.getDataSetSizeInKb(subscription)); .getDataSetSizeInKb(subscription));

View file

@ -20,21 +20,18 @@
package com.raytheon.uf.viz.datadelivery.notification; package com.raytheon.uf.viz.datadelivery.notification;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout; import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Text;
@ -59,6 +56,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Dec 12. 2012 1418 mpduff Change label. * Dec 12. 2012 1418 mpduff Change label.
* Aug 30, 2013 2314 mpduff Fixed find, filter, and various other bugs. * Aug 30, 2013 2314 mpduff Fixed find, filter, and various other bugs.
* Sep 26, 2013 2417 mpduff Reset the highlight all indices on close. * Sep 26, 2013 2417 mpduff Reset the highlight all indices on close.
* Feb 07, 2014 2453 mpduff Refactored dialog.
* *
* </pre> * </pre>
* *
@ -95,41 +93,20 @@ public class FindDlg extends CaveSWTDialog {
/** ITableFind callback */ /** ITableFind callback */
private final ITableFind callback; private final ITableFind callback;
/** Table row Index */
int tableIndex = -1;
/** Table row start Index */
int startIndex = 0;
/** Table row end Index */
int endIndex = 0;
/** Table row selected Index */ /** Table row selected Index */
int selectedIndex = 0; private int selectedIndex = 0;
/** Message Checkbox flag */ /** Message Checkbox flag */
boolean msgFlag = false; private boolean msgFlag = false;
/** Category Checkbox flag */ /** Category Checkbox flag */
boolean categoryFlag = false; private boolean categoryFlag = false;
/** Case Sensitive flag */ /** Case Sensitive flag */
boolean caseFlag = false; private boolean caseFlag = false;
/** Yes continue search flag */
boolean yesFlag = false;
/** Found Item flag */
boolean exists = false;
/** Exclude search flag */ /** Exclude search flag */
boolean excludeFlag = false; private boolean excludeFlag = false;
/** Message string */
String msg = null;
/** Subscription string */
String sub = null;
/** /**
* Constructor. * Constructor.
@ -150,13 +127,11 @@ public class FindDlg extends CaveSWTDialog {
*/ */
public FindDlg(Shell parent, public FindDlg(Shell parent,
TableDataManager<NotificationRowData> filteredTableList, TableDataManager<NotificationRowData> filteredTableList,
int sIndex, int eIndex, int selected, ITableFind callback) { int selected, ITableFind callback) {
super(parent, SWT.DIALOG_TRIM, CAVE.NONE | CAVE.DO_NOT_BLOCK); super(parent, SWT.DIALOG_TRIM, CAVE.NONE | CAVE.DO_NOT_BLOCK);
this.setText("Find"); this.setText("Find");
this.filteredTableList = filteredTableList; this.filteredTableList = filteredTableList;
sIndex = startIndex;
eIndex = endIndex;
selectedIndex = selected; selectedIndex = selected;
this.callback = callback; this.callback = callback;
} }
@ -185,12 +160,6 @@ public class FindDlg extends CaveSWTDialog {
*/ */
@Override @Override
protected void initializeComponents(Shell shell) { protected void initializeComponents(Shell shell) {
shell.addListener(SWT.Close, new Listener() {
@Override
public void handleEvent(Event event) {
callback.selectIndices(null);
}
});
createFindLayout(); createFindLayout();
createBottomButtons(); createBottomButtons();
} }
@ -219,12 +188,6 @@ public class FindDlg extends CaveSWTDialog {
findTxt.setLayoutData(gd); findTxt.setLayoutData(gd);
findTxt.selectAll(); findTxt.selectAll();
findTxt.setLayoutData(gd); findTxt.setLayoutData(gd);
findTxt.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
findText();
}
});
gl = new GridLayout(2, false); gl = new GridLayout(2, false);
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false); gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
@ -314,89 +277,16 @@ public class FindDlg extends CaveSWTDialog {
closeBtn.addSelectionListener(new SelectionAdapter() { closeBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
callback.selectIndices(null);
close(); close();
} }
}); });
} }
/**
* Find text on key release. Check all pages of filtered list. Stop when
* match is found and don't move to the next.
*/
private void findText() {
// Text in the find text box
String text = findTxt.getText();
// Get button selections
msgFlag = msgBtn.getSelection();
categoryFlag = categoryBtn.getSelection();
caseFlag = caseBtn.getSelection();
excludeFlag = exclusionBtn.getSelection();
int itemCount = filteredTableList.getDataArray().size();
tableIndex = 0;
if (filteredTableList != null) {
// Check rows in the entire filtered list - all pages
for (NotificationRowData row : filteredTableList.getDataArray()) {
// Column data
msg = row.getMessage();
sub = row.getCategory();
if (tableIndex <= itemCount) {
tableIndex++;
if (caseFlag) {
if (excludeFlag) {
// Select index if does not match message or
// subscription
if ((!msg.contains(text) && msgFlag)
|| (!sub.contains(text) && categoryFlag)) {
exists = true;
callback.selectIndex(tableIndex);
break;
}
// Select index if matches message or subscription
} else if ((msg.contains(text) && msgFlag)
|| (sub.contains(text) && categoryFlag)) {
exists = true;
callback.selectIndex(tableIndex);
break;
}
} else {
if (excludeFlag) {
// Select index if matches non case sensitive
// message or subscription
if ((!msg.toUpperCase()
.contains(text.toUpperCase()) && msgFlag)
|| (!sub.toLowerCase().contains(
text.toLowerCase()) && categoryFlag)) {
exists = true;
callback.selectIndex(tableIndex);
break;
}
} else if ((msg.toUpperCase().contains(
text.toUpperCase()) && msgFlag)
|| (sub.toLowerCase().contains(
text.toLowerCase()) && categoryFlag)) {
exists = true;
callback.selectIndex(tableIndex);
break;
}
}
}
}
}
}
/** /**
* Find Button action handler. Find the next matching row upon button click. * Find Button action handler. Find the next matching row upon button click.
*/ */
private void handleFindBtn() { private void handleFindBtn() {
int prevSelectedIndex = selectedIndex;
// Text in the find text box // Text in the find text box
String text = findTxt.getText(); String text = findTxt.getText();
@ -420,56 +310,20 @@ public class FindDlg extends CaveSWTDialog {
boolean continueSearch = true; boolean continueSearch = true;
boolean exists = false; boolean exists = false;
boolean hitEnd = false; boolean hitEnd = false;
selectedIndex = selectedIndex + 1; selectedIndex = callback.getCurrentSelectionIndex() + 1;
while (continueSearch) { while (continueSearch) {
if (tableIndex < itemCount) { if (selectedIndex < itemCount) {
// Get the row data starting at the currently highlighted row
NotificationRowData row = filteredTableList.getDataArray().get( NotificationRowData row = filteredTableList.getDataArray().get(
tableIndex); selectedIndex);
// Column data boolean matchFound = checkForMatch(text, row);
msg = row.getMessage(); if (matchFound) {
sub = row.getCategory();
tableIndex++;
if (caseFlag) {
if (excludeFlag) {
// Select index if does not match message or
// subscription
if ((!msg.contains(text) && msgFlag)
|| (!sub.contains(text) && categoryFlag)) {
continueSearch = false; continueSearch = false;
callback.selectIndex(tableIndex);
}
} else if ((msg.contains(text) && msgFlag)
|| (sub.contains(text) && categoryFlag)) {
// Select index if matches message or subscription
continueSearch = false;
callback.selectIndex(tableIndex);
}
} else {
if (excludeFlag) {
// Select index if matches non case sensitive message or
// subscription
if ((!msg.toUpperCase().contains(text.toUpperCase()) && msgFlag)
|| (!sub.toLowerCase().contains(
text.toLowerCase()) && categoryFlag)) {
continueSearch = false;
callback.selectIndex(tableIndex);
}
} else if ((msg.toUpperCase().contains(text.toUpperCase()) && msgFlag)
|| (sub.toLowerCase().contains(text.toLowerCase()) && categoryFlag)) {
continueSearch = false;
callback.selectIndex(tableIndex);
}
}
// If the item was found set exists to true
if (!continueSearch) {
exists = true; exists = true;
callback.selectRow(row);
} }
selectedIndex++;
} else { } else {
if (!hitEnd) { if (!hitEnd) {
int answer = DataDeliveryUtils int answer = DataDeliveryUtils
@ -480,10 +334,11 @@ public class FindDlg extends CaveSWTDialog {
"The end of the table has been reached. Would you like to search from the beginning of the table?"); "The end of the table has been reached. Would you like to search from the beginning of the table?");
if (answer == SWT.NO) { if (answer == SWT.NO) {
exists = true; exists = true;
selectedIndex = prevSelectedIndex;
break; break;
// Start search over at beginning of table
} else if (answer == SWT.YES) { } else if (answer == SWT.YES) {
tableIndex = 0; // Start search over at beginning of table
selectedIndex = 0;
continueSearch = true; continueSearch = true;
} }
hitEnd = true; hitEnd = true;
@ -499,7 +354,7 @@ public class FindDlg extends CaveSWTDialog {
mb.setText("Find Warning"); mb.setText("Find Warning");
mb.setMessage("No item matching your search was found."); mb.setMessage("No item matching your search was found.");
mb.open(); mb.open();
tableIndex = 0; selectedIndex = prevSelectedIndex;
callback.clearSelections(); callback.clearSelections();
} }
} }
@ -509,7 +364,6 @@ public class FindDlg extends CaveSWTDialog {
* text. * text.
*/ */
private void handleHighlightBtn() { private void handleHighlightBtn() {
// Text in the find text box // Text in the find text box
String text = findTxt.getText(); String text = findTxt.getText();
@ -519,61 +373,54 @@ public class FindDlg extends CaveSWTDialog {
caseFlag = caseBtn.getSelection(); caseFlag = caseBtn.getSelection();
excludeFlag = exclusionBtn.getSelection(); excludeFlag = exclusionBtn.getSelection();
ArrayList<Integer> items = new ArrayList<Integer>(); List<NotificationRowData> items = new ArrayList<NotificationRowData>();
int[] indices = new int[0];
// Start search at beginning of table
tableIndex = 0;
if (filteredTableList != null) { if (filteredTableList != null) {
for (int i = 0; i < filteredTableList.getDataArray().size(); i++) { for (int i = 0; i < filteredTableList.getSize(); i++) {
NotificationRowData row = filteredTableList.getDataArray().get( NotificationRowData row = filteredTableList.getDataArray().get(
i); i);
// Message Column
msg = row.getMessage();
// Subscription Name column
sub = row.getCategory();
if (caseFlag) { boolean matchFound = checkForMatch(text, row);
if (matchFound) {
items.add(row);
}
}
callback.selectRows(items);
}
}
/**
* Check if the matchText matches the row.
*
* @param matchText
* The text to match
* @param row
* The row to check
* @return true if matches
*/
private boolean checkForMatch(String matchText, NotificationRowData row) {
boolean matchFound = false;
String msg = row.getMessage();
String sub = row.getCategory();
if (!caseFlag) {
msg = msg.toUpperCase();
sub = sub.toUpperCase();
matchText = matchText.toUpperCase();
}
if (excludeFlag) { if (excludeFlag) {
// Select index if does not match message or if ((!msg.contains(matchText) && msgFlag)
// subscription || (!sub.contains(matchText) && categoryFlag)) {
if ((!msg.contains(text) && msgFlag) matchFound = true;
|| (!sub.contains(text) && categoryFlag)) {
items.add(i);
} }
} else if ((msg.contains(text) && msgFlag)
|| (sub.contains(text) && categoryFlag)) {
// Select index if matches message or subscription
items.add(i);
}
} else { } else {
if (excludeFlag) { if ((msg.contains(matchText) && msgFlag)
// Select index if matches non case sensitive message or || (sub.contains(matchText) && categoryFlag)) {
// subscription matchFound = true;
if ((!msg.toUpperCase().contains(text.toUpperCase()) && msgFlag)
|| (!sub.toLowerCase().contains(
text.toLowerCase()) && categoryFlag)) {
items.add(i);
}
} else if ((msg.toUpperCase().contains(text.toUpperCase()) && msgFlag)
|| (sub.toLowerCase().contains(text.toLowerCase()) && categoryFlag)) {
items.add(i);
} }
} }
return matchFound;
tableIndex++;
}
indices = new int[items.size()];
// Create an int array of the rows to highlight
for (int i = 0; i < items.size(); i++) {
indices[i] = items.get(i);
}
callback.selectIndices(indices);
}
} }
} }

View file

@ -104,6 +104,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Aug 30, 2013 2314 mpduff Change the reading of the xml. Make load config dlg non-blocking. * Aug 30, 2013 2314 mpduff Change the reading of the xml. Make load config dlg non-blocking.
* Sep 25, 2013 2408 mpduff Added a restore hidden notifications menu. * Sep 25, 2013 2408 mpduff Added a restore hidden notifications menu.
* Sep 25, 2013 2410 mpduff Check type of localization file. * Sep 25, 2013 2410 mpduff Check type of localization file.
* Feb 07, 2013 2453 mpduff Support find dialog refactor..
* *
* </pre> * </pre>
* *
@ -394,7 +395,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
hideOlderMI.addSelectionListener(new SelectionAdapter() { hideOlderMI.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
tableComp.handleDeleteOlderThan(); tableComp.handleHideOlderThan();
} }
}); });
@ -405,7 +406,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
hideMI.addSelectionListener(new SelectionAdapter() { hideMI.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
tableComp.handleDeleteNotification(); tableComp.handleHideNotification();
} }
}); });
@ -493,7 +494,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
mi.addSelectionListener(new SelectionAdapter() { mi.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
tableComp.handleDeleteByPriority((Integer) ((MenuItem) e tableComp.handleHideByPriority((Integer) ((MenuItem) e
.getSource()).getData()); .getSource()).getData());
} }
}); });
@ -540,6 +541,17 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
id = Activator.imageDescriptorFromPlugin( id = Activator.imageDescriptorFromPlugin(
"com.raytheon.uf.viz.datadelivery", "icons/dd_new.png"); "com.raytheon.uf.viz.datadelivery", "icons/dd_new.png");
trayImg2 = id.createImage(); trayImg2 = id.createImage();
/*
* Check if the images are null.
*/
if (trayImg1 == null) {
System.out.println("*** Tray image 1 is null...");
} else {
System.out
.println("*** Tray image 1 is not null and should have an image...");
}
tray = display.getSystemTray(); tray = display.getSystemTray();
createTray(); createTray();
@ -572,8 +584,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
private void handleFind() { private void handleFind() {
if (fnd == null || fnd.isDisposed()) { if (fnd == null || fnd.isDisposed()) {
fnd = new FindDlg(shell, tableComp.getFilteredTableList(), fnd = new FindDlg(shell, tableComp.getFilteredTableList(),
tableComp.getStartIndex(), tableComp.getEndIndex(), tableComp.getTable().getSelectionIndex(), tableComp);
tableComp.getSelectedIndex(), tableComp);
fnd.open(); fnd.open();
} else { } else {
fnd.bringToTop(); fnd.bringToTop();
@ -839,7 +850,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
if (isDisposed() == false && tableComp.passesFilter(records)) { if (isDisposed() == false && tableComp.passesFilter(records)) {
tableComp.populateTableDataRows(records); tableComp.populateTableDataRows(records);
tableComp.populateTable(); tableComp.populateTable();
tableComp.handlePageSelection();
// update title display...... // update title display......
if (tableComp.isLocked()) { if (tableComp.isLocked()) {
setText(TITLE_TEXT + tableComp.getPauseCountLabel()); setText(TITLE_TEXT + tableComp.getPauseCountLabel());

View file

@ -40,6 +40,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
* Jun 07, 2012 687 lvenable Table data refactor. * Jun 07, 2012 687 lvenable Table data refactor.
* Aug 30, 2013 2314 mpduff Fix formatting. * Aug 30, 2013 2314 mpduff Fix formatting.
* Sep 16, 2013 2375 mpduff Change date sort order. * Sep 16, 2013 2375 mpduff Change date sort order.
* Feb 07, 2014 2453 mpduff Added toString()
* *
* </pre> * </pre>
* *
@ -299,4 +300,8 @@ public class NotificationRowData implements ITableData<NotificationRowData> {
} }
} }
@Override
public String toString() {
return this.date.toString() + " - " + this.message;
}
} }

View file

@ -144,6 +144,7 @@ import com.raytheon.viz.ui.presenter.components.ComboBoxConf;
* Nov 07, 2013 2291 skorolev Used showText() method for "Unable to Create Subscription" message. * Nov 07, 2013 2291 skorolev Used showText() method for "Unable to Create Subscription" message.
* Nov 08, 2013 2506 bgonzale Removed send notification when a subscription is updated and created. * Nov 08, 2013 2506 bgonzale Removed send notification when a subscription is updated and created.
* Jan 14, 2014 2459 mpduff Change Subscription status code * Jan 14, 2014 2459 mpduff Change Subscription status code
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
* *
* </pre> * </pre>
* *
@ -471,8 +472,7 @@ public class CreateSubscriptionDlg extends CaveSWTDialog {
btn.addSelectionListener(new SelectionAdapter() { btn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
String currentSite = LocalizationManager.getInstance() String currentSite = DataDeliveryUtils.getDataDeliveryId();
.getCurrentSite();
SiteSelectionDlg dlg = new SiteSelectionDlg(shell, currentSite, SiteSelectionDlg dlg = new SiteSelectionDlg(shell, currentSite,
sharedSites); sharedSites);
dlg.setCloseCallback(new ICloseCallback() { dlg.setCloseCallback(new ICloseCallback() {
@ -1030,7 +1030,7 @@ public class CreateSubscriptionDlg extends CaveSWTDialog {
subscription = sharedSub; subscription = sharedSub;
} else { } else {
Set<String> officeList = Sets.newHashSet(); Set<String> officeList = Sets.newHashSet();
officeList.add(LocalizationManager.getInstance().getCurrentSite()); officeList.add(DataDeliveryUtils.getDataDeliveryId());
subscription.setOfficeIDs(officeList); subscription.setOfficeIDs(officeList);
} }
@ -1540,8 +1540,7 @@ public class CreateSubscriptionDlg extends CaveSWTDialog {
*/ */
private void setSubscriptionId(Subscription sub) { private void setSubscriptionId(Subscription sub) {
if (sub.getOriginatingSite() == null) { if (sub.getOriginatingSite() == null) {
LocalizationManager lm = LocalizationManager.getInstance(); sub.setOriginatingSite(DataDeliveryUtils.getDataDeliveryId());
sub.setOriginatingSite(lm.getCurrentSite());
} }
String id = RegistryUtil.getRegistryObjectKey(sub); String id = RegistryUtil.getRegistryObjectKey(sub);
sub.setId(id); sub.setId(id);

View file

@ -41,10 +41,10 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.auth.UserController; import com.raytheon.uf.viz.core.auth.UserController;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.datadelivery.common.ui.GroupSelectComp; import com.raytheon.uf.viz.datadelivery.common.ui.GroupSelectComp;
import com.raytheon.uf.viz.datadelivery.common.ui.IGroupAction; import com.raytheon.uf.viz.datadelivery.common.ui.IGroupAction;
import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices; import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.presenter.components.ComboBoxConf; import com.raytheon.viz.ui.presenter.components.ComboBoxConf;
import com.raytheon.viz.ui.presenter.components.WidgetConf; import com.raytheon.viz.ui.presenter.components.WidgetConf;
@ -68,6 +68,7 @@ import com.raytheon.viz.ui.presenter.components.WidgetConf;
* May 14, 2013 1040 mpduff Changed to add office Id rather than setting it. * May 14, 2013 1040 mpduff Changed to add office Id rather than setting it.
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription. * May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
* Nov 08, 2013 2506 bgonzale Removed send notification when a subscription is created. * Nov 08, 2013 2506 bgonzale Removed send notification when a subscription is created.
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
* *
* </pre> * </pre>
* *
@ -263,8 +264,7 @@ public class GroupAddDlg extends CaveSWTDialog {
System.out.println("Fix Me: Need to calculate data set size"); System.out.println("Fix Me: Need to calculate data set size");
subscription.setDataSetSize(999); subscription.setDataSetSize(999);
subscription.addOfficeID(LocalizationManager.getInstance() subscription.addOfficeID(DataDeliveryUtils.getDataDeliveryId());
.getCurrentSite());
// TODO: How to do this better? Will shared subscriptions participate in // TODO: How to do this better? Will shared subscriptions participate in
// groups? // groups?

View file

@ -52,6 +52,7 @@ import com.raytheon.viz.ui.widgets.duallist.DualListConfig;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 29, 2013 1040 mpduff Initial creation * Apr 29, 2013 1040 mpduff Initial creation
* Feb 11, 2014 2771 bgonzale Show all SiteDataTypes in site list.
* *
* </pre> * </pre>
* *
@ -153,10 +154,8 @@ public class SiteSelectionDlg extends CaveSWTDialog {
for (Entry<String, SiteData> entry : siteDataMap.entrySet()) { for (Entry<String, SiteData> entry : siteDataMap.entrySet()) {
SiteDataType type = entry.getValue().getType(); SiteDataType type = entry.getValue().getType();
if (type == SiteDataType.WFO || type == SiteDataType.RFC) {
siteList.add(entry.getKey()); siteList.add(entry.getKey());
} }
}
// Remove the current site // Remove the current site
siteList.remove(this.site); siteList.remove(this.site);

View file

@ -26,6 +26,9 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import javax.xml.bind.JAXBException; import javax.xml.bind.JAXBException;
@ -72,6 +75,7 @@ import com.raytheon.uf.common.site.SiteMap;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.auth.UserController; import com.raytheon.uf.viz.core.auth.UserController;
import com.raytheon.uf.viz.core.localization.LocalizationManager; import com.raytheon.uf.viz.core.localization.LocalizationManager;
@ -148,6 +152,10 @@ import com.raytheon.viz.ui.presenter.IDisplay;
* Dec 05, 2013 2570 skorolev Show All subscriptions. * Dec 05, 2013 2570 skorolev Show All subscriptions.
* Jan 08, 2014 2642 mpduff Update dialog for permissions, adding site to shared * Jan 08, 2014 2642 mpduff Update dialog for permissions, adding site to shared
* Jan 14, 2014 2459 mpduff Change Subscription status code * Jan 14, 2014 2459 mpduff Change Subscription status code
* Feb 04, 2014 2722 mpduff Add auto-refresh task.
* Feb 14, 2014 2806 mpduff Disable activate/deactivate buttons when viewing other site's subscriptions
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
*
* </pre> * </pre>
* *
* @author mpduff * @author mpduff
@ -184,8 +192,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
} }
/** Current site */ /** Current site */
private final String CURRENT_SITE = LocalizationManager.getInstance() private final String CURRENT_SITE = DataDeliveryUtils.getDataDeliveryId();
.getCurrentSite();
/** The activate button */ /** The activate button */
private Button activateBtn; private Button activateBtn;
@ -278,6 +285,8 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
/** New menu */ /** New menu */
private MenuItem newMI; private MenuItem newMI;
private final ScheduledExecutorService scheduler;
/** /**
* Constructor * Constructor
* *
@ -292,6 +301,9 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
| CAVE.DO_NOT_BLOCK); | CAVE.DO_NOT_BLOCK);
this.filter = filter; this.filter = filter;
scheduler = Executors.newScheduledThreadPool(1);
scheduler.scheduleAtFixedRate(new RefreshTask(), 15, 15,
TimeUnit.MINUTES);
setText("Data Delivery Subscription Manager"); setText("Data Delivery Subscription Manager");
} }
@ -346,7 +358,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
createBottomButtons(); createBottomButtons();
enableMenus(true); enableControls(true);
} }
/* /*
@ -364,6 +376,17 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
return mainLayout; return mainLayout;
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
*/
@Override
protected void disposed() {
super.disposed();
scheduler.shutdownNow();
}
/** /**
* Create subscription menu. * Create subscription menu.
*/ */
@ -634,7 +657,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
handleFilterSelection(); handleFilterSelection();
enableMenus(officeCbo.getText().equals(CURRENT_SITE)); enableControls(officeCbo.getText().equals(CURRENT_SITE));
} }
}); });
@ -659,8 +682,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
*/ */
@Override @Override
public void handleRefresh() { public void handleRefresh() {
tableComp.populateData(); tableComp.handleRefresh();
tableComp.populateTable();
} }
private void createBottomButtons() { private void createBottomButtons() {
@ -1498,9 +1520,12 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
} }
/** /**
* Enable/Disable menus. * Enable/Disable controls.
*
* @param enable
* true to enable, false to disable
*/ */
private void enableMenus(boolean enable) { private void enableControls(boolean enable) {
copyMI.setEnabled(enable); copyMI.setEnabled(enable);
deleteGroupMI.setEnabled(enable); deleteGroupMI.setEnabled(enable);
editMI.setEnabled(enable); editMI.setEnabled(enable);
@ -1510,5 +1535,24 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
groupMI.setEnabled(enable); groupMI.setEnabled(enable);
newMI.setEnabled(enable); newMI.setEnabled(enable);
tableComp.enableMenus(enable); tableComp.enableMenus(enable);
activateBtn.setEnabled(enable);
deactivateBtn.setEnabled(enable);
}
/**
* Private inner work thread used to auto refresh dialog.
*/
private class RefreshTask implements Runnable {
@Override
public void run() {
if (TimeUtil.currentTimeMillis() - tableComp.getLastUpdateTime() >= TimeUtil.MILLIS_PER_MINUTE * 5) {
VizApp.runAsync(new Runnable() {
@Override
public void run() {
handleRefresh();
}
});
}
}
} }
} }

View file

@ -97,6 +97,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* Oct 22, 2013 2292 mpduff Removed subscriptionOverlapService. * Oct 22, 2013 2292 mpduff Removed subscriptionOverlapService.
* Nov 07, 2013 2291 skorolev Used showText() method for "Shared Subscription" message. * Nov 07, 2013 2291 skorolev Used showText() method for "Shared Subscription" message.
* Jan 26, 2014 2259 mpduff Turn off subs to be deactivated. * Jan 26, 2014 2259 mpduff Turn off subs to be deactivated.
* Feb 04, 2014 2677 mpduff Don't do overlap checks when deactivating subs.
* *
* </pre> * </pre>
* *
@ -542,6 +543,17 @@ public class SubscriptionService implements ISubscriptionService {
final IForceApplyPromptDisplayText displayTextStrategy) final IForceApplyPromptDisplayText displayTextStrategy)
throws RegistryHandlerException { throws RegistryHandlerException {
if (subscriptions == null || subscriptions.isEmpty()) {
return new SubscriptionServiceResult(false,
"No subscriptions submitted.");
}
/*
* If activating the subscriptions check for overlaps.
*
* Only need to check one because all are being updated the same way.
*/
if (subscriptions.get(0).getSubscriptionState() == SubscriptionState.ON) {
SubscriptionOverlapRequest request = new SubscriptionOverlapRequest( SubscriptionOverlapRequest request = new SubscriptionOverlapRequest(
subscriptions); subscriptions);
@ -558,13 +570,16 @@ public class SubscriptionService implements ISubscriptionService {
if (response.isOverlap()) { if (response.isOverlap()) {
List<String> subNames = response.getSubscriptionNameList(); List<String> subNames = response.getSubscriptionNameList();
Collections.sort(subNames); Collections.sort(subNames);
forceApplyPrompt.displayMessage(displayTextStrategy, StringUtil forceApplyPrompt.displayMessage(displayTextStrategy,
.createMessage(OVERLAPPING_SUBSCRIPTIONS, subNames)); StringUtil.createMessage(OVERLAPPING_SUBSCRIPTIONS,
subNames));
} }
} catch (Exception e) { } catch (Exception e) {
statusHandler.error("Error checking subscription overlapping", e); statusHandler.error("Error checking subscription overlapping",
e);
return new SubscriptionServiceResult(false); return new SubscriptionServiceResult(false);
} }
}
try { try {
final ProposeResult result = proposeScheduleAndAction( final ProposeResult result = proposeScheduleAndAction(

View file

@ -57,9 +57,9 @@ import com.raytheon.uf.common.registry.handler.RegistryObjectHandlers;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.auth.UserController; import com.raytheon.uf.viz.core.auth.UserController;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.notification.NotificationMessage; import com.raytheon.uf.viz.core.notification.NotificationMessage;
import com.raytheon.uf.viz.core.notification.NotificationMessageContainsType; import com.raytheon.uf.viz.core.notification.NotificationMessageContainsType;
import com.raytheon.uf.viz.datadelivery.common.ui.IGroupAction; import com.raytheon.uf.viz.datadelivery.common.ui.IGroupAction;
@ -110,6 +110,8 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions. * Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
* Oct 11, 2013 2386 mpduff Refactor DD Front end. * Oct 11, 2013 2386 mpduff Refactor DD Front end.
* Jan 08, 2014 2642 mpduff Enable/disable menus based on site, allow user to add their site to a shared sub. * Jan 08, 2014 2642 mpduff Enable/disable menus based on site, allow user to add their site to a shared sub.
* Feb 04, 2014 2722 mpduff Add last update time.
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
* @version 1.0 * @version 1.0
*/ */
@ -120,8 +122,7 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
.getHandler(SubscriptionTableComp.class); .getHandler(SubscriptionTableComp.class);
/** Current site constant */ /** Current site constant */
private final String CURRENT_SITE = LocalizationManager.getInstance() private final String CURRENT_SITE = DataDeliveryUtils.getDataDeliveryId();
.getCurrentSite();
/** Pop up menu object. */ /** Pop up menu object. */
private Menu popupMenu; private Menu popupMenu;
@ -163,6 +164,9 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
/** Currently selected site */ /** Currently selected site */
private boolean currentSiteSelected; private boolean currentSiteSelected;
/** Last table update time */
protected long lastUpdateTime = TimeUtil.currentTimeMillis();
/** /**
* Constructor. * Constructor.
* *
@ -760,6 +764,7 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
VizApp.runAsync(new Runnable() { VizApp.runAsync(new Runnable() {
@Override @Override
public void run() { public void run() {
lastUpdateTime = TimeUtil.currentTimeMillis();
if (!isDisposed()) { if (!isDisposed()) {
handleRefresh(); handleRefresh();
} }
@ -783,9 +788,11 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
*/ */
@Override @Override
public void handleRefresh() { public void handleRefresh() {
if (!isDisposed()) {
populateData(); populateData();
populateTable(); populateTable();
this.lastUpdateTime = TimeUtil.currentTimeMillis();
}
} }
@Override @Override
@ -888,4 +895,11 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
}); });
job.schedule(); job.schedule();
} }
/**
* @return the lastUpdateTime
*/
public long getLastUpdateTime() {
return lastUpdateTime;
}
} }

View file

@ -142,6 +142,9 @@ import com.raytheon.viz.ui.presenter.IDisplay;
* Nov 14, 2013 2548 mpduff Set the subscription type (QUERY OR RECURRING) * Nov 14, 2013 2548 mpduff Set the subscription type (QUERY OR RECURRING)
* Jan 14, 2014 2459 mpduff Change Subscription status code * Jan 14, 2014 2459 mpduff Change Subscription status code
* Jan 20, 2014 2538 mpduff Call doesNameExist method to check for dupes * Jan 20, 2014 2538 mpduff Call doesNameExist method to check for dupes
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
* Feb 26, 2014 #2833 lvenable Added code to prevent the Subset (this) dialog from
* disappearing when the Subscription button is double clicked.
* </pre> * </pre>
* *
* @author mpduff * @author mpduff
@ -416,7 +419,7 @@ public abstract class SubsetManagerDlg extends CaveSWTDialog implements
int buttonWidth = 87; int buttonWidth = 87;
GridData btnData = new GridData(buttonWidth, SWT.DEFAULT); GridData btnData = new GridData(buttonWidth, SWT.DEFAULT);
Button subscribeBtn = new Button(bottomComp, SWT.PUSH); final Button subscribeBtn = new Button(bottomComp, SWT.PUSH);
if (!create) { if (!create) {
subscribeBtn.setText("Continue..."); subscribeBtn.setText("Continue...");
subscribeBtn.setToolTipText("Click to continue editing"); subscribeBtn.setToolTipText("Click to continue editing");
@ -429,6 +432,14 @@ public abstract class SubsetManagerDlg extends CaveSWTDialog implements
subscribeBtn.addSelectionListener(new SelectionAdapter() { subscribeBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
/*
* Need to disable the Subscription button as it takes time to
* do all of the validation. Once the subscription dialog
* returns the button will enable.
*/
subscribeBtn.setEnabled(false);
if (subscription == null) { if (subscription == null) {
launchCreateSubscriptionGui(createSubscription( launchCreateSubscriptionGui(createSubscription(
new SiteSubscription(), Network.OPSNET)); new SiteSubscription(), Network.OPSNET));
@ -437,6 +448,9 @@ public abstract class SubsetManagerDlg extends CaveSWTDialog implements
subscription.getRoute()); subscription.getRoute());
launchCreateSubscriptionGui(subscription); launchCreateSubscriptionGui(subscription);
} }
// Enable the button.
subscribeBtn.setEnabled(true);
} }
}); });
@ -570,8 +584,7 @@ public abstract class SubsetManagerDlg extends CaveSWTDialog implements
sub.setOwner((create) ? LocalizationManager.getInstance() sub.setOwner((create) ? LocalizationManager.getInstance()
.getCurrentUser() : this.subscription.getOwner()); .getCurrentUser() : this.subscription.getOwner());
sub.setOriginatingSite(LocalizationManager.getInstance() sub.setOriginatingSite(DataDeliveryUtils.getDataDeliveryId());
.getCurrentSite());
sub.setSubscriptionType(SubscriptionType.RECURRING); sub.setSubscriptionType(SubscriptionType.RECURRING);
return setupCommonSubscriptionAttributes(sub, defaultRoute); return setupCommonSubscriptionAttributes(sub, defaultRoute);
@ -599,7 +612,7 @@ public abstract class SubsetManagerDlg extends CaveSWTDialog implements
sub.setRoute(defaultRoute); sub.setRoute(defaultRoute);
sub.setName(nameText.getText()); sub.setName(nameText.getText());
if (subscription == null || subscription.getOfficeIDs() == null) { if (subscription == null || subscription.getOfficeIDs() == null) {
sub.addOfficeID(LocalizationManager.getInstance().getCurrentSite()); sub.addOfficeID(DataDeliveryUtils.getDataDeliveryId());
} else { } else {
sub.setOfficeIDs(subscription.getOfficeIDs()); sub.setOfficeIDs(subscription.getOfficeIDs());
} }

View file

@ -34,6 +34,9 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.auth.resp.SuccessfulExecution;
import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthRequest;
import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthRequest.RequestType;
import com.raytheon.uf.common.datadelivery.registry.Coverage; import com.raytheon.uf.common.datadelivery.registry.Coverage;
import com.raytheon.uf.common.datadelivery.registry.DataLevelType; import com.raytheon.uf.common.datadelivery.registry.DataLevelType;
import com.raytheon.uf.common.datadelivery.registry.DataType; import com.raytheon.uf.common.datadelivery.registry.DataType;
@ -43,6 +46,8 @@ import com.raytheon.uf.common.datadelivery.registry.Parameter;
import com.raytheon.uf.common.datadelivery.registry.PointTime; import com.raytheon.uf.common.datadelivery.registry.PointTime;
import com.raytheon.uf.common.datadelivery.registry.Subscription; import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.Time; import com.raytheon.uf.common.datadelivery.registry.Time;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants;
import com.raytheon.uf.common.serialization.comm.RequestRouter;
import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.util.CollectionUtil; import com.raytheon.uf.common.util.CollectionUtil;
import com.raytheon.uf.common.util.SizeUtil; import com.raytheon.uf.common.util.SizeUtil;
@ -84,6 +89,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Sep 30, 2013 1797 dhladky Time GriddedTime separation * Sep 30, 2013 1797 dhladky Time GriddedTime separation
* Oct 11, 2013 2386 mpduff Refactor DD Front end. * Oct 11, 2013 2386 mpduff Refactor DD Front end.
* Nov 07, 2013 2291 skorolev Added showText() method for messages with many lines. * Nov 07, 2013 2291 skorolev Added showText() method for messages with many lines.
* Feb 11, 2014 2771 bgonzale Added Data Delivery ID, getter, and retrieval method.
* </pre> * </pre>
* *
* @author mpduff * @author mpduff
@ -121,6 +127,8 @@ public class DataDeliveryUtils {
public static final String UNABLE_TO_RETRIEVE_PENDING_SUBSCRIPTIONS = "Unable to retrieve pending subscriptions!"; public static final String UNABLE_TO_RETRIEVE_PENDING_SUBSCRIPTIONS = "Unable to retrieve pending subscriptions!";
private static final String dataDeliveryId = retrieveDataDeliveryId();
/** /**
* TABLE_TYPE enumeration. * TABLE_TYPE enumeration.
*/ */
@ -832,4 +840,21 @@ public class DataDeliveryUtils {
public static int getMaxLatency(GriddedDataSet dataSet) { public static int getMaxLatency(GriddedDataSet dataSet) {
return getMaxLatency(new ArrayList<Integer>(dataSet.getCycles())); return getMaxLatency(new ArrayList<Integer>(dataSet.getCycles()));
} }
public static String getDataDeliveryId() {
return dataDeliveryId;
}
private static String retrieveDataDeliveryId() {
IBandwidthRequest request = new IBandwidthRequest();
request.setRequestType(RequestType.GET_DATADELIVERY_ID);
try {
SuccessfulExecution response = (SuccessfulExecution) RequestRouter
.route(request, DataDeliveryConstants.DATA_DELIVERY_SERVER);
return (String) response.getResponse();
} catch (Exception e) {
throw new RuntimeException(
"Unable to retrieve Data Delivery ID from EDEX.", e);
}
}
} }

View file

@ -31,6 +31,7 @@ import com.raytheon.uf.viz.datadelivery.notification.xml.MessageLoadXML;
* Mar 12, 2012 jsanchez Initial creation * Mar 12, 2012 jsanchez Initial creation
* Jan 22, 2013 1501 djohnson Route requests to datadelivery. * Jan 22, 2013 1501 djohnson Route requests to datadelivery.
* Sep 05, 2013 2314 mpduff support the load all messages option. * Sep 05, 2013 2314 mpduff support the load all messages option.
* Feb 07, 2014 2453 mpduff Remove username query param.
* *
* </pre> * </pre>
* *
@ -84,10 +85,9 @@ public class NotificationHandler implements INotificationObserver {
public List<NotificationRecord> intialLoad(MessageLoadXML messageLoad, public List<NotificationRecord> intialLoad(MessageLoadXML messageLoad,
ArrayList<String> users) { ArrayList<String> users) {
int loadAmount; int loadAmount;
String username = null;
Integer hours = null; Integer hours = null;
Integer maxResults = null; Integer maxResults = null;
Boolean loadAll = false; boolean loadAll = false;
// Retrieve the message load configuration // Retrieve the message load configuration
if (messageLoad != null) { if (messageLoad != null) {
loadAll = messageLoad.isLoadAllMessages(); loadAll = messageLoad.isLoadAllMessages();
@ -100,22 +100,11 @@ public class NotificationHandler implements INotificationObserver {
} }
} }
// Set usernames from filter
if (users != null && users.isEmpty() == false) {
StringBuffer sb = new StringBuffer();
for (String user : users) {
if (sb.length() > 0) {
sb.append(",");
}
sb.append(user);
}
username = sb.toString();
}
// Request data from the notification table. // Request data from the notification table.
// Note: Removing username query parameter for front end label
// consistency
try { try {
GetNotificationRequest request = new GetNotificationRequest(); GetNotificationRequest request = new GetNotificationRequest();
request.setUsername(username);
request.setHours(hours); request.setHours(hours);
request.setMaxResults(maxResults); request.setMaxResults(maxResults);
request.setLoadAll(loadAll); request.setLoadAll(loadAll);

View file

@ -57,6 +57,7 @@ import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
* Jul 16, 2013 2158 bsteffen Allow VizGlobalsManager to work without * Jul 16, 2013 2158 bsteffen Allow VizGlobalsManager to work without
* accessing UI thread. * accessing UI thread.
* Oct 15, 2013 2361 njensen Added startupTimer * Oct 15, 2013 2361 njensen Added startupTimer
* Jan 27, 2014 2744 njensen Add Local History pref back in
* *
* </pre> * </pre>
* *
@ -192,8 +193,17 @@ public class VizWorkbenchAdvisor extends WorkbenchAdvisor {
for (IPreferenceNode root : topNodes) { for (IPreferenceNode root : topNodes) {
String rootId = root.getId(); String rootId = root.getId();
if (rootId.equals("org.eclipse.ui.preferencePages.Workbench")) { if (rootId.equals("org.eclipse.ui.preferencePages.Workbench")) {
root.remove("org.eclipse.search.preferences.SearchPreferencePage"); IPreferenceNode node = root
.findSubNode("org.eclipse.ui.preferencePages.Workspace");
if (node != null) {
node.remove("org.eclipse.ui.preferencePages.LinkedResources");
node.remove("org.eclipse.ui.preferencePages.BuildOrder");
IPreferenceNode localHistoryNode = node
.findSubNode("org.eclipse.ui.preferencePages.FileStates");
root.add(localHistoryNode);
root.remove("org.eclipse.ui.preferencePages.Workspace"); root.remove("org.eclipse.ui.preferencePages.Workspace");
}
root.remove("org.eclipse.search.preferences.SearchPreferencePage");
} else if (rootId.equals("org.python.pydev.prefs")) { } else if (rootId.equals("org.python.pydev.prefs")) {
root.remove("org.python.pydev.ui.pythonpathconf.interpreterPreferencesPageJython"); root.remove("org.python.pydev.ui.pythonpathconf.interpreterPreferencesPageJython");
root.remove("org.python.pydev.ui.pythonpathconf.interpreterPreferencesPageIronpython"); root.remove("org.python.pydev.ui.pythonpathconf.interpreterPreferencesPageIronpython");

View file

@ -123,8 +123,10 @@ public class AlertVizApplication implements IStandaloneComponent {
AlertvizJob as = new AlertvizJob(port); AlertvizJob as = new AlertvizJob(port);
if (as.isAlreadyStarted()) { if (as.isAlreadyStarted()) {
Container.logInternal(Priority.ERROR, String exitMsg = "Alertviz already started on port: " + port
"Alertviz already started on port: " + port + ", exiting"); + ", exiting";
System.out.println(exitMsg);
Container.logInternal(Priority.ERROR, exitMsg);
return IApplication.EXIT_OK; return IApplication.EXIT_OK;
} }

View file

@ -36,6 +36,7 @@ import com.raytheon.uf.viz.core.comm.ConnectivityManager;
import com.raytheon.uf.viz.core.comm.ConnectivityManager.ConnectivityResult; import com.raytheon.uf.viz.core.comm.ConnectivityManager.ConnectivityResult;
import com.raytheon.uf.viz.core.comm.IConnectivityCallback; import com.raytheon.uf.viz.core.comm.IConnectivityCallback;
import com.raytheon.uf.viz.thinclient.Activator; import com.raytheon.uf.viz.thinclient.Activator;
import com.raytheon.uf.viz.thinclient.ThinClientUriUtil;
import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants; import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
/** /**
@ -51,6 +52,7 @@ import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
* Jan 14, 2013 1469 bkowal The hdf5 data directory is no longer a * Jan 14, 2013 1469 bkowal The hdf5 data directory is no longer a
* preference. * preference.
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking. * Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Feb 04, 2014 2704 njensen Only one field for proxy server
* *
* </pre> * </pre>
* *
@ -61,9 +63,7 @@ public class ThinClientServerPreferences extends FieldEditorPreferencePage {
private BooleanFieldEditor useProxies; private BooleanFieldEditor useProxies;
private StringFieldEditor pypiesServer; private StringFieldEditor proxyServer;
private StringFieldEditor servicesServer;
private Button connectivityButton; private Button connectivityButton;
@ -92,18 +92,11 @@ public class ThinClientServerPreferences extends FieldEditorPreferencePage {
"&Use Proxy Servers", getFieldEditorParent()); "&Use Proxy Servers", getFieldEditorParent());
addField(useProxies); addField(useProxies);
proxyServer = new StringFieldEditor(
servicesServer = new StringFieldEditor( ThinClientPreferenceConstants.P_PROXY_ADDRESS,
ThinClientPreferenceConstants.P_SERVICES_PROXY, "&Proxy Address: ", getFieldEditorParent());
"&Services Address: ", getFieldEditorParent()); proxyServer.setErrorMessage("Cannot connect to Proxy server");
servicesServer.setErrorMessage("Cannot connect to Services server"); addField(proxyServer);
addField(servicesServer);
pypiesServer = new StringFieldEditor(
ThinClientPreferenceConstants.P_PYPIES_PROXY,
"&Pypies Address: ", getFieldEditorParent());
pypiesServer.setErrorMessage("Cannot connect to Pypies server");
addField(pypiesServer);
addConnectivityButton(); addConnectivityButton();
} }
@ -131,43 +124,40 @@ public class ThinClientServerPreferences extends FieldEditorPreferencePage {
* Check the connectivity of the server field editors * Check the connectivity of the server field editors
*/ */
private void checkConnectivity() { private void checkConnectivity() {
final ConnectivityResult result = new ConnectivityResult(false, ""); final ConnectivityResult servicesResult = new ConnectivityResult(false,
"");
final ConnectivityResult pypiesResult = new ConnectivityResult(false,
"");
String errorMessage = "Cannot connect to proxy server: "; String errorMessage = "Cannot connect to proxy server: ";
boolean serverError = false; boolean serverError = false;
// check HTTP Server // check HTTP Server
Text text = servicesServer.getTextControl(getFieldEditorParent()); Text text = proxyServer.getTextControl(getFieldEditorParent());
ConnectivityManager.checkLocalizationServer(text.getText().trim(), String proxyAddr = text.getText().trim();
ConnectivityManager.checkLocalizationServer(
ThinClientUriUtil.getServicesAddress(proxyAddr),
new IConnectivityCallback() { new IConnectivityCallback() {
@Override @Override
public void connectionChecked(ConnectivityResult results) { public void connectionChecked(ConnectivityResult results) {
result.hasConnectivity = results.hasConnectivity; servicesResult.hasConnectivity = results.hasConnectivity;
} }
}); });
if (result.hasConnectivity) {
text.setBackground(Display.getDefault().getSystemColor(
SWT.COLOR_WHITE));
} else {
text.setBackground(Display.getDefault().getSystemColor(
SWT.COLOR_RED));
serverError = true;
}
// check Pypies Server // check Pypies Server
Text textPypies = pypiesServer.getTextControl(getFieldEditorParent()); ConnectivityManager.checkHttpServer(
ThinClientUriUtil.getPypiesAddress(proxyAddr),
ConnectivityManager.checkHttpServer(textPypies.getText().trim(),
new IConnectivityCallback() { new IConnectivityCallback() {
@Override @Override
public void connectionChecked(ConnectivityResult results) { public void connectionChecked(ConnectivityResult results) {
result.hasConnectivity = results.hasConnectivity; pypiesResult.hasConnectivity = results.hasConnectivity;
} }
}); });
if (result.hasConnectivity) {
textPypies.setBackground(Display.getDefault().getSystemColor( if (servicesResult.hasConnectivity && pypiesResult.hasConnectivity) {
text.setBackground(Display.getDefault().getSystemColor(
SWT.COLOR_WHITE)); SWT.COLOR_WHITE));
} else { } else {
textPypies.setBackground(Display.getDefault().getSystemColor( text.setBackground(Display.getDefault().getSystemColor(
SWT.COLOR_RED)); SWT.COLOR_RED));
serverError = true; serverError = true;
} }
@ -191,8 +181,7 @@ public class ThinClientServerPreferences extends FieldEditorPreferencePage {
private void updateEnabledFields() { private void updateEnabledFields() {
boolean useProxies = this.useProxies.getBooleanValue(); boolean useProxies = this.useProxies.getBooleanValue();
servicesServer.setEnabled(useProxies, connectivityButton.getParent()); proxyServer.setEnabled(useProxies, connectivityButton.getParent());
pypiesServer.setEnabled(useProxies, connectivityButton.getParent());
connectivityButton.setEnabled(useProxies); connectivityButton.setEnabled(useProxies);
} }

View file

@ -0,0 +1,91 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.thinclient;
/**
* Utilities for manipulating thin client URIs
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 3, 2014 njensen Initial creation
*
* </pre>
*
* @author njensen
* @version 1.0
*/
public class ThinClientUriUtil {
private static String services = "services";
private static String pypies = "pypies";
static {
services = System.getProperty("thinclient.proxy.services", services);
pypies = System.getProperty("thinclient.proxy.pypies", pypies);
}
private ThinClientUriUtil() {
}
/**
* Returns the address to connect to EDEX services when going through the
* thin client proxy
*
* @param proxyAddress
* the address of the proxy server
* @return
*/
public static String getServicesAddress(String proxyAddress) {
return appendTrailingSlash(proxyAddress) + services;
}
/**
* Returns the address to connect to PyPIES when going through the thin
* client proxy
*
* @param proxyAddress
* the address of the proxy server
* @return
*/
public static String getPypiesAddress(String proxyAddress) {
return appendTrailingSlash(proxyAddress) + pypies;
}
/**
* Appends a trailing slash to an address if the address does not have one
*
* @param proxyAddress
* @return
*/
private static String appendTrailingSlash(String proxyAddress) {
if (!proxyAddress.endsWith("/")) {
proxyAddress += "/";
}
return proxyAddress;
}
}

View file

@ -25,15 +25,15 @@ import org.apache.commons.collections.map.DefaultedMap;
import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.IPreferenceStore;
import com.raytheon.uf.common.comm.HttpClient; import com.raytheon.uf.common.comm.HttpClient;
import com.raytheon.uf.common.localization.msgs.GetServersRequest;
import com.raytheon.uf.common.localization.msgs.GetServersResponse; import com.raytheon.uf.common.localization.msgs.GetServersResponse;
import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.VizServers; import com.raytheon.uf.viz.core.VizServers;
import com.raytheon.uf.viz.core.comm.ConnectivityManager;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.localization.LocalizationInitializer; import com.raytheon.uf.viz.core.localization.LocalizationInitializer;
import com.raytheon.uf.viz.core.localization.LocalizationManager; import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.uf.viz.thinclient.Activator; import com.raytheon.uf.viz.thinclient.Activator;
import com.raytheon.uf.viz.thinclient.ThinClientUriUtil;
import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants; import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
import com.raytheon.uf.viz.thinclient.ui.ThinClientConnectivityDialog; import com.raytheon.uf.viz.thinclient.ui.ThinClientConnectivityDialog;
@ -53,6 +53,7 @@ import com.raytheon.uf.viz.thinclient.ui.ThinClientConnectivityDialog;
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking. * Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Aug 27, 2013 2295 bkowal The entire jms connection string is * Aug 27, 2013 2295 bkowal The entire jms connection string is
* now provided by EDEX. * now provided by EDEX.
* Feb 04, 2014 2704 njensen Single proxy address/preference
* *
* </pre> * </pre>
* *
@ -87,20 +88,25 @@ public class ThinClientLocalizationInitializer extends LocalizationInitializer {
.getBoolean(ThinClientPreferenceConstants.P_DISABLE_JMS); .getBoolean(ThinClientPreferenceConstants.P_DISABLE_JMS);
if (store.getBoolean(ThinClientPreferenceConstants.P_USE_PROXIES)) { if (store.getBoolean(ThinClientPreferenceConstants.P_USE_PROXIES)) {
String servicesProxy = store String proxyAddr = store
.getString(ThinClientPreferenceConstants.P_SERVICES_PROXY); .getString(ThinClientPreferenceConstants.P_PROXY_ADDRESS);
LocalizationManager.getInstance().setCurrentServer(servicesProxy); String servicesProxy = ThinClientUriUtil
.getServicesAddress(proxyAddr);
LocalizationManager.getInstance().setCurrentServer(servicesProxy,
false);
VizApp.setHttpServer(servicesProxy);
if (!disableJMS) { if (!disableJMS) {
GetServersRequest req = new GetServersRequest(); GetServersResponse resp = ConnectivityManager
GetServersResponse resp = (GetServersResponse) ThriftClient .checkLocalizationServer(servicesProxy, false);
.sendLocalizationRequest(req);
if (!disableJMS) { if (!disableJMS) {
VizApp.setJmsConnectionString(resp.getJmsConnectionString()); VizApp.setJmsConnectionString(resp.getJmsConnectionString());
} }
} }
VizApp.setHttpServer(servicesProxy);
VizApp.setPypiesServer(store String pypiesProxy = ThinClientUriUtil
.getString(ThinClientPreferenceConstants.P_PYPIES_PROXY)); .getPypiesAddress(proxyAddr);
VizApp.setPypiesServer(pypiesProxy);
boolean compressRequests = store boolean compressRequests = store
.getBoolean(ThinClientPreferenceConstants.P_ENABLE_REQUEST_COMPRESSION); .getBoolean(ThinClientPreferenceConstants.P_ENABLE_REQUEST_COMPRESSION);
HttpClient.getInstance().setCompressRequests(compressRequests); HttpClient.getInstance().setCompressRequests(compressRequests);

View file

@ -30,6 +30,7 @@ package com.raytheon.uf.viz.thinclient.preferences;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Oct 20, 2011 mschenke Initial creation * Oct 20, 2011 mschenke Initial creation
* Jan 14, 2013 1469 bkowal The hdf5 data directory is no longer a preference constant. * Jan 14, 2013 1469 bkowal The hdf5 data directory is no longer a preference constant.
* Feb 04, 2014 2704 njensen Single proxy preference constant
* *
* </pre> * </pre>
* *
@ -47,10 +48,6 @@ public class ThinClientPreferenceConstants {
public static String P_USE_PROXIES = "useHttpProxy"; public static String P_USE_PROXIES = "useHttpProxy";
public static String P_SERVICES_PROXY = "servicesProxyAddress";
public static String P_PYPIES_PROXY = "pypiesProxyAddress";
public static String P_MENU_TIME_UPDATE_INTERVALS = "menuTimeUpdateInterval"; public static String P_MENU_TIME_UPDATE_INTERVALS = "menuTimeUpdateInterval";
public static String P_DATA_UPDATE_INTERVALS = "dataUpdateInterval"; public static String P_DATA_UPDATE_INTERVALS = "dataUpdateInterval";
@ -70,4 +67,6 @@ public class ThinClientPreferenceConstants {
public static String P_ENABLE_REQUEST_COMPRESSION = "enableRequestCompression"; public static String P_ENABLE_REQUEST_COMPRESSION = "enableRequestCompression";
public static String P_PREFERENCE_PLACEHOLDER = "placeholderPreference"; public static String P_PREFERENCE_PLACEHOLDER = "placeholderPreference";
public static String P_PROXY_ADDRESS = "proxyAddress";
} }

View file

@ -27,25 +27,30 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.common.localization.msgs.GetServersResponse;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.comm.ConnectivityManager; import com.raytheon.uf.viz.core.comm.ConnectivityManager;
import com.raytheon.uf.viz.core.comm.ConnectivityManager.ConnectivityResult; import com.raytheon.uf.viz.core.comm.ConnectivityManager.ConnectivityResult;
import com.raytheon.uf.viz.core.comm.IConnectivityCallback; import com.raytheon.uf.viz.core.comm.IConnectivityCallback;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.localization.ConnectivityPreferenceDialog; import com.raytheon.uf.viz.core.localization.ConnectivityPreferenceDialog;
import com.raytheon.uf.viz.core.localization.LocalizationConstants; import com.raytheon.uf.viz.core.localization.LocalizationConstants;
import com.raytheon.uf.viz.core.localization.LocalizationManager; import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.thinclient.Activator; import com.raytheon.uf.viz.thinclient.Activator;
import com.raytheon.uf.viz.thinclient.ThinClientUriUtil;
import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants; import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
/** /**
* TODO Add Description * Connectivity dialog for launching thinclient or thinalertviz. Contains extra
* options not available when connecting with a normal CAVE.
* *
* <pre> * <pre>
* *
@ -55,6 +60,11 @@ import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Nov 23, 2011 bsteffen Initial creation * Nov 23, 2011 bsteffen Initial creation
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking. * Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Feb 04, 2014 2704 njensen Refactored
* Feb 17, 2014 2704 njensen Added checks for alertviz connectivity
* Feb 20, 2014 2704 njensen Fix issues where settings are valid
* but dialog doesn't realize it
*
* *
* </pre> * </pre>
* *
@ -71,8 +81,11 @@ public class ThinClientConnectivityDialog extends ConnectivityPreferenceDialog {
@Override @Override
public void connectionChecked(ConnectivityResult results) { public void connectionChecked(ConnectivityResult results) {
servicesGood = results.hasConnectivity; servicesGood = results.hasConnectivity;
appendDetails(buildDetails(results));
if (!results.hasConnectivity && status == null) {
status = buildErrorMessage(results);
}
} }
} }
private class PypiesCallback implements IConnectivityCallback { private class PypiesCallback implements IConnectivityCallback {
@ -80,26 +93,30 @@ public class ThinClientConnectivityDialog extends ConnectivityPreferenceDialog {
@Override @Override
public void connectionChecked(ConnectivityResult results) { public void connectionChecked(ConnectivityResult results) {
pypiesGood = results.hasConnectivity; pypiesGood = results.hasConnectivity;
appendDetails(buildDetails(results));
if (!results.hasConnectivity && status == null) {
status = buildErrorMessage(results);
}
}
}
private class JmsCallback implements IConnectivityCallback {
@Override
public void connectionChecked(ConnectivityResult results) {
jmsGood = results.hasConnectivity;
appendDetails(buildDetails(results));
if (!results.hasConnectivity && status == null) {
status = buildErrorMessage(results);
}
} }
} }
private Label servicesLabel;
private Text servicesText;
private String services = "";
private boolean servicesGood = false; private boolean servicesGood = false;
private IConnectivityCallback servicesCallback = new ServicesCallback(); private IConnectivityCallback servicesCallback = new ServicesCallback();
private Label pypiesLabel;
private Text pypiesText;
private String pypies = "";
private boolean pypiesGood = false; private boolean pypiesGood = false;
private IConnectivityCallback pypiesCallback = new PypiesCallback(); private IConnectivityCallback pypiesCallback = new PypiesCallback();
@ -108,15 +125,29 @@ public class ThinClientConnectivityDialog extends ConnectivityPreferenceDialog {
private boolean useProxy = false; private boolean useProxy = false;
private Button disableJmsCheck;
private boolean disableJms = false;
private boolean jmsGood = false;
private Label jmsErrorLabel;
private IConnectivityCallback jmsCallback = new JmsCallback();
private Text proxyText;
private String proxyAddress;
public ThinClientConnectivityDialog(boolean checkAlertViz) { public ThinClientConnectivityDialog(boolean checkAlertViz) {
super(checkAlertViz); super(checkAlertViz, "Thin Client Connectivity Preferences");
IPreferenceStore store = Activator.getDefault().getPreferenceStore(); IPreferenceStore store = Activator.getDefault().getPreferenceStore();
useProxy = store useProxy = store
.getBoolean(ThinClientPreferenceConstants.P_USE_PROXIES); .getBoolean(ThinClientPreferenceConstants.P_USE_PROXIES);
services = store disableJms = store
.getString(ThinClientPreferenceConstants.P_SERVICES_PROXY); .getBoolean(ThinClientPreferenceConstants.P_DISABLE_JMS);
pypies = store.getString(ThinClientPreferenceConstants.P_PYPIES_PROXY); proxyAddress = store
.getString(ThinClientPreferenceConstants.P_PROXY_ADDRESS);
} }
@Override @Override
@ -124,66 +155,75 @@ public class ThinClientConnectivityDialog extends ConnectivityPreferenceDialog {
super.createTextBoxes(textBoxComp); super.createTextBoxes(textBoxComp);
Label label = new Label(textBoxComp, SWT.RIGHT); Label label = new Label(textBoxComp, SWT.RIGHT);
label.setText("Use Proxy Servers:"); label.setText("Disable JMS:");
GridData gd = new GridData(SWT.RIGHT, SWT.None, true, true); GridData gd = new GridData(SWT.RIGHT, SWT.CENTER, true, true);
gd.widthHint = 150; gd.widthHint = 150;
label.setLayoutData(gd); label.setLayoutData(gd);
useProxyCheck = new Button(textBoxComp, SWT.CHECK | SWT.LEFT); Composite jmsComp = new Composite(textBoxComp, SWT.NONE);
GridLayout gl = new GridLayout(2, false);
gl.marginHeight = 0;
gl.marginWidth = 0;
jmsComp.setLayout(gl);
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
jmsComp.setLayoutData(gd);
disableJmsCheck = new Button(jmsComp, SWT.CHECK | SWT.LEFT);
disableJmsCheck.setSelection(disableJms);
disableJmsCheck.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
disableJms = disableJmsCheck.getSelection();
validate();
}
});
jmsErrorLabel = new Label(jmsComp, SWT.LEFT);
jmsErrorLabel.setText("Error connecting to JMS");
jmsErrorLabel.setForeground(display.getSystemColor(SWT.COLOR_RED));
jmsErrorLabel.setVisible(false);
label = new Label(textBoxComp, SWT.RIGHT);
label.setText("Use Proxy Server:");
gd = new GridData(SWT.RIGHT, SWT.CENTER, true, true);
gd.widthHint = 150;
label.setLayoutData(gd);
Composite proxyComp = new Composite(textBoxComp, SWT.NONE);
gl = new GridLayout(2, false);
gl.marginHeight = 0;
gl.marginWidth = 0;
proxyComp.setLayout(gl);
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
proxyComp.setLayoutData(gd);
useProxyCheck = new Button(proxyComp, SWT.CHECK | SWT.LEFT);
useProxyCheck.setSelection(useProxy); useProxyCheck.setSelection(useProxy);
useProxyCheck.addSelectionListener(new SelectionAdapter() { useProxyCheck.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
updateProxyEnabled(); updateProxyEnabled();
} }
}); });
servicesLabel = new Label(textBoxComp, SWT.RIGHT); proxyText = new Text(proxyComp, SWT.NONE | SWT.BORDER);
servicesLabel.setText("Services Proxy Address:"); gd = new GridData(SWT.FILL, SWT.None, true, true);
gd = new GridData(SWT.RIGHT, SWT.None, true, true); proxyText.setLayoutData(gd);
gd.widthHint = 150; proxyText.setText(proxyAddress == null ? "" : proxyAddress);
servicesLabel.setLayoutData(gd); proxyText.setBackground(getTextColor(servicesGood && pypiesGood));
servicesText = new Text(textBoxComp, SWT.NONE);
gd = new GridData(SWT.RIGHT, SWT.None, true, true);
gd.widthHint = 300;
servicesText.setLayoutData(gd);
servicesText.setText(services);
if (!servicesGood) {
servicesText.setBackground(textBoxComp.getDisplay().getSystemColor(
SWT.COLOR_RED));
}
pypiesLabel = new Label(textBoxComp, SWT.RIGHT);
pypiesLabel.setText("Pypies Proxy Address:");
gd = new GridData(SWT.RIGHT, SWT.None, true, true);
gd.widthHint = 150;
pypiesLabel.setLayoutData(gd);
pypiesText = new Text(textBoxComp, SWT.NONE);
gd = new GridData(SWT.RIGHT, SWT.None, true, true);
gd.widthHint = 300;
pypiesText.setLayoutData(gd);
pypiesText.setText(pypies);
if (!pypiesGood) {
pypiesText.setBackground(textBoxComp.getDisplay().getSystemColor(
SWT.COLOR_RED));
}
updateProxyEnabled(); updateProxyEnabled();
} }
@Override @Override
protected void applySettings() { protected void applySettings() {
IPreferenceStore store = Activator.getDefault().getPreferenceStore(); IPreferenceStore store = Activator.getDefault().getPreferenceStore();
store.setValue(ThinClientPreferenceConstants.P_USE_PROXIES, useProxy); store.setValue(ThinClientPreferenceConstants.P_DISABLE_JMS, disableJms);
if (useProxy) { if (useProxy) {
store.setValue(ThinClientPreferenceConstants.P_SERVICES_PROXY, store.setValue(ThinClientPreferenceConstants.P_USE_PROXIES,
services); useProxy);
store.setValue(ThinClientPreferenceConstants.P_PYPIES_PROXY, pypies); store.setValue(ThinClientPreferenceConstants.P_PROXY_ADDRESS,
// Set the site and alertViz server for super. proxyAddress);
LocalizationManager.getInstance().setCurrentSite(getSite());
if (getAlertVizServer() != null) { if (getAlertVizServer() != null) {
LocalizationManager LocalizationManager
.getInstance() .getInstance()
@ -191,11 +231,11 @@ public class ThinClientConnectivityDialog extends ConnectivityPreferenceDialog {
.setValue(LocalizationConstants.P_ALERT_SERVER, .setValue(LocalizationConstants.P_ALERT_SERVER,
getAlertVizServer()); getAlertVizServer());
} }
// setting the site will save the preference store
LocalizationManager.getInstance().setCurrentSite(getSite());
try { try {
((IPersistentPreferenceStore) store).save(); ((IPersistentPreferenceStore) store).save();
((IPersistentPreferenceStore) LocalizationManager.getInstance()
.getLocalizationStore()).save();
} catch (IOException e) { } catch (IOException e) {
statusHandler.handle(Priority.SIGNIFICANT, statusHandler.handle(Priority.SIGNIFICANT,
"Unable to persist localization preference store", e); "Unable to persist localization preference store", e);
@ -208,51 +248,125 @@ public class ThinClientConnectivityDialog extends ConnectivityPreferenceDialog {
@Override @Override
public boolean validate() { public boolean validate() {
boolean superValid = super.validate();
if (!useProxy) { if (!useProxy) {
return superValid; boolean superResult = super.validate();
validateJms(superResult);
return superResult && jmsGood;
} }
if (servicesText != null && !servicesText.isDisposed()
&& servicesText.isEnabled()) { status = null;
String services = servicesText.getText().trim(); details = null;
if (!servicesGood || !this.services.equals(services)) {
this.services = services; // validate proxy
if (proxyText != null && !proxyText.isDisposed()
&& proxyText.isEnabled()) {
proxyAddress = proxyText.getText();
}
if (proxyAddress != null && proxyAddress.length() > 0) {
validateServices(); validateServices();
servicesText.setBackground(getTextColor(servicesGood));
}
} else {
validateServices();
}
if (pypiesText != null && !pypiesText.isDisposed()
&& pypiesText.isEnabled()) {
String pypies = pypiesText.getText().trim();
if (!pypiesGood || !this.pypies.equals(pypies)) {
this.pypies = pypies;
validatePypies(); validatePypies();
pypiesText.setBackground(getTextColor(pypiesGood));
}
} else { } else {
validatePypies(); status = "Please enter a thin client proxy server address";
} }
return servicesGood && pypiesGood && isSiteGood() && isAlertVizGood(); if (proxyText != null && !proxyText.isDisposed()) {
proxyText.setBackground(getTextColor(servicesGood && pypiesGood));
}
validateJms(servicesGood);
// validate site
if (siteText != null && !siteText.isDisposed()) {
super.setSite(siteText.getText());
}
super.validateSite();
if (siteText != null && !siteText.isDisposed()) {
siteText.setBackground(getTextColor(isSiteGood()));
}
// validate alertviz
// apparently alertvizserver == null means it's alertviz itself
if (alertVizServer != null) {
if (alertVizText != null && !alertVizText.isDisposed()) {
setAlertVizServer(alertVizText.getText());
}
super.validateAlertviz();
if (alertVizText != null && !alertVizText.isDisposed()) {
alertVizText.setBackground(getTextColor(isAlertVizGood()));
}
}
boolean everythingGood = servicesGood && pypiesGood && isSiteGood()
&& isAlertVizGood() && jmsGood;
updateStatus(everythingGood, status, details);
return everythingGood;
} }
private void validateServices() { private void validateServices() {
ConnectivityManager.checkLocalizationServer(services, servicesCallback); ConnectivityManager.checkLocalizationServer(
ThinClientUriUtil.getServicesAddress(proxyAddress),
servicesCallback);
} }
private void validatePypies() { private void validatePypies() {
ConnectivityManager.checkHttpServer(pypies, pypiesCallback); ConnectivityManager.checkHttpServer(
ThinClientUriUtil.getPypiesAddress(proxyAddress),
pypiesCallback);
} }
private void updateProxyEnabled() { private void updateProxyEnabled() {
useProxy = useProxyCheck.getSelection(); useProxy = useProxyCheck.getSelection();
servicesLabel.setEnabled(useProxy); proxyText.setEnabled(useProxy);
servicesText.setEnabled(useProxy); super.setLocalizationEnabled(!useProxy);
pypiesLabel.setEnabled(useProxy); if (useProxy) {
pypiesText.setEnabled(useProxy); if (localizationText != null && !localizationText.isDisposed()) {
setLocalizationEnabled(!useProxy); localizationText.setBackground(getTextColor(true));
}
} else {
if (proxyText != null && !proxyText.isDisposed()) {
proxyText.setBackground(getTextColor(true));
}
}
validate(); validate();
} }
/**
* Validates that a connection to JMS works.
*
* @param hasEdexConnection
* if we've successfully connected to edex
*/
private void validateJms(boolean hasEdexConnection) {
// only check Jms if it's enabled and we can connect to the services
if (!disableJms) {
if (hasEdexConnection) {
try {
String server = useProxy ? ThinClientUriUtil
.getServicesAddress(proxyAddress)
: getLocalization();
GetServersResponse response = ConnectivityManager
.checkLocalizationServer(server, false);
ConnectivityManager.checkJmsServer(
response.getJmsConnectionString(), jmsCallback);
} catch (VizException e) {
if (status == null) {
status = "Error connecting to JMS";
}
appendDetails(buildDetails(new ConnectivityResult(false,
null, e)));
jmsGood = false;
}
} else {
// JMS can't be good if we're not connected to edex cause
// then we don't even know where to connect to
jmsGood = false;
}
}
jmsGood = (jmsGood || disableJms);
if (jmsErrorLabel != null && !jmsErrorLabel.isDisposed()) {
jmsErrorLabel.setVisible(!jmsGood);
}
}
} }

View file

@ -6,8 +6,13 @@ const int RED_BAND = 0;
const int GREEN_BAND = 1; const int GREEN_BAND = 1;
const int BLUE_BAND = 2; const int BLUE_BAND = 2;
uniform DataTexture rawData; uniform sampler2D rawDataTex;
uniform DataMapping dataMapping; uniform DataTextureInfo rawData;
uniform sampler1D dataMappingDataValues;
uniform sampler1D dataMappingColorValues;
uniform int dataMappingValues;
uniform ColorMapping colorMapping; uniform ColorMapping colorMapping;
uniform sampler2D trueColorTexture; uniform sampler2D trueColorTexture;
@ -49,7 +54,7 @@ vec4 applyColorBand(int colorband) {
vec2((xy.x / width), (xy.y / height))); vec2((xy.x / width), (xy.y / height)));
// Lookup raw data value // Lookup raw data value
float dataValue = textureToDataValue(rawData, gl_TexCoord[0].st); float dataValue = textureToDataValue(rawDataTex, rawData, gl_TexCoord[0].st);
float r = curVal.r; float r = curVal.r;
float g = curVal.g; float g = curVal.g;
@ -58,7 +63,7 @@ vec4 applyColorBand(int colorband) {
if (dataValue != rawData.noDataValue && dataValue == dataValue) { if (dataValue != rawData.noDataValue && dataValue == dataValue) {
// Convert dataValue to cmapValue // Convert dataValue to cmapValue
float cmapValue = dataToColorMapValue(dataValue, dataMapping); float cmapValue = dataToColorMapValue(dataValue, dataMappingDataValues, dataMappingColorValues, dataMappingValues);
float index = getColorMappingIndex(cmapValue, colorMapping); float index = getColorMappingIndex(cmapValue, colorMapping);
int currentMask = toBitMask(a); int currentMask = toBitMask(a);

View file

@ -51,6 +51,8 @@ import com.raytheon.uf.viz.core.exception.VizException;
* the start of the array. * the start of the array.
* 08AUG2012 15613 zhao Modified safeFormatTaf() * 08AUG2012 15613 zhao Modified safeFormatTaf()
* Sep 11, 2013 2277 mschenke Got rid of ScriptCreator references * Sep 11, 2013 2277 mschenke Got rid of ScriptCreator references
* Feb 24, 2014 2830 njensen Sort dataTimes in getLatestTafs()
* so it works correctly
* *
* </pre> * </pre>
* *
@ -97,6 +99,11 @@ public class TafUtil {
TafRecord.PLUGIN_NAME)); TafRecord.PLUGIN_NAME));
map.put("stationId", new RequestConstraint(siteID)); map.put("stationId", new RequestConstraint(siteID));
/*
* even if only requesting one, cannot pass in true because that
* will return a DataTime with only refTime set and tafs need to
* have fcstTime, validPeriod, etc set
*/
DataTime[] dt = DataCubeContainer.performTimeQuery(map, false); DataTime[] dt = DataCubeContainer.performTimeQuery(map, false);
if (dt.length == 0) { if (dt.length == 0) {
return null; return null;
@ -105,6 +112,7 @@ public class TafUtil {
if (size > dt.length) { if (size > dt.length) {
size = dt.length; size = dt.length;
} }
Arrays.sort(dt);
DataTime[] requestedTimes = new DataTime[size]; DataTime[] requestedTimes = new DataTime[size];
int k = 0; int k = 0;
for (int i = dt.length - 1; i > -1; i--) { for (int i = dt.length - 1; i > -1; i--) {

View file

@ -3,7 +3,10 @@
#include <mapping> #include <mapping>
#include <coloring> #include <coloring>
uniform sampler1D colorMappingColorMap;
uniform sampler1D colorMappingAlphaMask;
uniform ColorMapping colorMapping; uniform ColorMapping colorMapping;
uniform ColorModifiers modifiers; uniform ColorModifiers modifiers;
uniform float bkgrndRed; uniform float bkgrndRed;
@ -19,12 +22,12 @@ void main(void){
if ( logFactor > 0.0 ) { if ( logFactor > 0.0 ) {
index = getLogFactorIndex(index, logFactor); index = getLogFactorIndex(index, logFactor);
} }
vec4 color = texture1D(colorMapping.colorMap, index).rgba; vec4 color = texture1D(colorMappingColorMap, index).rgba;
// Apply alpha mask if set // Apply alpha mask if set
float alpha = color.a; float alpha = color.a;
if ( applyMask == 1 ) { if ( applyMask == 1 ) {
if ( texture1D(colorMapping.alphaMask , index ).r != 0.0 ) { if ( texture1D(colorMappingAlphaMask , index ).r != 0.0 ) {
color = vec4(bkgrndRed, bkgrndGreen, bkgrndBlue, alpha); color = vec4(bkgrndRed, bkgrndGreen, bkgrndBlue, alpha);
} }
} }

View file

@ -1,13 +1,21 @@
#include <mapping> #include <mapping>
#include <coloring> #include <coloring>
uniform DataTexture rawData; uniform sampler2D rawDataTex;
uniform DataMapping dataMapping; uniform DataTextureInfo rawData;
uniform sampler1D dataMappingDataValues;
uniform sampler1D dataMappingColorValues;
uniform int dataMappingValues;
uniform sampler1D colorMappingColorMap;
uniform sampler1D colorMappingAlphaMask;
uniform ColorMapping colorMapping; uniform ColorMapping colorMapping;
uniform ColorModifiers modifiers; uniform ColorModifiers modifiers;
void main(void) { void main(void) {
float dataValue = textureToDataValue(rawData, gl_TexCoord[0].st); float dataValue = textureToDataValue(rawDataTex, rawData, gl_TexCoord[0].st);
// No data check/special NaN check // No data check/special NaN check
if (dataValue == rawData.noDataValue || dataValue != dataValue) { if (dataValue == rawData.noDataValue || dataValue != dataValue) {
@ -16,9 +24,9 @@ void main(void) {
} }
// Convert dataValue to cmapValue // Convert dataValue to cmapValue
float cmapValue = dataToColorMapValue(dataValue, dataMapping); float cmapValue = dataToColorMapValue(dataValue, dataMappingDataValues, dataMappingColorValues, dataMappingValues);
// Get color for colormapping, given value // Get color for colormapping, given value
vec4 textureColor = getColorByValue(cmapValue, colorMapping); vec4 textureColor = getColorByValue(cmapValue, colorMapping, colorMappingColorMap, colorMappingAlphaMask);
// Apply the color modifiers into gl_FragColor // Apply the color modifiers into gl_FragColor
gl_FragColor = applyColorModifiers(textureColor, modifiers); gl_FragColor = applyColorModifiers(textureColor, modifiers);
} }

View file

@ -8,8 +8,7 @@
* implied data will range 0-1 and need scaling to get raw value * implied data will range 0-1 and need scaling to get raw value
* where scaleMin maps to 0 and scaleMax maps to 1. * where scaleMin maps to 0 and scaleMax maps to 1.
*/ */
struct DataTexture { struct DataTextureInfo {
sampler2D rawTex;
float noDataValue; float noDataValue;
int isScaled; int isScaled;
float scaleMin; float scaleMin;
@ -18,23 +17,9 @@ struct DataTexture {
float height; float height;
}; };
/**
* Fields used for converting from image data values to
* colormapping data values. Done to avoid conversions in
* application code. dmv[i] -> cmv[i]. Linear interpolation
* is done where non-exact matches are found. Mappings should
* be uploaded as floats so no scaling is needed
*/
struct DataMapping {
sampler1D dataMappingValues;
sampler1D colorMappingValues;
int numMappingValues;
};
struct ColorMapping { struct ColorMapping {
/** Fields for color map and size. colorMap contains colors to /** Fields for color map and size. colorMap contains colors to
* use for mapping. cmapMin/Max is range colormap is applied over */ * use for mapping. cmapMin/Max is range colormap is applied over */
sampler1D colorMap;
float cmapMin; float cmapMin;
float cmapMax; float cmapMax;
@ -42,7 +27,6 @@ struct ColorMapping {
* same size as colorMap and contains 0s and 1s, 1 indicating alpha * same size as colorMap and contains 0s and 1s, 1 indicating alpha
* should be set to completely transparent */ * should be set to completely transparent */
int applyMask; int applyMask;
sampler1D alphaMask;
/** Fields for logarithmic and mirrored indexing into the colorMap */ /** Fields for logarithmic and mirrored indexing into the colorMap */
int isMirrored; int isMirrored;
@ -51,28 +35,28 @@ struct ColorMapping {
}; };
/** /**
* Returns the data value for the DataTexture at location. * Returns the data value for the DataTextureInfo at location.
*/ */
float textureToDataValue(DataTexture texture, vec2 location) { float textureToDataValue(sampler2D texture, DataTextureInfo info, vec2 location) {
vec4 textureValue = texture2D(texture.rawTex, location); vec4 textureValue = texture2D(texture, location);
float dataValue = textureValue.r; float dataValue = textureValue.r;
if (texture.isScaled == 1) { if (info.isScaled == 1) {
// Convert to non-scaled value // Convert to non-scaled value
dataValue = ((dataValue * (texture.scaleMax - texture.scaleMin)) dataValue = ((dataValue * (info.scaleMax - info.scaleMin))
+ texture.scaleMin); + info.scaleMin);
} }
return dataValue; return dataValue;
} }
/** /**
* Returns the data value for the DataTexture at location. * Returns the data value for the DataTextureInfo at location.
*/ */
float dataToTextureValue(DataTexture texture, float dataValue) { float dataToTextureValue(DataTextureInfo info, float dataValue) {
float textureValue = dataValue; float textureValue = dataValue;
if (texture.isScaled == 1) { if (info.isScaled == 1) {
textureValue = (dataValue - texture.scaleMin) textureValue = (dataValue - info.scaleMin)
/ (texture.scaleMax - texture.scaleMin); / (info.scaleMax - info.scaleMin);
} }
return textureValue; return textureValue;
} }
@ -86,10 +70,9 @@ float lookupMappingValue(sampler1D mappingTex, int index,
} }
/** /**
* Converts a data value into a colorMap value given the DataMapping * Converts a data value into a colorMap value given the data mapping info
*/ */
float dataToColorMapValue(float dataValue, DataMapping mapping) { float dataToColorMapValue(float dataValue, sampler1D dataMappingDataValues, sampler1D dataMappingColorValues, int numMappingValues) {
int numMappingValues = mapping.numMappingValues;
if (numMappingValues == 0) { if (numMappingValues == 0) {
// Short circuit if no mapping is needed // Short circuit if no mapping is needed
return dataValue; return dataValue;
@ -99,9 +82,9 @@ float dataToColorMapValue(float dataValue, DataMapping mapping) {
int lowIndex = 0; int lowIndex = 0;
int highIndex = numMappingValues - 1; int highIndex = numMappingValues - 1;
float lowValue = lookupMappingValue(mapping.dataMappingValues, lowIndex, float lowValue = lookupMappingValue(dataMappingDataValues, lowIndex,
numMappingValues); numMappingValues);
float highValue = lookupMappingValue(mapping.dataMappingValues, highIndex, float highValue = lookupMappingValue(dataMappingDataValues, highIndex,
numMappingValues); numMappingValues);
int reversed = 0; int reversed = 0;
if (lowValue > highValue) { if (lowValue > highValue) {
@ -117,7 +100,7 @@ float dataToColorMapValue(float dataValue, DataMapping mapping) {
int nextIndex = lowIndex + ((highIndex - lowIndex) / 2); int nextIndex = lowIndex + ((highIndex - lowIndex) / 2);
if (nextIndex > lowIndex && nextIndex < highIndex) { if (nextIndex > lowIndex && nextIndex < highIndex) {
// Look up next value and determine if it is a high or low // Look up next value and determine if it is a high or low
float nextValue = lookupMappingValue(mapping.dataMappingValues, float nextValue = lookupMappingValue(dataMappingDataValues,
nextIndex, numMappingValues); nextIndex, numMappingValues);
if (nextValue < dataValue) { if (nextValue < dataValue) {
if (reversed == 0) { if (reversed == 0) {
@ -146,9 +129,9 @@ float dataToColorMapValue(float dataValue, DataMapping mapping) {
factor = 1.0 - factor; factor = 1.0 - factor;
} }
float lowCmapValue = lookupMappingValue(mapping.colorMappingValues, float lowCmapValue = lookupMappingValue(dataMappingColorValues,
lowIndex, numMappingValues); lowIndex, numMappingValues);
float highCmapValue = lookupMappingValue(mapping.colorMappingValues, float highCmapValue = lookupMappingValue(dataMappingColorValues,
highIndex, numMappingValues); highIndex, numMappingValues);
return lowCmapValue + (highCmapValue - lowCmapValue) * factor; return lowCmapValue + (highCmapValue - lowCmapValue) * factor;
@ -180,16 +163,16 @@ float getLinearIndex(float cmapValue, float cmapMin, float cmapMax) {
*/ */
float valueToLogIndex(float value, float rangeMin, float rangeMax) { float valueToLogIndex(float value, float rangeMin, float rangeMax) {
// Account for 0 min index // Account for 0 min index
if (rangeMin == 0) { if (rangeMin == 0.0) {
rangeMin = 0.0000001; rangeMin = 0.0000001;
if (rangeMax < 0) { if (rangeMax < 0.0) {
rangeMin = -rangeMin; rangeMin = -rangeMin;
} }
} }
int reverse = 0; int reverse = 0;
if ((value < rangeMin && rangeMin > 0) if ((value < rangeMin && rangeMin > 0.0)
|| (value > rangeMin && rangeMin < 0)) { || (value > rangeMin && rangeMin < 0.0)) {
reverse = 1; reverse = 1;
} }
@ -200,7 +183,7 @@ float valueToLogIndex(float value, float rangeMin, float rangeMax) {
// Check uncomputable index value, everything between this range is 0, // Check uncomputable index value, everything between this range is 0,
// rangeMin->rangeMax 0 -> 1, -rangeMin->-rangeMax 0 -> -1 // rangeMin->rangeMax 0 -> 1, -rangeMin->-rangeMax 0 -> -1
if (value <= rangeMin && value >= -rangeMin) { if (value <= rangeMin && value >= -rangeMin) {
return 0; return 0.0;
} }
float index = (log(value) - log(rangeMin)) float index = (log(value) - log(rangeMin))
@ -232,12 +215,12 @@ float getLogIndex(float cmapValue, float cmapMin, float cmapMax, int mirror) {
float index = 0.0; float index = 0.0;
// Flag if min/max values are on opposite sides of zero // Flag if min/max values are on opposite sides of zero
int minMaxOpposite = 0; int minMaxOpposite = 0;
if ((cmapMin < 0 && cmapMax > 0) || (cmapMin > 0 && cmapMax < 0)) { if ((cmapMin < 0.0 && cmapMax > 0.0) || (cmapMin > 0.0 && cmapMax < 0.0)) {
minMaxOpposite = 1; minMaxOpposite = 1;
} }
if (mirror != 0 || minMaxOpposite != 0) { if (mirror != 0 || minMaxOpposite != 0) {
if (cmapMax < 0) { if (cmapMax < 0.0) {
// Invert colormapping if negative range was given // Invert colormapping if negative range was given
cmapValue = -cmapValue; cmapValue = -cmapValue;
} }
@ -261,9 +244,9 @@ float getLogIndex(float cmapValue, float cmapMin, float cmapMax, int mirror) {
float logPosCmapMax = absLogZeroVal + log(posCmapMax); float logPosCmapMax = absLogZeroVal + log(posCmapMax);
// Calculate index which zeroVal is at based on neg max and pos max // Calculate index which zeroVal is at based on neg max and pos max
float zeroValIndex = logNegCmapMax / (logNegCmapMax + logPosCmapMax); float zeroValIndex = logNegCmapMax / (logNegCmapMax + logPosCmapMax);
if (cmapValue > 0) { if (cmapValue > 0.0) {
index = valueToLogIndex(rangeValue, zeroVal, posCmapMax); index = valueToLogIndex(rangeValue, zeroVal, posCmapMax);
index = zeroValIndex + (1 - zeroValIndex) * index; index = zeroValIndex + (1.0 - zeroValIndex) * index;
} else { } else {
index = valueToLogIndex(rangeValue, zeroVal, negCmapMax); index = valueToLogIndex(rangeValue, zeroVal, negCmapMax);
index = zeroValIndex - zeroValIndex * index; index = zeroValIndex - zeroValIndex * index;
@ -277,8 +260,8 @@ float getLogIndex(float cmapValue, float cmapMin, float cmapMax, int mirror) {
if (inverted == 1) { if (inverted == 1) {
index = 1.0 - index; index = 1.0 - index;
} }
if (cmapMin > 0 && cmapValue < rangeMin if (cmapMin > 0.0 && cmapValue < rangeMin
|| (cmapMin < 0 && cmapValue > -rangeMin)) { || (cmapMin < 0.0 && cmapValue > -rangeMin)) {
index = -index; index = -index;
} }
} }
@ -333,13 +316,13 @@ float getColorMappingIndex(float cmapValue, ColorMapping colorMapping) {
/** /**
* Returns a color for the index based on the ColorMapping * Returns a color for the index based on the ColorMapping
*/ */
vec4 getColorByIndex(float index, ColorMapping colorMapping) { vec4 getColorByIndex(float index, sampler1D colorMap, sampler1D alphaMask, int applyMask) {
// Lookup color in colorMap for index // Lookup color in colorMap for index
vec4 textureColor = texture1D(colorMapping.colorMap, index).rgba; vec4 textureColor = texture1D(colorMap, index).rgba;
// Apply alpha mask // Apply alpha mask
if (colorMapping.applyMask == 1) { if (applyMask == 1) {
if (texture1D(colorMapping.alphaMask, index).r != 0.0) { if (texture1D(alphaMask, index).r != 0.0) {
textureColor = vec4(textureColor.rgb, 0.0); textureColor = vec4(textureColor.rgb, 0.0);
} }
} }
@ -349,7 +332,7 @@ vec4 getColorByIndex(float index, ColorMapping colorMapping) {
/** /**
* Returns a color for the cmapValue based on the ColorMapping * Returns a color for the cmapValue based on the ColorMapping
*/ */
vec4 getColorByValue(float cmapValue, ColorMapping colorMapping) { vec4 getColorByValue(float cmapValue, ColorMapping colorMapping, sampler1D colorMap, sampler1D alphaMask) {
return getColorByIndex(getColorMappingIndex(cmapValue, colorMapping), float index = getColorMappingIndex(cmapValue, colorMapping);
colorMapping); return getColorByIndex(index, colorMap, alphaMask, colorMapping.applyMask);
} }

View file

@ -3,21 +3,27 @@
#include <mapping> #include <mapping>
uniform DataTexture imageData; uniform sampler2D imageDataTex;
uniform DataMapping imageToMosaic; uniform DataTextureInfo imageData;
uniform DataTexture mosaicData;
uniform sampler1D imageToMosaicDataValues;
uniform sampler1D imageToMosaicColorValues;
uniform int imageToMosaicValues;
uniform sampler2D mosaicDataTex;
uniform DataTextureInfo mosaicData;
void main(void) { void main(void) {
float imageValue = textureToDataValue(imageData, gl_TexCoord[0].st); float imageValue = textureToDataValue(imageDataTex, imageData, gl_TexCoord[0].st);
vec2 frag_xy = gl_FragCoord.xy; vec2 frag_xy = gl_FragCoord.xy;
float mosaicValue = textureToDataValue(mosaicData, float mosaicValue = textureToDataValue(mosaicDataTex, mosaicData,
vec2(frag_xy.x / mosaicData.width, frag_xy.y / mosaicData.height)); vec2(frag_xy.x / mosaicData.width, frag_xy.y / mosaicData.height));
float newValue = mosaicValue; float newValue = mosaicValue;
// No data check/special NaN check // No data check/special NaN check
if (imageValue != imageData.noDataValue && imageValue == imageValue) { if (imageValue != imageData.noDataValue && imageValue == imageValue) {
// Convert image value to mosaic value // Convert image value to mosaic value
imageValue = dataToColorMapValue(imageValue, imageToMosaic); imageValue = dataToColorMapValue(imageValue, imageToMosaicDataValues, imageToMosaicColorValues, imageToMosaicValues);
if (imageValue > mosaicValue) { if (imageValue > mosaicValue) {
newValue = imageValue; newValue = imageValue;
} }

View file

@ -3,14 +3,20 @@
#include <mapping> #include <mapping>
uniform DataTexture imageData; uniform sampler2D imageDataTex;
uniform DataMapping imageToMosaic; uniform DataTextureInfo imageData;
uniform DataTexture mosaicData;
uniform sampler1D imageToMosaicDataValues;
uniform sampler1D imageToMosaicColorValues;
uniform int imageToMosaicValues;
uniform sampler2D mosaicDataTex;
uniform DataTextureInfo mosaicData;
void main(void) { void main(void) {
float imageValue = textureToDataValue(imageData, gl_TexCoord[0].st); float imageValue = textureToDataValue(imageDataTex, imageData, gl_TexCoord[0].st);
vec2 frag_xy = gl_FragCoord.xy; vec2 frag_xy = gl_FragCoord.xy;
float mosaicValue = textureToDataValue(mosaicData, float mosaicValue = textureToDataValue(mosaicDataTex, mosaicData,
vec2(frag_xy.x / mosaicData.width, frag_xy.y / mosaicData.height)); vec2(frag_xy.x / mosaicData.width, frag_xy.y / mosaicData.height));
float newValue; float newValue;
@ -19,7 +25,7 @@ void main(void) {
// Use existing value // Use existing value
newValue = mosaicValue; newValue = mosaicValue;
} else { } else {
newValue = dataToColorMapValue(imageValue, imageToMosaic); newValue = dataToColorMapValue(imageValue, imageToMosaicDataValues, imageToMosaicColorValues, imageToMosaicValues);
} }
gl_FragColor = vec4(dataToTextureValue(mosaicData, newValue), 0.0, 0.0, gl_FragColor = vec4(dataToTextureValue(mosaicData, newValue), 0.0, 0.0,
1.0); 1.0);

View file

@ -56,7 +56,9 @@ public class GLSLStructFactory {
int texBinding, AbstractGLColormappedImage image) { int texBinding, AbstractGLColormappedImage image) {
ColorMapParameters parameters = image.getColorMapParameters(); ColorMapParameters parameters = image.getColorMapParameters();
AbstractGLColorMapDataFormat dataFormat = image.getDataFormat(); AbstractGLColorMapDataFormat dataFormat = image.getDataFormat();
setFieldUniform(program, name, "rawTex", texBinding); // Set the texture outside the struct
setFieldUniform(program, name + "Tex", texBinding);
// Set struct fields
setFieldUniform(program, name, "noDataValue", setFieldUniform(program, name, "noDataValue",
parameters.getNoDataValue()); parameters.getNoDataValue());
setFieldUniform(program, name, "isScaled", dataFormat.isScaled()); setFieldUniform(program, name, "isScaled", dataFormat.isScaled());
@ -82,11 +84,9 @@ public class GLSLStructFactory {
public static void createDataMapping(GLShaderProgram program, String name, public static void createDataMapping(GLShaderProgram program, String name,
int dataMappingTexBinding, int colorMappingTexBinding, int dataMappingTexBinding, int colorMappingTexBinding,
int numMappingValues) { int numMappingValues) {
setFieldUniform(program, name, "dataMappingValues", setFieldUniform(program, name + "DataValues", dataMappingTexBinding);
dataMappingTexBinding); setFieldUniform(program, name + "ColorValues", colorMappingTexBinding);
setFieldUniform(program, name, "colorMappingValues", setFieldUniform(program, name + "Values", numMappingValues);
colorMappingTexBinding);
setFieldUniform(program, name, "numMappingValues", numMappingValues);
} }
/** /**
@ -101,12 +101,12 @@ public class GLSLStructFactory {
public static void createColorMapping(GLShaderProgram program, String name, public static void createColorMapping(GLShaderProgram program, String name,
int colorMapTexBinding, int alphaMaskTexBinding, int colorMapTexBinding, int alphaMaskTexBinding,
ColorMapParameters parameters) { ColorMapParameters parameters) {
setFieldUniform(program, name, "colorMap", colorMapTexBinding); setFieldUniform(program, name + "ColorMap", colorMapTexBinding);
setFieldUniform(program, name, "cmapMin", parameters.getColorMapMin()); setFieldUniform(program, name, "cmapMin", parameters.getColorMapMin());
setFieldUniform(program, name, "cmapMax", parameters.getColorMapMax()); setFieldUniform(program, name, "cmapMax", parameters.getColorMapMax());
setFieldUniform(program, name, "applyMask", parameters.isUseMask()); setFieldUniform(program, name, "applyMask", parameters.isUseMask());
setFieldUniform(program, name, "alphaMask", alphaMaskTexBinding); setFieldUniform(program, name + "AlphaMask", alphaMaskTexBinding);
setFieldUniform(program, name, "isMirrored", parameters.isMirror()); setFieldUniform(program, name, "isMirrored", parameters.isMirror());
setFieldUniform(program, name, "isLogarithmic", setFieldUniform(program, name, "isLogarithmic",
@ -132,6 +132,13 @@ public class GLSLStructFactory {
private static void setFieldUniform(GLShaderProgram program, private static void setFieldUniform(GLShaderProgram program,
String structName, String fieldName, Object fieldValue) { String structName, String fieldName, Object fieldValue) {
program.setUniform(structName + FIELD_SEPERATOR + fieldName, fieldValue); setFieldUniform(program, structName + FIELD_SEPERATOR + fieldName,
fieldValue);
} }
private static void setFieldUniform(GLShaderProgram program,
String fieldName, Object fieldValue) {
program.setUniform(fieldName, fieldValue);
}
} }

View file

@ -1706,8 +1706,9 @@ public class GLTarget extends AbstractGraphicsTarget implements IGLTarget {
endAzm += 360.0; endAzm += 360.0;
} }
double totalAzimuth = (endAzm - startAzm);
boolean includeSides = circle.includeSides && !fill boolean includeSides = circle.includeSides && !fill
&& ((endAzm - startAzm) < 360.0); && (totalAzimuth < 360.0);
if (fill) { if (fill) {
gl.glBegin(GL.GL_TRIANGLE_FAN); gl.glBegin(GL.GL_TRIANGLE_FAN);
@ -1720,8 +1721,16 @@ public class GLTarget extends AbstractGraphicsTarget implements IGLTarget {
} }
} }
double step = (endAzm - startAzm) / (circle.numberOfPoints); // Get the number of unique points in the circle
for (double azm = startAzm; azm <= endAzm; azm += step) { int points = circle.numberOfPoints;
if (totalAzimuth >= 360) {
// If angle is meant to be complete circle, add extra point
// to ensure circle is touching
points += 1;
}
double step = totalAzimuth / (points - 1);
for (int i = 0; i < points; ++i) {
double azm = startAzm + (i * step);
double[] pointOnCircle = getPointOnCircle(x, y, z, radius, double[] pointOnCircle = getPointOnCircle(x, y, z, radius,
azm); azm);
gl.glVertex3d(pointOnCircle[0], pointOnCircle[1], gl.glVertex3d(pointOnCircle[0], pointOnCircle[1],

View file

@ -36,6 +36,8 @@ import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters.PersistedParameters; import com.raytheon.uf.common.colormap.prefs.ColorMapParameters.PersistedParameters;
import com.raytheon.uf.common.datastorage.DataStoreFactory; import com.raytheon.uf.common.datastorage.DataStoreFactory;
import com.raytheon.uf.common.datastorage.IDataStore; import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.datastorage.Request;
import com.raytheon.uf.common.datastorage.records.IDataRecord;
import com.raytheon.uf.common.geospatial.ReferencedCoordinate; import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
import com.raytheon.uf.common.style.LabelingPreferences; import com.raytheon.uf.common.style.LabelingPreferences;
import com.raytheon.uf.common.style.ParamLevelMatchCriteria; import com.raytheon.uf.common.style.ParamLevelMatchCriteria;
@ -91,6 +93,8 @@ public class TopoResource extends
protected TileSetRenderable topoTileSet; protected TileSetRenderable topoTileSet;
private double noDataValue;
protected TopoResource(TopoResourceData topoData, protected TopoResource(TopoResourceData topoData,
LoadProperties loadProperties, File dataFile) throws VizException { LoadProperties loadProperties, File dataFile) throws VizException {
super(topoData, loadProperties); super(topoData, loadProperties);
@ -189,12 +193,13 @@ public class TopoResource extends
} }
SamplePreferences samplePrefs = prefs.getSamplePrefs(); SamplePreferences samplePrefs = prefs.getSamplePrefs();
if (samplePrefs != null && samplePrefs.getFormatString() != null) { if ((samplePrefs != null)
&& (samplePrefs.getFormatString() != null)) {
params.setFormatString(samplePrefs.getFormatString()); params.setFormatString(samplePrefs.getFormatString());
} }
LabelingPreferences labelPrefs = prefs.getColorbarLabeling(); LabelingPreferences labelPrefs = prefs.getColorbarLabeling();
if (labelPrefs != null && labelPrefs.getValues() != null) { if ((labelPrefs != null) && (labelPrefs.getValues() != null)) {
params.setColorBarIntervals(labelPrefs.getValues()); params.setColorBarIntervals(labelPrefs.getValues());
} }
} }
@ -213,6 +218,16 @@ public class TopoResource extends
getCapability(ColorMapCapability.class).setColorMapParameters(params); getCapability(ColorMapCapability.class).setColorMapParameters(params);
IDataStore dataStore = DataStoreFactory.getDataStore(this.dataFile);
try {
IDataRecord rec = dataStore.retrieve("/", "full",
Request.buildPointRequest(new java.awt.Point(0, 0)));
noDataValue = rec.getFillValue().doubleValue();
} catch (Exception e) {
statusHandler.error(e.getLocalizedMessage(), e);
noDataValue = Double.NaN;
}
topoTileSet = new TileSetRenderable( topoTileSet = new TileSetRenderable(
getCapability(ImagingCapability.class), getTopoGeometry(), getCapability(ImagingCapability.class), getTopoGeometry(),
getTopoTileImageCreator(), getNumberOfTopoLevels(), 512); getTopoTileImageCreator(), getNumberOfTopoLevels(), 512);
@ -284,7 +299,7 @@ public class TopoResource extends
double height; double height;
try { try {
// height = TopoQuery.getInstance().getHeight(coord.asLatLon()); // height = TopoQuery.getInstance().getHeight(coord.asLatLon());
height = topoTileSet.interrogate(coord.asLatLon()); height = topoTileSet.interrogate(coord.asLatLon(), noDataValue);
} catch (Exception e) { } catch (Exception e) {
throw new VizException("Error transforming", e); throw new VizException("Error transforming", e);
} }

View file

@ -1,5 +1,4 @@
#!/bin/bash #!/bin/bash
# CAVE startup script # CAVE startup script
# Note: CAVE will not run as 'root' # Note: CAVE will not run as 'root'
@ -25,8 +24,6 @@
# SOFTWARE HISTORY # SOFTWARE HISTORY
# Date Ticket# Engineer Description # Date Ticket# Engineer Description
# ------------ ---------- ----------- -------------------------- # ------------ ---------- ----------- --------------------------
# Dec 04, 2013 #2589 dgilling Create command-line arg that controls
# xvfb initialization.
# Dec 05, 2013 #2593 rjpeter set IGNORE_NUM_CAVES # Dec 05, 2013 #2593 rjpeter set IGNORE_NUM_CAVES
# Dec 05, 2013 #2590 dgilling Remove duplicated code and call to # Dec 05, 2013 #2590 dgilling Remove duplicated code and call to
# cave.sh. # cave.sh.
@ -50,22 +47,6 @@ fi
PROGRAM_NAME="gfeclient" PROGRAM_NAME="gfeclient"
# remove "-enablegl" flag from command-line if set so it doesn't confuse any
# commands we call later.
USER_ARGS=()
while [[ $1 ]]
do
if [ "$1" == "-enablegl" ]
then
ENABLEGL="true"
else
USER_ARGS+=("$1")
fi
shift
done
if [ -n "$ENABLEGL" ]
then
# if display not set # if display not set
if [ -n "$DISPLAY" ] if [ -n "$DISPLAY" ]
then then
@ -80,12 +61,11 @@ then
#don't use shader when no display set #don't use shader when no display set
SWITCHES="${SWITCHES} -no_shader" SWITCHES="${SWITCHES} -no_shader"
fi fi
fi
export IGNORE_NUM_CAVES=1 export IGNORE_NUM_CAVES=1
source /awips2/cave/cave.sh -nosplash -noredirect -component gfeclient "${USER_ARGS[@]}" & source /awips2/cave/cave.sh -nosplash -noredirect -component gfeclient "$@" &
wait wait $!
if [ -n "$xvfb" ] if [ -n "$xvfb" ]
then then

View file

@ -22,8 +22,7 @@
# SOFTWARE HISTORY # SOFTWARE HISTORY
# Date Ticket# Engineer Description # Date Ticket# Engineer Description
# ------------ ---------- ----------- -------------------------- # ------------ ---------- ----------- --------------------------
# Dec 04, 2013 #2589 dgilling Create command-line arg that controls # Feb 07, 2014 #2509 dgilling Fix baseline merge issue.
# xvfb initialization.
# #
# #
@ -37,8 +36,7 @@ CAVE_DIR=/awips2/cave
# execute the runProcedure module # execute the runProcedure module
_GFECLI="${RUN_FROM_DIR}/gfeclient.sh" _GFECLI="${RUN_FROM_DIR}/gfeclient.sh"
_GFECLI_ARGS="-enablegl" _MODULE="${RUN_FROM_DIR}/src/ifpimage/PngWriter.py"
_MODULE="${CAVE_DIR}/etc/gfe/utility/PngWriter.py"
# quoting of '$@' is used to prevent command line interpretation # quoting of '$@' is used to prevent command line interpretation
if [ ! -f $_GFECLI ] || [ ! -d $CAVE_DIR ] if [ ! -f $_GFECLI ] || [ ! -d $CAVE_DIR ]
@ -46,6 +44,6 @@ then
echo "CAVE and/or gfeclient not installed on this workstation ..exiting" echo "CAVE and/or gfeclient not installed on this workstation ..exiting"
exit 1 exit 1
else else
$_GFECLI $_GFECLI_ARGS $_MODULE "$@" $_GFECLI $_MODULE "$@"
fi fi

View file

@ -32,10 +32,14 @@
# 09/24/13 1843 dgilling Handle GetNextEtnResponse. # 09/24/13 1843 dgilling Handle GetNextEtnResponse.
# 11/20/13 2490 randerso Corrected error handling in __getActiveTable # 11/20/13 2490 randerso Corrected error handling in __getActiveTable
# #
# 02/05/14 2774 dgilling Fix error logging statements in
# __warnETNduplication() and
# __highestETNActiveTable.
# #
import time, getopt, sys, copy, string, logging import time, getopt, sys, copy, string, logging
import os
import VTECTableUtil, VTECTable import VTECTableUtil, VTECTable
import TimeRange, AbsTime, ActiveTableVtec import TimeRange, AbsTime, ActiveTableVtec
import JUtil import JUtil
@ -724,7 +728,7 @@ class HazardsTable(VTECTableUtil.VTECTableUtil):
if phensig == activephensig and presentyear == activeyear: if phensig == activephensig and presentyear == activeyear:
# causes failure if tropical hazards are less than 1001 # causes failure if tropical hazards are less than 1001
if active['etn'] < int(self.__tpcBaseETN): if active['etn'] < int(self.__tpcBaseETN):
LogStream.logProblem("Incorrect ETN for tropical hazard.") self.log.error("Incorrect ETN for tropical hazard.")
return etn_base return etn_base
#determine the new etn to use, using the etn cache #determine the new etn to use, using the etn cache
@ -927,10 +931,8 @@ class HazardsTable(VTECTableUtil.VTECTableUtil):
return table return table
except: except:
import traceback self.log.exception("Unable to access VTEC Active Table: ")
s = "Unable to access VTEC Active Table: " raise Exception, s
self.log.exception(s)
raise Exception(s + traceback.format_exc())
def __createCityHazards(self): def __createCityHazards(self):
if not self.__accurateCities: if not self.__accurateCities:
@ -2238,8 +2240,8 @@ class HazardsTable(VTECTableUtil.VTECTableUtil):
if len(dups) > 0: if len(dups) > 0:
errorLine = '\n******************************************************\n' errorLine = '\n******************************************************\n'
LogStream.logProblem("Illegal ETN duplication is found for:\n", \ self.log.error("Illegal ETN duplication is found for:\n" + \
dups, errorLine) str(dups) + errorLine)
# send message to GFE # send message to GFE
msg = "The formatted %s product contains a duplicate ETN.\n"\ msg = "The formatted %s product contains a duplicate ETN.\n"\

View file

@ -505,16 +505,16 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
def windSpdProb_thresholds(self, tree, node): def windSpdProb_thresholds(self, tree, node):
return [ return [
((50.0, 80.0), (40.0, 60.0)), # Per 1 ((45.0, 80.0), (25.0, 60.0)), # Per 1
(45.0, 32.5), # Per 2 (35.0, 20.0), # Per 2
(40.0, 25.0), # Per 3 (30.0, 15.0), # Per 3
(35.0, 20.0), # Per 4 (25.0, 12.5), # Per 4
(30.0, 15.0), # Per 5 (22.5, 10.0), # Per 5
(25.0, 12.5), # Per 6 (20.0, 8.0), # Per 6
(22.5, 10.0), # Per 7 (17.5, 7.0), # Per 7
(20.0, 8.0), # Per 8 (15.0, 6.0), # Per 8
(17.5, 6.0), # Per 9 (12.5, 5.0), # Per 9
(15.0, 5.0), # Per 10 (10.0, 4.0), # Per 10
] ]
def firstComponentPeriod(self, tree, node): def firstComponentPeriod(self, tree, node):
@ -1130,7 +1130,7 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
desc = "posHR" desc = "posHR"
elif maxMag >= 34.0: elif maxMag >= 34.0:
desc = "posTS" desc = "posTS"
elif pws64 >= thresh64low or pws64 +2.0 >= thresh64low: elif pws64 >= thresh64low or pws64 +5.0 >= thresh64low:
desc = "posHR" desc = "posHR"
elif pws34 >= thresh34low or pws34+10.0 >= thresh34low: elif pws34 >= thresh34low or pws34+10.0 >= thresh34low:
desc = "posTS" desc = "posTS"
@ -1203,7 +1203,7 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
desc = "posHR" desc = "posHR"
elif maxMag >= 34.0: elif maxMag >= 34.0:
desc = "posTS" desc = "posTS"
elif pws64 >= thresh64 or pws64 +2.0 >= thresh64: elif pws64 >= thresh64 or pws64 +5.0 >= thresh64:
desc = "posHR" desc = "posHR"
elif pws34 >= thresh34 or pws34+10.0 >= thresh34: elif pws34 >= thresh34 or pws34+10.0 >= thresh34:
desc = "posTS" desc = "posTS"
@ -1299,7 +1299,7 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
else: else:
self.debug_print("HERE I AM") self.debug_print("HERE I AM")
if pws64 >= thresh64 or pws64+1.0 >= thresh64: if pws64 >= thresh64 or pws64+2.5 >= thresh64:
desc = "posHR" desc = "posHR"
elif maxMag >= 64.0: elif maxMag >= 64.0:
desc = "posHR" desc = "posHR"
@ -1399,7 +1399,7 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
else: else:
self.debug_print("HERE I AM") self.debug_print("HERE I AM")
if pws64 >= thresh64 or pws64+1 >= thresh64: if pws64 >= thresh64 or pws64+2.5 >= thresh64:
desc = "posHR" desc = "posHR"
elif maxMag >= 64.0: elif maxMag >= 64.0:
desc = "posHR" desc = "posHR"
@ -1435,14 +1435,18 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
self.debug_print("(34 kt threshold, 64 kt threshold) = (%.2f, %.2f)" % self.debug_print("(34 kt threshold, 64 kt threshold) = (%.2f, %.2f)" %
(thresh34, thresh64), 1) (thresh34, thresh64), 1)
if (pws64 >= thresh64 or (pws64 + 1.0) >= thresh64) and maxMag >= 20.0: if (pws64 >= thresh64 or (pws64 + 1.0) >= thresh64):
desc = "posHR" desc = "posHR"
elif maxMag >= 64.0: elif maxMag >= 64.0:
desc = "posHR" desc = "posHR"
elif (pws34 >= thresh34 or (pws34 + 2.5) >= thresh34) and maxMag >= 20.0: elif (self._Hurricane_A or self._Hurricane_W) and maxMag >= 50:
desc = "posHR"
elif (pws34 >= thresh34 or (pws34 + 2.5) >= thresh34):
desc = "posTS" desc = "posTS"
elif maxMag >= 34.0: elif maxMag >= 34.0:
desc = "posTS" desc = "posTS"
elif (self._Hurricane_A or self._Hurricane_W or self._TropStorm_A or self._TropStorm_W) and maxMag >= 25:
desc = "posTS"
else: else:
desc = "" desc = ""
@ -1470,14 +1474,18 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
self.debug_print("(34 kt threshold, 64 kt threshold) = (%.2f, %.2f)" % self.debug_print("(34 kt threshold, 64 kt threshold) = (%.2f, %.2f)" %
(thresh34, thresh64), 1) (thresh34, thresh64), 1)
if (pws64 >= thresh64 or (pws64 + 1.0) >= thresh64) and maxMag >= 20.0: if (pws64 >= thresh64 or (pws64 + 1.0) >= thresh64):
desc = "posHR" desc = "posHR"
elif maxMag >= 64.0: elif maxMag >= 64.0:
desc = "posHR" desc = "posHR"
elif (pws34 >= thresh34 or (pws34 + 2.5) >= thresh34) and maxMag >= 20.0: elif (self._Hurricane_A or self._Hurricane_W) and maxMag >= 50:
desc = "posHR"
elif (pws34 >= thresh34 or (pws34 + 2.5) >= thresh34):
desc = "posTS" desc = "posTS"
elif maxMag >= 34.0: elif maxMag >= 34.0:
desc = "posTS" desc = "posTS"
elif (self._Hurricane_A or self._Hurricane_W or self._TropStorm_A or self._TropStorm_W) and maxMag >= 25:
desc = "posTS"
else: else:
desc = "" desc = ""

View file

@ -29,7 +29,7 @@
# ------------ ---------- ----------- -------------------------- # ------------ ---------- ----------- --------------------------
# 07/25/08 njensen Initial Creation. # 07/25/08 njensen Initial Creation.
# 09/05/13 #2329 randerso Added error handling # 09/05/13 #2329 randerso Added error handling
# # 02/06/2014 #2591 randerso Changed log level to debug
# #
import sys, traceback, os, time, LogStream import sys, traceback, os, time, LogStream
@ -55,7 +55,7 @@ def getCombinations(comboName):
with open(filename,'r') as fd: with open(filename,'r') as fd:
filecontents = fd.read() filecontents = fd.read()
LogStream.logProblem("\nERROR loading combinations file: "+ comboName + LogStream.logDebug("ERROR loading combinations file: "+ comboName +
"\nmd.__file__: " + md.__file__ + "\nmd.__file__: " + md.__file__ +
"\ndir(md): " + str(dir(md)) + "\ndir(md): " + str(dir(md)) +
"\n" + md.__file__ + " last modified: " + time.strftime("%Y-%m-%d %H:%M:%S",time.gmtime(os.path.getmtime(md.__file__))) + "\n" + md.__file__ + " last modified: " + time.strftime("%Y-%m-%d %H:%M:%S",time.gmtime(os.path.getmtime(md.__file__))) +

View file

@ -63,6 +63,7 @@ import com.raytheon.viz.gfe.textformatter.TextProductManager;
* DataManager instance. * DataManager instance.
* 05 SEP 2013 2329 randerso Added call to ZoneCombinerComp.applyZoneCombo when * 05 SEP 2013 2329 randerso Added call to ZoneCombinerComp.applyZoneCombo when
* when run formatter button is clicked. * when run formatter button is clicked.
* 05 FEB 2014 2591 randerso Added dataManager to ZoneCombinerComp constructor
* *
* </pre> * </pre>
* *
@ -592,7 +593,7 @@ public class ProductAreaComp extends Composite implements
*/ */
private void createZoneCombinerComp() { private void createZoneCombinerComp() {
zoneCombiner = new ZoneCombinerComp(stackGridComp, productTabCB, zoneCombiner = new ZoneCombinerComp(stackGridComp, productTabCB,
productName, getTextProductManager()); productName, getTextProductManager(), this.dataMgr);
} }
/** /**

View file

@ -152,6 +152,10 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* 05/08/2013 #1842 dgilling Add alternate setProductText(), fix * 05/08/2013 #1842 dgilling Add alternate setProductText(), fix
* warnings. * warnings.
* 09/03/2013 16534 ryu Refactor; sneak in a change for Ron (RM #1597). * 09/03/2013 16534 ryu Refactor; sneak in a change for Ron (RM #1597).
* 01/06/2014 2649 dgilling Pass flag to StoreTransmitDlg to only
* update VTEC lines on products that
* aren't being corrected.
* 02/05/2014 17022 ryu Modified loadDraft() to fix merging of WMO heading and AWIPS ID.
* *
* </pre> * </pre>
* *
@ -1139,7 +1143,7 @@ public class ProductEditorComp extends Composite implements
// prevent the launching of another dialog until the modal dialog is // prevent the launching of another dialog until the modal dialog is
// closed. // closed.
StoreTransmitDlg storeDlg = new StoreTransmitDlg(parent.getShell(), StoreTransmitDlg storeDlg = new StoreTransmitDlg(parent.getShell(),
showStore, this, transmissionCB, pid); showStore, this, transmissionCB, pid, !textComp.isCorMode());
storeDlg.open(); storeDlg.open();
} }
} }
@ -2386,10 +2390,13 @@ public class ProductEditorComp extends Composite implements
} }
DraftProduct draft = DraftProduct.load(lf); DraftProduct draft = DraftProduct.load(lf);
setTabColorFunc(productStateEnum.Finished);
productDefinition = draft.getProductDefinition(); productDefinition = draft.getProductDefinition();
clearProductText();
setProductText(draft.getProductText()); setProductText(draft.getProductText());
setTabColorFunc(productStateEnum.Finished);
setStatusText('R', productId + " draft loaded."); setStatusText('R', productId + " draft loaded.");
if (productDefinition.get("brain") != null) { if (productDefinition.get("brain") != null) {
brain(); brain();
String msg = "Your saved draft was loaded, but the draft is invalid " String msg = "Your saved draft was loaded, but the draft is invalid "

View file

@ -67,19 +67,24 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 21 APR 2008 ### lvenable Initial creation * Apr 21, 2008 ### lvenable Initial creation
* 19 FEB 2010 4132 ryu Product correction. * Feb 19, 2010 4132 ryu Product correction.
* 28May2010 2187 cjeanbap Added StdTextProductFactory * May 28, 2010 2187 cjeanbap Added StdTextProductFactory
* functionality. * functionality.
* 09 NOV 2012 1298 rferrel Changes for non-blocking dialog. * Nov 09, 2012 1298 rferrel Changes for non-blocking dialog.
* 02apr2013 15564 mgamazaychikov Ensured awipsWanPil to be 10 characters space-padded long * Apr 02, 2013 15564 mgamazaychikov Ensured awipsWanPil to be 10 characters
* 08 MAY 2013 1842 dgilling Use VtecUtil to set product ETNs, fix * space-padded long
* May 08, 2013 1842 dgilling Use VtecUtil to set product ETNs, fix
* warnings. * warnings.
* 07 Jun 2013 1981 mpduff Set user's id in OUPRequest as it is now a protected operation. * Jun 07, 2013 1981 mduff Set user's id in OUPRequest as it is
* 23 Oct 2013 1843 dgilling Ensure that dialog is always closed, * now a protected operation.
* Oct 23, 2013 1843 dgilling Ensure that dialog is always closed,
* even on failure, changes for error handling * even on failure, changes for error handling
* of intersite ETN assignment. * of intersite ETN assignment.
* 18 Dec 2013 2641 dgilling Support changes to GFEVtecUtil.getVtecLinesThatNeedEtn(). * Dec 18, 2013 2641 dgilling Support changes to GFEVtecUtil.getVtecLinesThatNeedEtn().
* Jan 06, 2014 2649 dgilling Make ETN assignment process optional.
* Feb 17, 2014 2774 dgilling Merge changes from 14.1 baseline to 14.2.
*
* </pre> * </pre>
* *
* @author lvenable * @author lvenable
@ -142,17 +147,26 @@ public class StoreTransmitDlg extends CaveSWTDialog implements
private final String pid; private final String pid;
private final boolean updateVtec;
/** /**
* Constructor.
*
* @param parent * @param parent
* Parent shell. * Parent shell.
* @param storeDialog * @param storeDialog
* Store flag. True is store, false is transmit. * Store flag. True is store, false is transmit.
* @param editor
* Parent editor. Product will be updated in this editor after
* transmission.
* @param transmissionCB
* @param pid
* @param updateVtec
* Whether or not to update the ETNs of any VTEC lines in the
* product to be transmitted. Recommend setting this to false
* when correcting a previously transmitted product.
*/ */
public StoreTransmitDlg(Shell parent, boolean storeDialog, public StoreTransmitDlg(Shell parent, boolean storeDialog,
ProductEditorComp editor, ITransmissionState transmissionCB, ProductEditorComp editor, ITransmissionState transmissionCB,
String pid) { String pid, boolean updateVtec) {
super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL, super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL,
CAVE.DO_NOT_BLOCK); CAVE.DO_NOT_BLOCK);
@ -161,6 +175,7 @@ public class StoreTransmitDlg extends CaveSWTDialog implements
parentEditor = editor; parentEditor = editor;
this.productText = editor.getProductText(); this.productText = editor.getProductText();
this.pid = pid; this.pid = pid;
this.updateVtec = updateVtec;
} }
@Override @Override
@ -344,114 +359,78 @@ public class StoreTransmitDlg extends CaveSWTDialog implements
// Store/Transmit the product... // Store/Transmit the product...
if (!countdownThread.threadCancelled()) { if (!countdownThread.threadCancelled()) {
boolean retrieveEtnFailed = false; try {
if (updateVtec) {
List<VtecObject> vtecsToAssignEtn = GFEVtecUtil // With GFE VTEC products, it's possible to have multiple
.getVtecLinesThatNeedEtn(productText); // segments with NEW vtec action codes and the same phensig.
// With GFE VTEC products, it's possible to have multiple segments // For
// with // this reason, HazardsTable.py implemented a "cache" that
// NEW vtec action codes and the same phensig. For this reason, // would
// HazardsTable.py implemented a "cache" that would ensure all NEWs // ensure all NEWs for the same phensig would be assigned
// for // the
// the same phensig would be assigned the same ETN. This Map // same ETN. This Map replicates that legacy behavior.
// replicates
// that legacy behavior.
// //
// This "cache" has two levels: // This "cache" has two levels:
// 1. The first level is keyed by the hazard's phensig. // 1. The first level is keyed by the hazard's phensig.
// 2. The second level is keyed by the valid period of the hazard. // 2. The second level is keyed by the valid period of the
// Effectively, making this a Map<Phensig, Map<ValidPeriod, ETN>>. // hazard.
// Effectively, making this a Map<Phensig, Map<ValidPeriod,
// ETN>>.
Map<String, List<VtecObject>> vtecsToAssignEtn = GFEVtecUtil
.initETNCache(productText);
Map<String, Map<TimeRange, Integer>> etnCache = new HashMap<String, Map<TimeRange, Integer>>(); Map<String, Map<TimeRange, Integer>> etnCache = new HashMap<String, Map<TimeRange, Integer>>();
for (VtecObject vtec : vtecsToAssignEtn) { for (String phensig : vtecsToAssignEtn.keySet()) {
try { Map<TimeRange, Integer> l2EtnCache = new HashMap<TimeRange, Integer>();
GetNextEtnResponse serverResponse = GFEVtecUtil.getNextEtn( List<VtecObject> vtecs = vtecsToAssignEtn.get(phensig);
vtec.getOffice(), vtec.getPhensig(), true, true);
if (!serverResponse.isOkay()) {
final VtecObject vtecToFix = vtec;
final boolean[] exitLoopContainer = { false };
final Exception[] exceptionContainer = { null };
final GetNextEtnResponse[] responseContainer = { serverResponse };
do { for (int i = 0; i < vtecs.size(); i++) {
getDisplay().syncExec(new Runnable() { VtecObject vtec = vtecs.get(i);
@Override TimeRange validPeriod = new TimeRange(
public void run() { vtec.getStartTime(), vtec.getEndTime());
GetNextEtnResponse serverResponse = responseContainer[0]; Integer currentEtn = vtec.getSequence();
ETNConfirmationDialog dlg = new ETNConfirmationDialog(
getShell(), serverResponse); // the first time we select a new, unique ETN, any
if (dlg.open() == ETNConfirmationDialog.OK) { // other
int etn = dlg.getProposedEtn(); // VTEC lines in the product that have the same
statusHandler.info(String // phensig
.format("User confirmed ETN for %s: %04d", // and an adjacent TimeRange can also re-use this
serverResponse // ETN
.getPhensig(), if (currentEtn == 0) {
etn)); currentEtn = getNextEtn(vtec);
try { l2EtnCache.put(validPeriod, currentEtn);
GetNextEtnResponse followupResp = GFEVtecUtil.getNextEtn(
vtecToFix.getOffice(),
vtecToFix.getPhensig(),
true, true, true, etn);
responseContainer[0] = followupResp;
} catch (VizException e) {
exceptionContainer[0] = e;
exitLoopContainer[0] = true;
}
} else { } else {
statusHandler // BUT...once we've made our one pass through
.info("User declined to fix ETN for %s", // the
serverResponse // product and re-used the ETN where
.getPhensig()); // appropriate, we
exitLoopContainer[0] = true; // should not check again
continue;
} }
}
});
} while (!responseContainer[0].isOkay()
&& !exitLoopContainer[0]);
if (!responseContainer[0].isOkay()) { for (int j = i + 1; j < vtecs.size(); j++) {
String msg = "Unable to set ETN for phensig " VtecObject vtec2 = vtecs.get(j);
+ responseContainer[0].getPhensig() TimeRange validPeriod2 = new TimeRange(
+ "\nStatus: " vtec2.getStartTime(),
+ responseContainer[0].toString(); vtec2.getEndTime());
Exception e = exceptionContainer[0]; Integer currentEtn2 = vtec2.getSequence();
if (e == null) {
throw new VizException(msg); if ((currentEtn2 == 0)
} else { && (validPeriod2
throw new VizException(msg, e); .isAdjacentTo(validPeriod) || validPeriod2
.overlaps(validPeriod))) {
l2EtnCache.put(validPeriod2, currentEtn);
vtec2.setSequence(currentEtn);
} }
} else {
serverResponse = responseContainer[0];
} }
} }
TimeRange validPeriod = new TimeRange(vtec.getStartTime() etnCache.put(phensig, l2EtnCache);
.getTime(), vtec.getEndTime().getTime());
String phensig = vtec.getPhensig();
Map<TimeRange, Integer> etnsByTR = etnCache.get(phensig);
if (etnsByTR == null) {
etnsByTR = new HashMap<TimeRange, Integer>();
etnCache.put(phensig, etnsByTR);
}
etnsByTR.put(validPeriod, serverResponse.getNextEtn());
} catch (VizException e) {
statusHandler.handle(Priority.CRITICAL,
"Error setting ETNs for product", e);
retrieveEtnFailed = true;
VizApp.runAsync(new Runnable() {
@Override
public void run() {
sendTransmissionStatus(ConfigData.productStateEnum.Failed);
StoreTransmitDlg.this.parentEditor.revive();
}
});
break;
}
} }
if (!retrieveEtnFailed) { productText = GFEVtecUtil.finalizeETNs(productText,
productText = GFEVtecUtil.finalizeETNs(productText, etnCache); etnCache);
}
VizApp.runSync(new Runnable() { VizApp.runSync(new Runnable() {
@ -476,6 +455,17 @@ public class StoreTransmitDlg extends CaveSWTDialog implements
} }
}); });
} catch (VizException e) {
statusHandler.handle(Priority.CRITICAL,
"Error preparing product for transmission.", e);
VizApp.runAsync(new Runnable() {
@Override
public void run() {
sendTransmissionStatus(ConfigData.productStateEnum.Failed);
StoreTransmitDlg.this.parentEditor.revive();
}
});
} }
} }
@ -490,6 +480,65 @@ public class StoreTransmitDlg extends CaveSWTDialog implements
}); });
} }
private Integer getNextEtn(VtecObject vtec) throws VizException {
GetNextEtnResponse serverResponse = GFEVtecUtil.getNextEtn(
vtec.getOffice(), vtec.getPhensig(), true, true);
if (!serverResponse.isOkay()) {
final VtecObject vtecToFix = vtec;
final boolean[] exitLoopContainer = { false };
final Exception[] exceptionContainer = { null };
final GetNextEtnResponse[] responseContainer = { serverResponse };
do {
getDisplay().syncExec(new Runnable() {
@Override
public void run() {
GetNextEtnResponse serverResponse = responseContainer[0];
ETNConfirmationDialog dlg = new ETNConfirmationDialog(
getShell(), serverResponse);
if (dlg.open() == ETNConfirmationDialog.OK) {
int etn = dlg.getProposedEtn();
statusHandler.info(String.format(
"User confirmed ETN for %s: %04d",
serverResponse.getPhensig(), etn));
try {
GetNextEtnResponse followupResp = GFEVtecUtil
.getNextEtn(vtecToFix.getOffice(),
vtecToFix.getPhensig(), true,
true, true, etn);
responseContainer[0] = followupResp;
} catch (VizException e) {
exceptionContainer[0] = e;
exitLoopContainer[0] = true;
}
} else {
statusHandler.info(
"User declined to fix ETN for %s",
serverResponse.getPhensig());
exitLoopContainer[0] = true;
}
}
});
} while (!responseContainer[0].isOkay() && !exitLoopContainer[0]);
if (!responseContainer[0].isOkay()) {
String msg = "Unable to set ETN for phensig "
+ responseContainer[0].getPhensig() + "\nStatus: "
+ responseContainer[0].toString();
Exception e = exceptionContainer[0];
if (e == null) {
throw new VizException(msg);
} else {
throw new VizException(msg, e);
}
} else {
serverResponse = responseContainer[0];
}
}
return serverResponse.getNextEtn();
}
/** /**
* Method to transmit the product. * Method to transmit the product.
*/ */

View file

@ -58,8 +58,7 @@ import org.opengis.referencing.operation.TransformException;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridLocation; import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridLocation;
import com.raytheon.uf.common.dataplugin.gfe.exception.GfeException; import com.raytheon.uf.common.dataplugin.gfe.exception.GfeException;
import com.raytheon.uf.common.localization.FileUpdatedMessage; import com.raytheon.uf.common.dataplugin.gfe.server.notify.CombinationsFileChangedNotification;
import com.raytheon.uf.common.localization.ILocalizationFileObserver;
import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext; import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
@ -74,7 +73,9 @@ import com.raytheon.uf.viz.core.RGBColors;
import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.gfe.Activator; import com.raytheon.viz.gfe.Activator;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.core.DataManagerUIFactory; import com.raytheon.viz.gfe.core.DataManagerUIFactory;
import com.raytheon.viz.gfe.core.internal.NotificationRouter.AbstractGFENotificationObserver;
import com.raytheon.viz.gfe.textformatter.CombinationsFileUtil; import com.raytheon.viz.gfe.textformatter.CombinationsFileUtil;
import com.raytheon.viz.gfe.textformatter.TextProductManager; import com.raytheon.viz.gfe.textformatter.TextProductManager;
import com.raytheon.viz.gfe.ui.zoneselector.ZoneSelector; import com.raytheon.viz.gfe.ui.zoneselector.ZoneSelector;
@ -99,6 +100,12 @@ import com.raytheon.viz.gfe.ui.zoneselector.ZoneSelector;
* not found to match A1. * not found to match A1.
* Dec 03, 2013 #2591 dgilling Ensure all change states to the combo * Dec 03, 2013 #2591 dgilling Ensure all change states to the combo
* file are handled. * file are handled.
* Jan 07, 2014 #2662 randerso Disabled zone combiner if no maps are selected
* Feb 04, 2014 #2591 randerso Forced reload of combinations file after save to ensure
* file is updated prior to running formatter
* Changed to use CombinationsFileChangedNotification instead of
* FileUpdatedMessage so we can ignore our own changes
* Moved retrieval of combinations file to CombinationsFileUtil.init
* *
* </pre> * </pre>
* *
@ -106,8 +113,7 @@ import com.raytheon.viz.gfe.ui.zoneselector.ZoneSelector;
* @version 1.0 * @version 1.0
* *
*/ */
public class ZoneCombinerComp extends Composite implements public class ZoneCombinerComp extends Composite implements IZoneCombiner {
ILocalizationFileObserver, IZoneCombiner {
private final transient IUFStatusHandler statusHandler = UFStatus private final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(ZoneCombinerComp.class); .getHandler(ZoneCombinerComp.class);
@ -190,6 +196,8 @@ public class ZoneCombinerComp extends Composite implements
protected TextProductManager textProductMgr; protected TextProductManager textProductMgr;
protected DataManager dataManager;
protected String product; protected String product;
protected boolean mapRequired; protected boolean mapRequired;
@ -223,6 +231,8 @@ public class ZoneCombinerComp extends Composite implements
private List<String> mapNames; private List<String> mapNames;
private AbstractGFENotificationObserver<CombinationsFileChangedNotification> comboChangeListener;
private void initPreferences() { private void initPreferences() {
IPreferenceStore prefs = Activator.getDefault().getPreferenceStore(); IPreferenceStore prefs = Activator.getDefault().getPreferenceStore();
@ -246,7 +256,8 @@ public class ZoneCombinerComp extends Composite implements
* Product name. * Product name.
*/ */
public ZoneCombinerComp(Composite parent, IProductTab callBack, public ZoneCombinerComp(Composite parent, IProductTab callBack,
String productName, TextProductManager textProductMgr) { String productName, TextProductManager textProductMgr,
DataManager dataManager) {
super(parent, SWT.NONE); super(parent, SWT.NONE);
this.parent = parent; this.parent = parent;
@ -257,7 +268,13 @@ public class ZoneCombinerComp extends Composite implements
this.textProductMgr = textProductMgr; this.textProductMgr = textProductMgr;
mapRequired = textProductMgr.mapRequired(productName); this.dataManager = dataManager;
mapRequired = this.textProductMgr.mapRequired(productName);
this.mapNames = getMapNames(productName);
if (mapNames.isEmpty()) {
mapRequired = false;
}
initPreferences(); initPreferences();
init(); init();
@ -267,15 +284,47 @@ public class ZoneCombinerComp extends Composite implements
LocalizationType.CAVE_STATIC, LocalizationLevel.BASE); LocalizationType.CAVE_STATIC, LocalizationLevel.BASE);
comboDir = pathMgr.getLocalizationFile(baseCtx, comboDir = pathMgr.getLocalizationFile(baseCtx,
CombinationsFileUtil.COMBO_DIR_PATH); CombinationsFileUtil.COMBO_DIR_PATH);
comboDir.addFileUpdatedObserver(this);
this.comboChangeListener = new AbstractGFENotificationObserver<CombinationsFileChangedNotification>(
CombinationsFileChangedNotification.class) {
@Override
public void notify(
CombinationsFileChangedNotification notificationMessage) {
comboFileChanged(notificationMessage);
}
};
this.addDisposeListener(new DisposeListener() { this.addDisposeListener(new DisposeListener() {
@Override @Override
public void widgetDisposed(DisposeEvent e) { public void widgetDisposed(DisposeEvent e) {
comboDir.removeFileUpdatedObserver(ZoneCombinerComp.this); ZoneCombinerComp.this.dataManager.getNotificationRouter()
.removeObserver(
ZoneCombinerComp.this.comboChangeListener);
} }
}); });
dataManager.getNotificationRouter().addObserver(
this.comboChangeListener);
}
private List<String> getMapNames(String productName) {
Object obj = this.textProductMgr.getMapNameForCombinations(productName);
List<String> mapNames = new ArrayList<String>();
if (obj instanceof String) {
String s = (String) obj;
if (!s.isEmpty()) {
mapNames.add(s);
}
} else if (obj instanceof List<?>) {
@SuppressWarnings("unchecked")
List<String> list = (List<String>) obj;
mapNames.addAll(list);
}
return mapNames;
} }
/** /**
@ -757,9 +806,14 @@ public class ZoneCombinerComp extends Composite implements
} }
try { try {
String comboName = getCombinationsFileName();
CombinationsFileUtil.generateAutoCombinationsFile( CombinationsFileUtil.generateAutoCombinationsFile(
zoneSelector.getZoneGroupings(), getCombinationsFileName() zoneSelector.getZoneGroupings(), comboName);
+ ".py");
// reload here forces file to be retrieved from server before
// allowing formatter to run
loadCombinationsFile(comboName);
applyButtonState(false); applyButtonState(false);
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, "Unable to save " statusHandler.handle(Priority.PROBLEM, "Unable to save "
@ -790,21 +844,9 @@ public class ZoneCombinerComp extends Composite implements
} }
Map<String, Integer> comboDict = loadCombinationsFile(comboName); Map<String, Integer> comboDict = loadCombinationsFile(comboName);
Object obj = textProductMgr.getMapNameForCombinations(productName);
mapNames = new ArrayList<String>();
if (obj instanceof String) {
String s = (String) obj;
if (!s.isEmpty()) {
mapNames.add(s);
}
} else if (obj instanceof List<?>) {
@SuppressWarnings("unchecked")
List<String> list = (List<String>) obj;
mapNames.addAll(list);
}
boolean singleComboOnly = false; boolean singleComboOnly = false;
obj = textProductMgr.getDefinitionValue(productName, "singleComboOnly"); Object obj = textProductMgr.getDefinitionValue(productName,
"singleComboOnly");
if (obj != null) { if (obj != null) {
if (obj instanceof Integer) { if (obj instanceof Integer) {
singleComboOnly = ((Integer) obj) != 0; singleComboOnly = ((Integer) obj) != 0;
@ -915,17 +957,7 @@ public class ZoneCombinerComp extends Composite implements
public Map<String, Integer> loadCombinationsFile(String comboName) { public Map<String, Integer> loadCombinationsFile(String comboName) {
Map<String, Integer> dict = new HashMap<String, Integer>(); Map<String, Integer> dict = new HashMap<String, Integer>();
try { try {
File localFile = PathManagerFactory.getPathManager().getStaticFile( List<List<String>> combolist = CombinationsFileUtil.init(comboName);
FileUtil.join(CombinationsFileUtil.COMBO_DIR_PATH,
comboName + ".py"));
List<List<String>> combolist = new ArrayList<List<String>>();
if ((localFile != null) && localFile.exists()) {
combolist = CombinationsFileUtil.init(comboName);
} else {
// statusHandler
// .error("Combinations file not found: " + comboName);
}
// reformat combinations into combo dictionary // reformat combinations into combo dictionary
int group = 1; int group = 1;
@ -941,8 +973,7 @@ public class ZoneCombinerComp extends Composite implements
return new HashMap<String, Integer>(); return new HashMap<String, Integer>();
} }
currentComboFile = FileUtil.join(CombinationsFileUtil.COMBO_DIR_PATH, currentComboFile = comboName;
comboName + ".py");
return dict; return dict;
} }
@ -977,20 +1008,14 @@ public class ZoneCombinerComp extends Composite implements
return colors; return colors;
} }
/* private void comboFileChanged(CombinationsFileChangedNotification notif) {
* (non-Javadoc) String comboName = notif.getCombinationsFileName();
*
* @see // if it's the same file and not changed by me update the combos
* com.raytheon.uf.common.localization.ILocalizationFileObserver#fileUpdated if (comboName.equalsIgnoreCase(currentComboFile)
* (com.raytheon.uf.common.localization.FileUpdatedMessage) && !VizApp.getWsId().equals(notif.getWhoChanged())) {
*/
@Override
public void fileUpdated(FileUpdatedMessage message) {
if (message.getFileName().equalsIgnoreCase(currentComboFile)) {
File file = new File(message.getFileName());
String comboName = file.getName().replace(".py", "");
statusHandler statusHandler
.info("Received FileUpdatedMessage for combinations file: " .info("Received CombinationsFileChangedNotification for combinations file: "
+ comboName); + comboName);
Map<String, Integer> comboDict = loadCombinationsFile(comboName); Map<String, Integer> comboDict = loadCombinationsFile(comboName);
this.zoneSelector.updateCombos(comboDict); this.zoneSelector.updateCombos(comboDict);

View file

@ -59,6 +59,8 @@ import com.raytheon.viz.gfe.rsc.GFEResource;
* Feb 14, 2013 1616 bsteffen Add option for interpolation of colormap * Feb 14, 2013 1616 bsteffen Add option for interpolation of colormap
* parameters, disable colormap interpolation * parameters, disable colormap interpolation
* by default. * by default.
* 02/11/2014 #2788 randerso Fixed infinite loop in computeIntervalAndPrecision
* when pmax < pmin
* *
* </pre> * </pre>
* *
@ -186,10 +188,10 @@ public class ContinuousColorbar implements IColorBarDisplay {
dstring.font = colorbarResource.getColorbarScaleFont(); dstring.font = colorbarResource.getColorbarScaleFont();
dstring.textStyle = TextStyle.NORMAL; dstring.textStyle = TextStyle.NORMAL;
for (int i = 0; (minParm + i * interval) <= maxParm; i++) { for (int i = 0; (minParm + (i * interval)) <= maxParm; i++) {
// check to see whether this colorTable item needs to be // check to see whether this colorTable item needs to be
// rendered // rendered
float labelValue = minParm + i * interval; float labelValue = minParm + (i * interval);
// Check to see if value is same as previous unless float.... // Check to see if value is same as previous unless float....
if ((tmpValue != (int) labelValue) || (precision > 0)) { if ((tmpValue != (int) labelValue) || (precision > 0)) {
@ -197,7 +199,7 @@ public class ContinuousColorbar implements IColorBarDisplay {
labelValue, precision); labelValue, precision);
labelLoc = llx labelLoc = llx
+ ((labelValue - minParm) / (maxParm - minParm) * xExtent); + (((labelValue - minParm) / (maxParm - minParm)) * xExtent);
if (GFEColorbarResource.isLabelWithin(pe.getMinX(), if (GFEColorbarResource.isLabelWithin(pe.getMinX(),
pe.getMaxX(), labelLoc, 0)) { pe.getMaxX(), labelLoc, 0)) {
@ -219,10 +221,10 @@ public class ContinuousColorbar implements IColorBarDisplay {
labelValue = labelValueObj.floatValue(); labelValue = labelValueObj.floatValue();
if (precision == 0) { if (precision == 0) {
labelLoc = llx labelLoc = llx
+ ((labelValue - minParm) / (maxParm - minParm) * xExtent); + (((labelValue - minParm) / (maxParm - minParm)) * xExtent);
} else { } else {
labelLoc = llx labelLoc = llx
+ ((labelValue - minParm) / (maxParm - minParm) * xExtent); + (((labelValue - minParm) / (maxParm - minParm)) * xExtent);
} }
if (GFEColorbarResource.isLabelWithin(pe.getMinX(), if (GFEColorbarResource.isLabelWithin(pe.getMinX(),
pe.getMaxX(), labelLoc, 0)) { pe.getMaxX(), labelLoc, 0)) {
@ -246,7 +248,7 @@ public class ContinuousColorbar implements IColorBarDisplay {
float floatValue = ((ScalarWxValue) wxv).getValue(); float floatValue = ((ScalarWxValue) wxv).getValue();
if ((floatValue >= minParm) && (floatValue <= maxParm)) { if ((floatValue >= minParm) && (floatValue <= maxParm)) {
labelLoc = llx labelLoc = llx
+ ((floatValue - minParm) / (maxParm - minParm) * xExtent); + (((floatValue - minParm) / (maxParm - minParm)) * xExtent);
String s = wxv.toString(); String s = wxv.toString();
dstring.font = colorbarResource.getPickupValueFont(); dstring.font = colorbarResource.getPickupValueFont();
@ -261,12 +263,11 @@ public class ContinuousColorbar implements IColorBarDisplay {
dstring.shadowColor = new RGB(0, 0, 0); dstring.shadowColor = new RGB(0, 0, 0);
} }
double halfWidth = target.getStringsBounds(dstring).getWidth() double halfWidth = (target.getStringsBounds(dstring).getWidth() * ratio) / 2;
* ratio / 2;
if (labelLoc - halfWidth < pe.getMinX()) { if ((labelLoc - halfWidth) < pe.getMinX()) {
labelLoc = pe.getMinX() + halfWidth; labelLoc = pe.getMinX() + halfWidth;
} else if (labelLoc + halfWidth > pe.getMaxX()) { } else if ((labelLoc + halfWidth) > pe.getMaxX()) {
labelLoc = pe.getMaxX() - halfWidth; labelLoc = pe.getMaxX() - halfWidth;
} }
dstring.setCoordinates(labelLoc, dstring.setCoordinates(labelLoc,
@ -298,7 +299,8 @@ public class ContinuousColorbar implements IColorBarDisplay {
// initial values are good if decade < parmExtent // initial values are good if decade < parmExtent
// loop is infinite if parmExtent is NaN or 0, so avoid it // loop is infinite if parmExtent is NaN or 0, so avoid it
if (decade < parmExtent || Float.isNaN(parmExtent) || parmExtent == 0.0) { if (Float.isNaN(parmExtent) || (parmExtent <= 0.0)
|| (decade < parmExtent)) {
return new float[] { finterval, precision, labelLength }; return new float[] { finterval, precision, labelLength };
} }
@ -438,7 +440,7 @@ public class ContinuousColorbar implements IColorBarDisplay {
switch (parm.getGridInfo().getGridType()) { switch (parm.getGridInfo().getGridType()) {
case SCALAR: case SCALAR:
return new ScalarWxValue(min + (max - min) * fractionX, parm); return new ScalarWxValue(min + ((max - min) * fractionX), parm);
case VECTOR: case VECTOR:
WxValue previous = parm.getParmState().getPickUpValue(); WxValue previous = parm.getParmState().getPickUpValue();
float mag = 0.0f; float mag = 0.0f;
@ -448,7 +450,7 @@ public class ContinuousColorbar implements IColorBarDisplay {
dir = ((VectorWxValue) previous).getDir(); dir = ((VectorWxValue) previous).getDir();
} }
if (mouseButton == 1) { if (mouseButton == 1) {
mag = min + (max - min) * fractionX; mag = min + ((max - min) * fractionX);
} else if (mouseButton == 2) { } else if (mouseButton == 2) {
dir = 360 * fractionX; dir = 360 * fractionX;
} }

View file

@ -51,6 +51,7 @@ import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager; import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.util.FileUtil; import com.raytheon.uf.common.util.FileUtil;
import com.raytheon.viz.gfe.core.DataManagerUIFactory; import com.raytheon.viz.gfe.core.DataManagerUIFactory;
import com.raytheon.viz.gfe.core.internal.IFPClient; import com.raytheon.viz.gfe.core.internal.IFPClient;
@ -68,6 +69,8 @@ import com.raytheon.viz.gfe.textformatter.CombinationsFileUtil.ComboData.Entry;
* Sep 05, 2013 #2329 randerso Moved genereateAutoCombinationsFile here * Sep 05, 2013 #2329 randerso Moved genereateAutoCombinationsFile here
* Cleaned up error handling * Cleaned up error handling
* Sep 30, 2013 2361 njensen Use JAXBManager for XML * Sep 30, 2013 2361 njensen Use JAXBManager for XML
* Feb 05, 2014 #2591 randerso Forced retrieval of combinations file
* Implemented retry on error
* *
* </pre> * </pre>
* *
@ -79,6 +82,8 @@ public class CombinationsFileUtil {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(CombinationsFileUtil.class); .getHandler(CombinationsFileUtil.class);
private static final int MAX_TRIES = 2;
public static String COMBO_DIR_PATH = FileUtil.join("gfe", "combinations"); public static String COMBO_DIR_PATH = FileUtil.join("gfe", "combinations");
public static String SAVED_COMBO_DIR = FileUtil.join("gfe", "comboData"); public static String SAVED_COMBO_DIR = FileUtil.join("gfe", "comboData");
@ -215,13 +220,20 @@ public class CombinationsFileUtil {
IPathManager pm = PathManagerFactory.getPathManager(); IPathManager pm = PathManagerFactory.getPathManager();
// retrieve combinations file if it's changed
LocalizationFile lf = pm.getStaticLocalizationFile(FileUtil.join(
COMBO_DIR_PATH, comboName + ".py"));
File pyFile;
try {
pyFile = lf.getFile(true);
} catch (LocalizationException e) {
throw new GfeException("Error retrieving combinations file: "
+ comboName, e);
}
LocalizationContext baseContext = pm.getContext( LocalizationContext baseContext = pm.getContext(
LocalizationType.CAVE_STATIC, LocalizationLevel.BASE); LocalizationType.CAVE_STATIC, LocalizationLevel.BASE);
// Strip any path components from comboName
File comboFile = new File(comboName);
comboName = comboFile.getName();
String scriptPath = FileUtil.join( String scriptPath = FileUtil.join(
GfePyIncludeUtil.getUtilitiesLF(baseContext).getFile() GfePyIncludeUtil.getUtilitiesLF(baseContext).getFile()
.getPath(), "CombinationsInterface.py"); .getPath(), "CombinationsInterface.py");
@ -230,21 +242,41 @@ public class CombinationsFileUtil {
HashMap<String, Object> map = new HashMap<String, Object>(); HashMap<String, Object> map = new HashMap<String, Object>();
map.put("comboName", comboName); map.put("comboName", comboName);
PythonScript python = null; PythonScript python = null;
for (int retryCount = 0; retryCount < MAX_TRIES; retryCount++) {
try { try {
python = new PythonScript(scriptPath, PyUtil.buildJepIncludePath( python = new PythonScript(scriptPath,
PyUtil.buildJepIncludePath(
GfePyIncludeUtil.getCombinationsIncludePath(), GfePyIncludeUtil.getCombinationsIncludePath(),
GfePyIncludeUtil.getCommonPythonIncludePath()), GfePyIncludeUtil.getCommonPythonIncludePath()),
CombinationsFileUtil.class.getClassLoader()); CombinationsFileUtil.class.getClassLoader());
Object com = python.execute("getCombinations", map); Object com = python.execute("getCombinations", map);
combos = (List<List<String>>) com; combos = (List<List<String>>) com;
// if successfully retrieved break out of the loop
break;
} catch (JepException e) { } catch (JepException e) {
// remove the .pyo file
new File(pyFile.getAbsolutePath() + "o").delete();
// if not last try, log and try again
if (retryCount < MAX_TRIES - 1) {
// log but don't pop up
statusHandler.handle(Priority.EVENTB,
"Error loading combinations file: " + comboName
+ ", retrying ", e);
}
// else throw exception
else {
throw new GfeException("Error loading combinations file: " throw new GfeException("Error loading combinations file: "
+ comboName, e); + comboName, e);
}
} finally { } finally {
if (python != null) { if (python != null) {
python.dispose(); python.dispose();
} }
} }
}
return combos; return combos;
} }

View file

@ -74,6 +74,7 @@ import com.vividsolutions.jts.geom.Envelope;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Aug 23, 2011 randerso Initial creation * Aug 23, 2011 randerso Initial creation
* May 30, 2013 #2028 randerso Fixed date line issue with map display * May 30, 2013 #2028 randerso Fixed date line issue with map display
* Jan 07, 2014 #2662 randerso Fixed limitZones (subDomainUGCs) support
* *
* </pre> * </pre>
* *
@ -158,7 +159,6 @@ public abstract class AbstractZoneSelector extends PaneManager {
return this.zoomLevel; return this.zoomLevel;
} }
// command to label the zones, calls setMap() to update the display
public void setLabelZones(boolean labelZones) { public void setLabelZones(boolean labelZones) {
if (labelZones == this.labelZones) { if (labelZones == this.labelZones) {
return; return;
@ -182,7 +182,9 @@ public abstract class AbstractZoneSelector extends PaneManager {
return; return;
} }
this.limitZoneNames = limitZones; this.limitZoneNames = limitZones;
setMapInternal(this.mapRscList); for (ZoneSelectorResource mapRsc : this.mapRscList) {
mapRsc.setLimitZones(limitZones);
}
} }
/* /*
@ -287,7 +289,7 @@ public abstract class AbstractZoneSelector extends PaneManager {
.retrieveMap(bundlePath).getResourceData(); .retrieveMap(bundlePath).getResourceData();
ZoneSelectorResource rsc = new ZoneSelectorResource(rscData, ZoneSelectorResource rsc = new ZoneSelectorResource(rscData,
new LoadProperties(), gloc); new LoadProperties(), gloc, this.limitZoneNames);
mapRscList.add(rsc); mapRscList.add(rsc);
} catch (VizException e) { } catch (VizException e) {
statusHandler.handle(Priority.PROBLEM, "Error loading map: " statusHandler.handle(Priority.PROBLEM, "Error loading map: "

View file

@ -102,6 +102,7 @@ import com.vividsolutions.jts.io.WKBReader;
* Apr 10, 2013 #1854 randerso Fix for compatibility with PostGIS 2.0 * Apr 10, 2013 #1854 randerso Fix for compatibility with PostGIS 2.0
* May 30, 2013 #2028 randerso Fixed date line issue with map display * May 30, 2013 #2028 randerso Fixed date line issue with map display
* Jul 31, 2013 #2239 randerso Fixed scaling of maps that cross the date line * Jul 31, 2013 #2239 randerso Fixed scaling of maps that cross the date line
* Jan 07, 2014 #2662 randerso Fixed limitZones (subDomainUGCs) support
* Feb 18, 2014 #2819 randerso Removed unnecessary clones of geometries * Feb 18, 2014 #2819 randerso Removed unnecessary clones of geometries
* *
* </pre> * </pre>
@ -231,6 +232,7 @@ public class ZoneSelectorResource extends DbMapResource {
int numPoints = 0; int numPoints = 0;
int wfoPoints = 0; int wfoPoints = 0;
List<String> limitZones = req.rsc.getLimitZones();
WKBReader wkbReader = new WKBReader(); WKBReader wkbReader = new WKBReader();
for (int i = 0; i < mappedResult.getResultCount(); i++) { for (int i = 0; i < mappedResult.getResultCount(); i++) {
if (canceled) { if (canceled) {
@ -260,6 +262,12 @@ public class ZoneSelectorResource extends DbMapResource {
// TODO: what do we do with this? // TODO: what do we do with this?
// zoneName = ""; // zoneName = "";
} }
if (limitZones != null
&& !limitZones.contains(zoneName)) {
continue;
}
String wfo = (String) mappedResult String wfo = (String) mappedResult
.getRowColumnValue(i, "wfo"); .getRowColumnValue(i, "wfo");
@ -533,6 +541,8 @@ public class ZoneSelectorResource extends DbMapResource {
private Map<String, ZoneInfo> zoneData; private Map<String, ZoneInfo> zoneData;
private List<String> limitZones;
private RGB defaultFillColor; private RGB defaultFillColor;
private RGB outlineColor; private RGB outlineColor;
@ -560,9 +570,12 @@ public class ZoneSelectorResource extends DbMapResource {
/** /**
* @param data * @param data
* @param loadProperties * @param loadProperties
* @param gloc
* @param limitZones
*/ */
public ZoneSelectorResource(DbMapResourceData data, public ZoneSelectorResource(DbMapResourceData data,
LoadProperties loadProperties, GridLocation gloc) { LoadProperties loadProperties, GridLocation gloc,
List<String> limitZones) {
super(data, loadProperties); super(data, loadProperties);
this.zoneData = new HashMap<String, ZoneInfo>(); this.zoneData = new HashMap<String, ZoneInfo>();
this.geomFactory = new GeometryFactory(); this.geomFactory = new GeometryFactory();
@ -571,6 +584,7 @@ public class ZoneSelectorResource extends DbMapResource {
this.outlineColor = RGBColors.getRGBColor("white"); this.outlineColor = RGBColors.getRGBColor("white");
this.wfoOutlineColor = RGBColors.getRGBColor("yellow"); this.wfoOutlineColor = RGBColors.getRGBColor("yellow");
this.gloc = gloc; this.gloc = gloc;
this.limitZones = limitZones;
GeneralEnvelope env = new GeneralEnvelope(MapUtil.LATLON_PROJECTION); GeneralEnvelope env = new GeneralEnvelope(MapUtil.LATLON_PROJECTION);
env.setEnvelope(-180.0, -90.0, 180.0, 90.0); env.setEnvelope(-180.0, -90.0, 180.0, 90.0);
@ -849,13 +863,10 @@ public class ZoneSelectorResource extends DbMapResource {
query.append(geometryField); query.append(geometryField);
// add any additional columns // add any additional columns
List<String> additionalColumns = new ArrayList<String>();
if (resourceData.getColumns() != null) { if (resourceData.getColumns() != null) {
for (ColumnDefinition column : resourceData.getColumns()) { for (ColumnDefinition column : resourceData.getColumns()) {
query.append(", "); query.append(", ");
query.append(column); query.append(column);
additionalColumns.add(column.getName());
} }
} }
@ -916,6 +927,22 @@ public class ZoneSelectorResource extends DbMapResource {
return newShadedShape; return newShadedShape;
} }
/**
* @return the limitZones
*/
public List<String> getLimitZones() {
return limitZones;
}
/**
* @param limitZones
* the limitZones to set
*/
public void setLimitZones(List<String> limitZones) {
this.limitZones = limitZones;
issueRefresh();
}
/** /**
* @param labelZones * @param labelZones
*/ */
@ -1024,6 +1051,16 @@ public class ZoneSelectorResource extends DbMapResource {
query.append(resourceData.getGeomField()); query.append(resourceData.getGeomField());
query.append(")) as extent"); query.append(")) as extent");
// add editarea column
if (resourceData.getColumns() != null) {
for (ColumnDefinition column : resourceData.getColumns()) {
if (column.getName().equalsIgnoreCase("editarea")) {
query.append(", ");
query.append(column);
}
}
}
// add the geometry table // add the geometry table
query.append(" FROM "); query.append(" FROM ");
query.append(resourceData.getTable()); query.append(resourceData.getTable());
@ -1048,6 +1085,14 @@ public class ZoneSelectorResource extends DbMapResource {
WKBReader wkbReader = new WKBReader(); WKBReader wkbReader = new WKBReader();
for (int i = 0; i < mappedResult.getResultCount(); i++) { for (int i = 0; i < mappedResult.getResultCount(); i++) {
String zoneName = (String) mappedResult.getRowColumnValue(
i, "editarea");
if (this.limitZones != null
&& !this.limitZones.contains(zoneName)) {
continue;
}
byte[] b = (byte[]) mappedResult.getRowColumnValue(i, byte[] b = (byte[]) mappedResult.getRowColumnValue(i,
"extent"); "extent");
if (b != null) { if (b != null) {

View file

@ -22,6 +22,8 @@ package com.raytheon.viz.gfe.vtec;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.regex.Matcher; import java.util.regex.Matcher;
@ -60,6 +62,7 @@ import com.raytheon.viz.texteditor.util.VtecUtil;
* phensig but disjoint TimeRanges. * phensig but disjoint TimeRanges.
* Dec 18, 2013 #2641 dgilling Force ordering of items returned by * Dec 18, 2013 #2641 dgilling Force ordering of items returned by
* getVtecLinesThatNeedEtn(). * getVtecLinesThatNeedEtn().
* Feb 05, 2014 #2774 dgilling Additional correction to previous fix.
* *
* </pre> * </pre>
* *
@ -78,6 +81,24 @@ public class GFEVtecUtil {
public static final Collection<String> IGNORE_NATIONAL_ETN = ImmutableSet public static final Collection<String> IGNORE_NATIONAL_ETN = ImmutableSet
.copyOf(GFEVtecConfig.getInstance().getSitesIgnoreNationalEtn()); .copyOf(GFEVtecConfig.getInstance().getSitesIgnoreNationalEtn());
private static final Comparator<VtecObject> VTEC_COMPARATOR = new Comparator<VtecObject>() {
@Override
public int compare(VtecObject vtec1, VtecObject vtec2) {
TimeRange tr1 = new TimeRange(vtec1.getStartTime(),
vtec1.getEndTime());
TimeRange tr2 = new TimeRange(vtec2.getStartTime(),
vtec2.getEndTime());
int retVal = tr1.getStart().compareTo(tr2.getStart());
if (retVal == 0) {
retVal = tr1.getEnd().compareTo(tr2.getEnd());
}
return retVal;
}
};
/** /**
* A private constructor so that Java does not attempt to create one for us. * A private constructor so that Java does not attempt to create one for us.
* As this class should not be instantiated, do not attempt to ever call * As this class should not be instantiated, do not attempt to ever call
@ -194,12 +215,12 @@ public class GFEVtecUtil {
* @return A <code>Set</code> of <code>VtecObject</code>s that need to have * @return A <code>Set</code> of <code>VtecObject</code>s that need to have
* a new ETN assigned to them. * a new ETN assigned to them.
*/ */
public static List<VtecObject> getVtecLinesThatNeedEtn(String product) { public static Map<String, List<VtecObject>> initETNCache(String product) {
if (StringUtil.isEmptyString(product)) { if (StringUtil.isEmptyString(product)) {
return Collections.emptyList(); return Collections.emptyMap();
} }
List<VtecObject> phensigs = new ArrayList<VtecObject>(); Map<String, List<VtecObject>> cache = new HashMap<String, List<VtecObject>>();
Matcher vtecMatcher = VtecUtil.VTEC_REGEX.matcher(product); Matcher vtecMatcher = VtecUtil.VTEC_REGEX.matcher(product);
while (vtecMatcher.find()) { while (vtecMatcher.find()) {
@ -208,11 +229,24 @@ public class GFEVtecUtil {
&& ((!NATIONAL_PHENSIGS.contains(vtec.getPhensig())) || (IGNORE_NATIONAL_ETN && ((!NATIONAL_PHENSIGS.contains(vtec.getPhensig())) || (IGNORE_NATIONAL_ETN
.contains(vtec.getOffice()) && TROPICAL_PHENSIGS .contains(vtec.getOffice()) && TROPICAL_PHENSIGS
.contains(vtec.getPhensig())))) { .contains(vtec.getPhensig())))) {
phensigs.add(vtec); List<VtecObject> vtecsForPhensig = cache.get(vtec.getPhensig());
if (vtecsForPhensig == null) {
vtecsForPhensig = new ArrayList<VtecObject>();
}
vtec.setSequence(0);
vtecsForPhensig.add(vtec);
cache.put(vtec.getPhensig(), vtecsForPhensig);
} }
} }
return phensigs; for (String phensig : cache.keySet()) {
List<VtecObject> vtecsByTimeOrder = new ArrayList<VtecObject>(
cache.get(phensig));
Collections.sort(vtecsByTimeOrder, VTEC_COMPARATOR);
cache.put(phensig, vtecsByTimeOrder);
}
return cache;
} }
/** /**
@ -244,46 +278,12 @@ public class GFEVtecUtil {
&& ((!NATIONAL_PHENSIGS.contains(vtec.getPhensig())) || (IGNORE_NATIONAL_ETN && ((!NATIONAL_PHENSIGS.contains(vtec.getPhensig())) || (IGNORE_NATIONAL_ETN
.contains(vtec.getOffice()) && TROPICAL_PHENSIGS .contains(vtec.getOffice()) && TROPICAL_PHENSIGS
.contains(vtec.getPhensig())))) { .contains(vtec.getPhensig())))) {
// With GFE VTEC products, it's possible to have multiple String phensig = vtec.getPhensig();
// segments with
// NEW vtec action codes and the same phensig. For this reason,
// HazardsTable.py implemented a "cache" that would ensure all
// NEWs for
// the same phensig would be assigned the same ETN. This Map
// replicates
// that legacy behavior.
//
// This "cache" has two levels:
// 1. The first level is keyed by the hazard's phensig.
// 2. The second level is keyed by the valid period of the
// hazard.
// Effectively, making this a Map<Phensig, Map<ValidPeriod,
// ETN>>.
// Some more clarification on the ETN assignment behavior: all
// NEW VTEC lines with the same phensig should be assigned the
// same ETN if the hazards' valid periods are adjacent or
// overlapping.
// If there's a discontinuity in TimeRanges we increment to the
// next ETN.
Integer newEtn = null;
String cacheKey = vtec.getPhensig();
TimeRange validPeriod = new TimeRange(vtec.getStartTime() TimeRange validPeriod = new TimeRange(vtec.getStartTime()
.getTime(), vtec.getEndTime().getTime()); .getTime(), vtec.getEndTime().getTime());
Integer newEtn = etnCache.get(phensig).get(validPeriod);
Map<TimeRange, Integer> etnsByTR = etnCache.get(cacheKey);
if (etnsByTR != null) {
newEtn = etnsByTR.get(validPeriod);
for (TimeRange tr : etnsByTR.keySet()) {
if ((validPeriod.isAdjacentTo(tr))
|| (validPeriod.overlaps(tr))) {
vtec.setSequence(newEtn); vtec.setSequence(newEtn);
break;
} }
}
}
}
vtecMatcher vtecMatcher
.appendReplacement( .appendReplacement(
finalOutput, finalOutput,

View file

@ -21,7 +21,10 @@ package com.raytheon.viz.grid.rsc;
import java.util.Map; import java.util.Map;
import javax.measure.converter.UnitConverter;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters; import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences;
import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences.DataMappingEntry; import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences.DataMappingEntry;
import com.raytheon.uf.common.geospatial.ReferencedCoordinate; import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
@ -40,8 +43,10 @@ import com.raytheon.viz.grid.rsc.general.GeneralGridData;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* Oct 13, 2010 bsteffen Initial creation * Oct 13, 2010 bsteffen Initial creation
* Feb 07, 2014 2211 bsteffen Fix sampling
*
* *
* </pre> * </pre>
* *
@ -71,17 +76,22 @@ public class DataMappedGridResource extends D2DGridResource {
if (map == null) { if (map == null) {
return "NO DATA"; return "NO DATA";
} }
Double val = ((Float) map.get(INTERROGATE_VALUE)).doubleValue(); Double val = ((Number) map.get(INTERROGATE_VALUE)).doubleValue();
if (val.isNaN() || val <= -9999) { if (val.isNaN() || val <= -9999) {
return "No Data"; return "No Data";
} }
ColorMapParameters params = getCapability(ColorMapCapability.class) ColorMapParameters params = getCapability(ColorMapCapability.class)
.getColorMapParameters(); .getColorMapParameters();
if (params != null) {
UnitConverter d2cm = params.getDisplayToColorMapConverter();
if (d2cm != null) {
val = d2cm.convert(val);
}
val = params.getDisplayToImageConverter().convert(val); DataMappingPreferences dataMapping = params.getDataMapping();
if (dataMapping != null) {
for (DataMappingEntry entry : params.getDataMapping().getEntries()) { for (DataMappingEntry entry : dataMapping.getEntries()) {
double pixelValue = entry.getPixelValue(); double pixelValue = entry.getPixelValue();
double relError = Math.abs((pixelValue - val) / val); double relError = Math.abs((pixelValue - val) / val);
String text = entry.getLabel(); String text = entry.getLabel();
@ -89,11 +99,13 @@ public class DataMappedGridResource extends D2DGridResource {
return text; return text;
} }
} }
if (params != null && params.getImageToDisplayConverter() != null) {
val = params.getImageToDisplayConverter().convert(val);
} }
UnitConverter cm2d = params.getColorMapToDisplayConverter();
if (cm2d != null) {
val = cm2d.convert(val);
}
}
return ((DataMappedGridResourceData) this.getResourceData()) return ((DataMappedGridResourceData) this.getResourceData())
.getSampleFormat().format(val) + map.get(INTERROGATE_UNIT); .getSampleFormat().format(val) + map.get(INTERROGATE_UNIT);
} }

View file

@ -40,8 +40,9 @@ import com.raytheon.viz.grid.rsc.general.GeneralGridData;
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* Dec 16, 2009 mnash Initial creation * Dec 16, 2009 mnash Initial creation
* Feb 07, 2014 2211 bsteffen Fix sampling
* *
* </pre> * </pre>
* *
@ -71,7 +72,7 @@ public class RcmResource extends D2DGridResource {
if (map == null) { if (map == null) {
return "NO DATA"; return "NO DATA";
} }
float val = (Float) map.get(INTERROGATE_VALUE); float val = ((Number) map.get(INTERROGATE_VALUE)).floatValue();
String sampleVal = ""; String sampleVal = "";
if (val < 1f) { if (val < 1f) {
sampleVal = "No Data"; sampleVal = "No Data";

View file

@ -57,7 +57,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------- -------- ----------- -------------------------- * ------------- -------- ----------- -----------------------------------------
* Mar 09, 2011 bsteffen Initial creation * Mar 09, 2011 bsteffen Initial creation
* Jul 17, 2013 2185 bsteffen Cache computed grid reprojections. * Jul 17, 2013 2185 bsteffen Cache computed grid reprojections.
* Aug 27, 2013 2287 randerso Removed 180 degree adjustment required by * Aug 27, 2013 2287 randerso Removed 180 degree adjustment required by
@ -68,6 +68,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* Jan 14, 2014 2661 bsteffen For vectors only keep uComponent and * Jan 14, 2014 2661 bsteffen For vectors only keep uComponent and
* vComponent, calculate magnitude and * vComponent, calculate magnitude and
* direction on demand. * direction on demand.
* Feb 03, 2013 2764 bsteffen Ensure that internal buffers are array
* backed heap buffers.
* *
* </pre> * </pre>
* *
@ -162,8 +164,17 @@ public class GeneralGridData {
private GeneralGridData(GeneralGridGeometry gridGeometry, private GeneralGridData(GeneralGridGeometry gridGeometry,
FloatBuffer scalarData, Unit<?> dataUnit) { FloatBuffer scalarData, Unit<?> dataUnit) {
this.gridGeometry = GridGeometry2D.wrap(gridGeometry); this.gridGeometry = GridGeometry2D.wrap(gridGeometry);
if (scalarData != null && !scalarData.hasArray()) {
/*
* TODO refactor dispaly code so it doesn't need array instead of
* copying data.
*/
FloatBuffer copy = FloatBuffer.allocate(scalarData.capacity());
scalarData.rewind();
copy.put(scalarData);
scalarData = copy;
}
this.scalarData = new FloatBufferWrapper(scalarData, this.gridGeometry); this.scalarData = new FloatBufferWrapper(scalarData, this.gridGeometry);
;
this.dataUnit = dataUnit; this.dataUnit = dataUnit;
} }

View file

@ -34,6 +34,7 @@ import com.raytheon.viz.hydrocommon.data.GageData.ThreatIndex;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Nov 21, 2008 mpduff Initial creation * Nov 21, 2008 mpduff Initial creation
* Feb 03, 2014 16843 lbousaidi add a check for index OutOfBoundsException
* *
* </pre> * </pre>
* *
@ -101,7 +102,8 @@ public class PDCFindBasis {
} else { } else {
currentLid = fcstReportList.get(fcstIndex).getLid(); currentLid = fcstReportList.get(fcstIndex).getLid();
} }
} else if (obsReportList.get(obsIndex) != null) { } else if ((obsIndex< obsReportList.size()) && (obsReportList
.get(obsIndex) != null)) {
currentLid = obsReportList.get(obsIndex).getLid(); currentLid = obsReportList.get(obsIndex).getLid();
} else { } else {
currentLid = fcstReportList.get(fcstIndex).getLid(); currentLid = fcstReportList.get(fcstIndex).getLid();

View file

@ -140,6 +140,7 @@ import com.raytheon.viz.hydrocommon.util.DbUtils;
* 06 May 2013 1976 mpduff Refactored Hydro time series data access. * 06 May 2013 1976 mpduff Refactored Hydro time series data access.
* 29 May 2013 2016 mpduff Fix TS Toggle Traces. * 29 May 2013 2016 mpduff Fix TS Toggle Traces.
* 05 Sep 2013 #2332 lvenable Fixed memory leaks. * 05 Sep 2013 #2332 lvenable Fixed memory leaks.
* 24 Jan 2013 15959 lbousaidi Swap the corner points of the bounding box when zooming.
* @author lvenable * @author lvenable
* @version 1.0 * @version 1.0
* *
@ -1241,7 +1242,13 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
} }
Date xMin = pixel2x(gd, rubberBandX1 - GRAPHBORDER_LEFT); Date xMin = pixel2x(gd, rubberBandX1 - GRAPHBORDER_LEFT);
Date xMax = pixel2x(gd, rubberBandX2 - GRAPHBORDER_LEFT); Date xMax = pixel2x(gd, rubberBandX2 - GRAPHBORDER_LEFT);
//Swap the corner points of the bounding box when zooming
if (xMin.after(xMax)) {
Date xtmp;
xtmp= xMin;
xMin=xMax;
xMax=xtmp;
}
gd.setXMin(xMin); gd.setXMin(xMin);
gd.setXMax(xMax); gd.setXMax(xMax);
gd.setX(gd.getXMax().getTime() - gd.getXMin().getTime()); gd.setX(gd.getXMax().getTime() - gd.getXMin().getTime());
@ -1256,7 +1263,13 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
if (ymin < gd.getYmin()) { if (ymin < gd.getYmin()) {
ymin = gd.getYmin(); ymin = gd.getYmin();
} }
//Swap the corner points of the bounding box when zooming
if (ymin > ymax) {
double ytmp;
ytmp= ymin;
ymin=ymax;
ymax=ytmp;
}
gd.setYmin(ymin); gd.setYmin(ymin);
gd.setYmax(ymax); gd.setYmax(ymax);
gd.setY2(gd.getYmax2() - gd.getYmin2()); gd.setY2(gd.getYmax2() - gd.getYmin2());

View file

@ -35,6 +35,9 @@
<metadataMap> <metadataMap>
<mapping key="pluginName"> <mapping key="pluginName">
<constraint constraintValue="binlightning" constraintType="EQUALS" /> <constraint constraintValue="binlightning" constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping> </mapping>
</metadataMap> </metadataMap>
</resourceData> </resourceData>

View file

@ -37,6 +37,9 @@
<mapping key="pluginName"> <mapping key="pluginName">
<constraint constraintValue="binlightning" <constraint constraintValue="binlightning"
constraintType="EQUALS" /> constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping> </mapping>
</metadataMap> </metadataMap>
</resourceData> </resourceData>
@ -54,6 +57,9 @@
<mapping key="pluginName"> <mapping key="pluginName">
<constraint constraintValue="binlightning" <constraint constraintValue="binlightning"
constraintType="EQUALS" /> constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping> </mapping>
</metadataMap> </metadataMap>
</resourceData> </resourceData>

View file

@ -35,6 +35,9 @@
<metadataMap> <metadataMap>
<mapping key="pluginName"> <mapping key="pluginName">
<constraint constraintValue="binlightning" constraintType="EQUALS" /> <constraint constraintValue="binlightning" constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping> </mapping>
</metadataMap> </metadataMap>
</resourceData> </resourceData>

View file

@ -35,6 +35,9 @@
<metadataMap> <metadataMap>
<mapping key="pluginName"> <mapping key="pluginName">
<constraint constraintValue="binlightning" constraintType="EQUALS" /> <constraint constraintValue="binlightning" constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping> </mapping>
</metadataMap> </metadataMap>
</resourceData> </resourceData>

View file

@ -42,6 +42,9 @@
<mapping key="pluginName"> <mapping key="pluginName">
<constraint constraintValue="binlightning" <constraint constraintValue="binlightning"
constraintType="EQUALS" /> constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping> </mapping>
</metadataMap> </metadataMap>
</resourceData> </resourceData>
@ -65,6 +68,9 @@
<mapping key="pluginName"> <mapping key="pluginName">
<constraint constraintValue="binlightning" <constraint constraintValue="binlightning"
constraintType="EQUALS" /> constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping> </mapping>
</metadataMap> </metadataMap>
</resourceData> </resourceData>
@ -88,6 +94,9 @@
<mapping key="pluginName"> <mapping key="pluginName">
<constraint constraintValue="binlightning" <constraint constraintValue="binlightning"
constraintType="EQUALS" /> constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping> </mapping>
</metadataMap> </metadataMap>
</resourceData> </resourceData>
@ -111,6 +120,9 @@
<mapping key="pluginName"> <mapping key="pluginName">
<constraint constraintValue="binlightning" <constraint constraintValue="binlightning"
constraintType="EQUALS" /> constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping> </mapping>
</metadataMap> </metadataMap>
</resourceData> </resourceData>
@ -134,6 +146,9 @@
<mapping key="pluginName"> <mapping key="pluginName">
<constraint constraintValue="binlightning" <constraint constraintValue="binlightning"
constraintType="EQUALS" /> constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping> </mapping>
</metadataMap> </metadataMap>
</resourceData> </resourceData>
@ -157,6 +172,9 @@
<mapping key="pluginName"> <mapping key="pluginName">
<constraint constraintValue="binlightning" <constraint constraintValue="binlightning"
constraintType="EQUALS" /> constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping> </mapping>
</metadataMap> </metadataMap>
</resourceData> </resourceData>

View file

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
U.S._EXPORT_CONTROLLED_TECHNICAL_DATA
This_software_product_contains_export-restricted_data_whose
export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination
to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires
an_export_license_or_other_authorization.
Contractor_Name:________Raytheon_Company
Contractor_Address:_____6825_Pine_Street,_Suite_340
________________________Mail_Stop_B8
________________________Omaha,_NE_68106
________________________402.291.0100
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="bundleItem" file="bundles/LightningPlot60Min.xml"
menuText="1hr CG stroke plot" id="1HrLightningStrokePlot"
productInterval="3600">
<dataURI>/binlightning/%</dataURI>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/LightningPlot15Min.xml"
menuText="15min CG stroke plot" id="15MinLightningStrokePlot"
productInterval="900">
<dataURI>/binlightning/%</dataURI>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/LightningPlot15MinPN.xml"
menuText="15min Pos/Neg CG stroke plot" id="15MinPNLightningStrokePlot"
productInterval="900">
<dataURI>/binlightning/%</dataURI>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/LightningPlot5Min.xml"
menuText="5min CG stroke plot" id="5MinLightningStrokePlot"
productInterval="300">
<dataURI>/binlightning/%</dataURI>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/LightningSeq.xml"
menuText="1min Lgtng Seq CG stroke" id="1MinLightningStrokeSeq">
<dataURI>/binlightning/%</dataURI>
</contribute>
</menuTemplate>

View file

@ -20,6 +20,6 @@
--> -->
<menuContributionFile> <menuContributionFile>
<include installTo="menu:obs?after=LIGHTNINGPLACEHOLDER" <include installTo="menu:obs?after=LIGHTNINGPLACEHOLDER"
fileName="menus/lightning/baseLightning.xml" fileName="menus/lightning/lightningMenuItems.xml"
subMenu="Lightning"/> subMenu="Lightning"/>
</menuContributionFile> </menuContributionFile>

View file

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
U.S._EXPORT_CONTROLLED_TECHNICAL_DATA
This_software_product_contains_export-restricted_data_whose
export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination
to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires
an_export_license_or_other_authorization.
Contractor_Name:________Raytheon_Company
Contractor_Address:_____6825_Pine_Street,_Suite_340
________________________Mail_Stop_B8
________________________Omaha,_NE_68106
________________________402.291.0100
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="subMenu" menuText="NLDN" id="NLDNSubMenu">
<contribute xsi:type="subinclude" fileName="menus/lightning/nldnLightningBundleItems.xml">
<substitute key="lightSource" value="NLDN"/>
</contribute>
</contribute>
<contribute xsi:type="subMenu" menuText="GLD" id="GLDSubMenu">
<contribute xsi:type="subinclude" fileName="menus/lightning/gldLightningBundleItems.xml">
<substitute key="lightSource" value="GLD"/>
</contribute>
</contribute>
</menuTemplate>

View file

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
U.S._EXPORT_CONTROLLED_TECHNICAL_DATA
This_software_product_contains_export-restricted_data_whose
export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination
to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires
an_export_license_or_other_authorization.
Contractor_Name:________Raytheon_Company
Contractor_Address:_____6825_Pine_Street,_Suite_340
________________________Mail_Stop_B8
________________________Omaha,_NE_68106
________________________402.291.0100
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="bundleItem" file="bundles/LightningPlot60Min.xml"
menuText="1hr CG flash plot" id="1HrLightningFlashPlot"
productInterval="3600">
<dataURI>/binlightning/%</dataURI>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/LightningPlot15Min.xml"
menuText="15min CG flash plot" id="15MinLightningFlashPlot"
productInterval="900">
<dataURI>/binlightning/%</dataURI>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/LightningPlot15MinPN.xml"
menuText="15min Pos/Neg CG flash plot" id="15MinPNLightningFlashPlot"
productInterval="900">
<dataURI>/binlightning/%</dataURI>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/LightningPlot5Min.xml"
menuText="5min CG flash plot" id="5MinLightningFlashPlot"
productInterval="300">
<dataURI>/binlightning/%</dataURI>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/LightningSeq.xml"
menuText="1min Lgtng Seq CG flash" id="1MinLightningFlashSeq">
<dataURI>/binlightning/%</dataURI>
</contribute>
</menuTemplate>

View file

@ -38,7 +38,8 @@ import com.raytheon.viz.mpe.util.DailyQcUtils.Station;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Mar 11, 2009 snaples Initial creation * Mar 11, 2009 snaples Initial creation
* May 02, 2011 8962 snaples Added render24hrPcpUsingFour6hr() method * May 02, 2011 8962 snaples Added render24hrPcpUsingFour6hr() method
* * Jan 10, 2014 16976 cgobs Fixed issue on line 153.
* Changed pcp.value[row][col] to pcp.value[col][row]
* </pre> * </pre>
* *
* @author snaples * @author snaples
@ -149,7 +150,7 @@ public class RenderPcp {
for (int col = 0; col < hrap_grid.maxi; col++) { for (int col = 0; col < hrap_grid.maxi; col++) {
for (int row = 0; row < hrap_grid.maxj; row++) { for (int row = 0; row < hrap_grid.maxj; row++) {
value = pcp.value[row][col]; value = pcp.value[col][row];
if (value > maxValue) { if (value > maxValue) {
maxValue = value; maxValue = value;

View file

@ -38,7 +38,8 @@ import com.raytheon.viz.mpe.util.DailyQcUtils.Station;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Mar 11, 2009 snaples Initial creation * Mar 11, 2009 snaples Initial creation
* May 02, 2011 8962 snaples Added render24hrPcpUsingFour6hr() method * May 02, 2011 8962 snaples Added render24hrPcpUsingFour6hr() method
* * Jan 10, 2014 16976 cgobs Fixed issue on line 290.
* Changed pcp.value[row][col] to pcp.value[col][row]
* </pre> * </pre>
* *
* @author snaples * @author snaples
@ -286,7 +287,7 @@ public class RenderPcpBlocking {
* not estimate precipitation for it. * not estimate precipitation for it.
*/ */
if (hrap_grid.owner[col][row] == -1) { if (hrap_grid.owner[col][row] == -1) {
pcp.value[row][col] = 0; pcp.value[col][row] = 0;
continue; continue;
} }
@ -308,7 +309,7 @@ public class RenderPcpBlocking {
resultingPrecipValue = 0.0; resultingPrecipValue = 0.0;
} }
// pcp.value[row][col] is the value of grid, // pcp.value[col][row] is the value of grid,
// so we don't need to estimate a value for [row][col] // so we don't need to estimate a value for [row][col]
} }

View file

@ -31,6 +31,7 @@ import org.eclipse.swt.printing.PrinterData;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.VizApp;
/** /**
* Common class for handling printing of text. * Common class for handling printing of text.
@ -45,13 +46,14 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* Text is printed using same font as the GUI * Text is printed using same font as the GUI
* Dec 31, 2012 15651 M Gamazaychikov Added setFont method to scale font for printing * Dec 31, 2012 15651 M Gamazaychikov Added setFont method to scale font for printing
* Sep 30, 2013 #2420 lvenable Fixed memory leak in the setFont method. * Sep 30, 2013 #2420 lvenable Fixed memory leak in the setFont method.
* Feb 12, 2014 #2773 lvenable Added code to provide a workaround to an Eclipse/SWT bug
* that occurs when disposing of the printer.
* *
* </pre> * </pre>
* *
* @author rferrel * @author rferrel
* @version 1.0 * @version 1.0
*/ */
public class PrintDisplay { public class PrintDisplay {
public static void print(final String printedText, final FontData fontData, public static void print(final String printedText, final FontData fontData,
IUFStatusHandler statusHandler) { IUFStatusHandler statusHandler) {
@ -108,19 +110,46 @@ public class PrintDisplay {
int end; int end;
/**
* Constructor
*
* @param printer
* Printer object.
* @param text
* Text to print.
* @param fontData
* Font information.
*/
private PrintDisplay(Printer printer, String text, FontData fontData) { private PrintDisplay(Printer printer, String text, FontData fontData) {
this.printer = printer; this.printer = printer;
this.textToPrint = text; this.textToPrint = text;
this.printerFontData = fontData; this.printerFontData = fontData;
} }
/**
* Print thread that will print the information to the printer.
*/
private void printJob() { private void printJob() {
Thread thread = new Thread("Printing") { Thread thread = new Thread("Printing") {
public void run() { public void run() {
printIt(); printIt();
/** Dispose of the resources. */ /*
* Dispose of the printer resource. Running the dispose on the
* UI Thread should prevent the Eclipse/SWT bug from occurring.
*
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=259371
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=276438
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=265028
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=265265
*/
VizApp.runAsync(new Runnable() {
@Override
public void run() {
printer.dispose(); printer.dispose();
}
});
if (tmpFont != null && tmpFont.isDisposed() == false) { if (tmpFont != null && tmpFont.isDisposed() == false) {
tmpFont.dispose(); tmpFont.dispose();
@ -130,9 +159,12 @@ public class PrintDisplay {
thread.start(); thread.start();
} }
protected void setFont() { /**
* Set the font using the fontData.
*/
private void setFont() {
/* /*
* get the max number of characters in a line of text and add a length * Get the max number of characters in a line of text and add a length
* of tab * of tab
*/ */
String[] textLines = textToPrint.split("[\n]"); String[] textLines = textToPrint.split("[\n]");
@ -197,6 +229,9 @@ public class PrintDisplay {
gc.setFont(tmpFont); gc.setFont(tmpFont);
} }
/**
* Print to the printer.
*/
private void printIt() { private void printIt() {
if (printer.startJob("Text")) { // the string is the job name - shows up if (printer.startJob("Text")) { // the string is the job name - shows up
// in the printer's job list // in the printer's job list
@ -245,6 +280,9 @@ public class PrintDisplay {
} }
} }
/**
* Print the text.
*/
private void printText() { private void printText() {
printer.startPage(); printer.startPage();
wordBuffer = new StringBuilder(); wordBuffer = new StringBuilder();
@ -281,6 +319,9 @@ public class PrintDisplay {
} }
} }
/**
* Print the work buffer.
*/
private void printWordBuffer() { private void printWordBuffer() {
if (wordBuffer.length() > 0) { if (wordBuffer.length() > 0) {
String word = wordBuffer.toString(); String word = wordBuffer.toString();
@ -295,6 +336,9 @@ public class PrintDisplay {
} }
} }
/**
* Start a new line for printing.
*/
private void newline() { private void newline() {
x = leftMargin; x = leftMargin;
y += lineHeight; y += lineHeight;

View file

@ -34,6 +34,7 @@ import java.util.regex.Pattern;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Oct 14, 2009 bwoodle Initial creation * Oct 14, 2009 bwoodle Initial creation
* May 08, 2013 #1842 dgilling Add getPhensig() method. * May 08, 2013 #1842 dgilling Add getPhensig() method.
* Feb 17, 2014 #2774 dgilling Added toString() for debugging
* *
* </pre> * </pre>
* *
@ -315,6 +316,11 @@ public class VtecObject {
VtecUtil.formatVtecTime(this.endTime)); VtecUtil.formatVtecTime(this.endTime));
} }
@Override
public String toString() {
return generateVtec();
}
/* /*
* (non-Javadoc) * (non-Javadoc)
*/ */

View file

@ -34,6 +34,9 @@ import org.opengis.metadata.spatial.PixelOrientation;
import org.opengis.referencing.operation.MathTransform; import org.opengis.referencing.operation.MathTransform;
import com.raytheon.uf.common.dataplugin.warning.util.GeometryUtil; import com.raytheon.uf.common.dataplugin.warning.util.GeometryUtil;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.IExtent; import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.core.contours.util.ContourContainer; import com.raytheon.viz.core.contours.util.ContourContainer;
@ -76,6 +79,7 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
* 10/01/2013 DR 16632 Qinglu Lin Fixed the bug in for loop range. * 10/01/2013 DR 16632 Qinglu Lin Fixed the bug in for loop range.
* 10/17/2013 DR 16632 Qinglu Lin Updated removeOverlaidLinesegments(). * 10/17/2013 DR 16632 Qinglu Lin Updated removeOverlaidLinesegments().
* 10/18/2013 DR 16632 Qinglu Lin Catch exception thrown when coords length is less than 4 and doing createLinearRing(coords). * 10/18/2013 DR 16632 Qinglu Lin Catch exception thrown when coords length is less than 4 and doing createLinearRing(coords).
* 01/09/2014 DR 16974 D. Friedman Improve followup redraw-from-hatched-area polygons.
* </pre> * </pre>
* *
* @author mschenke * @author mschenke
@ -83,6 +87,8 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
*/ */
public class PolygonUtil { public class PolygonUtil {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(PolygonUtil.class);
private WarngenLayer layer; private WarngenLayer layer;
@ -114,6 +120,39 @@ public class PolygonUtil {
Geometry origWarningArea, Polygon oldWarningPolygon) throws VizException { Geometry origWarningArea, Polygon oldWarningPolygon) throws VizException {
float[][] contourAreaData = toFloatData(origWarningArea); float[][] contourAreaData = toFloatData(origWarningArea);
/* If we have an oldWarningPolygon, we can take a shortcut and see
* if the intersection of the current polygon and the old polygon
* generates the same input to the contouring algorithm as the current
* hatched area. If it does, that intersection can be used instead of
* generating a new contour.
*/
if (oldWarningPolygon != null) {
try {
Geometry intersection = origPolygon.intersection(oldWarningPolygon);
if (intersection instanceof Polygon) {
Polygon polygonIntersection = (Polygon) intersection;
if (polygonIntersection.isValid() &&
polygonIntersection.getNumInteriorRing() == 0 &&
polygonIntersection.getNumPoints() - 1 <= maxVertices) {
/*
* Use buildIdealArea to clip the current polygon against the old
* polygon (actually oldWarningArea) and the CWA, using the same
* coordinate transformations that are used to generate
* origWarningArea.
*/
Geometry comparableIntersection = layer.buildIdealArea(origPolygon);
float[][] interAreaData = toFloatData(comparableIntersection);
if (areasEqual(interAreaData, contourAreaData)) {
return polygonIntersection;
}
}
}
} catch (RuntimeException e) {
statusHandler.handle(Priority.WARN,
"Error while using simple polygon redraw method. Will continue using contouring method.", e);
}
}
// Create contouring configuration // Create contouring configuration
FortConConfig config = new FortConConfig(); FortConConfig config = new FortConConfig();
config.generateMaxes = false; config.generateMaxes = false;

View file

@ -195,6 +195,7 @@ import com.vividsolutions.jts.io.WKTReader;
* Use A1 hatching behavior when no county passes the inclusion filter. * Use A1 hatching behavior when no county passes the inclusion filter.
* 10/29/2013 DR 16734 D. Friedman If redraw-from-hatched-area fails, don't allow the pollygon the be used. * 10/29/2013 DR 16734 D. Friedman If redraw-from-hatched-area fails, don't allow the pollygon the be used.
* 12/04/2013 2604 jsanchez Refactored GisUtil. * 12/04/2013 2604 jsanchez Refactored GisUtil.
* 01/09/2014 DR 16974 D. Friedman Improve followup redraw-from-hatched-area polygons.
* 02/19/2014 2819 randerso Removed unnecessary .clone() call * 02/19/2014 2819 randerso Removed unnecessary .clone() call
* </pre> * </pre>
* *
@ -2963,41 +2964,11 @@ public class WarngenLayer extends AbstractStormTrackResource {
state.snappedToArea = false; state.snappedToArea = false;
if (areaHatcher != null) { if (areaHatcher != null) {
Polygon polygon = state.getWarningPolygon(); Polygon polygon = state.getWarningPolygon();
polygon = tryToIntersectWithOriginalPolygon(polygon);
areaHatcher.hatchArea(polygon, state.getWarningArea(), areaHatcher.hatchArea(polygon, state.getWarningArea(),
state.getOldWarningPolygon()); state.getOldWarningPolygon());
} }
} }
/**
* Try to determine the intersection of the given polygon with the original
* warning polygon. If there is no original polygon, if the result of the
* intersection is not a single polygon, or if a problem occurs, just return
* the original polygon. The purpose of this is to pass the polygon that
* best represents the user's intent to the polygon redrawing algorithm.
*/
private Polygon tryToIntersectWithOriginalPolygon(Polygon polygon) {
if (state.getOldWarningPolygon() != null) {
try {
Geometry g = polygon.intersection(state.getOldWarningPolygon());
Polygon newPolygon = null;
if (g instanceof Polygon) {
newPolygon = (Polygon) g;
} else if ((g instanceof GeometryCollection)
&& (g.getNumGeometries() == 1)
&& (g.getGeometryN(0) instanceof Polygon)) {
newPolygon = (Polygon) g.getGeometryN(0);
}
if ((newPolygon != null) && newPolygon.isValid()) {
polygon = newPolygon;
}
} catch (TopologyException e) {
// ignore
}
}
return polygon;
}
private Collection<GeospatialData> getDataWithFips(String fips) { private Collection<GeospatialData> getDataWithFips(String fips) {
List<GeospatialData> data = new ArrayList<GeospatialData>(); List<GeospatialData> data = new ArrayList<GeospatialData>();
for (GeospatialData d : geoData.features) { for (GeospatialData d : geoData.features) {
@ -3283,4 +3254,40 @@ public class WarngenLayer extends AbstractStormTrackResource {
} }
} }
} }
/**
* Like buildArea, but does not take inclusion filters into account. Also
* returns a Geometry in lat/lon space.
* @param inputArea
* @return
*/
public Geometry buildIdealArea(Geometry inputArea) {
Geometry localHatchedArea = latLonToLocal(inputArea);
Geometry oldWarningArea = latLonToLocal(state.getOldWarningArea());
Geometry newHatchedArea = null;
for (GeospatialData f : geoData.features) {
// get the geometry of the county and make sure it intersects
// with our hatched area
PreparedGeometry prepGeom = (PreparedGeometry) f.attributes
.get(GeospatialDataList.LOCAL_PREP_GEOM);
Geometry intersection = null;
try {
// Get intersection between county and hatched boundary
intersection = GeometryUtil.intersection(localHatchedArea, prepGeom);
if (oldWarningArea != null) {
intersection = GeometryUtil.intersection(intersection,
oldWarningArea);
}
} catch (RuntimeException e) {
continue;
// This is a workaround for JTS 1.7.1
}
newHatchedArea = union(newHatchedArea, intersection);
}
Geometry result = newHatchedArea != null ? newHatchedArea : new GeometryFactory()
.createGeometryCollection(new Geometry[0]);
return localToLatLon(result);
}
} }

View file

@ -1,5 +1,8 @@
### EDEX localization related variables ### ### EDEX localization related variables ###
export AW_SITE_IDENTIFIER=OAX export AW_SITE_IDENTIFIER=OAX
## Cluster id can be set to the cluster's id (example:tbw for dx1-tbwo)
## it will be autogenerated if not set
export CLUSTER_ID
# database names # database names
export DC_DB_NAME=dc_ob7oax export DC_DB_NAME=dc_ob7oax

View file

@ -165,6 +165,18 @@
</encoder> </encoder>
</appender> </appender>
<!-- ohd log -->
<appender name="OhdLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${edex.home}/logs/edex-${edex.run.mode}-ohd-%d{yyyyMMdd}.log</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%-5p %d [%t] %c{0}: %m%n</pattern>
</encoder>
</appender>
<appender name="ThreadBasedLog" class="com.raytheon.uf.common.status.logback.ThreadBasedAppender"> <appender name="ThreadBasedLog" class="com.raytheon.uf.common.status.logback.ThreadBasedAppender">
<threadPatterns>RadarLog:radarThreadPool.*;SatelliteLog:satelliteThreadPool.*;ShefLog:shefThreadPool.*;TextLog:textThreadPool.*;SmartInitLog:smartInit.*;PurgeLog:Purge.*;ArchiveLog:Archive.*</threadPatterns> <threadPatterns>RadarLog:radarThreadPool.*;SatelliteLog:satelliteThreadPool.*;ShefLog:shefThreadPool.*;TextLog:textThreadPool.*;SmartInitLog:smartInit.*;PurgeLog:Purge.*;ArchiveLog:Archive.*</threadPatterns>
<defaultAppender>asyncConsole</defaultAppender> <defaultAppender>asyncConsole</defaultAppender>
@ -301,6 +313,12 @@
<appender-ref ref="FailedTriggerLog"/> <appender-ref ref="FailedTriggerLog"/>
</logger> </logger>
<logger name="com.raytheon.uf.edex.ohd" additivity="false">
<level value="INFO"/>
<appender-ref ref="OhdLog" />
<appender-ref ref="console" />
</logger>
<!-- default logging --> <!-- default logging -->
<root> <root>
<level value="INFO"/> <level value="INFO"/>

Some files were not shown because too many files have changed in this diff Show more