diff flys-client/src/main/java/de/intevation/flys/client/server/ChartInfoServiceImpl.java @ 549:e74bf6bfeeb6

Use the same code to create the attribute document for the chart creation in ChartOutputService and ChartInfoService. flys-client/trunk@2060 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 07 Jun 2011 10:03:19 +0000
parents 95a7f9cb3d58
children 6050d49eaba3
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/server/ChartInfoServiceImpl.java	Mon Jun 06 11:56:15 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/ChartInfoServiceImpl.java	Tue Jun 07 10:03:19 2011 +0000
@@ -2,11 +2,11 @@
 
 import java.io.InputStream;
 import java.io.IOException;
+import java.util.Map;
 
 import javax.xml.xpath.XPathConstants;
 
 import org.w3c.dom.Document;
-import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
 import com.google.gwt.user.server.rpc.RemoteServiceServlet;
@@ -14,7 +14,6 @@
 import de.intevation.artifacts.common.ArtifactNamespaceContext;
 import de.intevation.artifacts.common.utils.ClientProtocolUtils;
 import de.intevation.artifacts.common.utils.XMLUtils;
-import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator;
 
 import de.intevation.artifacts.httpclient.http.HttpClient;
 import de.intevation.artifacts.httpclient.http.HttpClientImpl;
@@ -43,12 +42,11 @@
 
 
     public Transform2D getChartInfo(
-        Collection collection,
-        String     url,
-        String     locale,
-        String     type,
-        int        width,
-        int        height)
+        Collection          collection,
+        String              url,
+        String              locale,
+        String              type,
+        Map<String, String> attr)
     throws ServerException
     {
         System.out.println("ChartInfoServiceImpl.getChartInfo");
@@ -57,7 +55,7 @@
                 collection.identifier(),
                 type,
                 type,
-                getChartAttributes(width, height));
+                ChartServiceHelper.getChartAttributes(attr));
 
         try {
             HttpClient client = new HttpClientImpl(url, locale);
@@ -81,36 +79,6 @@
 
 
     /**
-     * This method returns a document which might contain parameters to adjust
-     * chart settings. The document is created using the information that are
-     * contained in the request object.
-     *
-     * @param req The request document.
-     *
-     * @return a document to adjust chart settings.
-     */
-    protected Document getChartAttributes(int width, int height) {
-        Document doc = XMLUtils.newDocument();
-
-        ElementCreator ec = new ElementCreator(
-            doc,
-            ArtifactNamespaceContext.NAMESPACE_URI,
-            ArtifactNamespaceContext.NAMESPACE_PREFIX);
-
-        Element attr = ec.create("attributes");
-        Element size = ec.create("size");
-
-        ec.addAttr(size, "width", String.valueOf(width), true);
-        ec.addAttr(size, "height", String.valueOf(height), true);
-
-        attr.appendChild(size);
-        doc.appendChild(attr);
-
-        return doc;
-    }
-
-
-    /**
      * Parses the chart info document and extract the Transform2D values.
      *
      * @param doc The chart info document.

http://dive4elements.wald.intevation.org