# HG changeset patch # User Sascha L. Teichmann # Date 1308674639 0 # Node ID 942bd0e7e332e3a674fae77824ccc4c865054f5e # Parent 809756dda091d78c094cef5a4707409494e6d4b8 Filter reports and dispatch them to updateReports(). flys-client/trunk@2184 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 809756dda091 -r 942bd0e7e332 flys-client/ChangeLog --- a/flys-client/ChangeLog Tue Jun 21 16:41:09 2011 +0000 +++ b/flys-client/ChangeLog Tue Jun 21 16:43:59 2011 +0000 @@ -1,3 +1,14 @@ +2011-06-21 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/client/shared/model/ReportMode.java: + New. Mode to detect out of type 'report'. + + * src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java: + Build ReportModes for 'report' outs. + + * src/main/java/de/intevation/flys/client/client/ui/ParameterList.java: + Filter reports and dispatch them to updateReports(). + 2011-06-21 Ingo Weinzierl flys/issue132 (WINFO: Streckenauswahl per default setzen) diff -r 809756dda091 -r 942bd0e7e332 flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java Tue Jun 21 16:41:09 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java Tue Jun 21 16:43:59 2011 +0000 @@ -23,6 +23,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.ReportMode; import de.intevation.flys.client.shared.model.ExportMode; import de.intevation.flys.client.shared.model.OutputMode; import de.intevation.flys.client.shared.model.River; @@ -516,20 +517,40 @@ } updateExportModes(c, getExportModes(outputs)); + updateReportModes(c, getReportModes(outputs)); } public void onOutputModesChange(OutputModesChangeEvent event) { - List exports = getExportModes(event.getOutputModes()); Collection c = cView.getCollection(); if (c != null) { - updateExportModes(c, exports); + OutputMode [] outs = event.getOutputModes(); + updateExportModes(c, getExportModes(outs)); + updateReportModes(c, getReportModes(outs)); } } + protected List getReportModes(OutputMode [] outs) { + + List reports = new ArrayList(); + + if (outs == null || outs.length == 0) { + return reports; + } + + for (OutputMode out: outs) { + if (out instanceof ReportMode) { + reports.add((ReportMode)out); + } + } + + return reports; + } + + protected List getExportModes(OutputMode[] outs) { List exports = new ArrayList(); @@ -558,6 +579,16 @@ } } + protected void updateReportModes(Collection c, List reports) { + int num = reports != null ? reports.size() : 0; + GWT.log("Update report modes: " + num); + + for (ReportMode report: reports) { + GWT.log("report '" + report.toString() + "'"); + } + + } + /** * Adds a table to the parameterlist to show calculated data. diff -r 809756dda091 -r 942bd0e7e332 flys-client/src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java --- a/flys-client/src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java Tue Jun 21 16:41:09 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java Tue Jun 21 16:43:59 2011 +0000 @@ -31,6 +31,7 @@ import de.intevation.flys.client.shared.model.DefaultOutputMode; import de.intevation.flys.client.shared.model.DefaultTheme; import de.intevation.flys.client.shared.model.ExportMode; +import de.intevation.flys.client.shared.model.ReportMode; import de.intevation.flys.client.shared.model.Facet; import de.intevation.flys.client.shared.model.OutputMode; import de.intevation.flys.client.shared.model.Theme; @@ -340,6 +341,9 @@ if (name.indexOf("export") > -1) { outmode = new ExportMode(name, desc, mime, fs); } + else if (name.indexOf("report") > -1) { + outmode = new ReportMode(name, desc, mime, fs); + } else { outmode = new DefaultOutputMode(name, desc, mime, fs); } diff -r 809756dda091 -r 942bd0e7e332 flys-client/src/main/java/de/intevation/flys/client/shared/model/ReportMode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/ReportMode.java Tue Jun 21 16:43:59 2011 +0000 @@ -0,0 +1,39 @@ +package de.intevation.flys.client.shared.model; + +import java.util.List; + +public class ReportMode +extends DefaultOutputMode +{ + public ReportMode() { + } + + + public ReportMode(String name, String desc, String mimeType) { + super(name, desc, mimeType); + } + + + public ReportMode( + String name, + String description, + String mimeType, + List facets + ) { + super(name, description, mimeType, facets); + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + boolean first = true; + for (Facet f: facets) { + if (first) first = false; + else sb.append(", "); + sb.append("(name = '").append(f.getName()) + .append("', index = ").append(f.getIndex()) + .append(", desc = '").append(f.getDescription()).append("')"); + } + return sb.toString(); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :