diff flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixPeriodPanel.java @ 2537:cc5969df0490

New methods in UI providers for fixings states and minor protocol changes. flys-client/trunk@4449 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Mon, 21 May 2012 09:22:29 +0000
parents a911e2968cb1
children c7da05282644
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixPeriodPanel.java	Mon May 21 09:17:24 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixPeriodPanel.java	Mon May 21 09:22:29 2012 +0000
@@ -5,6 +5,9 @@
 import java.util.Date;
 
 import com.google.gwt.core.client.GWT;
+import com.google.gwt.i18n.client.DateTimeFormat;
+import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat;
+
 import com.smartgwt.client.util.SC;
 
 import com.smartgwt.client.widgets.Canvas;
@@ -49,7 +52,7 @@
 
         VLayout layout = new VLayout();
 
-        Label title = new Label(MESSAGES.period());
+        Label title = new Label(data.get(0).getDescription());
         title.setHeight("25px");
 
         DynamicForm form = new DynamicForm();
@@ -74,9 +77,27 @@
         DataItem[] startItem = start.getItems();
         DataItem[] endItem = end.getItems();
 
+        String v1 = startItem[0].getStringValue();
+        String v2 = endItem[0].getStringValue();
+
+        long v1l = 0;
+        long v2l = 0;
+        try {
+            v1l = Long.parseLong(v1);
+            v2l = Long.parseLong(v2);
+        }
+        catch(NumberFormatException nfe) {
+            GWT.log(nfe.toString());
+        }
+        Date d1 = new Date(v1l);
+        Date d2 = new Date(v2l);
+
+        DateTimeFormat f =
+            DateTimeFormat.getFormat(
+                DateTimeFormat.PredefinedFormat.DATE_MEDIUM);
         StringBuilder sb = new StringBuilder();
-        sb.append(startItem[0].getLabel() + " - ");
-        sb.append(endItem[0].getLabel());
+        sb.append(f.format(d1) + " - ");
+        sb.append(f.format(d2));
 
         Label old = new Label(sb.toString());
         old.setWidth(130);
@@ -151,6 +172,7 @@
         return this.fixFilter;
     }
 
+    public void success() {}
 
     protected boolean saveDateValues() {
         Date st = inputPanel.getFromDate();

http://dive4elements.wald.intevation.org