mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
sorting sets in drafts by release date
This commit is contained in:
parent
2c80ed377d
commit
37e7941807
3 changed files with 18 additions and 16 deletions
|
@ -149,14 +149,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
this.btnBooster.setVisible(true);
|
||||
this.btnClear.setVisible(true);
|
||||
this.cbExpansionSet.setVisible(true);
|
||||
Object[] l = Sets.getInstance().values().toArray();
|
||||
Arrays.sort(l, new Comparator<Object>() {
|
||||
@Override
|
||||
public int compare(Object o1, Object o2) {
|
||||
return ((ExpansionSet)o2).getReleaseDate().compareTo(((ExpansionSet)o1).getReleaseDate());
|
||||
}
|
||||
});
|
||||
cbExpansionSet.setModel(new DefaultComboBoxModel(l));
|
||||
cbExpansionSet.setModel(new DefaultComboBoxModel(Sets.getInstance().getSortedByReleaseDate()));
|
||||
cbExpansionSet.insertItemAt("-- All sets", 0);
|
||||
cbExpansionSet.insertItemAt("-- Standard", 1);
|
||||
cbExpansionSet.setSelectedIndex(0);
|
||||
|
|
|
@ -34,13 +34,6 @@
|
|||
|
||||
package mage.client.dialog;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.SpinnerNumberModel;
|
||||
import mage.Constants.MultiplayerAttackOption;
|
||||
import mage.Constants.RangeOfInfluence;
|
||||
import mage.cards.ExpansionSet;
|
||||
|
@ -56,6 +49,11 @@ import mage.view.TableView;
|
|||
import mage.view.TournamentTypeView;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
@ -364,7 +362,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
}
|
||||
while (packs.size() < numPacks) {
|
||||
JComboBox pack = new JComboBox();
|
||||
pack.setModel(new DefaultComboBoxModel(Sets.getInstance().values().toArray()));
|
||||
pack.setModel(new DefaultComboBoxModel(Sets.getInstance().getSortedByReleaseDate()));
|
||||
pnlPacks.add(pack);
|
||||
packs.add(pack);
|
||||
pack.addActionListener(new java.awt.event.ActionListener() {
|
||||
|
|
|
@ -384,4 +384,15 @@ public class Sets extends HashMap<String, ExpansionSet> {
|
|||
out.close();
|
||||
}
|
||||
}
|
||||
|
||||
public ExpansionSet[] getSortedByReleaseDate() {
|
||||
ExpansionSet[] sets = Sets.getInstance().values().toArray(new ExpansionSet[0]);
|
||||
Arrays.sort(sets, new Comparator<ExpansionSet>() {
|
||||
@Override
|
||||
public int compare(ExpansionSet o1, ExpansionSet o2) {
|
||||
return o2.getReleaseDate().compareTo(o1.getReleaseDate());
|
||||
}
|
||||
});
|
||||
return sets;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue