com.vaadin.flow.server.frontend.
Class 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
(elemental.json.JsonObject themeJson) getThemeAnnotation
(VaadinContext context) Gets the theme annotation for the project.
static String
getThemeFilePath
(String themeName, String fileName) static File
getThemeFolder
(File frontendFolder, String themeName) Finds the folder for the given theme.
static Optional<elemental.json.JsonObject>
getThemeJson
(String themeName, AbstractConfiguration config) static Optional<elemental.json.JsonObject>
getThemeJson
(String themeName, File frontendFolder) getThemeName
(VaadinContext context) Gets the custom theme name if the custom theme is used in the project.
static URL
getThemeResourceFromPrecompiledProductionBundle
(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 contextReturns:
custom theme name or empty optional if no theme is used
-
getThemeAnnotation
Gets the theme annotation for the project.
Parameters:
context
- the Vaadin contextReturns:
the theme annotation or an empty optional
-
getThemeJson
public static Optional<elemental.json.JsonObject> 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,
null
otherwise -
getThemeJson
-
getParentThemeName
-
getActiveThemes
Gets the active themes in parent to child order, starting from the application theme.
Parameters:
context
- the vaadin contextReturns:
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 nameReturns:
the folder for the theme, containing styles.css
Throws:
IllegalArgumentException
- if the theme folder was not found -
getThemeFilePath
-