Ignore:
Timestamp:
2019-07-06T22:15:55+02:00 (5 years ago)
Author:
Don-vip
Message:

fix #13458 - display external resources icons in the preferences

File:
1 edited

Legend:

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

    r15099 r15211  
    88import java.util.List;
    99import java.util.Map;
     10import java.util.Optional;
    1011import java.util.Set;
    1112import java.util.stream.Collectors;
     
    4445     * @return map (key=value)
    4546     */
    46     public abstract Map<String, String> serialize(SourceEntry entry);
     47    public Map<String, String> serialize(SourceEntry entry) {
     48        Map<String, String> res = new HashMap<>();
     49        res.put("url", entry.url);
     50        res.put("title", entry.title == null ? "" : entry.title);
     51        return res;
     52    }
    4753
    4854    /**
     
    5157     * @return source entry
    5258     */
    53     public abstract SourceEntry deserialize(Map<String, String> entryStr);
     59    public SourceEntry deserialize(Map<String, String> entryStr) {
     60        return new SourceEntry(type,
     61                entryStr.get("url"),
     62                entryStr.get("name"),
     63                entryStr.get("title"),
     64                Optional.ofNullable(entryStr.get("active")).map(Boolean::parseBoolean).orElse(true));
     65    }
    5466
    5567    /**
Note: See TracChangeset for help on using the changeset viewer.