Replaced CardStorage references from MageFrame with CardRepository

This commit is contained in:
North 2012-10-20 21:24:36 +03:00
parent 4a4ed72324
commit 56a11f4da2
6 changed files with 46 additions and 75 deletions

View file

@ -1,6 +1,5 @@
package org.mage.plugins.card;
import mage.cards.Card;
import mage.cards.MagePermanent;
import mage.cards.action.ActionCallback;
import mage.interfaces.plugin.CardPlugin;
@ -21,7 +20,6 @@ import org.mage.plugins.card.dl.DownloadJob;
import org.mage.plugins.card.dl.Downloader;
import org.mage.plugins.card.dl.sources.GathererSets;
import org.mage.plugins.card.dl.sources.GathererSymbols;
import org.mage.plugins.card.images.DownloadPictures;
import org.mage.plugins.card.images.ImageCache;
import org.mage.plugins.card.info.CardInfoPaneImpl;
@ -421,22 +419,6 @@ public class CardPluginImpl implements CardPlugin {
}
}
@Override
public boolean newImages(Set<Card> allCards, String imagesPath) {
return DownloadPictures.checkForNewCards(allCards, imagesPath);
}
/**
* Download images.
*
* @param allCards Set of cards to download images for.
* @param imagesPath Path to check in and store images to. Can be null, in such case default path should be used.
*/
@Override
public void downloadImages(Set<Card> allCards, String imagesPath) {
DownloadPictures.startDownload(null, allCards, imagesPath);
}
/**
* Download various symbols (mana, tap, set).
*

View file

@ -21,7 +21,9 @@ import javax.imageio.ImageWriteParam;
import javax.imageio.ImageWriter;
import javax.imageio.stream.FileImageOutputStream;
import javax.swing.*;
import java.awt.*;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
@ -32,7 +34,7 @@ import java.net.URL;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.regex.Pattern;
@ -67,7 +69,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
startDownload(null, null, null);
}
public static void startDownload(JFrame frame, Set<Card> allCards, String imagesPath) {
public static void startDownload(JFrame frame, List<Card> allCards, String imagesPath) {
ArrayList<CardInfo> cards = getNeededCards(allCards, imagesPath);
/*
@ -207,7 +209,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
dlg = new JOptionPane(p0, JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE, null, options, options[1]);
}
public static boolean checkForNewCards(Set<Card> allCards, String imagesPath) {
public static boolean checkForNewCards(List<Card> allCards, String imagesPath) {
TFile file;
for (Card card : allCards) {
if (card.getCardNumber() > 0 && !card.getExpansionSetCode().isEmpty()) {
@ -221,7 +223,7 @@ public class DownloadPictures extends DefaultBoundedRangeModel implements Runnab
return false;
}
private static ArrayList<CardInfo> getNeededCards(Set<Card> allCards, String imagesPath) {
private static ArrayList<CardInfo> getNeededCards(List<Card> allCards, String imagesPath) {
ArrayList<CardInfo> cardsToDownload = new ArrayList<CardInfo>();