changeset 517:ec965bf8dfef

Take care on empty Data objects while initializing default values in Location/distance panel. flys-client/trunk@1989 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 24 May 2011 11:21:11 +0000
parents ba606e575663
children bac8e6ea277d
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java
diffstat 2 files changed, 18 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Tue May 24 10:52:00 2011 +0000
+++ b/flys-client/ChangeLog	Tue May 24 11:21:11 2011 +0000
@@ -1,3 +1,8 @@
+2011-05-24  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java:
+	  Take care on empty Data objects while initializing default values.
+
 2011-05-24  Ingo Weinzierl <ingo@intevation.de>
 
 	ISSUE-85 (part II/III)
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java	Tue May 24 10:52:00 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java	Tue May 24 11:21:11 2011 +0000
@@ -465,26 +465,34 @@
         DataItem   tDef   = t.getDefault();
         DataItem   sDef   = s.getDefault();
 
-        String theMode = mDef != null
+        String mDefValue = mDef != null ? mDef.getStringValue() : null;
+        String theMode = mDefValue != null && mDefValue.length() > 0
             ? mDef.getStringValue()
             : FIELD_VALUE_LOCATION;
 
         mode.setValue(FIELD_MODE, theMode);
 
-        setFrom(fDef != null
+        String fDefValue = fDef != null ? fDef.getStringValue() : null;
+        setFrom(fDefValue != null && fDefValue.length() > 0
             ? Double.valueOf(fDef.getStringValue())
             : min);
 
-        setTo(tDef != null
+        String tDefValue = tDef != null ? tDef.getStringValue() : null;
+        setTo(tDefValue != null && tDefValue.length() > 0
             ? Double.valueOf(tDef.getStringValue())
             : max);
 
-        setStep(sDef != null
+        String sDefValue = sDef != null ? sDef.getStringValue() : null;
+        setStep(sDefValue != null && sDefValue.length() > 0
             ? Double.valueOf(sDef.getStringValue())
             : step);
 
         if (lDef != null) {
-            setLocationValues(lDef.getStringValue());
+            String lDefValue = lDef != null ? lDef.getStringValue() : null;
+
+            if (lDefValue != null && lDefValue.length() > 0) {
+                setLocationValues(lDef.getStringValue());
+            }
         }
 
         if (theMode.equals(FIELD_VALUE_DISTANCE)) {

http://dive4elements.wald.intevation.org