Changed set selection for tournament boosters to only show sets with boosters. Closes issue #91.

This commit is contained in:
LevelX2 2013-01-02 15:46:21 +01:00
parent 94fd2429d1
commit 5517474c90
3 changed files with 21 additions and 4 deletions

View file

@ -362,7 +362,7 @@ public class NewTournamentDialog extends MageDialog {
}
while (packs.size() < numPacks) {
JComboBox pack = new JComboBox();
pack.setModel(new DefaultComboBoxModel(Sets.getInstance().getSortedByReleaseDate()));
pack.setModel(new DefaultComboBoxModel(Sets.getInstance().getWithBoosterSortedByReleaseDate()));
pnlPacks.add(pack);
packs.add(pack);
pack.addActionListener(new java.awt.event.ActionListener() {

View file

@ -169,4 +169,8 @@ public abstract class ExpansionSet implements Serializable {
}
}
}
public boolean hasBoosters() {
return hasBoosters;
}
}

View file

@ -28,6 +28,9 @@
package mage.cards;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.*;
import mage.Constants.CardType;
import mage.Constants.ColoredManaSymbol;
import mage.cards.decks.DeckCardLists;
@ -37,9 +40,6 @@ import mage.cards.repository.CardRepository;
import mage.util.ClassScanner;
import org.apache.log4j.Logger;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.*;
/**
*
@ -182,4 +182,17 @@ public class Sets extends HashMap<String, ExpansionSet> {
});
return sets;
}
public ExpansionSet[] getWithBoosterSortedByReleaseDate() {
ExpansionSet[] allSets = getSortedByReleaseDate();
ArrayList<ExpansionSet> boosterSets = new ArrayList<ExpansionSet>();
for (ExpansionSet set: allSets) {
if (set.hasBoosters) {
boosterSets.add(set);
}
}
return boosterSets.toArray(new ExpansionSet[0]);
}
}