changeset 8619:156980fb3cb9

Try to find "default" data items for start and end in period panel This is not using the DefaultValue mechanismn which also exists as the DefaultValue mechanism is deprecated and a candidate for removal.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 25 Mar 2015 19:18:43 +0100
parents 42fc26e463db
children 8737de2ca763
files gwt-client/src/main/java/org/dive4elements/river/client/client/ui/PeriodPanel.java
diffstat 1 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/PeriodPanel.java	Wed Mar 25 18:23:22 2015 +0100
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/PeriodPanel.java	Wed Mar 25 19:18:43 2015 +0100
@@ -94,6 +94,25 @@
         layout.addMember(title);
         layout.addMember(form);
 
+        /* Try to find default values for the periods */
+        Data start = getData(data.getAll(), "start");
+        Data end = getData(data.getAll(), "end");
+        if (start == null || end == null) {
+            return layout;
+        }
+
+        for (DataItem item: start.getItems()) {
+            if (item.getLabel().equals("default")) {
+                Date defDate = new Date(Long.parseLong(item.getStringValue()));
+                inputPanel.setFromDate(defDate);
+            }
+        }
+        for (DataItem item: end.getItems()) {
+            if (item.getLabel().equals("default")) {
+                Date defDate = new Date(Long.parseLong(item.getStringValue()));
+                inputPanel.setToDate(defDate);
+            }
+        }
         return layout;
     }
 

http://dive4elements.wald.intevation.org