Changeset 18827 in osm for applications/editors


Ignore:
Timestamp:
2009-11-27T21:45:13+01:00 (15 years ago)
Author:
stoecker
Message:

fix josm 3681 - double values in prefs not shown

Location:
applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/DoubleConfigurer.java

    r13497 r18827  
    1414 *
    1515 * You should have received a copy of the GNU Library General Public
    16  * License along with this library; if not, copies are available 
     16 * License along with this library; if not, copies are available
    1717 * at http://www.opensource.org.
    1818 */
     
    2424public class DoubleConfigurer extends StringConfigurer {
    2525
    26   public DoubleConfigurer() {
    27     super();
    28   }
     26    public DoubleConfigurer() {
     27        super();
     28    }
    2929
    30   public DoubleConfigurer(String key, String name) {
    31     this(key, name, new Double(0));
    32   }
     30    public DoubleConfigurer(String key, String name) {
     31        this(key, name, new Double(0));
     32    }
    3333
    34   public DoubleConfigurer(String key, String name, Double val) {
    35     super(key, name, val == null ? null : val.toString());
    36   }
     34    public DoubleConfigurer(String key, String name, Double val) {
     35        super(key, name, val == null ? null : val.toString());
     36    }
    3737
    38   public void setValue(String s) {
    39     Double d = null;
    40     try {
    41       d = Double.valueOf(s);
     38    public void setValue(String s) {
     39        Double d = null;
     40        try {
     41            d = Double.valueOf(s);
     42        }
     43        catch (NumberFormatException e) {
     44            d = null;
     45        }
     46        if (d != null)
     47            setValue(d);
    4248    }
    43     catch (NumberFormatException e) {
    44       d = null;
     49
     50    public void setValue(Object o) {
     51        if (!noUpdate && nameField != null && o != null) {
     52            nameField.setText(o.toString());
     53        }
     54        super.setValue(o);
    4555    }
    46     if (d != null) {
    47       setValue(d);
    48       if (!noUpdate && nameField != null) {
    49         nameField.setText(d.toString());
    50       }
     56
     57    public String getValueString() {
     58        if (value == null || value.equals("")) {
     59            return null;
     60        }
     61        return value.toString();
    5162    }
    52   }
    53 
    54   public String getValueString() {
    55     if (value == null || value.equals("")) {
    56       return null;
    57     }
    58     return value.toString();
    59   }
    6063}
  • applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/IntConfigurer.java

    r13497 r18827  
    3939  }
    4040
    41   public void setValue(String s) {
    42     Integer i = null;
    43     try {
    44       i = Integer.valueOf(s);
    45     }
    46     catch (NumberFormatException e) {
    47       i = null;
    48     }
    49     if (i != null) {
    50       setValue(i);
    51     }
    52   }
    53  
    5441  public int getIntValue(int defaultValue) {
    5542    if (getValue() instanceof Integer) {
  • applications/editors/josm/plugins/lakewalker/src/org/openstreetmap/josm/plugins/lakewalker/LakewalkerPreferences.java

    r13497 r18827  
    9292        landsatResConfig.setValue(Main.pref.getInteger(PREF_LANDSAT_RES, 4000));
    9393        landsatSizeConfig.setValue(Main.pref.getInteger(PREF_LANDSAT_SIZE, 2000));
     94System.out.println("set");
    9495        eastOffsetConfig.setValue(Main.pref.getDouble(PREF_EAST_OFFSET, 0.0));
    9596        northOffsetConfig.setValue(Main.pref.getDouble(PREF_NORTH_OFFSET, 0.0));
Note: See TracChangeset for help on using the changeset viewer.