diff gnv-artifacts/src/main/java/de/intevation/gnv/state/StateBase.java @ 637:154d158238d3

Display the selected value if there is no description avaible. WKT-strings will be displayed again (issue182). gnv-artifacts/trunk@720 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 01 Mar 2010 16:00:39 +0000
parents 22cc12b1622c
children 078ba6799bd2
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/StateBase.java	Mon Mar 01 14:15:33 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/StateBase.java	Mon Mar 01 16:00:39 2010 +0000
@@ -714,15 +714,18 @@
 
         for (int i = 0; i < size; i++) {
             Element itemNode = creator.create("item");
+            String value = data.getValue();
+            String desc  = descriptions[i];
+            desc = desc == null ? value : desc;
 
             creator.addAttr(itemNode, "selected", "true");
 
             Element choiceLableNode = creator.create("label");
-            choiceLableNode.setTextContent(descriptions[i]);
+            choiceLableNode.setTextContent(desc);
             itemNode.appendChild(choiceLableNode);
 
             Element choiceValueNode = creator.create("value");
-            choiceValueNode.setTextContent(data.getValue());
+            choiceValueNode.setTextContent(value);
             itemNode.appendChild(choiceValueNode);
             choiceNode.appendChild(itemNode);
         }

http://dive4elements.wald.intevation.org