|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.mucommander.ui.theme.ThemeData
public class ThemeData
Base class for all things Theme.
The role of ThemeData is twofold:
- theme data storage.
- default values retrievals and notification.
In the current version, theme data is solely composed of assorted colors and fonts. ThemeData
offers methods to set, retrieve, compare
and clone these values.
One of its major constraints is that it can never return null values for the items it contains. Whenever a specific
value hasn't been set, ThemeData will seemlessly provide the rest of the world with default values retrieved from the current
look&feel.
This default values system means that theme items can change outside of anybody's control: Swing UI properties can be updated, the current
look&feel can be modified... ThemeData will track this changes and make sure that the proper event are dispatched
to listeners.
In theory, classes that use the theme API should not need to worry about default value modifications. This is already managed internally, and
if the change affects any of the themes being listened on, the event will be propagated to them. There might special cases where it's necessary,
however, for which ThemeData provides a listening mechanism.
Theme,
ThemeManager,
UIManager| Field Summary | |
|---|---|
static int |
ARCHIVE_FOREGROUND_COLOR
Color used to paint archives text in the folder panels. |
static int |
ARCHIVE_INACTIVE_FOREGROUND_COLOR
Color used to paint archives text in the folder panels when they don't have the focus. |
static int |
ARCHIVE_INACTIVE_SELECTED_FOREGROUND_COLOR
Color used to paint selected archives text in the folder panels when they don't have the focus. |
static int |
ARCHIVE_SELECTED_FOREGROUND_COLOR
Color used to paint selected archives text in the folder panels. |
static int |
COLOR_COUNT
Number of known colors. |
static int |
EDITOR_BACKGROUND_COLOR
Color used to paint the file editor / viewer's background. |
static int |
EDITOR_FONT
Font used in the file editor and viewer. |
static int |
EDITOR_FOREGROUND_COLOR
Color used to paint the file editor / viewer's text. |
static int |
EDITOR_SELECTED_BACKGROUND_COLOR
Color used to paint the file editor / viewer's background when selected. |
static int |
EDITOR_SELECTED_FOREGROUND_COLOR
Color used to paint the file editor / viewer's foreground when selected. |
static int |
FILE_FOREGROUND_COLOR
Color used to paint plain files text in the folder panels. |
static int |
FILE_INACTIVE_FOREGROUND_COLOR
Color used to paint plain files text in the folder panels when they don't have the focus. |
static int |
FILE_INACTIVE_SELECTED_FOREGROUND_COLOR
Color used to paint selected plain files text in the folder panels when they don't have the focus. |
static int |
FILE_SELECTED_FOREGROUND_COLOR
Color used to paint selected plain files text in the folder panels. |
static int |
FILE_TABLE_ALTERNATE_BACKGROUND_COLOR
Color used to paint the folder panel's alternate background color. |
static int |
FILE_TABLE_BACKGROUND_COLOR
Color used to paint the folder panel's background color. |
static int |
FILE_TABLE_BORDER_COLOR
Color used to paint the folder panels' borders. |
static int |
FILE_TABLE_FONT
Font used in the folder panels. |
static int |
FILE_TABLE_INACTIVE_ALTERNATE_BACKGROUND_COLOR
Color used to paint the folder panel's alternate background color when inactive. |
static int |
FILE_TABLE_INACTIVE_BACKGROUND_COLOR
Color used to paint the folder panel's background color when it doesn't have the focus. |
static int |
FILE_TABLE_INACTIVE_BORDER_COLOR
Color used to paint the folder panels' borders when it doesn't have the focus. |
static int |
FILE_TABLE_INACTIVE_SELECTED_BACKGROUND_COLOR
Colors used to pain the file table's background color when in an inactive selected row. |
static int |
FILE_TABLE_INACTIVE_SELECTED_OUTLINE_COLOR
Color used to paint the outline of selected files in an inactive table. |
static int |
FILE_TABLE_INACTIVE_SELECTED_SECONDARY_BACKGROUND_COLOR
Color used to paint the gradient of the file table's selection when inactive. |
static int |
FILE_TABLE_SELECTED_BACKGROUND_COLOR
Color used to paint the file table's background color when in a selected row. |
static int |
FILE_TABLE_SELECTED_OUTLINE_COLOR
Color used to paint the outline of selected files. |
static int |
FILE_TABLE_SELECTED_SECONDARY_BACKGROUND_COLOR
Color used to paint the gradient of the file table's selection. |
static int |
FILE_TABLE_UNMATCHED_BACKGROUND_COLOR
Color used to paint the file table's background color when it's part of an unmatched file. |
static int |
FILE_TABLE_UNMATCHED_FOREGROUND_COLOR
Color used to paint the file table's foreground color when it's part of an unmatched file. |
static int |
FOLDER_FOREGROUND_COLOR
Color used to paint folders text in the folder panels. |
static int |
FOLDER_INACTIVE_FOREGROUND_COLOR
Color used to paint folders text in the folder panels when they don't have the focus. |
static int |
FOLDER_INACTIVE_SELECTED_FOREGROUND_COLOR
Color used to paint selected folders text in the folder panels when they don't have the focus. |
static int |
FOLDER_SELECTED_FOREGROUND_COLOR
Color used to paint selected folders text in the folder panels. |
static int |
FONT_COUNT
Number of known fonts. |
static int |
HIDDEN_FILE_FOREGROUND_COLOR
Color used to paint hidden files text in the folder panels. |
static int |
HIDDEN_FILE_INACTIVE_FOREGROUND_COLOR
Color used to paint hidden files text in the folder panels when they don't have the focus. |
static int |
HIDDEN_FILE_INACTIVE_SELECTED_FOREGROUND_COLOR
Color used to paint selected hidden files text in the folder panels when they don't have the focus. |
static int |
HIDDEN_FILE_SELECTED_FOREGROUND_COLOR
Color used to paint selected hidden files text in the folder panels. |
static int |
LOCATION_BAR_BACKGROUND_COLOR
Color used to paint the location's bar background. |
static int |
LOCATION_BAR_FONT
Font used in the location bar. |
static int |
LOCATION_BAR_FOREGROUND_COLOR
Color used to paint the location's bar text. |
static int |
LOCATION_BAR_PROGRESS_COLOR
Color used to paint the location's bar background when used as a progress bar. |
static int |
LOCATION_BAR_SELECTED_BACKGROUND_COLOR
Color used to paint the location's bar background when selected. |
static int |
LOCATION_BAR_SELECTED_FOREGROUND_COLOR
Color used to paint the location's bar text when selected. |
static int |
MARKED_FOREGROUND_COLOR
Color used to paint marked files text in the folder panels. |
static int |
MARKED_INACTIVE_FOREGROUND_COLOR
Color used to paint marked files text in the folder panels when they don't have the focus. |
static int |
MARKED_INACTIVE_SELECTED_FOREGROUND_COLOR
Color used to paint selected marked files text in the folder panels when they don't have the focus. |
static int |
MARKED_SELECTED_FOREGROUND_COLOR
Color used to paint selected marked files text in the folder panels. |
static int |
QUICK_LIST_HEADER_BACKGROUND_COLOR
Color used to paint the main background of a quick list header. |
static int |
QUICK_LIST_HEADER_FONT
Font used in the quick list header. |
static int |
QUICK_LIST_HEADER_FOREGROUND_COLOR
Color used to paint the text of a quick list header. |
static int |
QUICK_LIST_HEADER_SECONDARY_BACKGROUND_COLOR
Color used to paint the secondary background of a quick list header. |
static int |
QUICK_LIST_ITEM_BACKGROUND_COLOR
Color used to paint the background of a quick list item. |
static int |
QUICK_LIST_ITEM_FONT
Font used in the quick list item. |
static int |
QUICK_LIST_ITEM_FOREGROUND_COLOR
Color used to paint the text of a quick list item. |
static int |
QUICK_LIST_SELECTED_ITEM_BACKGROUND_COLOR
Color used to paint the background of a selected quick list item. |
static int |
QUICK_LIST_SELECTED_ITEM_FOREGROUND_COLOR
Color used to paint the text of a selected quick list item. |
static int |
SHELL_BACKGROUND_COLOR
Color used to paint the background of shell commands output. |
static int |
SHELL_FONT
Font used to display shell output. |
static int |
SHELL_FOREGROUND_COLOR
Color used to paint shell commands output. |
static int |
SHELL_HISTORY_BACKGROUND_COLOR
Color used to paint the shell history's background. |
static int |
SHELL_HISTORY_FONT
Font used in the shell history widget. |
static int |
SHELL_HISTORY_FOREGROUND_COLOR
Color used to paint the shell history's text. |
static int |
SHELL_HISTORY_SELECTED_BACKGROUND_COLOR
Color used to paint the shell history's background when selected. |
static int |
SHELL_HISTORY_SELECTED_FOREGROUND_COLOR
Color used to paint the shell history's text when selected. |
static int |
SHELL_SELECTED_BACKGROUND_COLOR
Color used to paint the background of shell commands output when selected. |
static int |
SHELL_SELECTED_FOREGROUND_COLOR
Color used to paint shell commands output when selected. |
static int |
STATUS_BAR_BACKGROUND_COLOR
Color used to paint the status bar's background |
static int |
STATUS_BAR_BORDER_COLOR
Color used to paint the status bar's border. |
static int |
STATUS_BAR_CRITICAL_COLOR
Color used to paint the status bar's drive usage color when there's dangerously little space left. |
static int |
STATUS_BAR_FONT
Font used in the status bar. |
static int |
STATUS_BAR_FOREGROUND_COLOR
Color used to paint the status bar's text. |
static int |
STATUS_BAR_OK_COLOR
Color used to paint the status bar's drive usage color when there's plenty of space left. |
static int |
STATUS_BAR_WARNING_COLOR
Color used to paint the status bar's drive usage color when there's an average amount of space left. |
static int |
SYMLINK_FOREGROUND_COLOR
Color used to paint symlinks text in the folder panels. |
static int |
SYMLINK_INACTIVE_FOREGROUND_COLOR
Color used to paint symlinks text in the folder panels when they don't have the focus. |
static int |
SYMLINK_INACTIVE_SELECTED_FOREGROUND_COLOR
Color used to paint selected symlinks text in the folder panels when they don't have the focus. |
static int |
SYMLINK_SELECTED_FOREGROUND_COLOR
Color used to paint selected symlinks text in the folder panels. |
| Constructor Summary | |
|---|---|
ThemeData()
Creates an empty set of theme data. |
|
| Method Summary | |
|---|---|
static void |
addDefaultValuesListener(ThemeListener listener)
Registers the specified theme listener. |
ThemeData |
cloneData()
Clones the theme data without freezing default values. |
ThemeData |
cloneData(boolean freezeDefaults)
Clones the current theme data. |
java.awt.Color |
getColor(int id)
Returns the requested color. |
static java.awt.Font |
getDefaultFont(int id)
Returns the default value for the specified font. |
java.awt.Font |
getFont(int id)
Returns the requested font. |
void |
importData(ThemeData data)
Imports the specified data in the current one. |
boolean |
isColorDifferent(int id,
java.awt.Color color)
Checks whether the current color and the specified one are different from one another. |
boolean |
isColorDifferent(int id,
java.awt.Color color,
boolean ignoreDefaults)
Checks whether the current color and the specified one are different from one another. |
boolean |
isColorSet(int id)
Returns true if the specified color is set. |
boolean |
isFontDifferent(int id,
java.awt.Font font)
Checks whether the current font and the specified one are different from one another. |
boolean |
isFontDifferent(int id,
java.awt.Font font,
boolean ignoreDefaults)
Checks whether the current font and the specified one are different from one another. |
boolean |
isFontSet(int id)
Returns true if the specified font is set. |
boolean |
isIdentical(ThemeData data)
Returns true if the current data is identical to the specified one, using default values when items haven't been set. |
boolean |
isIdentical(ThemeData data,
boolean ignoreDefaults)
Returns true if the specified data and the current one are identical. |
static void |
removeDefaultValuesListener(ThemeListener listener)
Removes the specified instance from the list of registered theme listeners. |
boolean |
setColor(int id,
java.awt.Color color)
Sets the specified color to the specified value. |
boolean |
setFont(int id,
java.awt.Font font)
Sets the specified font to the specified value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int FONT_COUNT
Since font identifiers are contiguous, it is possible to explore all fonts contained
by an instance of theme data by looping from 0 to FONT_COUNT.
public static final int COLOR_COUNT
Since color identifiers are contiguous, it is possible to explore all colors contained
by an instance of theme data by looping from 0 to COLOR_COUNT.
public static final int FILE_TABLE_FONT
This defaults to the current JTable font.
public static final int SHELL_FONT
This defaults to the current JTextArea font.
public static final int EDITOR_FONT
This defaults to the current JTable font.
public static final int LOCATION_BAR_FONT
This defaults to the current JTextField font.
public static final int SHELL_HISTORY_FONT
This defaults to the current JTextField font.
public static final int STATUS_BAR_FONT
This defaults to the current JLabel font.
public static final int QUICK_LIST_HEADER_FONT
This defaults to a similar font of the current JTable font, but a little bigger.
public static final int QUICK_LIST_ITEM_FONT
This defaults to the current JTable font.
public static final int FILE_TABLE_BORDER_COLOR
This defaults to Color.GRAY.
public static final int FILE_TABLE_INACTIVE_BORDER_COLOR
This defaults to Color.GRAY.
public static final int FILE_TABLE_BACKGROUND_COLOR
This defaults to the current JTable background color.
public static final int FILE_TABLE_ALTERNATE_BACKGROUND_COLOR
This defaults to the current JTable background color.
public static final int FILE_TABLE_INACTIVE_BACKGROUND_COLOR
This behaves in exactly the same fashion as FILE_TABLE_BACKGROUND_COLOR, and defaults
to the same value.
public static final int FILE_TABLE_INACTIVE_ALTERNATE_BACKGROUND_COLOR
This defaults to the current JTable background color.
public static final int FILE_TABLE_UNMATCHED_BACKGROUND_COLOR
public static final int FILE_TABLE_UNMATCHED_FOREGROUND_COLOR
public static final int FILE_TABLE_SELECTED_BACKGROUND_COLOR
public static final int FILE_TABLE_SELECTED_SECONDARY_BACKGROUND_COLOR
public static final int FILE_TABLE_INACTIVE_SELECTED_SECONDARY_BACKGROUND_COLOR
public static final int FILE_TABLE_INACTIVE_SELECTED_BACKGROUND_COLOR
public static final int HIDDEN_FILE_FOREGROUND_COLOR
This defaults to the current JTable foreground color.
public static final int HIDDEN_FILE_INACTIVE_FOREGROUND_COLOR
This behaves in exactly the same fashion as HIDDEN_FILE_FOREGROUND_COLOR, and defaults
to the same value.
public static final int HIDDEN_FILE_SELECTED_FOREGROUND_COLOR
This defaults to the current JTable selection foreground color.
public static final int HIDDEN_FILE_INACTIVE_SELECTED_FOREGROUND_COLOR
This behaves in exactly the same fashion as HIDDEN_FILE_SELECTED_FOREGROUND_COLOR, and defaults
to the same value.
public static final int FOLDER_FOREGROUND_COLOR
This defaults to the current JTable foreground color.
public static final int FOLDER_INACTIVE_FOREGROUND_COLOR
This behaves in exactly the same fashion as FOLDER_FOREGROUND_COLOR, and defaults
to the same value.
public static final int FOLDER_SELECTED_FOREGROUND_COLOR
This defaults to the current JTable selection foreground color.
public static final int FOLDER_INACTIVE_SELECTED_FOREGROUND_COLOR
This behaves in exactly the same fashion as FOLDER_SELECTED_FOREGROUND_COLOR, and defaults
to the same value.
public static final int ARCHIVE_FOREGROUND_COLOR
This defaults to the current JTable foreground color.
public static final int ARCHIVE_INACTIVE_FOREGROUND_COLOR
This behaves in exactly the same fashion as ARCHIVE_FOREGROUND_COLOR, and defaults
to the same value.
public static final int ARCHIVE_SELECTED_FOREGROUND_COLOR
This defaults to the current JTable selection foreground color.
public static final int ARCHIVE_INACTIVE_SELECTED_FOREGROUND_COLOR
This behaves in exactly the same fashion as ARCHIVE_SELECTED_FOREGROUND_COLOR, and defaults
to the same value.
public static final int SYMLINK_FOREGROUND_COLOR
This defaults to the current JTable foreground color.
public static final int SYMLINK_INACTIVE_FOREGROUND_COLOR
This behaves in exactly the same fashion as SYMLINK_FOREGROUND_COLOR, and defaults
to the same value.
public static final int SYMLINK_SELECTED_FOREGROUND_COLOR
This defaults to the current JTable selection foreground color.
public static final int SYMLINK_INACTIVE_SELECTED_FOREGROUND_COLOR
This behaves in exactly the same fashion as SYMLINK_SELECTED_FOREGROUND_COLOR, and defaults
to the same value.
public static final int MARKED_FOREGROUND_COLOR
This defaults to the current JTable foreground color.
public static final int MARKED_INACTIVE_FOREGROUND_COLOR
This behaves in exactly the same fashion as MARKED_FOREGROUND_COLOR, and defaults
to the same value.
public static final int MARKED_SELECTED_FOREGROUND_COLOR
This defaults to the current JTable selection foreground color.
public static final int MARKED_INACTIVE_SELECTED_FOREGROUND_COLOR
This behaves in exactly the same fashion as MARKED_SELECTED_FOREGROUND_COLOR, and defaults
to the same value.
public static final int FILE_FOREGROUND_COLOR
This defaults to the current JTable foreground color.
public static final int FILE_INACTIVE_FOREGROUND_COLOR
This behaves in exactly the same fashion as FILE_FOREGROUND_COLOR, and defaults
to the same value.
public static final int FILE_SELECTED_FOREGROUND_COLOR
This defaults to the current JTable selection foreground color.
public static final int FILE_INACTIVE_SELECTED_FOREGROUND_COLOR
This behaves in exactly the same fashion as FILE_SELECTED_FOREGROUND_COLOR, and defaults
to the same value.
public static final int SHELL_FOREGROUND_COLOR
This defaults to the current JTextArea foreground color.
public static final int SHELL_BACKGROUND_COLOR
This defaults to the current JTextArea background color.
public static final int SHELL_SELECTED_FOREGROUND_COLOR
This defaults to the current JTextArea selection foreground color.
public static final int SHELL_SELECTED_BACKGROUND_COLOR
This defaults to the current JTextArea selection background color.
public static final int SHELL_HISTORY_FOREGROUND_COLOR
This defaults to the current JTextField foreground color.
public static final int SHELL_HISTORY_BACKGROUND_COLOR
This defaults to the current JTextField background color.
public static final int SHELL_HISTORY_SELECTED_FOREGROUND_COLOR
This defaults to the current JTextField selection foreground color.
public static final int SHELL_HISTORY_SELECTED_BACKGROUND_COLOR
This defaults to the current JTextField selection background color.
public static final int EDITOR_FOREGROUND_COLOR
This defaults to the current JTextArea foreground color.
public static final int EDITOR_BACKGROUND_COLOR
This defaults to the current JTextArea background color.
public static final int EDITOR_SELECTED_FOREGROUND_COLOR
This defaults to the current JTextArea selection foreground color.
public static final int EDITOR_SELECTED_BACKGROUND_COLOR
This defaults to the current JTextArea selection background color.
public static final int LOCATION_BAR_FOREGROUND_COLOR
This defaults to the current JTextField foreground color.
public static final int LOCATION_BAR_BACKGROUND_COLOR
This defaults to the current JTextField background color.
public static final int LOCATION_BAR_SELECTED_FOREGROUND_COLOR
This defaults to the current JTextField selection foreground color.
public static final int LOCATION_BAR_SELECTED_BACKGROUND_COLOR
This defaults to the current JTextField selection background color.
public static final int LOCATION_BAR_PROGRESS_COLOR
Note that this color is painted over the location's bar background and foreground. In order for anything to be visible under it, it needs to have an alpha transparency component.
This defaults to the current JTextField selection background color, with an
alpha transparency value of 64.
public static final int STATUS_BAR_FOREGROUND_COLOR
This defaults to the current JLabel foreground color.
public static final int STATUS_BAR_BACKGROUND_COLOR
This defaults to the current JLabel background color.
public static final int STATUS_BAR_BORDER_COLOR
This defaults to Color.GRAY.
public static final int STATUS_BAR_OK_COLOR
This defaults to 0x70EC2B.
public static final int STATUS_BAR_WARNING_COLOR
This defaults to 0xFF7F00.
public static final int STATUS_BAR_CRITICAL_COLOR
This defaults to Color.RED.
public static final int FILE_TABLE_SELECTED_OUTLINE_COLOR
public static final int FILE_TABLE_INACTIVE_SELECTED_OUTLINE_COLOR
public static final int QUICK_LIST_HEADER_BACKGROUND_COLOR
public static final int QUICK_LIST_HEADER_SECONDARY_BACKGROUND_COLOR
public static final int QUICK_LIST_HEADER_FOREGROUND_COLOR
public static final int QUICK_LIST_ITEM_BACKGROUND_COLOR
public static final int QUICK_LIST_ITEM_FOREGROUND_COLOR
public static final int QUICK_LIST_SELECTED_ITEM_BACKGROUND_COLOR
public static final int QUICK_LIST_SELECTED_ITEM_FOREGROUND_COLOR
| Constructor Detail |
|---|
public ThemeData()
ThemeData instances created that way will return default values for every
single one of their items.
cloneData()| Method Detail |
|---|
public ThemeData cloneData(boolean freezeDefaults)
This method allows callers to decide whether they want to freeze default values or not. Freezing a value means that it will be considered to have been set to the default value, and will not be updated when this default value changes.
freezeDefaults - whether or not to freeze the data's default values.
cloneData()public ThemeData cloneData()
This is a convenience method, and is exactly equivalent to calling .
cloneData(false)
public void importData(ThemeData data)
This method can be dangerous in that it overwrites every single value of the current data without hope of retrieval. Moreoever, if something were to go wrong during the operation and an exception was raised, the current data would find itself in an invalid state, where some of its values would have been updated but not all of them. It is up to callers to deal with these issues.
Values overwritting is done through the use of the current instance's setColor(int,Color)
and setFont(int,Font) methods. This allows subclasses to plug their own code here. A good
example of that is Theme, which will automatically trigger font and color events when
importing data.
data - data to import.
public boolean setColor(int id,
java.awt.Color color)
Use a value of null to restore the color to it's default value.
This method will return false if it didn't actually change the theme data.
This is checked through the use of .
isColorDifferent(id,color)
Note that even if the color is found to be identical, the previous value will be overwritten -
this is a design choice, meant for these cases where developers need to work with home-made
subclasses of Color.
id - identifier of the color to set.color - value to which the color should be set.
true if the call actually changed the data, false otherwise.
public boolean setFont(int id,
java.awt.Font font)
Use a value of null to restore the font to it's default value.
This method will return false if it didn't actually change the theme data.
This is checked through the use of .
isFontDifferent(id, font)
Note that even if the font is found to be identical, the previous value will be overwritten -
this is a design choice, meant for these cases where developers need to work with home-made
subclasses of Font.
id - identifier of the font to set.font - value to which the font should be set.
true if the call actually changed the data, false otherwise.public java.awt.Color getColor(int id)
If the requested color wasn't set, its default value will be returned.
id - identifier of the color to retrieve.
getDefaultColor(int,ThemeData),
isColorSet(int)public java.awt.Font getFont(int id)
If the requested font wasn't set, its default value will be returned.
id - identifier of the font to retrieve.
getDefaultFont(int),
isFontSet(int)public boolean isColorSet(int id)
true if the specified color is set.
id - identifier of the color to check for.
true if the specified color is set, false otherwise.getDefaultColor(int,ThemeData)public boolean isFontSet(int id)
true if the specified font is set.
id - identifier of the font to check for.
true if the specified font is set, false otherwise.getDefaultFont(int)public static java.awt.Font getDefaultFont(int id)
Default values are look&feel dependant, and are subject to change during the application's
life time.
Classes that need to monitor such changes can register themselves using addDefaultValuesListener(ThemeListener).
id - identifier of the font whose default value should be retrieved.
addDefaultValuesListener(ThemeListener)
public boolean isIdentical(ThemeData data,
boolean ignoreDefaults)
true if the specified data and the current one are identical.
Comparisons is done by calling isFontDifferent(int,Font,boolean) and isColorDifferent(int,Color,boolean)
on every font and color. Refer to the documentation of these methods for more information on using the ignoreDefaults
parameter.
data - data against which to compare.ignoreDefaults - whether or not to compare default values.
true if the specified data and the current one are identical, false otherwise.isFontDifferent(int,Font,boolean),
isColorDifferent(int,Color,boolean)public boolean isIdentical(ThemeData data)
true if the current data is identical to the specified one, using default values when items haven't been set.
This is a convenience method, and is strictly equivalent to calling isIdentical(data, false).
data - data against which to compare.
true if the specified data and the current one are identical, false otherwise.
public boolean isFontDifferent(int id,
java.awt.Font font)
This is a convenience method, and is stricly equivalent to calling
.
isFontDifferent(id, font, false)
id - identifier of the font to check.font - font to check.
true if font is different from the one defined in the data.isFontDifferent(int,Font,boolean),
isColorDifferent(int,Color)
public boolean isFontDifferent(int id,
java.awt.Font font,
boolean ignoreDefaults)
Setting ignoreDefaults to false will compare both fonts from a 'user' point of view: comparison
will be done on the values that are used by the rest of the application. It might however be necessary to consider
fonts to be different if one is set but not the other. This can be achieved by setting ignoreDefaults to true.
id - identifier of the font to check.font - font to check.ignoreDefaults - whether or not to ignore defaults if the requested item doesn't have a value.
true if font is different from the one defined in the data.isFontDifferent(int,Font),
isColorDifferent(int,Color)
public boolean isColorDifferent(int id,
java.awt.Color color)
This is a convenience method, and is stricly equivalent to calling
.
isColorDifferent(id, color, false)
id - identifier of the color to check.color - color to check.
true if color is different from the one defined in the data.isColorDifferent(int,Color,boolean),
isFontDifferent(int,Font)
public boolean isColorDifferent(int id,
java.awt.Color color,
boolean ignoreDefaults)
Setting ignoreDefaults to false will compare both colors from a 'user' point of view: comparison
will be done on the values that are used by the rest of the application. It might however be necessary to consider
colors to be different if one is set but not the other. This can be achieved by setting ignoreDefaults to true.
id - identifier of the color to check.color - color to check.ignoreDefaults - whether or not to ignore defaults if the requested item doesn't have a value.
true if color is different from the one defined in the data.isColorDifferent(int,Color),
isFontDifferent(int,Font)public static void addDefaultValuesListener(ThemeListener listener)
The listener will receive font and color events whenever
one of the default values has been changed, by a modification to the current look&feel for example.
It is not necessary for 'themable' components to listen to default values, as they are automatically propagated
through Theme and ThemeManager.
Note that listeners are stored as weak references, to make sure that the API doesn't keep ghost copies of objects whose usefulness is long since past. This forces callers to make sure they keep a copy of the listener's instance: if they do not, the instance will be weakly linked and garbage collected out of existence.
listener - theme listener to register.removeDefaultValuesListener(ThemeListener)public static void removeDefaultValuesListener(ThemeListener listener)
Note that since listeners are stored as weak references, calling this method is not strictly necessary. As soon as a listener instance is not referenced anymore, it will automatically be caught and destroyed by the garbage collector.
listener - instance to remove from the list of registered theme listeners.addDefaultValuesListener(ThemeListener)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard