Changeset 13250 in josm
- Timestamp:
- 2017-12-28T00:53:58+01:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java
r13206 r13250 76 76 String icon = info.getIcon(); 77 77 if (icon != null) { 78 new ImageProvider(icon).setOptional(true).getResourceAsync().thenAccept (result -> {78 new ImageProvider(icon).setOptional(true).getResourceAsync().thenAcceptAsync(result -> { 79 79 if (result != null) { 80 80 GuiHelper.runInEDT(() -> result.attachImageIcon(this)); -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/MapImage.java
r12722 r13250 139 139 .setHeight(height) 140 140 .setOptional(true) 141 .getAsync().thenAccept (result -> {141 .getAsync().thenAcceptAsync(result -> { 142 142 synchronized (this) { 143 143 if (result == null) { -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java
r13130 r13250 217 217 imgProv.setArchive(arch); 218 218 imgProv.setOptional(true); 219 imgProv.getResourceAsync().thenAccept (result -> {219 imgProv.getResourceAsync().thenAcceptAsync(result -> { 220 220 if (result != null) { 221 221 GuiHelper.runInEDT(() -> result.attachImageIcon(this)); -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r13186 r13250 631 631 632 632 /** 633 * Determines if this icon is located on a remote location (http, https, wiki). 634 * @return {@code true} if this icon is located on a remote location (http, https, wiki) 635 * @since 13250 636 */ 637 public boolean isRemote() { 638 return name.startsWith(HTTP_PROTOCOL) || name.startsWith(HTTPS_PROTOCOL) || name.startsWith(WIKI_PROTOCOL); 639 } 640 641 /** 633 642 * Execute the image request and scale result. 634 643 * @return the requested image or null if the request failed … … 655 664 */ 656 665 public CompletableFuture<ImageIcon> getAsync() { 657 return name.startsWith(HTTP_PROTOCOL) || name.startsWith(WIKI_PROTOCOL)666 return isRemote() 658 667 ? CompletableFuture.supplyAsync(this::get, IMAGE_FETCHER) 659 668 : CompletableFuture.completedFuture(get()); … … 699 708 */ 700 709 public CompletableFuture<ImageResource> getResourceAsync() { 701 return name.startsWith(HTTP_PROTOCOL) || name.startsWith(WIKI_PROTOCOL)710 return isRemote() 702 711 ? CompletableFuture.supplyAsync(this::getResource, IMAGE_FETCHER) 703 712 : CompletableFuture.completedFuture(getResource());
Note:
See TracChangeset
for help on using the changeset viewer.