Mercurial > dive4elements > river
changeset 589:942bd0e7e332
Filter reports and dispatch them to updateReports().
flys-client/trunk@2184 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 21 Jun 2011 16:43:59 +0000 (2011-06-21) |
parents | 809756dda091 |
children | 81d7939a5d9e |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java flys-client/src/main/java/de/intevation/flys/client/server/DescribeCollectionServiceImpl.java flys-client/src/main/java/de/intevation/flys/client/shared/model/ReportMode.java |
diffstat | 4 files changed, 87 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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 <sascha.teichmann@intevation.de> + + * 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 <ingo@intevation.de> flys/issue132 (WINFO: Streckenauswahl per default setzen)
--- 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<ExportMode> 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<ReportMode> getReportModes(OutputMode [] outs) { + + List<ReportMode> reports = new ArrayList<ReportMode>(); + + if (outs == null || outs.length == 0) { + return reports; + } + + for (OutputMode out: outs) { + if (out instanceof ReportMode) { + reports.add((ReportMode)out); + } + } + + return reports; + } + + protected List<ExportMode> getExportModes(OutputMode[] outs) { List<ExportMode> exports = new ArrayList<ExportMode>(); @@ -558,6 +579,16 @@ } } + protected void updateReportModes(Collection c, List<ReportMode> 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.
--- 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); }
--- /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<Facet> 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 :