Changeset 13252 in josm


Ignore:
Timestamp:
2017-12-28T03:04:16+01:00 (7 years ago)
Author:
Don-vip
Message:

see #15654 - fix icon flickering (regression from r13250)

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java

    r13250 r13252  
    7676        String icon = info.getIcon();
    7777        if (icon != null) {
    78             new ImageProvider(icon).setOptional(true).getResourceAsync().thenAcceptAsync(result -> {
     78            new ImageProvider(icon).setOptional(true).getResourceAsync(result -> {
    7979                if (result != null) {
    8080                    GuiHelper.runInEDT(() -> result.attachImageIcon(this));
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/MapImage.java

    r13250 r13252  
    139139                .setHeight(height)
    140140                .setOptional(true)
    141                 .getAsync().thenAcceptAsync(result -> {
     141                .getAsync(result -> {
    142142                    synchronized (this) {
    143143                        if (result == null) {
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java

    r13250 r13252  
    217217        imgProv.setArchive(arch);
    218218        imgProv.setOptional(true);
    219         imgProv.getResourceAsync().thenAcceptAsync(result -> {
     219        imgProv.getResourceAsync(result -> {
    220220            if (result != null) {
    221221                GuiHelper.runInEDT(() -> result.attachImageIcon(this));
  • trunk/src/org/openstreetmap/josm/tools/ImageProvider.java

    r13250 r13252  
    4646import java.util.concurrent.ExecutorService;
    4747import java.util.concurrent.Executors;
     48import java.util.function.Consumer;
    4849import java.util.regex.Matcher;
    4950import java.util.regex.Pattern;
     
    659660     *
    660661     * This method returns immediately and runs the image request asynchronously.
     662     * @param action the action that will deal with the image
    661663     *
    662664     * @return the future of the requested image
    663      * @since 10714
    664      */
    665     public CompletableFuture<ImageIcon> getAsync() {
     665     * @since 13252
     666     */
     667    public CompletableFuture<Void> getAsync(Consumer<? super ImageIcon> action) {
    666668        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);
    669671    }
    670672
     
    703705     *
    704706     * This method returns immediately and runs the image request asynchronously.
     707     * @param action the action that will deal with the image
    705708     *
    706709     * @return the future of the requested image
    707      * @since 10714
    708      */
    709     public CompletableFuture<ImageResource> getResourceAsync() {
     710     * @since 13252
     711     */
     712    public CompletableFuture<Void> getResourceAsync(Consumer<? super ImageResource> action) {
    710713        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);
    713716    }
    714717
Note: See TracChangeset for help on using the changeset viewer.