changeset 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 (2012-05-21)
parents 256b458cc7ea
children c7da05282644
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/SelectProvider.java flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixEventSelect.java flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixGaugeSelectPanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixLocationPanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixPeriodPanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixQSelectPanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixationPanel.java
diffstat 8 files changed, 66 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Mon May 21 09:17:24 2012 +0000
+++ b/flys-client/ChangeLog	Mon May 21 09:22:29 2012 +0000
@@ -1,3 +1,17 @@
+2012-05-21  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/fixation/FixLocationPanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/fixation/FixGaugeSelectPanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/fixation/FixationPanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/fixation/FixQSelectPanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/fixation/FixEventSelect.java,
+	  src/main/java/de/intevation/flys/client/client/ui/fixation/FixPeriodPanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/SelectProvider.java:
+	  Added new method 'success', called on successful requested fixings
+	  overview document.
+	  Implemented 'createOld' to display old values.
+	  Changed data field 'name' to 'description'.
+
 2012-05-21  Raimund Renkert <raimund.renkert@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/server/FixingsOverviewServiceImpl.java,
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/SelectProvider.java	Mon May 21 09:17:24 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/SelectProvider.java	Mon May 21 09:22:29 2012 +0000
@@ -139,7 +139,7 @@
                 defaultSet = true;
             }
 
-            // I was here.
+            // I was here. Me 2.
             for (DataItem item: d.getItems()) {
                 if (!defaultSet && first) {
                     initial.put(d.getLabel(), item.getStringValue());
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixEventSelect.java	Mon May 21 09:17:24 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixEventSelect.java	Mon May 21 09:22:29 2012 +0000
@@ -24,6 +24,7 @@
 import de.intevation.flys.client.shared.model.DataList;
 import de.intevation.flys.client.shared.model.DefaultData;
 import de.intevation.flys.client.shared.model.DefaultDataItem;
+import de.intevation.flys.client.shared.model.IntDataItem;
 import de.intevation.flys.client.shared.model.IntegerArrayData;
 import de.intevation.flys.client.shared.model.FixingsOverviewInfo;
 import de.intevation.flys.client.shared.model.FixingsOverviewInfo.FixEvent;
@@ -68,10 +69,18 @@
     public Canvas createOld(DataList dataList) {
         List<Data> list = dataList.getAll();
 
+        GWT.log("listsize: " + list.size());
+
         Data data = getData(list, "events");
 
         VLayout dataLayout = new VLayout();
         dataLayout.setWidth(130);
+        DataItem[] items = data.getItems();
+        for (int i = 0; i < items.length; i++) {
+            Label l = new Label(items[i].getLabel());
+            l.setHeight(25);
+            dataLayout.addMember(l);
+        }
 
         HLayout layout = new HLayout();
         layout.setWidth("400px");
@@ -98,21 +107,21 @@
         List<Data> data = new ArrayList<Data>();
 
         if (events.size() > 0) {
-            int[] arr = new int[events.size()];
+            IntDataItem[] arr = new IntDataItem[events.size()];
             for (int i = 0; i < events.size(); i++) {
                 GWT.log("event: " + events.get(i));
                 try {
                     Integer v = new Integer(events.get(i));
-                    arr[i] = v.intValue();
+                    arr[i] = new IntDataItem("id", "id", v.intValue());
                 }
                 catch (NumberFormatException nfe) {
                     return  (Data[]) data.toArray(new Data[data.size()]);
                 }
             }
-            fixFilter.setEvents(arr);
 
             IntegerArrayData iad =
                 new IntegerArrayData("events", "events", arr);
+            fixFilter.setEvents(iad.getValues());
 
             data.add(iad);
         }
@@ -149,11 +158,12 @@
         return this.fixFilter;
     }
 
+    public void success() {}
 
     public void dumpGWT(String cid) {
         GWT.log("Setting values for cId: " + cid);
         GWT.log("River: " + fixInfo.getRiver());
         GWT.log("Date: " + fixInfo.getEventByCId(cid).getDate());
-        GWT.log("Name: " + fixInfo.getEventByCId(cid).getName());
+        GWT.log("Name: " + fixInfo.getEventByCId(cid).getDescription());
     }
 }
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixGaugeSelectPanel.java	Mon May 21 09:17:24 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixGaugeSelectPanel.java	Mon May 21 09:22:29 2012 +0000
@@ -164,6 +164,7 @@
         return this.fixFilter;
     }
 
+    public void success() {}
 
     protected boolean saveClassValues() {
         String v1 = from.getValueAsString();
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixLocationPanel.java	Mon May 21 09:17:24 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixLocationPanel.java	Mon May 21 09:22:29 2012 +0000
@@ -64,9 +64,9 @@
                 MESSAGES.unitFrom(),
                 MESSAGES.unitTo(),
                 MESSAGES.unitWidth(),
-                5d,
-                10d,
-                1d,
+                0d,
+                0d,
+                0d,
                 240,
                 this);
 
@@ -175,6 +175,9 @@
         return this.fixFilter;
     }
 
+    public void success() {
+        inputPanel.setValues(fixInfo.getFrom(), fixInfo.getTo(), 100d);
+    }
 
     /**
      * This method is used to validate the inserted data in the form fields.
@@ -197,6 +200,6 @@
         GWT.log("Setting values for cId: " + cid);
         GWT.log("River: " + fixInfo.getRiver());
         GWT.log("Date: " + fixInfo.getEventByCId(cid).getDate());
-        GWT.log("Name: " + fixInfo.getEventByCId(cid).getName());
+        GWT.log("Name: " + fixInfo.getEventByCId(cid).getDescription());
     }
 }
--- 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();
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixQSelectPanel.java	Mon May 21 09:17:24 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixQSelectPanel.java	Mon May 21 09:22:29 2012 +0000
@@ -72,4 +72,6 @@
     public FixFilter getFilter() {
         return this.fixFilter;
     }
+
+    public void success() {}
 }
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixationPanel.java	Mon May 21 09:17:24 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixationPanel.java	Mon May 21 09:22:29 2012 +0000
@@ -158,6 +158,7 @@
                     eventPane.setContents(htmlOverview);
                     updateChartTab(fixInfo.getFrom());
                     events.setPane(eventPane);
+                    success();
                 }
             });
 
@@ -294,7 +295,7 @@
     public abstract boolean renderCheckboxes();
     public abstract FixFilter getFilter();
     public abstract void setFilter(FixFilter filter);
-
+    public abstract void success();
 
     public static class FixFilter {
         protected String river;

http://dive4elements.wald.intevation.org