[PATCH 6 of 9] Add default value handling in MultiPeriodPanel

Wald Commits scm-commit at wald.intevation.org
Thu Mar 26 12:12:00 CET 2015


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1427367221 -3600
# Node ID e0c8850d86292e4c8cbd7b5c68f24274c2b686f4
# Parent  3b85c8cee94b8e09bfde47f0e105bf97af8d70cd
Add default value handling in MultiPeriodPanel

diff -r 3b85c8cee94b -r e0c8850d8629 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/MultiPeriodPanel.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/MultiPeriodPanel.java	Thu Mar 26 11:52:05 2015 +0100
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/MultiPeriodPanel.java	Thu Mar 26 11:53:41 2015 +0100
@@ -127,6 +127,23 @@
         input.addMember(grid);
         root.addMember(input);
 
+        /* Check for a default element */
+        Data periods = getData(data.getAll(), "periods");
+        DataItem[] items = periods.getItems();
+        if (items == null) {
+            return root;
+        }
+
+        for (DataItem item: items) {
+            if (!item.getLabel().equals("default")) {
+                continue;
+            }
+            String[] vals = item.getStringValue().split(",");
+            long f = Long.valueOf(vals[0]).longValue();
+            long t = Long.valueOf(vals[1]).longValue();
+            inputPanel.setFromDate(new Date(f));
+            inputPanel.setToDate(new Date(t));
+        }
         return root;
     }
 


More information about the Dive4Elements-commits mailing list