GUI: deck legality and themes improves:

* Improved formats list in deck legality panel (#6854);
 * Added hide button to deck legality panel (#6854);
 * Fixed themes names and added theme info in startup logs;
This commit is contained in:
Oleg Agafonov 2020-08-03 00:07:13 +04:00
parent c9c1bc2b90
commit 309b3f5636
7 changed files with 46 additions and 17 deletions

View file

@ -1,13 +1,14 @@
package mage.client.deckeditor;
import java.util.*;
import java.util.stream.Stream;
import mage.cards.decks.Deck;
import mage.cards.decks.DeckValidator;
import mage.client.components.LegalityLabel;
import mage.deck.*;
import javax.swing.*;
import java.util.Arrays;
import java.util.stream.Stream;
/**
* @author Elandril
@ -85,10 +86,15 @@ public class DeckLegalityPanel extends javax.swing.JPanel {
remove(previewNotLegal);
Stream.of(
new Standard(), new Pioneer(), new Modern(), new Pauper(), new HistoricalType2(),
new Legacy(), new Vintage(), new Eternal(), new Frontier(), new Momir(),
new Commander(), new Brawl(), new Oathbreaker(), new PennyDreadfulCommander(), new TinyLeaders()
// most popular
new Standard(), new Pioneer(), new Modern(), new Legacy(), new Vintage(), new Pauper(),
// common
new Commander(), new Oathbreaker(), new Brawl(),
// other
new Frontier(), new HistoricalType2(), new PennyDreadfulCommander()
// not used: new Eternal(), new Momir(), new TinyLeaders()
).forEach(this::addLegalityLabel);
addHidePanelButton();
revalidate();
repaint();
@ -101,6 +107,12 @@ public class DeckLegalityPanel extends javax.swing.JPanel {
return label;
}
protected void addHidePanelButton() {
JButton button = LegalityLabel.createHideButton();
button.addActionListener(e -> this.setVisible(false));
add(button);
}
public void validateDeck(Deck deck) {
Arrays.stream(getComponents())
.filter(LegalityLabel.class::isInstance)