Class ThemeDelegate
- java.lang.Object
-
- com.github.weisj.darklaf.theme.Theme
-
- com.github.weisj.darklaf.theme.ThemeDelegate
-
- All Implemented Interfaces:
Serializable,Comparable<Theme>,Comparator<Theme>
- Direct Known Subclasses:
RenamedTheme
public class ThemeDelegate extends Theme
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ThemeDelegate(Theme delegate)ThemeDelegate(Theme delegate, FontSizeRule fontSizeRule, AccentColorRule accentColorRule)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanappearsEqualTo(Theme theme)Returns whether the appearance of the given theme is equal to the appearance if [this].Themecopy()Creates a copy of this theme.voidcustomizeGlobals(Properties properties, UIDefaults currentDefaults)Customize the global values.voidcustomizeIconTheme(Properties properties, UIDefaults currentDefaults)Customize the icon defaults.voidcustomizePlatformProperties(Properties properties, UIDefaults currentDefaults)Customize the platform defaults.voidcustomizeUIProperties(Properties properties, UIDefaults currentDefaults)Customize the ui defaults.Themederive(FontSizeRule fontSizeRule, AccentColorRule accentColorRule)Create a derived theme with the givenFontSizeRuleandAccentColorRule.AccentColorRulegetAccentColorRule()Get the accent color rule.ColorToneRulegetColorToneRule()Returns the style rule for this theme.ContrastRulegetContrastRule()Returns contrast rule for the theme.ThemegetDelegate()StringgetDisplayName()Get the display name of this theme.FontSizeRulegetFontSizeRule()Get the font size rule for this theme.protected Class<? extends Theme>getLoaderClass()The class used to determine the runtime location of resources.StringgetName()Get the name of this theme.StringgetPrefix()Get the prefix for resource loading.protected PresetIconRulegetPresetIconRule()The preset icon theme.protected StringgetPropertyFilePath(String name)Get the path for the file [prefix]_[name].properties in the themes resource location.protected StringgetResourcePath()The path to the resource location relative to the classpath ofTheme.getLoaderClass().Class<? extends Theme>getThemeClass()voidloadDefaults(Properties properties, UIDefaults currentDefaults)Load the theme defaults.voidloadIconTheme(Properties properties, UIDefaults currentDefaults)Load the general properties file for the icon themes.booleansupportsCustomAccentColor()Returns whether this theme supports custom accent colors.booleansupportsCustomSelectionColor()Returns whether this theme supports custom selection colors.booleanuseCustomDecorations()Returns whether this theme should use custom decorations if available.-
Methods inherited from class com.github.weisj.darklaf.theme.Theme
baseThemeOf, compare, compareTo, equals, hashCode, isDark, isHighContrast, load, loadAccentProperties, loadCustomProperties, loadPropertyFile, loadPropertyFile, loadStyleSheet, loadWithClass, toString, withDisplayName
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Constructor Detail
-
ThemeDelegate
public ThemeDelegate(Theme delegate)
-
ThemeDelegate
public ThemeDelegate(Theme delegate, FontSizeRule fontSizeRule, AccentColorRule accentColorRule)
-
-
Method Detail
-
getDelegate
public Theme getDelegate()
-
getThemeClass
public Class<? extends Theme> getThemeClass()
- Overrides:
getThemeClassin classTheme
-
appearsEqualTo
public boolean appearsEqualTo(Theme theme)
Description copied from class:ThemeReturns whether the appearance of the given theme is equal to the appearance if [this].- Overrides:
appearsEqualToin classTheme- Parameters:
theme- the other theme.- Returns:
- true if they appear equal.
-
derive
public Theme derive(FontSizeRule fontSizeRule, AccentColorRule accentColorRule)
Description copied from class:ThemeCreate a derived theme with the givenFontSizeRuleandAccentColorRule.
-
copy
public Theme copy()
Description copied from class:ThemeCreates a copy of this theme. This is not equivalent toObject.clone()in the sense thatclone().getClass() == this.getClass()andcopy().getClass() != this.getClass(). Nonetheless the copy theme behaves exactly the same as the original.
-
getFontSizeRule
public FontSizeRule getFontSizeRule()
Description copied from class:ThemeGet the font size rule for this theme.- Overrides:
getFontSizeRulein classTheme- Returns:
- the font size rule.
-
getAccentColorRule
public AccentColorRule getAccentColorRule()
Description copied from class:ThemeGet the accent color rule.- Overrides:
getAccentColorRulein classTheme- Returns:
- the accent color rule.
-
getColorToneRule
public ColorToneRule getColorToneRule()
Description copied from class:ThemeReturns the style rule for this theme.- Specified by:
getColorToneRulein classTheme- Returns:
- the style rule.
-
getContrastRule
public ContrastRule getContrastRule()
Description copied from class:ThemeReturns contrast rule for the theme.- Overrides:
getContrastRulein classTheme- Returns:
- the contrast rule.
-
getPresetIconRule
protected PresetIconRule getPresetIconRule()
Description copied from class:ThemeThe preset icon theme.- Specified by:
getPresetIconRulein classTheme- Returns:
- the icon theme.
-
loadDefaults
public void loadDefaults(Properties properties, UIDefaults currentDefaults)
Description copied from class:ThemeLoad the theme defaults.Note: When overwriting a theme you also have overwrite
Theme.getLoaderClass()to return the class of the theme you are overwriting. In this case you should useTheme.loadWithClass(String, Class)instead ofTheme.load(String).- Overrides:
loadDefaultsin classTheme- Parameters:
properties- the properties to load the values into.currentDefaults- the current ui defaults.
-
customizeGlobals
public void customizeGlobals(Properties properties, UIDefaults currentDefaults)
Description copied from class:ThemeCustomize the global values.Note: When overwriting a theme you also have overwrite
Theme.getLoaderClass()to return the class of the theme you are overwriting. In this case you should useTheme.loadWithClass(String, Class)instead ofTheme.load(String).- Overrides:
customizeGlobalsin classTheme- Parameters:
properties- the properties to load the values into.currentDefaults- the current ui defaults.
-
customizeIconTheme
public void customizeIconTheme(Properties properties, UIDefaults currentDefaults)
Description copied from class:ThemeCustomize the icon defaults.Note: When overwriting a theme you also have overwrite
Theme.getLoaderClass()to return the class of the theme you are overwriting. In this case you should useTheme.loadWithClass(String, Class)instead ofTheme.load(String).- Overrides:
customizeIconThemein classTheme- Parameters:
properties- the properties to load the value into.currentDefaults- the current ui defaults.
-
loadIconTheme
public void loadIconTheme(Properties properties, UIDefaults currentDefaults)
Description copied from class:ThemeLoad the general properties file for the icon themes.Note: When overwriting a theme you also have overwrite
Theme.getLoaderClass()to return the class of the theme you are overwriting. In this case you should useTheme.loadWithClass(String, Class)instead ofTheme.load(String).- Overrides:
loadIconThemein classTheme- Parameters:
properties- the properties to load the value into.currentDefaults- the current ui defaults.
-
customizePlatformProperties
public void customizePlatformProperties(Properties properties, UIDefaults currentDefaults)
Description copied from class:ThemeCustomize the platform defaults.Note: When overwriting a theme you should use
Theme.loadWithClass(String, Class)instead ofTheme.load(String).- Overrides:
customizePlatformPropertiesin classTheme- Parameters:
properties- the properties to load the values into.currentDefaults- the current ui defaults.
-
customizeUIProperties
public void customizeUIProperties(Properties properties, UIDefaults currentDefaults)
Description copied from class:ThemeCustomize the ui defaults.Note: When overwriting a theme you should use
Theme.loadWithClass(String, Class)instead ofTheme.load(String).- Overrides:
customizeUIPropertiesin classTheme- Parameters:
properties- the properties to load the values into.currentDefaults- the current ui defaults.
-
getResourcePath
protected String getResourcePath()
Description copied from class:ThemeThe path to the resource location relative to the classpath ofTheme.getLoaderClass().- Overrides:
getResourcePathin classTheme- Returns:
- the relative resource path
-
getPrefix
public String getPrefix()
Description copied from class:ThemeGet the prefix for resource loading.
-
getDisplayName
public String getDisplayName()
Description copied from class:ThemeGet the display name of this theme.- Overrides:
getDisplayNamein classTheme- Returns:
- the display name of the theme.
-
getLoaderClass
protected Class<? extends Theme> getLoaderClass()
Description copied from class:ThemeThe class used to determine the runtime location of resources. It is advised to explicitly return the class instead of usingObject.getClass()to protect against extending the theme.- Specified by:
getLoaderClassin classTheme- Returns:
- the loader class.
-
getPropertyFilePath
protected String getPropertyFilePath(String name)
Description copied from class:ThemeGet the path for the file [prefix]_[name].properties in the themes resource location.- Overrides:
getPropertyFilePathin classTheme- Parameters:
name- the of the file.- Returns:
- the path relative to the location of
Theme.getLoaderClass().
-
useCustomDecorations
public boolean useCustomDecorations()
Description copied from class:ThemeReturns whether this theme should use custom decorations if available.- Overrides:
useCustomDecorationsin classTheme- Returns:
- true if decoration should be used.
-
supportsCustomSelectionColor
public boolean supportsCustomSelectionColor()
Description copied from class:ThemeReturns whether this theme supports custom selection colors.- Overrides:
supportsCustomSelectionColorin classTheme- Returns:
- true if supported.
-
supportsCustomAccentColor
public boolean supportsCustomAccentColor()
Description copied from class:ThemeReturns whether this theme supports custom accent colors.- Overrides:
supportsCustomAccentColorin classTheme- Returns:
- true if supported.
-
-