Last change
on this file since 5028 was 4932, checked in by stoecker, 12 years ago |
fix 6833 - use WindowGeometry for toggle dialogs and mainwindow replacing old custom methods, improve dual screen handling
|
-
Property svn:eol-style
set to
native
|
File size:
639 bytes
|
Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.data.preferences;
|
---|
3 |
|
---|
4 | import org.openstreetmap.josm.Main;
|
---|
5 |
|
---|
6 | /**
|
---|
7 | * captures the common functionality of preference properties
|
---|
8 | */
|
---|
9 | public 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.