comparison 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
comparison
equal deleted inserted replaced
873:77a549772aa9 874:d900ab031dfe
18 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> 18 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
19 */ 19 */
20 public class AutoIntegerPanel extends TextProvider { 20 public class AutoIntegerPanel extends TextProvider {
21 21
22 public static final String FIELD_NAME = "integer_field"; 22 public static final String FIELD_NAME = "integer_field";
23
24 public static final String FIELD_DEFAULT_VALUE = "auto";
23 25
24 26
25 protected static FLYSConstants MSG = GWT.create(FLYSConstants.class); 27 protected static FLYSConstants MSG = GWT.create(FLYSConstants.class);
26 28
27 protected String dataName; 29 protected String dataName;
46 layout.setMembersMargin(10); 48 layout.setMembersMargin(10);
47 49
48 initDefaultValues(dataList); 50 initDefaultValues(dataList);
49 51
50 return layout; 52 return layout;
53 }
54
55
56 @Override
57 protected void initDefaultValues(DataList dataList) {
58 super.initDefaultValues(dataList);
59
60 String def = getValueAsString();
61
62 if (def == null || def.length() == 0) {
63 form.setValue(getFieldName(), FIELD_DEFAULT_VALUE);
64 }
51 } 65 }
52 66
53 67
54 protected String getTitle() { 68 protected String getTitle() {
55 return MSG.uesk_profile_distance(); 69 return MSG.uesk_profile_distance();

http://dive4elements.wald.intevation.org