# HG changeset patch # User Raimund Renkert # Date 1345202295 0 # Node ID 17c66d38f095f0450926f046525578f229661267 # Parent 92239b53823f5aa07f284e0f7e9cb1c0f1beb92b FixA: Added AT file export to FixAnalysis W/Q. flys-client/trunk@5223 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 92239b53823f -r 17c66d38f095 flys-client/ChangeLog --- a/flys-client/ChangeLog Thu Aug 16 16:38:21 2012 +0000 +++ b/flys-client/ChangeLog Fri Aug 17 11:18:15 2012 +0000 @@ -1,3 +1,22 @@ +2012-08-17 Raimund Renkert + + Added AT file export to FixAnalysis W/Q. + + * src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java: + New image link for AT export in W/Q tab. + + * src/main/java/de/intevation/flys/client/client/ui/chart/NaviChartOutputTab.java: + Update link url on km change. + + * src/main/java/de/intevation/flys/client/server/ExportServiceImpl.java: + Add the km to the request document. + + * src/main/java/de/intevation/flys/client/client/FLYSConstants.java, + src/main/java/de/intevation/flys/client/client/FLYSConstants.properties, + src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties, + src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties: + Added i18n string for tooltip. + 2012-08-16 Sascha L. Teichmann * src/main/java/de/intevation/flys/client/server/ProxyServlet.java: diff -r 92239b53823f -r 17c66d38f095 flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Thu Aug 16 16:38:21 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Fri Aug 17 11:18:15 2012 +0000 @@ -517,6 +517,8 @@ String sq_relation_export(); + String exportATTooltip(); + // ERRORS String error_read_minmax_values(); diff -r 92239b53823f -r 17c66d38f095 flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties --- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Thu Aug 16 16:38:21 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Fri Aug 17 11:18:15 2012 +0000 @@ -220,6 +220,8 @@ fix_derivate_curve = Derivate fix_vollmer_wq_curve = W/Q +exportATTooltip = Export as AT file + waterlevel_export = Waterlevel Export waterlevel_report = Waterlevel Report computed_dischargecurve_export = Discharge Curve Export diff -r 92239b53823f -r 17c66d38f095 flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties --- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Thu Aug 16 16:38:21 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Fri Aug 17 11:18:15 2012 +0000 @@ -239,6 +239,8 @@ events = Ereignisse kmchart = Diagramm +exportATTooltip = Daten als AT Datei exportieren + chart_themepanel_header_themes = Thema chart_themepanel_header_actions = Aktionen chart_themepanel_synchron = Synchron navigieren diff -r 92239b53823f -r 17c66d38f095 flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties --- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties Thu Aug 16 16:38:21 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties Fri Aug 17 11:18:15 2012 +0000 @@ -221,6 +221,7 @@ fix_derivate_curve = Derivate fix_vollmer_wq_curve = W/Q +exportATTooltip = Export as AT file waterlevel_export = Waterlevel Export waterlevel_report = Waterlevel Report diff -r 92239b53823f -r 17c66d38f095 flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java Thu Aug 16 16:38:21 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java Fri Aug 17 11:18:15 2012 +0000 @@ -8,6 +8,7 @@ import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; +import de.intevation.flys.client.client.Config; import de.intevation.flys.client.client.FLYSConstants; import de.intevation.flys.client.client.event.ZoomEvent; import de.intevation.flys.client.client.event.ZoomHandler; @@ -41,6 +42,7 @@ protected ImgButton chartProperties; protected Button addPoints; protected Button addWSP; + protected ImgLink exportAT; protected PanControl panControl; @@ -102,6 +104,24 @@ }); String baseUrl = GWT.getHostPageBaseURL(); + String moduleUrl = GWT.getModuleBaseURL(); + Config config = Config.getInstance(); + + if (chartTab.getMode().getName().equals("fix_wq_curve")) { + exportAT = new ImgLink( + baseUrl + MSG.downloadCSV(), + moduleUrl + "export" + + "?uuid=" + chartTab.getCollection().identifier() + + "&mode=" + chartTab.getMode().getName() + "_at_export" + + "&type=at" + + "&server=" + config.getServerUrl() + + "&locale=" + config.getLocale() + + "&km=" + chartTab.getCollectionView().getCurrentKm(), + 20, + 20 + ); + exportAT.setTooltip(MSG.exportATTooltip()); + } downloadPNG = new ImgLink( baseUrl + MSG.downloadPNG(), @@ -236,6 +256,9 @@ addMember(downloadPDF); addMember(downloadSVG); addMember(downloadCSV); + if (getChartOutputTab().getMode().getName().equals("fix_wq_curve")) { + addMember(exportAT); + } addMember(zoomToMaxExtent); addMember(historyBack); addMember(zoomOut); @@ -292,5 +315,22 @@ public void deselectControls() { zoombox.deselect(); } + + public void updateLinks() { + ChartOutputTab chartTab = getChartOutputTab(); + String moduleUrl = GWT.getModuleBaseURL(); + Config config = Config.getInstance(); + + if (chartTab.getMode().getName().equals("fix_wq_curve")) { + exportAT.setSource( + moduleUrl + "export" + + "?uuid=" + chartTab.getCollection().identifier() + + "&mode=" + chartTab.getMode().getName() + "_at_export" + + "&type=at" + + "&server=" + config.getServerUrl() + + "&locale=" + config.getLocale() + + "&km=" + chartTab.getCollectionView().getCurrentKm()); + } + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 92239b53823f -r 17c66d38f095 flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/NaviChartOutputTab.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/NaviChartOutputTab.java Thu Aug 16 16:38:21 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/NaviChartOutputTab.java Fri Aug 17 11:18:15 2012 +0000 @@ -163,6 +163,7 @@ if (d <= collectionView.getMaxKm() && d >= collectionView.getMinKm()) { collectionView.setCurrentKm(d); + tbarPanel.updateLinks(); if (right != null) { updateChartPanel(); updateChartInfo(); @@ -191,6 +192,7 @@ double newVal = currentKm * 100; newVal += (collectionView.getSteps() / 10); collectionView.setCurrentKm((double)Math.round(newVal) / 100); + tbarPanel.updateLinks(); updateChartPanel(); updateChartInfo(); } @@ -201,6 +203,7 @@ double newVal = currentKm * 100; newVal -= (collectionView.getSteps() / 10); collectionView.setCurrentKm((double)Math.round(newVal) / 100); + tbarPanel.updateLinks(); updateChartPanel(); updateChartInfo(); } diff -r 92239b53823f -r 17c66d38f095 flys-client/src/main/java/de/intevation/flys/client/server/ExportServiceImpl.java --- a/flys-client/src/main/java/de/intevation/flys/client/server/ExportServiceImpl.java Thu Aug 16 16:38:21 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/ExportServiceImpl.java Fri Aug 17 11:18:15 2012 +0000 @@ -4,14 +4,17 @@ import java.io.IOException; import org.w3c.dom.Document; +import org.w3c.dom.Element; import org.apache.log4j.Logger; +import org.json.XML; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import de.intevation.artifacts.common.utils.ClientProtocolUtils; +import de.intevation.artifacts.common.utils.XMLUtils; import de.intevation.artifacts.httpclient.http.HttpClient; import de.intevation.artifacts.httpclient.http.HttpClientImpl; @@ -43,14 +46,24 @@ String mode = req.getParameter("mode"); String type = req.getParameter("type"); String locale = req.getParameter("locale"); + String km = req.getParameter("km"); String fn = mode + "." + type; resp.setHeader("Content-Disposition", "attachment;filename=" + fn); logger.debug("Request " + type + " export."); + + Document attr = null; + if (km != null && km.length() > 0) { + attr = XMLUtils.newDocument(); + XMLUtils.ElementCreator ec = + new XMLUtils.ElementCreator(attr, null, null); + Element e = ec.create("km"); + e.setTextContent(km); + attr.appendChild(e); + } Document request = ClientProtocolUtils.newOutCollectionDocument( - uuid, mode, type); - + uuid, mode, type, attr); HttpClient client = new HttpClientImpl(url, locale); client.collectionOut(request, uuid, mode, out);