mirror of
https://github.com/correl/mage.git
synced 2025-04-10 17:00:08 -09:00
Removed mana leaks for deck editor and draft panels.
This commit is contained in:
parent
30ddcaf99b
commit
1f8555447d
21 changed files with 504 additions and 418 deletions
Mage.Client/src/main/java
mage/client
MageFrame.javaMagePane.java
cards
deckeditor
CardSelector.formCardSelector.javaDeckArea.formDeckArea.javaDeckEditorPane.javaDeckEditorPanel.java
table
draft
tournament
org/mage/card/arcane
Mage.Common/src/mage/cards/action
|
@ -112,7 +112,6 @@ import mage.client.plugins.impl.Plugins;
|
|||
import mage.client.remote.CallbackClientImpl;
|
||||
import mage.client.table.TablesPane;
|
||||
import mage.client.tournament.TournamentPane;
|
||||
import mage.client.tournament.TournamentPanel;
|
||||
import mage.client.util.EDTExceptionHandler;
|
||||
import mage.client.util.MusicPlayer;
|
||||
import mage.client.util.SettingsManager;
|
||||
|
@ -162,7 +161,6 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
private static final Map<UUID, ChatPanel> chats = new HashMap<UUID, ChatPanel>();
|
||||
private static final Map<UUID, GamePanel> games = new HashMap<UUID, GamePanel>();
|
||||
private static final Map<UUID, DraftPanel> drafts = new HashMap<UUID, DraftPanel>();
|
||||
private static final Map<UUID, TournamentPanel> tournaments = new HashMap<UUID, TournamentPanel>();
|
||||
private static final MageUI ui = new MageUI();
|
||||
|
||||
private static final ScheduledExecutorService pingTaskExecutor = Executors.newSingleThreadScheduledExecutor();
|
||||
|
@ -1171,10 +1169,6 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
drafts.put(draftId, draftPanel);
|
||||
}
|
||||
|
||||
public static void addTournament(UUID tournamentId, TournamentPanel tournament) {
|
||||
tournaments.put(tournamentId, tournament);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getId() {
|
||||
return clientId;
|
||||
|
|
|
@ -34,6 +34,9 @@
|
|||
|
||||
package mage.client;
|
||||
|
||||
import java.awt.KeyboardFocusManager;
|
||||
import java.beans.PropertyVetoException;
|
||||
import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE;
|
||||
import javax.swing.plaf.basic.BasicInternalFrameUI;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
@ -47,6 +50,7 @@ public abstract class MagePane extends javax.swing.JInternalFrame {
|
|||
|
||||
/** Creates new form MagePane */
|
||||
public MagePane() {
|
||||
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
initComponents();
|
||||
hideTitle();
|
||||
}
|
||||
|
@ -64,7 +68,14 @@ public abstract class MagePane extends javax.swing.JInternalFrame {
|
|||
}
|
||||
|
||||
public void hideFrame() {
|
||||
KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner();
|
||||
try {
|
||||
this.setClosed(true);
|
||||
} catch (PropertyVetoException ex) {
|
||||
|
||||
}
|
||||
MageFrame.deactivate(this);
|
||||
MageFrame.getDesktop().remove(this);
|
||||
}
|
||||
|
||||
public void activated() {
|
||||
|
|
|
@ -169,6 +169,7 @@ public class BigCard extends JComponent {
|
|||
|
||||
setFocusable(false);
|
||||
setMinimumSize(new Dimension(FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT));
|
||||
setName("bigCardPanel"); // NOI18N
|
||||
setOpaque(false);
|
||||
setPreferredSize(getMinimumSize());
|
||||
setLayout(null);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.1" encoding="UTF-8" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.7">
|
||||
<AuxValues>
|
||||
|
|
|
@ -46,11 +46,9 @@ import java.util.HashMap;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.cards.MageCard;
|
||||
import mage.client.constants.Constants.SortBy;
|
||||
import mage.client.deckeditor.SortSetting;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.Config;
|
||||
|
@ -58,6 +56,7 @@ import mage.client.util.Event;
|
|||
import mage.client.util.Listener;
|
||||
import mage.view.CardView;
|
||||
import mage.view.CardsView;
|
||||
import org.mage.card.arcane.CardPanel;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -81,6 +80,16 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
|
|||
initComponents();
|
||||
setOpaque(false);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
for(MouseListener ml: this.getMouseListeners()) {
|
||||
this.removeMouseListener(ml);
|
||||
}
|
||||
this.clearCardEventListeners();
|
||||
this.clearCards();
|
||||
this.bigCard = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCards(CardsView showCards, SortSetting sortSetting, boolean piles, BigCard bigCard, UUID gameId) {
|
||||
this.loadCards(showCards, sortSetting, piles, bigCard, gameId, true);
|
||||
|
@ -105,7 +114,7 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
|
|||
}
|
||||
}
|
||||
} else {
|
||||
this.clear();
|
||||
this.clearCards();
|
||||
for (CardView card: showCards.values()) {
|
||||
addCard(card, bigCard, gameId, drawImage);
|
||||
}
|
||||
|
@ -216,7 +225,13 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
|
|||
repaint();
|
||||
}
|
||||
|
||||
private void clear() {
|
||||
private void clearCards() {
|
||||
// remove possible mouse listeners, preventing gc
|
||||
for (MageCard mageCard: cards.values()) {
|
||||
if (mageCard instanceof CardPanel) {
|
||||
((CardPanel)mageCard).clear();
|
||||
}
|
||||
}
|
||||
this.cards.clear();
|
||||
removeAllCardImg();
|
||||
}
|
||||
|
|
|
@ -84,6 +84,17 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
|||
initListViewComponents();
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
this.clearCardEventListeners();
|
||||
if (cards != null) {
|
||||
cards.clear();
|
||||
}
|
||||
if (mainModel != null) {
|
||||
mainModel.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void makeTransparent() {
|
||||
jScrollPane1.setOpaque(false);
|
||||
cardArea.setOpaque(false);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.1" encoding="UTF-8" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
package mage.client.cards;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
@ -68,6 +69,15 @@ public class DraftGrid extends javax.swing.JPanel implements MouseListener {
|
|||
initComponents();
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
this.clearCardEventListeners();
|
||||
for (Component comp: getComponents()) {
|
||||
if (comp instanceof Card || comp instanceof MageCard) {
|
||||
this.remove(comp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void loadBooster(CardsView booster, BigCard bigCard) {
|
||||
this.bigCard = bigCard;
|
||||
this.removeAll();
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
<Component id="tbTypes" alignment="0" pref="917" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jPanel1" max="32767" attributes="0"/>
|
||||
<Component id="cardSelectorBottomPanel" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="jScrollPane1" alignment="0" pref="917" max="32767" attributes="0"/>
|
||||
<Component id="cardSelectorScrollPane" alignment="0" pref="917" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
|
@ -33,9 +33,9 @@
|
|||
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
||||
<Component id="tbTypes" min="-2" pref="25" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane1" pref="273" max="32767" attributes="0"/>
|
||||
<Component id="cardSelectorScrollPane" pref="273" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="cardSelectorBottomPanel" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
@ -160,10 +160,6 @@
|
|||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
</Container>
|
||||
<Container class="javax.swing.JToolBar" name="tbTypes">
|
||||
<Properties>
|
||||
<Property name="floatable" type="boolean" value="false"/>
|
||||
|
@ -307,7 +303,11 @@
|
|||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="jPanel1">
|
||||
<Container class="javax.swing.JScrollPane" name="cardSelectorScrollPane">
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
</Container>
|
||||
<Container class="javax.swing.JPanel" name="cardSelectorBottomPanel">
|
||||
<Properties>
|
||||
<Property name="opaque" type="boolean" value="false"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
|
|
|
@ -40,7 +40,6 @@ import java.awt.event.ActionEvent;
|
|||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.ComponentListener;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.ArrayList;
|
||||
|
@ -111,8 +110,8 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
setOpaque(false);
|
||||
|
||||
cardGrid.setOpaque(false);
|
||||
jScrollPane1.setOpaque(false);
|
||||
jScrollPane1.getViewport().setOpaque(false);
|
||||
cardSelectorScrollPane.setOpaque(false);
|
||||
cardSelectorScrollPane.getViewport().setOpaque(false);
|
||||
cbSortBy.setModel(new DefaultComboBoxModel(SortBy.values()));
|
||||
cbSortBy.setSelectedItem(sortSetting.getSortBy());
|
||||
jTextFieldSearch.addActionListener(searchAction);
|
||||
|
@ -143,7 +142,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
mainTable.getColumnModel().getColumn(6).setPreferredWidth(15);
|
||||
mainTable.getColumnModel().getColumn(7).setPreferredWidth(15);
|
||||
|
||||
jScrollPane1.setViewportView(mainTable);
|
||||
cardSelectorScrollPane.setViewportView(mainTable);
|
||||
|
||||
mainTable.setOpaque(false);
|
||||
|
||||
|
@ -161,11 +160,20 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Free all references
|
||||
*
|
||||
*/
|
||||
public void clear() {
|
||||
this.cardGrid.clear();
|
||||
this.mainModel.clear();
|
||||
}
|
||||
|
||||
public void switchToGrid(){
|
||||
jToggleListView.setSelected(false);
|
||||
jToggleCardView.setSelected(true);
|
||||
currentView = cardGrid;
|
||||
jScrollPane1.setViewportView(cardGrid);
|
||||
cardSelectorScrollPane.setViewportView(cardGrid);
|
||||
cbSortBy.setEnabled(true);
|
||||
chkPiles.setEnabled(true);
|
||||
jButtonAddToMain.setEnabled(false);
|
||||
|
@ -382,7 +390,6 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
cbExpansionSet = new javax.swing.JComboBox();
|
||||
btnBooster = new javax.swing.JButton();
|
||||
btnClear = new javax.swing.JButton();
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
tbTypes = new javax.swing.JToolBar();
|
||||
rdoLand = new javax.swing.JRadioButton();
|
||||
rdoCreatures = new javax.swing.JRadioButton();
|
||||
|
@ -395,7 +402,8 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
cbSortBy = new javax.swing.JComboBox();
|
||||
jToggleListView = new javax.swing.JToggleButton();
|
||||
jToggleCardView = new javax.swing.JToggleButton();
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
cardSelectorScrollPane = new javax.swing.JScrollPane();
|
||||
cardSelectorBottomPanel = new javax.swing.JPanel();
|
||||
jButtonAddToMain = new javax.swing.JButton();
|
||||
jButtonAddToSideboard = new javax.swing.JButton();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
|
@ -641,8 +649,8 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
});
|
||||
tbTypes.add(jToggleCardView);
|
||||
|
||||
jPanel1.setOpaque(false);
|
||||
jPanel1.setPreferredSize(new java.awt.Dimension(897, 35));
|
||||
cardSelectorBottomPanel.setOpaque(false);
|
||||
cardSelectorBottomPanel.setPreferredSize(new java.awt.Dimension(897, 35));
|
||||
|
||||
jButtonAddToMain.setText("+");
|
||||
jButtonAddToMain.setToolTipText("Add to Main");
|
||||
|
@ -676,10 +684,8 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
}
|
||||
});
|
||||
|
||||
cardCountLabel.setForeground(java.awt.SystemColor.textHighlightText);
|
||||
cardCountLabel.setText("Card count:");
|
||||
|
||||
cardCount.setForeground(java.awt.SystemColor.text);
|
||||
cardCount.setText("0");
|
||||
|
||||
jButtonRemoveFromMain.setText("-");
|
||||
|
@ -698,11 +704,11 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
||||
jPanel1.setLayout(jPanel1Layout);
|
||||
jPanel1Layout.setHorizontalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
javax.swing.GroupLayout cardSelectorBottomPanelLayout = new javax.swing.GroupLayout(cardSelectorBottomPanel);
|
||||
cardSelectorBottomPanel.setLayout(cardSelectorBottomPanelLayout);
|
||||
cardSelectorBottomPanelLayout.setHorizontalGroup(
|
||||
cardSelectorBottomPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(cardSelectorBottomPanelLayout.createSequentialGroup()
|
||||
.addComponent(jButtonAddToMain)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jButtonRemoveFromMain)
|
||||
|
@ -724,9 +730,9 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
.addComponent(cardCount, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(121, Short.MAX_VALUE))
|
||||
);
|
||||
jPanel1Layout.setVerticalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
cardSelectorBottomPanelLayout.setVerticalGroup(
|
||||
cardSelectorBottomPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(cardSelectorBottomPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jButtonAddToMain)
|
||||
.addComponent(jLabel1)
|
||||
.addComponent(jTextFieldSearch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
|
@ -750,9 +756,9 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
.addComponent(tbTypes, javax.swing.GroupLayout.DEFAULT_SIZE, 917, Short.MAX_VALUE)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(cardSelectorBottomPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addContainerGap())
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 917, Short.MAX_VALUE)
|
||||
.addComponent(cardSelectorScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 917, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
|
@ -761,9 +767,9 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
.addGap(0, 0, 0)
|
||||
.addComponent(tbTypes, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 273, Short.MAX_VALUE)
|
||||
.addComponent(cardSelectorScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 273, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(cardSelectorBottomPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
@ -941,7 +947,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
jToggleListView.setSelected(true);
|
||||
jToggleCardView.setSelected(false);
|
||||
currentView = mainModel;
|
||||
jScrollPane1.setViewportView(mainTable);
|
||||
cardSelectorScrollPane.setViewportView(mainTable);
|
||||
cbSortBy.setEnabled(false);
|
||||
chkPiles.setEnabled(false);
|
||||
jButtonAddToMain.setEnabled(true);
|
||||
|
@ -950,7 +956,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
jToggleCardView.setSelected(true);
|
||||
jToggleListView.setSelected(false);
|
||||
currentView = cardGrid;
|
||||
jScrollPane1.setViewportView(cardGrid);
|
||||
cardSelectorScrollPane.setViewportView(cardGrid);
|
||||
cbSortBy.setEnabled(true);
|
||||
chkPiles.setEnabled(true);
|
||||
jButtonAddToMain.setEnabled(false);
|
||||
|
@ -984,6 +990,8 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
private javax.swing.JButton btnClear;
|
||||
private javax.swing.JLabel cardCount;
|
||||
private javax.swing.JLabel cardCountLabel;
|
||||
private javax.swing.JPanel cardSelectorBottomPanel;
|
||||
private javax.swing.JScrollPane cardSelectorScrollPane;
|
||||
private javax.swing.JComboBox cbExpansionSet;
|
||||
private javax.swing.JComboBox cbSortBy;
|
||||
private javax.swing.JCheckBox chkPiles;
|
||||
|
@ -994,8 +1002,6 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
|||
private javax.swing.JButton jButtonRemoveFromSideboard;
|
||||
private javax.swing.JButton jButtonSearch;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private javax.swing.JTextField jTextFieldSearch;
|
||||
private javax.swing.JToggleButton jToggleCardView;
|
||||
private javax.swing.JToggleButton jToggleListView;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.1" encoding="UTF-8" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
|
@ -16,17 +16,17 @@
|
|||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jSplitPane1" alignment="0" pref="740" max="32767" attributes="0"/>
|
||||
<Component id="deckAreaSplitPane" 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"/>
|
||||
<Component id="deckAreaSplitPane" alignment="0" pref="568" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JSplitPane" name="jSplitPane1">
|
||||
<Container class="javax.swing.JSplitPane" name="deckAreaSplitPane">
|
||||
<Properties>
|
||||
<Property name="orientation" type="int" value="0"/>
|
||||
<Property name="resizeWeight" type="double" value="0.8"/>
|
||||
|
|
|
@ -51,7 +51,7 @@ public class DeckArea extends javax.swing.JPanel {
|
|||
/** Creates new form DeckArea */
|
||||
public DeckArea() {
|
||||
initComponents();
|
||||
jSplitPane1.setOpaque(false);
|
||||
deckAreaSplitPane.setOpaque(false);
|
||||
deckList.setSortSetting(SortSettingDeck.getInstance());
|
||||
sideboardList.setSortSetting(SortSettingSideboard.getInstance());
|
||||
deckList.setOpaque(false);
|
||||
|
@ -60,6 +60,11 @@ public class DeckArea extends javax.swing.JPanel {
|
|||
sideboardList.setDisplayNoCopies(true);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
deckList.clear();
|
||||
sideboardList.clear();
|
||||
}
|
||||
|
||||
public void showSideboard(boolean show) {
|
||||
this.sideboardList.setVisible(show);
|
||||
}
|
||||
|
@ -96,24 +101,24 @@ public class DeckArea extends javax.swing.JPanel {
|
|||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jSplitPane1 = new javax.swing.JSplitPane();
|
||||
deckAreaSplitPane = new javax.swing.JSplitPane();
|
||||
deckList = new mage.client.cards.CardsList();
|
||||
sideboardList = new mage.client.cards.CardsList();
|
||||
|
||||
jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
|
||||
jSplitPane1.setResizeWeight(0.8);
|
||||
jSplitPane1.setLeftComponent(deckList);
|
||||
jSplitPane1.setRightComponent(sideboardList);
|
||||
deckAreaSplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
|
||||
deckAreaSplitPane.setResizeWeight(0.8);
|
||||
deckAreaSplitPane.setLeftComponent(deckList);
|
||||
deckAreaSplitPane.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)
|
||||
.addComponent(deckAreaSplitPane, 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)
|
||||
.addComponent(deckAreaSplitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 568, Short.MAX_VALUE)
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
@ -126,8 +131,8 @@ public class DeckArea extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JSplitPane deckAreaSplitPane;
|
||||
private mage.client.cards.CardsList deckList;
|
||||
private javax.swing.JSplitPane jSplitPane1;
|
||||
private mage.client.cards.CardsList sideboardList;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public class DeckEditorPane extends MagePane {
|
|||
|
||||
/** Creates new form TablesPane */
|
||||
public DeckEditorPane() {
|
||||
|
||||
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||
boolean initialized = false;
|
||||
if (Plugins.getInstance().isThemePluginLoaded()) {
|
||||
Map<String, JComponent> uiMap = new HashMap<String, JComponent>();
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
* 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.
|
||||
*/
|
||||
package mage.client.deckeditor;
|
||||
|
||||
import java.awt.Component;
|
||||
|
@ -61,6 +61,7 @@ import mage.client.constants.Constants.DeckEditorMode;
|
|||
import mage.client.constants.Constants.SortBy;
|
||||
import mage.client.dialog.AddLandDialog;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
import mage.client.plugins.adapters.MageActionCallback;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.Event;
|
||||
import mage.client.util.Listener;
|
||||
|
@ -78,7 +79,6 @@ import org.apache.log4j.Logger;
|
|||
public class DeckEditorPanel extends javax.swing.JPanel {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(DeckEditorPanel.class);
|
||||
|
||||
private JFileChooser fcSelectDeck;
|
||||
private JFileChooser fcImportDeck;
|
||||
private Deck deck = new Deck();
|
||||
|
@ -89,8 +89,9 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
private Timer countdown;
|
||||
private UpdateDeckTask updateDeckTask;
|
||||
|
||||
|
||||
/** Creates new form DeckEditorPanel */
|
||||
/**
|
||||
* Creates new form DeckEditorPanel
|
||||
*/
|
||||
public DeckEditorPanel() {
|
||||
initComponents();
|
||||
fcSelectDeck = new JFileChooser();
|
||||
|
@ -104,24 +105,40 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
jPanel1.setOpaque(false);
|
||||
jSplitPane1.setOpaque(false);
|
||||
countdown = new Timer(1000,
|
||||
new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (--timeout > 0) {
|
||||
setTimeout(timeout);
|
||||
}
|
||||
else {
|
||||
if (updateDeckTask != null) {
|
||||
updateDeckTask.cancel(true);
|
||||
}
|
||||
setTimeout(0);
|
||||
countdown.stop();
|
||||
hideDeckEditor();
|
||||
new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (--timeout > 0) {
|
||||
setTimeout(timeout);
|
||||
} else {
|
||||
if (updateDeckTask != null) {
|
||||
updateDeckTask.cancel(true);
|
||||
}
|
||||
setTimeout(0);
|
||||
countdown.stop();
|
||||
hideDeckEditor();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Free resources so GC can work
|
||||
*/
|
||||
public void clear() {
|
||||
if (updateDeckTask != null) {
|
||||
updateDeckTask.cancel(true);
|
||||
}
|
||||
if (countdown != null) {
|
||||
for (ActionListener al : countdown.getActionListeners()) {
|
||||
countdown.removeActionListener(al);
|
||||
}
|
||||
}
|
||||
this.cardSelector.clear();
|
||||
this.deckArea.clear();
|
||||
this.getUI().uninstallUI(this);
|
||||
((MageActionCallback) Plugins.getInstance().getActionCallback()).setCardPreviewComponent(null);
|
||||
}
|
||||
|
||||
public void showDeckEditor(DeckEditorMode mode, Deck deck, UUID tableId, int time) {
|
||||
if (deck != null) {
|
||||
|
@ -138,7 +155,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
this.btnSubmit.setVisible(true);
|
||||
this.cardSelector.loadSideboard(new ArrayList<Card>(deck.getSideboard()), this.bigCard);
|
||||
// TODO: take from preferences
|
||||
this.cardSelector.switchToGrid();
|
||||
this.cardSelector.switchToGrid();
|
||||
|
||||
this.btnExit.setVisible(false);
|
||||
this.btnImport.setVisible(false);
|
||||
|
@ -179,113 +196,109 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
for (ICardGrid component : this.cardSelector.getCardGridComponents()) {
|
||||
component.clearCardEventListeners();
|
||||
component.addCardEventListener(
|
||||
new Listener<Event> () {
|
||||
@Override
|
||||
public void event(Event event) {
|
||||
if (event.getEventName().equals("double-click")) {
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
CardInfo cardInfo = CardRepository.instance.findCard(cardView.getExpansionSetCode(), cardView.getCardNumber());
|
||||
Card card = null;
|
||||
new Listener<Event>() {
|
||||
@Override
|
||||
public void event(Event event) {
|
||||
if (event.getEventName().equals("double-click")) {
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
CardInfo cardInfo = CardRepository.instance.findCard(cardView.getExpansionSetCode(), cardView.getCardNumber());
|
||||
Card card = null;
|
||||
if (mode == DeckEditorMode.Sideboard || mode == DeckEditorMode.Limited) {
|
||||
Iterator sideboard = deck.getSideboard().iterator();
|
||||
while (sideboard.hasNext()) {
|
||||
card = (Card) sideboard.next();
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
card = cardInfo != null ? cardInfo.getMockCard() : null;
|
||||
}
|
||||
if (card != null) {
|
||||
deck.getCards().add(card);
|
||||
if (mode == DeckEditorMode.Sideboard || mode == DeckEditorMode.Limited) {
|
||||
Iterator sideboard = deck.getSideboard().iterator();
|
||||
while (sideboard.hasNext()) {
|
||||
card = (Card) sideboard.next();
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
card = cardInfo != null ? cardInfo.getMockCard() : null;
|
||||
deck.getSideboard().remove(card);
|
||||
cardSelector.removeCard(card.getId());
|
||||
cardSelector.setCardCount(deck.getSideboard().size());
|
||||
cardSelector.refresh();
|
||||
}
|
||||
if (card != null) {
|
||||
deck.getCards().add(card);
|
||||
if (mode == DeckEditorMode.Sideboard || mode == DeckEditorMode.Limited) {
|
||||
deck.getSideboard().remove(card);
|
||||
cardSelector.removeCard(card.getId());
|
||||
cardSelector.setCardCount(deck.getSideboard().size());
|
||||
cardSelector.refresh();
|
||||
}
|
||||
if (cardInfoPane instanceof CardInfoPane) {
|
||||
((CardInfoPane)cardInfoPane).setCard(new CardView(card), null);
|
||||
}
|
||||
hidePopup();
|
||||
}
|
||||
|
||||
} else if (event.getEventName().equals("shift-double-click") && mode == DeckEditorMode.Constructed) {
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
CardInfo cardInfo = CardRepository.instance.findCard(cardView.getExpansionSetCode(), cardView.getCardNumber());
|
||||
Card card = cardInfo != null ? cardInfo.getMockCard() : null;
|
||||
if (card != null) {
|
||||
deck.getSideboard().add(card);
|
||||
}
|
||||
if (cardInfoPane instanceof CardInfoPane) {
|
||||
((CardInfoPane)cardInfoPane).setCard(new CardView(card), null);
|
||||
if (cardInfoPane instanceof CardInfoPane) {
|
||||
((CardInfoPane) cardInfoPane).setCard(new CardView(card), null);
|
||||
}
|
||||
hidePopup();
|
||||
} else if (event.getEventName().equals("remove-main")) {
|
||||
DeckEditorPanel.this.deckArea.getDeckList().handleDoubleClick();
|
||||
} else if (event.getEventName().equals("remove-sideboard")) {
|
||||
DeckEditorPanel.this.deckArea.getSideboardList().handleDoubleClick();
|
||||
}
|
||||
refreshDeck();
|
||||
|
||||
} else if (event.getEventName().equals("shift-double-click") && mode == DeckEditorMode.Constructed) {
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
CardInfo cardInfo = CardRepository.instance.findCard(cardView.getExpansionSetCode(), cardView.getCardNumber());
|
||||
Card card = cardInfo != null ? cardInfo.getMockCard() : null;
|
||||
if (card != null) {
|
||||
deck.getSideboard().add(card);
|
||||
}
|
||||
if (cardInfoPane instanceof CardInfoPane) {
|
||||
((CardInfoPane) cardInfoPane).setCard(new CardView(card), null);
|
||||
}
|
||||
hidePopup();
|
||||
} else if (event.getEventName().equals("remove-main")) {
|
||||
DeckEditorPanel.this.deckArea.getDeckList().handleDoubleClick();
|
||||
} else if (event.getEventName().equals("remove-sideboard")) {
|
||||
DeckEditorPanel.this.deckArea.getSideboardList().handleDoubleClick();
|
||||
}
|
||||
refreshDeck();
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
this.deckArea.clearDeckEventListeners();
|
||||
this.deckArea.addDeckEventListener(
|
||||
new Listener<Event> () {
|
||||
@Override
|
||||
public void event(Event event) {
|
||||
if (event.getEventName().equals("double-click")) {
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card: deck.getCards()) {
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
deck.getCards().remove(card);
|
||||
if (mode == DeckEditorMode.Limited || mode == DeckEditorMode.Sideboard) {
|
||||
deck.getSideboard().add(card);
|
||||
cardSelector.loadSideboard(new ArrayList<Card>(deck.getSideboard()), getBigCard());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
hidePopup();
|
||||
refreshDeck();
|
||||
}
|
||||
else if (event.getEventName().equals("shift-double-click") && mode == DeckEditorMode.Constructed) {
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card: deck.getCards()) {
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
deck.getCards().remove(card);
|
||||
new Listener<Event>() {
|
||||
@Override
|
||||
public void event(Event event) {
|
||||
if (event.getEventName().equals("double-click")) {
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card : deck.getCards()) {
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
deck.getCards().remove(card);
|
||||
if (mode == DeckEditorMode.Limited || mode == DeckEditorMode.Sideboard) {
|
||||
deck.getSideboard().add(card);
|
||||
break;
|
||||
cardSelector.loadSideboard(new ArrayList<Card>(deck.getSideboard()), getBigCard());
|
||||
}
|
||||
break;
|
||||
}
|
||||
hidePopup();
|
||||
refreshDeck();
|
||||
}
|
||||
hidePopup();
|
||||
refreshDeck();
|
||||
} else if (event.getEventName().equals("shift-double-click") && mode == DeckEditorMode.Constructed) {
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card : deck.getCards()) {
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
deck.getCards().remove(card);
|
||||
deck.getSideboard().add(card);
|
||||
break;
|
||||
}
|
||||
}
|
||||
hidePopup();
|
||||
refreshDeck();
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
this.deckArea.addSideboardEventListener(
|
||||
new Listener<Event> () {
|
||||
@Override
|
||||
public void event(Event event) {
|
||||
if (event.getEventName().equals("double-click")) {
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card: deck.getSideboard()) {
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
deck.getSideboard().remove(card);
|
||||
deck.getCards().add(card);
|
||||
break;
|
||||
}
|
||||
new Listener<Event>() {
|
||||
@Override
|
||||
public void event(Event event) {
|
||||
if (event.getEventName().equals("double-click")) {
|
||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||
for (Card card : deck.getSideboard()) {
|
||||
if (card.getId().equals(cardView.getId())) {
|
||||
deck.getSideboard().remove(card);
|
||||
deck.getCards().add(card);
|
||||
break;
|
||||
}
|
||||
hidePopup();
|
||||
refreshDeck();
|
||||
}
|
||||
hidePopup();
|
||||
refreshDeck();
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
// Set Sort from Preferences
|
||||
SortBy sortBy = SortBy.getByString(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_DRAFT_SORT_BY, "Color"));
|
||||
deckArea.getDeckList().setSortBy(sortBy);
|
||||
|
@ -294,21 +307,20 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
this.setVisible(true);
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
|
||||
private void hidePopup() {
|
||||
Plugins.getInstance().getActionCallback().mouseExited(null, null);
|
||||
}
|
||||
|
||||
public void hideDeckEditor() {
|
||||
if (updateDeckTask != null) {
|
||||
updateDeckTask.cancel(true);
|
||||
}
|
||||
this.clear();
|
||||
|
||||
Component c = this.getParent();
|
||||
while (c != null && !(c instanceof DeckEditorPane)) {
|
||||
c = c.getParent();
|
||||
}
|
||||
if (c != null) {
|
||||
((DeckEditorPane)c).hideFrame();
|
||||
((DeckEditorPane) c).hideFrame();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -321,24 +333,23 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
||||
this.txtDeckName.setText(deck.getName());
|
||||
deckArea.loadDeck(deck, bigCard);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||
}
|
||||
}
|
||||
|
||||
private void setTimeout(int s){
|
||||
int minute = s/60;
|
||||
int second = s - (minute*60);
|
||||
private void setTimeout(int s) {
|
||||
int minute = s / 60;
|
||||
int second = s - (minute * 60);
|
||||
String text;
|
||||
if(minute < 10){
|
||||
if (minute < 10) {
|
||||
text = "0" + Integer.toString(minute) + ":";
|
||||
}else{
|
||||
} else {
|
||||
text = Integer.toString(minute) + ":";
|
||||
}
|
||||
if(second < 10){
|
||||
if (second < 10) {
|
||||
text = text + "0" + Integer.toString(second);
|
||||
}else{
|
||||
} else {
|
||||
text = text + Integer.toString(second);
|
||||
}
|
||||
this.txtTimeRemaining.setText(text);
|
||||
|
@ -378,7 +389,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
|
||||
cardInfoPane = Plugins.getInstance().getCardInfoPane();
|
||||
if (cardInfoPane != null && System.getProperty("testCardInfo") != null) {
|
||||
cardInfoPane.setPreferredSize(new Dimension(170,150));
|
||||
cardInfoPane.setPreferredSize(new Dimension(170, 150));
|
||||
cardInfoPane.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
|
||||
isShowCardInfo = true;
|
||||
} else {
|
||||
|
@ -457,82 +468,77 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
jPanel1.setLayout(jPanel1Layout);
|
||||
jPanel1Layout.setHorizontalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
/*.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jLayeredPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE))*/
|
||||
.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(cardInfoPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.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))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(btnImport)
|
||||
.addContainerGap()
|
||||
.addComponent(btnAddLand)
|
||||
.addContainerGap()
|
||||
.addComponent(btnSubmit))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(txtTimeRemaining))
|
||||
)
|
||||
.addContainerGap())
|
||||
);
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
/*.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jLayeredPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE))*/
|
||||
.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(cardInfoPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.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))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(btnImport)
|
||||
.addContainerGap()
|
||||
.addComponent(btnAddLand)
|
||||
.addContainerGap()
|
||||
.addComponent(btnSubmit))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(txtTimeRemaining)))
|
||||
.addContainerGap()));
|
||||
jPanel1Layout.setVerticalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
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))
|
||||
.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))
|
||||
.addComponent(btnSave)
|
||||
.addComponent(btnLoad)
|
||||
.addComponent(btnNew)
|
||||
.addComponent(btnExit))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(btnImport)
|
||||
.addComponent(btnAddLand)
|
||||
.addComponent(btnSubmit))
|
||||
.addComponent(btnImport)
|
||||
.addComponent(btnAddLand)
|
||||
.addComponent(btnSubmit))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(txtTimeRemaining))
|
||||
.addComponent(txtTimeRemaining))
|
||||
//.addComponent(jLayeredPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, isShowCardInfo ? 30 : 159, Short.MAX_VALUE)
|
||||
.addComponent(cardInfoPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 104, Short.MAX_VALUE)
|
||||
.addComponent(bigCard, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
);
|
||||
.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()
|
||||
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))
|
||||
);
|
||||
.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)
|
||||
);
|
||||
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));
|
||||
}
|
||||
|
||||
private void btnLoadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoadActionPerformed
|
||||
|
@ -550,14 +556,14 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
JOptionPane.showMessageDialog(MageFrame.getDesktop(), ex.getMessage(), "Error loading deck", JOptionPane.ERROR_MESSAGE);
|
||||
} catch (Exception ex) {
|
||||
logger.fatal(ex);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||
}
|
||||
refreshDeck();
|
||||
try {
|
||||
MageFrame.getPreferences().put("lastDeckFolder", file.getCanonicalPath());
|
||||
} catch (IOException ex) { }
|
||||
} catch (IOException ex) {
|
||||
}
|
||||
}
|
||||
fcSelectDeck.setSelectedFile(null);
|
||||
}//GEN-LAST:event_btnLoadActionPerformed
|
||||
|
@ -580,25 +586,24 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
Sets.saveDeck(fileName, deck.getDeckCardLists());
|
||||
} catch (Exception ex) {
|
||||
logger.fatal(ex);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||
}
|
||||
try {
|
||||
MageFrame.getPreferences().put("lastDeckFolder", file.getCanonicalPath());
|
||||
} catch (IOException ex) { }
|
||||
} catch (IOException ex) {
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_btnSaveActionPerformed
|
||||
|
||||
private void btnNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNewActionPerformed
|
||||
if (mode == DeckEditorMode.Sideboard || mode == DeckEditorMode.Limited) {
|
||||
for (Card card: deck.getCards()) {
|
||||
for (Card card : deck.getCards()) {
|
||||
deck.getSideboard().add(card);
|
||||
}
|
||||
deck.getCards().clear();
|
||||
cardSelector.loadSideboard(new ArrayList<Card>(deck.getSideboard()), this.bigCard);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
deck = new Deck();
|
||||
}
|
||||
refreshDeck();
|
||||
|
@ -622,17 +627,15 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
if (importer != null) {
|
||||
deck = Deck.load(importer.importDeck(file.getPath()));
|
||||
String errors = importer.getErrors();
|
||||
if(!errors.isEmpty()){
|
||||
if (!errors.isEmpty()) {
|
||||
JOptionPane.showMessageDialog(MageFrame.getDesktop(), errors, "Error importing deck", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Unknown deck format", "Error importing deck", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
logger.fatal(ex);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||
}
|
||||
refreshDeck();
|
||||
|
@ -640,7 +643,8 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
if (file != null) {
|
||||
MageFrame.getPreferences().put("lastImportFolder", file.getCanonicalPath());
|
||||
}
|
||||
} catch (IOException ex) { }
|
||||
} catch (IOException ex) {
|
||||
}
|
||||
}
|
||||
fcImportDeck.setSelectedFile(null);
|
||||
}//GEN-LAST:event_btnImportActionPerformed
|
||||
|
@ -660,7 +664,6 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
addLand.showDialog(deck);
|
||||
refreshDeck();
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private mage.client.cards.BigCard bigCard;
|
||||
private javax.swing.JButton btnExit;
|
||||
|
@ -675,7 +678,6 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
|||
private javax.swing.JLabel lblDeckName;
|
||||
private javax.swing.JTextField txtDeckName;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
private JComponent cardInfoPane;
|
||||
private javax.swing.JButton btnSubmit;
|
||||
private javax.swing.JButton btnAddLand;
|
||||
|
@ -694,10 +696,10 @@ class DeckFilter extends FileFilter {
|
|||
String s = f.getName();
|
||||
int i = s.lastIndexOf('.');
|
||||
|
||||
if (i > 0 && i < s.length() - 1) {
|
||||
ext = s.substring(i+1).toLowerCase();
|
||||
if (i > 0 && i < s.length() - 1) {
|
||||
ext = s.substring(i + 1).toLowerCase();
|
||||
}
|
||||
return (ext==null)?false:ext.equals("dck");
|
||||
return (ext == null) ? false : ext.equals("dck");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -718,8 +720,8 @@ class ImportFilter extends FileFilter {
|
|||
String s = f.getName();
|
||||
int i = s.lastIndexOf('.');
|
||||
|
||||
if (i > 0 && i < s.length() - 1) {
|
||||
ext = s.substring(i+1).toLowerCase();
|
||||
if (i > 0 && i < s.length() - 1) {
|
||||
ext = s.substring(i + 1).toLowerCase();
|
||||
}
|
||||
if (ext != null) {
|
||||
if (ext.toLowerCase().equals("dec") || ext.toLowerCase().equals("mwdeck") || ext.toLowerCase().equals("txt")) {
|
||||
|
@ -733,14 +735,11 @@ class ImportFilter extends FileFilter {
|
|||
public String getDescription() {
|
||||
return "*.dec | *.mwDeck | *.txt";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class UpdateDeckTask extends SwingWorker<Void, Void> {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(UpdateDeckTask.class);
|
||||
|
||||
private Session session;
|
||||
private UUID tableId;
|
||||
private Deck deck;
|
||||
|
@ -768,7 +767,7 @@ class UpdateDeckTask extends SwingWorker<Void, Void> {
|
|||
logger.fatal("Update Matches Task error", ex);
|
||||
} catch (ExecutionException ex) {
|
||||
logger.fatal("Update Matches Task error", ex);
|
||||
} catch (CancellationException ex) {}
|
||||
} catch (CancellationException ex) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -93,7 +93,11 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
|||
private boolean recentAscending;
|
||||
|
||||
|
||||
|
||||
public void clear() {
|
||||
this.clearCardEventListeners();
|
||||
this.clearCards();
|
||||
this.view.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCards(CardsView showCards, SortSetting sortSetting, boolean piles, BigCard bigCard, UUID gameId) {
|
||||
|
@ -110,7 +114,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
|||
int landCount = 0;
|
||||
int creatureCount = 0;
|
||||
if (!merge) {
|
||||
this.clear();
|
||||
this.clearCards();
|
||||
for (CardView card : showCards.values()) {
|
||||
addCard(card, bigCard, gameId);
|
||||
}
|
||||
|
@ -189,7 +193,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
|||
fireTableDataChanged();
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
public void clearCards() {
|
||||
view.clear();
|
||||
cards.clear();
|
||||
}
|
||||
|
|
|
@ -34,16 +34,16 @@
|
|||
|
||||
package mage.client.draft;
|
||||
|
||||
import mage.client.MagePane;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.Component;
|
||||
import java.awt.KeyboardFocusManager;
|
||||
import java.beans.PropertyVetoException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import javax.swing.JComponent;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.MagePane;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -55,8 +55,8 @@ public class DraftPane extends MagePane {
|
|||
public DraftPane() {
|
||||
boolean initialized = false;
|
||||
if (Plugins.getInstance().isThemePluginLoaded()) {
|
||||
Map<String, JComponent> ui = new HashMap<String, JComponent>();
|
||||
JComponent container = Plugins.getInstance().updateTablePanel(ui);
|
||||
Map<String, JComponent> uiComponents = new HashMap<String, JComponent>();
|
||||
JComponent container = Plugins.getInstance().updateTablePanel(uiComponents);
|
||||
if (container != null) {
|
||||
draftPanel1 = new mage.client.draft.DraftPanel();
|
||||
initComponents(container);
|
||||
|
@ -77,14 +77,7 @@ public class DraftPane extends MagePane {
|
|||
}
|
||||
|
||||
public void hideDraft() {
|
||||
KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner();
|
||||
try {
|
||||
this.setClosed(true);
|
||||
} catch (PropertyVetoException ex) {
|
||||
|
||||
}
|
||||
this.hideFrame();
|
||||
MageFrame.getDesktop().remove(this);
|
||||
this.hideFrame();
|
||||
}
|
||||
|
||||
/** This method is called from within the constructor to
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.1" encoding="UTF-8" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<NonVisualComponents>
|
||||
|
@ -21,7 +21,7 @@
|
|||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="draftLeftPane" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="draftPicks" pref="582" max="32767" attributes="0"/>
|
||||
|
@ -32,7 +32,7 @@
|
|||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="draftLeftPane" alignment="0" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="draftPicks" pref="106" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
||||
|
@ -42,7 +42,7 @@
|
|||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel1">
|
||||
<Container class="javax.swing.JPanel" name="draftLeftPane">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.BevelBorderInfo">
|
||||
|
@ -55,45 +55,45 @@
|
|||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="bigCard" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblCardNo" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="1" max="-2" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="1">
|
||||
<Component id="lblPack2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="txtPack2" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="lblPack1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="txtPack1" min="-2" pref="112" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="lblPack3" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="txtCardNo" alignment="0" pref="112" max="32767" attributes="0"/>
|
||||
<Component id="txtPack3" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="txtTimeRemaining" alignment="0" pref="112" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="chkPack3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="chkPack2" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="chkPack1" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="lblCardNo" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="1" max="-2" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="1">
|
||||
<Component id="lblPack2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="txtPack2" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="lblPack1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="txtPack1" min="-2" pref="112" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="lblPack3" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="txtCardNo" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="txtPack3" alignment="0" max="32767" attributes="0"/>
|
||||
<Component id="txtTimeRemaining" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="chkPack3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="chkPack2" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="chkPack1" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="lblMessage" pref="236" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lblMessage" pref="236" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
|
@ -206,6 +206,8 @@
|
|||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="mage.client.cards.CardsList" name="draftPicks">
|
||||
</Component>
|
||||
<Container class="mage.client.cards.DraftGrid" name="draftBooster">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
|
@ -228,7 +230,5 @@
|
|||
</DimensionLayout>
|
||||
</Layout>
|
||||
</Container>
|
||||
<Component class="mage.client.cards.CardsList" name="draftPicks">
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
|
|
@ -34,7 +34,13 @@
|
|||
|
||||
package mage.client.draft;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.UUID;
|
||||
import javax.swing.Timer;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.deckeditor.SortSettingDraft;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.client.util.CardsViewUtil;
|
||||
import mage.client.util.Event;
|
||||
|
@ -43,13 +49,6 @@ import mage.remote.Session;
|
|||
import mage.view.CardsView;
|
||||
import mage.view.DraftPickView;
|
||||
import mage.view.DraftView;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.UUID;
|
||||
import mage.client.deckeditor.SortSettingDraft;
|
||||
import mage.view.SimpleCardView;
|
||||
|
||||
/**
|
||||
|
@ -73,7 +72,7 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
draftBooster.setOpaque(false);
|
||||
draftPicks.setSortSetting(SortSettingDraft.getInstance());
|
||||
draftPicks.setOpaque(false);
|
||||
jPanel1.setOpaque(false);
|
||||
draftLeftPane.setOpaque(false);
|
||||
|
||||
countdown = new Timer(1000,
|
||||
new ActionListener() {
|
||||
|
@ -91,12 +90,18 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
draftPicks.clear();
|
||||
draftBooster.clear();
|
||||
}
|
||||
|
||||
public synchronized void showDraft(UUID draftId) {
|
||||
this.draftId = draftId;
|
||||
session = MageFrame.getSession();
|
||||
MageFrame.addDraft(draftId, this);
|
||||
if (!session.joinDraft(draftId))
|
||||
if (!session.joinDraft(draftId)) {
|
||||
hideDraft();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateDraft(DraftView draftView) {
|
||||
|
@ -157,6 +162,7 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
public void hideDraft() {
|
||||
this.clear();
|
||||
Component c = this.getParent();
|
||||
while (c != null && !(c instanceof DraftPane)) {
|
||||
c = c.getParent();
|
||||
|
@ -180,7 +186,7 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
private void initComponents() {
|
||||
|
||||
jSeparator1 = new javax.swing.JSeparator();
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
draftLeftPane = new javax.swing.JPanel();
|
||||
bigCard = new mage.client.cards.BigCard();
|
||||
lblCardNo = new javax.swing.JLabel();
|
||||
lblPack1 = new javax.swing.JLabel();
|
||||
|
@ -195,10 +201,10 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
chkPack3 = new javax.swing.JCheckBox();
|
||||
txtTimeRemaining = new javax.swing.JTextField();
|
||||
lblMessage = new javax.swing.JLabel();
|
||||
draftBooster = new mage.client.cards.DraftGrid();
|
||||
draftPicks = new mage.client.cards.CardsList();
|
||||
draftBooster = new mage.client.cards.DraftGrid();
|
||||
|
||||
jPanel1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
|
||||
draftLeftPane.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
|
||||
|
||||
lblCardNo.setText("Card #:");
|
||||
|
||||
|
@ -227,62 +233,61 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
|
||||
lblMessage.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||
|
||||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
||||
jPanel1.setLayout(jPanel1Layout);
|
||||
jPanel1Layout.setHorizontalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
javax.swing.GroupLayout draftLeftPaneLayout = new javax.swing.GroupLayout(draftLeftPane);
|
||||
draftLeftPane.setLayout(draftLeftPaneLayout);
|
||||
draftLeftPaneLayout.setHorizontalGroup(
|
||||
draftLeftPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(bigCard, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGroup(draftLeftPaneLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(lblCardNo))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(lblPack2)
|
||||
.addGroup(draftLeftPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(lblCardNo)
|
||||
.addGroup(draftLeftPaneLayout.createSequentialGroup()
|
||||
.addGroup(draftLeftPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, draftLeftPaneLayout.createSequentialGroup()
|
||||
.addComponent(lblPack2)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtPack2))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, draftLeftPaneLayout.createSequentialGroup()
|
||||
.addComponent(lblPack1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtPack1, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, draftLeftPaneLayout.createSequentialGroup()
|
||||
.addComponent(lblPack3)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(draftLeftPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(txtCardNo)
|
||||
.addComponent(txtPack3)
|
||||
.addComponent(txtTimeRemaining))))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtPack2))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(lblPack1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtPack1, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(lblPack3)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(txtCardNo, javax.swing.GroupLayout.DEFAULT_SIZE, 112, Short.MAX_VALUE)
|
||||
.addComponent(txtPack3)
|
||||
.addComponent(txtTimeRemaining, javax.swing.GroupLayout.DEFAULT_SIZE, 112, Short.MAX_VALUE))))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(chkPack3)
|
||||
.addComponent(chkPack2)
|
||||
.addComponent(chkPack1)))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(lblMessage, javax.swing.GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE)
|
||||
.addContainerGap())
|
||||
.addGroup(draftLeftPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(chkPack3)
|
||||
.addComponent(chkPack2)
|
||||
.addComponent(chkPack1)))
|
||||
.addGroup(draftLeftPaneLayout.createSequentialGroup()
|
||||
.addComponent(lblMessage, javax.swing.GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE)
|
||||
.addContainerGap())))
|
||||
);
|
||||
jPanel1Layout.setVerticalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
|
||||
draftLeftPaneLayout.setVerticalGroup(
|
||||
draftLeftPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, draftLeftPaneLayout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addGroup(draftLeftPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblPack1)
|
||||
.addComponent(txtPack1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(chkPack1))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addGroup(draftLeftPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblPack2)
|
||||
.addComponent(txtPack2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(chkPack2))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addGroup(draftLeftPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblPack3)
|
||||
.addComponent(txtPack3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(chkPack3))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addGroup(draftLeftPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lblCardNo)
|
||||
.addComponent(txtCardNo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGap(18, 18, 18)
|
||||
|
@ -311,7 +316,7 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(draftLeftPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, 0)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(draftPicks, javax.swing.GroupLayout.DEFAULT_SIZE, 582, Short.MAX_VALUE)
|
||||
|
@ -319,7 +324,7 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
);
|
||||
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(draftLeftPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addComponent(draftPicks, javax.swing.GroupLayout.DEFAULT_SIZE, 106, Short.MAX_VALUE)
|
||||
.addGap(0, 0, 0)
|
||||
|
@ -334,8 +339,8 @@ public class DraftPanel extends javax.swing.JPanel {
|
|||
private javax.swing.JCheckBox chkPack2;
|
||||
private javax.swing.JCheckBox chkPack3;
|
||||
private mage.client.cards.DraftGrid draftBooster;
|
||||
private javax.swing.JPanel draftLeftPane;
|
||||
private mage.client.cards.CardsList draftPicks;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JSeparator jSeparator1;
|
||||
private javax.swing.JLabel lblCardNo;
|
||||
private javax.swing.JLabel lblMessage;
|
||||
|
|
|
@ -148,7 +148,7 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
public synchronized void showTournament(UUID tournamentId) {
|
||||
this.tournamentId = tournamentId;
|
||||
session = MageFrame.getSession();
|
||||
MageFrame.addTournament(tournamentId, this);
|
||||
// MageFrame.addTournament(tournamentId, this);
|
||||
UUID chatRoomId = session.getTournamentChatId(tournamentId);
|
||||
if (session.joinTournament(tournamentId) && chatRoomId != null) {
|
||||
this.chatPanel1.connect(chatRoomId);
|
||||
|
|
|
@ -1,12 +1,38 @@
|
|||
package org.mage.card.arcane;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import java.awt.AlphaComposite;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Image;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.awt.event.MouseMotionListener;
|
||||
import java.awt.event.MouseWheelEvent;
|
||||
import java.awt.event.MouseWheelListener;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import mage.cards.MagePermanent;
|
||||
import mage.cards.TextPopup;
|
||||
import mage.cards.action.ActionCallback;
|
||||
import mage.cards.action.TransferData;
|
||||
import mage.client.util.AudioManager;
|
||||
import mage.components.ImagePanel;
|
||||
import mage.constants.CardType;
|
||||
import mage.utils.CardUtil;
|
||||
import mage.view.AbilityView;
|
||||
import mage.view.CardView;
|
||||
|
@ -18,15 +44,6 @@ import org.mage.card.arcane.ScaledImagePanel.ScalingType;
|
|||
import org.mage.plugins.card.images.ImageCache;
|
||||
import org.mage.plugins.card.utils.impl.ImageManagerImpl;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.constants.Constants;
|
||||
|
||||
/**
|
||||
* Main class for drawing Mage card object.
|
||||
*
|
||||
|
@ -88,7 +105,6 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
|
||||
private boolean isPermanent;
|
||||
private boolean hasSickness;
|
||||
private boolean isFoil;
|
||||
private String zone;
|
||||
|
||||
public double transformAngle = 1;
|
||||
|
@ -236,6 +252,23 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
});
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
if (dayNightButton != null) {
|
||||
for(ActionListener al: dayNightButton.getActionListeners()) {
|
||||
dayNightButton.removeActionListener(al);
|
||||
}
|
||||
}
|
||||
for(MouseListener ml: this.getMouseListeners() ){
|
||||
this.removeMouseListener(ml);
|
||||
}
|
||||
for(MouseMotionListener ml: this.getMouseMotionListeners() ){
|
||||
this.removeMouseMotionListener(ml);
|
||||
}
|
||||
for(MouseWheelListener ml: this.getMouseWheelListeners() ){
|
||||
this.removeMouseWheelListener(ml);
|
||||
}
|
||||
}
|
||||
|
||||
private void setText(CardView card) {
|
||||
if (displayTitleAnyway) {
|
||||
titleText.setText(card.getName());
|
||||
|
|
|
@ -3,7 +3,6 @@ package mage.cards.action;
|
|||
import java.awt.Component;
|
||||
import java.awt.Point;
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.cards.TextPopup;
|
||||
import mage.view.CardView;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue