xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerem...@apache.org
Subject svn commit: r358240 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/area/Trait.java
Date Wed, 21 Dec 2005 09:29:09 GMT
Author: jeremias
Date: Wed Dec 21 01:29:06 2005
New Revision: 358240

URL: http://svn.apache.org/viewcvs?rev=358240&view=rev
Log:
Forgot to add a toString() method to keep tests happy.

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/area/Trait.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/area/Trait.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/area/Trait.java?rev=358240&r1=358239&r2=358240&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/area/Trait.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/area/Trait.java Wed Dec 21 01:29:06 2005
@@ -486,13 +486,37 @@
          * @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();
+        }
+
     }
     
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org


Mime
View raw message