mirror of
https://github.com/correl/mage.git
synced 2024-12-24 03:00:14 +00:00
updates in rate plugin
This commit is contained in:
parent
8fdc5a33d8
commit
1882d0c93d
2 changed files with 21 additions and 22 deletions
|
@ -1,24 +1,17 @@
|
|||
package org.mage.plugins.rating;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.mage.plugins.rating.cards.CardsStorage;
|
||||
import org.mage.plugins.rating.results.ResultHandler;
|
||||
import org.mage.plugins.rating.ui.BigCard;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
|
||||
public class RateFrame extends JFrame {
|
||||
|
||||
private static Logger log = Logger.getLogger(RateFrame.class);
|
||||
|
@ -34,12 +27,16 @@ public class RateFrame extends JFrame {
|
|||
log.error(ex.getMessage(), ex);
|
||||
}
|
||||
|
||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
|
||||
addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e) {
|
||||
if (JOptionPane.showConfirmDialog(null, "Do you want to save recent compares?", "Save before exit", JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION) {
|
||||
//if (JOptionPane.showConfirmDialog(null, "Are you sure you want to exit?", "Exit", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||
RateThread.getInstance().forceSave();
|
||||
}
|
||||
//dispose();
|
||||
//System.exit(0);
|
||||
//}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -82,7 +79,7 @@ public class RateFrame extends JFrame {
|
|||
|
||||
public void startRating() {
|
||||
CardsStorage.getAllCards();
|
||||
label.setText("The results are stored for every 10 compare.");
|
||||
label.setText("The results are stored automatically for every 10 compare.");
|
||||
RateThread.getInstance().start(this, this.bigCard);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,21 +1,23 @@
|
|||
package org.mage.plugins.rating.cards;
|
||||
|
||||
import mage.cards.Card;
|
||||
import mage.cards.ExpansionSet;
|
||||
import mage.sets.Sets;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import mage.cards.Card;
|
||||
import mage.cards.ExpansionSet;
|
||||
import mage.sets.Sets;
|
||||
|
||||
public class CardsStorage {
|
||||
private static List<Card> allCards = new ArrayList<Card>();
|
||||
private static List<Card> uniqueCards = new ArrayList<Card>();
|
||||
|
||||
static {
|
||||
for (ExpansionSet set: Sets.getInstance().values()) {
|
||||
allCards.addAll(set.getCards());
|
||||
if (set.getName().equals("Magic 2013")) {
|
||||
allCards.addAll(set.getCards());
|
||||
}
|
||||
}
|
||||
Set<String> names = new HashSet<String>();
|
||||
for (Card card : allCards) {
|
||||
|
|
Loading…
Reference in a new issue