Package generic.theme
Class StubThemeManager
java.lang.Object
generic.theme.ThemeManager
generic.theme.StubThemeManager
Version of ThemeManager that is used before an application or test installs a full
ApplicationThemeManager. Provides enough basic functionality used by the Gui class to
allow simple unit tests to run.
-
Field Summary
Fields inherited from class generic.theme.ThemeManager
activeLafType, activeTheme, applicationDefaults, currentValues, INSTANCE, javaDefaults, THEME_DIR, useDarkDefaults
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the given theme to set of all themes.void
deleteTheme
(GTheme theme) Removes the theme from the set of all themes.protected void
Returns the active theme.Returns a set of all known themes.Returns theGThemeValueMap
containing all the dark default values defined in theme.properties files.Returns theGThemeValueMap
containing all the standard default values defined in theme.properties files.Returns aGThemeValueMap
containing all default values for the current theme.Returns theGThemeValueMap
containing all the default theme values defined by the currentLookAndFeel
.Returns theLafType
for the currently activeLookAndFeel
Returns a set of all known themes that are supported on the current platform.Returns the known theme that has the given name.Returns the theme values as defined by the current theme, ignoring any unsaved changes that are currently applied to the application.boolean
Returns true if there are any unsaved changes to the current theme.protected void
boolean
isChangedColor
(String id) Returns true if the color associated with the given id has been changed from the current theme value for that id.boolean
isChangedFont
(String id) Returns true if the font associated with the given id has been changed from the current theme value for that id.boolean
isChangedIcon
(String id) Returns true if the Icon associated with the given id has been changed from the current theme value for that id.boolean
Returns true if the current theme use dark default values.boolean
Returns true if the given UI object is using the Aqua Look and Feel.boolean
Returns true if 'Nimbus' is the current Look and Feelprotected ApplicationThemeDefaults
void
registerFont
(Component component, String fontId) Binds the component to the font identified by the given font id.void
restoreColor
(String id) Restores the current color value for the given color id to the value established by the current theme.void
restoreFont
(String id) Restores the current font value for the given font id to the value established by the current theme.void
restoreIcon
(String id) Restores the current icon value for the given icon id to the value established by the current theme.void
Restores all the current application back to the values as specified by the active theme.void
setColor
(ColorValue newValue) Updates the current value for the color id in the newValuevoid
Updates the current value for the font id in the newValuevoid
Updates the current value for theIcon
id in the newValuevoid
Sets the application's active theme to the given theme.Methods inherited from class generic.theme.ThemeManager
addThemeListener, adjustFonts, buildCurrentValues, getColor, getCurrentValues, getDefaultTheme, getFont, getIcon, getInstance, getNonDefaultValues, hasColor, hasFont, hasIcon, hasThemeValueChanges, installInGui, isBlinkingCursors, isUpdatingTheme, notifyThemeChanged, registerFont, removeThemeListener, setBlinkingCursors, setColor, setFont, setIcon, setLookAndFeel, unRegisterFont, update
-
Constructor Details
-
StubThemeManager
public StubThemeManager()
-
-
Method Details
-
installPaletteColors
protected void installPaletteColors() -
restoreThemeValues
public void restoreThemeValues()Description copied from class:ThemeManager
Restores all the current application back to the values as specified by the active theme. In other words, reverts any changes to the active theme that haven't been saved.- Overrides:
restoreThemeValues
in classThemeManager
-
restoreColor
Description copied from class:ThemeManager
Restores the current color value for the given color id to the value established by the current theme.- Overrides:
restoreColor
in classThemeManager
- Parameters:
id
- the color id to restore back to the original theme value
-
restoreFont
Description copied from class:ThemeManager
Restores the current font value for the given font id to the value established by the current theme.- Overrides:
restoreFont
in classThemeManager
- Parameters:
id
- the font id to restore back to the original theme value
-
restoreIcon
Description copied from class:ThemeManager
Restores the current icon value for the given icon id to the value established by the current theme.- Overrides:
restoreIcon
in classThemeManager
- Parameters:
id
- the icon id to restore back to the original theme value
-
isChangedColor
Description copied from class:ThemeManager
Returns true if the color associated with the given id has been changed from the current theme value for that id.- Overrides:
isChangedColor
in classThemeManager
- Parameters:
id
- the color id to check if it has been changed- Returns:
- true if the color associated with the given id has been changed from the current theme value for that id.
-
isChangedFont
Description copied from class:ThemeManager
Returns true if the font associated with the given id has been changed from the current theme value for that id.- Overrides:
isChangedFont
in classThemeManager
- Parameters:
id
- the font id to check if it has been changed- Returns:
- true if the font associated with the given id has been changed from the current theme value for that id.
-
isChangedIcon
Description copied from class:ThemeManager
Returns true if the Icon associated with the given id has been changed from the current theme value for that id.- Overrides:
isChangedIcon
in classThemeManager
- Parameters:
id
- the Icon id to check if it has been changed- Returns:
- true if the Icon associated with the given id has been changed from the current theme value for that id.
-
setTheme
Description copied from class:ThemeManager
Sets the application's active theme to the given theme.- Overrides:
setTheme
in classThemeManager
- Parameters:
theme
- the theme to make active
-
addTheme
Description copied from class:ThemeManager
Adds the given theme to set of all themes.- Overrides:
addTheme
in classThemeManager
- Parameters:
newTheme
- the theme to add
-
deleteTheme
Description copied from class:ThemeManager
Removes the theme from the set of all themes. Also, if the theme has an associated file, the file will be deleted.- Overrides:
deleteTheme
in classThemeManager
- Parameters:
theme
- the theme to delete
-
getAllThemes
Description copied from class:ThemeManager
Returns a set of all known themes.- Overrides:
getAllThemes
in classThemeManager
- Returns:
- a set of all known themes.
-
getSupportedThemes
Description copied from class:ThemeManager
Returns a set of all known themes that are supported on the current platform.- Overrides:
getSupportedThemes
in classThemeManager
- Returns:
- a set of all known themes that are supported on the current platform.
-
getActiveTheme
Description copied from class:ThemeManager
Returns the active theme.- Overrides:
getActiveTheme
in classThemeManager
- Returns:
- the active theme.
-
getLookAndFeelType
Description copied from class:ThemeManager
Returns theLafType
for the currently activeLookAndFeel
- Overrides:
getLookAndFeelType
in classThemeManager
- Returns:
- the
LafType
for the currently activeLookAndFeel
-
getTheme
Description copied from class:ThemeManager
Returns the known theme that has the given name.- Overrides:
getTheme
in classThemeManager
- Parameters:
themeName
- the name of the theme to retrieve- Returns:
- the known theme that has the given name
-
getThemeValues
Description copied from class:ThemeManager
Returns the theme values as defined by the current theme, ignoring any unsaved changes that are currently applied to the application.- Overrides:
getThemeValues
in classThemeManager
- Returns:
- the theme values as defined by the current theme, ignoring any unsaved changes that are currently applied to the application
-
setFont
Description copied from class:ThemeManager
Updates the current value for the font id in the newValue- Overrides:
setFont
in classThemeManager
- Parameters:
newValue
- the newFontValue
to install in the current values.
-
setColor
Description copied from class:ThemeManager
Updates the current value for the color id in the newValue- Overrides:
setColor
in classThemeManager
- Parameters:
newValue
- the newColorValue
to install in the current values.
-
setIcon
Description copied from class:ThemeManager
Updates the current value for theIcon
id in the newValue- Overrides:
setIcon
in classThemeManager
- Parameters:
newValue
- the newIconValue
to install in the current values.
-
getJavaDefaults
Description copied from class:ThemeManager
Returns theGThemeValueMap
containing all the default theme values defined by the currentLookAndFeel
.- Overrides:
getJavaDefaults
in classThemeManager
- Returns:
- the
GThemeValueMap
containing all the default theme values defined by the currentLookAndFeel
-
getApplicationDarkDefaults
Description copied from class:ThemeManager
Returns theGThemeValueMap
containing all the dark default values defined in theme.properties files. Note that dark defaults includes light defaults that haven't been overridden by a dark default with the same id.- Overrides:
getApplicationDarkDefaults
in classThemeManager
- Returns:
- the
GThemeValueMap
containing all the dark values defined in theme.properties files
-
getApplicationLightDefaults
Description copied from class:ThemeManager
Returns theGThemeValueMap
containing all the standard default values defined in theme.properties files.- Overrides:
getApplicationLightDefaults
in classThemeManager
- Returns:
- the
GThemeValueMap
containing all the standard values defined in theme.properties files
-
getDefaults
Description copied from class:ThemeManager
Returns aGThemeValueMap
containing all default values for the current theme. It is a combination of application defined defaults and javaLookAndFeel
defaults.- Overrides:
getDefaults
in classThemeManager
- Returns:
- the current set of defaults.
-
isUsingAquaUI
Description copied from class:ThemeManager
Returns true if the given UI object is using the Aqua Look and Feel.- Overrides:
isUsingAquaUI
in classThemeManager
- Parameters:
UI
- the UI to examine.- Returns:
- true if the UI is using Aqua
-
isUsingNimbusUI
public boolean isUsingNimbusUI()Description copied from class:ThemeManager
Returns true if 'Nimbus' is the current Look and Feel- Overrides:
isUsingNimbusUI
in classThemeManager
- Returns:
- true if 'Nimbus' is the current Look and Feel
-
hasThemeChanges
public boolean hasThemeChanges()Description copied from class:ThemeManager
Returns true if there are any unsaved changes to the current theme.- Overrides:
hasThemeChanges
in classThemeManager
- Returns:
- true if there are any unsaved changes to the current theme.
-
registerFont
Description copied from class:ThemeManager
Binds the component to the font identified by the given font id. Whenever the font for the font id changes, the component will updated with the new font.- Overrides:
registerFont
in classThemeManager
- Parameters:
component
- the component to set/update the fontfontId
- the id of the font to register with the given component
-
isDarkTheme
public boolean isDarkTheme()Description copied from class:ThemeManager
Returns true if the current theme use dark default values.- Overrides:
isDarkTheme
in classThemeManager
- Returns:
- true if the current theme use dark default values.
-
error
- Overrides:
error
in classThemeManager
-
loadApplicationDefaults
- Overrides:
loadApplicationDefaults
in classThemeManager
-