[PATCH 1 of 2] Try to find "default" data items for start and end in period panel
Wald Commits
scm-commit at wald.intevation.org
Wed Mar 25 19:21:07 CET 2015
# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1427307523 -3600
# Node ID 156980fb3cb9f7afc284917ca01f032cd884d88a
# Parent 42fc26e463dbf1d1634fb11b8f2081a3c9d067e2
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.
diff -r 42fc26e463db -r 156980fb3cb9 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/PeriodPanel.java
--- 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;
}
More information about the Dive4Elements-commits
mailing list