changeset 142:b43671a551d1

Append human readable strings of the selected values to the DESCRIBE output. flys-artifacts/trunk@1525 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 21 Mar 2011 09:18:04 +0000
parents 7f909429ccc8
children 8735d1a9af4c
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java
diffstat 2 files changed, 21 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Mon Mar 21 09:16:17 2011 +0000
+++ b/flys-artifacts/ChangeLog	Mon Mar 21 09:18:04 2011 +0000
@@ -1,3 +1,9 @@
+2011-03-21  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/states/DefaultState.java:
+	  Write human readable strings as label attribute into the DESCRIBE
+	  output. Those labels are used to be displayed in the GUI.
+
 2011-03-21  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/states/CalculationSelect.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java	Mon Mar 21 09:16:17 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java	Mon Mar 21 09:18:04 2011 +0000
@@ -9,8 +9,9 @@
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
+import de.intevation.artifacts.ArtifactNamespaceContext;
 import de.intevation.artifacts.CallContext;
-import de.intevation.artifacts.ArtifactNamespaceContext;
+import de.intevation.artifacts.CallMeta;
 
 import de.intevation.artifacts.common.utils.XMLUtils;
 
@@ -41,7 +42,9 @@
             ArtifactNamespaceContext.NAMESPACE_URI,
             ArtifactNamespaceContext.NAMESPACE_PREFIX);
 
-        String label = Resources.getMsg(context.getMeta(), getID(), getID());
+        CallMeta meta = context.getMeta();
+
+        String label = Resources.getMsg(meta, getID(), getID());
         Element ui   = ProtocolUtils.createArtNode(
             creator, "state",
             new String[] { "name", "uiprovider", "label" },
@@ -55,15 +58,22 @@
         Collection<StateData> dataItems = theData.values();
 
         for (StateData data: dataItems) {
-            String name    = data.getName();
+            String name  = data.getName();
+            String value = (String) data.getValue();
+
+            logger.debug("Append element '" + name + "' (" + value + ")");
 
             Element dataElement = creator.create("data");
             creator.addAttr(dataElement, "name", name, true);
             creator.addAttr(dataElement, "type", data.getType(), true);
 
             Element itemElement = creator.create("item");
-            creator.addAttr(itemElement, "value", (String) data.getValue(), true);
-            // TODO Description (human readable) is missing
+            creator.addAttr(itemElement, "value", value, true);
+            creator.addAttr(
+                itemElement,
+                "label",
+                Resources.getMsg(meta, value, value),
+                true);
 
             dataElement.appendChild(itemElement);
             ui.appendChild(dataElement);

http://dive4elements.wald.intevation.org