Tag: mws_bea300
User: obo     
Date: 2008-04-28 15:23:30+0000
Modified:
   dba/reportdesign/java/com/sun/star/report/pentaho/output/ImageProducer.java

Log:
 INTEGRATION: CWS dba30beta_BEA300 (1.4.6); FILE MERGED
 2008/04/22 10:30:28 oj 1.4.6.1: #i88503# merge changes from rptchart02

File Changes:

Directory: /dba/reportdesign/java/com/sun/star/report/pentaho/output/
=====================================================================

File [changed]: ImageProducer.java
Url: 
http://dba.openoffice.org/source/browse/dba/reportdesign/java/com/sun/star/report/pentaho/output/ImageProducer.java?r1=1.4&r2=1.4.4.1
Delta lines:  +332 -339
-----------------------
--- ImageProducer.java  2008-04-10 17:35:35+0000        1.4
+++ ImageProducer.java  2008-04-28 15:23:27+0000        1.4.4.1
@@ -27,8 +27,6 @@
  * for a copy of the LGPLv3 License.
  *
  ************************************************************************/
-
-
 package com.sun.star.report.pentaho.output;
 
 import java.awt.Image;
@@ -53,6 +51,7 @@
 import com.sun.star.report.ReportExecutionException;
 import com.sun.star.report.pentaho.DefaultNameGenerator;
 import com.keypoint.PngEncoder;
+import java.util.Map;
 import org.jfree.io.IOUtils;
 import org.jfree.layouting.input.style.values.CSSNumericType;
 import org.jfree.layouting.input.style.values.CSSNumericValue;
@@ -67,11 +66,13 @@
  */
 public class ImageProducer
 {
+
   public static class OfficeImage
   {
-    private CSSNumericValue width;
-    private CSSNumericValue height;
-    private String embeddableLink;
+
+        private final CSSNumericValue width;
+        private final CSSNumericValue height;
+        private final String embeddableLink;
 
     public OfficeImage(final String embeddableLink, final CSSNumericValue 
width, final CSSNumericValue height)
     {
@@ -98,7 +99,8 @@
 
   private static class ByteDataImageKey
   {
-    private byte[] keyData;
+
+        private final byte[] keyData;
     private Integer hashCode;
 
     protected ByteDataImageKey(final byte[] keyData)
@@ -110,13 +112,10 @@
       this.keyData = keyData;
     }
 
-
     public boolean equals(final Object o)
     {
-      if (this == o)
+            if (this != o)
       {
-        return true;
-      }
       if (o == null || getClass() != o.getClass())
       {
         return false;
@@ -127,6 +126,7 @@
       {
         return false;
       }
+            }
 
       return true;
     }
@@ -139,22 +139,21 @@
       }
 
       final int length = Math.min(keyData.length, 512);
-      int hashCode = 0;
+            int hashValue = 0;
       for (int i = 0; i < length; i++)
       {
         final byte b = keyData[i];
-        hashCode = b + hashCode * 23;
+                hashValue = b + hashValue * 23;
       }
-      this.hashCode = new Integer(hashCode);
-      return hashCode;
+            this.hashCode = new Integer(hashValue);
+            return hashValue;
     }
   }
-
-  private HashMap imageCache;
-  private InputRepository inputRepository;
-  private OutputRepository outputRepository;
-  private ImageService imageService;
-  private DefaultNameGenerator nameGenerator;
+    private final Map imageCache;
+    private final InputRepository inputRepository;
+    private final OutputRepository outputRepository;
+    private final ImageService imageService;
+    private final DefaultNameGenerator nameGenerator;
 
   public ImageProducer(final InputRepository inputRepository,
                        final OutputRepository outputRepository,
@@ -191,7 +190,7 @@
                                   final boolean preserveIRI)
   {
 
-    Log.debug ("Want to produce image " + imageData);
+        Log.debug("Want to produce image " + imageData);
     if (imageData instanceof String)
     {
       return produceFromString((String) imageData, preserveIRI);
@@ -242,8 +241,7 @@
       try
       {
         IOUtils.getInstance().copyStreams(inputStream, bout);
-      }
-      finally
+            } finally
       {
         inputStream.close();
       }
@@ -283,8 +281,7 @@
       try
       {
         IOUtils.getInstance().copyStreams(bin, outputStream);
-      }
-      finally
+            } finally
       {
         outputStream.close();
       }
@@ -337,8 +334,7 @@
         try
         {
           IOUtils.getInstance().copyStreams(inputStream, bout);
-        }
-        finally
+                } finally
         {
           inputStream.close();
         }
@@ -387,8 +383,7 @@
       try
       {
         IOUtils.getInstance().copyStreams(inputStream, bout);
-      }
-      finally
+            } finally
       {
         inputStream.close();
       }
@@ -399,7 +394,7 @@
       final CSSNumericValue widthVal = 
CSSNumericValue.createValue(CSSNumericType.MM, dims.getWidth() / 100.0);
       final CSSNumericValue heightVal = 
CSSNumericValue.createValue(CSSNumericType.MM, dims.getHeight() / 100.0);
 
-      if (preserveIRI == false)
+            if (!preserveIRI)
       {
         final OfficeImage retval = new OfficeImage(url.toString(), widthVal, 
heightVal);
         imageCache.put(url, retval);
@@ -421,7 +416,7 @@
       Log.warn("Failed to create image from local input-repository" + e);
     }
 
-    if (preserveIRI == false)
+        if (!preserveIRI)
     {
       final OfficeImage image = new OfficeImage(url.toString(), null, null);
       imageCache.put(url, image);
@@ -453,12 +448,10 @@
     try
     {
       IOUtils.getInstance().copyStreams(bin, outputStream);
-    }
-    finally
+        } finally
     {
       outputStream.close();
     }
     return name;
   }
-
 }




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to