Changeset 12634 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2017-08-24T15:54:00+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/Preferences.java
r12620 r12634 235 235 236 236 /** 237 * Constructs a new {@code Preferences}. 238 */ 239 public Preferences() { 240 // Default constructor 241 } 242 243 /** 244 * Constructs a new {@code Preferences} from an existing instance. 245 * @param pref existing preferences to copy 246 * @since 12634 247 */ 248 public Preferences(Preferences pref) { 249 settingsMap.putAll(pref.settingsMap); 250 defaultsMap.putAll(pref.defaultsMap); 251 colornames.putAll(pref.colornames); 252 } 253 254 /** 237 255 * Adds a new preferences listener. 238 256 * @param listener The listener to add -
trunk/src/org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java
r12620 r12634 16 16 import java.util.Set; 17 17 import java.util.TreeSet; 18 import java.util.concurrent.ExecutorService; 18 19 19 20 import org.openstreetmap.josm.Main; … … 33 34 public class ImageryLayerInfo { 34 35 36 /** Unique instance */ 35 37 public static final ImageryLayerInfo instance = new ImageryLayerInfo(); 36 38 /** List of all usable layers */ … … 61 63 } 62 64 65 /** 66 * Constructs a new {@code ImageryLayerInfo} from an existing one. 67 * @param info info to copy 68 */ 63 69 public ImageryLayerInfo(ImageryLayerInfo info) { 64 70 layers.addAll(info.layers); 65 71 } 66 72 73 /** 74 * Clear the lists of layers. 75 */ 67 76 public void clear() { 68 77 layers.clear(); … … 88 97 Collections.sort(layers); 89 98 } 90 loadDefaults(false, true, fastFail);99 loadDefaults(false, null, fastFail); 91 100 } 92 101 … … 95 104 * 96 105 * The data is downloaded from the JOSM website (or loaded from cache). 97 * Entries marked as "default" are added to the user selection, if not 98 * already present. 106 * Entries marked as "default" are added to the user selection, if not already present. 99 107 * 100 108 * @param clearCache if true, clear the cache and start a fresh download. 101 * @param quiet whether not the loadingshould be performed using a {@link PleaseWaitRunnable} in the background109 * @param worker executor service which will perform the loading. If null, it should be performed using a {@link PleaseWaitRunnable} in the background 102 110 * @param fastFail whether opening HTTP connections should fail fast, see {@link ImageryReader#setFastFail(boolean)} 103 */ 104 public void loadDefaults(boolean clearCache, boolean quiet, boolean fastFail) { 111 * @since 12634 112 */ 113 public void loadDefaults(boolean clearCache, ExecutorService worker, boolean fastFail) { 105 114 final DefaultEntryLoader loader = new DefaultEntryLoader(clearCache, fastFail); 106 if ( quiet) {115 if (worker == null) { 107 116 loader.realRun(); 108 117 loader.finish(); 109 118 } else { 110 Main.worker.execute(new DefaultEntryLoader(clearCache, fastFail));119 worker.execute(loader); 111 120 } 112 121 } … … 327 336 } 328 337 338 /** 339 * Add a new imagery entry. 340 * @param info imagery entry to add 341 */ 329 342 public void add(ImageryInfo info) { 330 343 layers.add(info); 331 344 } 332 345 346 /** 347 * Remove an imagery entry. 348 * @param info imagery entry to remove 349 */ 333 350 public void remove(ImageryInfo info) { 334 351 layers.remove(info); 335 352 } 336 353 354 /** 355 * Save the list of imagery entries to preferences. 356 */ 337 357 public void save() { 338 358 List<ImageryPreferenceEntry> entries = new ArrayList<>();
Note:
See TracChangeset
for help on using the changeset viewer.