changeset 1351:19f621663b7a

Add the format (png, pdf, svg) string into the xml document which is used for querying charts. flys-client/trunk@3022 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 19 Oct 2011 09:35:41 +0000
parents 064fb5d181ea
children 01b18db3b288
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/server/ChartServiceHelper.java
diffstat 2 files changed, 35 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Wed Oct 19 08:02:52 2011 +0000
+++ b/flys-client/ChangeLog	Wed Oct 19 09:35:41 2011 +0000
@@ -1,3 +1,8 @@
+2011-10-19  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/server/ChartServiceHelper.java:
+	  Add the format string into the xml document for querying charts.
+
 2011-10-19  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/server/ChartServiceHelper.java	Wed Oct 19 08:02:52 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/ChartServiceHelper.java	Wed Oct 19 09:35:41 2011 +0000
@@ -47,6 +47,7 @@
         Element attributes = ec.create("attributes");
 
         appendChartSize(req, attributes, ec);
+        appendFormat(req, attributes, ec);
         appendXRange(req, attributes, ec);
         appendYRange(req, attributes, ec);
 
@@ -147,5 +148,34 @@
             attributes.appendChild(range);
         }
     }
+
+
+    /**
+     * This method extracts the format string from request object and appends
+     * those format - if existing - to the attribute document used to adjust
+     * the chart settings.
+     *
+     * @param req The request object that might contain the chart format.
+     * @param doc The attribute document used to adjust chart settings.
+     * @param ec The ElementCreator that might be used to create new Elements.
+     */
+    protected static void appendFormat(
+        Map<String, String> req,
+        Element             attributes,
+        ElementCreator      ec
+
+    ) {
+        System.out.println("ChartServiceHelper.appendFormat");
+
+        String formatStr = req.get("format");
+        if (formatStr == null || formatStr.length() == 0) {
+            return;
+        }
+
+        Element format = ec.create("format");
+        ec.addAttr(format, "value", formatStr, true);
+
+        attributes.appendChild(format);
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org