org.jenkins.ui.icon
Class Icon

java.lang.Object
  extended by org.jenkins.ui.icon.Icon

public class Icon
extends Object

Simple icon metadata class.

Author:
tom.fennelly@gmail.com

Field Summary
static String ICON_LARGE_STYLE
           
static String ICON_MEDIUM_STYLE
           
static String ICON_SMALL_STYLE
           
static String ICON_XLARGE_STYLE
           
 
Constructor Summary
Icon(String classSpec, String style)
          Icon instance.
Icon(String classSpec, String url, String style)
          Icon instance.
Icon(String classSpec, String url, String style, IconType iconType)
          Icon instance.
 
Method Summary
 String getClassSpec()
          Get the class specification for this Icon.
 String getNormalizedSelector()
          Get the icon's normalized CSS selector.
 String getQualifiedUrl(org.apache.commons.jelly.JellyContext context)
          Get the qualified icon url.
 String getStyle()
          Get the icon style.
 String getUrl()
          Get the icon url.
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 toNormalizedIconUrl(String url)
          Normalize the supplied url.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ICON_SMALL_STYLE

public static final String ICON_SMALL_STYLE
See Also:
Constant Field Values

ICON_MEDIUM_STYLE

public static final String ICON_MEDIUM_STYLE
See Also:
Constant Field Values

ICON_LARGE_STYLE

public static final String ICON_LARGE_STYLE
See Also:
Constant Field Values

ICON_XLARGE_STYLE

public static final String ICON_XLARGE_STYLE
See Also:
Constant Field Values
Constructor Detail

Icon

public Icon(String classSpec,
            String style)
Icon instance.

Creates a core icon.

Parameters:
classSpec - The icon class names.
style - The icon style.

Icon

public Icon(String classSpec,
            String url,
            String style)
Icon instance.

Creates a core icon.

Parameters:
classSpec - The icon class names.
url - The icon image url.
style - The icon style.

Icon

public Icon(String classSpec,
            String url,
            String style,
            IconType iconType)
Icon instance.

Parameters:
classSpec - The icon class specification.
url - The icon image url.
style - The icon style.
iconType - The icon type.
Method Detail

getClassSpec

public String getClassSpec()
Get the class specification for this Icon.

Returns:
The class specification for this Icon.

getNormalizedSelector

public String getNormalizedSelector()
Get the icon's normalized CSS selector.

Returns:
The icon normalized CSS selector.
See Also:
toNormalizedCSSSelector(String)

getUrl

public String getUrl()
Get the icon url.

Returns:
The icon url.

getQualifiedUrl

public String getQualifiedUrl(org.apache.commons.jelly.JellyContext context)
Get the qualified icon url.

Qualifying the URL involves prefixing it depending on whether the icon is a core or plugin icon. Core icons are prefixed with the

Parameters:
context - The JellyContext.
Returns:
The qualified icon url.

getStyle

public String getStyle()
Get the icon style.

Returns:
The icon style.

toNormalizedIconNameClass

public static String toNormalizedIconNameClass(String string)
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

public static String toNormalizedIconName(String string)
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

public static String toNormalizedIconSizeClass(String string)
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

public static String toNormalizedCSSSelector(String classNames)
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

public static String toNormalizedIconUrl(String url)
Normalize the supplied url.

Parameters:
url - The url to be normalized.
Returns:
The normalized url.


Copyright © 2004-2014. All Rights Reserved.