aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2005-12-21 09:29:06 +0000
committerJeremias Maerki <jeremias@apache.org>2005-12-21 09:29:06 +0000
commit1a6c78d1f1d83622ce5b095807bef63c4fe2588b (patch)
tree557e8bdd48c0d158ae961bf1dd899012d2fab648 /src
parent16890a0b27db4e7f9f712b9fb18fbf7b27f7931c (diff)
downloadxmlgraphics-fop-1a6c78d1f1d83622ce5b095807bef63c4fe2588b.tar.gz
xmlgraphics-fop-1a6c78d1f1d83622ce5b095807bef63c4fe2588b.zip
Forgot to add a toString() method to keep tests happy.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@358240 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/area/Trait.java26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/java/org/apache/fop/area/Trait.java b/src/java/org/apache/fop/area/Trait.java
index a576ede6e..57a6d1a2d 100644
--- a/src/java/org/apache/fop/area/Trait.java
+++ b/src/java/org/apache/fop/area/Trait.java
@@ -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();
+ }
+
}
/**