diff flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugeTree.java @ 4183:1755a1bfe5ce

Merged
author Christian Lins <christian.lins@intevation.de>
date Fri, 19 Oct 2012 09:20:52 +0200
parents 9be8d7942284
children 79878efbdf07
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugeTree.java	Tue Oct 16 12:44:15 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugeTree.java	Fri Oct 19 09:20:52 2012 +0200
@@ -269,7 +269,7 @@
             if (item instanceof GaugeInfoItem) {
                 boolean setstate = false;
                 GaugeInfoItem gitem = (GaugeInfoItem)item;
-                if (end == null) {
+                if (end == null && gitem.getStart() != null) {
                     if (gitem.getStart() >= start) {
                         setstate = true;
                     }
@@ -291,6 +291,9 @@
         }
     }
 
+    /**
+     * Open Gauge entry if a location fits to the gauge
+     */
     public void openOnLocations(List<Double> locations) {
         GWT.log("GaugeTree - openOnLocations " + locations + " " +
                 tree.getItemCount());
@@ -308,11 +311,18 @@
                     if (locations == null) {
                         continue;
                     }
-                    if (location >= gitem.getStart() &&
-                            location <= gitem.getEnd()) {
+
+                    Double start = gitem.getStart();
+                    Double end   = gitem.getEnd();
+                    if (start == null || end == null) {
+                        // should not occur but avoid NullPointerException
+                        continue;
+                    }
+
+                    if (location >= start && location <= end) {
                         isset = true;
                         break;
-                            }
+                    }
                 }
                 item.setState(isset);
             }

http://dive4elements.wald.intevation.org