Changeset 12600 in josm for trunk/src


Ignore:
Timestamp:
2017-08-14T13:32:37+02:00 (7 years ago)
Author:
bastiK
Message:

see #14524 - use inteface SessionAwareReadApply

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/imagery/TileSourceDisplaySettings.java

    r12134 r12600  
    22package org.openstreetmap.josm.gui.layer.imagery;
    33
     4import java.util.HashMap;
    45import java.util.Map;
    56import java.util.concurrent.CopyOnWriteArrayList;
     
    1112import org.openstreetmap.josm.data.preferences.BooleanProperty;
    1213import org.openstreetmap.josm.gui.layer.AbstractTileSourceLayer;
     14import org.openstreetmap.josm.io.session.SessionAwareReadApply;
    1315import org.openstreetmap.josm.tools.CheckParameterUtil;
    1416import org.openstreetmap.josm.tools.JosmRuntimeException;
     
    2224 * @since 10568
    2325 */
    24 public class TileSourceDisplaySettings {
     26public class TileSourceDisplaySettings implements SessionAwareReadApply {
    2527    /**
    2628     * A string returned by {@link DisplaySettingsChangeEvent#getChangedSetting()} if auto load was changed.
     
    249251     * Stores the current settings object to the given hashmap.
    250252     * The offset data is not stored and needs to be handled separately.
    251      * @param data The map to store the settings to.
    252      * @see #loadFrom(Map)
     253     * @see #applyFromPropertiesMap(Map)
    253254     * @see OffsetBookmark#toPropertiesMap()
    254255     */
    255     public void storeTo(Map<String, String> data) {
     256    @Override
     257    public Map<String, String> toPropertiesMap() {
     258        Map<String, String> data = new HashMap<>();
    256259        data.put(AUTO_LOAD, Boolean.toString(autoLoad));
    257260        data.put(AUTO_ZOOM, Boolean.toString(autoZoom));
    258261        data.put(SHOW_ERRORS, Boolean.toString(showErrors));
     262        return data;
    259263    }
    260264
     
    263267     * The offset data is not loaded and needs to be handled separately.
    264268     * @param data The data
    265      * @see #storeTo(Map)
     269     * @see #toPropertiesMap()
    266270     * @see OffsetBookmark#fromPropertiesMap(java.util.Map)
    267271     */
    268     public void loadFrom(Map<String, String> data) {
     272    @Override
     273    public void applyFromPropertiesMap(Map<String, String> data) {
    269274        try {
    270275            String doAutoLoad = data.get(AUTO_LOAD);
  • trunk/src/org/openstreetmap/josm/io/session/ImagerySessionExporter.java

    r12594 r12600  
    8686        Map<String, String> data = new LinkedHashMap<>(Preferences.serializeStruct(e, ImageryPreferenceEntry.class));
    8787        if (layer instanceof AbstractTileSourceLayer) {
    88             ((AbstractTileSourceLayer<?>) layer).getDisplaySettings().storeTo(data);
     88            data.putAll(((AbstractTileSourceLayer<?>) layer).getDisplaySettings().toPropertiesMap());
    8989        }
    9090        addAttributes(layerElem, data, support);
  • trunk/src/org/openstreetmap/josm/io/session/ImagerySessionImporter.java

    r12594 r12600  
    4646        if (layer instanceof AbstractTileSourceLayer) {
    4747            AbstractTileSourceLayer<?> tsLayer = (AbstractTileSourceLayer<?>) layer;
    48             tsLayer.getDisplaySettings().loadFrom(attributes);
     48            tsLayer.getDisplaySettings().applyFromPropertiesMap(attributes);
    4949            Element offsetEl = getFirstElementByTagName(elem, "offset");
    5050            if (offsetEl != null) {
Note: See TracChangeset for help on using the changeset viewer.