]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Forgot to add a toString() method to keep tests happy.
authorJeremias Maerki <jeremias@apache.org>
Wed, 21 Dec 2005 09:29:06 +0000 (09:29 +0000)
committerJeremias Maerki <jeremias@apache.org>
Wed, 21 Dec 2005 09:29:06 +0000 (09:29 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@358240 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/area/Trait.java

index a576ede6e8ce6f4bbdabe07bbe865f197fde4098..57a6d1a2d1fd8b4d350db2b8d566cfeddf97a5ce 100644 (file)
@@ -486,13 +486,37 @@ public class Trait implements Serializable {
          * @return the serializable color value.
          */
         public static ColorType makeSerializable(ColorType col) {
-            if (col instanceof Serializable) {
+            if (col == null) {
+                return null;
+            } else if (col instanceof Serializable) {
                 return col;
             } else {
                 return new Color(col);
             }
         }
         
+        /** @see java.lang.Object#toString() */
+        public String toString() {
+            StringBuffer sbuf = new StringBuffer(8);
+            sbuf.append('#');
+            String s = Integer.toHexString((int)(red * 255.0));
+            if (s.length() == 1) {
+                sbuf.append('0');
+            }
+            sbuf.append(s);
+            s = Integer.toHexString((int)(green * 255.0));
+            if (s.length() == 1) {
+                sbuf.append('0');
+            }
+            sbuf.append(s);
+            s = Integer.toHexString((int)(blue * 255.0));
+            if (s.length() == 1) {
+                sbuf.append('0');
+            }
+            sbuf.append(s);
+            return sbuf.toString();
+        }
+
     }
     
     /**