comparison 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
comparison
equal deleted inserted replaced
603:8cb98fa4987f 604:84d3c5fde5bb
42 import de.intevation.flys.client.client.event.StepBackEvent; 42 import de.intevation.flys.client.client.event.StepBackEvent;
43 import de.intevation.flys.client.client.event.StepBackHandler; 43 import de.intevation.flys.client.client.event.StepBackHandler;
44 import de.intevation.flys.client.client.event.StepForwardEvent; 44 import de.intevation.flys.client.client.event.StepForwardEvent;
45 import de.intevation.flys.client.client.event.StepForwardHandler; 45 import de.intevation.flys.client.client.event.StepForwardHandler;
46 import de.intevation.flys.client.client.services.AdvanceService; 46 import de.intevation.flys.client.client.services.AdvanceService;
47 import de.intevation.flys.client.client.services.ReportService;
47 import de.intevation.flys.client.client.services.AdvanceServiceAsync; 48 import de.intevation.flys.client.client.services.AdvanceServiceAsync;
48 import de.intevation.flys.client.client.services.ArtifactService; 49 import de.intevation.flys.client.client.services.ArtifactService;
49 import de.intevation.flys.client.client.services.ArtifactServiceAsync; 50 import de.intevation.flys.client.client.services.ArtifactServiceAsync;
50 import de.intevation.flys.client.client.services.StepForwardService; 51 import de.intevation.flys.client.client.services.StepForwardService;
51 import de.intevation.flys.client.client.services.StepForwardServiceAsync; 52 import de.intevation.flys.client.client.services.StepForwardServiceAsync;
53 import de.intevation.flys.client.client.services.ReportServiceAsync;
52 54
53 55
54 public class ParameterList 56 public class ParameterList
55 extends Tab 57 extends Tab
56 implements StepBackHandler, StepForwardHandler, ParameterChangeHandler, 58 implements StepBackHandler, StepForwardHandler, ParameterChangeHandler,
71 /** The StepForwardService used to put data into an existing artifact. */ 73 /** The StepForwardService used to put data into an existing artifact. */
72 protected AdvanceServiceAsync advanceService = 74 protected AdvanceServiceAsync advanceService =
73 GWT.create(AdvanceService.class); 75 GWT.create(AdvanceService.class);
74 76
75 77
78 protected ReportServiceAsync reportService =
79 GWT.create(ReportService.class);
80
81
76 /** The list of ParameterizationChangeHandler.*/ 82 /** The list of ParameterizationChangeHandler.*/
77 protected List<ParameterChangeHandler> parameterHandlers; 83 protected List<ParameterChangeHandler> parameterHandlers;
78 84
79 protected FLYS flys; 85 protected FLYS flys;
80 86
165 left.addMember(currentItems); 171 left.addMember(currentItems);
166 left.addMember(exportModes); 172 left.addMember(exportModes);
167 left.addMember(report); 173 left.addMember(report);
168 174
169 reportPanel = new Canvas(); 175 reportPanel = new Canvas();
170 //reportPanel.setContents("<strong>I was here!</strong>");
171 reportPanel.setHeight("*"); 176 reportPanel.setHeight("*");
172 report.addMember(reportPanel); 177 report.addMember(reportPanel);
173 178
174 // This canvas is used to render helper widgets 179 // This canvas is used to render helper widgets
175 helperPanel = new Canvas(); 180 helperPanel = new Canvas();
581 586
582 protected void updateReportModes(Collection c, List<ReportMode> reports) { 587 protected void updateReportModes(Collection c, List<ReportMode> reports) {
583 int num = reports != null ? reports.size() : 0; 588 int num = reports != null ? reports.size() : 0;
584 GWT.log("Update report modes: " + num); 589 GWT.log("Update report modes: " + num);
585 590
591 if (num == 0) {
592 reportPanel.setContents("");
593 return;
594 }
595
596 Config config = Config.getInstance();
597 String url = config.getServerUrl();
598 String locale = config.getLocale();
599
600 String cid = c.identifier();
601
586 for (ReportMode report: reports) { 602 for (ReportMode report: reports) {
587 GWT.log("report '" + report.toString() + "'"); 603 GWT.log("report '" + report.toString() + "'");
588 } 604
589 605 reportService.report(cid, url, locale, report.getName(),
606 new AsyncCallback<String>() {
607 public void onFailure(Throwable caught) {
608 SC.warn(caught.getMessage());
609 }
610
611 public void onSuccess(String msg) {
612 setReportMessage(msg);
613 }
614 });
615 }
616 }
617
618 protected void setReportMessage(String msg) {
619 GWT.log("returned from service: " + msg);
620 if (msg == null) {
621 msg = "";
622 }
623 reportPanel.setContents(msg);
590 } 624 }
591 625
592 626
593 /** 627 /**
594 * Adds a table to the parameterlist to show calculated data. 628 * Adds a table to the parameterlist to show calculated data.

http://dive4elements.wald.intevation.org