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 the PropertyMap interface.
Since:
SNAP 2
  • Field Details

    • DEFAULT_FONT

      public static final Font DEFAULT_FONT
    • DEFAULT_COLOR

      public static final Color DEFAULT_COLOR
  • Constructor Details

    • AbstractPropertyMap

      public AbstractPropertyMap()
  • Method Details

    • getPropertyBool

      public boolean getPropertyBool(String key)
      Gets a value of type boolean.
      Specified by:
      getPropertyBool in interface PropertyMap
      Parameters:
      key - the key
      Returns:
      the value for the given key, or false if the key is not contained in this property set.
    • getPropertyBool

      public Boolean getPropertyBool(String key, Boolean defaultValue)
      Gets a value of type Boolean.
      Specified by:
      getPropertyBool in interface PropertyMap
      Parameters:
      key - the key
      defaultValue - the default value that is returned if the key was not found in this property set.
      Returns:
      the value for the given key, or defaultValue if the key is not contained in this property set.
    • setPropertyBool

      public void setPropertyBool(String key, Boolean newValue)
      Sets a value of type Boolean.
      Specified by:
      setPropertyBool in interface PropertyMap
      Parameters:
      key - the key
      newValue - the new value
      Throws:
      IllegalArgumentException
    • getPropertyInt

      public int getPropertyInt(String key)
      Gets a value of type int.
      Specified by:
      getPropertyInt in interface PropertyMap
      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 type Integer.
      Specified by:
      getPropertyInt in interface PropertyMap
      Parameters:
      key - the key
      defaultValue - the default value that is returned if the key was not found in this property set.
      Returns:
      the value for the given key, or defaultValue if the key is not contained in this property set.
    • setPropertyInt

      public void setPropertyInt(String key, Integer value)
      Sets a value of type Integer.
      Specified by:
      setPropertyInt in interface PropertyMap
      Parameters:
      key - the key
      value - the value
      Throws:
      IllegalArgumentException
    • getPropertyDouble

      public double getPropertyDouble(String key)
      Gets a value of type double.
      Specified by:
      getPropertyDouble in interface PropertyMap
      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 type Double.
      Specified by:
      getPropertyDouble in interface PropertyMap
      Parameters:
      key - the key
      defaultValue - the default value that is returned if the key was not found in this property set.
      Returns:
      the value for the given key, or defaultValue if the key is not contained in this property set.
    • setPropertyDouble

      public void setPropertyDouble(String key, Double value)
      Sets a value of type Double.
      Specified by:
      setPropertyDouble in interface PropertyMap
      Parameters:
      key - the key
      value - the value
      Throws:
      IllegalArgumentException
    • getPropertyString

      public String getPropertyString(String key)
      Gets a value of type String.
      Specified by:
      getPropertyString in interface PropertyMap
      Parameters:
      key - the key
      Returns:
      the value for the given key, or "" (empty string) if the key is not contained in this property set, never null.
    • getPropertyString

      public String getPropertyString(String key, String defaultValue)
      Gets a value of type String.
      Specified by:
      getPropertyString in interface PropertyMap
      Parameters:
      key - the key
      defaultValue - the default value that is returned if the key was not found in this property set.
      Returns:
      the value for the given key, or defaultValue if the key is not contained in this property set.
    • setPropertyString

      public void setPropertyString(String key, String value)
      Sets a value of type String.
      Specified by:
      setPropertyString in interface PropertyMap
      Parameters:
      key - the key
      value - the new value
      Throws:
      IllegalArgumentException
    • getPropertyColor

      public Color getPropertyColor(String key)
      Gets a value of type Color.
      Specified by:
      getPropertyColor in interface PropertyMap
      Parameters:
      key - the key
      Returns:
      the value for the given key, or Color.black if the key is not contained in this property set, never null.
    • getPropertyColor

      public Color getPropertyColor(String key, Color defaultValue)
      Gets a value of type Color.
      Specified by:
      getPropertyColor in interface PropertyMap
      Parameters:
      key - the key
      defaultValue - the default value that is returned if the key was not found in this property set.
      Returns:
      the value for the given key, or defaultValue if the key is not contained in this property set.
    • setPropertyColor

      public void setPropertyColor(String key, Color value)
      Sets a value of type Color.
      Specified by:
      setPropertyColor in interface PropertyMap
      Parameters:
      key - the key
      value - the value
      Throws:
      IllegalArgumentException
    • getPropertyFont

      public Font getPropertyFont(String key)
      Gets a value of type Font.
      Specified by:
      getPropertyFont in interface PropertyMap
      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 type Font.
      Specified by:
      getPropertyFont in interface PropertyMap
      Parameters:
      key - the key
      defaultValue - the default value that is returned if the key was not found in this property set.
      Returns:
      the value for the given key, or defaultValue if the key is not contained in this property set.
    • setPropertyFont

      public void setPropertyFont(String key, Font font)
      Sets a font of type Font. The method actually puts three keys in this property set in order to store the font's properties:
      • <key>.name for the font's name
      • <key>.style for the font's style (an integer font)
      • <key>.name for the font's size in points (an integer font)
      Specified by:
      setPropertyFont in interface PropertyMap
      Parameters:
      key - the key
      font - the font
      Throws:
      IllegalArgumentException
    • get

      protected abstract String get(String key)
    • get

      protected abstract String get(String key, String defaultValue)
    • set

      protected abstract String set(String key, String value)
    • firePropertyChange

      protected abstract void firePropertyChange(String key, String oldValue, String newValue)