mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
* Add Land Dialog - Added deck size value and images of mana symbols.
This commit is contained in:
parent
db94287b20
commit
64f9dc6e60
2 changed files with 335 additions and 112 deletions
|
@ -7,6 +7,11 @@
|
|||
<Property name="text" type="java.lang.String" value="jButton2"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="jLabel1"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</NonVisualComponents>
|
||||
<Properties>
|
||||
<Property name="title" type="java.lang.String" value="Add Land"/>
|
||||
|
@ -29,40 +34,62 @@
|
|||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="lblMountain" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblForest" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblLandSet" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblIsland" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblPains" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblSwamp" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="lblMountain" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblForest" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblLandSet" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblIsland" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblPains" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblSwamp" alignment="1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="lblDeckSize" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="ckbFullArtLands" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="1" max="-2" attributes="0">
|
||||
<Component id="btnAutoAdd" alignment="0" pref="85" max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" attributes="0">
|
||||
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
|
||||
<Component id="spnMountain" alignment="0" pref="85" max="32767" attributes="0"/>
|
||||
<Component id="spnIsland" alignment="0" pref="85" max="32767" attributes="0"/>
|
||||
<Component id="spnForest" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
|
||||
<Component id="spnSwamp" alignment="0" pref="85" max="32767" attributes="0"/>
|
||||
<Component id="spnPlains" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="btnAdd" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnCancel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="ckbFullArtLands" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="panelSet" min="-2" pref="219" max="-2" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="spnForest" min="-2" pref="50" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblForestIcon" min="-2" pref="20" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="spnIsland" min="-2" pref="50" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblIslandIcon" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="spnMountain" min="-2" pref="50" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblMountainIcon" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="spnSwamp" min="-2" pref="50" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblSwampIcon" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="spnDeckSize" min="-2" pref="50" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="btnAutoAdd" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnAdd" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnCancel" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="panelSet" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="spnPlains" min="-2" pref="50" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblPlainsIcon" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="36" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
|
@ -79,35 +106,54 @@
|
|||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="lblForest" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spnForest" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblForestIcon" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="lblIsland" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spnIsland" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="lblIsland" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spnIsland" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="lblIslandIcon" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="lblMountain" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spnMountain" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="lblMountain" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spnMountain" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="lblMountainIcon" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="lblPains" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spnPlains" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="lblPains" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spnPlains" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="lblPlainsIcon" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="lblSwamp" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spnSwamp" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="lblSwamp" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spnSwamp" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="lblSwampIcon" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="ckbFullArtLands" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="btnAutoAdd" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblDeckSize" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="spnDeckSize" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="btnAdd" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="btnCancel" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
@ -120,7 +166,7 @@
|
|||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lblForest">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Forest"/>
|
||||
<Property name="text" type="java.lang.String" value="Forest:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSpinner" name="spnForest">
|
||||
|
@ -130,9 +176,23 @@
|
|||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lblForestIcon">
|
||||
<Properties>
|
||||
<Property name="toolTipText" type="java.lang.String" value=""/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[22, 20]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[22, 20]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[22, 20]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lblIsland">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Island"/>
|
||||
<Property name="text" type="java.lang.String" value="Island:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSpinner" name="spnIsland">
|
||||
|
@ -142,9 +202,22 @@
|
|||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lblIslandIcon">
|
||||
<Properties>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[22, 20]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[22, 20]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[22, 20]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lblMountain">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Mountain"/>
|
||||
<Property name="text" type="java.lang.String" value="Mountain:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSpinner" name="spnMountain">
|
||||
|
@ -154,9 +227,22 @@
|
|||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lblMountainIcon">
|
||||
<Properties>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[22, 20]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[22, 20]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[22, 20]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lblPains">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Plains"/>
|
||||
<Property name="text" type="java.lang.String" value="Plains:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSpinner" name="spnPlains">
|
||||
|
@ -166,9 +252,22 @@
|
|||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lblPlainsIcon">
|
||||
<Properties>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[22, 20]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[22, 20]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[22, 20]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lblSwamp">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Swamp"/>
|
||||
<Property name="text" type="java.lang.String" value="Swamp:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSpinner" name="spnSwamp">
|
||||
|
@ -178,9 +277,44 @@
|
|||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lblSwampIcon">
|
||||
<Properties>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[22, 20]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[22, 20]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[22, 20]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lblDeckSize">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Deck size:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSpinner" name="spnDeckSize">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
|
||||
<SpinnerModel initial="0" minimum="0" numberType="java.lang.Integer" stepSize="1" type="number"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnAutoAdd">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Suggest"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="<HTML>Propose related to the mana costs of the cards in the deck<br>
the number of lands to add to get to the set deck size."/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnAutoAddActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnAdd">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Add"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Add the selected number of basic lands to the deck."/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnAddActionPerformed"/>
|
||||
|
@ -194,14 +328,6 @@
|
|||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnCancelActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnAutoAdd">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Suggest"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnAutoAddActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="panelSet">
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
|
||||
|
|
|
@ -27,12 +27,13 @@
|
|||
*/
|
||||
package mage.client.dialog;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLayeredPane;
|
||||
import mage.Mana;
|
||||
import mage.cards.Card;
|
||||
|
@ -49,6 +50,7 @@ import mage.client.util.gui.FastSearchUtil;
|
|||
import mage.constants.Rarity;
|
||||
import mage.util.RandomUtil;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.mage.card.arcane.ManaSymbols;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -59,7 +61,6 @@ public class AddLandDialog extends MageDialog {
|
|||
private static final Logger logger = Logger.getLogger(MageDialog.class);
|
||||
|
||||
private Deck deck;
|
||||
private final Set<String> landSetCodes = new HashSet<>();
|
||||
|
||||
private static final int DEFAULT_SEALED_DECK_CARD_NUMBER = 40;
|
||||
|
||||
|
@ -131,6 +132,27 @@ public class AddLandDialog extends MageDialog {
|
|||
} else {
|
||||
MageFrame.getDesktop().add(this, JLayeredPane.PALETTE_LAYER);
|
||||
}
|
||||
spnDeckSize.setValue(DEFAULT_SEALED_DECK_CARD_NUMBER);
|
||||
BufferedImage image = ManaSymbols.getSizedManaSymbol("G", 15);
|
||||
if (image != null) {
|
||||
lblForestIcon.setIcon(new ImageIcon(image));
|
||||
}
|
||||
image = ManaSymbols.getSizedManaSymbol("U", 15);
|
||||
if (image != null) {
|
||||
lblIslandIcon.setIcon(new ImageIcon(image));
|
||||
}
|
||||
image = ManaSymbols.getSizedManaSymbol("W", 15);
|
||||
if (image != null) {
|
||||
lblPlainsIcon.setIcon(new ImageIcon(image));
|
||||
}
|
||||
image = ManaSymbols.getSizedManaSymbol("R", 15);
|
||||
if (image != null) {
|
||||
lblMountainIcon.setIcon(new ImageIcon(image));
|
||||
}
|
||||
image = ManaSymbols.getSizedManaSymbol("B", 15);
|
||||
if (image != null) {
|
||||
lblSwampIcon.setIcon(new ImageIcon(image));
|
||||
}
|
||||
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
@ -139,9 +161,7 @@ public class AddLandDialog extends MageDialog {
|
|||
String landSetName = (String) cbLandSet.getSelectedItem();
|
||||
|
||||
CardCriteria criteria = new CardCriteria();
|
||||
if (landSetName.equals("<Random lands>")) {
|
||||
criteria.setCodes(landSetCodes.toArray(new String[landSetCodes.size()]));
|
||||
} else {
|
||||
if (!landSetName.equals("<Random lands>")) {
|
||||
ExpansionInfo expansionInfo = ExpansionRepository.instance.getSetByName(landSetName);
|
||||
if (expansionInfo == null) {
|
||||
throw new IllegalArgumentException("Code of Set " + landSetName + " not found");
|
||||
|
@ -193,20 +213,28 @@ public class AddLandDialog extends MageDialog {
|
|||
private void initComponents() {
|
||||
|
||||
jButton2 = new javax.swing.JButton();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
lblLandSet = new javax.swing.JLabel();
|
||||
lblForest = new javax.swing.JLabel();
|
||||
spnForest = new javax.swing.JSpinner();
|
||||
lblForestIcon = new javax.swing.JLabel();
|
||||
lblIsland = new javax.swing.JLabel();
|
||||
spnIsland = new javax.swing.JSpinner();
|
||||
lblIslandIcon = new javax.swing.JLabel();
|
||||
lblMountain = new javax.swing.JLabel();
|
||||
spnMountain = new javax.swing.JSpinner();
|
||||
lblMountainIcon = new javax.swing.JLabel();
|
||||
lblPains = new javax.swing.JLabel();
|
||||
spnPlains = new javax.swing.JSpinner();
|
||||
lblPlainsIcon = new javax.swing.JLabel();
|
||||
lblSwamp = new javax.swing.JLabel();
|
||||
spnSwamp = new javax.swing.JSpinner();
|
||||
lblSwampIcon = new javax.swing.JLabel();
|
||||
lblDeckSize = new javax.swing.JLabel();
|
||||
spnDeckSize = new javax.swing.JSpinner();
|
||||
btnAutoAdd = new javax.swing.JButton();
|
||||
btnAdd = new javax.swing.JButton();
|
||||
btnCancel = new javax.swing.JButton();
|
||||
btnAutoAdd = new javax.swing.JButton();
|
||||
panelSet = new javax.swing.JPanel();
|
||||
cbLandSet = new javax.swing.JComboBox();
|
||||
btnSetFastSearch = new javax.swing.JButton();
|
||||
|
@ -214,31 +242,67 @@ public class AddLandDialog extends MageDialog {
|
|||
|
||||
jButton2.setText("jButton2");
|
||||
|
||||
jLabel1.setText("jLabel1");
|
||||
|
||||
setTitle("Add Land");
|
||||
|
||||
lblLandSet.setText("Set:");
|
||||
|
||||
lblForest.setText("Forest");
|
||||
lblForest.setText("Forest:");
|
||||
|
||||
spnForest.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1));
|
||||
|
||||
lblIsland.setText("Island");
|
||||
lblForestIcon.setToolTipText("");
|
||||
lblForestIcon.setMaximumSize(new java.awt.Dimension(22, 20));
|
||||
lblForestIcon.setMinimumSize(new java.awt.Dimension(22, 20));
|
||||
lblForestIcon.setPreferredSize(new java.awt.Dimension(22, 20));
|
||||
|
||||
lblIsland.setText("Island:");
|
||||
|
||||
spnIsland.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1));
|
||||
|
||||
lblMountain.setText("Mountain");
|
||||
lblIslandIcon.setMaximumSize(new java.awt.Dimension(22, 20));
|
||||
lblIslandIcon.setMinimumSize(new java.awt.Dimension(22, 20));
|
||||
lblIslandIcon.setPreferredSize(new java.awt.Dimension(22, 20));
|
||||
|
||||
lblMountain.setText("Mountain:");
|
||||
|
||||
spnMountain.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1));
|
||||
|
||||
lblPains.setText("Plains");
|
||||
lblMountainIcon.setMaximumSize(new java.awt.Dimension(22, 20));
|
||||
lblMountainIcon.setMinimumSize(new java.awt.Dimension(22, 20));
|
||||
lblMountainIcon.setPreferredSize(new java.awt.Dimension(22, 20));
|
||||
|
||||
lblPains.setText("Plains:");
|
||||
|
||||
spnPlains.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1));
|
||||
|
||||
lblSwamp.setText("Swamp");
|
||||
lblPlainsIcon.setMaximumSize(new java.awt.Dimension(22, 20));
|
||||
lblPlainsIcon.setMinimumSize(new java.awt.Dimension(22, 20));
|
||||
lblPlainsIcon.setPreferredSize(new java.awt.Dimension(22, 20));
|
||||
|
||||
lblSwamp.setText("Swamp:");
|
||||
|
||||
spnSwamp.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1));
|
||||
|
||||
lblSwampIcon.setMaximumSize(new java.awt.Dimension(22, 20));
|
||||
lblSwampIcon.setMinimumSize(new java.awt.Dimension(22, 20));
|
||||
lblSwampIcon.setPreferredSize(new java.awt.Dimension(22, 20));
|
||||
|
||||
lblDeckSize.setText("Deck size:");
|
||||
|
||||
spnDeckSize.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1));
|
||||
|
||||
btnAutoAdd.setText("Suggest");
|
||||
btnAutoAdd.setToolTipText("<HTML>Propose related to the mana costs of the cards in the deck<br>\nthe number of lands to add to get to the set deck size.");
|
||||
btnAutoAdd.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnAutoAddActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
btnAdd.setText("Add");
|
||||
btnAdd.setToolTipText("Add the selected number of basic lands to the deck.");
|
||||
btnAdd.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnAddActionPerformed(evt);
|
||||
|
@ -252,13 +316,6 @@ public class AddLandDialog extends MageDialog {
|
|||
}
|
||||
});
|
||||
|
||||
btnAutoAdd.setText("Suggest");
|
||||
btnAutoAdd.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnAutoAddActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
panelSet.setLayout(new javax.swing.BoxLayout(panelSet, javax.swing.BoxLayout.LINE_AXIS));
|
||||
|
||||
cbLandSet.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||
|
@ -285,32 +342,50 @@ public class AddLandDialog extends MageDialog {
|
|||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblMountain)
|
||||
.addComponent(lblForest, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblLandSet, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblIsland, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblPains, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblSwamp, javax.swing.GroupLayout.Alignment.TRAILING))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblMountain)
|
||||
.addComponent(lblForest, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblLandSet, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblIsland, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblPains, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(lblSwamp, javax.swing.GroupLayout.Alignment.TRAILING))
|
||||
.addComponent(lblDeckSize))
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(ckbFullArtLands)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addComponent(btnAdd)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnCancel)
|
||||
.addContainerGap())
|
||||
.addComponent(ckbFullArtLands)
|
||||
.addComponent(panelSet, javax.swing.GroupLayout.PREFERRED_SIZE, 219, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(spnForest, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblForestIcon, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(spnIsland, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblIslandIcon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(spnMountain, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblMountainIcon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(spnSwamp, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lblSwampIcon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(spnDeckSize, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(btnAutoAdd)))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||
.addComponent(btnAutoAdd, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||
.addComponent(spnMountain, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE)
|
||||
.addComponent(spnIsland, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE)
|
||||
.addComponent(spnForest, javax.swing.GroupLayout.Alignment.LEADING))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||
.addComponent(spnSwamp, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 85, Short.MAX_VALUE)
|
||||
.addComponent(spnPlains, javax.swing.GroupLayout.Alignment.LEADING))))
|
||||
.addComponent(spnPlains, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnAdd)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnCancel))
|
||||
.addComponent(panelSet, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
||||
.addComponent(lblPlainsIcon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(36, 36, 36))))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
|
@ -322,30 +397,44 @@ public class AddLandDialog extends MageDialog {
|
|||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblForest)
|
||||
.addComponent(spnForest, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(spnForest, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblForestIcon, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblIsland)
|
||||
.addComponent(spnIsland, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblIsland)
|
||||
.addComponent(spnIsland, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(lblIslandIcon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblMountain)
|
||||
.addComponent(spnMountain, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblMountain)
|
||||
.addComponent(spnMountain, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(lblMountainIcon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblPains)
|
||||
.addComponent(spnPlains, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblPains)
|
||||
.addComponent(spnPlains, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(lblPlainsIcon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblSwamp)
|
||||
.addComponent(spnSwamp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(lblSwampIcon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblSwamp)
|
||||
.addComponent(spnSwamp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(ckbFullArtLands)
|
||||
.addGap(2, 2, 2)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(btnAutoAdd)
|
||||
.addComponent(lblDeckSize)
|
||||
.addComponent(spnDeckSize, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(btnAdd)
|
||||
.addComponent(btnCancel)))
|
||||
.addComponent(btnCancel))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
pack();
|
||||
|
@ -386,7 +475,7 @@ public class AddLandDialog extends MageDialog {
|
|||
int blue = 0;
|
||||
int white = 0;
|
||||
Set<Card> cards = deck.getCards();
|
||||
int land_number = DEFAULT_SEALED_DECK_CARD_NUMBER - cards.size();
|
||||
int land_number = ((Number) spnDeckSize.getValue()).intValue() - cards.size();
|
||||
if (land_number < 0) {
|
||||
land_number = 0;
|
||||
}
|
||||
|
@ -427,13 +516,21 @@ public class AddLandDialog extends MageDialog {
|
|||
private javax.swing.JComboBox cbLandSet;
|
||||
private javax.swing.JCheckBox ckbFullArtLands;
|
||||
private javax.swing.JButton jButton2;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel lblDeckSize;
|
||||
private javax.swing.JLabel lblForest;
|
||||
private javax.swing.JLabel lblForestIcon;
|
||||
private javax.swing.JLabel lblIsland;
|
||||
private javax.swing.JLabel lblIslandIcon;
|
||||
private javax.swing.JLabel lblLandSet;
|
||||
private javax.swing.JLabel lblMountain;
|
||||
private javax.swing.JLabel lblMountainIcon;
|
||||
private javax.swing.JLabel lblPains;
|
||||
private javax.swing.JLabel lblPlainsIcon;
|
||||
private javax.swing.JLabel lblSwamp;
|
||||
private javax.swing.JLabel lblSwampIcon;
|
||||
private javax.swing.JPanel panelSet;
|
||||
private javax.swing.JSpinner spnDeckSize;
|
||||
private javax.swing.JSpinner spnForest;
|
||||
private javax.swing.JSpinner spnIsland;
|
||||
private javax.swing.JSpinner spnMountain;
|
||||
|
|
Loading…
Reference in a new issue