diff flys-client/src/main/java/de/intevation/flys/client/client/ui/AutoIntegerPanel.java @ 874:d900ab031dfe

Set the default value of the AutoInteger panel to 'auto' if no other value is set. flys-client/trunk@2698 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 12 Sep 2011 09:39:15 +0000
parents 40269a176cd2
children 360e22afb98b
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/AutoIntegerPanel.java	Mon Sep 12 05:40:58 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/AutoIntegerPanel.java	Mon Sep 12 09:39:15 2011 +0000
@@ -21,6 +21,8 @@
 
     public static final String FIELD_NAME = "integer_field";
 
+    public static final String FIELD_DEFAULT_VALUE = "auto";
+
 
     protected static FLYSConstants MSG = GWT.create(FLYSConstants.class);
 
@@ -51,6 +53,18 @@
     }
 
 
+    @Override
+    protected void initDefaultValues(DataList dataList) {
+        super.initDefaultValues(dataList);
+
+        String def = getValueAsString();
+
+        if (def == null || def.length() == 0) {
+            form.setValue(getFieldName(), FIELD_DEFAULT_VALUE);
+        }
+    }
+
+
     protected String getTitle() {
         return MSG.uesk_profile_distance();
     }

http://dive4elements.wald.intevation.org