diff artifacts/src/main/java/org/dive4elements/river/exports/sq/SQOverviewGenerator.java @ 7077:0a337f0005c2 generator-refactoring

Extended init() of OutGenerator to take name of the out to serve.
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 20 Sep 2013 16:34:09 +0200
parents 5c6fd2c010dd
children ada424214b02
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/sq/SQOverviewGenerator.java	Fri Sep 20 15:44:39 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/sq/SQOverviewGenerator.java	Fri Sep 20 16:34:09 2013 +0200
@@ -62,6 +62,8 @@
 
     protected List<JFreeChart> charts;
 
+    protected String outName;
+
     @Override
     public void setup(Element config) {
         logger.debug("SQOverviewGenerator.setup");
@@ -80,6 +82,8 @@
     ) {
         logger.debug("doOut()");
 
+        // TODO: Why not using outName for this.
+
         String name = artifactAndFacet.getData(context).toString();
         if(name != null) {
             logger.debug("name: " + name);
@@ -99,7 +103,7 @@
 
             try {
                 Document cAttr = getAttribute(context, collectionAttribute, name);
-                g.init(request, out, context);
+                g.init(name, request, out, context);
 
                 helper.doOut(g, name, name, cAttr, context);
                 JFreeChart chart = g.generateChart();
@@ -116,7 +120,8 @@
     }
 
     @Override
-    public void init(Document request, OutputStream out, CallContext context) {
+    public void init(String outName, Document request, OutputStream out, CallContext context) {
+        this.outName = outName;
         this.request = request;
         this.out = out;
         this.context = context;
@@ -158,6 +163,7 @@
             if (i > 1) {
                 vertPos = (size[1] / 3) * (i / 2);
             }
+            // TODO: Dispose Graphics object!
             result.createGraphics().drawImage(img, horPos, vertPos, null);
         }
         ImageIO.write(result, "png", out);

http://dive4elements.wald.intevation.org