Package org.jenkins.ui.icon
Class IconSet
- java.lang.Object
-
- org.jenkins.ui.icon.IconSet
-
public class IconSet extends Object
An icon set.- Since:
- 2.0
- Author:
- tom.fennelly@gmail.com
-
-
Constructor Summary
Constructors Constructor Description IconSet()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IconSet
addIcon(Icon icon)
Map<String,Icon>
getCoreIcons()
Icon
getIconByClassSpec(Object iconClassSpec)
Get an icon instance from a class specification.Icon
getIconByNormalizedCSSSelector(Object cssSelector)
Get an icon instance from it'snormalized CSS selector
.Icon
getIconByUrl(Object url)
Get an icon instance from it's url.static String
getSymbol(String name, String title, String tooltip, String htmlTooltip, String classes, String pluginName, String id)
static void
initPageVariables(org.apache.commons.jelly.JellyContext context)
static String
toNormalizedIconNameClass(Object string)
Normalize the supplied string to an Icon name class e.g.static String
toNormalizedIconSizeClass(Object string)
Normalize the supplied string to an Icon size class e.g.static String
toNormalizedIconUrl(Object url)
Normalize the supplied url.static String
tryTranslateTangoIconToSymbol(String tangoIcon)
This is a temporary function to replace Tango icons across Jenkins and plugins with appropriate Jenkins Symbolsstatic String
tryTranslateTangoIconToSymbol(String tangoIcon, Supplier<String> defaultValueSupplier)
This is a temporary function to replace Tango icons across Jenkins and plugins with appropriate Jenkins Symbols
-
-
-
Field Detail
-
icons
public static final IconSet icons
-
-
Method Detail
-
initPageVariables
public static void initPageVariables(org.apache.commons.jelly.JellyContext context)
-
getSymbol
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static String getSymbol(String name, String title, String tooltip, String htmlTooltip, String classes, String pluginName, String id)
-
getIconByNormalizedCSSSelector
public Icon getIconByNormalizedCSSSelector(Object cssSelector)
Get an icon instance from it'snormalized CSS selector
.
ThisObject
based version allows the function to be resolvable e.g. from JEXL expressions that are trying to perform reflective lookup using a GString (instead of aString
).- Parameters:
cssSelector
- The icon's normalized CSS selector.- Returns:
- The icon instance, or
null
if no such icon.
-
getIconByClassSpec
public Icon getIconByClassSpec(Object iconClassSpec)
Get an icon instance from a class specification.
ThisObject
based version allows the function to be resolvable e.g. from JEXL expressions that are trying to perform reflective lookup using a GString (instead of aString
).- Parameters:
iconClassSpec
- The icon's class spec as defined on the <l:icon class> attribute.- Returns:
- The icon instance, or
null
if no such icon.
-
getIconByUrl
public Icon getIconByUrl(Object url)
Get an icon instance from it's url.
ThisObject
based version allows the function to be resolvable e.g. from JEXL expressions that are trying to perform reflective lookup using a GString (instead of aString
).- Parameters:
url
- The icon url.- Returns:
- The icon instance, or
null
if no such icon.
-
toNormalizedIconNameClass
public static String toNormalizedIconNameClass(Object string)
Normalize the supplied string to an Icon name class e.g. "blue_anime" to "icon-blue-anime".
ThisObject
based version allows the function to be resolvable e.g. from JEXL expressions that are trying to perform reflective lookup using a GString (instead of aString
).- Parameters:
string
- The string to be normalized.- Returns:
- The normalized icon name class.
-
toNormalizedIconSizeClass
public static String toNormalizedIconSizeClass(Object string)
Normalize the supplied string to an Icon size class e.g. "16x16" to "icon-sm".
ThisObject
based version allows the function to be resolvable e.g. from JEXL expressions that are trying to perform reflective lookup using a GString (instead of aString
).- Parameters:
string
- The string to be normalized.- Returns:
- The normalized icon size class, or the unmodified
string
arg if it was an unrecognised icon size.
-
toNormalizedIconUrl
public static String toNormalizedIconUrl(Object url)
Normalize the supplied url.
ThisObject
based version allows the function to be resolvable e.g. from JEXL expressions that are trying to perform reflective lookup using a GString (instead of aString
).- Parameters:
url
- The url to be normalized.- Returns:
- The normalized url.
-
tryTranslateTangoIconToSymbol
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static String tryTranslateTangoIconToSymbol(@CheckForNull String tangoIcon)
This is a temporary function to replace Tango icons across Jenkins and plugins with appropriate Jenkins Symbols- Parameters:
tangoIcon
- A tango icon in the format 'icon-* size-*', e.g. 'icon-gear icon-lg'- Returns:
- a Jenkins Symbol (if one exists) otherwise null
-
tryTranslateTangoIconToSymbol
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static String tryTranslateTangoIconToSymbol(@CheckForNull String tangoIcon, @NonNull Supplier<String> defaultValueSupplier)
This is a temporary function to replace Tango icons across Jenkins and plugins with appropriate Jenkins Symbols- Parameters:
tangoIcon
- A tango icon in the format 'icon-* size-*', e.g. 'icon-gear icon-lg'defaultValueSupplier
- A supplier function that will be called if no icon translation is found- Returns:
- a Jenkins Symbol (if one exists) otherwise the value returned by the supplier
-
-