Mercurial > dive4elements > river
comparison gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ParameterMatrixPanel.java @ 7580:dacc1123075f
issue1063: Always create data for all parameters, even if not specified.
This will delete old data elements.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Mon, 18 Nov 2013 15:38:52 +0100 |
parents | ea9eef426962 |
children | 982382d9ea8b |
comparison
equal
deleted
inserted
replaced
7579:b4b8764ee90d | 7580:dacc1123075f |
---|---|
45 @Override | 45 @Override |
46 protected Data[] getData() { | 46 protected Data[] getData() { |
47 Map<String, List<String>> selection = matrix.getSelection(); | 47 Map<String, List<String>> selection = matrix.getSelection(); |
48 Set<Map.Entry<String, List<String>>> entries = selection.entrySet(); | 48 Set<Map.Entry<String, List<String>>> entries = selection.entrySet(); |
49 | 49 |
50 Data[] list = new Data[selection.size()]; | 50 Data[] list = new Data[matrix.getColumnNames().size()]; |
51 | 51 |
52 int i = 0; | 52 int i = 0; |
53 | 53 |
54 for (Map.Entry<String, List<String>> entry: entries) { | 54 for (Map.Entry<String, List<String>> entry: entries) { |
55 String value = buildValueString(entry.getValue()); | 55 String value = buildValueString(entry.getValue()); |
59 null, | 59 null, |
60 value); | 60 value); |
61 | 61 |
62 list[i++] = new DefaultData( | 62 list[i++] = new DefaultData( |
63 entry.getKey(), null, null, new DataItem[] { item }); | 63 entry.getKey(), null, null, new DataItem[] { item }); |
64 } | |
65 | |
66 // To delete old values already given, construct empty ones | |
67 // for all not-specified options. | |
68 for (String colName : matrix.getColumnNames()) { | |
69 boolean found = false; | |
70 for (Data data : list) { | |
71 if (data != null && data.getLabel().equals(colName)) { | |
72 found = true; | |
73 break; | |
74 } | |
75 } | |
76 if (!found) { | |
77 // Add an empty data for this. | |
78 list[i++] = new DefaultData( | |
79 colName, null, null, new DataItem[] { }); | |
80 } | |
64 } | 81 } |
65 | 82 |
66 return list; | 83 return list; |
67 } | 84 } |
68 | 85 |