Package org.esa.snap.core.util
Class PreferencesPropertyMap
- java.lang.Object
-
- org.esa.snap.core.util.AbstractPropertyMap
-
- org.esa.snap.core.util.PreferencesPropertyMap
-
- All Implemented Interfaces:
EventListener
,PreferenceChangeListener
,PropertyMap
public class PreferencesPropertyMap extends AbstractPropertyMap implements PreferenceChangeListener
Implementation of thePropertyMap
interface backed by aPreferences
instance.- Since:
- SNAP 2
-
-
Field Summary
-
Fields inherited from class org.esa.snap.core.util.AbstractPropertyMap
DEFAULT_COLOR, DEFAULT_FONT
-
-
Constructor Summary
Constructors Constructor Description PreferencesPropertyMap(Preferences preferences)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 theProperties
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.-
Methods inherited from class org.esa.snap.core.util.AbstractPropertyMap
getPropertyBool, getPropertyBool, getPropertyColor, getPropertyColor, getPropertyDouble, getPropertyDouble, getPropertyFont, getPropertyFont, getPropertyInt, getPropertyInt, getPropertyString, getPropertyString, setPropertyBool, setPropertyColor, setPropertyDouble, setPropertyFont, setPropertyInt, setPropertyString
-
-
-
-
Constructor Detail
-
PreferencesPropertyMap
public PreferencesPropertyMap(Preferences preferences)
-
-
Method Detail
-
get
protected String get(String key)
- Specified by:
get
in classAbstractPropertyMap
-
get
protected String get(String key, String defaultValue)
- Specified by:
get
in classAbstractPropertyMap
-
set
protected String set(String key, String value)
- Specified by:
set
in classAbstractPropertyMap
-
firePropertyChange
protected void firePropertyChange(String key, String oldValue, String newValue)
- Specified by:
firePropertyChange
in classAbstractPropertyMap
-
load
public void load(Path file) throws IOException
Description copied from interface:PropertyMap
Loads key/value pairs from a text file into this property map.- Specified by:
load
in interfacePropertyMap
- Parameters:
file
- the text file- Throws:
IOException
- if an I/O error occurs
-
store
public void store(Path file, String header) throws IOException
Description copied from interface:PropertyMap
Stores the key/value pairs of this property map into a text file.- Specified by:
store
in interfacePropertyMap
- Parameters:
file
- the text fileheader
- an optional file header- Throws:
IOException
- if an I/O error occurs
-
getProperties
public Properties getProperties()
Description copied from interface:PropertyMap
Returns theProperties
instance in which this property map stores its key/value pairs.- Specified by:
getProperties
in interfacePropertyMap
-
getPropertyKeys
public Set<String> getPropertyKeys()
Description copied from interface:PropertyMap
Returns an enumeration of the property keys in this map.- Specified by:
getPropertyKeys
in interfacePropertyMap
-
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener listener)
- Specified by:
addPropertyChangeListener
in interfacePropertyMap
-
addPropertyChangeListener
public void addPropertyChangeListener(String key, PropertyChangeListener listener)
- Specified by:
addPropertyChangeListener
in interfacePropertyMap
-
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener listener)
- Specified by:
removePropertyChangeListener
in interfacePropertyMap
-
removePropertyChangeListener
public void removePropertyChangeListener(String key, PropertyChangeListener listener)
- Specified by:
removePropertyChangeListener
in interfacePropertyMap
-
preferenceChange
public void preferenceChange(PreferenceChangeEvent evt)
This method gets called when a preference is added, removed or when its value is changed.- Specified by:
preferenceChange
in interfacePreferenceChangeListener
- Parameters:
evt
- A PreferenceChangeEvent object describing the event source and the preference that has changed.
-
-