forked from External/mage
Moved /src and /resources to maven stardard /src/main/java and /src/main/resources. Hope it's ok, if not I'll revert.
This commit is contained in:
parent
b45cc23d72
commit
f775f7c511
155 changed files with 0 additions and 9 deletions
|
|
@ -0,0 +1,239 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="tbColor" alignment="0" pref="825" max="32767" attributes="0"/>
|
||||
<Component id="tbTypes" alignment="0" pref="825" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane1" alignment="0" pref="825" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="tbColor" min="-2" pref="25" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
||||
<Component id="tbTypes" min="-2" pref="25" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane1" pref="316" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JToolBar" name="tbColor">
|
||||
<Properties>
|
||||
<Property name="floatable" type="boolean" value="false"/>
|
||||
<Property name="rollover" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JRadioButton" name="rdoRed">
|
||||
<Properties>
|
||||
<Property name="selected" type="boolean" value="true"/>
|
||||
<Property name="text" type="java.lang.String" value="Red "/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rdoRedActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JRadioButton" name="rdoGreen">
|
||||
<Properties>
|
||||
<Property name="selected" type="boolean" value="true"/>
|
||||
<Property name="text" type="java.lang.String" value="Green "/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rdoGreenActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JRadioButton" name="rdoBlue">
|
||||
<Properties>
|
||||
<Property name="selected" type="boolean" value="true"/>
|
||||
<Property name="text" type="java.lang.String" value="Blue "/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rdoBlueActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JRadioButton" name="rdoBlack">
|
||||
<Properties>
|
||||
<Property name="selected" type="boolean" value="true"/>
|
||||
<Property name="text" type="java.lang.String" value="Black "/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rdoBlackActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JRadioButton" name="rdoWhite">
|
||||
<Properties>
|
||||
<Property name="selected" type="boolean" value="true"/>
|
||||
<Property name="text" type="java.lang.String" value="White "/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rdoWhiteActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JRadioButton" name="rdoColorless">
|
||||
<Properties>
|
||||
<Property name="selected" type="boolean" value="true"/>
|
||||
<Property name="text" type="java.lang.String" value="Colorless "/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rdoColorlessActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="cbExpansionSet">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="4">
|
||||
<StringItem index="0" value="Item 1"/>
|
||||
<StringItem index="1" value="Item 2"/>
|
||||
<StringItem index="2" value="Item 3"/>
|
||||
<StringItem index="3" value="Item 4"/>
|
||||
</StringArray>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbExpansionSetActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="mage.client.cards.CardGrid" name="cardGrid">
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JLayeredPaneSupportLayout"/>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JToolBar" name="tbTypes">
|
||||
<Properties>
|
||||
<Property name="floatable" type="boolean" value="false"/>
|
||||
<Property name="rollover" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JRadioButton" name="rdoLand">
|
||||
<Properties>
|
||||
<Property name="selected" type="boolean" value="true"/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||
<Property name="label" type="java.lang.String" value="Land "/>
|
||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rdoLandActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JRadioButton" name="rdoCreatures">
|
||||
<Properties>
|
||||
<Property name="selected" type="boolean" value="true"/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||
<Property name="label" type="java.lang.String" value="Creatures "/>
|
||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rdoCreaturesActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JRadioButton" name="rdoArtifacts">
|
||||
<Properties>
|
||||
<Property name="selected" type="boolean" value="true"/>
|
||||
<Property name="text" type="java.lang.String" value="Artifacts "/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rdoArtifactsActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JRadioButton" name="rdoEnchantments">
|
||||
<Properties>
|
||||
<Property name="selected" type="boolean" value="true"/>
|
||||
<Property name="text" type="java.lang.String" value="Enchantments "/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rdoEnchantmentsActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JRadioButton" name="rdoInstants">
|
||||
<Properties>
|
||||
<Property name="selected" type="boolean" value="true"/>
|
||||
<Property name="text" type="java.lang.String" value="Instants "/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rdoInstantsActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JRadioButton" name="rdoSorceries">
|
||||
<Properties>
|
||||
<Property name="selected" type="boolean" value="true"/>
|
||||
<Property name="text" type="java.lang.String" value="Sorceries "/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rdoSorceriesActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JRadioButton" name="rdoPlaneswalkers">
|
||||
<Properties>
|
||||
<Property name="selected" type="boolean" value="true"/>
|
||||
<Property name="text" type="java.lang.String" value="Planeswalkers "/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rdoPlaneswalkersActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
|
@ -0,0 +1,480 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
* CardSelector.java
|
||||
*
|
||||
* Created on Feb 18, 2010, 2:49:03 PM
|
||||
*/
|
||||
|
||||
package mage.client.deckeditor;
|
||||
|
||||
import java.awt.Cursor;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.ComponentListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import mage.Constants.CardType;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.ExpansionSet;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.cards.CardGrid;
|
||||
import mage.filter.Filter.ComparisonScope;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.sets.Sets;
|
||||
import mage.view.CardsView;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class CardSelector extends javax.swing.JPanel implements ComponentListener {
|
||||
|
||||
private final Set<Card> allCards = new LinkedHashSet<Card>();
|
||||
private final List<Card> cards = new ArrayList<Card>();
|
||||
private final FilterCard filter = new FilterCard();
|
||||
private BigCard bigCard;
|
||||
|
||||
/** Creates new form CardSelector */
|
||||
public CardSelector() {
|
||||
initComponents();
|
||||
this.addComponentListener(this);
|
||||
}
|
||||
|
||||
public void loadCards(BigCard bigCard) {
|
||||
this.bigCard = bigCard;
|
||||
cbExpansionSet.setModel(new DefaultComboBoxModel(Sets.getInstance().values().toArray()));
|
||||
// cbExpansionSet.insertItemAt("All sets", 0);
|
||||
for (ExpansionSet set: Sets.getInstance().values()) {
|
||||
allCards.addAll(set.createCards());
|
||||
}
|
||||
cbExpansionSet.setSelectedIndex(0);
|
||||
filter.setUseColor(true);
|
||||
filter.getColor().setBlack(true);
|
||||
filter.getColor().setBlue(true);
|
||||
filter.getColor().setGreen(true);
|
||||
filter.getColor().setWhite(true);
|
||||
filter.getColor().setRed(true);
|
||||
filter.setColorless(true);
|
||||
filter.setUseColorless(true);
|
||||
filter.setNotColor(false);
|
||||
filter.setScopeColor(ComparisonScope.Any);
|
||||
filter.getCardType().add(CardType.LAND);
|
||||
filter.getCardType().add(CardType.ARTIFACT);
|
||||
filter.getCardType().add(CardType.CREATURE);
|
||||
filter.getCardType().add(CardType.ENCHANTMENT);
|
||||
filter.getCardType().add(CardType.INSTANT);
|
||||
filter.getCardType().add(CardType.PLANESWALKER);
|
||||
filter.getCardType().add(CardType.SORCERY);
|
||||
filter.setScopeCardType(ComparisonScope.Any);
|
||||
filter.getExpansionSetCode().add(((ExpansionSet)this.cbExpansionSet.getSelectedItem()).getCode());
|
||||
filterCards();
|
||||
}
|
||||
|
||||
private void filterCards() {
|
||||
try {
|
||||
cards.clear();
|
||||
for (Card card: allCards) {
|
||||
if (filter.match(card))
|
||||
cards.add(card);
|
||||
}
|
||||
setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
||||
this.cardGrid.loadCards(new CardsView(cards), bigCard, null);
|
||||
}
|
||||
finally {
|
||||
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||
}
|
||||
}
|
||||
|
||||
public CardGrid getCardsList() {
|
||||
return this.cardGrid;
|
||||
}
|
||||
|
||||
public List<Card> getCards() {
|
||||
return cards;
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
tbColor = new javax.swing.JToolBar();
|
||||
rdoRed = new javax.swing.JRadioButton();
|
||||
rdoGreen = new javax.swing.JRadioButton();
|
||||
rdoBlue = new javax.swing.JRadioButton();
|
||||
rdoBlack = new javax.swing.JRadioButton();
|
||||
rdoWhite = new javax.swing.JRadioButton();
|
||||
rdoColorless = new javax.swing.JRadioButton();
|
||||
cbExpansionSet = new javax.swing.JComboBox();
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
cardGrid = new mage.client.cards.CardGrid();
|
||||
tbTypes = new javax.swing.JToolBar();
|
||||
rdoLand = new javax.swing.JRadioButton();
|
||||
rdoCreatures = new javax.swing.JRadioButton();
|
||||
rdoArtifacts = new javax.swing.JRadioButton();
|
||||
rdoEnchantments = new javax.swing.JRadioButton();
|
||||
rdoInstants = new javax.swing.JRadioButton();
|
||||
rdoSorceries = new javax.swing.JRadioButton();
|
||||
rdoPlaneswalkers = new javax.swing.JRadioButton();
|
||||
|
||||
tbColor.setFloatable(false);
|
||||
tbColor.setRollover(true);
|
||||
|
||||
rdoRed.setSelected(true);
|
||||
rdoRed.setText("Red ");
|
||||
rdoRed.setFocusable(false);
|
||||
rdoRed.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||
rdoRed.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
rdoRed.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
rdoRedActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
tbColor.add(rdoRed);
|
||||
|
||||
rdoGreen.setSelected(true);
|
||||
rdoGreen.setText("Green ");
|
||||
rdoGreen.setFocusable(false);
|
||||
rdoGreen.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||
rdoGreen.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
rdoGreen.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
rdoGreenActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
tbColor.add(rdoGreen);
|
||||
|
||||
rdoBlue.setSelected(true);
|
||||
rdoBlue.setText("Blue ");
|
||||
rdoBlue.setFocusable(false);
|
||||
rdoBlue.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||
rdoBlue.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
rdoBlue.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
rdoBlueActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
tbColor.add(rdoBlue);
|
||||
|
||||
rdoBlack.setSelected(true);
|
||||
rdoBlack.setText("Black ");
|
||||
rdoBlack.setFocusable(false);
|
||||
rdoBlack.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||
rdoBlack.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
rdoBlack.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
rdoBlackActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
tbColor.add(rdoBlack);
|
||||
|
||||
rdoWhite.setSelected(true);
|
||||
rdoWhite.setText("White ");
|
||||
rdoWhite.setFocusable(false);
|
||||
rdoWhite.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||
rdoWhite.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
rdoWhite.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
rdoWhiteActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
tbColor.add(rdoWhite);
|
||||
|
||||
rdoColorless.setSelected(true);
|
||||
rdoColorless.setText("Colorless ");
|
||||
rdoColorless.setFocusable(false);
|
||||
rdoColorless.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||
rdoColorless.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
rdoColorless.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
rdoColorlessActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
tbColor.add(rdoColorless);
|
||||
|
||||
cbExpansionSet.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||
cbExpansionSet.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
cbExpansionSetActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
tbColor.add(cbExpansionSet);
|
||||
|
||||
jScrollPane1.setViewportView(cardGrid);
|
||||
|
||||
tbTypes.setFloatable(false);
|
||||
tbTypes.setRollover(true);
|
||||
|
||||
rdoLand.setSelected(true);
|
||||
rdoLand.setFocusable(false);
|
||||
rdoLand.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||
rdoLand.setLabel("Land ");
|
||||
rdoLand.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
rdoLand.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
rdoLandActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
tbTypes.add(rdoLand);
|
||||
|
||||
rdoCreatures.setSelected(true);
|
||||
rdoCreatures.setFocusable(false);
|
||||
rdoCreatures.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||
rdoCreatures.setLabel("Creatures ");
|
||||
rdoCreatures.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
rdoCreatures.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
rdoCreaturesActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
tbTypes.add(rdoCreatures);
|
||||
|
||||
rdoArtifacts.setSelected(true);
|
||||
rdoArtifacts.setText("Artifacts ");
|
||||
rdoArtifacts.setFocusable(false);
|
||||
rdoArtifacts.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||
rdoArtifacts.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
rdoArtifacts.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
rdoArtifactsActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
tbTypes.add(rdoArtifacts);
|
||||
|
||||
rdoEnchantments.setSelected(true);
|
||||
rdoEnchantments.setText("Enchantments ");
|
||||
rdoEnchantments.setFocusable(false);
|
||||
rdoEnchantments.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||
rdoEnchantments.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
rdoEnchantments.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
rdoEnchantmentsActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
tbTypes.add(rdoEnchantments);
|
||||
|
||||
rdoInstants.setSelected(true);
|
||||
rdoInstants.setText("Instants ");
|
||||
rdoInstants.setFocusable(false);
|
||||
rdoInstants.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||
rdoInstants.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
rdoInstants.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
rdoInstantsActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
tbTypes.add(rdoInstants);
|
||||
|
||||
rdoSorceries.setSelected(true);
|
||||
rdoSorceries.setText("Sorceries ");
|
||||
rdoSorceries.setFocusable(false);
|
||||
rdoSorceries.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||
rdoSorceries.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
rdoSorceries.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
rdoSorceriesActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
tbTypes.add(rdoSorceries);
|
||||
|
||||
rdoPlaneswalkers.setSelected(true);
|
||||
rdoPlaneswalkers.setText("Planeswalkers ");
|
||||
rdoPlaneswalkers.setFocusable(false);
|
||||
rdoPlaneswalkers.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||
rdoPlaneswalkers.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
rdoPlaneswalkers.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
rdoPlaneswalkersActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
tbTypes.add(rdoPlaneswalkers);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(tbColor, javax.swing.GroupLayout.DEFAULT_SIZE, 825, Short.MAX_VALUE)
|
||||
.addComponent(tbTypes, javax.swing.GroupLayout.DEFAULT_SIZE, 825, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 825, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(tbColor, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(tbTypes, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 316, Short.MAX_VALUE))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void rdoGreenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoGreenActionPerformed
|
||||
filter.getColor().setGreen(this.rdoGreen.isSelected());
|
||||
filterCards();
|
||||
}//GEN-LAST:event_rdoGreenActionPerformed
|
||||
|
||||
private void rdoBlackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoBlackActionPerformed
|
||||
filter.getColor().setBlack(this.rdoBlack.isSelected());
|
||||
filterCards();
|
||||
}//GEN-LAST:event_rdoBlackActionPerformed
|
||||
|
||||
private void rdoWhiteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoWhiteActionPerformed
|
||||
filter.getColor().setWhite(this.rdoWhite.isSelected());
|
||||
filterCards();
|
||||
}//GEN-LAST:event_rdoWhiteActionPerformed
|
||||
|
||||
private void rdoRedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoRedActionPerformed
|
||||
filter.getColor().setRed(this.rdoRed.isSelected());
|
||||
filterCards();
|
||||
}//GEN-LAST:event_rdoRedActionPerformed
|
||||
|
||||
private void rdoBlueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoBlueActionPerformed
|
||||
filter.getColor().setBlue(this.rdoBlue.isSelected());
|
||||
filterCards();
|
||||
}//GEN-LAST:event_rdoBlueActionPerformed
|
||||
|
||||
private void rdoColorlessActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoColorlessActionPerformed
|
||||
filter.setColorless(this.rdoColorless.isSelected());
|
||||
filterCards();
|
||||
}//GEN-LAST:event_rdoColorlessActionPerformed
|
||||
|
||||
private void rdoLandActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoLandActionPerformed
|
||||
if (this.rdoLand.isSelected())
|
||||
filter.getCardType().add(CardType.LAND);
|
||||
else
|
||||
filter.getCardType().remove(CardType.LAND);
|
||||
filterCards();
|
||||
}//GEN-LAST:event_rdoLandActionPerformed
|
||||
|
||||
private void rdoCreaturesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoCreaturesActionPerformed
|
||||
if (this.rdoCreatures.isSelected())
|
||||
filter.getCardType().add(CardType.CREATURE);
|
||||
else
|
||||
filter.getCardType().remove(CardType.CREATURE);
|
||||
filterCards();
|
||||
}//GEN-LAST:event_rdoCreaturesActionPerformed
|
||||
|
||||
private void rdoArtifactsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoArtifactsActionPerformed
|
||||
if (this.rdoArtifacts.isSelected())
|
||||
filter.getCardType().add(CardType.ARTIFACT);
|
||||
else
|
||||
filter.getCardType().remove(CardType.ARTIFACT);
|
||||
filterCards();
|
||||
}//GEN-LAST:event_rdoArtifactsActionPerformed
|
||||
|
||||
private void rdoEnchantmentsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoEnchantmentsActionPerformed
|
||||
if (this.rdoEnchantments.isSelected())
|
||||
filter.getCardType().add(CardType.ENCHANTMENT);
|
||||
else
|
||||
filter.getCardType().remove(CardType.ENCHANTMENT);
|
||||
filterCards();
|
||||
}//GEN-LAST:event_rdoEnchantmentsActionPerformed
|
||||
|
||||
private void rdoInstantsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoInstantsActionPerformed
|
||||
if (this.rdoInstants.isSelected())
|
||||
filter.getCardType().add(CardType.INSTANT);
|
||||
else
|
||||
filter.getCardType().remove(CardType.INSTANT);
|
||||
filterCards();
|
||||
}//GEN-LAST:event_rdoInstantsActionPerformed
|
||||
|
||||
private void rdoSorceriesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoSorceriesActionPerformed
|
||||
if (this.rdoSorceries.isSelected())
|
||||
filter.getCardType().add(CardType.SORCERY);
|
||||
else
|
||||
filter.getCardType().remove(CardType.SORCERY);
|
||||
filterCards();
|
||||
}//GEN-LAST:event_rdoSorceriesActionPerformed
|
||||
|
||||
private void rdoPlaneswalkersActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoPlaneswalkersActionPerformed
|
||||
if (this.rdoPlaneswalkers.isSelected())
|
||||
filter.getCardType().add(CardType.PLANESWALKER);
|
||||
else
|
||||
filter.getCardType().remove(CardType.PLANESWALKER);
|
||||
filterCards();
|
||||
}//GEN-LAST:event_rdoPlaneswalkersActionPerformed
|
||||
|
||||
private void cbExpansionSetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbExpansionSetActionPerformed
|
||||
filter.getExpansionSetCode().clear();
|
||||
if (cbExpansionSet.getSelectedItem() instanceof ExpansionSet) {
|
||||
filter.getExpansionSetCode().add(((ExpansionSet)this.cbExpansionSet.getSelectedItem()).getCode());
|
||||
}
|
||||
filterCards();
|
||||
}//GEN-LAST:event_cbExpansionSetActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private mage.client.cards.CardGrid cardGrid;
|
||||
private javax.swing.JComboBox cbExpansionSet;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private javax.swing.JRadioButton rdoArtifacts;
|
||||
private javax.swing.JRadioButton rdoBlack;
|
||||
private javax.swing.JRadioButton rdoBlue;
|
||||
private javax.swing.JRadioButton rdoColorless;
|
||||
private javax.swing.JRadioButton rdoCreatures;
|
||||
private javax.swing.JRadioButton rdoEnchantments;
|
||||
private javax.swing.JRadioButton rdoGreen;
|
||||
private javax.swing.JRadioButton rdoInstants;
|
||||
private javax.swing.JRadioButton rdoLand;
|
||||
private javax.swing.JRadioButton rdoPlaneswalkers;
|
||||
private javax.swing.JRadioButton rdoRed;
|
||||
private javax.swing.JRadioButton rdoSorceries;
|
||||
private javax.swing.JRadioButton rdoWhite;
|
||||
private javax.swing.JToolBar tbColor;
|
||||
private javax.swing.JToolBar tbTypes;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
@Override
|
||||
public void componentResized(ComponentEvent e) {
|
||||
this.cardGrid.drawCards();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentMoved(ComponentEvent e) {
|
||||
this.cardGrid.drawCards();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentShown(ComponentEvent e) {
|
||||
this.cardGrid.drawCards();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentHidden(ComponentEvent e) {
|
||||
this.cardGrid.drawCards();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jSplitPane1" alignment="0" pref="740" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jSplitPane1" alignment="0" pref="568" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JSplitPane" name="jSplitPane1">
|
||||
<Properties>
|
||||
<Property name="resizeWeight" type="double" value="0.8"/>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="mage.client.cards.CardsList" name="deckList">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
||||
<JSplitPaneConstraints position="left"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="mage.client.cards.CardsList" name="sideboardList">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
||||
<JSplitPaneConstraints position="right"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* DeckArea.java
|
||||
*
|
||||
* Created on Feb 18, 2010, 3:10:39 PM
|
||||
*/
|
||||
|
||||
package mage.client.deckeditor;
|
||||
|
||||
import mage.client.cards.CardsList;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class DeckArea extends javax.swing.JPanel {
|
||||
|
||||
/** Creates new form DeckArea */
|
||||
public DeckArea() {
|
||||
initComponents();
|
||||
}
|
||||
|
||||
public CardsList getDeckList() {
|
||||
return deckList;
|
||||
}
|
||||
|
||||
public CardsList getSideboardList() {
|
||||
return sideboardList;
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jSplitPane1 = new javax.swing.JSplitPane();
|
||||
deckList = new mage.client.cards.CardsList();
|
||||
sideboardList = new mage.client.cards.CardsList();
|
||||
|
||||
jSplitPane1.setResizeWeight(0.8);
|
||||
jSplitPane1.setLeftComponent(deckList);
|
||||
jSplitPane1.setRightComponent(sideboardList);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 740, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 568, Short.MAX_VALUE)
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private mage.client.cards.CardsList deckList;
|
||||
private javax.swing.JSplitPane jSplitPane1;
|
||||
private mage.client.cards.CardsList sideboardList;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JInternalFrameFormInfo">
|
||||
<SyntheticProperties>
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
</SyntheticProperties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="deckEditorPanel1" alignment="0" pref="885" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="deckEditorPanel1" alignment="0" pref="626" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="mage.client.deckeditor.DeckEditorPanel" name="deckEditorPanel1">
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DeckEditorPane.java
|
||||
*
|
||||
* Created on Dec 17, 2009, 9:21:42 AM
|
||||
*/
|
||||
|
||||
package mage.client.deckeditor;
|
||||
|
||||
import mage.client.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class DeckEditorPane extends MagePane {
|
||||
|
||||
/** Creates new form TablesPane */
|
||||
public DeckEditorPane() {
|
||||
initComponents();
|
||||
}
|
||||
|
||||
public void showTables() {
|
||||
this.deckEditorPanel1.showDeckEditor();
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
deckEditorPanel1 = new mage.client.deckeditor.DeckEditorPanel();
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(deckEditorPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 885, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(deckEditorPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 626, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private mage.client.deckeditor.DeckEditorPanel deckEditorPanel1;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,163 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jPanel1" min="-2" pref="261" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
||||
<Component id="jSplitPane1" pref="604" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="jSplitPane1" alignment="1" pref="615" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JSplitPane" name="jSplitPane1">
|
||||
<Properties>
|
||||
<Property name="orientation" type="int" value="0"/>
|
||||
<Property name="resizeWeight" type="double" value="0.5"/>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="mage.client.deckeditor.CardSelector" name="cardSelector">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
||||
<JSplitPaneConstraints position="top"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="mage.client.deckeditor.DeckArea" name="deckArea">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
||||
<JSplitPaneConstraints position="right"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel1">
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
|
||||
<Component id="lblDeckName" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="txtDeckName" pref="189" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="bigCard" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnSave" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnLoad" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnNew" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnExit" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="txtDeckName" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblDeckName" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="btnSave" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="btnLoad" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="btnNew" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="btnExit" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="188" max="32767" attributes="0"/>
|
||||
<Component id="bigCard" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="mage.client.cards.BigCard" name="bigCard">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
|
||||
<LineBorder/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="txtDeckName">
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="lblDeckName">
|
||||
<Properties>
|
||||
<Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
|
||||
<ComponentRef name="txtDeckName"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Deck Name:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnSave">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Save"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnSaveActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnLoad">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Load"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnLoadActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnNew">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="New"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnNewActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="btnExit">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Exit"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnExitActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
|
@ -0,0 +1,347 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
* DeckEditorPanel.java
|
||||
*
|
||||
* Created on Feb 18, 2010, 2:47:04 PM
|
||||
*/
|
||||
|
||||
package mage.client.deckeditor;
|
||||
|
||||
import java.awt.Cursor;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.cards.decks.DeckCardLists;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.util.Event;
|
||||
import mage.client.util.Listener;
|
||||
import mage.view.CardsView;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class DeckEditorPanel extends javax.swing.JPanel {
|
||||
|
||||
private JFileChooser fcSelectDeck;
|
||||
private Deck deck = new Deck();;
|
||||
|
||||
/** Creates new form DeckEditorPanel */
|
||||
public DeckEditorPanel() {
|
||||
initComponents();
|
||||
fcSelectDeck = new JFileChooser();
|
||||
fcSelectDeck.setAcceptAllFileFilterUsed(false);
|
||||
fcSelectDeck.addChoosableFileFilter(new DeckFilter());
|
||||
}
|
||||
|
||||
public void showDeckEditor() {
|
||||
this.cardSelector.loadCards(this.bigCard);
|
||||
this.cardSelector.setVisible(true);
|
||||
this.jPanel1.setVisible(true);
|
||||
this.cardSelector.getCardsList().clearCardEventListeners();
|
||||
this.cardSelector.getCardsList().addCardEventListener(
|
||||
new Listener<Event> () {
|
||||
@Override
|
||||
public void event(Event event) {
|
||||
if (event.getEventName().equals("double-click")) {
|
||||
for (Card card: cardSelector.getCards()) {
|
||||
if (card.getId().equals((UUID)event.getSource())) {
|
||||
deck.getCards().add(createCard(card.getClass()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
refreshDeck();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
this.deckArea.getDeckList().clearCardEventListeners();
|
||||
this.deckArea.getDeckList().addCardEventListener(
|
||||
new Listener<Event> () {
|
||||
@Override
|
||||
public void event(Event event) {
|
||||
if (event.getEventName().equals("double-click")) {
|
||||
for (Card card: deck.getCards()) {
|
||||
if (card.getId().equals((UUID)event.getSource())) {
|
||||
deck.getCards().remove(card);
|
||||
break;
|
||||
}
|
||||
}
|
||||
refreshDeck();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
this.setVisible(true);
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
private void refreshDeck() {
|
||||
try {
|
||||
setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
||||
this.txtDeckName.setText(deck.getName());
|
||||
deckArea.getDeckList().loadCards(new CardsView(deck.getCards()), bigCard, null);
|
||||
deckArea.getSideboardList().loadCards(new CardsView(deck.getSideboard()), bigCard, null);
|
||||
}
|
||||
finally {
|
||||
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||
}
|
||||
}
|
||||
|
||||
private Card createCard(Class clazz) {
|
||||
try {
|
||||
Constructor<?> con = clazz.getConstructor(new Class[]{UUID.class});
|
||||
return (Card) con.newInstance(new Object[] {null});
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(DeckEditorPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
* initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is
|
||||
* always regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jSplitPane1 = new javax.swing.JSplitPane();
|
||||
cardSelector = new mage.client.deckeditor.CardSelector();
|
||||
deckArea = new mage.client.deckeditor.DeckArea();
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
bigCard = new mage.client.cards.BigCard();
|
||||
txtDeckName = new javax.swing.JTextField();
|
||||
lblDeckName = new javax.swing.JLabel();
|
||||
btnSave = new javax.swing.JButton();
|
||||
btnLoad = new javax.swing.JButton();
|
||||
btnNew = new javax.swing.JButton();
|
||||
btnExit = new javax.swing.JButton();
|
||||
|
||||
jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
|
||||
jSplitPane1.setResizeWeight(0.5);
|
||||
jSplitPane1.setTopComponent(cardSelector);
|
||||
jSplitPane1.setRightComponent(deckArea);
|
||||
|
||||
bigCard.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
|
||||
|
||||
lblDeckName.setLabelFor(txtDeckName);
|
||||
lblDeckName.setText("Deck Name:");
|
||||
|
||||
btnSave.setText("Save");
|
||||
btnSave.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnSaveActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
btnLoad.setText("Load");
|
||||
btnLoad.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnLoadActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
btnNew.setText("New");
|
||||
btnNew.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnNewActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
btnExit.setText("Exit");
|
||||
btnExit.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnExitActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
||||
jPanel1.setLayout(jPanel1Layout);
|
||||
jPanel1Layout.setHorizontalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGap(6, 6, 6)
|
||||
.addComponent(lblDeckName)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtDeckName, javax.swing.GroupLayout.DEFAULT_SIZE, 189, Short.MAX_VALUE))
|
||||
.addComponent(bigCard, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(btnSave)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnLoad)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnNew)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnExit)))
|
||||
.addContainerGap())
|
||||
);
|
||||
jPanel1Layout.setVerticalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(txtDeckName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblDeckName))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(btnSave)
|
||||
.addComponent(btnLoad)
|
||||
.addComponent(btnNew)
|
||||
.addComponent(btnExit))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 188, Short.MAX_VALUE)
|
||||
.addComponent(bigCard, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 604, Short.MAX_VALUE))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jSplitPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 615, Short.MAX_VALUE)
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void btnLoadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoadActionPerformed
|
||||
String lastFolder = MageFrame.getPreferences().get("lastDeckFolder", "");
|
||||
if (!lastFolder.isEmpty())
|
||||
fcSelectDeck.setCurrentDirectory(new File(lastFolder));
|
||||
int ret = fcSelectDeck.showOpenDialog(this);
|
||||
if (ret == JFileChooser.APPROVE_OPTION) {
|
||||
File file = fcSelectDeck.getSelectedFile();
|
||||
try {
|
||||
setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
||||
deck = Deck.load(DeckCardLists.load(file.getPath()));
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(DeckEditorPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
finally {
|
||||
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||
}
|
||||
refreshDeck();
|
||||
try {
|
||||
MageFrame.getPreferences().put("lastDeckFolder", file.getCanonicalPath());
|
||||
} catch (IOException ex) { }
|
||||
}
|
||||
fcSelectDeck.setSelectedFile(null);
|
||||
}//GEN-LAST:event_btnLoadActionPerformed
|
||||
|
||||
private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed
|
||||
String lastFolder = MageFrame.getPreferences().get("lastDeckFolder", "");
|
||||
if (!lastFolder.isEmpty())
|
||||
fcSelectDeck.setCurrentDirectory(new File(lastFolder));
|
||||
deck.setName(this.txtDeckName.getText());
|
||||
int ret = fcSelectDeck.showSaveDialog(this);
|
||||
if (ret == JFileChooser.APPROVE_OPTION) {
|
||||
File file = fcSelectDeck.getSelectedFile();
|
||||
try {
|
||||
String fileName = file.getPath();
|
||||
if (!fileName.endsWith(".dck"))
|
||||
fileName += ".dck";
|
||||
setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
||||
deck.getDeckCardLists().save(fileName);
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(DeckEditorPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
finally {
|
||||
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||
}
|
||||
try {
|
||||
MageFrame.getPreferences().put("lastDeckFolder", file.getCanonicalPath());
|
||||
} catch (IOException ex) { }
|
||||
}
|
||||
}//GEN-LAST:event_btnSaveActionPerformed
|
||||
|
||||
private void btnNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNewActionPerformed
|
||||
deck = new Deck();
|
||||
refreshDeck();
|
||||
}//GEN-LAST:event_btnNewActionPerformed
|
||||
|
||||
private void btnExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExitActionPerformed
|
||||
this.setVisible(false);
|
||||
}//GEN-LAST:event_btnExitActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private mage.client.cards.BigCard bigCard;
|
||||
private javax.swing.JButton btnExit;
|
||||
private javax.swing.JButton btnLoad;
|
||||
private javax.swing.JButton btnNew;
|
||||
private javax.swing.JButton btnSave;
|
||||
private mage.client.deckeditor.CardSelector cardSelector;
|
||||
private mage.client.deckeditor.DeckArea deckArea;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JSplitPane jSplitPane1;
|
||||
private javax.swing.JLabel lblDeckName;
|
||||
private javax.swing.JTextField txtDeckName;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
}
|
||||
|
||||
class DeckFilter extends FileFilter {
|
||||
|
||||
@Override
|
||||
public boolean accept(File f) {
|
||||
if (f.isDirectory())
|
||||
return true;
|
||||
|
||||
String ext = null;
|
||||
String s = f.getName();
|
||||
int i = s.lastIndexOf('.');
|
||||
|
||||
if (i > 0 && i < s.length() - 1) {
|
||||
ext = s.substring(i+1).toLowerCase();
|
||||
}
|
||||
return (ext==null)?false:ext.equals("dck");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Deck Files";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue