public abstract class Preferences extends Object
PropertiesPreferences
is used, which stores the preferences in a properties file. Under Java 1.4,
JavaPreferences
is used, which uses the java.util.prefs
preferences.
A set of default preferences is stored with the application jar file and accessed using the
ResourceBundle
mechanism from the resource "/preferences".
If a user preference is not yet set, the value from the default preferences is used.
The default value passed to the methods getInt
,... is only used if the default
preference setting (a string) cannot be converted to the requested data type.
Property change listeners are used to inform interested objects of preference value changes.
The field oldValue
of any property change event may not be initialized depending
on the implementation.
Constructor and Description |
---|
Preferences()
Initializes the preferences with the user's settings.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener cl)
Adds a listener which will be notified of changes to the preferences.
|
protected void |
firePropertyChanged(String name,
Object oldValue,
Object newValue)
Notifies the listeners of a change to the preferences.
|
abstract boolean |
getBoolean(String key,
boolean d)
Returns the preference for the given key as a boolean.
|
abstract double |
getDouble(String key,
double d)
Returns the preference for the given key as a double.
|
abstract int |
getInt(String key,
int d)
Returns the preference for the given key as an int.
|
String[] |
getList(String key,
char separator)
Returns the preferences for the given key as an array of strings.
|
String[] |
getPaths(String key)
Returns the preference for the given key as an array of strings with pathnames.
|
String |
getString(String key)
Return the preference for the given key.
|
abstract String |
getString(String key,
String d)
Return the preference for the given key.
|
void |
removePropertyChangeListener(PropertyChangeListener cl)
Removes a listener.
|
abstract void |
set(String key,
boolean value)
Sets the new preference value to a boolean.
|
abstract void |
set(String key,
double value)
Sets the new preference value to a double.
|
abstract void |
set(String key,
int value)
Sets the new preference value to an int.
|
abstract void |
set(String key,
String value)
Sets a new preference value.
|
public static final String DICTIONARIES
public static final String DICTIONARIES_DIR
public static final String FRAME_X
public static final String FRAME_Y
public static final String FRAME_WIDTH
public static final String FRAME_HEIGHT
public static final String READING_BRACKET_CHARS
public static final String ENCODINGS
public static final String FONTSIZES_WORDLOOKUP
public static final String FONTSIZES_KANJI
public static final String FONTSIZES_READING
public static final String FONTSIZES_TRANSLATION
public static final String FONT_GENERAL_USEDEFAULT
public static final String FONT_GENERAL
public static final String FONT_GENERAL_SIZEDIFF
public static final String FONT_WORDLOOKUP
public static final String FONT_WORDLOOKUP_SIZE
public static final String FONT_TEXT
public static final String FONT_TEXT_SIZE
public static final String FONT_TEXT_BGCOLOR
public static final String FONT_TEXT_USECOLOR
public static final String FONT_READING
public static final String FONT_READING_SIZE
public static final String FONT_READING_BGCOLOR
public static final String FONT_READING_USECOLOR
public static final String FONT_TRANSLATION
public static final String FONT_TRANSLATION_SIZE
public static final String FONT_TRANSLATION_BGCOLOR
public static final String FONT_TRANSLATION_USECOLOR
public static final String FONT_DEFAULTFONTS
public static final String FONT_AUTODETECTED
public static final String ANNOTATION_HIGHLIGHT_COLOR
public static final String DTD_DEFAULT
public static final String VIEW_COMPACTVIEW
public static final String VIEW_SHOWREADING
public static final String VIEW_SHOWTRANSLATION
public static final String VIEW_SHOWANNOTATION
public static final String VIEW_ANNOTATIONEDITORHIDDEN
public static final String VIEW_DIVIDERLOCATION
public static final String VIEW_MAXTRANSLATIONLENGTH
public static final String EDITOR_ENABLEEDITINGCHECKBOX
public static final String EDITOR_ENABLEEDITING
public static final String IMPORT_PARSER
public static final String IMPORT_FIRSTOCCURRENCE
public static final String IMPORT_DETECTPARAGRAPHS
public static final String IMPORT_READINGBRACKETS
public static final String IMPORTCLIPBOARD_PARSER
public static final String IMPORTCLIPBOARD_FIRSTOCCURRENCE
public static final String IMPORTCLIPBOARD_DETECTPARAGRAPHS
public static final String IMPORTCLIPBOARD_READINGBRACKETS
public static final String EXPORT_PLAINTEXT_ENCODING
public static final String EXPORT_PLAINTEXT_WRITEREADING
public static final String EXPORT_PLAINTEXT_WRITETRANSLATIONS
public static final String EXPORT_PLAINTEXT_WRITEHIDDEN
public static final String EXPORT_HTML_ENCODING
public static final String EXPORT_HTML_WRITEREADING
public static final String EXPORT_HTML_WRITETRANSLATIONS
public static final String EXPORT_HTML_BACKWARDSCOMPATIBLE
public static final String EXPORT_HTML_WRITEHIDDEN
public static final String EXPORT_LATEX_WRITEHIDDEN
public static final String EXPORT_LATEX_TEMPLATE
public static final String EXPORT_LATEX_USERTEMPLATES
public static final String EXPORT_LATEX_FONTSIZES
public static final String EXPORT_LATEX_FONTSIZE
public static final String EXPORT_ANNOTATIONLIST_ENCODING
public static final String EXPORT_EXCLUSIONS_ENCODING
public static final String EXCLUSIONS_FILE
public static final String EXCLUSIONS_ENCODING
public static final String USERDICTIONARY_FILE
public static final String STARTUP_WORDLOOKUP
public static final String LEFTCLICK_TOOLTIP
public static final String WORDLOOKUP_WIDTH
public static final String WORDLOOKUP_HEIGHT
public static final String WORDLOOKUP_SEARCHTYPE
public static final String WORDLOOKUP_DEINFLECTION
public static final String WORDLOOKUP_ALLDICTIONARIES
public static final String WORDLOOKUP_RESULTLIMIT
public static final String WORDLOOKUP_SEARCHCLIPBOARD
public static final String CHASEN_LOCATION
public static final String OPENRECENT_FILES
public static final String HISTORY_SELECTION
public static final String HISTORY_SIZE
public static final String SHOW_WELCOME_DIALOG
public static final String PREFERENCES_MIGRATED
protected Properties defaults
Preferences
constructor.protected final List<PropertyChangeListener> propertyChangeListeners
public Preferences()
public String getString(String key)
key
- Key to a preference.public abstract String getString(String key, String d)
key
- Key to a preference.d
- Default value. Used if neither the preference value nor the default preference
value is set.public abstract void set(String key, String value)
key
- Key to the preference.value
- The new value. May be null
to reset to the default preference.public abstract int getInt(String key, int d)
key
- Key to the preference.d
- Default value, if the preference is not parseable as int.public abstract void set(String key, int value)
key
- Key to the preference.value
- The new value.public abstract double getDouble(String key, double d)
key
- Key to the preference.d
- Default value, if the preference is not parseable as double.public abstract void set(String key, double value)
key
- Key to the preference.value
- The new value.public abstract boolean getBoolean(String key, boolean d)
key
- Key to the preference.d
- Default value, if the preference is not parseable as boolean.public abstract void set(String key, boolean value)
key
- Key to the preference.value
- The new value.public String[] getPaths(String key)
key
- Key to the preference.public String[] getList(String key, char separator)
key
- Key to the preference.separator
- Character which separates the strings in the preference value.public void addPropertyChangeListener(PropertyChangeListener cl)
cl
- The listener.public void removePropertyChangeListener(PropertyChangeListener cl)
cl
- The listener.protected void firePropertyChanged(String name, Object oldValue, Object newValue)
name
- The key of the changed preference.oldValue
- The previous setting of the preference.newValue
- The new setting of the preference.Copyright © 2001-2013 the JGloss developers. All Rights Reserved.