Interface AbstractTheme

All Superinterfaces:
Serializable
All Known Implementing Classes:
Lumo, Material

public interface AbstractTheme extends Serializable
Abstract theme definition class for defining theme variables when in use.
Since:
1.0
Author:
Vaadin Ltd
  • Method Details

    • getBaseUrl

      String getBaseUrl()
      The url for the base component implementation.

      e.g. src/

      Returns:
      the base component path
    • getThemeUrl

      String getThemeUrl()
      The url for the components themed version implementation.

      e.g. theme/lumo/

      Returns:
      the themed component path
    • getHeaderInlineContents

      default List<String> getHeaderInlineContents()
      Return a list of contents to inline to the bootstrap header. The contents will be handled as no-wrap as is and will be inserted to the initial page head tag.

      This will usually be the any <custom-style> declarations, see CustomStyle

      For importing theme files, use JsModule on the corresponding theme subclass.

      Returns:
      list of string content to inline or empty list if nothing to inline
    • getHtmlAttributes

      default Map<String,String> getHtmlAttributes(String variant)
      Gets the attributes that should be set on the <html> element when the Theme variant is applied.
      Parameters:
      variant - the variant defined in the Theme annotation, not null
      Returns:
      a Map with the attributes (keys and values) that should be set in the body, or an empty Map if nothing should be set for the given variant.
    • translateUrl

      default String translateUrl(String url)
      Translates the given url using the result of the getThemeUrl() theme method.

      If translation is possible then translated URL is returned. Otherwise the url is returned.

      Parameters:
      url - the URL to translate using the theme
      Returns:
      translated URL if possible or the same given url if not.