Changeset 13252 in josm
- Timestamp:
- 2017-12-28T03:04:16+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
r13250 r13252 76 76 String icon = info.getIcon(); 77 77 if (icon != null) { 78 new ImageProvider(icon).setOptional(true).getResourceAsync( ).thenAcceptAsync(result -> {78 new ImageProvider(icon).setOptional(true).getResourceAsync(result -> { 79 79 if (result != null) { 80 80 GuiHelper.runInEDT(() -> result.attachImageIcon(this)); -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/MapImage.java
r13250 r13252 139 139 .setHeight(height) 140 140 .setOptional(true) 141 .getAsync( ).thenAcceptAsync(result -> {141 .getAsync(result -> { 142 142 synchronized (this) { 143 143 if (result == null) { -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java
r13250 r13252 217 217 imgProv.setArchive(arch); 218 218 imgProv.setOptional(true); 219 imgProv.getResourceAsync( ).thenAcceptAsync(result -> {219 imgProv.getResourceAsync(result -> { 220 220 if (result != null) { 221 221 GuiHelper.runInEDT(() -> result.attachImageIcon(this)); -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r13250 r13252 46 46 import java.util.concurrent.ExecutorService; 47 47 import java.util.concurrent.Executors; 48 import java.util.function.Consumer; 48 49 import java.util.regex.Matcher; 49 50 import java.util.regex.Pattern; … … 659 660 * 660 661 * This method returns immediately and runs the image request asynchronously. 662 * @param action the action that will deal with the image 661 663 * 662 664 * @return the future of the requested image 663 * @since 1 0714664 */ 665 public CompletableFuture< ImageIcon> getAsync() {665 * @since 13252 666 */ 667 public CompletableFuture<Void> getAsync(Consumer<? super ImageIcon> action) { 666 668 return isRemote() 667 ? CompletableFuture.supplyAsync(this::get, IMAGE_FETCHER) 668 : CompletableFuture.completedFuture(get()) ;669 ? CompletableFuture.supplyAsync(this::get, IMAGE_FETCHER).thenAcceptAsync(action) 670 : CompletableFuture.completedFuture(get()).thenAccept(action); 669 671 } 670 672 … … 703 705 * 704 706 * This method returns immediately and runs the image request asynchronously. 707 * @param action the action that will deal with the image 705 708 * 706 709 * @return the future of the requested image 707 * @since 1 0714708 */ 709 public CompletableFuture< ImageResource> getResourceAsync() {710 * @since 13252 711 */ 712 public CompletableFuture<Void> getResourceAsync(Consumer<? super ImageResource> action) { 710 713 return isRemote() 711 ? CompletableFuture.supplyAsync(this::getResource, IMAGE_FETCHER) 712 : CompletableFuture.completedFuture(getResource()) ;714 ? CompletableFuture.supplyAsync(this::getResource, IMAGE_FETCHER).thenAcceptAsync(action) 715 : CompletableFuture.completedFuture(getResource()).thenAccept(action); 713 716 } 714 717
Note:
See TracChangeset
for help on using the changeset viewer.