Ignore:
Timestamp:
2017-09-14T01:59:34+02:00 (7 years ago)
Author:
bastiK
Message:

see #15229 - extract "struct" handling from Preference to StructUtils

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/imagery/OffsetBookmark.java

    r12846 r12851  
    1212
    1313import org.openstreetmap.josm.Main;
    14 import org.openstreetmap.josm.data.Preferences;
    15 import org.openstreetmap.josm.data.Preferences.pref;
    16 import org.openstreetmap.josm.data.Preferences.writeExplicitly;
     14import org.openstreetmap.josm.data.StructUtils;
     15import org.openstreetmap.josm.data.StructUtils.StructEntry;
     16import org.openstreetmap.josm.data.StructUtils.WriteExplicitly;
    1717import org.openstreetmap.josm.data.coor.EastNorth;
    1818import org.openstreetmap.josm.data.coor.LatLon;
     
    3434    private static final List<OffsetBookmark> allBookmarks = new ArrayList<>();
    3535
    36     @pref private String projection_code;
    37     @pref private String imagery_name;
    38     @pref private String name;
    39     @pref @writeExplicitly private double dx, dy;
    40     @pref private double center_lon, center_lat;
     36    @StructEntry private String projection_code;
     37    @StructEntry private String imagery_name;
     38    @StructEntry private String name;
     39    @StructEntry @WriteExplicitly private double dx, dy;
     40    @StructEntry private double center_lon, center_lat;
    4141
    4242    public boolean isUsable(ImageryLayer layer) {
     
    167167
    168168    public static void loadBookmarks() {
    169         List<OffsetBookmark> bookmarks = Main.pref.getListOfStructs("imagery.offsetbookmarks", null, OffsetBookmark.class);
     169        List<OffsetBookmark> bookmarks = StructUtils.getListOfStructs(
     170                Config.getPref(), "imagery.offsetbookmarks", null, OffsetBookmark.class);
    170171        if (bookmarks == null) {
    171172            loadBookmarksOld();
     
    184185
    185186    public static void saveBookmarks() {
    186         Main.pref.putListOfStructs("imagery.offsetbookmarks", allBookmarks, OffsetBookmark.class);
     187        StructUtils.putListOfStructs(Config.getPref(), "imagery.offsetbookmarks", allBookmarks, OffsetBookmark.class);
    187188    }
    188189
     
    276277     */
    277278    public Map<String, String> toPropertiesMap() {
    278         return Preferences.serializeStruct(this, OffsetBookmark.class);
     279        return StructUtils.serializeStruct(this, OffsetBookmark.class);
    279280    }
    280281
     
    287288     */
    288289    public static OffsetBookmark fromPropertiesMap(Map<String, String> properties) {
    289         return Preferences.deserializeStruct(properties, OffsetBookmark.class);
     290        return StructUtils.deserializeStruct(properties, OffsetBookmark.class);
    290291    }
    291292}
Note: See TracChangeset for help on using the changeset viewer.