Package com.oorian.fontawesome
Class FontAwesome
java.lang.Object
com.oorian.fontawesome.FontAwesome
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 Summary
Modifier and TypeMethodDescriptionstatic voidaddResources(com.oorian.html.elements.Head head) Adds all Font Awesome resources to the page head.static StringGets the CDN base URL.static StringGets the CSS file name relative to the root path.static StringGets the root path for Font Awesome resources.static StringGets the configured kit code.static StringGets the Font Awesome version used for CDN.static booleanhasKit()Checks if a kit code is configured.static voidinitialize(com.oorian.html.HtmlPage page) Initializes Font Awesome for the given page.static voidsetCdnBase(String cdnBase) Sets the CDN base URL for Font Awesome resources.static voidsetCssFile(String cssFile) Sets the CSS file name relative to the root path.static voidsetFontAwesomeRootPath(String path) Sets the root path for Font Awesome resources.static voidsetKitCode(String code) Sets the Font Awesome Kit code for Pro features.static voidsetVersion(String version) Sets the Font Awesome version to use from CDN.
-
Method Details
-
setCdnBase
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
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
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
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
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
Gets the CDN base URL.- Returns:
- CDN base URL.
-
getVersion
Gets the Font Awesome version used for CDN.- Returns:
- Font Awesome version string.
-
getFontAwesomeRootPath
Gets the root path for Font Awesome resources.- Returns:
- Root path for Font Awesome files, or null if using CDN.
-
getCssFile
Gets the CSS file name relative to the root path.- Returns:
- CSS file name.
-
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.
-