Class Theme

    • Method Detail

      • baseThemeOf

        public static Theme baseThemeOf​(Theme theme)
      • withDisplayName

        public Theme withDisplayName​(String newName)
        Create a derived theme with the given display name.
        Parameters:
        newName - the new display name.
        Returns:
        the derived theme.
      • copy

        public Theme copy()
        Creates a copy of this theme. This is not equivalent to Object.clone() in the sense that clone().getClass() == this.getClass() and copy().getClass() != this.getClass(). Nonetheless the copy theme behaves exactly the same as the original.
        Returns:
        a copy of the theme.
      • isDark

        public static boolean isDark​(Theme theme)
        Returns whether the theme is a dark theme. This is used to determine the default mode for [aware] icons.
        Parameters:
        theme - the theme.
        Returns:
        true if dark.
      • isHighContrast

        public static boolean isHighContrast​(Theme theme)
        Returns whether the theme is a high contrast theme.
        Parameters:
        theme - the theme.
        Returns:
        true if the theme is a high contrast theme.
      • loadDefaults

        public void loadDefaults​(Properties properties,
                                 UIDefaults currentDefaults)
        Load the theme defaults.

        Note: When overwriting a theme you also have overwrite getLoaderClass() to return the class of the theme you are overwriting. In this case you should use loadWithClass(String, Class) instead of load(String).

        Parameters:
        properties - the properties to load the values into.
        currentDefaults - the current ui defaults.
      • customizeGlobals

        public void customizeGlobals​(Properties properties,
                                     UIDefaults currentDefaults)
        Customize the global values.

        Note: When overwriting a theme you also have overwrite getLoaderClass() to return the class of the theme you are overwriting. In this case you should use loadWithClass(String, Class) instead of load(String).

        Parameters:
        properties - the properties to load the values into.
        currentDefaults - the current ui defaults.
      • customizeIconTheme

        public void customizeIconTheme​(Properties properties,
                                       UIDefaults currentDefaults)
        Customize the icon defaults.

        Note: When overwriting a theme you also have overwrite getLoaderClass() to return the class of the theme you are overwriting. In this case you should use loadWithClass(String, Class) instead of load(String).

        Parameters:
        properties - the properties to load the value into.
        currentDefaults - the current ui defaults.
      • loadIconTheme

        public void loadIconTheme​(Properties properties,
                                  UIDefaults currentDefaults)
        Load the general properties file for the icon themes.

        Note: When overwriting a theme you also have overwrite getLoaderClass() to return the class of the theme you are overwriting. In this case you should use loadWithClass(String, Class) instead of load(String).

        Parameters:
        properties - the properties to load the value into.
        currentDefaults - the current ui defaults.
      • customizePlatformProperties

        public void customizePlatformProperties​(Properties properties,
                                                UIDefaults currentDefaults)
        Customize the platform defaults.

        Note: When overwriting a theme you should use loadWithClass(String, Class) instead of load(String).

        Parameters:
        properties - the properties to load the values into.
        currentDefaults - the current ui defaults.
      • customizeUIProperties

        public void customizeUIProperties​(Properties properties,
                                          UIDefaults currentDefaults)
        Customize the ui defaults.

        Note: When overwriting a theme you should use loadWithClass(String, Class) instead of load(String).

        Parameters:
        properties - the properties to load the values into.
        currentDefaults - the current ui defaults.
      • getPresetIconRule

        protected abstract PresetIconRule getPresetIconRule()
        The preset icon theme.
        Returns:
        the icon theme.
      • loadCustomProperties

        protected final void loadCustomProperties​(String propertySuffix,
                                                  Properties properties,
                                                  UIDefaults currentDefaults)
        Load custom properties that are located under getResourcePath(), with the name getPrefix()_{propertySuffix}.properties

        Note: When overwriting a theme you should use loadWithClass(String, Class) instead of load(String).

        Parameters:
        propertySuffix - the property suffix.
        properties - the properties to load into.
        currentDefaults - the current ui defaults.
      • loadAccentProperties

        public Properties loadAccentProperties()
        Load the properties specifying how to map the colors from the AccentColorRule are mapped to the properties.
        Returns:
        the properties providing the mapping rules.
      • loadWithClass

        protected final Properties loadWithClass​(String name,
                                                 Class<?> loaderClass)
        Load a .properties file.
        Parameters:
        name - the properties file to load.
        loaderClass - the class to resolve the file location from.
        Returns:
        the properties.
      • loadStyleSheet

        public StyleSheet loadStyleSheet()
        Load the css style sheet used for html display in text components with a HTMLEditorKit.
        Returns:
        the StyleSheet.
      • getResourcePath

        protected String getResourcePath()
        The path to the resource location relative to the classpath of getLoaderClass().
        Returns:
        the relative resource path
      • getPrefix

        public abstract String getPrefix()
        Get the prefix for resource loading.
        Returns:
        the prefix for loading resources.
      • getName

        public abstract String getName()
        Get the name of this theme.
        Returns:
        the name of the theme.
      • getDisplayName

        public String getDisplayName()
        Get the display name of this theme.
        Returns:
        the display name of the theme.
      • getLoaderClass

        protected abstract Class<? extends Theme> getLoaderClass()
        The class used to determine the runtime location of resources. It is advised to explicitly return the class instead of using Object.getClass() to protect against extending the theme.
        Returns:
        the loader class.
      • getPropertyFilePath

        protected String getPropertyFilePath​(String name)
        Get the path for the file [prefix]_[name].properties in the themes resource location.
        Parameters:
        name - the of the file.
        Returns:
        the path relative to the location of getLoaderClass().
      • loadPropertyFile

        public final Properties loadPropertyFile​(String name)
        Load the theme property file with the specified name. The name gets resolved to the resource location of the theme adds the theme property prefix and appends ".properties" e.g. "test" -> [resource_location]/[prefix_of_theme]_test.properties.
        Parameters:
        name - the properties name.
        Returns:
        the properties.
      • loadPropertyFile

        public final Properties loadPropertyFile​(String name,
                                                 boolean silent)
        Load the theme property file with the specified name. The name gets resolved to the resource location of the theme adds the theme property prefix and appends ".properties" e.g. "test" -> [resource_location]/[prefix_of_theme]_test.properties.
        Parameters:
        name - the properties name.
        silent - if true no warnings are issues if the file is not present. Instead, an empty property instance is returned.
        Returns:
        the properties.
      • useCustomDecorations

        public boolean useCustomDecorations()
        Returns whether this theme should use custom decorations if available.
        Returns:
        true if decoration should be used.
      • supportsCustomAccentColor

        public boolean supportsCustomAccentColor()
        Returns whether this theme supports custom accent colors.
        Returns:
        true if supported.
      • supportsCustomSelectionColor

        public boolean supportsCustomSelectionColor()
        Returns whether this theme supports custom selection colors.
        Returns:
        true if supported.
      • getColorToneRule

        public abstract ColorToneRule getColorToneRule()
        Returns the style rule for this theme.
        Returns:
        the style rule.
      • getContrastRule

        public ContrastRule getContrastRule()
        Returns contrast rule for the theme.
        Returns:
        the contrast rule.
      • getFontSizeRule

        public FontSizeRule getFontSizeRule()
        Get the font size rule for this theme.
        Returns:
        the font size rule.
      • getAccentColorRule

        public AccentColorRule getAccentColorRule()
        Get the accent color rule.
        Returns:
        the accent color rule.
      • getThemeClass

        public Class<? extends Theme> getThemeClass()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • appearsEqualTo

        public boolean appearsEqualTo​(Theme theme)
        Returns whether the appearance of the given theme is equal to the appearance if [this].
        Parameters:
        theme - the other theme.
        Returns:
        true if they appear equal.