changeset 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 b4b8764ee90d
children b2d750a6df9f
files gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ParameterMatrixPanel.java
diffstat 1 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ParameterMatrixPanel.java	Mon Nov 18 15:37:33 2013 +0100
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ParameterMatrixPanel.java	Mon Nov 18 15:38:52 2013 +0100
@@ -47,7 +47,7 @@
         Map<String, List<String>> selection = matrix.getSelection();
         Set<Map.Entry<String, List<String>>> entries = selection.entrySet();
 
-        Data[] list = new Data[selection.size()];
+        Data[] list = new Data[matrix.getColumnNames().size()];
 
         int i = 0;
 
@@ -63,6 +63,23 @@
                 entry.getKey(), null, null, new DataItem[] { item });
         }
 
+        // To delete old values already given, construct empty ones
+        // for all not-specified options.
+        for (String colName : matrix.getColumnNames()) {
+            boolean found = false;
+            for (Data data : list) {
+                if (data != null && data.getLabel().equals(colName)) {
+                    found = true;
+                    break;
+                }
+            }
+            if (!found) {
+                // Add an empty data for this.
+                list[i++] = new DefaultData(
+                    colName, null, null, new DataItem[] { });
+            }
+        }
+
         return list;
     }
 

http://dive4elements.wald.intevation.org