Package org.esa.snap.core.util
Class AbstractPropertyMap
- java.lang.Object
-
- org.esa.snap.core.util.AbstractPropertyMap
-
- All Implemented Interfaces:
PropertyMap
- Direct Known Subclasses:
DefaultPropertyMap,PreferencesPropertyMap
public abstract class AbstractPropertyMap extends Object implements PropertyMap
Abstract implementation of thePropertyMapinterface.- Since:
- SNAP 2
-
-
Field Summary
Fields Modifier and Type Field Description static ColorDEFAULT_COLORstatic FontDEFAULT_FONT
-
Constructor Summary
Constructors Constructor Description AbstractPropertyMap()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidfirePropertyChange(String key, String oldValue, String newValue)protected abstract Stringget(String key)protected abstract Stringget(String key, String defaultValue)booleangetPropertyBool(String key)Gets a value of typeboolean.BooleangetPropertyBool(String key, Boolean defaultValue)Gets a value of typeBoolean.ColorgetPropertyColor(String key)Gets a value of typeColor.ColorgetPropertyColor(String key, Color defaultValue)Gets a value of typeColor.doublegetPropertyDouble(String key)Gets a value of typedouble.DoublegetPropertyDouble(String key, Double defaultValue)Gets a value of typeDouble.FontgetPropertyFont(String key)Gets a value of typeFont.FontgetPropertyFont(String key, Font defaultValue)Gets a value of typeFont.intgetPropertyInt(String key)Gets a value of typeint.IntegergetPropertyInt(String key, Integer defaultValue)Gets a value of typeInteger.StringgetPropertyString(String key)Gets a value of typeString.StringgetPropertyString(String key, String defaultValue)Gets a value of typeString.protected abstract Stringset(String key, String value)voidsetPropertyBool(String key, Boolean newValue)Sets a value of typeBoolean.voidsetPropertyColor(String key, Color value)Sets a value of typeColor.voidsetPropertyDouble(String key, Double value)Sets a value of typeDouble.voidsetPropertyFont(String key, Font font)Sets a font of typeFont.voidsetPropertyInt(String key, Integer value)Sets a value of typeInteger.voidsetPropertyString(String key, String value)Sets a value of typeString.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.esa.snap.core.util.PropertyMap
addPropertyChangeListener, addPropertyChangeListener, getProperties, getPropertyKeys, load, removePropertyChangeListener, removePropertyChangeListener, store
-
-
-
-
Method Detail
-
getPropertyBool
public boolean getPropertyBool(String key)
Gets a value of typeboolean.- Specified by:
getPropertyBoolin interfacePropertyMap- Parameters:
key- the key- Returns:
- the value for the given key, or
falseif the key is not contained in this property set.
-
getPropertyBool
public Boolean getPropertyBool(String key, Boolean defaultValue)
Gets a value of typeBoolean.- Specified by:
getPropertyBoolin interfacePropertyMap- Parameters:
key- the keydefaultValue- the default value that is returned if the key was not found in this property set.- Returns:
- the value for the given key, or
defaultValueif the key is not contained in this property set.
-
setPropertyBool
public void setPropertyBool(String key, Boolean newValue)
Sets a value of typeBoolean.- Specified by:
setPropertyBoolin interfacePropertyMap- Parameters:
key- the keynewValue- the new value- Throws:
IllegalArgumentException
-
getPropertyInt
public int getPropertyInt(String key)
Gets a value of typeint.- Specified by:
getPropertyIntin interfacePropertyMap- Parameters:
key- the key- Returns:
- the value for the given key, or
0(zero) if the key is not contained in this property set.
-
getPropertyInt
public Integer getPropertyInt(String key, Integer defaultValue)
Gets a value of typeInteger.- Specified by:
getPropertyIntin interfacePropertyMap- Parameters:
key- the keydefaultValue- the default value that is returned if the key was not found in this property set.- Returns:
- the value for the given key, or
defaultValueif the key is not contained in this property set.
-
setPropertyInt
public void setPropertyInt(String key, Integer value)
Sets a value of typeInteger.- Specified by:
setPropertyIntin interfacePropertyMap- Parameters:
key- the keyvalue- the value- Throws:
IllegalArgumentException
-
getPropertyDouble
public double getPropertyDouble(String key)
Gets a value of typedouble.- Specified by:
getPropertyDoublein interfacePropertyMap- Parameters:
key- the key- Returns:
- the value for the given key, or
0.0(zero) if the key is not contained in this property set.
-
getPropertyDouble
public Double getPropertyDouble(String key, Double defaultValue)
Gets a value of typeDouble.- Specified by:
getPropertyDoublein interfacePropertyMap- Parameters:
key- the keydefaultValue- the default value that is returned if the key was not found in this property set.- Returns:
- the value for the given key, or
defaultValueif the key is not contained in this property set.
-
setPropertyDouble
public void setPropertyDouble(String key, Double value)
Sets a value of typeDouble.- Specified by:
setPropertyDoublein interfacePropertyMap- Parameters:
key- the keyvalue- the value- Throws:
IllegalArgumentException
-
getPropertyString
public String getPropertyString(String key)
Gets a value of typeString.- Specified by:
getPropertyStringin interfacePropertyMap- Parameters:
key- the key- Returns:
- the value for the given key, or
""(empty string) if the key is not contained in this property set, nevernull.
-
getPropertyString
public String getPropertyString(String key, String defaultValue)
Gets a value of typeString.- Specified by:
getPropertyStringin interfacePropertyMap- Parameters:
key- the keydefaultValue- the default value that is returned if the key was not found in this property set.- Returns:
- the value for the given key, or
defaultValueif the key is not contained in this property set.
-
setPropertyString
public void setPropertyString(String key, String value)
Sets a value of typeString.- Specified by:
setPropertyStringin interfacePropertyMap- Parameters:
key- the keyvalue- the new value- Throws:
IllegalArgumentException
-
getPropertyColor
public Color getPropertyColor(String key)
Gets a value of typeColor.- Specified by:
getPropertyColorin interfacePropertyMap- Parameters:
key- the key- Returns:
- the value for the given key, or
Color.blackif the key is not contained in this property set, nevernull.
-
getPropertyColor
public Color getPropertyColor(String key, Color defaultValue)
Gets a value of typeColor.- Specified by:
getPropertyColorin interfacePropertyMap- Parameters:
key- the keydefaultValue- the default value that is returned if the key was not found in this property set.- Returns:
- the value for the given key, or
defaultValueif the key is not contained in this property set.
-
setPropertyColor
public void setPropertyColor(String key, Color value)
Sets a value of typeColor.- Specified by:
setPropertyColorin interfacePropertyMap- Parameters:
key- the keyvalue- the value- Throws:
IllegalArgumentException
-
getPropertyFont
public Font getPropertyFont(String key)
Gets a value of typeFont.- Specified by:
getPropertyFontin interfacePropertyMap- Parameters:
key- the key- Returns:
- the value for the given key, or a plain, 12-point "SandSerif" font if the key is not contained in this
property set, never
null.
-
getPropertyFont
public Font getPropertyFont(String key, Font defaultValue)
Gets a value of typeFont.- Specified by:
getPropertyFontin interfacePropertyMap- Parameters:
key- the keydefaultValue- the default value that is returned if the key was not found in this property set.- Returns:
- the value for the given key, or
defaultValueif the key is not contained in this property set.
-
setPropertyFont
public void setPropertyFont(String key, Font font)
Sets a font of typeFont. The method actually puts three keys in this property set in order to store the font's properties:<key>.namefor the font's name<key>.stylefor the font's style (an integer font)<key>.namefor the font's size in points (an integer font)
- Specified by:
setPropertyFontin interfacePropertyMap- Parameters:
key- the keyfont- the font- Throws:
IllegalArgumentException
-
-