Ignore:
Timestamp:
2016-08-17T09:18:31+02:00 (8 years ago)
Author:
Don-vip
Message:

see #13309 - Caching and notifying preferences (patch by michael2402) - gsoc-core

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/preferences/DoubleProperty.java

    r9818 r10824  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.data.preferences;
    3 
    4 import org.openstreetmap.josm.Main;
    53
    64/**
     
    86 * @since 3246
    97 */
    10 public class DoubleProperty extends AbstractProperty<Double> {
     8public class DoubleProperty extends AbstractToStringProperty<Double> {
    119
    1210    /**
     
    2119    @Override
    2220    public Double get() {
    23         return Main.pref.getDouble(getKey(), getDefaultValue());
     21        // Removing this implementation breaks binary compatibility
     22        return super.get();
    2423    }
    2524
    2625    @Override
    2726    public boolean put(Double value) {
    28         return Main.pref.putDouble(getKey(), value);
     27        // Removing this implementation breaks binary compatibility
     28        return super.put(value);
     29    }
     30
     31    @Override
     32    protected Double fromString(String string) {
     33        try {
     34            return Double.valueOf(string);
     35        } catch (NumberFormatException e) {
     36            throw new InvalidPreferenceValueException(e);
     37        }
     38    }
     39
     40    @Override
     41    protected String toString(Double t) {
     42        return t.toString();
    2943    }
    3044
Note: See TracChangeset for help on using the changeset viewer.