Class CssColorConverter

java.lang.Object
com.bc.ceres.swing.figure.support.CssColorConverter
All Implemented Interfaces:
Converter<Color>

public class CssColorConverter extends Object implements Converter<Color>
  • Constructor Details

    • CssColorConverter

      public CssColorConverter()
  • Method Details

    • getValueType

      public Class<? extends Color> getValueType()
      Gets the value type.
      Specified by:
      getValueType in interface Converter<Color>
      Returns:
      The value type.
    • parse

      public Color parse(String text) throws ConversionException
      Converts a value from its plain text representation to a Java object instance of the type returned by getValueType().
      Specified by:
      parse in interface Converter<Color>
      Parameters:
      text - The textual representation of the value. It must be either in hexadecimal format (e.g. "#FFFFFF" or "FFFFFF") or given by a string of comma-separated numbers, such as "255,255,255".
      Returns:
      The converted value.
      Throws:
      ConversionException - If the conversion fails.
    • format

      public String format(Color value)
      Converts a value of the type returned by getValueType() to its plain text representation.
      Specified by:
      format in interface Converter<Color>
      Parameters:
      value - The value to be converted to text.
      Returns:
      The textual representation of the value.