Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/SelectProvider.java @ 519:77234b1d009c
ISSUE-90 & ISSUE-40 (part II/II) Former selected values are preselected after back jumps.
flys-client/trunk@1998 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 24 May 2011 16:22:34 +0000 |
parents | e3565f58b0ae |
children | f8f8982e2d5c |
comparison
equal
deleted
inserted
replaced
518:bac8e6ea277d | 519:77234b1d009c |
---|---|
124 | 124 |
125 ComboBoxItem combobox = new ComboBoxItem(d.getLabel()); | 125 ComboBoxItem combobox = new ComboBoxItem(d.getLabel()); |
126 | 126 |
127 LinkedHashMap<String, String> it = new LinkedHashMap<String, String>(); | 127 LinkedHashMap<String, String> it = new LinkedHashMap<String, String>(); |
128 | 128 |
129 boolean firstItem = true; | 129 boolean defaultSet = false; |
130 boolean first = true; | |
131 | |
132 DataItem def = d.getDefault(); | |
133 String defValue = def != null ? def.getStringValue() : null; | |
134 | |
135 if (defValue != null && defValue.length() > 0) { | |
136 initial.put(d.getLabel(), def.getStringValue()); | |
137 defaultSet = true; | |
138 } | |
130 | 139 |
131 for (DataItem item: d.getItems()) { | 140 for (DataItem item: d.getItems()) { |
132 if (firstItem) { | 141 if (!defaultSet && first) { |
133 initial.put(d.getLabel(), item.getStringValue()); | 142 initial.put(d.getLabel(), item.getStringValue()); |
134 firstItem = false; | 143 first = false; |
135 } | 144 } |
136 | 145 |
137 it.put(item.getStringValue(), item.getLabel()); | 146 it.put(item.getStringValue(), item.getLabel()); |
138 } | 147 } |
139 | 148 |