source: josm/trunk/src/org/openstreetmap/josm/data/preferences/AbstractProperty.java @ 5241

Revision 4932, 639 bytes checked in by stoecker, 3 months ago (diff)

fix 6833 - use WindowGeometry for toggle dialogs and mainwindow replacing old custom methods, improve dual screen handling

  • Property svn:eol-style set to native
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.preferences;
3
4import org.openstreetmap.josm.Main;
5
6/**
7 * captures the common functionality of preference properties
8 */
9public abstract class AbstractProperty<T> {
10    protected final String key;
11
12    public AbstractProperty(String key) {
13        this.key = key;
14    }
15
16    public String getKey() {
17        return key;
18    }
19
20    public boolean isSet() {
21        return !Main.pref.get(key).isEmpty();
22    }
23
24    public abstract T getDefaultValue();
25
26    public void remove() {
27        Main.pref.put(getKey(), String.valueOf(getDefaultValue()));
28    }
29
30}
Note: See TracBrowser for help on using the repository browser.