Package org.jenkins.ui.icon
Class Icon
java.lang.Object
org.jenkins.ui.icon.Icon
- Direct Known Subclasses:
BuildStatusIcon
,WeatherIcon
Simple icon metadata class.
- Since:
- 2.0
- Author:
- tom.fennelly@gmail.com
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGet the class specification for this Icon.Get the icon's normalized CSS selector.getQualifiedUrl
(String resUrl) Get the qualified icon url.getQualifiedUrl
(org.apache.commons.jelly.JellyContext context) Get the qualified icon url.getStyle()
Get the icon style.getUrl()
Get the icon url.boolean
Is the Icon an SVG?static String
toNormalizedCSSSelector
(String classNames) Generate a normalized CSS selector from the space separated list of icon class names.static String
toNormalizedIconName
(String string) Normalize the supplied string to an Icon name e.g.static String
toNormalizedIconNameClass
(String string) Normalize the supplied string to an Icon name class e.g.static String
toNormalizedIconSizeClass
(String string) Normalize the supplied string to an Icon size class e.g.static String
Normalize the supplied url.
-
Field Details
-
ICON_SMALL_STYLE
- See Also:
-
ICON_MEDIUM_STYLE
- See Also:
-
ICON_LARGE_STYLE
- See Also:
-
ICON_XLARGE_STYLE
- See Also:
-
-
Constructor Details
-
Icon
Creates acore
icon.- Parameters:
classSpec
- The icon class names. Expected to start with `icon-`.style
- The icon style.
-
Icon
Creates acore
icon.- Parameters:
classSpec
- The icon class names. Expected to start with `icon-`.url
- The icon image url.style
- The icon style.
-
Icon
Icon instance.- Parameters:
classSpec
- The icon class specification. Expected to start with `icon-`.url
- The icon image url.style
- The icon style.iconType
- The icon type.
-
Icon
Creates an icon.- Parameters:
classSpec
- The icon class names. Expected to start with `icon-`.url
- The icon image url.style
- The icon style.iconFormat
- theIconFormat
.- Since:
- 2.283
-
Icon
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public Icon(String classSpec, String url, String style, IconType iconType, IconFormat iconFormat)
-
-
Method Details
-
getClassSpec
Get the class specification for this Icon.- Returns:
- The class specification for this Icon.
-
isSvgSprite
public boolean isSvgSprite()Is the Icon an SVG?- Since:
- 2.283
-
getNormalizedSelector
Get the icon's normalized CSS selector.- Returns:
- The icon normalized CSS selector.
- See Also:
-
getUrl
Get the icon url.- Returns:
- The icon url.
-
getQualifiedUrl
Get the qualified icon url.
Qualifying the URL involves prefixing it depending on whether the icon is a core or plugin icon.- Parameters:
context
- The JellyContext.- Returns:
- The qualified icon url.
-
getQualifiedUrl
Get the qualified icon url.
Qualifying the URL involves prefixing it depending on whether the icon is a core or plugin icon.- Parameters:
resUrl
- The url of resources.- Returns:
- The qualified icon url.
-
getStyle
Get the icon style.- Returns:
- The icon style.
-
toNormalizedIconNameClass
Normalize the supplied string to an Icon name class e.g. "blue_anime" to "icon-blue-anime".- Parameters:
string
- The string to be normalized.- Returns:
- The normalized icon name class.
-
toNormalizedIconName
Normalize the supplied string to an Icon name e.g. "blue_anime" to "blue-anime".- Parameters:
string
- The string to be normalized.- Returns:
- The normalized icon name.
-
toNormalizedIconSizeClass
Normalize the supplied string to an Icon size class e.g. "16x16" to "icon-sm".- 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.
-
toNormalizedCSSSelector
Generate a normalized CSS selector from the space separated list of icon class names.
The normalized CSS selector is the list of class names, alphabetically sorted and dot separated. This means that "icon-help icon-xlg" and "icon-xlg icon-help" have the same normalized selector ".icon-help.icon-xlg". Spaces are not relevant etc.- Parameters:
classNames
- The space separated list of icon class names.- Returns:
- The normalized CSS selector.
-
toNormalizedIconUrl
Normalize the supplied url.- Parameters:
url
- The url to be normalized.- Returns:
- The normalized url.
-