public ContentStyleReadHandler() { colorValueConverter = new ColorValueConverter(); }
/** * Creates a new object description. */ public ColorObjectDescription() { super( Color.class ); valueConverter = new ColorValueConverter(); setParameterDefinition( "value", String.class ); }
/** * Parses a color entry. If the entry is in hexadecimal or octal notation, the color is created using Color.decode(). * If the string denotes a constant name of one of the color constants defined in java.awt.Color, this constant is * used. * <p/> * As fallback the supplied default value is returned if no color can be parsed. * * @param color * the color (as a string). * @param defaultValue * the default value (returned if no color can be parsed). * @return the paint. */ public static Color parseColor( final String color, final Color defaultValue ) { if ( color == null ) { return defaultValue; } try { // get color by hex or octal value return (Color) new ColorValueConverter().toPropertyValue( color ); } catch ( Exception nfe ) { return defaultValue; } }
registeredClasses.put( Character.class, new CharacterValueConverter() ); registeredClasses.put( Character.TYPE, new CharacterValueConverter() ); registeredClasses.put( Color.class, new ColorValueConverter() ); registeredClasses.put( Double.class, new DoubleValueConverter() ); registeredClasses.put( Double.TYPE, new DoubleValueConverter() );