Class ThemeFns


  • public class ThemeFns
    extends java.lang.Object
    Providing theme relevant functions for EL.
    Since:
    6.5.0
    Author:
    simonpai, jumperchen
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String applyCSS3​(java.lang.String styleName, java.lang.String styleValue)
      Generates a specific browser CSS rule String for the given style name and value.
      static java.lang.String borderRadius​(java.lang.String style)
      Generates a specific browser CSS border-radius.
      static java.lang.String box​(java.lang.String styleName, java.lang.String styleValue)
      Generates a specific browser CSS rule string for box model.
      static java.lang.String box2​(java.lang.String styleName, java.lang.String styleValue, java.lang.String styleName2, java.lang.String styleValue2)
      Generates a specific browser CSS rule string for box model with two pair styles.
      static java.lang.String box3​(java.lang.String styleName, java.lang.String styleValue, java.lang.String styleName2, java.lang.String styleValue2, java.lang.String styleName3, java.lang.String styleValue3)
      Generates a specific browser CSS rule string for box model with three pair styles.
      static java.lang.String boxShadow​(java.lang.String style)
      Generates a specific browser CSS box-shadow.
      static java.lang.String getCurrentTheme()
      Returns the current theme name
      static ThemeRegistry getThemeRegistry()
      Returns the current theme registry
      static ThemeResolver getThemeResolver()
      Returns the current theme resolver
      static java.lang.String gradient​(java.lang.String direction, java.lang.String colors)
      Generates a specific of browser CSS color gradient rules String.
      static java.lang.String gradients​(java.lang.String direction, java.lang.String colors)
      Generates a set of cross-browser CSS color gradient rules String.
      static java.lang.String gradValue​(java.lang.String direction, java.lang.String colors)
      Generates a specific CSS color gradient value only.
      static void loadProperties​(java.lang.String path)
      Loads a theme properties and apply them into the request scope.
      static void setThemeRegistry​(ThemeRegistry themeRegistry)
      Change the theme registry
      static void setThemeResolver​(ThemeResolver themeResolver)
      Change the current theme resolver
      static java.lang.String transform​(java.lang.String style)
      Generates a specific browser CSS transform.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • gradient

        public static java.lang.String gradient​(java.lang.String direction,
                                                java.lang.String colors)
        Generates a specific of browser CSS color gradient rules String.
        Parameters:
        direction - "ver", "hor", "diag-", "diag+", "rad"
        colors - the colors with stops, which are separated by semicolon ";". For example,
        ThemeFns.gradient("ver", "#fefefe 0%; #eeeeee 100%");
        Returns:
        A specific CSS gradient rules String
      • gradValue

        public static java.lang.String gradValue​(java.lang.String direction,
                                                 java.lang.String colors)
        Generates a specific CSS color gradient value only.
        Parameters:
        direction - "ver", "hor", "diag-", "diag+", "rad"
        colors - the colors with stops, which are separated by semicolon ";" For example,
        ThemeFns.gradValue("ver", "#fefefe 0%; #eeeeee 100%");
        Returns:
        A specific CSS gradient rules String without the words "background:".
      • gradients

        public static java.lang.String gradients​(java.lang.String direction,
                                                 java.lang.String colors)
        Generates a set of cross-browser CSS color gradient rules String.
        Parameters:
        direction - "ver", "hor", "diag-", "diag+", "rad"
        colors - the colors, which are separated by semicolon ";"
        Returns:
        A set of cross-browser CSS gradient rules String
      • applyCSS3

        public static java.lang.String applyCSS3​(java.lang.String styleName,
                                                 java.lang.String styleValue)
        Generates a specific browser CSS rule String for the given style name and value.

        Note: the method is only applied with the browser prefix as the style name, if the CSS3 style usage rule is different between browsers, please use another method instead.

        Parameters:
        styleName - the value of the style name, like box-sizing, animation
        styleValue - the value according to the style name, like border-box, mymove 5s infinite
        Returns:
        a specific browser CSS rule string, like -moz-box-sizing for firefox and -webkit-box-sizing for safari and chrome
      • box

        public static java.lang.String box​(java.lang.String styleName,
                                           java.lang.String styleValue)
        Generates a specific browser CSS rule string for box model.
        Parameters:
        styleName - the value of the style name, like box-orient, box-pack
        styleValue - the value according to the style name, like horizontal, center
        Returns:
        a specific browser CSS rule string, like -moz-box-orient for firefox and -webkit-box-orient for safari and chrome
      • box2

        public static java.lang.String box2​(java.lang.String styleName,
                                            java.lang.String styleValue,
                                            java.lang.String styleName2,
                                            java.lang.String styleValue2)
        Generates a specific browser CSS rule string for box model with two pair styles.
        See Also:
        box(String, String)
      • box3

        public static java.lang.String box3​(java.lang.String styleName,
                                            java.lang.String styleValue,
                                            java.lang.String styleName2,
                                            java.lang.String styleValue2,
                                            java.lang.String styleName3,
                                            java.lang.String styleValue3)
        Generates a specific browser CSS rule string for box model with three pair styles.
        See Also:
        box(String, String), box2(String, String, String, String)
      • transform

        public static java.lang.String transform​(java.lang.String style)
        Generates a specific browser CSS transform.
        Parameters:
        style - the value of the transform
        Returns:
        a specific browser CSS transform
      • boxShadow

        public static java.lang.String boxShadow​(java.lang.String style)
        Generates a specific browser CSS box-shadow.
        Parameters:
        style - the value of the box-shadow
        Returns:
        a specific browser CSS box-shadow
      • borderRadius

        public static java.lang.String borderRadius​(java.lang.String style)
        Generates a specific browser CSS border-radius.
        Parameters:
        style - the value of the border-radius
        Returns:
        a specific browser CSS border-radius
      • loadProperties

        public static void loadProperties​(java.lang.String path)
        Loads a theme properties and apply them into the request scope.
        Parameters:
        path - a file path
      • getThemeRegistry

        public static ThemeRegistry getThemeRegistry()
        Returns the current theme registry
        Returns:
        the current theme registry
        Since:
        6.5.2
      • setThemeRegistry

        public static void setThemeRegistry​(ThemeRegistry themeRegistry)
        Change the theme registry
        Parameters:
        themeRegistry - the new theme registry
        Since:
        6.5.2
      • getThemeResolver

        public static ThemeResolver getThemeResolver()
        Returns the current theme resolver
        Returns:
        the current theme resolver
        Since:
        6.5.2
      • setThemeResolver

        public static void setThemeResolver​(ThemeResolver themeResolver)
        Change the current theme resolver
        Parameters:
        themeResolver - the new theme resolver
      • getCurrentTheme

        public static java.lang.String getCurrentTheme()
        Returns the current theme name
        Returns:
        the current theme name
        Since:
        6.5.2