Interface IThemeEngine


public interface IThemeEngine
The theme engine collects available themes (who are composed of stylesheets) and provides the possibility to change the theme
  • Field Details

  • Method Details

    • registerTheme

      ITheme registerTheme(String id, String label, String basestylesheetURI) throws IllegalArgumentException
      Register a theme
      Parameters:
      id - the id of the theme
      label - the label
      basestylesheetURI - the base stylesheet uri
      Returns:
      the theme instance registered
      Throws:
      IllegalArgumentException - if a theme with this id is already registered
    • registerStylesheet

      void registerStylesheet(String uri, String... themes)
      Register a stylesheet
      Parameters:
      uri - the stylsheet uri
      themes - the theme ids the stylesheet is added to or empty if should be added to all
    • registerResourceLocator

      void registerResourceLocator(IResourceLocator locator, String... themes)
      Register a resource locator used to look up image sources
      Parameters:
      locator - the locator
      themes - the theme ids the locator is registered for or empty if should be added to all
    • getThemes

      List<ITheme> getThemes()
      Returns:
      Unmodifiable list of themes
    • setTheme

      void setTheme(String themeId, boolean restore)
      Set a theme by its id and restore it for the next time the engine is initialized (restore(String))
      Parameters:
      themeId - the theme id
      restore - restore the theme set for the next time restore(String)
    • setTheme

      void setTheme(ITheme theme, boolean restore)
      Set a theme and restore it for the next time the engine is initialized ( restore(String))
      Parameters:
      theme - the theme
      restore - restore the theme set for the next time restore(String)
    • applyStyles

      void applyStyles(Object widget, boolean applyStylesToChildNodes)
      Force reapplying the style to the widget and its children
      Parameters:
      widget - the widget
      applyStylesToChildNodes - if the children should be updated as well
    • getStyle

      CSSStyleDeclaration getStyle(Object widget)
      Get the style currently active for a widget
      Parameters:
      widget - the widget
      Returns:
      the declaration or null
    • restore

      void restore(String alternate)
      Restore the previously stored theme
      Parameters:
      alternate - the alternate theme if the restored one is not found
    • getActiveTheme

      ITheme getActiveTheme()
      Returns:
      the current active theme or null if no active theme
    • addCSSEngine

      void addCSSEngine(CSSEngine cssswtEngine)
    • removeCSSEngine

      void removeCSSEngine(CSSEngine cssswtEngine)