diff flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java @ 604:84d3c5fde5bb

First version of error reports. flys-client/trunk@2211 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 23 Jun 2011 09:11:54 +0000
parents 942bd0e7e332
children 3ae0facd4cab
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java	Wed Jun 22 15:34:52 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java	Thu Jun 23 09:11:54 2011 +0000
@@ -44,11 +44,13 @@
 import de.intevation.flys.client.client.event.StepForwardEvent;
 import de.intevation.flys.client.client.event.StepForwardHandler;
 import de.intevation.flys.client.client.services.AdvanceService;
+import de.intevation.flys.client.client.services.ReportService;
 import de.intevation.flys.client.client.services.AdvanceServiceAsync;
 import de.intevation.flys.client.client.services.ArtifactService;
 import de.intevation.flys.client.client.services.ArtifactServiceAsync;
 import de.intevation.flys.client.client.services.StepForwardService;
 import de.intevation.flys.client.client.services.StepForwardServiceAsync;
+import de.intevation.flys.client.client.services.ReportServiceAsync;
 
 
 public class ParameterList
@@ -73,6 +75,10 @@
         GWT.create(AdvanceService.class);
 
 
+    protected ReportServiceAsync reportService =
+        GWT.create(ReportService.class);
+
+
     /** The list of ParameterizationChangeHandler.*/
     protected List<ParameterChangeHandler> parameterHandlers;
 
@@ -167,7 +173,6 @@
         left.addMember(report);
 
         reportPanel = new Canvas();
-        //reportPanel.setContents("<strong>I was here!</strong>");
         reportPanel.setHeight("*");
         report.addMember(reportPanel);
 
@@ -583,10 +588,39 @@
         int num = reports != null ? reports.size() : 0;
         GWT.log("Update report modes: " + num);
 
+        if (num == 0) {
+            reportPanel.setContents("");
+            return;
+        }
+
+        Config config = Config.getInstance();
+        String url    = config.getServerUrl();
+        String locale = config.getLocale();
+
+        String cid = c.identifier();
+
         for (ReportMode report: reports) {
             GWT.log("report '" + report.toString() + "'");
+
+            reportService.report(cid, url, locale, report.getName(),
+                new AsyncCallback<String>() {
+                    public void onFailure(Throwable caught) {
+                        SC.warn(caught.getMessage());
+                    }
+
+                    public void onSuccess(String msg) {
+                        setReportMessage(msg);
+                    }
+                });
         }
+    }
 
+    protected void setReportMessage(String msg) {
+        GWT.log("returned from service: " + msg);
+        if (msg == null) {
+            msg = "";
+        }
+        reportPanel.setContents(msg);
     }
 
 

http://dive4elements.wald.intevation.org