changeset 3499:17c66d38f095

FixA: Added AT file export to FixAnalysis W/Q. flys-client/trunk@5223 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 17 Aug 2012 11:18:15 +0000
parents 92239b53823f
children def13f23bb27
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/NaviChartOutputTab.java flys-client/src/main/java/de/intevation/flys/client/server/ExportServiceImpl.java
diffstat 8 files changed, 84 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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 <raimund.renkert@intevation.de>
+
+	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	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/server/ProxyServlet.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();
--- 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
--- 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
--- 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
--- 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 :
--- 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();
         }
--- 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);
 

http://dive4elements.wald.intevation.org