forked from External/mage
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
|
|
@ -112,7 +112,6 @@ import mage.client.plugins.impl.Plugins;
|
||||||
import mage.client.remote.CallbackClientImpl;
|
import mage.client.remote.CallbackClientImpl;
|
||||||
import mage.client.table.TablesPane;
|
import mage.client.table.TablesPane;
|
||||||
import mage.client.tournament.TournamentPane;
|
import mage.client.tournament.TournamentPane;
|
||||||
import mage.client.tournament.TournamentPanel;
|
|
||||||
import mage.client.util.EDTExceptionHandler;
|
import mage.client.util.EDTExceptionHandler;
|
||||||
import mage.client.util.MusicPlayer;
|
import mage.client.util.MusicPlayer;
|
||||||
import mage.client.util.SettingsManager;
|
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, ChatPanel> chats = new HashMap<UUID, ChatPanel>();
|
||||||
private static final Map<UUID, GamePanel> games = new HashMap<UUID, GamePanel>();
|
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, 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 MageUI ui = new MageUI();
|
||||||
|
|
||||||
private static final ScheduledExecutorService pingTaskExecutor = Executors.newSingleThreadScheduledExecutor();
|
private static final ScheduledExecutorService pingTaskExecutor = Executors.newSingleThreadScheduledExecutor();
|
||||||
|
|
@ -1171,10 +1169,6 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
drafts.put(draftId, draftPanel);
|
drafts.put(draftId, draftPanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addTournament(UUID tournamentId, TournamentPanel tournament) {
|
|
||||||
tournaments.put(tournamentId, tournament);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UUID getId() {
|
public UUID getId() {
|
||||||
return clientId;
|
return clientId;
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,9 @@
|
||||||
|
|
||||||
package mage.client;
|
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 javax.swing.plaf.basic.BasicInternalFrameUI;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
@ -47,6 +50,7 @@ public abstract class MagePane extends javax.swing.JInternalFrame {
|
||||||
|
|
||||||
/** Creates new form MagePane */
|
/** Creates new form MagePane */
|
||||||
public MagePane() {
|
public MagePane() {
|
||||||
|
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||||
initComponents();
|
initComponents();
|
||||||
hideTitle();
|
hideTitle();
|
||||||
}
|
}
|
||||||
|
|
@ -64,7 +68,14 @@ public abstract class MagePane extends javax.swing.JInternalFrame {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hideFrame() {
|
public void hideFrame() {
|
||||||
|
KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner();
|
||||||
|
try {
|
||||||
|
this.setClosed(true);
|
||||||
|
} catch (PropertyVetoException ex) {
|
||||||
|
|
||||||
|
}
|
||||||
MageFrame.deactivate(this);
|
MageFrame.deactivate(this);
|
||||||
|
MageFrame.getDesktop().remove(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void activated() {
|
public void activated() {
|
||||||
|
|
|
||||||
|
|
@ -169,6 +169,7 @@ public class BigCard extends JComponent {
|
||||||
|
|
||||||
setFocusable(false);
|
setFocusable(false);
|
||||||
setMinimumSize(new Dimension(FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT));
|
setMinimumSize(new Dimension(FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT));
|
||||||
|
setName("bigCardPanel"); // NOI18N
|
||||||
setOpaque(false);
|
setOpaque(false);
|
||||||
setPreferredSize(getMinimumSize());
|
setPreferredSize(getMinimumSize());
|
||||||
setLayout(null);
|
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">
|
<Form version="1.3" maxVersion="1.7">
|
||||||
<AuxValues>
|
<AuxValues>
|
||||||
|
|
|
||||||
|
|
@ -46,11 +46,9 @@ import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.UUID;
|
||||||
import mage.cards.MageCard;
|
import mage.cards.MageCard;
|
||||||
import mage.client.constants.Constants.SortBy;
|
|
||||||
import mage.client.deckeditor.SortSetting;
|
import mage.client.deckeditor.SortSetting;
|
||||||
import mage.client.plugins.impl.Plugins;
|
import mage.client.plugins.impl.Plugins;
|
||||||
import mage.client.util.Config;
|
import mage.client.util.Config;
|
||||||
|
|
@ -58,6 +56,7 @@ import mage.client.util.Event;
|
||||||
import mage.client.util.Listener;
|
import mage.client.util.Listener;
|
||||||
import mage.view.CardView;
|
import mage.view.CardView;
|
||||||
import mage.view.CardsView;
|
import mage.view.CardsView;
|
||||||
|
import org.mage.card.arcane.CardPanel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -81,6 +80,16 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
|
||||||
initComponents();
|
initComponents();
|
||||||
setOpaque(false);
|
setOpaque(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
for(MouseListener ml: this.getMouseListeners()) {
|
||||||
|
this.removeMouseListener(ml);
|
||||||
|
}
|
||||||
|
this.clearCardEventListeners();
|
||||||
|
this.clearCards();
|
||||||
|
this.bigCard = null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadCards(CardsView showCards, SortSetting sortSetting, boolean piles, BigCard bigCard, UUID gameId) {
|
public void loadCards(CardsView showCards, SortSetting sortSetting, boolean piles, BigCard bigCard, UUID gameId) {
|
||||||
this.loadCards(showCards, sortSetting, piles, bigCard, gameId, true);
|
this.loadCards(showCards, sortSetting, piles, bigCard, gameId, true);
|
||||||
|
|
@ -105,7 +114,7 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.clear();
|
this.clearCards();
|
||||||
for (CardView card: showCards.values()) {
|
for (CardView card: showCards.values()) {
|
||||||
addCard(card, bigCard, gameId, drawImage);
|
addCard(card, bigCard, gameId, drawImage);
|
||||||
}
|
}
|
||||||
|
|
@ -216,7 +225,13 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
|
||||||
repaint();
|
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();
|
this.cards.clear();
|
||||||
removeAllCardImg();
|
removeAllCardImg();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,17 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
||||||
initListViewComponents();
|
initListViewComponents();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
this.clearCardEventListeners();
|
||||||
|
if (cards != null) {
|
||||||
|
cards.clear();
|
||||||
|
}
|
||||||
|
if (mainModel != null) {
|
||||||
|
mainModel.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void makeTransparent() {
|
private void makeTransparent() {
|
||||||
jScrollPane1.setOpaque(false);
|
jScrollPane1.setOpaque(false);
|
||||||
cardArea.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">
|
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||||
<AuxValues>
|
<AuxValues>
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
|
|
||||||
package mage.client.cards;
|
package mage.client.cards;
|
||||||
|
|
||||||
|
import java.awt.Component;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
|
|
@ -68,6 +69,15 @@ public class DraftGrid extends javax.swing.JPanel implements MouseListener {
|
||||||
initComponents();
|
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) {
|
public void loadBooster(CardsView booster, BigCard bigCard) {
|
||||||
this.bigCard = bigCard;
|
this.bigCard = bigCard;
|
||||||
this.removeAll();
|
this.removeAll();
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,10 @@
|
||||||
<Component id="tbTypes" alignment="0" pref="917" max="32767" attributes="0"/>
|
<Component id="tbTypes" alignment="0" pref="917" max="32767" attributes="0"/>
|
||||||
<Group type="102" alignment="1" attributes="0">
|
<Group type="102" alignment="1" attributes="0">
|
||||||
<EmptySpace max="-2" 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"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<Component id="jScrollPane1" alignment="0" pref="917" max="32767" attributes="0"/>
|
<Component id="cardSelectorScrollPane" alignment="0" pref="917" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
|
|
@ -33,9 +33,9 @@
|
||||||
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
||||||
<Component id="tbTypes" min="-2" pref="25" max="-2" attributes="0"/>
|
<Component id="tbTypes" min="-2" pref="25" max="-2" attributes="0"/>
|
||||||
<EmptySpace 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"/>
|
<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>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
|
|
@ -160,10 +160,6 @@
|
||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</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">
|
<Container class="javax.swing.JToolBar" name="tbTypes">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="floatable" type="boolean" value="false"/>
|
<Property name="floatable" type="boolean" value="false"/>
|
||||||
|
|
@ -307,7 +303,11 @@
|
||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</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>
|
<Properties>
|
||||||
<Property name="opaque" type="boolean" value="false"/>
|
<Property name="opaque" type="boolean" value="false"/>
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
<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.ActionListener;
|
||||||
import java.awt.event.ComponentEvent;
|
import java.awt.event.ComponentEvent;
|
||||||
import java.awt.event.ComponentListener;
|
import java.awt.event.ComponentListener;
|
||||||
import java.awt.event.ItemEvent;
|
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -111,8 +110,8 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
setOpaque(false);
|
setOpaque(false);
|
||||||
|
|
||||||
cardGrid.setOpaque(false);
|
cardGrid.setOpaque(false);
|
||||||
jScrollPane1.setOpaque(false);
|
cardSelectorScrollPane.setOpaque(false);
|
||||||
jScrollPane1.getViewport().setOpaque(false);
|
cardSelectorScrollPane.getViewport().setOpaque(false);
|
||||||
cbSortBy.setModel(new DefaultComboBoxModel(SortBy.values()));
|
cbSortBy.setModel(new DefaultComboBoxModel(SortBy.values()));
|
||||||
cbSortBy.setSelectedItem(sortSetting.getSortBy());
|
cbSortBy.setSelectedItem(sortSetting.getSortBy());
|
||||||
jTextFieldSearch.addActionListener(searchAction);
|
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(6).setPreferredWidth(15);
|
||||||
mainTable.getColumnModel().getColumn(7).setPreferredWidth(15);
|
mainTable.getColumnModel().getColumn(7).setPreferredWidth(15);
|
||||||
|
|
||||||
jScrollPane1.setViewportView(mainTable);
|
cardSelectorScrollPane.setViewportView(mainTable);
|
||||||
|
|
||||||
mainTable.setOpaque(false);
|
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(){
|
public void switchToGrid(){
|
||||||
jToggleListView.setSelected(false);
|
jToggleListView.setSelected(false);
|
||||||
jToggleCardView.setSelected(true);
|
jToggleCardView.setSelected(true);
|
||||||
currentView = cardGrid;
|
currentView = cardGrid;
|
||||||
jScrollPane1.setViewportView(cardGrid);
|
cardSelectorScrollPane.setViewportView(cardGrid);
|
||||||
cbSortBy.setEnabled(true);
|
cbSortBy.setEnabled(true);
|
||||||
chkPiles.setEnabled(true);
|
chkPiles.setEnabled(true);
|
||||||
jButtonAddToMain.setEnabled(false);
|
jButtonAddToMain.setEnabled(false);
|
||||||
|
|
@ -382,7 +390,6 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
cbExpansionSet = new javax.swing.JComboBox();
|
cbExpansionSet = new javax.swing.JComboBox();
|
||||||
btnBooster = new javax.swing.JButton();
|
btnBooster = new javax.swing.JButton();
|
||||||
btnClear = new javax.swing.JButton();
|
btnClear = new javax.swing.JButton();
|
||||||
jScrollPane1 = new javax.swing.JScrollPane();
|
|
||||||
tbTypes = new javax.swing.JToolBar();
|
tbTypes = new javax.swing.JToolBar();
|
||||||
rdoLand = new javax.swing.JRadioButton();
|
rdoLand = new javax.swing.JRadioButton();
|
||||||
rdoCreatures = 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();
|
cbSortBy = new javax.swing.JComboBox();
|
||||||
jToggleListView = new javax.swing.JToggleButton();
|
jToggleListView = new javax.swing.JToggleButton();
|
||||||
jToggleCardView = 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();
|
jButtonAddToMain = new javax.swing.JButton();
|
||||||
jButtonAddToSideboard = new javax.swing.JButton();
|
jButtonAddToSideboard = new javax.swing.JButton();
|
||||||
jLabel1 = new javax.swing.JLabel();
|
jLabel1 = new javax.swing.JLabel();
|
||||||
|
|
@ -641,8 +649,8 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
});
|
});
|
||||||
tbTypes.add(jToggleCardView);
|
tbTypes.add(jToggleCardView);
|
||||||
|
|
||||||
jPanel1.setOpaque(false);
|
cardSelectorBottomPanel.setOpaque(false);
|
||||||
jPanel1.setPreferredSize(new java.awt.Dimension(897, 35));
|
cardSelectorBottomPanel.setPreferredSize(new java.awt.Dimension(897, 35));
|
||||||
|
|
||||||
jButtonAddToMain.setText("+");
|
jButtonAddToMain.setText("+");
|
||||||
jButtonAddToMain.setToolTipText("Add to Main");
|
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:");
|
cardCountLabel.setText("Card count:");
|
||||||
|
|
||||||
cardCount.setForeground(java.awt.SystemColor.text);
|
|
||||||
cardCount.setText("0");
|
cardCount.setText("0");
|
||||||
|
|
||||||
jButtonRemoveFromMain.setText("-");
|
jButtonRemoveFromMain.setText("-");
|
||||||
|
|
@ -698,11 +704,11 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
javax.swing.GroupLayout cardSelectorBottomPanelLayout = new javax.swing.GroupLayout(cardSelectorBottomPanel);
|
||||||
jPanel1.setLayout(jPanel1Layout);
|
cardSelectorBottomPanel.setLayout(cardSelectorBottomPanelLayout);
|
||||||
jPanel1Layout.setHorizontalGroup(
|
cardSelectorBottomPanelLayout.setHorizontalGroup(
|
||||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
cardSelectorBottomPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
.addGroup(cardSelectorBottomPanelLayout.createSequentialGroup()
|
||||||
.addComponent(jButtonAddToMain)
|
.addComponent(jButtonAddToMain)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(jButtonRemoveFromMain)
|
.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)
|
.addComponent(cardCount, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addContainerGap(121, Short.MAX_VALUE))
|
.addContainerGap(121, Short.MAX_VALUE))
|
||||||
);
|
);
|
||||||
jPanel1Layout.setVerticalGroup(
|
cardSelectorBottomPanelLayout.setVerticalGroup(
|
||||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
cardSelectorBottomPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addGroup(cardSelectorBottomPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(jButtonAddToMain)
|
.addComponent(jButtonAddToMain)
|
||||||
.addComponent(jLabel1)
|
.addComponent(jLabel1)
|
||||||
.addComponent(jTextFieldSearch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.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)
|
.addComponent(tbTypes, javax.swing.GroupLayout.DEFAULT_SIZE, 917, Short.MAX_VALUE)
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.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())
|
.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.setVerticalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
|
@ -761,9 +767,9 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
.addGap(0, 0, 0)
|
.addGap(0, 0, 0)
|
||||||
.addComponent(tbTypes, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(tbTypes, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.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)
|
.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
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
|
|
@ -941,7 +947,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
jToggleListView.setSelected(true);
|
jToggleListView.setSelected(true);
|
||||||
jToggleCardView.setSelected(false);
|
jToggleCardView.setSelected(false);
|
||||||
currentView = mainModel;
|
currentView = mainModel;
|
||||||
jScrollPane1.setViewportView(mainTable);
|
cardSelectorScrollPane.setViewportView(mainTable);
|
||||||
cbSortBy.setEnabled(false);
|
cbSortBy.setEnabled(false);
|
||||||
chkPiles.setEnabled(false);
|
chkPiles.setEnabled(false);
|
||||||
jButtonAddToMain.setEnabled(true);
|
jButtonAddToMain.setEnabled(true);
|
||||||
|
|
@ -950,7 +956,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
jToggleCardView.setSelected(true);
|
jToggleCardView.setSelected(true);
|
||||||
jToggleListView.setSelected(false);
|
jToggleListView.setSelected(false);
|
||||||
currentView = cardGrid;
|
currentView = cardGrid;
|
||||||
jScrollPane1.setViewportView(cardGrid);
|
cardSelectorScrollPane.setViewportView(cardGrid);
|
||||||
cbSortBy.setEnabled(true);
|
cbSortBy.setEnabled(true);
|
||||||
chkPiles.setEnabled(true);
|
chkPiles.setEnabled(true);
|
||||||
jButtonAddToMain.setEnabled(false);
|
jButtonAddToMain.setEnabled(false);
|
||||||
|
|
@ -984,6 +990,8 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
private javax.swing.JButton btnClear;
|
private javax.swing.JButton btnClear;
|
||||||
private javax.swing.JLabel cardCount;
|
private javax.swing.JLabel cardCount;
|
||||||
private javax.swing.JLabel cardCountLabel;
|
private javax.swing.JLabel cardCountLabel;
|
||||||
|
private javax.swing.JPanel cardSelectorBottomPanel;
|
||||||
|
private javax.swing.JScrollPane cardSelectorScrollPane;
|
||||||
private javax.swing.JComboBox cbExpansionSet;
|
private javax.swing.JComboBox cbExpansionSet;
|
||||||
private javax.swing.JComboBox cbSortBy;
|
private javax.swing.JComboBox cbSortBy;
|
||||||
private javax.swing.JCheckBox chkPiles;
|
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 jButtonRemoveFromSideboard;
|
||||||
private javax.swing.JButton jButtonSearch;
|
private javax.swing.JButton jButtonSearch;
|
||||||
private javax.swing.JLabel jLabel1;
|
private javax.swing.JLabel jLabel1;
|
||||||
private javax.swing.JPanel jPanel1;
|
|
||||||
private javax.swing.JScrollPane jScrollPane1;
|
|
||||||
private javax.swing.JTextField jTextFieldSearch;
|
private javax.swing.JTextField jTextFieldSearch;
|
||||||
private javax.swing.JToggleButton jToggleCardView;
|
private javax.swing.JToggleButton jToggleCardView;
|
||||||
private javax.swing.JToggleButton jToggleListView;
|
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">
|
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||||
<AuxValues>
|
<AuxValues>
|
||||||
|
|
@ -16,17 +16,17 @@
|
||||||
<Layout>
|
<Layout>
|
||||||
<DimensionLayout dim="0">
|
<DimensionLayout dim="0">
|
||||||
<Group type="103" groupAlignment="0" attributes="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>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<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>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
</Layout>
|
</Layout>
|
||||||
<SubComponents>
|
<SubComponents>
|
||||||
<Container class="javax.swing.JSplitPane" name="jSplitPane1">
|
<Container class="javax.swing.JSplitPane" name="deckAreaSplitPane">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="orientation" type="int" value="0"/>
|
<Property name="orientation" type="int" value="0"/>
|
||||||
<Property name="resizeWeight" type="double" value="0.8"/>
|
<Property name="resizeWeight" type="double" value="0.8"/>
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ public class DeckArea extends javax.swing.JPanel {
|
||||||
/** Creates new form DeckArea */
|
/** Creates new form DeckArea */
|
||||||
public DeckArea() {
|
public DeckArea() {
|
||||||
initComponents();
|
initComponents();
|
||||||
jSplitPane1.setOpaque(false);
|
deckAreaSplitPane.setOpaque(false);
|
||||||
deckList.setSortSetting(SortSettingDeck.getInstance());
|
deckList.setSortSetting(SortSettingDeck.getInstance());
|
||||||
sideboardList.setSortSetting(SortSettingSideboard.getInstance());
|
sideboardList.setSortSetting(SortSettingSideboard.getInstance());
|
||||||
deckList.setOpaque(false);
|
deckList.setOpaque(false);
|
||||||
|
|
@ -60,6 +60,11 @@ public class DeckArea extends javax.swing.JPanel {
|
||||||
sideboardList.setDisplayNoCopies(true);
|
sideboardList.setDisplayNoCopies(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
deckList.clear();
|
||||||
|
sideboardList.clear();
|
||||||
|
}
|
||||||
|
|
||||||
public void showSideboard(boolean show) {
|
public void showSideboard(boolean show) {
|
||||||
this.sideboardList.setVisible(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
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
|
|
||||||
jSplitPane1 = new javax.swing.JSplitPane();
|
deckAreaSplitPane = new javax.swing.JSplitPane();
|
||||||
deckList = new mage.client.cards.CardsList();
|
deckList = new mage.client.cards.CardsList();
|
||||||
sideboardList = new mage.client.cards.CardsList();
|
sideboardList = new mage.client.cards.CardsList();
|
||||||
|
|
||||||
jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
|
deckAreaSplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
|
||||||
jSplitPane1.setResizeWeight(0.8);
|
deckAreaSplitPane.setResizeWeight(0.8);
|
||||||
jSplitPane1.setLeftComponent(deckList);
|
deckAreaSplitPane.setLeftComponent(deckList);
|
||||||
jSplitPane1.setRightComponent(sideboardList);
|
deckAreaSplitPane.setRightComponent(sideboardList);
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||||
this.setLayout(layout);
|
this.setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
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.setVerticalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
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
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
|
|
@ -126,8 +131,8 @@ public class DeckArea extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
|
private javax.swing.JSplitPane deckAreaSplitPane;
|
||||||
private mage.client.cards.CardsList deckList;
|
private mage.client.cards.CardsList deckList;
|
||||||
private javax.swing.JSplitPane jSplitPane1;
|
|
||||||
private mage.client.cards.CardsList sideboardList;
|
private mage.client.cards.CardsList sideboardList;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ public class DeckEditorPane extends MagePane {
|
||||||
|
|
||||||
/** Creates new form TablesPane */
|
/** Creates new form TablesPane */
|
||||||
public DeckEditorPane() {
|
public DeckEditorPane() {
|
||||||
|
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||||
boolean initialized = false;
|
boolean initialized = false;
|
||||||
if (Plugins.getInstance().isThemePluginLoaded()) {
|
if (Plugins.getInstance().isThemePluginLoaded()) {
|
||||||
Map<String, JComponent> uiMap = new HashMap<String, JComponent>();
|
Map<String, JComponent> uiMap = new HashMap<String, JComponent>();
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,30 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without modification, are
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
* permitted provided that the following conditions are met:
|
* permitted provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
* conditions and the following disclaimer.
|
* conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
* 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
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
* provided with the distribution.
|
* provided with the distribution.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
* 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
|
* 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
|
* 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
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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
|
* 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
|
* 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
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* The views and conclusions contained in the software and documentation are those of the
|
* 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
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
package mage.client.deckeditor;
|
package mage.client.deckeditor;
|
||||||
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
|
|
@ -61,6 +61,7 @@ import mage.client.constants.Constants.DeckEditorMode;
|
||||||
import mage.client.constants.Constants.SortBy;
|
import mage.client.constants.Constants.SortBy;
|
||||||
import mage.client.dialog.AddLandDialog;
|
import mage.client.dialog.AddLandDialog;
|
||||||
import mage.client.dialog.PreferencesDialog;
|
import mage.client.dialog.PreferencesDialog;
|
||||||
|
import mage.client.plugins.adapters.MageActionCallback;
|
||||||
import mage.client.plugins.impl.Plugins;
|
import mage.client.plugins.impl.Plugins;
|
||||||
import mage.client.util.Event;
|
import mage.client.util.Event;
|
||||||
import mage.client.util.Listener;
|
import mage.client.util.Listener;
|
||||||
|
|
@ -78,7 +79,6 @@ import org.apache.log4j.Logger;
|
||||||
public class DeckEditorPanel extends javax.swing.JPanel {
|
public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(DeckEditorPanel.class);
|
private static final Logger logger = Logger.getLogger(DeckEditorPanel.class);
|
||||||
|
|
||||||
private JFileChooser fcSelectDeck;
|
private JFileChooser fcSelectDeck;
|
||||||
private JFileChooser fcImportDeck;
|
private JFileChooser fcImportDeck;
|
||||||
private Deck deck = new Deck();
|
private Deck deck = new Deck();
|
||||||
|
|
@ -89,8 +89,9 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
private Timer countdown;
|
private Timer countdown;
|
||||||
private UpdateDeckTask updateDeckTask;
|
private UpdateDeckTask updateDeckTask;
|
||||||
|
|
||||||
|
/**
|
||||||
/** Creates new form DeckEditorPanel */
|
* Creates new form DeckEditorPanel
|
||||||
|
*/
|
||||||
public DeckEditorPanel() {
|
public DeckEditorPanel() {
|
||||||
initComponents();
|
initComponents();
|
||||||
fcSelectDeck = new JFileChooser();
|
fcSelectDeck = new JFileChooser();
|
||||||
|
|
@ -104,24 +105,40 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
jPanel1.setOpaque(false);
|
jPanel1.setOpaque(false);
|
||||||
jSplitPane1.setOpaque(false);
|
jSplitPane1.setOpaque(false);
|
||||||
countdown = new Timer(1000,
|
countdown = new Timer(1000,
|
||||||
new ActionListener() {
|
new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (--timeout > 0) {
|
if (--timeout > 0) {
|
||||||
setTimeout(timeout);
|
setTimeout(timeout);
|
||||||
}
|
} else {
|
||||||
else {
|
if (updateDeckTask != null) {
|
||||||
if (updateDeckTask != null) {
|
updateDeckTask.cancel(true);
|
||||||
updateDeckTask.cancel(true);
|
|
||||||
}
|
|
||||||
setTimeout(0);
|
|
||||||
countdown.stop();
|
|
||||||
hideDeckEditor();
|
|
||||||
}
|
}
|
||||||
|
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) {
|
public void showDeckEditor(DeckEditorMode mode, Deck deck, UUID tableId, int time) {
|
||||||
if (deck != null) {
|
if (deck != null) {
|
||||||
|
|
@ -138,7 +155,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
this.btnSubmit.setVisible(true);
|
this.btnSubmit.setVisible(true);
|
||||||
this.cardSelector.loadSideboard(new ArrayList<Card>(deck.getSideboard()), this.bigCard);
|
this.cardSelector.loadSideboard(new ArrayList<Card>(deck.getSideboard()), this.bigCard);
|
||||||
// TODO: take from preferences
|
// TODO: take from preferences
|
||||||
this.cardSelector.switchToGrid();
|
this.cardSelector.switchToGrid();
|
||||||
|
|
||||||
this.btnExit.setVisible(false);
|
this.btnExit.setVisible(false);
|
||||||
this.btnImport.setVisible(false);
|
this.btnImport.setVisible(false);
|
||||||
|
|
@ -179,113 +196,109 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
for (ICardGrid component : this.cardSelector.getCardGridComponents()) {
|
for (ICardGrid component : this.cardSelector.getCardGridComponents()) {
|
||||||
component.clearCardEventListeners();
|
component.clearCardEventListeners();
|
||||||
component.addCardEventListener(
|
component.addCardEventListener(
|
||||||
new Listener<Event> () {
|
new Listener<Event>() {
|
||||||
@Override
|
@Override
|
||||||
public void event(Event event) {
|
public void event(Event event) {
|
||||||
if (event.getEventName().equals("double-click")) {
|
if (event.getEventName().equals("double-click")) {
|
||||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||||
CardInfo cardInfo = CardRepository.instance.findCard(cardView.getExpansionSetCode(), cardView.getCardNumber());
|
CardInfo cardInfo = CardRepository.instance.findCard(cardView.getExpansionSetCode(), cardView.getCardNumber());
|
||||||
Card card = null;
|
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) {
|
if (mode == DeckEditorMode.Sideboard || mode == DeckEditorMode.Limited) {
|
||||||
Iterator sideboard = deck.getSideboard().iterator();
|
deck.getSideboard().remove(card);
|
||||||
while (sideboard.hasNext()) {
|
cardSelector.removeCard(card.getId());
|
||||||
card = (Card) sideboard.next();
|
cardSelector.setCardCount(deck.getSideboard().size());
|
||||||
if (card.getId().equals(cardView.getId())) {
|
cardSelector.refresh();
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
card = cardInfo != null ? cardInfo.getMockCard() : null;
|
|
||||||
}
|
}
|
||||||
if (card != null) {
|
if (cardInfoPane instanceof CardInfoPane) {
|
||||||
deck.getCards().add(card);
|
((CardInfoPane) cardInfoPane).setCard(new CardView(card), null);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
hidePopup();
|
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.clearDeckEventListeners();
|
||||||
this.deckArea.addDeckEventListener(
|
this.deckArea.addDeckEventListener(
|
||||||
new Listener<Event> () {
|
new Listener<Event>() {
|
||||||
@Override
|
@Override
|
||||||
public void event(Event event) {
|
public void event(Event event) {
|
||||||
if (event.getEventName().equals("double-click")) {
|
if (event.getEventName().equals("double-click")) {
|
||||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||||
for (Card card: deck.getCards()) {
|
for (Card card : deck.getCards()) {
|
||||||
if (card.getId().equals(cardView.getId())) {
|
if (card.getId().equals(cardView.getId())) {
|
||||||
deck.getCards().remove(card);
|
deck.getCards().remove(card);
|
||||||
if (mode == DeckEditorMode.Limited || mode == DeckEditorMode.Sideboard) {
|
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);
|
|
||||||
deck.getSideboard().add(card);
|
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(
|
this.deckArea.addSideboardEventListener(
|
||||||
new Listener<Event> () {
|
new Listener<Event>() {
|
||||||
@Override
|
@Override
|
||||||
public void event(Event event) {
|
public void event(Event event) {
|
||||||
if (event.getEventName().equals("double-click")) {
|
if (event.getEventName().equals("double-click")) {
|
||||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||||
for (Card card: deck.getSideboard()) {
|
for (Card card : deck.getSideboard()) {
|
||||||
if (card.getId().equals(cardView.getId())) {
|
if (card.getId().equals(cardView.getId())) {
|
||||||
deck.getSideboard().remove(card);
|
deck.getSideboard().remove(card);
|
||||||
deck.getCards().add(card);
|
deck.getCards().add(card);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
hidePopup();
|
|
||||||
refreshDeck();
|
|
||||||
}
|
}
|
||||||
|
hidePopup();
|
||||||
|
refreshDeck();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
// Set Sort from Preferences
|
// Set Sort from Preferences
|
||||||
SortBy sortBy = SortBy.getByString(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_DRAFT_SORT_BY, "Color"));
|
SortBy sortBy = SortBy.getByString(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_DRAFT_SORT_BY, "Color"));
|
||||||
deckArea.getDeckList().setSortBy(sortBy);
|
deckArea.getDeckList().setSortBy(sortBy);
|
||||||
|
|
@ -294,21 +307,20 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
this.setVisible(true);
|
this.setVisible(true);
|
||||||
this.repaint();
|
this.repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hidePopup() {
|
private void hidePopup() {
|
||||||
Plugins.getInstance().getActionCallback().mouseExited(null, null);
|
Plugins.getInstance().getActionCallback().mouseExited(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hideDeckEditor() {
|
public void hideDeckEditor() {
|
||||||
if (updateDeckTask != null) {
|
this.clear();
|
||||||
updateDeckTask.cancel(true);
|
|
||||||
}
|
|
||||||
Component c = this.getParent();
|
Component c = this.getParent();
|
||||||
while (c != null && !(c instanceof DeckEditorPane)) {
|
while (c != null && !(c instanceof DeckEditorPane)) {
|
||||||
c = c.getParent();
|
c = c.getParent();
|
||||||
}
|
}
|
||||||
if (c != null) {
|
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));
|
setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
||||||
this.txtDeckName.setText(deck.getName());
|
this.txtDeckName.setText(deck.getName());
|
||||||
deckArea.loadDeck(deck, bigCard);
|
deckArea.loadDeck(deck, bigCard);
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setTimeout(int s){
|
private void setTimeout(int s) {
|
||||||
int minute = s/60;
|
int minute = s / 60;
|
||||||
int second = s - (minute*60);
|
int second = s - (minute * 60);
|
||||||
String text;
|
String text;
|
||||||
if(minute < 10){
|
if (minute < 10) {
|
||||||
text = "0" + Integer.toString(minute) + ":";
|
text = "0" + Integer.toString(minute) + ":";
|
||||||
}else{
|
} else {
|
||||||
text = Integer.toString(minute) + ":";
|
text = Integer.toString(minute) + ":";
|
||||||
}
|
}
|
||||||
if(second < 10){
|
if (second < 10) {
|
||||||
text = text + "0" + Integer.toString(second);
|
text = text + "0" + Integer.toString(second);
|
||||||
}else{
|
} else {
|
||||||
text = text + Integer.toString(second);
|
text = text + Integer.toString(second);
|
||||||
}
|
}
|
||||||
this.txtTimeRemaining.setText(text);
|
this.txtTimeRemaining.setText(text);
|
||||||
|
|
@ -378,7 +389,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
cardInfoPane = Plugins.getInstance().getCardInfoPane();
|
cardInfoPane = Plugins.getInstance().getCardInfoPane();
|
||||||
if (cardInfoPane != null && System.getProperty("testCardInfo") != null) {
|
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)));
|
cardInfoPane.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
|
||||||
isShowCardInfo = true;
|
isShowCardInfo = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -457,82 +468,77 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
jPanel1.setLayout(jPanel1Layout);
|
jPanel1.setLayout(jPanel1Layout);
|
||||||
jPanel1Layout.setHorizontalGroup(
|
jPanel1Layout.setHorizontalGroup(
|
||||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
/*.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
|
/*.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(jLayeredPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE))*/
|
.addComponent(jLayeredPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE))*/
|
||||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||||
.addGap(6, 6, 6)
|
.addGap(6, 6, 6)
|
||||||
.addComponent(lblDeckName)
|
.addComponent(lblDeckName)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(txtDeckName, javax.swing.GroupLayout.DEFAULT_SIZE, 189, Short.MAX_VALUE))
|
.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(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)
|
.addComponent(bigCard, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(btnSave)
|
.addComponent(btnSave)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(btnLoad)
|
.addComponent(btnLoad)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(btnNew)
|
.addComponent(btnNew)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(btnExit))
|
.addComponent(btnExit))
|
||||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(btnImport)
|
.addComponent(btnImport)
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(btnAddLand)
|
.addComponent(btnAddLand)
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(btnSubmit))
|
.addComponent(btnSubmit))
|
||||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(txtTimeRemaining))
|
.addComponent(txtTimeRemaining)))
|
||||||
)
|
.addContainerGap()));
|
||||||
.addContainerGap())
|
|
||||||
);
|
|
||||||
jPanel1Layout.setVerticalGroup(
|
jPanel1Layout.setVerticalGroup(
|
||||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.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(txtDeckName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(lblDeckName))
|
.addComponent(lblDeckName))
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(btnSave)
|
.addComponent(btnSave)
|
||||||
.addComponent(btnLoad)
|
.addComponent(btnLoad)
|
||||||
.addComponent(btnNew)
|
.addComponent(btnNew)
|
||||||
.addComponent(btnExit))
|
.addComponent(btnExit))
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(btnImport)
|
.addComponent(btnImport)
|
||||||
.addComponent(btnAddLand)
|
.addComponent(btnAddLand)
|
||||||
.addComponent(btnSubmit))
|
.addComponent(btnSubmit))
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.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)
|
//.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)
|
.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)
|
.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)
|
.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);
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||||
this.setLayout(layout);
|
this.setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addGap(0, 0, 0)
|
.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.setVerticalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.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)
|
.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
|
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);
|
JOptionPane.showMessageDialog(MageFrame.getDesktop(), ex.getMessage(), "Error loading deck", JOptionPane.ERROR_MESSAGE);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
logger.fatal(ex);
|
logger.fatal(ex);
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||||
}
|
}
|
||||||
refreshDeck();
|
refreshDeck();
|
||||||
try {
|
try {
|
||||||
MageFrame.getPreferences().put("lastDeckFolder", file.getCanonicalPath());
|
MageFrame.getPreferences().put("lastDeckFolder", file.getCanonicalPath());
|
||||||
} catch (IOException ex) { }
|
} catch (IOException ex) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fcSelectDeck.setSelectedFile(null);
|
fcSelectDeck.setSelectedFile(null);
|
||||||
}//GEN-LAST:event_btnLoadActionPerformed
|
}//GEN-LAST:event_btnLoadActionPerformed
|
||||||
|
|
@ -580,25 +586,24 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
Sets.saveDeck(fileName, deck.getDeckCardLists());
|
Sets.saveDeck(fileName, deck.getDeckCardLists());
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
logger.fatal(ex);
|
logger.fatal(ex);
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
MageFrame.getPreferences().put("lastDeckFolder", file.getCanonicalPath());
|
MageFrame.getPreferences().put("lastDeckFolder", file.getCanonicalPath());
|
||||||
} catch (IOException ex) { }
|
} catch (IOException ex) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}//GEN-LAST:event_btnSaveActionPerformed
|
}//GEN-LAST:event_btnSaveActionPerformed
|
||||||
|
|
||||||
private void btnNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNewActionPerformed
|
private void btnNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNewActionPerformed
|
||||||
if (mode == DeckEditorMode.Sideboard || mode == DeckEditorMode.Limited) {
|
if (mode == DeckEditorMode.Sideboard || mode == DeckEditorMode.Limited) {
|
||||||
for (Card card: deck.getCards()) {
|
for (Card card : deck.getCards()) {
|
||||||
deck.getSideboard().add(card);
|
deck.getSideboard().add(card);
|
||||||
}
|
}
|
||||||
deck.getCards().clear();
|
deck.getCards().clear();
|
||||||
cardSelector.loadSideboard(new ArrayList<Card>(deck.getSideboard()), this.bigCard);
|
cardSelector.loadSideboard(new ArrayList<Card>(deck.getSideboard()), this.bigCard);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
deck = new Deck();
|
deck = new Deck();
|
||||||
}
|
}
|
||||||
refreshDeck();
|
refreshDeck();
|
||||||
|
|
@ -622,17 +627,15 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
if (importer != null) {
|
if (importer != null) {
|
||||||
deck = Deck.load(importer.importDeck(file.getPath()));
|
deck = Deck.load(importer.importDeck(file.getPath()));
|
||||||
String errors = importer.getErrors();
|
String errors = importer.getErrors();
|
||||||
if(!errors.isEmpty()){
|
if (!errors.isEmpty()) {
|
||||||
JOptionPane.showMessageDialog(MageFrame.getDesktop(), errors, "Error importing deck", JOptionPane.ERROR_MESSAGE);
|
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);
|
JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Unknown deck format", "Error importing deck", JOptionPane.ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
logger.fatal(ex);
|
logger.fatal(ex);
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||||
}
|
}
|
||||||
refreshDeck();
|
refreshDeck();
|
||||||
|
|
@ -640,7 +643,8 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
MageFrame.getPreferences().put("lastImportFolder", file.getCanonicalPath());
|
MageFrame.getPreferences().put("lastImportFolder", file.getCanonicalPath());
|
||||||
}
|
}
|
||||||
} catch (IOException ex) { }
|
} catch (IOException ex) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fcImportDeck.setSelectedFile(null);
|
fcImportDeck.setSelectedFile(null);
|
||||||
}//GEN-LAST:event_btnImportActionPerformed
|
}//GEN-LAST:event_btnImportActionPerformed
|
||||||
|
|
@ -660,7 +664,6 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
addLand.showDialog(deck);
|
addLand.showDialog(deck);
|
||||||
refreshDeck();
|
refreshDeck();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
private mage.client.cards.BigCard bigCard;
|
private mage.client.cards.BigCard bigCard;
|
||||||
private javax.swing.JButton btnExit;
|
private javax.swing.JButton btnExit;
|
||||||
|
|
@ -675,7 +678,6 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
private javax.swing.JLabel lblDeckName;
|
private javax.swing.JLabel lblDeckName;
|
||||||
private javax.swing.JTextField txtDeckName;
|
private javax.swing.JTextField txtDeckName;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
|
|
||||||
private JComponent cardInfoPane;
|
private JComponent cardInfoPane;
|
||||||
private javax.swing.JButton btnSubmit;
|
private javax.swing.JButton btnSubmit;
|
||||||
private javax.swing.JButton btnAddLand;
|
private javax.swing.JButton btnAddLand;
|
||||||
|
|
@ -694,10 +696,10 @@ class DeckFilter extends FileFilter {
|
||||||
String s = f.getName();
|
String s = f.getName();
|
||||||
int i = s.lastIndexOf('.');
|
int i = s.lastIndexOf('.');
|
||||||
|
|
||||||
if (i > 0 && i < s.length() - 1) {
|
if (i > 0 && i < s.length() - 1) {
|
||||||
ext = s.substring(i+1).toLowerCase();
|
ext = s.substring(i + 1).toLowerCase();
|
||||||
}
|
}
|
||||||
return (ext==null)?false:ext.equals("dck");
|
return (ext == null) ? false : ext.equals("dck");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -718,8 +720,8 @@ class ImportFilter extends FileFilter {
|
||||||
String s = f.getName();
|
String s = f.getName();
|
||||||
int i = s.lastIndexOf('.');
|
int i = s.lastIndexOf('.');
|
||||||
|
|
||||||
if (i > 0 && i < s.length() - 1) {
|
if (i > 0 && i < s.length() - 1) {
|
||||||
ext = s.substring(i+1).toLowerCase();
|
ext = s.substring(i + 1).toLowerCase();
|
||||||
}
|
}
|
||||||
if (ext != null) {
|
if (ext != null) {
|
||||||
if (ext.toLowerCase().equals("dec") || ext.toLowerCase().equals("mwdeck") || ext.toLowerCase().equals("txt")) {
|
if (ext.toLowerCase().equals("dec") || ext.toLowerCase().equals("mwdeck") || ext.toLowerCase().equals("txt")) {
|
||||||
|
|
@ -733,14 +735,11 @@ class ImportFilter extends FileFilter {
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return "*.dec | *.mwDeck | *.txt";
|
return "*.dec | *.mwDeck | *.txt";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class UpdateDeckTask extends SwingWorker<Void, Void> {
|
class UpdateDeckTask extends SwingWorker<Void, Void> {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(UpdateDeckTask.class);
|
private static final Logger logger = Logger.getLogger(UpdateDeckTask.class);
|
||||||
|
|
||||||
private Session session;
|
private Session session;
|
||||||
private UUID tableId;
|
private UUID tableId;
|
||||||
private Deck deck;
|
private Deck deck;
|
||||||
|
|
@ -768,7 +767,7 @@ class UpdateDeckTask extends SwingWorker<Void, Void> {
|
||||||
logger.fatal("Update Matches Task error", ex);
|
logger.fatal("Update Matches Task error", ex);
|
||||||
} catch (ExecutionException ex) {
|
} catch (ExecutionException ex) {
|
||||||
logger.fatal("Update Matches Task error", 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;
|
private boolean recentAscending;
|
||||||
|
|
||||||
|
|
||||||
|
public void clear() {
|
||||||
|
this.clearCardEventListeners();
|
||||||
|
this.clearCards();
|
||||||
|
this.view.clear();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadCards(CardsView showCards, SortSetting sortSetting, boolean piles, BigCard bigCard, UUID gameId) {
|
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 landCount = 0;
|
||||||
int creatureCount = 0;
|
int creatureCount = 0;
|
||||||
if (!merge) {
|
if (!merge) {
|
||||||
this.clear();
|
this.clearCards();
|
||||||
for (CardView card : showCards.values()) {
|
for (CardView card : showCards.values()) {
|
||||||
addCard(card, bigCard, gameId);
|
addCard(card, bigCard, gameId);
|
||||||
}
|
}
|
||||||
|
|
@ -189,7 +193,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
||||||
fireTableDataChanged();
|
fireTableDataChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clear() {
|
public void clearCards() {
|
||||||
view.clear();
|
view.clear();
|
||||||
cards.clear();
|
cards.clear();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,16 +34,16 @@
|
||||||
|
|
||||||
package mage.client.draft;
|
package mage.client.draft;
|
||||||
|
|
||||||
import mage.client.MagePane;
|
import java.awt.Component;
|
||||||
import mage.client.plugins.impl.Plugins;
|
import java.awt.KeyboardFocusManager;
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
|
||||||
import java.beans.PropertyVetoException;
|
import java.beans.PropertyVetoException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import javax.swing.JComponent;
|
||||||
import mage.client.MageFrame;
|
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() {
|
public DraftPane() {
|
||||||
boolean initialized = false;
|
boolean initialized = false;
|
||||||
if (Plugins.getInstance().isThemePluginLoaded()) {
|
if (Plugins.getInstance().isThemePluginLoaded()) {
|
||||||
Map<String, JComponent> ui = new HashMap<String, JComponent>();
|
Map<String, JComponent> uiComponents = new HashMap<String, JComponent>();
|
||||||
JComponent container = Plugins.getInstance().updateTablePanel(ui);
|
JComponent container = Plugins.getInstance().updateTablePanel(uiComponents);
|
||||||
if (container != null) {
|
if (container != null) {
|
||||||
draftPanel1 = new mage.client.draft.DraftPanel();
|
draftPanel1 = new mage.client.draft.DraftPanel();
|
||||||
initComponents(container);
|
initComponents(container);
|
||||||
|
|
@ -77,14 +77,7 @@ public class DraftPane extends MagePane {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hideDraft() {
|
public void hideDraft() {
|
||||||
KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner();
|
this.hideFrame();
|
||||||
try {
|
|
||||||
this.setClosed(true);
|
|
||||||
} catch (PropertyVetoException ex) {
|
|
||||||
|
|
||||||
}
|
|
||||||
this.hideFrame();
|
|
||||||
MageFrame.getDesktop().remove(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method is called from within the constructor to
|
/** 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">
|
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||||
<NonVisualComponents>
|
<NonVisualComponents>
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
<DimensionLayout dim="0">
|
<DimensionLayout dim="0">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" alignment="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"/>
|
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="draftPicks" pref="582" max="32767" attributes="0"/>
|
<Component id="draftPicks" pref="582" max="32767" attributes="0"/>
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<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">
|
<Group type="102" alignment="1" attributes="0">
|
||||||
<Component id="draftPicks" pref="106" max="32767" attributes="0"/>
|
<Component id="draftPicks" pref="106" max="32767" attributes="0"/>
|
||||||
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
</Layout>
|
</Layout>
|
||||||
<SubComponents>
|
<SubComponents>
|
||||||
<Container class="javax.swing.JPanel" name="jPanel1">
|
<Container class="javax.swing.JPanel" name="draftLeftPane">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||||
<Border info="org.netbeans.modules.form.compat2.border.BevelBorderInfo">
|
<Border info="org.netbeans.modules.form.compat2.border.BevelBorderInfo">
|
||||||
|
|
@ -55,45 +55,45 @@
|
||||||
<DimensionLayout dim="0">
|
<DimensionLayout dim="0">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="bigCard" min="-2" max="-2" attributes="0"/>
|
<Component id="bigCard" min="-2" max="-2" attributes="0"/>
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" 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>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="chkPack3" min="-2" max="-2" attributes="0"/>
|
<Component id="lblCardNo" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="chkPack2" min="-2" max="-2" attributes="0"/>
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<Component id="chkPack1" alignment="0" min="-2" 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" 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>
|
</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>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
|
|
@ -206,6 +206,8 @@
|
||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</Container>
|
||||||
|
<Component class="mage.client.cards.CardsList" name="draftPicks">
|
||||||
|
</Component>
|
||||||
<Container class="mage.client.cards.DraftGrid" name="draftBooster">
|
<Container class="mage.client.cards.DraftGrid" name="draftBooster">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||||
|
|
@ -228,7 +230,5 @@
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
</Layout>
|
</Layout>
|
||||||
</Container>
|
</Container>
|
||||||
<Component class="mage.client.cards.CardsList" name="draftPicks">
|
|
||||||
</Component>
|
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,13 @@
|
||||||
|
|
||||||
package mage.client.draft;
|
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.MageFrame;
|
||||||
|
import mage.client.deckeditor.SortSettingDraft;
|
||||||
import mage.client.plugins.impl.Plugins;
|
import mage.client.plugins.impl.Plugins;
|
||||||
import mage.client.util.CardsViewUtil;
|
import mage.client.util.CardsViewUtil;
|
||||||
import mage.client.util.Event;
|
import mage.client.util.Event;
|
||||||
|
|
@ -43,13 +49,6 @@ import mage.remote.Session;
|
||||||
import mage.view.CardsView;
|
import mage.view.CardsView;
|
||||||
import mage.view.DraftPickView;
|
import mage.view.DraftPickView;
|
||||||
import mage.view.DraftView;
|
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;
|
import mage.view.SimpleCardView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -73,7 +72,7 @@ public class DraftPanel extends javax.swing.JPanel {
|
||||||
draftBooster.setOpaque(false);
|
draftBooster.setOpaque(false);
|
||||||
draftPicks.setSortSetting(SortSettingDraft.getInstance());
|
draftPicks.setSortSetting(SortSettingDraft.getInstance());
|
||||||
draftPicks.setOpaque(false);
|
draftPicks.setOpaque(false);
|
||||||
jPanel1.setOpaque(false);
|
draftLeftPane.setOpaque(false);
|
||||||
|
|
||||||
countdown = new Timer(1000,
|
countdown = new Timer(1000,
|
||||||
new ActionListener() {
|
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) {
|
public synchronized void showDraft(UUID draftId) {
|
||||||
this.draftId = draftId;
|
this.draftId = draftId;
|
||||||
session = MageFrame.getSession();
|
session = MageFrame.getSession();
|
||||||
MageFrame.addDraft(draftId, this);
|
MageFrame.addDraft(draftId, this);
|
||||||
if (!session.joinDraft(draftId))
|
if (!session.joinDraft(draftId)) {
|
||||||
hideDraft();
|
hideDraft();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateDraft(DraftView draftView) {
|
public void updateDraft(DraftView draftView) {
|
||||||
|
|
@ -157,6 +162,7 @@ public class DraftPanel extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hideDraft() {
|
public void hideDraft() {
|
||||||
|
this.clear();
|
||||||
Component c = this.getParent();
|
Component c = this.getParent();
|
||||||
while (c != null && !(c instanceof DraftPane)) {
|
while (c != null && !(c instanceof DraftPane)) {
|
||||||
c = c.getParent();
|
c = c.getParent();
|
||||||
|
|
@ -180,7 +186,7 @@ public class DraftPanel extends javax.swing.JPanel {
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
|
|
||||||
jSeparator1 = new javax.swing.JSeparator();
|
jSeparator1 = new javax.swing.JSeparator();
|
||||||
jPanel1 = new javax.swing.JPanel();
|
draftLeftPane = new javax.swing.JPanel();
|
||||||
bigCard = new mage.client.cards.BigCard();
|
bigCard = new mage.client.cards.BigCard();
|
||||||
lblCardNo = new javax.swing.JLabel();
|
lblCardNo = new javax.swing.JLabel();
|
||||||
lblPack1 = 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();
|
chkPack3 = new javax.swing.JCheckBox();
|
||||||
txtTimeRemaining = new javax.swing.JTextField();
|
txtTimeRemaining = new javax.swing.JTextField();
|
||||||
lblMessage = new javax.swing.JLabel();
|
lblMessage = new javax.swing.JLabel();
|
||||||
draftBooster = new mage.client.cards.DraftGrid();
|
|
||||||
draftPicks = new mage.client.cards.CardsList();
|
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 #:");
|
lblCardNo.setText("Card #:");
|
||||||
|
|
||||||
|
|
@ -227,62 +233,61 @@ public class DraftPanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
lblMessage.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
lblMessage.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||||
|
|
||||||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
javax.swing.GroupLayout draftLeftPaneLayout = new javax.swing.GroupLayout(draftLeftPane);
|
||||||
jPanel1.setLayout(jPanel1Layout);
|
draftLeftPane.setLayout(draftLeftPaneLayout);
|
||||||
jPanel1Layout.setHorizontalGroup(
|
draftLeftPaneLayout.setHorizontalGroup(
|
||||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
draftLeftPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.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)
|
||||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
.addGroup(draftLeftPaneLayout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(lblCardNo))
|
.addGroup(draftLeftPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
.addComponent(lblCardNo)
|
||||||
.addContainerGap()
|
.addGroup(draftLeftPaneLayout.createSequentialGroup()
|
||||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
.addGroup(draftLeftPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
|
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, draftLeftPaneLayout.createSequentialGroup()
|
||||||
.addComponent(lblPack2)
|
.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)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(txtPack2))
|
.addGroup(draftLeftPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
|
.addComponent(chkPack3)
|
||||||
.addComponent(lblPack1)
|
.addComponent(chkPack2)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addComponent(chkPack1)))
|
||||||
.addComponent(txtPack1, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addGroup(draftLeftPaneLayout.createSequentialGroup()
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
|
.addComponent(lblMessage, javax.swing.GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE)
|
||||||
.addComponent(lblPack3)
|
.addContainerGap())))
|
||||||
.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())
|
|
||||||
);
|
);
|
||||||
jPanel1Layout.setVerticalGroup(
|
draftLeftPaneLayout.setVerticalGroup(
|
||||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
draftLeftPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, draftLeftPaneLayout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addGroup(draftLeftPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(lblPack1)
|
.addComponent(lblPack1)
|
||||||
.addComponent(txtPack1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(txtPack1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(chkPack1))
|
.addComponent(chkPack1))
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.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(lblPack2)
|
||||||
.addComponent(txtPack2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(txtPack2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(chkPack2))
|
.addComponent(chkPack2))
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.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(lblPack3)
|
||||||
.addComponent(txtPack3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(txtPack3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(chkPack3))
|
.addComponent(chkPack3))
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.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(lblCardNo)
|
||||||
.addComponent(txtCardNo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addComponent(txtCardNo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
.addGap(18, 18, 18)
|
.addGap(18, 18, 18)
|
||||||
|
|
@ -311,7 +316,7 @@ public class DraftPanel extends javax.swing.JPanel {
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.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)
|
.addGap(0, 0, 0)
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(draftPicks, javax.swing.GroupLayout.DEFAULT_SIZE, 582, Short.MAX_VALUE)
|
.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.setVerticalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
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()
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||||
.addComponent(draftPicks, javax.swing.GroupLayout.DEFAULT_SIZE, 106, Short.MAX_VALUE)
|
.addComponent(draftPicks, javax.swing.GroupLayout.DEFAULT_SIZE, 106, Short.MAX_VALUE)
|
||||||
.addGap(0, 0, 0)
|
.addGap(0, 0, 0)
|
||||||
|
|
@ -334,8 +339,8 @@ public class DraftPanel extends javax.swing.JPanel {
|
||||||
private javax.swing.JCheckBox chkPack2;
|
private javax.swing.JCheckBox chkPack2;
|
||||||
private javax.swing.JCheckBox chkPack3;
|
private javax.swing.JCheckBox chkPack3;
|
||||||
private mage.client.cards.DraftGrid draftBooster;
|
private mage.client.cards.DraftGrid draftBooster;
|
||||||
|
private javax.swing.JPanel draftLeftPane;
|
||||||
private mage.client.cards.CardsList draftPicks;
|
private mage.client.cards.CardsList draftPicks;
|
||||||
private javax.swing.JPanel jPanel1;
|
|
||||||
private javax.swing.JSeparator jSeparator1;
|
private javax.swing.JSeparator jSeparator1;
|
||||||
private javax.swing.JLabel lblCardNo;
|
private javax.swing.JLabel lblCardNo;
|
||||||
private javax.swing.JLabel lblMessage;
|
private javax.swing.JLabel lblMessage;
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ public class TournamentPanel extends javax.swing.JPanel {
|
||||||
public synchronized void showTournament(UUID tournamentId) {
|
public synchronized void showTournament(UUID tournamentId) {
|
||||||
this.tournamentId = tournamentId;
|
this.tournamentId = tournamentId;
|
||||||
session = MageFrame.getSession();
|
session = MageFrame.getSession();
|
||||||
MageFrame.addTournament(tournamentId, this);
|
// MageFrame.addTournament(tournamentId, this);
|
||||||
UUID chatRoomId = session.getTournamentChatId(tournamentId);
|
UUID chatRoomId = session.getTournamentChatId(tournamentId);
|
||||||
if (session.joinTournament(tournamentId) && chatRoomId != null) {
|
if (session.joinTournament(tournamentId) && chatRoomId != null) {
|
||||||
this.chatPanel1.connect(chatRoomId);
|
this.chatPanel1.connect(chatRoomId);
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,38 @@
|
||||||
package org.mage.card.arcane;
|
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.MagePermanent;
|
||||||
import mage.cards.TextPopup;
|
import mage.cards.TextPopup;
|
||||||
import mage.cards.action.ActionCallback;
|
import mage.cards.action.ActionCallback;
|
||||||
import mage.cards.action.TransferData;
|
import mage.cards.action.TransferData;
|
||||||
import mage.client.util.AudioManager;
|
import mage.client.util.AudioManager;
|
||||||
import mage.components.ImagePanel;
|
import mage.components.ImagePanel;
|
||||||
|
import mage.constants.CardType;
|
||||||
import mage.utils.CardUtil;
|
import mage.utils.CardUtil;
|
||||||
import mage.view.AbilityView;
|
import mage.view.AbilityView;
|
||||||
import mage.view.CardView;
|
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.images.ImageCache;
|
||||||
import org.mage.plugins.card.utils.impl.ImageManagerImpl;
|
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.
|
* Main class for drawing Mage card object.
|
||||||
*
|
*
|
||||||
|
|
@ -88,7 +105,6 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
||||||
|
|
||||||
private boolean isPermanent;
|
private boolean isPermanent;
|
||||||
private boolean hasSickness;
|
private boolean hasSickness;
|
||||||
private boolean isFoil;
|
|
||||||
private String zone;
|
private String zone;
|
||||||
|
|
||||||
public double transformAngle = 1;
|
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) {
|
private void setText(CardView card) {
|
||||||
if (displayTitleAnyway) {
|
if (displayTitleAnyway) {
|
||||||
titleText.setText(card.getName());
|
titleText.setText(card.getName());
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ package mage.cards.action;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.cards.TextPopup;
|
import mage.cards.TextPopup;
|
||||||
import mage.view.CardView;
|
import mage.view.CardView;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue