Class FontAwesome

java.lang.Object
com.oorian.fontawesome.FontAwesome

public class FontAwesome extends Object
Entry point class for the FontAwesome wrapper library. Provides static methods to configure resource paths and add CSS/JS to pages. Font Awesome is a popular icon library with thousands of icons across multiple styles including Solid, Regular, Light, Thin, Duotone, Sharp, and Brands.
See Also:
  • Method Details

    • setCdnBase

      public static void setCdnBase(String cdnBase)
      Sets the CDN base URL for Font Awesome resources. Default is "https://cdnjs.cloudflare.com/ajax/libs/font-awesome".
      Parameters:
      cdnBase - The CDN base URL.
    • setVersion

      public static void setVersion(String version)
      Sets the Font Awesome version to use from CDN. Default is "6.5.1".
      Parameters:
      version - The Font Awesome version string (e.g., "6.5.1").
    • setFontAwesomeRootPath

      public static void setFontAwesomeRootPath(String path)
      Sets the root path for Font Awesome resources. When set, local files will be used instead of CDN.
      Parameters:
      path - Root path for Font Awesome files (e.g., "/fontawesome").
    • setCssFile

      public static void setCssFile(String cssFile)
      Sets the CSS file name relative to the root path. Default is "css/all.min.css".
      Parameters:
      cssFile - CSS file name (e.g., "css/all.min.css").
    • setKitCode

      public static void setKitCode(String code)
      Sets the Font Awesome Kit code for Pro features. When a kit code is set, the kit script will be used instead of local/CDN files.
      Parameters:
      code - The kit code from your Font Awesome account (e.g., "a1b2c3d4e5").
    • getCdnBase

      public static String getCdnBase()
      Gets the CDN base URL.
      Returns:
      CDN base URL.
    • getVersion

      public static String getVersion()
      Gets the Font Awesome version used for CDN.
      Returns:
      Font Awesome version string.
    • getFontAwesomeRootPath

      public static String getFontAwesomeRootPath()
      Gets the root path for Font Awesome resources.
      Returns:
      Root path for Font Awesome files, or null if using CDN.
    • getCssFile

      public static String getCssFile()
      Gets the CSS file name relative to the root path.
      Returns:
      CSS file name.
    • getKitCode

      public static String getKitCode()
      Gets the configured kit code.
      Returns:
      The kit code, or null if not configured.
    • addResources

      public static void addResources(com.oorian.html.elements.Head head)
      Adds all Font Awesome resources to the page head. Uses kit script if a kit code is configured, otherwise uses local files or CDN.
      Parameters:
      head - The page head element.
    • hasKit

      public static boolean hasKit()
      Checks if a kit code is configured.
      Returns:
      True if a kit code is set, false otherwise.
    • initialize

      public static void initialize(com.oorian.html.HtmlPage page)
      Initializes Font Awesome for the given page. Adds all required CSS and JavaScript resources to the page head.
      Parameters:
      page - The page to initialize Font Awesome on.