mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 02:52:02 -08:00
latest
This commit is contained in:
parent
dd402b3ab1
commit
d151f99f4f
30 changed files with 1072 additions and 207 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
|
||||||
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="defaultCloseOperation" type="int" value="3"/>
|
<Property name="defaultCloseOperation" type="int" value="3"/>
|
||||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||||
|
|
@ -25,8 +25,8 @@
|
||||||
<Layout>
|
<Layout>
|
||||||
<DimensionLayout dim="0">
|
<DimensionLayout dim="0">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="mageToolbar" alignment="0" pref="1106" max="32767" attributes="0"/>
|
<Component id="desktopPane" alignment="0" pref="1066" max="32767" attributes="0"/>
|
||||||
<Component id="desktopPane" alignment="0" pref="1106" max="32767" attributes="0"/>
|
<Component id="mageToolbar" alignment="0" pref="1066" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
|
|
@ -180,6 +180,14 @@
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnExitActionPerformed"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnExitActionPerformed"/>
|
||||||
</Events>
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
|
<Component class="javax.swing.JLabel" name="lblStatus">
|
||||||
|
<Properties>
|
||||||
|
<Property name="text" type="java.lang.String" value="Not connected"/>
|
||||||
|
</Properties>
|
||||||
|
<AuxValues>
|
||||||
|
<AuxValue name="JavaCodeGenerator_AddingCodePre" type="java.lang.String" value="mageToolbar.add(Box.createHorizontalGlue());"/>
|
||||||
|
</AuxValues>
|
||||||
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</Container>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,8 @@ import java.io.IOException;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
import javax.swing.Box;
|
||||||
|
import javax.swing.BoxLayout;
|
||||||
import javax.swing.JDesktopPane;
|
import javax.swing.JDesktopPane;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
|
|
@ -145,6 +147,7 @@ public class MageFrame extends javax.swing.JFrame {
|
||||||
btnAbout = new javax.swing.JButton();
|
btnAbout = new javax.swing.JButton();
|
||||||
jSeparator1 = new javax.swing.JToolBar.Separator();
|
jSeparator1 = new javax.swing.JToolBar.Separator();
|
||||||
btnExit = new javax.swing.JButton();
|
btnExit = new javax.swing.JButton();
|
||||||
|
lblStatus = new javax.swing.JLabel();
|
||||||
|
|
||||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||||||
setMinimumSize(new java.awt.Dimension(1024, 768));
|
setMinimumSize(new java.awt.Dimension(1024, 768));
|
||||||
|
|
@ -239,12 +242,16 @@ public class MageFrame extends javax.swing.JFrame {
|
||||||
});
|
});
|
||||||
mageToolbar.add(btnExit);
|
mageToolbar.add(btnExit);
|
||||||
|
|
||||||
|
lblStatus.setText("Not connected");
|
||||||
|
mageToolbar.add(Box.createHorizontalGlue());
|
||||||
|
mageToolbar.add(lblStatus);
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(mageToolbar, javax.swing.GroupLayout.DEFAULT_SIZE, 1106, Short.MAX_VALUE)
|
.addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1066, Short.MAX_VALUE)
|
||||||
.addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1106, Short.MAX_VALUE)
|
.addComponent(mageToolbar, javax.swing.GroupLayout.DEFAULT_SIZE, 1066, Short.MAX_VALUE)
|
||||||
);
|
);
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
|
@ -335,32 +342,13 @@ public class MageFrame extends javax.swing.JFrame {
|
||||||
private javax.swing.JToolBar.Separator jSeparator2;
|
private javax.swing.JToolBar.Separator jSeparator2;
|
||||||
private javax.swing.JToolBar.Separator jSeparator3;
|
private javax.swing.JToolBar.Separator jSeparator3;
|
||||||
private javax.swing.JToolBar.Separator jSeparator4;
|
private javax.swing.JToolBar.Separator jSeparator4;
|
||||||
|
private javax.swing.JLabel lblStatus;
|
||||||
private javax.swing.JToolBar mageToolbar;
|
private javax.swing.JToolBar mageToolbar;
|
||||||
private mage.client.TablesPane tablesPane;
|
private mage.client.TablesPane tablesPane;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
|
|
||||||
private void createDeck() {
|
public void setStatusText(String status) {
|
||||||
Deck deck = new Deck();
|
this.lblStatus.setText(status);
|
||||||
deck.getCards().add(new mage.sets.shardsofalara.BroodmateDragon(null));
|
|
||||||
deck.getCards().add(new mage.sets.shardsofalara.BroodmateDragon(null));
|
|
||||||
deck.getCards().add(new mage.sets.alarareborn.BloodbraidElf(null));
|
|
||||||
deck.getCards().add(new mage.sets.alarareborn.BloodbraidElf(null));
|
|
||||||
deck.getCards().add(new mage.sets.shardsofalara.JundPanorama(null));
|
|
||||||
deck.getCards().add(new mage.sets.shardsofalara.JundPanorama(null));
|
|
||||||
deck.getCards().add(new mage.sets.alarareborn.VengefulRebirth(null));
|
|
||||||
deck.getCards().add(new mage.sets.alarareborn.VengefulRebirth(null));
|
|
||||||
deck.getCards().add(new mage.sets.shardsofalara.SproutingThrinax(null));
|
|
||||||
deck.getCards().add(new mage.sets.shardsofalara.SproutingThrinax(null));
|
|
||||||
deck.getCards().add(new mage.sets.shardsofalara.SarkhanVol(null));
|
|
||||||
deck.getCards().add(new mage.sets.shardsofalara.SarkhanVol(null));
|
|
||||||
deck.getCards().add(new mage.sets.alarareborn.MaelstromPulse(null));
|
|
||||||
deck.getCards().add(new mage.sets.alarareborn.MaelstromPulse(null));
|
|
||||||
try {
|
|
||||||
deck.getDeckCardLists().save("test.dck");
|
|
||||||
} catch (FileNotFoundException ex) {
|
|
||||||
logger.log(Level.SEVERE, null, ex);
|
|
||||||
} catch (IOException ex) {
|
|
||||||
logger.log(Level.SEVERE, null, ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,16 @@
|
||||||
<Layout>
|
<Layout>
|
||||||
<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="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" attributes="0">
|
||||||
|
<EmptySpace min="-2" pref="14" max="-2" attributes="0"/>
|
||||||
|
<Component id="lblPlayerDeck" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="1" attributes="0">
|
<Component id="lblPlayer2Name" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="lblPlayerDeck" alignment="1" min="-2" max="-2" attributes="0"/>
|
</Group>
|
||||||
<Component id="lblPlayer2Name" alignment="1" min="-2" max="-2" attributes="0"/>
|
|
||||||
</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">
|
||||||
|
|
@ -37,9 +42,9 @@
|
||||||
<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">
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="1" attributes="0">
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
<Component id="lblPlayer2Name" alignment="1" min="-2" max="-2" attributes="0"/>
|
<Component id="txtPlayerName" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="txtPlayerName" alignment="1" min="-2" max="-2" attributes="0"/>
|
<Component id="lblPlayer2Name" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,10 @@
|
||||||
package mage.client;
|
package mage.client;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
import java.util.prefs.Preferences;
|
||||||
import javax.swing.JFileChooser;
|
import javax.swing.JFileChooser;
|
||||||
import javax.swing.filechooser.FileFilter;
|
import javax.swing.filechooser.FileFilter;
|
||||||
|
|
||||||
|
|
@ -45,20 +49,34 @@ import javax.swing.filechooser.FileFilter;
|
||||||
public class NewPlayerPanel extends javax.swing.JPanel {
|
public class NewPlayerPanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
private JFileChooser fcSelectDeck;
|
private JFileChooser fcSelectDeck;
|
||||||
|
private Preferences prefs;
|
||||||
|
|
||||||
/** Creates new form NewPlayerPanel */
|
/** Creates new form NewPlayerPanel */
|
||||||
public NewPlayerPanel() {
|
public NewPlayerPanel() {
|
||||||
initComponents();
|
initComponents();
|
||||||
|
prefs = Preferences.userNodeForPackage(this.getClass());
|
||||||
fcSelectDeck = new JFileChooser();
|
fcSelectDeck = new JFileChooser();
|
||||||
fcSelectDeck.setAcceptAllFileFilterUsed(false);
|
fcSelectDeck.setAcceptAllFileFilterUsed(false);
|
||||||
fcSelectDeck.addChoosableFileFilter(new DeckFilter());
|
fcSelectDeck.addChoosableFileFilter(new DeckFilter());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void playerLoadDeck() {
|
public void setPlayerName(String playerName) {
|
||||||
|
this.txtPlayerName.setText(playerName);
|
||||||
|
this.txtPlayerName.setEditable(false);
|
||||||
|
this.txtPlayerName.setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void playerLoadDeck() {
|
||||||
|
String lastFolder = prefs.get("lastDeckFolder", "");
|
||||||
|
if (!lastFolder.isEmpty())
|
||||||
|
fcSelectDeck.setCurrentDirectory(new File(lastFolder));
|
||||||
int ret = fcSelectDeck.showDialog(this, "Select Deck");
|
int ret = fcSelectDeck.showDialog(this, "Select Deck");
|
||||||
if (ret == JFileChooser.APPROVE_OPTION) {
|
if (ret == JFileChooser.APPROVE_OPTION) {
|
||||||
File file = fcSelectDeck.getSelectedFile();
|
File file = fcSelectDeck.getSelectedFile();
|
||||||
this.txtPlayerDeck.setText(file.getPath());
|
this.txtPlayerDeck.setText(file.getPath());
|
||||||
|
try {
|
||||||
|
prefs.put("lastDeckFolder", file.getCanonicalPath());
|
||||||
|
} catch (IOException ex) { }
|
||||||
}
|
}
|
||||||
fcSelectDeck.setSelectedFile(null);
|
fcSelectDeck.setSelectedFile(null);
|
||||||
}
|
}
|
||||||
|
|
@ -71,13 +89,13 @@ public class NewPlayerPanel extends javax.swing.JPanel {
|
||||||
return this.txtPlayerDeck.getText();
|
return this.txtPlayerDeck.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPlayerName(String playerName) {
|
// public void setPlayerName(String playerName) {
|
||||||
this.txtPlayerName.setText(playerName);
|
// this.txtPlayerName.setText(playerName);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setDeckFile(String deckFile) {
|
// public void setDeckFile(String deckFile) {
|
||||||
this.txtPlayerDeck.setText(deckFile);
|
// this.txtPlayerDeck.setText(deckFile);
|
||||||
}
|
// }
|
||||||
|
|
||||||
/** This method is called from within the constructor to
|
/** This method is called from within the constructor to
|
||||||
* initialize the form.
|
* initialize the form.
|
||||||
|
|
@ -109,11 +127,14 @@ public class NewPlayerPanel extends javax.swing.JPanel {
|
||||||
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.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addGap(14, 14, 14)
|
||||||
|
.addComponent(lblPlayerDeck))
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
.addComponent(lblPlayer2Name)))
|
||||||
.addComponent(lblPlayerDeck)
|
|
||||||
.addComponent(lblPlayer2Name))
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(txtPlayerName, javax.swing.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE)
|
.addComponent(txtPlayerName, javax.swing.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE)
|
||||||
|
|
@ -126,9 +147,9 @@ public class NewPlayerPanel extends javax.swing.JPanel {
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(lblPlayer2Name)
|
.addComponent(txtPlayerName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(txtPlayerName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addComponent(lblPlayer2Name))
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(lblPlayerDeck)
|
.addComponent(lblPlayerDeck)
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,7 @@ public class TablesPanel extends javax.swing.JPanel implements Observer {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void update(Observable arg0, Object arg1) {
|
public void update(Observable arg0, Object arg1) {
|
||||||
try {
|
try {
|
||||||
tableModel.loadData(roomId);
|
tableModel.loadData(roomId);
|
||||||
|
|
@ -129,7 +130,7 @@ public class TablesPanel extends javax.swing.JPanel implements Observer {
|
||||||
|
|
||||||
this.roomId = roomId;
|
this.roomId = roomId;
|
||||||
session = MageFrame.getSession();
|
session = MageFrame.getSession();
|
||||||
this.btnQuickStart.setVisible(false);
|
this.btnQuickStart.setVisible(true);
|
||||||
if (newTableDialog == null) {
|
if (newTableDialog == null) {
|
||||||
newTableDialog = new NewTableDialog();
|
newTableDialog = new NewTableDialog();
|
||||||
MageFrame.getDesktop().add(newTableDialog);
|
MageFrame.getDesktop().add(newTableDialog);
|
||||||
|
|
@ -258,7 +259,7 @@ public class TablesPanel extends javax.swing.JPanel implements Observer {
|
||||||
table = session.createTable(
|
table = session.createTable(
|
||||||
roomId,
|
roomId,
|
||||||
"Two Player Duel",
|
"Two Player Duel",
|
||||||
Constants.DeckType.CONSTRUCTED_EXTENDED,
|
"Constructed",
|
||||||
playerTypes
|
playerTypes
|
||||||
);
|
);
|
||||||
session.joinTable(
|
session.joinTable(
|
||||||
|
|
@ -378,6 +379,7 @@ class TablesWatchdog extends Observable implements ActionListener {
|
||||||
t.start();
|
t.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
setChanged();
|
setChanged();
|
||||||
notifyObservers();
|
notifyObservers();
|
||||||
|
|
|
||||||
|
|
@ -74,9 +74,7 @@ public class BigCard extends javax.swing.JPanel {
|
||||||
for (String line: strings) {
|
for (String line: strings) {
|
||||||
doc.insertString(doc.getLength(), line + "\n", doc.getStyle("regular"));
|
doc.insertString(doc.getLength(), line + "\n", doc.getStyle("regular"));
|
||||||
}
|
}
|
||||||
} catch (BadLocationException ble) {
|
} catch (BadLocationException ble) { }
|
||||||
System.err.println("Couldn't insert initial text into text pane.");
|
|
||||||
}
|
|
||||||
text.setCaretPosition(0);
|
text.setCaretPosition(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,9 @@
|
||||||
<Property name="focusable" type="boolean" value="false"/>
|
<Property name="focusable" type="boolean" value="false"/>
|
||||||
<Property name="opaque" type="boolean" value="false"/>
|
<Property name="opaque" type="boolean" value="false"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
|
<AuxValues>
|
||||||
|
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="4"/>
|
||||||
|
</AuxValues>
|
||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</Container>
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@
|
||||||
|
|
||||||
package mage.client.cards;
|
package mage.client.cards;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
|
|
@ -43,17 +42,17 @@ import java.awt.Graphics2D;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.awt.RenderingHints;
|
import java.awt.RenderingHints;
|
||||||
|
import java.awt.event.ComponentEvent;
|
||||||
|
import java.awt.event.ComponentListener;
|
||||||
import java.awt.event.FocusEvent;
|
import java.awt.event.FocusEvent;
|
||||||
import java.awt.event.FocusListener;
|
import java.awt.event.FocusListener;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.event.MouseListener;
|
import java.awt.event.MouseListener;
|
||||||
import java.awt.event.MouseMotionListener;
|
import java.awt.event.MouseMotionListener;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import javax.swing.BorderFactory;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.JTextArea;
|
|
||||||
import javax.swing.Popup;
|
import javax.swing.Popup;
|
||||||
import javax.swing.PopupFactory;
|
import javax.swing.PopupFactory;
|
||||||
import javax.swing.text.BadLocationException;
|
import javax.swing.text.BadLocationException;
|
||||||
|
|
@ -72,7 +71,7 @@ import static mage.client.util.Constants.*;
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
public class Card extends javax.swing.JPanel implements MouseMotionListener, MouseListener, FocusListener {
|
public class Card extends javax.swing.JPanel implements MouseMotionListener, MouseListener, FocusListener, ComponentListener {
|
||||||
|
|
||||||
protected static Session session = MageFrame.getSession();
|
protected static Session session = MageFrame.getSession();
|
||||||
|
|
||||||
|
|
@ -109,6 +108,7 @@ public class Card extends javax.swing.JPanel implements MouseMotionListener, Mou
|
||||||
addFocusListener(this);
|
addFocusListener(this);
|
||||||
addMouseMotionListener(this);
|
addMouseMotionListener(this);
|
||||||
text.addMouseMotionListener(this);
|
text.addMouseMotionListener(this);
|
||||||
|
addComponentListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public UUID getCardId() {
|
public UUID getCardId() {
|
||||||
|
|
@ -164,7 +164,7 @@ public class Card extends javax.swing.JPanel implements MouseMotionListener, Mou
|
||||||
gSmall.dispose();
|
gSmall.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getText(String cardType) {
|
protected String getText(String cardType) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(card.getName()).append("\n");
|
sb.append(card.getName()).append("\n");
|
||||||
if (card.getManaCost().size() > 0) {
|
if (card.getManaCost().size() > 0) {
|
||||||
|
|
@ -172,7 +172,7 @@ public class Card extends javax.swing.JPanel implements MouseMotionListener, Mou
|
||||||
}
|
}
|
||||||
sb.append(cardType).append("\n");
|
sb.append(cardType).append("\n");
|
||||||
sb.append(card.getColor().toString()).append("\n");
|
sb.append(card.getColor().toString()).append("\n");
|
||||||
for (String rule: card.getRules()) {
|
for (String rule: getRules()) {
|
||||||
sb.append(rule).append("\n");
|
sb.append(rule).append("\n");
|
||||||
}
|
}
|
||||||
if (card.getCardTypes().contains(CardType.CREATURE)) {
|
if (card.getCardTypes().contains(CardType.CREATURE)) {
|
||||||
|
|
@ -184,20 +184,22 @@ public class Card extends javax.swing.JPanel implements MouseMotionListener, Mou
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawText() {
|
protected void drawText() {
|
||||||
text.setText("");
|
text.setText("");
|
||||||
StyledDocument doc = text.getStyledDocument();
|
StyledDocument doc = text.getStyledDocument();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for (String rule: card.getRules())
|
for (String rule: getRules())
|
||||||
doc.insertString(doc.getLength(), rule + "\n", doc.getStyle("small"));
|
doc.insertString(doc.getLength(), rule + "\n", doc.getStyle("small"));
|
||||||
} catch (BadLocationException e) {
|
} catch (BadLocationException e) {}
|
||||||
System.err.println("Couldn't insert initial text into text pane.");
|
|
||||||
}
|
|
||||||
|
|
||||||
text.setCaretPosition(0);
|
text.setCaretPosition(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected List<String> getRules() {
|
||||||
|
return card.getRules();
|
||||||
|
}
|
||||||
|
|
||||||
protected String getType(CardView card) {
|
protected String getType(CardView card) {
|
||||||
StringBuilder sbType = new StringBuilder();
|
StringBuilder sbType = new StringBuilder();
|
||||||
|
|
||||||
|
|
@ -243,7 +245,7 @@ public class Card extends javax.swing.JPanel implements MouseMotionListener, Mou
|
||||||
|
|
||||||
text.setBorder(null);
|
text.setBorder(null);
|
||||||
text.setEditable(false);
|
text.setEditable(false);
|
||||||
text.setFont(new java.awt.Font("Arial", 0, 9));
|
text.setFont(new java.awt.Font("Arial", 0, 9)); // NOI18N
|
||||||
text.setFocusable(false);
|
text.setFocusable(false);
|
||||||
text.setOpaque(false);
|
text.setOpaque(false);
|
||||||
jScrollPane1.setViewportView(text);
|
jScrollPane1.setViewportView(text);
|
||||||
|
|
@ -273,7 +275,7 @@ public class Card extends javax.swing.JPanel implements MouseMotionListener, Mou
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseMoved(MouseEvent arg0) {
|
public void mouseMoved(MouseEvent arg0) {
|
||||||
this.bigCard.setCard(card.getId(), image, card.getRules());
|
this.bigCard.setCard(card.getId(), image, getRules());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -328,28 +330,22 @@ public class Card extends javax.swing.JPanel implements MouseMotionListener, Mou
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
private javax.swing.JScrollPane jScrollPane1;
|
private javax.swing.JScrollPane jScrollPane1;
|
||||||
private javax.swing.JTextPane text;
|
protected javax.swing.JTextPane text;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentResized(ComponentEvent e) { }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentMoved(ComponentEvent e) { }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentShown(ComponentEvent e) { }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentHidden(ComponentEvent e) {
|
||||||
|
if (popup != null)
|
||||||
|
popup.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
class TextPopup extends JPanel {
|
|
||||||
|
|
||||||
JTextArea txt;
|
|
||||||
|
|
||||||
public TextPopup() {
|
|
||||||
super(new BorderLayout());
|
|
||||||
this.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
|
|
||||||
txt = new JTextArea(1, 20);
|
|
||||||
txt.setLineWrap(true);
|
|
||||||
txt.setWrapStyleWord(true);
|
|
||||||
txt.setEditable(false);
|
|
||||||
txt.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
|
|
||||||
txt.setBackground(Color.lightGray);
|
|
||||||
this.add(txt);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setText(String text) {
|
|
||||||
txt.setText(text);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
28
Mage.Client/src/mage/client/cards/CardGrid.form
Normal file
28
Mage.Client/src/mage/client/cards/CardGrid.form
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
|
||||||
|
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||||
|
<AuxValues>
|
||||||
|
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||||
|
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||||
|
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||||
|
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||||
|
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||||
|
</AuxValues>
|
||||||
|
|
||||||
|
<Layout>
|
||||||
|
<DimensionLayout dim="0">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<EmptySpace min="0" pref="400" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
<DimensionLayout dim="1">
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</DimensionLayout>
|
||||||
|
</Layout>
|
||||||
|
</Form>
|
||||||
200
Mage.Client/src/mage/client/cards/CardGrid.java
Normal file
200
Mage.Client/src/mage/client/cards/CardGrid.java
Normal file
|
|
@ -0,0 +1,200 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
* permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* The views and conclusions contained in the software and documentation are those of the
|
||||||
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CardGrid.java
|
||||||
|
*
|
||||||
|
* Created on 30-Mar-2010, 9:25:40 PM
|
||||||
|
*/
|
||||||
|
|
||||||
|
package mage.client.cards;
|
||||||
|
|
||||||
|
import java.awt.Component;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import java.awt.event.ComponentEvent;
|
||||||
|
import java.awt.event.ComponentListener;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.awt.event.MouseListener;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.client.util.Event;
|
||||||
|
import mage.client.util.Listener;
|
||||||
|
import mage.view.CardView;
|
||||||
|
import mage.view.CardsView;
|
||||||
|
import static mage.client.util.Constants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
*/
|
||||||
|
public class CardGrid extends javax.swing.JLayeredPane implements MouseListener, ComponentListener {
|
||||||
|
|
||||||
|
protected CardEventSource cardEventSource = new CardEventSource();
|
||||||
|
protected BigCard bigCard;
|
||||||
|
protected UUID gameId;
|
||||||
|
protected List<Card> cards = new ArrayList<Card>();
|
||||||
|
|
||||||
|
public CardGrid() {
|
||||||
|
initComponents();
|
||||||
|
addComponentListener(this);
|
||||||
|
setPreferredSize(new Dimension(FRAME_WIDTH, FRAME_HEIGHT));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadCards(CardsView showCards, BigCard bigCard, UUID gameId) {
|
||||||
|
this.bigCard = bigCard;
|
||||||
|
this.gameId = gameId;
|
||||||
|
cards.clear();
|
||||||
|
for (CardView card: showCards) {
|
||||||
|
Card cardImg = new Card(card, bigCard, gameId);
|
||||||
|
cardImg.update(card);
|
||||||
|
cardImg.addMouseListener(this);
|
||||||
|
cards.add(cardImg);
|
||||||
|
}
|
||||||
|
drawCards();
|
||||||
|
this.setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drawCards() {
|
||||||
|
removeAll();
|
||||||
|
int maxWidth = this.getParent().getWidth();
|
||||||
|
int numColumns = maxWidth / FRAME_WIDTH;
|
||||||
|
int curColumn = 0;
|
||||||
|
int curRow = 0;
|
||||||
|
if (cards.size() > 0) {
|
||||||
|
Rectangle rectangle = new Rectangle(FRAME_WIDTH, FRAME_HEIGHT);
|
||||||
|
for (Card cardImg: cards) {
|
||||||
|
rectangle.setLocation(curColumn * FRAME_WIDTH, curRow * 20);
|
||||||
|
cardImg.setBounds(rectangle);
|
||||||
|
add(cardImg);
|
||||||
|
moveToFront(cardImg);
|
||||||
|
curColumn++;
|
||||||
|
if (curColumn == numColumns) {
|
||||||
|
curColumn = 0;
|
||||||
|
curRow++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resizeArea();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addCardEventListener(Listener<Event> listener) {
|
||||||
|
cardEventSource.addListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearCardEventListeners() {
|
||||||
|
cardEventSource.clearListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** This method is called from within the constructor to
|
||||||
|
* initialize the form.
|
||||||
|
* WARNING: Do NOT modify this code. The content of this method is
|
||||||
|
* always regenerated by the Form Editor.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||||
|
private void initComponents() {
|
||||||
|
|
||||||
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||||
|
this.setLayout(layout);
|
||||||
|
layout.setHorizontalGroup(
|
||||||
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGap(0, 400, Short.MAX_VALUE)
|
||||||
|
);
|
||||||
|
layout.setVerticalGroup(
|
||||||
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGap(0, 300, Short.MAX_VALUE)
|
||||||
|
);
|
||||||
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
|
|
||||||
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
|
// End of variables declaration//GEN-END:variables
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent e) {
|
||||||
|
if (e.getClickCount() == 2 && !e.isConsumed()) {
|
||||||
|
e.consume();
|
||||||
|
cardEventSource.doubleClick(((Card)e.getSource()).getCardId(), "double-click");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mousePressed(MouseEvent e) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseReleased(MouseEvent e) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseEntered(MouseEvent e) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseExited(MouseEvent e) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentResized(ComponentEvent e) {
|
||||||
|
resizeArea();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentMoved(ComponentEvent e) {
|
||||||
|
resizeArea();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentShown(ComponentEvent e) {
|
||||||
|
resizeArea();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentHidden(ComponentEvent e) {
|
||||||
|
resizeArea();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resizeArea() {
|
||||||
|
Dimension area = new Dimension(0, 0);
|
||||||
|
Dimension size = getPreferredSize();
|
||||||
|
|
||||||
|
for (Component comp: getComponents()) {
|
||||||
|
Rectangle r = comp.getBounds();
|
||||||
|
if (r.x + r.width > area.width) {
|
||||||
|
area.width = r.x + r.width;
|
||||||
|
}
|
||||||
|
if (r.y + r.height > area.height) {
|
||||||
|
area.height = r.y + r.height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (size.height != area.height || size.width != area.width) {
|
||||||
|
setPreferredSize(area);
|
||||||
|
revalidate();
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -38,8 +38,6 @@ import java.awt.Dimension;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.event.MouseListener;
|
import java.awt.event.MouseListener;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.client.util.Event;
|
import mage.client.util.Event;
|
||||||
import mage.client.util.Listener;
|
import mage.client.util.Listener;
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,11 @@ import java.awt.image.BufferedImage;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import javax.swing.PopupFactory;
|
||||||
|
import javax.swing.text.BadLocationException;
|
||||||
|
import javax.swing.text.StyledDocument;
|
||||||
import mage.client.util.ImageHelper;
|
import mage.client.util.ImageHelper;
|
||||||
|
import mage.view.CounterView;
|
||||||
import mage.view.PermanentView;
|
import mage.view.PermanentView;
|
||||||
import static mage.client.util.Constants.*;
|
import static mage.client.util.Constants.*;
|
||||||
|
|
||||||
|
|
@ -85,6 +89,19 @@ public class Permanent extends Card {
|
||||||
this.linked = linked;
|
this.linked = linked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<String> getRules() {
|
||||||
|
if (permanent.getCounters() != null) {
|
||||||
|
List<String> rules = new ArrayList<String>(permanent.getRules());
|
||||||
|
for (CounterView counter: permanent.getCounters())
|
||||||
|
rules.add(counter.getCount() + " x " + counter.getName());
|
||||||
|
return rules;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return permanent.getRules();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mousePressed(MouseEvent e) {
|
public void mousePressed(MouseEvent e) {
|
||||||
p = e.getPoint();
|
p = e.getPoint();
|
||||||
|
|
@ -111,6 +128,12 @@ public class Permanent extends Card {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent arg0) {
|
||||||
|
|
||||||
|
super.mouseClicked(arg0);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void paintComponent(Graphics graphics) {
|
public void paintComponent(Graphics graphics) {
|
||||||
Graphics2D g2 = (Graphics2D) graphics;
|
Graphics2D g2 = (Graphics2D) graphics;
|
||||||
|
|
@ -179,6 +202,21 @@ public class Permanent extends Card {
|
||||||
return this.getBounds().intersects(r1);
|
return this.getBounds().intersects(r1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseEntered(MouseEvent arg0) {
|
||||||
|
if (popup != null)
|
||||||
|
popup.hide();
|
||||||
|
PopupFactory factory = PopupFactory.getSharedInstance();
|
||||||
|
int x = (int) this.getLocationOnScreen().getX() + (permanent.isTapped()?FRAME_HEIGHT:FRAME_WIDTH);
|
||||||
|
int y = (int) this.getLocationOnScreen().getY() + 40;
|
||||||
|
popup = factory.getPopup(this, popupText, x, y);
|
||||||
|
popup.show();
|
||||||
|
//hack to get popup to resize to fit text
|
||||||
|
popup.hide();
|
||||||
|
popup = factory.getPopup(this, popupText, x, y);
|
||||||
|
popup.show();
|
||||||
|
}
|
||||||
|
|
||||||
/** This method is called from within the constructor to
|
/** This method is called from within the constructor to
|
||||||
* initialize the form.
|
* initialize the form.
|
||||||
* WARNING: Do NOT modify this code. The content of this method is
|
* WARNING: Do NOT modify this code. The content of this method is
|
||||||
|
|
|
||||||
49
Mage.Client/src/mage/client/cards/TextPopup.form
Normal file
49
Mage.Client/src/mage/client/cards/TextPopup.form
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
|
||||||
|
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||||
|
<Properties>
|
||||||
|
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||||
|
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
|
||||||
|
<LineBorder/>
|
||||||
|
</Border>
|
||||||
|
</Property>
|
||||||
|
</Properties>
|
||||||
|
<AuxValues>
|
||||||
|
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||||
|
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||||
|
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||||
|
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||||
|
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||||
|
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||||
|
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,0,24,0,0,1,37"/>
|
||||||
|
</AuxValues>
|
||||||
|
|
||||||
|
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||||
|
<SubComponents>
|
||||||
|
<Component class="javax.swing.JTextArea" name="popupText">
|
||||||
|
<Properties>
|
||||||
|
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||||
|
<Color blue="cc" green="cc" red="cc" type="rgb"/>
|
||||||
|
</Property>
|
||||||
|
<Property name="columns" type="int" value="20"/>
|
||||||
|
<Property name="editable" type="boolean" value="false"/>
|
||||||
|
<Property name="lineWrap" type="boolean" value="true"/>
|
||||||
|
<Property name="rows" type="int" value="1"/>
|
||||||
|
<Property name="wrapStyleWord" type="boolean" value="true"/>
|
||||||
|
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||||
|
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
|
||||||
|
<EmptyBorder bottom="2" left="2" right="2" top="2"/>
|
||||||
|
</Border>
|
||||||
|
</Property>
|
||||||
|
</Properties>
|
||||||
|
<Constraints>
|
||||||
|
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||||
|
<BorderConstraints direction="First"/>
|
||||||
|
</Constraint>
|
||||||
|
</Constraints>
|
||||||
|
</Component>
|
||||||
|
</SubComponents>
|
||||||
|
</Form>
|
||||||
81
Mage.Client/src/mage/client/cards/TextPopup.java
Normal file
81
Mage.Client/src/mage/client/cards/TextPopup.java
Normal file
|
|
@ -0,0 +1,81 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
* permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* The views and conclusions contained in the software and documentation are those of the
|
||||||
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TextPopup.java
|
||||||
|
*
|
||||||
|
* Created on Apr 6, 2010, 9:36:13 AM
|
||||||
|
*/
|
||||||
|
|
||||||
|
package mage.client.cards;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author BetaSteward_at_googlemail.com
|
||||||
|
*/
|
||||||
|
public class TextPopup extends javax.swing.JPanel {
|
||||||
|
|
||||||
|
/** Creates new form TextPopup */
|
||||||
|
public TextPopup() {
|
||||||
|
initComponents();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setText(String text) {
|
||||||
|
popupText.setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** This method is called from within the constructor to
|
||||||
|
* initialize the form.
|
||||||
|
* WARNING: Do NOT modify this code. The content of this method is
|
||||||
|
* always regenerated by the Form Editor.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||||
|
private void initComponents() {
|
||||||
|
|
||||||
|
popupText = new javax.swing.JTextArea();
|
||||||
|
|
||||||
|
setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
|
||||||
|
setLayout(new java.awt.BorderLayout());
|
||||||
|
|
||||||
|
popupText.setBackground(new java.awt.Color(204, 204, 204));
|
||||||
|
popupText.setColumns(20);
|
||||||
|
popupText.setEditable(false);
|
||||||
|
popupText.setLineWrap(true);
|
||||||
|
popupText.setRows(1);
|
||||||
|
popupText.setWrapStyleWord(true);
|
||||||
|
popupText.setBorder(javax.swing.BorderFactory.createEmptyBorder(2, 2, 2, 2));
|
||||||
|
add(popupText, java.awt.BorderLayout.PAGE_START);
|
||||||
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
|
|
||||||
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
|
private javax.swing.JTextArea popupText;
|
||||||
|
// End of variables declaration//GEN-END:variables
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -16,23 +16,27 @@
|
||||||
<Layout>
|
<Layout>
|
||||||
<DimensionLayout dim="0">
|
<DimensionLayout dim="0">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="jToolBar1" alignment="0" pref="825" max="32767" attributes="0"/>
|
<Component id="tbColor" alignment="0" pref="825" max="32767" attributes="0"/>
|
||||||
<Component id="cardsList1" alignment="0" pref="825" max="32767" attributes="0"/>
|
<Component id="tbTypes" alignment="0" pref="825" max="32767" attributes="0"/>
|
||||||
|
<Component id="jScrollPane1" alignment="0" pref="825" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
<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="jToolBar1" min="-2" pref="25" max="-2" attributes="0"/>
|
<Component id="tbColor" min="-2" pref="25" max="-2" attributes="0"/>
|
||||||
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
||||||
<Component id="cardsList1" pref="340" max="32767" attributes="0"/>
|
<Component id="tbTypes" min="-2" pref="25" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
||||||
|
<Component id="jScrollPane1" pref="316" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
</Layout>
|
</Layout>
|
||||||
<SubComponents>
|
<SubComponents>
|
||||||
<Container class="javax.swing.JToolBar" name="jToolBar1">
|
<Container class="javax.swing.JToolBar" name="tbColor">
|
||||||
<Properties>
|
<Properties>
|
||||||
|
<Property name="floatable" type="boolean" value="false"/>
|
||||||
<Property name="rollover" type="boolean" value="true"/>
|
<Property name="rollover" type="boolean" value="true"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
|
|
||||||
|
|
@ -110,9 +114,126 @@
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rdoColorlessActionPerformed"/>
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rdoColorlessActionPerformed"/>
|
||||||
</Events>
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
<Component class="javax.swing.JComboBox" name="cbExpansionSet">
|
||||||
</Container>
|
<Properties>
|
||||||
<Component class="mage.client.cards.CardsList" name="cardsList1">
|
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||||
|
<StringArray count="4">
|
||||||
|
<StringItem index="0" value="Item 1"/>
|
||||||
|
<StringItem index="1" value="Item 2"/>
|
||||||
|
<StringItem index="2" value="Item 3"/>
|
||||||
|
<StringItem index="3" value="Item 4"/>
|
||||||
|
</StringArray>
|
||||||
|
</Property>
|
||||||
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cbExpansionSetActionPerformed"/>
|
||||||
|
</Events>
|
||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
|
</Container>
|
||||||
|
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
||||||
|
|
||||||
|
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||||
|
<SubComponents>
|
||||||
|
<Container class="mage.client.cards.CardGrid" name="cardGrid">
|
||||||
|
|
||||||
|
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JLayeredPaneSupportLayout"/>
|
||||||
|
</Container>
|
||||||
|
</SubComponents>
|
||||||
|
</Container>
|
||||||
|
<Container class="javax.swing.JToolBar" name="tbTypes">
|
||||||
|
<Properties>
|
||||||
|
<Property name="floatable" type="boolean" value="false"/>
|
||||||
|
<Property name="rollover" type="boolean" value="true"/>
|
||||||
|
</Properties>
|
||||||
|
|
||||||
|
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
|
||||||
|
<SubComponents>
|
||||||
|
<Component class="javax.swing.JRadioButton" name="rdoLand">
|
||||||
|
<Properties>
|
||||||
|
<Property name="selected" type="boolean" value="true"/>
|
||||||
|
<Property name="focusable" type="boolean" value="false"/>
|
||||||
|
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||||
|
<Property name="label" type="java.lang.String" value="Land "/>
|
||||||
|
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||||
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rdoLandActionPerformed"/>
|
||||||
|
</Events>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JRadioButton" name="rdoCreatures">
|
||||||
|
<Properties>
|
||||||
|
<Property name="selected" type="boolean" value="true"/>
|
||||||
|
<Property name="focusable" type="boolean" value="false"/>
|
||||||
|
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||||
|
<Property name="label" type="java.lang.String" value="Creatures "/>
|
||||||
|
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||||
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rdoCreaturesActionPerformed"/>
|
||||||
|
</Events>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JRadioButton" name="rdoArtifacts">
|
||||||
|
<Properties>
|
||||||
|
<Property name="selected" type="boolean" value="true"/>
|
||||||
|
<Property name="text" type="java.lang.String" value="Artifacts "/>
|
||||||
|
<Property name="focusable" type="boolean" value="false"/>
|
||||||
|
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||||
|
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||||
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rdoArtifactsActionPerformed"/>
|
||||||
|
</Events>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JRadioButton" name="rdoEnchantments">
|
||||||
|
<Properties>
|
||||||
|
<Property name="selected" type="boolean" value="true"/>
|
||||||
|
<Property name="text" type="java.lang.String" value="Enchantments "/>
|
||||||
|
<Property name="focusable" type="boolean" value="false"/>
|
||||||
|
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||||
|
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||||
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rdoEnchantmentsActionPerformed"/>
|
||||||
|
</Events>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JRadioButton" name="rdoInstants">
|
||||||
|
<Properties>
|
||||||
|
<Property name="selected" type="boolean" value="true"/>
|
||||||
|
<Property name="text" type="java.lang.String" value="Instants "/>
|
||||||
|
<Property name="focusable" type="boolean" value="false"/>
|
||||||
|
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||||
|
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||||
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rdoInstantsActionPerformed"/>
|
||||||
|
</Events>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JRadioButton" name="rdoSorceries">
|
||||||
|
<Properties>
|
||||||
|
<Property name="selected" type="boolean" value="true"/>
|
||||||
|
<Property name="text" type="java.lang.String" value="Sorceries "/>
|
||||||
|
<Property name="focusable" type="boolean" value="false"/>
|
||||||
|
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||||
|
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||||
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rdoSorceriesActionPerformed"/>
|
||||||
|
</Events>
|
||||||
|
</Component>
|
||||||
|
<Component class="javax.swing.JRadioButton" name="rdoPlaneswalkers">
|
||||||
|
<Properties>
|
||||||
|
<Property name="selected" type="boolean" value="true"/>
|
||||||
|
<Property name="text" type="java.lang.String" value="Planeswalkers "/>
|
||||||
|
<Property name="focusable" type="boolean" value="false"/>
|
||||||
|
<Property name="horizontalTextPosition" type="int" value="4"/>
|
||||||
|
<Property name="verticalTextPosition" type="int" value="3"/>
|
||||||
|
</Properties>
|
||||||
|
<Events>
|
||||||
|
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="rdoPlaneswalkersActionPerformed"/>
|
||||||
|
</Events>
|
||||||
|
</Component>
|
||||||
|
</SubComponents>
|
||||||
|
</Container>
|
||||||
|
</SubComponents>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
|
||||||
|
|
@ -35,28 +35,26 @@
|
||||||
package mage.client.deckeditor;
|
package mage.client.deckeditor;
|
||||||
|
|
||||||
import java.awt.Cursor;
|
import java.awt.Cursor;
|
||||||
|
import java.awt.event.ComponentEvent;
|
||||||
|
import java.awt.event.ComponentListener;
|
||||||
|
import javax.swing.DefaultComboBoxModel;
|
||||||
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Zone;
|
import mage.Constants.Zone;
|
||||||
import mage.cards.Cards;
|
import mage.cards.Cards;
|
||||||
import mage.cards.CardsImpl;
|
import mage.cards.CardsImpl;
|
||||||
|
import mage.cards.ExpansionSet;
|
||||||
import mage.client.cards.BigCard;
|
import mage.client.cards.BigCard;
|
||||||
import mage.client.cards.CardsList;
|
import mage.client.cards.CardGrid;
|
||||||
import mage.filter.Filter.ComparisonScope;
|
import mage.filter.Filter.ComparisonScope;
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
import mage.sets.AlaraReborn;
|
import mage.sets.Sets;
|
||||||
import mage.sets.Conflux;
|
|
||||||
import mage.sets.Magic2010;
|
|
||||||
import mage.sets.Planechase;
|
|
||||||
import mage.sets.ShardsOfAlara;
|
|
||||||
import mage.sets.Tenth;
|
|
||||||
import mage.sets.Worldwake;
|
|
||||||
import mage.sets.Zendikar;
|
|
||||||
import mage.view.CardsView;
|
import mage.view.CardsView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
public class CardSelector extends javax.swing.JPanel {
|
public class CardSelector extends javax.swing.JPanel implements ComponentListener {
|
||||||
|
|
||||||
private Cards cards = new CardsImpl(Zone.OUTSIDE);
|
private Cards cards = new CardsImpl(Zone.OUTSIDE);
|
||||||
private FilterCard filter = new FilterCard();
|
private FilterCard filter = new FilterCard();
|
||||||
|
|
@ -65,19 +63,18 @@ public class CardSelector extends javax.swing.JPanel {
|
||||||
/** Creates new form CardSelector */
|
/** Creates new form CardSelector */
|
||||||
public CardSelector() {
|
public CardSelector() {
|
||||||
initComponents();
|
initComponents();
|
||||||
|
this.addComponentListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadCards(BigCard bigCard) {
|
public void loadCards(BigCard bigCard) {
|
||||||
this.bigCard = bigCard;
|
this.bigCard = bigCard;
|
||||||
this.cards.clear();
|
this.cards.clear();
|
||||||
cards.addAll(AlaraReborn.getInstance().createCards());
|
cbExpansionSet.setModel(new DefaultComboBoxModel(Sets.getInstance().toArray()));
|
||||||
cards.addAll(Conflux.getInstance().createCards());
|
cbExpansionSet.insertItemAt("All sets", 0);
|
||||||
cards.addAll(Magic2010.getInstance().createCards());
|
cbExpansionSet.setSelectedIndex(0);
|
||||||
cards.addAll(Planechase.getInstance().createCards());
|
for (ExpansionSet set: Sets.getInstance()) {
|
||||||
cards.addAll(ShardsOfAlara.getInstance().createCards());
|
cards.addAll(set.createCards());
|
||||||
cards.addAll(Tenth.getInstance().createCards());
|
}
|
||||||
cards.addAll(Worldwake.getInstance().createCards());
|
|
||||||
cards.addAll(Zendikar.getInstance().createCards());
|
|
||||||
filter.setUseColor(true);
|
filter.setUseColor(true);
|
||||||
filter.getColor().setBlack(true);
|
filter.getColor().setBlack(true);
|
||||||
filter.getColor().setBlue(true);
|
filter.getColor().setBlue(true);
|
||||||
|
|
@ -88,21 +85,29 @@ public class CardSelector extends javax.swing.JPanel {
|
||||||
filter.setUseColorless(true);
|
filter.setUseColorless(true);
|
||||||
filter.setNotColor(false);
|
filter.setNotColor(false);
|
||||||
filter.setScopeColor(ComparisonScope.Any);
|
filter.setScopeColor(ComparisonScope.Any);
|
||||||
|
filter.getCardType().add(CardType.LAND);
|
||||||
|
filter.getCardType().add(CardType.ARTIFACT);
|
||||||
|
filter.getCardType().add(CardType.CREATURE);
|
||||||
|
filter.getCardType().add(CardType.ENCHANTMENT);
|
||||||
|
filter.getCardType().add(CardType.INSTANT);
|
||||||
|
filter.getCardType().add(CardType.PLANESWALKER);
|
||||||
|
filter.getCardType().add(CardType.SORCERY);
|
||||||
|
filter.setScopeCardType(ComparisonScope.Any);
|
||||||
filterCards();
|
filterCards();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void filterCards() {
|
private void filterCards() {
|
||||||
try {
|
try {
|
||||||
setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
||||||
this.cardsList1.loadCards(new CardsView(cards.getCards(filter)), bigCard, null);
|
this.cardGrid.loadCards(new CardsView(cards.getCards(filter)), bigCard, null);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public CardsList getCardsList() {
|
public CardGrid getCardsList() {
|
||||||
return this.cardsList1;
|
return this.cardGrid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Cards getCards() {
|
public Cards getCards() {
|
||||||
|
|
@ -118,16 +123,27 @@ public class CardSelector 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() {
|
||||||
|
|
||||||
jToolBar1 = new javax.swing.JToolBar();
|
tbColor = new javax.swing.JToolBar();
|
||||||
rdoRed = new javax.swing.JRadioButton();
|
rdoRed = new javax.swing.JRadioButton();
|
||||||
rdoGreen = new javax.swing.JRadioButton();
|
rdoGreen = new javax.swing.JRadioButton();
|
||||||
rdoBlue = new javax.swing.JRadioButton();
|
rdoBlue = new javax.swing.JRadioButton();
|
||||||
rdoBlack = new javax.swing.JRadioButton();
|
rdoBlack = new javax.swing.JRadioButton();
|
||||||
rdoWhite = new javax.swing.JRadioButton();
|
rdoWhite = new javax.swing.JRadioButton();
|
||||||
rdoColorless = new javax.swing.JRadioButton();
|
rdoColorless = new javax.swing.JRadioButton();
|
||||||
cardsList1 = new mage.client.cards.CardsList();
|
cbExpansionSet = new javax.swing.JComboBox();
|
||||||
|
jScrollPane1 = new javax.swing.JScrollPane();
|
||||||
|
cardGrid = new mage.client.cards.CardGrid();
|
||||||
|
tbTypes = new javax.swing.JToolBar();
|
||||||
|
rdoLand = new javax.swing.JRadioButton();
|
||||||
|
rdoCreatures = new javax.swing.JRadioButton();
|
||||||
|
rdoArtifacts = new javax.swing.JRadioButton();
|
||||||
|
rdoEnchantments = new javax.swing.JRadioButton();
|
||||||
|
rdoInstants = new javax.swing.JRadioButton();
|
||||||
|
rdoSorceries = new javax.swing.JRadioButton();
|
||||||
|
rdoPlaneswalkers = new javax.swing.JRadioButton();
|
||||||
|
|
||||||
jToolBar1.setRollover(true);
|
tbColor.setFloatable(false);
|
||||||
|
tbColor.setRollover(true);
|
||||||
|
|
||||||
rdoRed.setSelected(true);
|
rdoRed.setSelected(true);
|
||||||
rdoRed.setText("Red ");
|
rdoRed.setText("Red ");
|
||||||
|
|
@ -139,7 +155,7 @@ public class CardSelector extends javax.swing.JPanel {
|
||||||
rdoRedActionPerformed(evt);
|
rdoRedActionPerformed(evt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
jToolBar1.add(rdoRed);
|
tbColor.add(rdoRed);
|
||||||
|
|
||||||
rdoGreen.setSelected(true);
|
rdoGreen.setSelected(true);
|
||||||
rdoGreen.setText("Green ");
|
rdoGreen.setText("Green ");
|
||||||
|
|
@ -151,7 +167,7 @@ public class CardSelector extends javax.swing.JPanel {
|
||||||
rdoGreenActionPerformed(evt);
|
rdoGreenActionPerformed(evt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
jToolBar1.add(rdoGreen);
|
tbColor.add(rdoGreen);
|
||||||
|
|
||||||
rdoBlue.setSelected(true);
|
rdoBlue.setSelected(true);
|
||||||
rdoBlue.setText("Blue ");
|
rdoBlue.setText("Blue ");
|
||||||
|
|
@ -163,7 +179,7 @@ public class CardSelector extends javax.swing.JPanel {
|
||||||
rdoBlueActionPerformed(evt);
|
rdoBlueActionPerformed(evt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
jToolBar1.add(rdoBlue);
|
tbColor.add(rdoBlue);
|
||||||
|
|
||||||
rdoBlack.setSelected(true);
|
rdoBlack.setSelected(true);
|
||||||
rdoBlack.setText("Black ");
|
rdoBlack.setText("Black ");
|
||||||
|
|
@ -175,7 +191,7 @@ public class CardSelector extends javax.swing.JPanel {
|
||||||
rdoBlackActionPerformed(evt);
|
rdoBlackActionPerformed(evt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
jToolBar1.add(rdoBlack);
|
tbColor.add(rdoBlack);
|
||||||
|
|
||||||
rdoWhite.setSelected(true);
|
rdoWhite.setSelected(true);
|
||||||
rdoWhite.setText("White ");
|
rdoWhite.setText("White ");
|
||||||
|
|
@ -187,7 +203,7 @@ public class CardSelector extends javax.swing.JPanel {
|
||||||
rdoWhiteActionPerformed(evt);
|
rdoWhiteActionPerformed(evt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
jToolBar1.add(rdoWhite);
|
tbColor.add(rdoWhite);
|
||||||
|
|
||||||
rdoColorless.setSelected(true);
|
rdoColorless.setSelected(true);
|
||||||
rdoColorless.setText("Colorless ");
|
rdoColorless.setText("Colorless ");
|
||||||
|
|
@ -199,21 +215,121 @@ public class CardSelector extends javax.swing.JPanel {
|
||||||
rdoColorlessActionPerformed(evt);
|
rdoColorlessActionPerformed(evt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
jToolBar1.add(rdoColorless);
|
tbColor.add(rdoColorless);
|
||||||
|
|
||||||
|
cbExpansionSet.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||||
|
cbExpansionSet.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
cbExpansionSetActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tbColor.add(cbExpansionSet);
|
||||||
|
|
||||||
|
jScrollPane1.setViewportView(cardGrid);
|
||||||
|
|
||||||
|
tbTypes.setFloatable(false);
|
||||||
|
tbTypes.setRollover(true);
|
||||||
|
|
||||||
|
rdoLand.setSelected(true);
|
||||||
|
rdoLand.setFocusable(false);
|
||||||
|
rdoLand.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||||
|
rdoLand.setLabel("Land ");
|
||||||
|
rdoLand.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
|
rdoLand.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
rdoLandActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tbTypes.add(rdoLand);
|
||||||
|
|
||||||
|
rdoCreatures.setSelected(true);
|
||||||
|
rdoCreatures.setFocusable(false);
|
||||||
|
rdoCreatures.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||||
|
rdoCreatures.setLabel("Creatures ");
|
||||||
|
rdoCreatures.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
|
rdoCreatures.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
rdoCreaturesActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tbTypes.add(rdoCreatures);
|
||||||
|
|
||||||
|
rdoArtifacts.setSelected(true);
|
||||||
|
rdoArtifacts.setText("Artifacts ");
|
||||||
|
rdoArtifacts.setFocusable(false);
|
||||||
|
rdoArtifacts.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||||
|
rdoArtifacts.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
|
rdoArtifacts.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
rdoArtifactsActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tbTypes.add(rdoArtifacts);
|
||||||
|
|
||||||
|
rdoEnchantments.setSelected(true);
|
||||||
|
rdoEnchantments.setText("Enchantments ");
|
||||||
|
rdoEnchantments.setFocusable(false);
|
||||||
|
rdoEnchantments.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||||
|
rdoEnchantments.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
|
rdoEnchantments.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
rdoEnchantmentsActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tbTypes.add(rdoEnchantments);
|
||||||
|
|
||||||
|
rdoInstants.setSelected(true);
|
||||||
|
rdoInstants.setText("Instants ");
|
||||||
|
rdoInstants.setFocusable(false);
|
||||||
|
rdoInstants.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||||
|
rdoInstants.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
|
rdoInstants.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
rdoInstantsActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tbTypes.add(rdoInstants);
|
||||||
|
|
||||||
|
rdoSorceries.setSelected(true);
|
||||||
|
rdoSorceries.setText("Sorceries ");
|
||||||
|
rdoSorceries.setFocusable(false);
|
||||||
|
rdoSorceries.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||||
|
rdoSorceries.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
|
rdoSorceries.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
rdoSorceriesActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tbTypes.add(rdoSorceries);
|
||||||
|
|
||||||
|
rdoPlaneswalkers.setSelected(true);
|
||||||
|
rdoPlaneswalkers.setText("Planeswalkers ");
|
||||||
|
rdoPlaneswalkers.setFocusable(false);
|
||||||
|
rdoPlaneswalkers.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||||
|
rdoPlaneswalkers.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
|
rdoPlaneswalkers.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||||
|
rdoPlaneswalkersActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tbTypes.add(rdoPlaneswalkers);
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
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(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 825, Short.MAX_VALUE)
|
.addComponent(tbColor, javax.swing.GroupLayout.DEFAULT_SIZE, 825, Short.MAX_VALUE)
|
||||||
.addComponent(cardsList1, javax.swing.GroupLayout.DEFAULT_SIZE, 825, Short.MAX_VALUE)
|
.addComponent(tbTypes, javax.swing.GroupLayout.DEFAULT_SIZE, 825, Short.MAX_VALUE)
|
||||||
|
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 825, Short.MAX_VALUE)
|
||||||
);
|
);
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(tbColor, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addGap(0, 0, 0)
|
.addGap(0, 0, 0)
|
||||||
.addComponent(cardsList1, javax.swing.GroupLayout.DEFAULT_SIZE, 340, Short.MAX_VALUE))
|
.addComponent(tbTypes, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addGap(0, 0, 0)
|
||||||
|
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 316, Short.MAX_VALUE))
|
||||||
);
|
);
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
|
|
@ -247,16 +363,110 @@ public class CardSelector extends javax.swing.JPanel {
|
||||||
filterCards();
|
filterCards();
|
||||||
}//GEN-LAST:event_rdoColorlessActionPerformed
|
}//GEN-LAST:event_rdoColorlessActionPerformed
|
||||||
|
|
||||||
|
private void rdoLandActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoLandActionPerformed
|
||||||
|
if (this.rdoLand.isSelected())
|
||||||
|
filter.getCardType().add(CardType.LAND);
|
||||||
|
else
|
||||||
|
filter.getCardType().remove(CardType.LAND);
|
||||||
|
filterCards();
|
||||||
|
}//GEN-LAST:event_rdoLandActionPerformed
|
||||||
|
|
||||||
|
private void rdoCreaturesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoCreaturesActionPerformed
|
||||||
|
if (this.rdoCreatures.isSelected())
|
||||||
|
filter.getCardType().add(CardType.CREATURE);
|
||||||
|
else
|
||||||
|
filter.getCardType().remove(CardType.CREATURE);
|
||||||
|
filterCards();
|
||||||
|
}//GEN-LAST:event_rdoCreaturesActionPerformed
|
||||||
|
|
||||||
|
private void rdoArtifactsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoArtifactsActionPerformed
|
||||||
|
if (this.rdoArtifacts.isSelected())
|
||||||
|
filter.getCardType().add(CardType.ARTIFACT);
|
||||||
|
else
|
||||||
|
filter.getCardType().remove(CardType.ARTIFACT);
|
||||||
|
filterCards();
|
||||||
|
}//GEN-LAST:event_rdoArtifactsActionPerformed
|
||||||
|
|
||||||
|
private void rdoEnchantmentsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoEnchantmentsActionPerformed
|
||||||
|
if (this.rdoEnchantments.isSelected())
|
||||||
|
filter.getCardType().add(CardType.ENCHANTMENT);
|
||||||
|
else
|
||||||
|
filter.getCardType().remove(CardType.ENCHANTMENT);
|
||||||
|
filterCards();
|
||||||
|
}//GEN-LAST:event_rdoEnchantmentsActionPerformed
|
||||||
|
|
||||||
|
private void rdoInstantsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoInstantsActionPerformed
|
||||||
|
if (this.rdoInstants.isSelected())
|
||||||
|
filter.getCardType().add(CardType.INSTANT);
|
||||||
|
else
|
||||||
|
filter.getCardType().remove(CardType.INSTANT);
|
||||||
|
filterCards();
|
||||||
|
}//GEN-LAST:event_rdoInstantsActionPerformed
|
||||||
|
|
||||||
|
private void rdoSorceriesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoSorceriesActionPerformed
|
||||||
|
if (this.rdoSorceries.isSelected())
|
||||||
|
filter.getCardType().add(CardType.SORCERY);
|
||||||
|
else
|
||||||
|
filter.getCardType().remove(CardType.SORCERY);
|
||||||
|
filterCards();
|
||||||
|
}//GEN-LAST:event_rdoSorceriesActionPerformed
|
||||||
|
|
||||||
|
private void rdoPlaneswalkersActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoPlaneswalkersActionPerformed
|
||||||
|
if (this.rdoPlaneswalkers.isSelected())
|
||||||
|
filter.getCardType().add(CardType.PLANESWALKER);
|
||||||
|
else
|
||||||
|
filter.getCardType().remove(CardType.PLANESWALKER);
|
||||||
|
filterCards();
|
||||||
|
}//GEN-LAST:event_rdoPlaneswalkersActionPerformed
|
||||||
|
|
||||||
|
private void cbExpansionSetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbExpansionSetActionPerformed
|
||||||
|
filter.getExpansionSetId().clear();
|
||||||
|
if (cbExpansionSet.getSelectedItem() instanceof ExpansionSet) {
|
||||||
|
filter.getExpansionSetId().add(((ExpansionSet)this.cbExpansionSet.getSelectedItem()).getId());
|
||||||
|
}
|
||||||
|
filterCards();
|
||||||
|
}//GEN-LAST:event_cbExpansionSetActionPerformed
|
||||||
|
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
private mage.client.cards.CardsList cardsList1;
|
private mage.client.cards.CardGrid cardGrid;
|
||||||
private javax.swing.JToolBar jToolBar1;
|
private javax.swing.JComboBox cbExpansionSet;
|
||||||
|
private javax.swing.JScrollPane jScrollPane1;
|
||||||
|
private javax.swing.JRadioButton rdoArtifacts;
|
||||||
private javax.swing.JRadioButton rdoBlack;
|
private javax.swing.JRadioButton rdoBlack;
|
||||||
private javax.swing.JRadioButton rdoBlue;
|
private javax.swing.JRadioButton rdoBlue;
|
||||||
private javax.swing.JRadioButton rdoColorless;
|
private javax.swing.JRadioButton rdoColorless;
|
||||||
|
private javax.swing.JRadioButton rdoCreatures;
|
||||||
|
private javax.swing.JRadioButton rdoEnchantments;
|
||||||
private javax.swing.JRadioButton rdoGreen;
|
private javax.swing.JRadioButton rdoGreen;
|
||||||
|
private javax.swing.JRadioButton rdoInstants;
|
||||||
|
private javax.swing.JRadioButton rdoLand;
|
||||||
|
private javax.swing.JRadioButton rdoPlaneswalkers;
|
||||||
private javax.swing.JRadioButton rdoRed;
|
private javax.swing.JRadioButton rdoRed;
|
||||||
|
private javax.swing.JRadioButton rdoSorceries;
|
||||||
private javax.swing.JRadioButton rdoWhite;
|
private javax.swing.JRadioButton rdoWhite;
|
||||||
|
private javax.swing.JToolBar tbColor;
|
||||||
|
private javax.swing.JToolBar tbTypes;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentResized(ComponentEvent e) {
|
||||||
|
this.cardGrid.drawCards();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentMoved(ComponentEvent e) {
|
||||||
|
this.cardGrid.drawCards();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentShown(ComponentEvent e) {
|
||||||
|
this.cardGrid.drawCards();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentHidden(ComponentEvent e) {
|
||||||
|
this.cardGrid.drawCards();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,10 +36,12 @@ package mage.client.deckeditor;
|
||||||
|
|
||||||
import java.awt.Cursor;
|
import java.awt.Cursor;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
import java.util.prefs.Preferences;
|
||||||
import javax.swing.JFileChooser;
|
import javax.swing.JFileChooser;
|
||||||
import javax.swing.filechooser.FileFilter;
|
import javax.swing.filechooser.FileFilter;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
|
|
@ -57,10 +59,12 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
private JFileChooser fcSelectDeck;
|
private JFileChooser fcSelectDeck;
|
||||||
private Deck deck = new Deck();;
|
private Deck deck = new Deck();;
|
||||||
|
private Preferences prefs;
|
||||||
|
|
||||||
/** Creates new form DeckEditorPanel */
|
/** Creates new form DeckEditorPanel */
|
||||||
public DeckEditorPanel() {
|
public DeckEditorPanel() {
|
||||||
initComponents();
|
initComponents();
|
||||||
|
prefs = Preferences.userNodeForPackage(this.getClass());
|
||||||
fcSelectDeck = new JFileChooser();
|
fcSelectDeck = new JFileChooser();
|
||||||
fcSelectDeck.setAcceptAllFileFilterUsed(false);
|
fcSelectDeck.setAcceptAllFileFilterUsed(false);
|
||||||
fcSelectDeck.addChoosableFileFilter(new DeckFilter());
|
fcSelectDeck.addChoosableFileFilter(new DeckFilter());
|
||||||
|
|
@ -236,6 +240,9 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
private void btnLoadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoadActionPerformed
|
private void btnLoadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoadActionPerformed
|
||||||
|
String lastFolder = prefs.get("lastDeckFolder", "");
|
||||||
|
if (!lastFolder.isEmpty())
|
||||||
|
fcSelectDeck.setCurrentDirectory(new File(lastFolder));
|
||||||
int ret = fcSelectDeck.showOpenDialog(this);
|
int ret = fcSelectDeck.showOpenDialog(this);
|
||||||
if (ret == JFileChooser.APPROVE_OPTION) {
|
if (ret == JFileChooser.APPROVE_OPTION) {
|
||||||
File file = fcSelectDeck.getSelectedFile();
|
File file = fcSelectDeck.getSelectedFile();
|
||||||
|
|
@ -249,11 +256,17 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||||
}
|
}
|
||||||
refreshDeck();
|
refreshDeck();
|
||||||
|
try {
|
||||||
|
prefs.put("lastDeckFolder", file.getCanonicalPath());
|
||||||
|
} catch (IOException ex) { }
|
||||||
}
|
}
|
||||||
fcSelectDeck.setSelectedFile(null);
|
fcSelectDeck.setSelectedFile(null);
|
||||||
}//GEN-LAST:event_btnLoadActionPerformed
|
}//GEN-LAST:event_btnLoadActionPerformed
|
||||||
|
|
||||||
private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed
|
private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed
|
||||||
|
String lastFolder = prefs.get("lastDeckFolder", "");
|
||||||
|
if (!lastFolder.isEmpty())
|
||||||
|
fcSelectDeck.setCurrentDirectory(new File(lastFolder));
|
||||||
deck.setName(this.txtDeckName.getText());
|
deck.setName(this.txtDeckName.getText());
|
||||||
int ret = fcSelectDeck.showSaveDialog(this);
|
int ret = fcSelectDeck.showSaveDialog(this);
|
||||||
if (ret == JFileChooser.APPROVE_OPTION) {
|
if (ret == JFileChooser.APPROVE_OPTION) {
|
||||||
|
|
@ -267,6 +280,9 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
finally {
|
finally {
|
||||||
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
prefs.put("lastDeckFolder", file.getCanonicalPath());
|
||||||
|
} catch (IOException ex) { }
|
||||||
}
|
}
|
||||||
}//GEN-LAST:event_btnSaveActionPerformed
|
}//GEN-LAST:event_btnSaveActionPerformed
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,10 +34,8 @@
|
||||||
|
|
||||||
package mage.client.dialog;
|
package mage.client.dialog;
|
||||||
|
|
||||||
import java.awt.Dimension;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import javax.swing.JLayeredPane;
|
|
||||||
import mage.client.cards.BigCard;
|
import mage.client.cards.BigCard;
|
||||||
import mage.client.game.CombatGroup;
|
import mage.client.game.CombatGroup;
|
||||||
import mage.view.CombatGroupView;
|
import mage.view.CombatGroupView;
|
||||||
|
|
@ -69,11 +67,9 @@ public class CombatDialog extends MageDialog {
|
||||||
combatGroup.init(gameId, bigCard);
|
combatGroup.init(gameId, bigCard);
|
||||||
combatGroup.update(group);
|
combatGroup.update(group);
|
||||||
combatGroup.setVisible(true);
|
combatGroup.setVisible(true);
|
||||||
// combatGroup.setPreferredSize(new Dimension(140, 440));
|
|
||||||
combatArea.add(combatGroup);
|
combatArea.add(combatGroup);
|
||||||
combatGroup.revalidate();
|
combatGroup.revalidate();
|
||||||
}
|
}
|
||||||
// combatArea.setPreferredSize(new Dimension(140, 440));
|
|
||||||
pack();
|
pack();
|
||||||
this.revalidate();
|
this.revalidate();
|
||||||
this.repaint();
|
this.repaint();
|
||||||
|
|
|
||||||
|
|
@ -193,6 +193,7 @@ public class ConnectDialog extends MageDialog {
|
||||||
}
|
}
|
||||||
setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
setCursor(new Cursor(Cursor.WAIT_CURSOR));
|
||||||
session.connect(txtUserName.getText(), txtServer.getText(), Integer.valueOf(txtPort.getText()));
|
session.connect(txtUserName.getText(), txtServer.getText(), Integer.valueOf(txtPort.getText()));
|
||||||
|
|
||||||
prefs.put("serverAddress", txtServer.getText());
|
prefs.put("serverAddress", txtServer.getText());
|
||||||
prefs.put("serverPort", txtPort.getText());
|
prefs.put("serverPort", txtPort.getText());
|
||||||
prefs.put("userName", txtUserName.getText());
|
prefs.put("userName", txtUserName.getText());
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,7 @@ public class MageDialog extends javax.swing.JInternalFrame {
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
SwingUtilities.invokeAndWait(new Runnable() {
|
SwingUtilities.invokeAndWait(new Runnable() {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
stopModal();
|
stopModal();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,12 +33,6 @@
|
||||||
<Component id="cbGameType" alignment="0" min="-2" pref="241" max="-2" attributes="1"/>
|
<Component id="cbGameType" alignment="0" min="-2" pref="241" max="-2" attributes="1"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
<Group type="102" alignment="1" attributes="0">
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="btnOK" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="btnCancel" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="lbPlayer2Type" min="-2" max="-2" attributes="0"/>
|
<Component id="lbPlayer2Type" min="-2" max="-2" attributes="0"/>
|
||||||
|
|
@ -53,6 +47,12 @@
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="player2Panel" pref="468" max="32767" attributes="0"/>
|
<Component id="player2Panel" pref="468" max="32767" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
|
<Group type="102" alignment="1" attributes="0">
|
||||||
|
<EmptySpace pref="360" max="32767" attributes="0"/>
|
||||||
|
<Component id="btnOK" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="btnCancel" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
|
|
@ -80,12 +80,12 @@
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="player2Panel" min="-2" max="-2" attributes="0"/>
|
<Component id="player2Panel" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace min="-2" pref="13" max="-2" attributes="0"/>
|
<EmptySpace pref="22" max="32767" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
<Group type="103" groupAlignment="3" attributes="0">
|
||||||
<Component id="btnOK" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="btnCancel" alignment="3" min="-2" max="-2" attributes="0"/>
|
<Component id="btnCancel" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="btnOK" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace pref="51" max="32767" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
|
|
@ -104,11 +104,6 @@
|
||||||
</Properties>
|
</Properties>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JComboBox" name="cbDeckType">
|
<Component class="javax.swing.JComboBox" name="cbDeckType">
|
||||||
<Properties>
|
|
||||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
|
||||||
<Connection code="new DefaultComboBoxModel(Constants.DeckType.values())" type="code"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JLabel" name="lbPlayer2Type">
|
<Component class="javax.swing.JLabel" name="lbPlayer2Type">
|
||||||
<Properties>
|
<Properties>
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@ import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import javax.swing.DefaultComboBoxModel;
|
import javax.swing.DefaultComboBoxModel;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import mage.Constants;
|
|
||||||
import mage.cards.decks.DeckCardLists;
|
import mage.cards.decks.DeckCardLists;
|
||||||
import mage.client.remote.Session;
|
import mage.client.remote.Session;
|
||||||
import mage.util.Logging;
|
import mage.util.Logging;
|
||||||
|
|
@ -99,8 +98,6 @@ public class NewTableDialog extends MageDialog {
|
||||||
|
|
||||||
lbDeckType.setText("Deck Type:");
|
lbDeckType.setText("Deck Type:");
|
||||||
|
|
||||||
cbDeckType.setModel(new DefaultComboBoxModel(Constants.DeckType.values()));
|
|
||||||
|
|
||||||
lbPlayer2Type.setText("Player 2 Type:");
|
lbPlayer2Type.setText("Player 2 Type:");
|
||||||
|
|
||||||
cbPlayer2Type.addActionListener(new java.awt.event.ActionListener() {
|
cbPlayer2Type.addActionListener(new java.awt.event.ActionListener() {
|
||||||
|
|
@ -138,11 +135,6 @@ public class NewTableDialog extends MageDialog {
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||||
.addComponent(cbDeckType, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addComponent(cbDeckType, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
.addComponent(cbGameType, javax.swing.GroupLayout.PREFERRED_SIZE, 241, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
.addComponent(cbGameType, javax.swing.GroupLayout.PREFERRED_SIZE, 241, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
|
||||||
.addContainerGap()
|
|
||||||
.addComponent(btnOK)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(btnCancel))
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(lbPlayer2Type)
|
.addComponent(lbPlayer2Type)
|
||||||
|
|
@ -153,7 +145,12 @@ public class NewTableDialog extends MageDialog {
|
||||||
.addComponent(player1Panel, javax.swing.GroupLayout.DEFAULT_SIZE, 468, Short.MAX_VALUE))
|
.addComponent(player1Panel, javax.swing.GroupLayout.DEFAULT_SIZE, 468, Short.MAX_VALUE))
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(player2Panel, javax.swing.GroupLayout.DEFAULT_SIZE, 468, Short.MAX_VALUE)))
|
.addComponent(player2Panel, javax.swing.GroupLayout.DEFAULT_SIZE, 468, Short.MAX_VALUE))
|
||||||
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||||
|
.addContainerGap(360, Short.MAX_VALUE)
|
||||||
|
.addComponent(btnOK)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(btnCancel)))
|
||||||
.addContainerGap())
|
.addContainerGap())
|
||||||
);
|
);
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
|
|
@ -175,11 +172,11 @@ public class NewTableDialog extends MageDialog {
|
||||||
.addComponent(cbPlayer2Type, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addComponent(cbPlayer2Type, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(player2Panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(player2Panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addGap(13, 13, 13)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE)
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(btnOK)
|
.addComponent(btnCancel)
|
||||||
.addComponent(btnCancel))
|
.addComponent(btnOK))
|
||||||
.addContainerGap(39, Short.MAX_VALUE))
|
.addContainerGap())
|
||||||
);
|
);
|
||||||
|
|
||||||
pack();
|
pack();
|
||||||
|
|
@ -198,6 +195,10 @@ public class NewTableDialog extends MageDialog {
|
||||||
else {
|
else {
|
||||||
this.player2Panel.setVisible(false);
|
this.player2Panel.setVisible(false);
|
||||||
}
|
}
|
||||||
|
this.pack();
|
||||||
|
this.revalidate();
|
||||||
|
this.repaint();
|
||||||
|
|
||||||
}//GEN-LAST:event_cbPlayer2TypeActionPerformed
|
}//GEN-LAST:event_cbPlayer2TypeActionPerformed
|
||||||
|
|
||||||
private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed
|
private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed
|
||||||
|
|
@ -208,30 +209,34 @@ public class NewTableDialog extends MageDialog {
|
||||||
table = session.createTable(
|
table = session.createTable(
|
||||||
roomId,
|
roomId,
|
||||||
(String)this.cbGameType.getSelectedItem(),
|
(String)this.cbGameType.getSelectedItem(),
|
||||||
(Constants.DeckType)this.cbDeckType.getSelectedItem(),
|
(String)this.cbDeckType.getSelectedItem(),
|
||||||
playerTypes
|
playerTypes
|
||||||
);
|
);
|
||||||
session.joinTable(
|
if (session.joinTable(
|
||||||
roomId,
|
roomId,
|
||||||
table.getTableId(),
|
table.getTableId(),
|
||||||
0,
|
0,
|
||||||
this.player1Panel.getPlayerName(),
|
this.player1Panel.getPlayerName(),
|
||||||
DeckCardLists.load(this.player1Panel.getDeckFile())
|
DeckCardLists.load(this.player1Panel.getDeckFile())
|
||||||
);
|
)) {
|
||||||
if (!this.cbPlayer2Type.getSelectedItem().equals("Human")) {
|
if (!this.cbPlayer2Type.getSelectedItem().equals("Human")) {
|
||||||
session.joinTable(
|
if (session.joinTable(
|
||||||
roomId,
|
roomId,
|
||||||
table.getTableId(),
|
table.getTableId(),
|
||||||
1,
|
1,
|
||||||
this.player2Panel.getPlayerName(),
|
this.player2Panel.getPlayerName(),
|
||||||
DeckCardLists.load(this.player2Panel.getDeckFile())
|
DeckCardLists.load(this.player2Panel.getDeckFile())
|
||||||
);
|
)) {
|
||||||
|
this.setVisible(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
handleError(ex);
|
handleError(ex);
|
||||||
}
|
}
|
||||||
|
session.removeTable(roomId, table.getTableId());
|
||||||
this.setVisible(false);
|
table = null;
|
||||||
}//GEN-LAST:event_btnOKActionPerformed
|
}//GEN-LAST:event_btnOKActionPerformed
|
||||||
|
|
||||||
private void handleError(Exception ex) {
|
private void handleError(Exception ex) {
|
||||||
|
|
@ -241,10 +246,15 @@ public class NewTableDialog extends MageDialog {
|
||||||
|
|
||||||
public void showDialog(UUID roomId) {
|
public void showDialog(UUID roomId) {
|
||||||
session = MageFrame.getSession();
|
session = MageFrame.getSession();
|
||||||
|
this.player1Panel.setPlayerName(session.getUserName());
|
||||||
cbGameType.setModel(new DefaultComboBoxModel(session.getGameTypes()));
|
cbGameType.setModel(new DefaultComboBoxModel(session.getGameTypes()));
|
||||||
|
cbDeckType.setModel(new DefaultComboBoxModel(session.getDeckTypes()));
|
||||||
cbPlayer2Type.setModel(new DefaultComboBoxModel(session.getPlayerTypes()));
|
cbPlayer2Type.setModel(new DefaultComboBoxModel(session.getPlayerTypes()));
|
||||||
this.roomId = roomId;
|
this.roomId = roomId;
|
||||||
this.setModal(true);
|
this.setModal(true);
|
||||||
|
this.pack();
|
||||||
|
this.revalidate();
|
||||||
|
this.repaint();
|
||||||
this.setVisible(true);
|
this.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,11 +36,8 @@ package mage.client.dialog;
|
||||||
|
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.awt.event.ComponentEvent;
|
|
||||||
import java.awt.event.ComponentListener;
|
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.event.MouseListener;
|
import java.awt.event.MouseListener;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import javax.swing.JLayeredPane;
|
import javax.swing.JLayeredPane;
|
||||||
import mage.client.MageFrame;
|
import mage.client.MageFrame;
|
||||||
|
|
@ -65,6 +62,34 @@ public class ShowCardsDialog extends MageDialog implements MouseListener {
|
||||||
public void loadCards(String name, CardsView showCards, BigCard bigCard, UUID gameId) {
|
public void loadCards(String name, CardsView showCards, BigCard bigCard, UUID gameId) {
|
||||||
this.title = name;
|
this.title = name;
|
||||||
cardArea.removeAll();
|
cardArea.removeAll();
|
||||||
|
if (showCards != null && showCards.size() < 10)
|
||||||
|
loadCardsFew(showCards, bigCard, gameId);
|
||||||
|
else
|
||||||
|
loadCardsMany(showCards, bigCard, gameId);
|
||||||
|
cardArea.revalidate();
|
||||||
|
if (getParent() != MageFrame.getDesktop() || this.isClosed)
|
||||||
|
MageFrame.getDesktop().add(this, JLayeredPane.PALETTE_LAYER);
|
||||||
|
pack();
|
||||||
|
this.revalidate();
|
||||||
|
this.repaint();
|
||||||
|
this.setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadCardsFew(CardsView showCards, BigCard bigCard, UUID gameId) {
|
||||||
|
Rectangle rectangle = new Rectangle(FRAME_WIDTH, FRAME_HEIGHT);
|
||||||
|
for (CardView card: showCards) {
|
||||||
|
Card cardImg = new Card(card, bigCard, gameId);
|
||||||
|
cardImg.setBounds(rectangle);
|
||||||
|
cardArea.add(cardImg);
|
||||||
|
cardArea.moveToFront(cardImg);
|
||||||
|
cardImg.update(card);
|
||||||
|
cardImg.addMouseListener(this);
|
||||||
|
rectangle.translate(FRAME_WIDTH, 0);
|
||||||
|
}
|
||||||
|
cardArea.setPreferredSize(new Dimension(FRAME_WIDTH * showCards.size(), FRAME_HEIGHT));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadCardsMany(CardsView showCards, BigCard bigCard, UUID gameId) {
|
||||||
int columns = 1;
|
int columns = 1;
|
||||||
if (showCards != null && showCards.size() > 0) {
|
if (showCards != null && showCards.size() > 0) {
|
||||||
Rectangle rectangle = new Rectangle(FRAME_WIDTH, FRAME_HEIGHT);
|
Rectangle rectangle = new Rectangle(FRAME_WIDTH, FRAME_HEIGHT);
|
||||||
|
|
@ -87,13 +112,6 @@ public class ShowCardsDialog extends MageDialog implements MouseListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cardArea.setPreferredSize(new Dimension(FRAME_WIDTH * columns, FRAME_HEIGHT + 400));
|
cardArea.setPreferredSize(new Dimension(FRAME_WIDTH * columns, FRAME_HEIGHT + 400));
|
||||||
cardArea.revalidate();
|
|
||||||
if (getParent() != MageFrame.getDesktop() || this.isClosed)
|
|
||||||
MageFrame.getDesktop().add(this, JLayeredPane.PALETTE_LAYER);
|
|
||||||
pack();
|
|
||||||
this.revalidate();
|
|
||||||
this.repaint();
|
|
||||||
this.setVisible(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method is called from within the constructor to
|
/** This method is called from within the constructor to
|
||||||
|
|
@ -124,6 +142,7 @@ public class ShowCardsDialog extends MageDialog implements MouseListener {
|
||||||
private javax.swing.JScrollPane jScrollPane1;
|
private javax.swing.JScrollPane jScrollPane1;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
|
|
||||||
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
this.setVisible(false);
|
this.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" 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">
|
||||||
<AuxValues>
|
<AuxValues>
|
||||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||||
|
|
@ -14,7 +14,5 @@
|
||||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,0,-68,0,0,1,-115"/>
|
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,0,-68,0,0,1,-115"/>
|
||||||
</AuxValues>
|
</AuxValues>
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
|
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JLayeredPaneSupportLayout"/>
|
||||||
<Property name="useNullLayout" type="boolean" value="true"/>
|
|
||||||
</Layout>
|
|
||||||
</Form>
|
</Form>
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ import static mage.client.util.Constants.*;
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
public class BattlefieldPanel extends javax.swing.JPanel implements ComponentListener {
|
public class BattlefieldPanel extends javax.swing.JLayeredPane implements ComponentListener {
|
||||||
|
|
||||||
private Map<UUID, Permanent> permanents = new HashMap<UUID, Permanent>();
|
private Map<UUID, Permanent> permanents = new HashMap<UUID, Permanent>();
|
||||||
private UUID gameId;
|
private UUID gameId;
|
||||||
|
|
@ -98,11 +98,13 @@ public class BattlefieldPanel extends javax.swing.JPanel implements ComponentLis
|
||||||
perm.setBounds(findEmptySpace(new Dimension(FRAME_WIDTH, FRAME_HEIGHT)));
|
perm.setBounds(findEmptySpace(new Dimension(FRAME_WIDTH, FRAME_HEIGHT)));
|
||||||
permanents.put(permanent.getId(), perm);
|
permanents.put(permanent.getId(), perm);
|
||||||
this.add(perm);
|
this.add(perm);
|
||||||
|
moveToFront(perm);
|
||||||
perm.update(permanent);
|
perm.update(permanent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void groupAttachments(PermanentView permanent) {
|
private void groupAttachments(PermanentView permanent) {
|
||||||
Permanent perm = permanents.get(permanent.getId());
|
Permanent perm = permanents.get(permanent.getId());
|
||||||
|
int position = getPosition(perm);
|
||||||
perm.getLinks().clear();
|
perm.getLinks().clear();
|
||||||
Rectangle r = perm.getBounds();
|
Rectangle r = perm.getBounds();
|
||||||
for (UUID attachmentId: permanent.getAttachments()) {
|
for (UUID attachmentId: permanent.getAttachments()) {
|
||||||
|
|
@ -110,6 +112,7 @@ public class BattlefieldPanel extends javax.swing.JPanel implements ComponentLis
|
||||||
perm.getLinks().add(link);
|
perm.getLinks().add(link);
|
||||||
r.translate(20, 20);
|
r.translate(20, 20);
|
||||||
link.setBounds(r);
|
link.setBounds(r);
|
||||||
|
setPosition(link, ++position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -163,18 +166,22 @@ public class BattlefieldPanel extends javax.swing.JPanel implements ComponentLis
|
||||||
setLayout(null);
|
setLayout(null);
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
|
@Override
|
||||||
public void componentResized(ComponentEvent e) {
|
public void componentResized(ComponentEvent e) {
|
||||||
resizeBattlefield();
|
resizeBattlefield();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void componentMoved(ComponentEvent e) {
|
public void componentMoved(ComponentEvent e) {
|
||||||
resizeBattlefield();
|
resizeBattlefield();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void componentShown(ComponentEvent e) {
|
public void componentShown(ComponentEvent e) {
|
||||||
resizeBattlefield();
|
resizeBattlefield();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void componentHidden(ComponentEvent e) {
|
public void componentHidden(ComponentEvent e) {
|
||||||
resizeBattlefield();
|
resizeBattlefield();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ public class GamePanel extends javax.swing.JPanel {
|
||||||
initComponents();
|
initComponents();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showGame(UUID gameId, UUID playerId) {
|
public synchronized void showGame(UUID gameId, UUID playerId) {
|
||||||
this.gameId = gameId;
|
this.gameId = gameId;
|
||||||
session = MageFrame.getSession();
|
session = MageFrame.getSession();
|
||||||
session.setGame(this);
|
session.setGame(this);
|
||||||
|
|
@ -94,7 +94,7 @@ public class GamePanel extends javax.swing.JPanel {
|
||||||
hideGame();
|
hideGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void watchGame(UUID gameId) {
|
public synchronized void watchGame(UUID gameId) {
|
||||||
this.gameId = gameId;
|
this.gameId = gameId;
|
||||||
session = MageFrame.getSession();
|
session = MageFrame.getSession();
|
||||||
session.setGame(this);
|
session.setGame(this);
|
||||||
|
|
@ -109,7 +109,7 @@ public class GamePanel extends javax.swing.JPanel {
|
||||||
hideGame();
|
hideGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void replayGame(UUID gameId) {
|
public synchronized void replayGame(UUID gameId) {
|
||||||
this.gameId = gameId;
|
this.gameId = gameId;
|
||||||
session = MageFrame.getSession();
|
session = MageFrame.getSession();
|
||||||
session.setGame(this);
|
session.setGame(this);
|
||||||
|
|
@ -126,11 +126,11 @@ public class GamePanel extends javax.swing.JPanel {
|
||||||
this.chatPanel.disconnect();
|
this.chatPanel.disconnect();
|
||||||
this.players.clear();
|
this.players.clear();
|
||||||
this.pnlBattlefield.removeAll();
|
this.pnlBattlefield.removeAll();
|
||||||
|
this.combat.hideDialog();
|
||||||
this.setVisible(false);
|
this.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(GameView game) {
|
public synchronized void init(GameView game) {
|
||||||
combat.init(gameId, bigCard);
|
combat.init(gameId, bigCard);
|
||||||
MageFrame.getDesktop().add(combat, JLayeredPane.PALETTE_LAYER);
|
MageFrame.getDesktop().add(combat, JLayeredPane.PALETTE_LAYER);
|
||||||
this.players.clear();
|
this.players.clear();
|
||||||
|
|
@ -144,7 +144,7 @@ public class GamePanel extends javax.swing.JPanel {
|
||||||
updateGame(game);
|
updateGame(game);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateGame(GameView game) {
|
public synchronized void updateGame(GameView game) {
|
||||||
if (game.getHand() != null)
|
if (game.getHand() != null)
|
||||||
this.hand.loadCards(game.getHand(), bigCard, gameId);
|
this.hand.loadCards(game.getHand(), bigCard, gameId);
|
||||||
else
|
else
|
||||||
|
|
@ -169,6 +169,7 @@ public class GamePanel extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
if (game.getCombat().size() > 0) {
|
if (game.getCombat().size() > 0) {
|
||||||
combat.showDialog(game.getCombat());
|
combat.showDialog(game.getCombat());
|
||||||
|
combat.setLocation(300, 200);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
combat.hideDialog();
|
combat.hideDialog();
|
||||||
|
|
|
||||||
|
|
@ -40,12 +40,12 @@ import java.util.UUID;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import mage.Constants;
|
|
||||||
import mage.cards.decks.DeckCardLists;
|
import mage.cards.decks.DeckCardLists;
|
||||||
import mage.client.MageFrame;
|
import mage.client.MageFrame;
|
||||||
import mage.client.chat.ChatPanel;
|
import mage.client.chat.ChatPanel;
|
||||||
import mage.client.game.GamePanel;
|
import mage.client.game.GamePanel;
|
||||||
import mage.client.util.Config;
|
import mage.client.util.Config;
|
||||||
|
import mage.game.GameException;
|
||||||
import mage.interfaces.MageException;
|
import mage.interfaces.MageException;
|
||||||
import mage.interfaces.Server;
|
import mage.interfaces.Server;
|
||||||
import mage.interfaces.callback.CallbackClientDaemon;
|
import mage.interfaces.callback.CallbackClientDaemon;
|
||||||
|
|
@ -67,6 +67,7 @@ public class Session {
|
||||||
private MageFrame frame;
|
private MageFrame frame;
|
||||||
private String[] playerTypes;
|
private String[] playerTypes;
|
||||||
private String[] gameTypes;
|
private String[] gameTypes;
|
||||||
|
private String[] deckTypes;
|
||||||
private Map<UUID, ChatPanel> chats = new HashMap<UUID, ChatPanel>();
|
private Map<UUID, ChatPanel> chats = new HashMap<UUID, ChatPanel>();
|
||||||
private GamePanel game;
|
private GamePanel game;
|
||||||
private CallbackClientDaemon callbackDaemon;
|
private CallbackClientDaemon callbackDaemon;
|
||||||
|
|
@ -89,7 +90,9 @@ public class Session {
|
||||||
callbackDaemon = new CallbackClientDaemon(sessionId, client, server);
|
callbackDaemon = new CallbackClientDaemon(sessionId, client, server);
|
||||||
playerTypes = server.getPlayerTypes();
|
playerTypes = server.getPlayerTypes();
|
||||||
gameTypes = server.getGameTypes();
|
gameTypes = server.getGameTypes();
|
||||||
|
deckTypes = server.getDeckTypes();
|
||||||
logger.info("Connected to RMI server at " + serverName + ":" + port);
|
logger.info("Connected to RMI server at " + serverName + ":" + port);
|
||||||
|
frame.setStatusText("Connected to " + serverName + ":" + port);
|
||||||
frame.enableButtons();
|
frame.enableButtons();
|
||||||
} catch (MageException ex) {
|
} catch (MageException ex) {
|
||||||
Logger.getLogger(Session.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(Session.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
|
|
@ -112,6 +115,7 @@ public class Session {
|
||||||
} catch (MageException ex) {
|
} catch (MageException ex) {
|
||||||
logger.log(Level.SEVERE, "Error disconnecting ...", ex);
|
logger.log(Level.SEVERE, "Error disconnecting ...", ex);
|
||||||
}
|
}
|
||||||
|
frame.setStatusText("Not connected");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -127,6 +131,10 @@ public class Session {
|
||||||
return gameTypes;
|
return gameTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String[] getDeckTypes() {
|
||||||
|
return deckTypes;
|
||||||
|
}
|
||||||
|
|
||||||
public Map<UUID, ChatPanel> getChats() {
|
public Map<UUID, ChatPanel> getChats() {
|
||||||
return chats;
|
return chats;
|
||||||
}
|
}
|
||||||
|
|
@ -225,6 +233,8 @@ public class Session {
|
||||||
handleRemoteException(ex);
|
handleRemoteException(ex);
|
||||||
} catch (MageException ex) {
|
} catch (MageException ex) {
|
||||||
handleMageException(ex);
|
handleMageException(ex);
|
||||||
|
} catch (GameException ex) {
|
||||||
|
handleGameException(ex);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -363,7 +373,7 @@ public class Session {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TableView createTable(UUID roomId, String gameType, Constants.DeckType deckType, List<String> playerTypes) {
|
public TableView createTable(UUID roomId, String gameType, String deckType, List<String> playerTypes) {
|
||||||
try {
|
try {
|
||||||
return server.createTable(sessionId, roomId, gameType, deckType, playerTypes);
|
return server.createTable(sessionId, roomId, gameType, deckType, playerTypes);
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
|
|
@ -496,6 +506,7 @@ public class Session {
|
||||||
private void handleRemoteException(RemoteException ex) {
|
private void handleRemoteException(RemoteException ex) {
|
||||||
server = null;
|
server = null;
|
||||||
logger.log(Level.SEVERE, "Connection to server lost", ex);
|
logger.log(Level.SEVERE, "Connection to server lost", ex);
|
||||||
|
frame.setStatusText("Not connected");
|
||||||
JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Connection to server lost.", "Error", JOptionPane.ERROR_MESSAGE);
|
JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Connection to server lost.", "Error", JOptionPane.ERROR_MESSAGE);
|
||||||
frame.disableButtons();
|
frame.disableButtons();
|
||||||
}
|
}
|
||||||
|
|
@ -507,6 +518,12 @@ public class Session {
|
||||||
frame.disableButtons();
|
frame.disableButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleGameException(GameException ex) {
|
||||||
|
logger.log(Level.WARNING, "Game error", ex.getMessage());
|
||||||
|
JOptionPane.showMessageDialog(MageFrame.getDesktop(), ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getUserName() {
|
public String getUserName() {
|
||||||
return userName;
|
return userName;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,10 @@
|
||||||
|
|
||||||
package mage.client.util;
|
package mage.client.util;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
|
import mage.client.MageFrame;
|
||||||
import mage.util.Logging;
|
import mage.util.Logging;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -46,7 +49,8 @@ public class EDTExceptionHandler implements Thread.UncaughtExceptionHandler {
|
||||||
|
|
||||||
public void handle(Throwable throwable) {
|
public void handle(Throwable throwable) {
|
||||||
try {
|
try {
|
||||||
logger.severe(throwable.getMessage());
|
logger.log(Level.SEVERE, null, throwable);
|
||||||
|
JOptionPane.showMessageDialog(MageFrame.getDesktop(), throwable, "MAGE Client UI error", JOptionPane.ERROR_MESSAGE);
|
||||||
} catch (Throwable t) {}
|
} catch (Throwable t) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,12 +44,23 @@ public class Frames {
|
||||||
public static Image Grey = ImageHelper.loadImage(Config.frameResourcePath + "8 grey.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
public static Image Grey = ImageHelper.loadImage(Config.frameResourcePath + "8 grey.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
||||||
public static Image Red = ImageHelper.loadImage(Config.frameResourcePath + "8 red.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
public static Image Red = ImageHelper.loadImage(Config.frameResourcePath + "8 red.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
||||||
public static Image White = ImageHelper.loadImage(Config.frameResourcePath + "8 white.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
public static Image White = ImageHelper.loadImage(Config.frameResourcePath + "8 white.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
||||||
|
public static Image BlackRed = ImageHelper.loadImage(Config.frameResourcePath + "black to red hybrid.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
||||||
|
public static Image BlackGreen = ImageHelper.loadImage(Config.frameResourcePath + "eve hybrid black to green.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
||||||
|
public static Image BlueBlack = ImageHelper.loadImage(Config.frameResourcePath + "blue_to_black_hybrid.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
||||||
|
public static Image BlueRed = ImageHelper.loadImage(Config.frameResourcePath + "eve hybrid blue to red.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
||||||
|
public static Image GreenBlue = ImageHelper.loadImage(Config.frameResourcePath + "eve hybrid green to blue.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
||||||
|
public static Image GreenWhite = ImageHelper.loadImage(Config.frameResourcePath + "green_to_white_hybrid.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
||||||
|
public static Image RedGreen = ImageHelper.loadImage(Config.frameResourcePath + "red_to_green_hybrid.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
||||||
|
public static Image RedWhite = ImageHelper.loadImage(Config.frameResourcePath + "eve hybrid red to white.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
||||||
|
public static Image WhiteBlack = ImageHelper.loadImage(Config.frameResourcePath + "eve hybrid white to black.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
||||||
|
public static Image WhiteBlue = ImageHelper.loadImage(Config.frameResourcePath + "white_to_blue_hybrid.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
||||||
|
|
||||||
public static Image Forest = ImageHelper.loadImage(Config.frameResourcePath + "8 land mana green.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
public static Image Forest = ImageHelper.loadImage(Config.frameResourcePath + "8 land mana green.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
||||||
public static Image Island = ImageHelper.loadImage(Config.frameResourcePath + "8 land mana blue.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
public static Image Island = ImageHelper.loadImage(Config.frameResourcePath + "8 land mana blue.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
||||||
public static Image Mountain = ImageHelper.loadImage(Config.frameResourcePath + "8 land mana red.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
public static Image Mountain = ImageHelper.loadImage(Config.frameResourcePath + "8 land mana red.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
||||||
public static Image Plains = ImageHelper.loadImage(Config.frameResourcePath + "8 land mana white.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
public static Image Plains = ImageHelper.loadImage(Config.frameResourcePath + "8 land mana white.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
||||||
public static Image Swamp = ImageHelper.loadImage(Config.frameResourcePath + "8 land mana black.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
public static Image Swamp = ImageHelper.loadImage(Config.frameResourcePath + "8 land mana black.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
||||||
|
public static Image Land = ImageHelper.loadImage(Config.frameResourcePath + "8 multiland nomana colorless.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
||||||
|
|
||||||
public static Image Effect = ImageHelper.loadImage(Config.frameResourcePath + "Effects\\effect0.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
public static Image Effect = ImageHelper.loadImage(Config.frameResourcePath + "Effects\\effect0.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
|
import mage.view.AbilityView;
|
||||||
import mage.view.CardView;
|
import mage.view.CardView;
|
||||||
import mage.view.StackAbilityView;
|
import mage.view.StackAbilityView;
|
||||||
import static mage.client.util.Constants.*;
|
import static mage.client.util.Constants.*;
|
||||||
|
|
@ -87,12 +88,12 @@ public class ImageHelper {
|
||||||
g.setColor(Color.WHITE);
|
g.setColor(Color.WHITE);
|
||||||
g.fillRect(0, 0, FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
g.fillRect(0, 0, FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
|
||||||
g.drawImage(getFrame(card), 0, 0, Color.WHITE, null);
|
g.drawImage(getFrame(card), 0, 0, Color.WHITE, null);
|
||||||
if (!card.getArt().equals("")) {
|
if (card.getArt() != null && !card.getArt().equals("")) {
|
||||||
Image art = loadImage(Config.cardArtResourcePath + card.getArt(), ART_MAX_WIDTH, ART_MAX_HEIGHT);
|
Image art = loadImage(Config.cardArtResourcePath + card.getArt(), ART_MAX_WIDTH, ART_MAX_HEIGHT);
|
||||||
g.drawImage(art, CONTENT_MAX_XOFFSET, ART_MAX_YOFFSET, null);
|
g.drawImage(art, CONTENT_MAX_XOFFSET, ART_MAX_YOFFSET, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (card.getCardTypes().contains(CardType.CREATURE) || card.getCardTypes().contains(CardType.PLANESWALKER)) {
|
if (card.getCardTypes() != null && (card.getCardTypes().contains(CardType.CREATURE) || card.getCardTypes().contains(CardType.PLANESWALKER))) {
|
||||||
g.drawImage(Frames.PowBoxLeft, POWBOX_MAX_LEFT, POWBOX_MAX_TOP, null);
|
g.drawImage(Frames.PowBoxLeft, POWBOX_MAX_LEFT, POWBOX_MAX_TOP, null);
|
||||||
g.drawImage(Frames.PowBoxMid, POWBOX_MAX_LEFT + 7, POWBOX_MAX_TOP, null);
|
g.drawImage(Frames.PowBoxMid, POWBOX_MAX_LEFT + 7, POWBOX_MAX_TOP, null);
|
||||||
g.drawImage(Frames.PowBoxRight, POWBOX_MAX_LEFT + 38, POWBOX_MAX_TOP, null);
|
g.drawImage(Frames.PowBoxRight, POWBOX_MAX_LEFT + 38, POWBOX_MAX_TOP, null);
|
||||||
|
|
@ -105,7 +106,7 @@ public class ImageHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static Image getFrame(CardView card) {
|
protected static Image getFrame(CardView card) {
|
||||||
if (card instanceof StackAbilityView) {
|
if (card instanceof StackAbilityView || card instanceof AbilityView) {
|
||||||
return Frames.Effect;
|
return Frames.Effect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -116,6 +117,48 @@ public class ImageHelper {
|
||||||
if (card.getColor().isColorless()) {
|
if (card.getColor().isColorless()) {
|
||||||
return Frames.Grey;
|
return Frames.Grey;
|
||||||
} else if (card.getColor().isMulticolored()) {
|
} else if (card.getColor().isMulticolored()) {
|
||||||
|
if (card.getColor().getColorCount() > 2)
|
||||||
|
return Frames.Gold;
|
||||||
|
if (card.getColor().isBlack() && card.getColor().isRed()) {
|
||||||
|
if (Frames.BlackRed != null)
|
||||||
|
return Frames.BlackRed;
|
||||||
|
}
|
||||||
|
else if (card.getColor().isBlack() && card.getColor().isGreen()) {
|
||||||
|
if (Frames.BlackGreen != null)
|
||||||
|
return Frames.BlackGreen;
|
||||||
|
}
|
||||||
|
else if (card.getColor().isBlack() && card.getColor().isBlue()) {
|
||||||
|
if (Frames.BlueBlack != null)
|
||||||
|
return Frames.BlueBlack;
|
||||||
|
}
|
||||||
|
else if (card.getColor().isRed() && card.getColor().isBlue()) {
|
||||||
|
if (Frames.BlueRed != null)
|
||||||
|
return Frames.BlueRed;
|
||||||
|
}
|
||||||
|
else if (card.getColor().isGreen() && card.getColor().isBlue()) {
|
||||||
|
if (Frames.GreenBlue != null)
|
||||||
|
return Frames.GreenBlue;
|
||||||
|
}
|
||||||
|
else if (card.getColor().isGreen() && card.getColor().isWhite()) {
|
||||||
|
if (Frames.GreenWhite != null)
|
||||||
|
return Frames.GreenWhite;
|
||||||
|
}
|
||||||
|
else if (card.getColor().isRed() && card.getColor().isGreen()) {
|
||||||
|
if (Frames.RedGreen != null)
|
||||||
|
return Frames.RedGreen;
|
||||||
|
}
|
||||||
|
else if (card.getColor().isRed() && card.getColor().isWhite()) {
|
||||||
|
if (Frames.RedWhite != null)
|
||||||
|
return Frames.RedWhite;
|
||||||
|
}
|
||||||
|
else if (card.getColor().isWhite() && card.getColor().isBlack()) {
|
||||||
|
if (Frames.WhiteBlack != null)
|
||||||
|
return Frames.WhiteBlack;
|
||||||
|
}
|
||||||
|
else if (card.getColor().isWhite() && card.getColor().isBlue()) {
|
||||||
|
if (Frames.WhiteBlue != null)
|
||||||
|
return Frames.WhiteBlue;
|
||||||
|
}
|
||||||
return Frames.Gold;
|
return Frames.Gold;
|
||||||
} else {
|
} else {
|
||||||
if (card.getColor().isBlack()) {
|
if (card.getColor().isBlack()) {
|
||||||
|
|
@ -152,7 +195,7 @@ public class ImageHelper {
|
||||||
return Frames.Swamp;
|
return Frames.Swamp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Frames.Grey;
|
return Frames.Land;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Image ScaleImage(Image image, int width, int height) {
|
public static Image ScaleImage(Image image, int width, int height) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue