Mercurial > dive4elements > river
comparison gwt-client/src/main/java/org/dive4elements/river/client/client/ui/fixation/FixFunctionSelect.java @ 9481:787fc085459b
TSV introduced; uinfo.inundationWMS-Config
author | gernotbelger |
---|---|
date | Wed, 12 Sep 2018 10:55:09 +0200 |
parents | e6958f0e72fa |
children | 51212d40ff56 |
comparison
equal
deleted
inserted
replaced
9480:7228bd10a8cc | 9481:787fc085459b |
---|---|
6 * documentation coming with Dive4Elements River for details. | 6 * documentation coming with Dive4Elements River for details. |
7 */ | 7 */ |
8 | 8 |
9 package org.dive4elements.river.client.client.ui.fixation; | 9 package org.dive4elements.river.client.client.ui.fixation; |
10 | 10 |
11 import java.util.HashMap; | |
12 import java.util.LinkedHashMap; | 11 import java.util.LinkedHashMap; |
13 import java.util.Map; | 12 import java.util.Map; |
14 | 13 |
15 import org.dive4elements.river.client.shared.model.Data; | 14 import org.dive4elements.river.client.shared.model.Data; |
16 import org.dive4elements.river.client.shared.model.DataItem; | 15 import org.dive4elements.river.client.shared.model.DataItem; |
26 import com.smartgwt.client.widgets.form.fields.SelectItem; | 25 import com.smartgwt.client.widgets.form.fields.SelectItem; |
27 import com.smartgwt.client.widgets.layout.HLayout; | 26 import com.smartgwt.client.widgets.layout.HLayout; |
28 import com.smartgwt.client.widgets.layout.VLayout; | 27 import com.smartgwt.client.widgets.layout.VLayout; |
29 | 28 |
30 public class FixFunctionSelect extends FixationPanel { | 29 public class FixFunctionSelect extends FixationPanel { |
31 public static final Map<String, String> funcDesc = new HashMap<String, String>(); | 30 public static final LinkedHashMap<String, String> funcDesc = new LinkedHashMap<String, String>(); |
32 | 31 |
33 static { | 32 static { |
34 funcDesc.put("log", "W(Q) = m*ln(Q + b)"); | 33 funcDesc.put("log", "W(Q) = m*ln(Q + b)"); |
35 funcDesc.put("linear", "W(Q) = m * Q + b"); | 34 funcDesc.put("linear", "W(Q) = m * Q + b"); |
36 funcDesc.put("log-linear", "W(Q) = a*ln(m*Q+b)"); | 35 funcDesc.put("log-linear", "W(Q) = a*ln(m*Q+b)"); |
47 public Canvas createWidget(final DataList data) { | 46 public Canvas createWidget(final DataList data) { |
48 final VLayout layout = new VLayout(); | 47 final VLayout layout = new VLayout(); |
49 layout.setAlign(VerticalAlignment.TOP); | 48 layout.setAlign(VerticalAlignment.TOP); |
50 layout.setHeight(25); | 49 layout.setHeight(25); |
51 | 50 |
52 final LinkedHashMap initial = new LinkedHashMap(); | 51 final LinkedHashMap<String, String> initial = new LinkedHashMap<String, String>(); |
53 | 52 |
54 this.form = new DynamicForm(); | 53 this.form = new DynamicForm(); |
54 | |
55 final int selectIndex = 0; | |
55 | 56 |
56 final int size = data.size(); | 57 final int size = data.size(); |
57 | 58 |
58 for (int i = 0; i < size; i++) { | 59 for (int i = 0; i < size; i++) { |
59 final Data d = data.get(i); | 60 final Data d = data.get(i); |
78 initial.put(d.getLabel(), def.getStringValue()); | 79 initial.put(d.getLabel(), def.getStringValue()); |
79 defaultSet = true; | 80 defaultSet = true; |
80 } | 81 } |
81 | 82 |
82 // I was here. Me 2. | 83 // I was here. Me 2. |
84 int j = 0; | |
85 assert selectIndex < d.getItems().length; | |
83 for (final DataItem item : d.getItems()) { | 86 for (final DataItem item : d.getItems()) { |
84 if (!defaultSet && first) { | 87 if (!defaultSet && first && j == selectIndex) { |
85 initial.put(d.getLabel(), item.getStringValue()); | 88 initial.put(d.getLabel(), item.getStringValue()); |
86 first = false; | 89 first = false; |
87 } | 90 } |
88 | 91 |
89 funcTypes.put(item.getStringValue(), item.getLabel()); | 92 funcTypes.put(item.getStringValue(), item.getLabel()); |
93 j++; | |
90 } | 94 } |
91 | 95 |
92 label.setWidth(50); | 96 label.setWidth(50); |
93 combobox.setValueMap(funcTypes); | 97 combobox.setValueMap(funcTypes); |
94 combobox.setShowTitle(false); | 98 combobox.setShowTitle(false); |