Package com.jalios.jcms
Class MemberInitialsManager
java.lang.Object
com.jalios.jcms.MemberInitialsManager
- All Implemented Interfaces:
JPropertiesListener
Utility class to produce a Member photo using member's initials.
- Since:
- jcms-10.0.4 JCMS-6025
- Author:
- Sylvain Devaux
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiongetInitials(Member member, Locale userLocale) Returns letters initials.getInitials(String firstName, String name, Locale userLocale) Returns letters initials.getInitialsColor(Member member) Return a CSS var of a jpalette color based on Member metadata.getInitialsColorFromEmail(String email) Return a CSS var of a jpalette color based on given email String.getInitialsFromEmail(String email) getInitialsJPaletteColorVar(String initialsColor) Return the closest jpalette color of the given initials background color.getInitialsTextColor(Member member) Return the text color to use with the initials background color of the given member.getInitialsTextColor(String initialsColor) Return the text color to use with the given initials background color.static MemberInitialsManagerGet the manager.voidpropertiesChange(JProperties arg0) Invoked after properties have been modified in JCMS and save on disk.protected voidvoidresetInitialsColor(Member member) Reset the cached color code based on Member metaDatas.
-
Field Details
-
COLOR_PROP_SEPARATOR
- See Also:
-
COLORS_PROP
List of custom hexadecimal color codes.- See Also:
-
colorCacheMap
-
-
Method Details
-
getInstance
Get the manager.- Returns:
- MemberInitialsManager the singleton instance
-
reloadProperties
protected void reloadProperties() -
propertiesChange
Description copied from interface:JPropertiesListenerInvoked after properties have been modified in JCMS and save on disk.You cannot alter the value received in parameters.
Note that properties parameter may be null, a limited set of site properties, or all site properties.
To check that a property has been modified, reload the "current" property instead using
channel.getPropertiesorchannel.getProperty.- Specified by:
propertiesChangein interfaceJPropertiesListener- Parameters:
arg0- the properties which have been submitted to change
-
getInitials
Returns letters initials.- Parameters:
firstName- the firstnamename- the nameuserLocale- the locale to use withString.toUpperCase(Locale)- Returns:
- First letter of name + First letter of firstname if available
- Since:
- jcms-10.0.4 JCMS-6025
-
getInitials
Returns letters initials.- Parameters:
member- the member to compute its initialsuserLocale- the locale to use withString.toUpperCase(Locale)- Returns:
- member's initials
- Since:
- jcms-10.0.4 JCMS-6025
-
getInitialsColor
Return a CSS var of a jpalette color based on Member metadata.- Parameters:
member- the member to compute a color from- Returns:
- a CSS var of a jpalette color
- Since:
- jcms-10.0.4 JCMS-6025
-
getInitialsColorFromEmail
Return a CSS var of a jpalette color based on given email String.- Parameters:
email- the email to get a color.Extracts name and firstname from email.
- Returns:
- a CSS var of a jpalette color
- Since:
- jcms-10.0.8
-
getInitialsTextColor
Return the text color to use with the given initials background color.- Parameters:
initialsColor- an initials background color, as returned bygetInitialsColor(Member)- Returns:
- the 700 variant CSS var for an Untitled UI color family, a white CSS var for other colors, null if initialsColor is empty
- Since:
- jplatform-11
-
getInitialsTextColor
Return the text color to use with the initials background color of the given member.- Parameters:
member- the member to compute a color from- Returns:
- a CSS var of a color
- Since:
- jplatform-11
-
getInitialsJPaletteColorVar
Return the closest jpalette color of the given initials background color.An Untitled UI color family is converted using its 700 variant (or 600 if not available) declared in jpalette.color.* properties.
- Parameters:
initialsColor- an initials background color, as returned bygetInitialsColor(Member)- Returns:
- a CSS var of a jpalette color, or initialsColor if not an Untitled UI color family
- Since:
- jplatform-11
-
getInitialsFromEmail
- Parameters:
email- the email to get initials.Extracts name and firstname from email.
- Returns:
- a color hex hexadecimal code
- Since:
- jcms-10.0.8
-
resetInitialsColor
Reset the cached color code based on Member metaDatas.- Parameters:
member- the member to reset its cached color- Since:
- jcms-10.0.5
-
getAvailableColors
-