public class PreferencesPropertyMap extends AbstractPropertyMap implements PreferenceChangeListener
PropertyMap
interface backed by a Preferences
instance.DEFAULT_COLOR, DEFAULT_FONT
Constructor and Description |
---|
PreferencesPropertyMap(Preferences preferences) |
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener) |
void |
addPropertyChangeListener(String key,
PropertyChangeListener listener) |
protected void |
firePropertyChange(String key,
String oldValue,
String newValue) |
protected String |
get(String key) |
protected String |
get(String key,
String defaultValue) |
Properties |
getProperties()
Returns the
Properties instance in which this property map stores its key/value pairs. |
Set<String> |
getPropertyKeys()
Returns an enumeration of the property keys in this map.
|
void |
load(Path file)
Loads key/value pairs from a text file into this property map.
|
void |
preferenceChange(PreferenceChangeEvent evt)
This method gets called when a preference is added, removed or when
its value is changed.
|
void |
removePropertyChangeListener(PropertyChangeListener listener) |
void |
removePropertyChangeListener(String key,
PropertyChangeListener listener) |
protected String |
set(String key,
String value) |
void |
store(Path file,
String header)
Stores the key/value pairs of this property map into a text file.
|
getPropertyBool, getPropertyBool, getPropertyColor, getPropertyColor, getPropertyDouble, getPropertyDouble, getPropertyFont, getPropertyFont, getPropertyInt, getPropertyInt, getPropertyString, getPropertyString, setPropertyBool, setPropertyColor, setPropertyDouble, setPropertyFont, setPropertyInt, setPropertyString
public PreferencesPropertyMap(Preferences preferences)
protected String get(String key)
get
in class AbstractPropertyMap
protected String get(String key, String defaultValue)
get
in class AbstractPropertyMap
protected String set(String key, String value)
set
in class AbstractPropertyMap
protected void firePropertyChange(String key, String oldValue, String newValue)
firePropertyChange
in class AbstractPropertyMap
public void load(Path file) throws IOException
PropertyMap
load
in interface PropertyMap
file
- the text fileIOException
- if an I/O error occurspublic void store(Path file, String header) throws IOException
PropertyMap
store
in interface PropertyMap
file
- the text fileheader
- an optional file headerIOException
- if an I/O error occurspublic Properties getProperties()
PropertyMap
Properties
instance in which this property map stores its key/value pairs.getProperties
in interface PropertyMap
public Set<String> getPropertyKeys()
PropertyMap
getPropertyKeys
in interface PropertyMap
public void addPropertyChangeListener(PropertyChangeListener listener)
addPropertyChangeListener
in interface PropertyMap
public void addPropertyChangeListener(String key, PropertyChangeListener listener)
addPropertyChangeListener
in interface PropertyMap
public void removePropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener
in interface PropertyMap
public void removePropertyChangeListener(String key, PropertyChangeListener listener)
removePropertyChangeListener
in interface PropertyMap
public void preferenceChange(PreferenceChangeEvent evt)
preferenceChange
in interface PreferenceChangeListener
evt
- A PreferenceChangeEvent object describing the event source
and the preference that has changed.Copyright © 2014–2016 European Space Agency (ESA). All rights reserved.