invalidate the image cache after downloading new images so the new images can be loaded if they were previously cached as not found

This commit is contained in:
myk
2013-03-20 17:13:19 +00:00
parent 31756b86cf
commit fd90002a60
2 changed files with 9 additions and 2 deletions

View File

@@ -83,6 +83,11 @@ public class ImageCache {
e.printStackTrace();
}
}
public static void clear() {
CACHE.invalidateAll();
}
/**
* retrieve an image from the cache. returns null if the image is not found in the cache
* and cannot be loaded from disk. pass -1 for width and/or height to avoid resizing in that dimension.

View File

@@ -55,6 +55,7 @@ import org.apache.commons.lang3.tuple.Pair;
import com.esotericsoftware.minlog.Log;
import forge.Command;
import forge.ImageCache;
import forge.error.BugReporter;
import forge.gui.SOverlayUtils;
import forge.gui.toolbox.FButton;
@@ -70,12 +71,14 @@ import forge.util.MyRandom;
@SuppressWarnings("serial")
public abstract class GuiDownloader extends DefaultBoundedRangeModel implements Runnable {
public static final Proxy.Type[] TYPES = Proxy.Type.values(); /** */
public static final Proxy.Type[] TYPES = Proxy.Type.values();
// Actions and commands
private final ActionListener actStartDownload = new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
// invalidate image cache so newly downloaded images will be loaded
ImageCache.clear();
new Thread(GuiDownloader.this).start();
btnStart.setEnabled(false);
}
@@ -374,5 +377,4 @@ public abstract class GuiDownloader extends DefaultBoundedRangeModel implements
}
}
}
}