Index: trunk/src/org/openstreetmap/josm/data/Preferences.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 5463)
+++ trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 5464)
@@ -49,4 +49,5 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.preferences.ColorProperty;
 import org.openstreetmap.josm.io.MirroredInputStream;
 import org.openstreetmap.josm.io.XmlWriter;
@@ -241,5 +242,5 @@
         String getColorName();
         String getSpecialName();
-        Color getDefault();
+        Color getDefaultValue();
     }
 
@@ -449,15 +450,15 @@
     }
 
-    synchronized public boolean getBoolean(final String key) {
+    synchronized public Boolean getBoolean(final String key) {
         putDefault(key, null);
         return properties.containsKey(key) ? Boolean.parseBoolean(properties.get(key)) : false;
     }
 
-    synchronized public boolean getBoolean(final String key, final boolean def) {
+    synchronized public Boolean getBoolean(final String key, final boolean def) {
         putDefault(key, Boolean.toString(def));
         return properties.containsKey(key) ? Boolean.parseBoolean(properties.get(key)) : def;
     }
 
-    synchronized public boolean getBoolean(final String key, final String specName, final boolean def) {
+    synchronized public Boolean getBoolean(final String key, final String specName, final boolean def) {
         putDefault(key, Boolean.toString(def));
         String skey = key+"."+specName;
@@ -802,5 +803,5 @@
 
     public Color getColor(ColorKey key) {
-        return getColor(key.getColorName(), key.getSpecialName(), key.getDefault());
+        return getColor(key.getColorName(), key.getSpecialName(), key.getDefaultValue());
     }
 
@@ -814,5 +815,5 @@
      */
     synchronized public Color getColor(String colName, String specName, Color def) {
-        String colKey = colName.toLowerCase().replaceAll("[^a-z0-9]+",".");
+        String colKey = ColorProperty.getColorKey(colName);
         if(!colKey.equals(colName)) {
             colornames.put(colKey, colName);
@@ -826,11 +827,11 @@
     }
 
-    synchronized public Color getDefaultColor(String colName) {
-        String colStr = defaults.get("color."+colName);
+    synchronized public Color getDefaultColor(String colKey) {
+        String colStr = defaults.get("color."+colKey);
         return colStr == null || "".equals(colStr) ? null : ColorHelper.html2color(colStr);
     }
 
-    synchronized public boolean putColor(String colName, Color val) {
-        return put("color."+colName, val != null ? ColorHelper.color2html(val) : null);
+    synchronized public boolean putColor(String colKey, Color val) {
+        return put("color."+colKey, val != null ? ColorHelper.color2html(val) : null);
     }
 
Index: trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/PaintColors.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/PaintColors.java	(revision 5463)
+++ trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/PaintColors.java	(revision 5464)
@@ -57,12 +57,15 @@
     }
 
+    @Override
     public String getColorName() {
         return name;
     }
 
-    public Color getDefault() {
+    @Override
+    public Color getDefaultValue() {
         return defaultColor;
     }
 
+    @Override
     public String getSpecialName() {
         return null;
Index: trunk/src/org/openstreetmap/josm/data/preferences/AbstractProperty.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/preferences/AbstractProperty.java	(revision 5463)
+++ trunk/src/org/openstreetmap/josm/data/preferences/AbstractProperty.java	(revision 5464)
@@ -5,26 +5,66 @@
 
 /**
- * captures the common functionality of preference properties
+ * Captures the common functionality of preference properties
+ * @param <T> The type of object accessed by this property
  */
 public abstract class AbstractProperty<T> {
     protected final String key;
+    protected final T defaultValue;
 
-    public AbstractProperty(String key) {
+    /**
+     * Constructs a new {@code AbstractProperty}.
+     * @param key The property key
+     * @param defaultValue The default value
+     * @since 5464
+     */
+    public AbstractProperty(String key, T defaultValue) {
         this.key = key;
+        this.defaultValue = defaultValue;
     }
 
+    /**
+     * Replies the property key.
+     * @return The property key
+     */
     public String getKey() {
         return key;
     }
 
+    /**
+     * Determines if this property is currently set in JOSM preferences.
+     * @return true if {@code Main.pref} contains this property.
+     */
     public boolean isSet() {
         return !Main.pref.get(key).isEmpty();
     }
 
-    public abstract T getDefaultValue();
+    /**
+     * Replies the default value of this property.
+     * @return The default value of this property
+     */
+    public T getDefaultValue() {
+        return defaultValue;
+    }
 
+    /**
+     * Removes this property from JOSM preferences (i.e replace it by its default value).
+     */
     public void remove() {
         Main.pref.put(getKey(), String.valueOf(getDefaultValue()));
     }
-
+    
+    /**
+     * Replies the value of this property.
+     * @return the value of this property
+     * @since 5464
+     */
+    public abstract T get();
+    
+    /**
+     * Sets this property to the specified value.
+     * @param value The new value of this property
+     * @return true if something has changed (i.e. value is different than before)
+     * @since 5464
+     */
+    public abstract boolean put(T value);
 }
Index: trunk/src/org/openstreetmap/josm/data/preferences/BooleanProperty.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/preferences/BooleanProperty.java	(revision 5463)
+++ trunk/src/org/openstreetmap/josm/data/preferences/BooleanProperty.java	(revision 5464)
@@ -4,24 +4,26 @@
 import org.openstreetmap.josm.Main;
 
+/**
+ * A property containing a {@code Boolean} value.
+ */
 public class BooleanProperty extends AbstractProperty<Boolean> {
 
-    protected final boolean defaultValue;
-
+    /**
+     * Constructs a new {@code BooleanProperty}.
+     * @param key The property key
+     * @param defaultValue The default value
+     */
     public BooleanProperty(String key, boolean defaultValue) {
-        super(key);
-        this.defaultValue = defaultValue;
+        super(key, defaultValue);
     }
 
-    public boolean get() {
+    @Override
+    public Boolean get() {
         return Main.pref.getBoolean(getKey(), defaultValue);
     }
 
-    public boolean put(boolean value) {
+    @Override
+    public boolean put(Boolean value) {
         return Main.pref.put(getKey(), value);
     }
-
-    @Override
-    public Boolean getDefaultValue() {
-        return defaultValue;
-    }
 }
Index: trunk/src/org/openstreetmap/josm/data/preferences/CachedProperty.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/preferences/CachedProperty.java	(revision 5463)
+++ trunk/src/org/openstreetmap/josm/data/preferences/CachedProperty.java	(revision 5464)
@@ -8,12 +8,12 @@
 public abstract class CachedProperty<T> extends AbstractProperty<T> implements PreferenceChangedListener {
 
-    protected final String defaultValue;
+    private final String defaultValueAsString;
     private T value;
     private int updateCount;
 
-    protected CachedProperty(String key, String defaultValue) {
-        super(key);
+    protected CachedProperty(String key, T defaultValue, String defaultValueAsString) {
+        super(key, defaultValue);
         Main.pref.addPreferenceChangeListener(this);
-        this.defaultValue = defaultValue;
+        this.defaultValueAsString = defaultValueAsString;
         updateValue();
     }
@@ -30,4 +30,5 @@
     protected abstract T fromString(String s);
 
+    @Override
     public T get() {
         return value;
@@ -40,15 +41,16 @@
     }
 
+    @Override
+    public final boolean put(T value) {
+        // Not used
+        throw new IllegalAccessError("You cannot use put(T). Use put(String) instead.");
+    }
+
     public int getUpdateCount() {
         return updateCount;
     }
 
-    @Override
-    public T getDefaultValue() {
-        return fromString(getDefaultValueAsString());
-    }
-
     public String getDefaultValueAsString() {
-        return defaultValue;
+        return defaultValueAsString;
     }
 
Index: trunk/src/org/openstreetmap/josm/data/preferences/CollectionProperty.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/preferences/CollectionProperty.java	(revision 5463)
+++ trunk/src/org/openstreetmap/josm/data/preferences/CollectionProperty.java	(revision 5464)
@@ -6,24 +6,26 @@
 import org.openstreetmap.josm.Main;
 
+/**
+ * A property containing a {@code Collection} of {@code String} as value.
+ */
 public class CollectionProperty extends AbstractProperty<Collection<String>> {
-    protected final Collection<String> defaultValue;
 
+    /**
+     * Constructs a new {@code CollectionProperty}.
+     * @param key The property key
+     * @param defaultValue The default value
+     */
     public CollectionProperty(String key, Collection<String> defaultValue) {
-        super(key);
-        this.defaultValue = defaultValue;
+        super(key, defaultValue);
     }
 
+    @Override
     public Collection<String> get() {
         return Main.pref.getCollection(getKey(), getDefaultValue());
     }
 
+    @Override
     public boolean put(Collection<String> value) {
         return Main.pref.putCollection(getKey(), value);
     }
-
-    @Override
-    public Collection<String> getDefaultValue() {
-        return defaultValue;
-    }
-
 }
Index: trunk/src/org/openstreetmap/josm/data/preferences/ColorProperty.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/preferences/ColorProperty.java	(revision 5464)
+++ trunk/src/org/openstreetmap/josm/data/preferences/ColorProperty.java	(revision 5464)
@@ -0,0 +1,55 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.data.preferences;
+
+import java.awt.Color;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.Preferences.ColorKey;
+
+/**
+ * A property containing a {@link Color} value.
+ * @since 5464
+ */
+public class ColorProperty extends AbstractProperty<Color> implements ColorKey {
+
+    private final String name;
+    
+    /**
+     * Constructs a new {@code ColorProperty}.
+     * @param colName The color name
+     * @param defaultValue The default value
+     */
+    public ColorProperty(String colName, Color defaultValue) {
+        super(getColorKey(colName), defaultValue);
+        this.name = colName;
+    }
+    
+    @Override
+    public Color get() {
+        return Main.pref.getColor(this);
+    }
+
+    @Override
+    public boolean put(Color value) {
+        return Main.pref.putColor(getColorKey(name), value);
+    }
+    
+    /**
+     * Replies the color key used in JOSM preferences for this property.
+     * @param colName The color name
+     * @return The color key for this property
+     */
+    public static String getColorKey(String colName) {
+        return colName == null ? null : colName.toLowerCase().replaceAll("[^a-z0-9]+",".");
+    }
+
+    @Override
+    public String getColorName() {
+        return name;
+    }
+
+    @Override
+    public String getSpecialName() {
+        return null;
+    }
+}
Index: trunk/src/org/openstreetmap/josm/data/preferences/IntegerProperty.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/preferences/IntegerProperty.java	(revision 5463)
+++ trunk/src/org/openstreetmap/josm/data/preferences/IntegerProperty.java	(revision 5464)
@@ -4,18 +4,25 @@
 import org.openstreetmap.josm.Main;
 
+/**
+ * A property containing an {@code Integer} value.
+ */
 public class IntegerProperty extends AbstractProperty<Integer> {
 
-    protected final int defaultValue;
-
+    /**
+     * Constructs a new {@code IntegerProperty}.
+     * @param key The property key
+     * @param defaultValue The default value
+     */
     public IntegerProperty(String key, int defaultValue) {
-        super(key);
-        this.defaultValue = defaultValue;
+        super(key, defaultValue);
     }
 
-    public int get() {
+    @Override
+    public Integer get() {
         return Main.pref.getInteger(getKey(), getDefaultValue());
     }
 
-    public boolean put(int value) {
+    @Override
+    public boolean put(Integer value) {
         return Main.pref.putInteger(getKey(), value);
     }
@@ -36,9 +43,3 @@
         return put(intVal);
     }
-
-    @Override
-    public Integer getDefaultValue() {
-        return defaultValue;
-    }
-
 }
Index: trunk/src/org/openstreetmap/josm/data/preferences/ParametrizedCollectionProperty.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/preferences/ParametrizedCollectionProperty.java	(revision 5463)
+++ 	(revision )
@@ -1,26 +1,0 @@
-// License: GPL. For details, see LICENSE file.
-package org.openstreetmap.josm.data.preferences;
-
-import java.util.Collection;
-
-import org.openstreetmap.josm.Main;
-
-public abstract class ParametrizedCollectionProperty {
-
-    private final Collection<String> defaultValue;
-
-    public ParametrizedCollectionProperty(Collection<String> defaultValue) {
-        this.defaultValue = defaultValue;
-    }
-
-    protected abstract String getKey(String... params);
-
-    public Collection<String> get(String... params) {
-        return Main.pref.getCollection(getKey(params), defaultValue);
-    }
-
-    public boolean put(Collection<String> value, String... params) {
-        return Main.pref.putCollection(getKey(params), value);
-    }
-
-}
Index: trunk/src/org/openstreetmap/josm/data/preferences/StringProperty.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/preferences/StringProperty.java	(revision 5463)
+++ trunk/src/org/openstreetmap/josm/data/preferences/StringProperty.java	(revision 5464)
@@ -4,25 +4,26 @@
 import org.openstreetmap.josm.Main;
 
+/**
+ * A property containing an {@code String} value.
+ */
 public class StringProperty extends AbstractProperty<String> {
 
-    protected final String defaultValue;
-
+    /**
+     * Constructs a new {@code StringProperty}.
+     * @param key The property key
+     * @param defaultValue The default value
+     */
     public StringProperty(String key, String defaultValue) {
-        super(key);
-        this.defaultValue = defaultValue;
+        super(key, defaultValue);
     }
 
+    @Override
     public String get() {
         return Main.pref.get(getKey(), getDefaultValue());
     }
 
+    @Override
     public boolean put(String value) {
         return Main.pref.put(getKey(), value);
     }
-
-    @Override
-    public String getDefaultValue() {
-        return defaultValue;
-    }
-
 }
Index: trunk/src/org/openstreetmap/josm/gui/conflict/ConflictColors.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/conflict/ConflictColors.java	(revision 5463)
+++ trunk/src/org/openstreetmap/josm/gui/conflict/ConflictColors.java	(revision 5464)
@@ -45,12 +45,15 @@
     }
 
+    @Override
     public String getColorName() {
         return name;
     }
 
-    public Color getDefault() {
+    @Override
+    public Color getDefaultValue() {
         return defaultColor;
     }
 
+    @Override
     public String getSpecialName() {
         return null;
Index: trunk/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java	(revision 5463)
+++ trunk/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java	(revision 5464)
@@ -35,4 +35,5 @@
 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
 import org.openstreetmap.josm.data.imagery.OffsetBookmark;
+import org.openstreetmap.josm.data.preferences.ColorProperty;
 import org.openstreetmap.josm.data.preferences.IntegerProperty;
 import org.openstreetmap.josm.gui.MenuScroller;
@@ -43,18 +44,15 @@
 public abstract class ImageryLayer extends Layer {
 
+    public static final ColorProperty PROP_FADE_COLOR = new ColorProperty(marktr("Imagery fade"), Color.white);
     public static final IntegerProperty PROP_FADE_AMOUNT = new IntegerProperty("imagery.fade_amount", 0);
     public static final IntegerProperty PROP_SHARPEN_LEVEL = new IntegerProperty("imagery.sharpen_level", 0);
 
     public static Color getFadeColor() {
-        return Main.pref.getColor(marktr("Imagery fade"), Color.white);
+        return PROP_FADE_COLOR.get();
     }
 
     public static Color getFadeColorWithAlpha() {
-        Color c = getFadeColor();
+        Color c = PROP_FADE_COLOR.get();
         return new Color(c.getRed(),c.getGreen(),c.getBlue(),PROP_FADE_AMOUNT.get()*255/100);
-    }
-
-    public static void setFadeColor(Color color) {
-        Main.pref.putColor("imagery.fade", color);
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java	(revision 5463)
+++ trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java	(revision 5464)
@@ -102,8 +102,12 @@
             TemplateEntryProperty result = cache.get(key);
             if (result == null) {
-                String defaultValue = layerName == null?getDefaultLabelPattern():"";
-                TemplateEntryProperty parent = layerName == null?null:forMarker(null);
-                result = new TemplateEntryProperty(key, defaultValue, parent);
-                cache.put(key, result);
+                String defaultValue = layerName == null ? getDefaultLabelPattern():"";
+                TemplateEntryProperty parent = layerName == null ? null : forMarker(null);
+                try {
+                    result = new TemplateEntryProperty(key, defaultValue, parent);
+                    cache.put(key, result);
+                } catch (ParseError e) {
+                    System.out.println(String.format("Unable to parse template engine pattern '%s' for property %s", defaultValue, key));
+                }
             }
             return result;
@@ -118,7 +122,11 @@
             if (result == null) {
                 String defaultValue = layerName == null?"?{ '{name}' | '{desc}' | '{" + Marker.MARKER_FORMATTED_OFFSET + "}' }":"";
-                TemplateEntryProperty parent = layerName == null?null:forAudioMarker(null);
-                result = new TemplateEntryProperty(key, defaultValue, parent);
-                cache.put(key, result);
+                TemplateEntryProperty parent = layerName == null ? null : forAudioMarker(null);
+                try {
+                    result = new TemplateEntryProperty(key, defaultValue, parent);
+                    cache.put(key, result);
+                } catch (ParseError e) {
+                    System.out.println(String.format("Unable to parse template engine pattern '%s' for property %s", defaultValue, key));
+                }
             }
             return result;
@@ -128,6 +136,6 @@
 
 
-        private TemplateEntryProperty(String key, String defaultValue, TemplateEntryProperty parent) {
-            super(key, defaultValue);
+        private TemplateEntryProperty(String key, String defaultValue, TemplateEntryProperty parent) throws ParseError {
+            super(key, new TemplateParser(defaultValue).parse(), defaultValue);
             this.parent = parent;
             updateValue(); // Needs to be called because parent wasn't know in super constructor
@@ -140,5 +148,5 @@
             } catch (ParseError e) {
                 System.out.println(String.format("Unable to parse template engine pattern '%s' for property %s. Using default ('%s') instead",
-                        s, getKey(), defaultValue));
+                        s, getKey(), super.getDefaultValueAsString()));
                 return getDefaultValue();
             }
Index: trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreference.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreference.java	(revision 5463)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreference.java	(revision 5464)
@@ -26,5 +26,4 @@
 import java.util.HashSet;
 import java.util.List;
-import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
@@ -129,5 +128,5 @@
         final JPanel p = new JPanel(new GridBagLayout());
 
-        this.colFadeColor = ImageryLayer.getFadeColor();
+        this.colFadeColor = ImageryLayer.PROP_FADE_COLOR.get();
         this.btnFadeColor = new JButton();
 
@@ -196,6 +195,6 @@
         JLabel labelEast = new JLabel(tr("% of east:"));
         JLabel labelNorth = new JLabel(tr("% of north:"));
-        spinEast = new JSpinner(new SpinnerNumberModel(WMSLayer.PROP_OVERLAP_EAST.get(), 1, 50, 1));
-        spinNorth = new JSpinner(new SpinnerNumberModel(WMSLayer.PROP_OVERLAP_NORTH.get(), 1, 50, 1));
+        spinEast = new JSpinner(new SpinnerNumberModel(WMSLayer.PROP_OVERLAP_EAST.get().intValue(), 1, 50, 1));
+        spinNorth = new JSpinner(new SpinnerNumberModel(WMSLayer.PROP_OVERLAP_NORTH.get().intValue(), 1, 50, 1));
 
         JPanel overlapPanel = new JPanel(new FlowLayout());
@@ -211,5 +210,5 @@
         p.add(Box.createHorizontalGlue(), GBC.eol().fill(GBC.HORIZONTAL));
         JLabel labelSimConn = new JLabel(tr("Simultaneous connections"));
-        spinSimConn = new JSpinner(new SpinnerNumberModel(WMSLayer.PROP_SIMULTANEOUS_CONNECTIONS.get(), 1, 30, 1));
+        spinSimConn = new JSpinner(new SpinnerNumberModel(WMSLayer.PROP_SIMULTANEOUS_CONNECTIONS.get().intValue(), 1, 30, 1));
         JPanel overlapPanelSimConn = new JPanel(new FlowLayout(FlowLayout.LEFT));
         overlapPanelSimConn.add(labelSimConn);
@@ -352,5 +351,5 @@
 
         ImageryLayer.PROP_FADE_AMOUNT.put(this.fadeAmount.getValue());
-        ImageryLayer.setFadeColor(this.colFadeColor);
+        ImageryLayer.PROP_FADE_COLOR.put(this.colFadeColor);
         ImageryLayer.PROP_SHARPEN_LEVEL.put(sharpen.getSelectedIndex());
 
