Package com.vaadin.flow.server.frontend
Class ThemeUtils
java.lang.Object
com.vaadin.flow.server.frontend.ThemeUtils
Helpers related to theme handling.
For internal use only. May be renamed or removed in a future release.
-
Method Summary
Modifier and TypeMethodDescriptiongetActiveThemes(VaadinContext context) Gets the active themes in parent to child order, starting from the application theme.getParentThemeName(tools.jackson.databind.JsonNode themeJson) getThemeAnnotation(VaadinContext context) Gets the theme annotation for the project.static StringgetThemeFilePath(String themeName, String fileName) static FilegetThemeFolder(File frontendFolder, String themeName) Finds the folder for the given theme.static Optional<tools.jackson.databind.JsonNode> getThemeJson(String themeName, AbstractConfiguration config) static Optional<tools.jackson.databind.JsonNode> getThemeJson(String themeName, File frontendFolder) getThemeName(VaadinContext context) Gets the custom theme name if the custom theme is used in the project.static URLgetThemeResourceFromPrecompiledProductionBundle(String themeAssetPath) Gets the URL of the theme resource located in the pre-compiled production bundle JAR or in the external packaged theme JAR.
-
Method Details
-
getThemeName
Gets the custom theme name if the custom theme is used in the project.Should be only used in the development mode.
- Parameters:
context- the vaadin context- Returns:
- custom theme name or empty optional if no theme is used
-
getThemeAnnotation
Gets the theme annotation for the project.- Parameters:
context- the Vaadin context- Returns:
- the theme annotation or an empty optional
-
getThemeJson
public static Optional<tools.jackson.databind.JsonNode> getThemeJson(String themeName, AbstractConfiguration config) -
getThemeResourceFromPrecompiledProductionBundle
Gets the URL of the theme resource located in the pre-compiled production bundle JAR or in the external packaged theme JAR.- Parameters:
themeAssetPath- theme resource path relative to 'themes' folder, e.g. 'my-theme/styles.css'- Returns:
- URL to theme resource if the resource was found,
nullotherwise
-
getThemeJson
-
getParentThemeName
-
getActiveThemes
Gets the active themes in parent to child order, starting from the application theme.- Parameters:
context- the vaadin context- Returns:
- a list of active themes, in parent to child order
-
getThemeFolder
public static File getThemeFolder(File frontendFolder, String themeName) throws IllegalArgumentException Finds the folder for the given theme.Assumes the folder exists and throws an exception if it does not.
- Parameters:
frontendFolder- the project frontend folderthemeName- the theme name- Returns:
- the folder for the theme, containing styles.css
- Throws:
IllegalArgumentException- if the theme folder was not found
-
getThemeFilePath
-