changeset 630:40d3039f85ac

ISSUE-40 (part I/II) Write values that the user had former selected / inserted into DESCRIBE document to preselect such data in the UI. flys-artifacts/trunk@1995 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 24 May 2011 12:58:55 +0000
parents 65e4e42b4b03
children a9af60c84dca
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java
diffstat 2 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue May 24 12:40:06 2011 +0000
+++ b/flys-artifacts/ChangeLog	Tue May 24 12:58:55 2011 +0000
@@ -1,3 +1,11 @@
+2011-05-24  Ingo Weinzierl <ingo@intevation.de>
+
+	  ISSUE-40 (part I/II)
+
+	* src/main/java/de/intevation/flys/artifacts/states/DefaultState.java:
+	  Write default values (values already selected by the user before) of the
+	  input data items into DESCRIBE.
+
 2011-05-24  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/states/LocationDistanceSelect.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java	Tue May 24 12:40:06 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java	Tue May 24 12:58:55 2011 +0000
@@ -138,6 +138,21 @@
 
             Element select = createData(creator, artifact, data, context);
 
+            String defValue = (String) data.getValue();
+            String defDesc  = null;
+
+            if (defValue != null && defValue.length() > 0) {
+                defDesc = Resources.getMsg(
+                    context.getMeta(),
+                    defValue,
+                    defValue);
+            }
+
+            if (defValue != null && defDesc != null) {
+                creator.addAttr(select, "defaultValue", defValue, true);
+                creator.addAttr(select, "defaultLabel", defDesc, true);
+            }
+
             Element choices = ProtocolUtils.createArtNode(
             creator, "choices", null, null);
 

http://dive4elements.wald.intevation.org