1 42 43 package org.jfree.xml.factory.objects; 44 45 import java.awt.Color ; 46 47 import org.jfree.util.PaintUtilities; 48 49 54 public class ColorObjectDescription extends AbstractObjectDescription { 55 56 59 public ColorObjectDescription() { 60 super(Color .class); 61 setParameterDefinition("value", String .class); 62 } 63 64 69 public Object createObject() { 70 final String value = (String ) getParameter("value"); 71 return PaintUtilities.stringToColor(value); 72 } 73 74 82 public void setParameterFromObject(final Object o) throws ObjectFactoryException { 83 if (!(o instanceof Color )) { 84 throw new ObjectFactoryException("Is no instance of java.awt.Color"); 85 } 86 final Color c = (Color ) o; 87 setParameter("value", PaintUtilities.colorToString(c)); 88 } 89 } 90 | Popular Tags |