diff flys-client/src/main/java/de/intevation/flys/client/server/ChartServiceHelper.java @ 2906:1780841d79af

Added navigation to fix analysis charts. flys-client/trunk@4673 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 15 Jun 2012 12:13:09 +0000
parents ab8eb2f544f2
children
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/server/ChartServiceHelper.java	Fri Jun 15 09:35:37 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/ChartServiceHelper.java	Fri Jun 15 12:13:09 2012 +0000
@@ -56,6 +56,7 @@
         appendFormat(req, attributes, ec);
         appendXRange(req, attributes, ec);
         appendYRange(req, attributes, ec);
+        appendCurrentKm(req, attributes, ec);
 
         doc.appendChild(attributes);
 
@@ -183,5 +184,34 @@
 
         attributes.appendChild(format);
     }
+
+
+    /**
+     * This method extracts the current km for the chart from request object and
+     * appends this km - if it exists - to the attribute document used to
+     * adjust the chart settings.
+     *
+     * @param req The request object that might contain the chart size.
+     * @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 appendCurrentKm(
+        Map<String, String> req,
+        Element             attributes,
+        ElementCreator      ec)
+    {
+        logger.debug("ChartServiceHelper.appendCurrentKm");
+
+        Element currentKm = ec.create("currentKm");
+
+        String km = req.get("km");
+
+        if (km != null) {
+            ec.addAttr(currentKm, "km", km, true);
+
+            attributes.appendChild(currentKm);
+        }
+    }
+
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org