Class JWTIconFontMapper
java.lang.Object
com.jadice.web.util.icon.client.iconfont.JWTIconFontMapper
In some cases, for example when selecting the image for an annotation, we need to get the icon by
the name of the annotation. The same icon can be requested by different names (for examples in
different annotation profiles the open polygon is either called polygon or open polygon). In
other cases the requested name and the icon differs. In this class mappings from a requested name
to an
IconFont
can be defined. If a name is requested but no mapping is defined
JWTIconFont.valueOf(String)
is called.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addMapping
(String name, IconFont font) Adds a new mapping.static JWTIconFontMapper
get()
getMappingForName
(String name) Returns the defined mapping.Returns the defined mapping.void
Deletes all defined mappings.
-
Constructor Details
-
JWTIconFontMapper
public JWTIconFontMapper()
-
-
Method Details
-
get
-
getMappingForName
Returns the defined mapping. If no mapping is defined returns the matching value ofJWTIconFont.valueOf(String)
. If there is no matchingJWTIconFont
null will be returned.- Parameters:
name
- the name for which the mapping should be returned- Returns:
- the mapping or null
-
getMappingForNameWithFallback
Returns the defined mapping. If no mapping is defined returns the matching value ofJWTIconFont.valueOf(String)
. If there is no matchingJWTIconFont
theJWTIconFont.MISSING_ICON
will be returned.- Parameters:
name
- the name for which the mapping should be returned- Returns:
- the mapping or the fallback icon
-
resetMappings
public void resetMappings()Deletes all defined mappings. -
addMapping
Adds a new mapping.- Parameters:
name
- the name for the mappingfont
- the font which should be returned when callinggetMappingForName(String)
orgetMappingForNameWithFallback(String)
-