Class LegacyPrimeFacesHexColorConverter

  • All Implemented Interfaces:
    javax.faces.convert.Converter<String>

    public class LegacyPrimeFacesHexColorConverter
    extends Object
    implements javax.faces.convert.Converter<String>
    Legacy converter for the PrimeFaces p:colorPicker component. From their changelog:
         Value used to be hex only without the # like ffffff but now if using hex it includes the #fffffff because the new
         picker supports Hex, RGB, HSL color values.
     
    We do not have any issue using CSS like color values, but we need to ensure that values from existing entities stored in the database are loaded correctly. When encountering a raw color string such as 3aff9b, this converter adds a hashtag to the beginning of the string to make it compatible with the new color picker.
    Since:
    8.2.0
    Author:
    XIMA Media GmbH
    • Constructor Detail

      • LegacyPrimeFacesHexColorConverter

        public LegacyPrimeFacesHexColorConverter()
    • Method Detail

      • getAsObject

        public String getAsObject​(javax.faces.context.FacesContext context,
                                  javax.faces.component.UIComponent component,
                                  String value)
        Specified by:
        getAsObject in interface javax.faces.convert.Converter<String>
      • getAsString

        public String getAsString​(javax.faces.context.FacesContext context,
                                  javax.faces.component.UIComponent component,
                                  String value)
        Specified by:
        getAsString in interface javax.faces.convert.Converter<String>