Class Icon

    • Constructor Detail

      • Icon

        public Icon​(String classSpec,
                    String style)
        Creates a core icon.
        Parameters:
        classSpec - The icon class names. Expected to start with `icon-`.
        style - The icon style.
      • Icon

        public Icon​(String classSpec,
                    String url,
                    String style)
        Creates a core icon.
        Parameters:
        classSpec - The icon class names. Expected to start with `icon-`.
        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. Expected to start with `icon-`.
        url - The icon image url.
        style - The icon style.
        iconType - The icon type.
      • Icon

        public Icon​(String classSpec,
                    String url,
                    String style,
                    IconFormat iconFormat)
        Creates an icon.
        Parameters:
        classSpec - The icon class names. Expected to start with `icon-`.
        url - The icon image url.
        style - The icon style.
        iconFormat - the IconFormat.
        Since:
        2.283
    • Method Detail

      • getClassSpec

        public String 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

        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.
        Parameters:
        context - The JellyContext.
        Returns:
        The qualified icon url.
      • getQualifiedUrl

        public String getQualifiedUrl​(String resUrl)
        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

        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.