diff --git a/Mage.Client/build-before-profiler.xml b/Mage.Client/build-before-profiler.xml
new file mode 100644
index 00000000000..b40b33eb728
--- /dev/null
+++ b/Mage.Client/build-before-profiler.xml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+ Builds, tests, and runs the project Mage.Client.
+
+
+
diff --git a/Mage.Client/build.xml b/Mage.Client/build.xml
new file mode 100644
index 00000000000..a4e5ae988f6
--- /dev/null
+++ b/Mage.Client/build.xml
@@ -0,0 +1,109 @@
+
+
+
+
+
+
+
+
+
+
+ Builds, tests, and runs the project Mage.Client.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Mage.Client/manifest.mf b/Mage.Client/manifest.mf
new file mode 100644
index 00000000000..1574df4a2de
--- /dev/null
+++ b/Mage.Client/manifest.mf
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+X-COMMENT: Main-Class will be added automatically by build
+
diff --git a/Mage.Client/nbproject/build-impl.xml b/Mage.Client/nbproject/build-impl.xml
new file mode 100644
index 00000000000..ee131412af5
--- /dev/null
+++ b/Mage.Client/nbproject/build-impl.xml
@@ -0,0 +1,708 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set src.dir
+ Must set test.src.dir
+ Must set build.dir
+ Must set dist.dir
+ Must set build.classes.dir
+ Must set dist.javadoc.dir
+ Must set build.test.classes.dir
+ Must set build.test.results.dir
+ Must set build.classes.excludes
+ Must set dist.jar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ To run this application from the command line without Ant, try:
+
+
+
+
+
+
+ java -cp "${run.classpath.with.dist.jar}" ${main.class}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ To run this application from the command line without Ant, try:
+
+ java -jar "${dist.jar.resolved}"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must set fix.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set test.includes
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+ Must select one file in the IDE or set test.class
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Mage.Client/nbproject/genfiles.properties b/Mage.Client/nbproject/genfiles.properties
new file mode 100644
index 00000000000..6a0c7889ca2
--- /dev/null
+++ b/Mage.Client/nbproject/genfiles.properties
@@ -0,0 +1,11 @@
+build.xml.data.CRC32=661539d5
+build.xml.script.CRC32=a8618a63
+build.xml.stylesheet.CRC32=958a1d3e@1.26.2.45
+# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=ab5db5cf
+nbproject/build-impl.xml.script.CRC32=268965d9
+nbproject/build-impl.xml.stylesheet.CRC32=5c621a33@1.26.2.45
+nbproject/profiler-build-impl.xml.data.CRC32=661539d5
+nbproject/profiler-build-impl.xml.script.CRC32=abda56ed
+nbproject/profiler-build-impl.xml.stylesheet.CRC32=42cb6bcf@1.6.1
diff --git a/Mage.Client/nbproject/profiler-build-impl.xml b/Mage.Client/nbproject/profiler-build-impl.xml
new file mode 100644
index 00000000000..300ea407597
--- /dev/null
+++ b/Mage.Client/nbproject/profiler-build-impl.xml
@@ -0,0 +1,131 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set JVM to use for profiling in profiler.info.jvm
+ Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set profile.class
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Mage.Client/nbproject/project.properties b/Mage.Client/nbproject/project.properties
new file mode 100644
index 00000000000..f1d78945c61
--- /dev/null
+++ b/Mage.Client/nbproject/project.properties
@@ -0,0 +1,75 @@
+application.title=MageClient
+application.vendor=BetaSteward_at_googlemail.com
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+build.generated.sources.dir=${build.dir}/generated-sources
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+# Uncomment to specify the preferred debugger connection transport:
+#debug.transport=dt_socket
+debug.classpath=\
+ ${run.classpath}
+debug.test.classpath=\
+ ${run.test.classpath}
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/Mage.Client.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+excludes=
+includes=**
+jar.compress=false
+javac.classpath=\
+ ${reference.Mage_Common.jar}:\
+ ${reference.Mage.jar}:\
+ ${reference.Mage_Sets.jar}
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.deprecation=false
+javac.source=1.6
+javac.target=1.6
+javac.test.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}:\
+ ${libs.junit.classpath}:\
+ ${libs.junit_4.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=${source.encoding}
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.private=false
+javadoc.splitindex=true
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=
+main.class=mage.client.MageFrame
+manifest.file=manifest.mf
+meta.inf.dir=${src.dir}/META-INF
+platform.active=default_platform
+project.license=bsd
+project.Mage=../Mage
+project.Mage_Common=../Mage.Common
+project.Mage_Sets=../Mage.Sets
+reference.Mage.jar=${project.Mage}/dist/Mage.jar
+reference.Mage_Common.jar=${project.Mage_Common}/dist/Mage.Common.jar
+reference.Mage_Sets.jar=${project.Mage_Sets}/dist/Mage.Sets.jar
+run.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+# Space-separated list of JVM arguments used when running the project
+# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
+# or test-sys-prop.name=value to set system properties for unit tests):
+run.jvmargs=-Xmx512m
+run.test.classpath=\
+ ${javac.test.classpath}:\
+ ${build.test.classes.dir}
+source.encoding=UTF-8
+src.dir=src
+test.src.dir=test
+app.version=0.1
diff --git a/Mage.Client/nbproject/project.xml b/Mage.Client/nbproject/project.xml
new file mode 100644
index 00000000000..7ec054b48bc
--- /dev/null
+++ b/Mage.Client/nbproject/project.xml
@@ -0,0 +1,41 @@
+
+
+ org.netbeans.modules.java.j2seproject
+
+
+ Mage.Client
+
+
+
+
+
+
+
+
+
+ Mage
+ jar
+
+ jar
+ clean
+ jar
+
+
+ Mage_Common
+ jar
+
+ jar
+ clean
+ jar
+
+
+ Mage_Sets
+ jar
+
+ jar
+ clean
+ jar
+
+
+
+
diff --git a/Mage.Client/release/config/config.properties b/Mage.Client/release/config/config.properties
new file mode 100644
index 00000000000..7c8e6bc7d45
--- /dev/null
+++ b/Mage.Client/release/config/config.properties
@@ -0,0 +1,6 @@
+server-name=localhost
+port=17171
+remote-server=mage-server
+cards-resource-path=resources/images/cards/
+symbols-resource-path=resources/images/symbols/
+resource-path=resources/images/
\ No newline at end of file
diff --git a/Mage.Client/release/sample-decks/ALA Block Constructed.dck b/Mage.Client/release/sample-decks/ALA Block Constructed.dck
new file mode 100644
index 00000000000..2b9a0df7b6d
Binary files /dev/null and b/Mage.Client/release/sample-decks/ALA Block Constructed.dck differ
diff --git a/Mage.Client/release/sample-decks/Jund.dck b/Mage.Client/release/sample-decks/Jund.dck
new file mode 100644
index 00000000000..68639251c3e
Binary files /dev/null and b/Mage.Client/release/sample-decks/Jund.dck differ
diff --git a/Mage.Client/release/sample-decks/NayaLightsaber.dck b/Mage.Client/release/sample-decks/NayaLightsaber.dck
new file mode 100644
index 00000000000..22475881a2e
Binary files /dev/null and b/Mage.Client/release/sample-decks/NayaLightsaber.dck differ
diff --git a/Mage.Client/release/sample-decks/WhiteTokens.dck b/Mage.Client/release/sample-decks/WhiteTokens.dck
new file mode 100644
index 00000000000..1a0bc8e5104
Binary files /dev/null and b/Mage.Client/release/sample-decks/WhiteTokens.dck differ
diff --git a/Mage.Client/release/startClient.bat b/Mage.Client/release/startClient.bat
new file mode 100644
index 00000000000..afadd24cca2
--- /dev/null
+++ b/Mage.Client/release/startClient.bat
@@ -0,0 +1 @@
+start javaw -jar .\MageClient.jar
\ No newline at end of file
diff --git a/Mage.Client/release/test.dck b/Mage.Client/release/test.dck
new file mode 100644
index 00000000000..1a0bc8e5104
Binary files /dev/null and b/Mage.Client/release/test.dck differ
diff --git a/Mage.Client/src/mage/client/MageFrame.form b/Mage.Client/src/mage/client/MageFrame.form
new file mode 100644
index 00000000000..372679d87c5
--- /dev/null
+++ b/Mage.Client/src/mage/client/MageFrame.form
@@ -0,0 +1,186 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/MageFrame.java b/Mage.Client/src/mage/client/MageFrame.java
new file mode 100644
index 00000000000..98acc6fde12
--- /dev/null
+++ b/Mage.Client/src/mage/client/MageFrame.java
@@ -0,0 +1,365 @@
+/*
+* 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.
+*/
+
+/*
+ * MageFrame.java
+ *
+ * Created on 15-Dec-2009, 9:11:37 PM
+ */
+
+package mage.client;
+
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.UUID;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.JDesktopPane;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import mage.cards.decks.Deck;
+import mage.client.dialog.AboutDialog;
+import mage.client.dialog.ConnectDialog;
+import mage.client.remote.Session;
+import mage.util.Logging;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class MageFrame extends javax.swing.JFrame {
+
+ private final static Logger logger = Logging.getLogger(MageFrame.class.getName());
+
+ private static Session session;
+ private ConnectDialog connectDialog;
+
+ /**
+ * @return the session
+ */
+ public static Session getSession() {
+ return session;
+ }
+
+ public static JDesktopPane getDesktop() {
+ return desktopPane;
+ }
+
+ /** Creates new form MageFrame */
+ public MageFrame() {
+
+ addWindowListener(new WindowAdapter()
+ {
+ @Override
+ public void windowClosing(WindowEvent e)
+ {
+ exitApp();
+ }
+ });
+
+ try {
+ UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
+ } catch (Exception ex) {
+ logger.log(Level.SEVERE, null, ex);
+ }
+
+
+ initComponents();
+
+ session = new Session(this);
+ connectDialog = new ConnectDialog(session);
+ desktopPane.add(connectDialog);
+ disableButtons();
+ }
+
+ public void showGame(UUID gameId, UUID playerId) {
+ logger.info("showing game");
+ this.tablesPane.hideTables();
+ this.tablesPane.setVisible(false);
+ this.gamePane.setVisible(true);
+ this.gamePane.showGame(gameId, playerId);
+ }
+
+ public void watchGame(UUID gameId) {
+ this.tablesPane.hideTables();
+ this.tablesPane.setVisible(false);
+ this.gamePane.setVisible(true);
+ this.gamePane.watchGame(gameId);
+ }
+
+ public void replayGame(UUID gameId) {
+ this.tablesPane.hideTables();
+ this.tablesPane.setVisible(false);
+ this.gamePane.setVisible(true);
+ this.gamePane.replayGame(gameId);
+ }
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ desktopPane = new javax.swing.JDesktopPane();
+ tablesPane = new mage.client.TablesPane();
+ gamePane = new mage.client.game.GamePane();
+ deckEditorPane = new mage.client.deckeditor.DeckEditorPane();
+ mageToolbar = new javax.swing.JToolBar();
+ btnConnect = new javax.swing.JButton();
+ jSeparator4 = new javax.swing.JToolBar.Separator();
+ btnGames = new javax.swing.JButton();
+ jSeparator3 = new javax.swing.JToolBar.Separator();
+ btnDeckEditor = new javax.swing.JButton();
+ jSeparator2 = new javax.swing.JToolBar.Separator();
+ btnAbout = new javax.swing.JButton();
+ jSeparator1 = new javax.swing.JToolBar.Separator();
+ btnExit = new javax.swing.JButton();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
+ setMinimumSize(new java.awt.Dimension(1024, 768));
+
+ desktopPane.setBackground(new java.awt.Color(204, 204, 204));
+ tablesPane.setBounds(20, 10, 560, 440);
+ desktopPane.add(tablesPane, javax.swing.JLayeredPane.DEFAULT_LAYER);
+ try {
+ tablesPane.setMaximum(true);
+ } catch (java.beans.PropertyVetoException e1) {
+ e1.printStackTrace();
+ }
+ gamePane.setBounds(20, 30, -1, -1);
+ desktopPane.add(gamePane, javax.swing.JLayeredPane.DEFAULT_LAYER);
+ try {
+ gamePane.setMaximum(true);
+ } catch (java.beans.PropertyVetoException e1) {
+ e1.printStackTrace();
+ }
+ deckEditorPane.setBounds(140, 50, -1, -1);
+ desktopPane.add(deckEditorPane, javax.swing.JLayeredPane.DEFAULT_LAYER);
+ try {
+ deckEditorPane.setMaximum(true);
+ } catch (java.beans.PropertyVetoException e1) {
+ e1.printStackTrace();
+ }
+
+ mageToolbar.setFloatable(false);
+ mageToolbar.setRollover(true);
+
+ btnConnect.setText("Connect");
+ btnConnect.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
+ btnConnect.setFocusable(false);
+ btnConnect.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
+ btnConnect.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
+ btnConnect.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnConnectActionPerformed(evt);
+ }
+ });
+ mageToolbar.add(btnConnect);
+ mageToolbar.add(jSeparator4);
+
+ btnGames.setText("Tables");
+ btnGames.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
+ btnGames.setFocusable(false);
+ btnGames.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
+ btnGames.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
+ btnGames.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnGamesActionPerformed(evt);
+ }
+ });
+ mageToolbar.add(btnGames);
+ mageToolbar.add(jSeparator3);
+
+ btnDeckEditor.setText("Deck Editor");
+ btnDeckEditor.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
+ btnDeckEditor.setFocusable(false);
+ btnDeckEditor.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
+ btnDeckEditor.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
+ btnDeckEditor.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnDeckEditorActionPerformed(evt);
+ }
+ });
+ mageToolbar.add(btnDeckEditor);
+ mageToolbar.add(jSeparator2);
+
+ btnAbout.setText("About");
+ btnAbout.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
+ btnAbout.setFocusable(false);
+ btnAbout.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
+ btnAbout.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
+ btnAbout.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnAboutActionPerformed(evt);
+ }
+ });
+ mageToolbar.add(btnAbout);
+ mageToolbar.add(jSeparator1);
+
+ btnExit.setText("Exit");
+ btnExit.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
+ btnExit.setFocusable(false);
+ btnExit.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
+ btnExit.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
+ btnExit.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnExitActionPerformed(evt);
+ }
+ });
+ mageToolbar.add(btnExit);
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ 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, 1106, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(mageToolbar, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(0, 0, 0)
+ .addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 840, Short.MAX_VALUE))
+ );
+
+ pack();
+ }// //GEN-END:initComponents
+
+ private void btnDeckEditorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeckEditorActionPerformed
+ this.gamePane.setVisible(false);
+ this.tablesPane.setVisible(false);
+ this.deckEditorPane.setVisible(true);
+ this.deckEditorPane.showTables();
+ }//GEN-LAST:event_btnDeckEditorActionPerformed
+
+ private void btnGamesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGamesActionPerformed
+ this.gamePane.setVisible(false);
+ this.deckEditorPane.setVisible(false);
+ this.tablesPane.setVisible(true);
+ this.tablesPane.showTables();
+ }//GEN-LAST:event_btnGamesActionPerformed
+
+ private void btnExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExitActionPerformed
+ exitApp();
+ }//GEN-LAST:event_btnExitActionPerformed
+
+ private void btnConnectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConnectActionPerformed
+ connectDialog.showDialog();
+ }//GEN-LAST:event_btnConnectActionPerformed
+
+ private void btnAboutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAboutActionPerformed
+ AboutDialog aboutDialog = new AboutDialog();
+ desktopPane.add(aboutDialog);
+ aboutDialog.showDialog();
+ }//GEN-LAST:event_btnAboutActionPerformed
+
+ private void exitApp() {
+ session.disconnect();
+ dispose();
+ System.exit(0);
+ }
+
+ public void enableButtons() {
+ btnConnect.setEnabled(false);
+ btnGames.setEnabled(true);
+ btnDeckEditor.setEnabled(true);
+ }
+
+ public void disableButtons() {
+ btnConnect.setEnabled(true);
+ btnGames.setEnabled(false);
+ btnDeckEditor.setEnabled(true);
+ this.tablesPane.setVisible(false);
+ this.gamePane.setVisible(false);
+ this.deckEditorPane.setVisible(false);
+ }
+
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String args[]) {
+ Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
+ public void uncaughtException(Thread t, Throwable e) {
+ logger.log(Level.SEVERE, null, e);
+ }
+ });
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ new MageFrame().setVisible(true);
+ }
+ });
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnAbout;
+ private javax.swing.JButton btnConnect;
+ private javax.swing.JButton btnDeckEditor;
+ private javax.swing.JButton btnExit;
+ private javax.swing.JButton btnGames;
+ private mage.client.deckeditor.DeckEditorPane deckEditorPane;
+ private static javax.swing.JDesktopPane desktopPane;
+ private mage.client.game.GamePane gamePane;
+ private javax.swing.JToolBar.Separator jSeparator1;
+ private javax.swing.JToolBar.Separator jSeparator2;
+ private javax.swing.JToolBar.Separator jSeparator3;
+ private javax.swing.JToolBar.Separator jSeparator4;
+ private javax.swing.JToolBar mageToolbar;
+ private mage.client.TablesPane tablesPane;
+ // End of variables declaration//GEN-END:variables
+
+ private void createDeck() {
+ Deck deck = new Deck();
+ 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);
+ }
+ }
+}
diff --git a/Mage.Client/src/mage/client/MagePane.form b/Mage.Client/src/mage/client/MagePane.form
new file mode 100644
index 00000000000..725f5d510d5
--- /dev/null
+++ b/Mage.Client/src/mage/client/MagePane.form
@@ -0,0 +1,36 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/MagePane.java b/Mage.Client/src/mage/client/MagePane.java
new file mode 100644
index 00000000000..5e18f881138
--- /dev/null
+++ b/Mage.Client/src/mage/client/MagePane.java
@@ -0,0 +1,92 @@
+/*
+* 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.
+*/
+
+/*
+ * MagePane.java
+ *
+ * Created on 15-Dec-2009, 9:34:25 PM
+ */
+
+package mage.client;
+
+import javax.swing.plaf.basic.BasicInternalFrameUI;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class MagePane extends javax.swing.JInternalFrame {
+
+ /** Creates new form MagePane */
+ public MagePane() {
+ initComponents();
+ hideTitle();
+ }
+
+ private void hideTitle() {
+ if (ui instanceof BasicInternalFrameUI)
+ ((BasicInternalFrameUI) ui).setNorthPane(null);
+ }
+
+ @Override
+ public void updateUI() {
+ super.updateUI();
+ hideTitle();
+ }
+
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ setBorder(null);
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 765, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 476, Short.MAX_VALUE)
+ );
+
+ pack();
+ }// //GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/Mage.Client/src/mage/client/NewPlayerPanel.form b/Mage.Client/src/mage/client/NewPlayerPanel.form
new file mode 100644
index 00000000000..836e8fbe281
--- /dev/null
+++ b/Mage.Client/src/mage/client/NewPlayerPanel.form
@@ -0,0 +1,79 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/NewPlayerPanel.java b/Mage.Client/src/mage/client/NewPlayerPanel.java
new file mode 100644
index 00000000000..e737e69f029
--- /dev/null
+++ b/Mage.Client/src/mage/client/NewPlayerPanel.java
@@ -0,0 +1,178 @@
+/*
+* 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.
+*/
+
+/*
+ * NewPlayerPanel.java
+ *
+ * Created on 15-Dec-2009, 10:09:46 PM
+ */
+
+package mage.client;
+
+import java.io.File;
+import javax.swing.JFileChooser;
+import javax.swing.filechooser.FileFilter;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class NewPlayerPanel extends javax.swing.JPanel {
+
+ private JFileChooser fcSelectDeck;
+
+ /** Creates new form NewPlayerPanel */
+ public NewPlayerPanel() {
+ initComponents();
+ fcSelectDeck = new JFileChooser();
+ fcSelectDeck.setAcceptAllFileFilterUsed(false);
+ fcSelectDeck.addChoosableFileFilter(new DeckFilter());
+ }
+
+ public void playerLoadDeck() {
+ int ret = fcSelectDeck.showDialog(this, "Select Deck");
+ if (ret == JFileChooser.APPROVE_OPTION) {
+ File file = fcSelectDeck.getSelectedFile();
+ this.txtPlayerDeck.setText(file.getPath());
+ }
+ fcSelectDeck.setSelectedFile(null);
+ }
+
+ public String getPlayerName() {
+ return this.txtPlayerName.getText();
+ }
+
+ public String getDeckFile() {
+ return this.txtPlayerDeck.getText();
+ }
+
+ public void setPlayerName(String playerName) {
+ this.txtPlayerName.setText(playerName);
+ }
+
+ public void setDeckFile(String deckFile) {
+ this.txtPlayerDeck.setText(deckFile);
+ }
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ lblPlayer2Name = new javax.swing.JLabel();
+ txtPlayerName = new javax.swing.JTextField();
+ lblPlayerDeck = new javax.swing.JLabel();
+ txtPlayerDeck = new javax.swing.JTextField();
+ btnPlayerDeck = new javax.swing.JButton();
+
+ lblPlayer2Name.setText("Player Name:");
+
+ lblPlayerDeck.setText("Player Deck:");
+
+ btnPlayerDeck.setText("...");
+ btnPlayerDeck.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnPlayerDeckActionPerformed(evt);
+ }
+ });
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(lblPlayerDeck)
+ .addComponent(lblPlayer2Name))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(txtPlayerName, javax.swing.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE)
+ .addComponent(txtPlayerDeck, javax.swing.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnPlayerDeck, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(lblPlayer2Name)
+ .addComponent(txtPlayerName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblPlayerDeck)
+ .addComponent(txtPlayerDeck, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(btnPlayerDeck, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+ }// //GEN-END:initComponents
+
+ private void btnPlayerDeckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPlayerDeckActionPerformed
+ playerLoadDeck();
+ }//GEN-LAST:event_btnPlayerDeckActionPerformed
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnPlayerDeck;
+ private javax.swing.JLabel lblPlayer2Name;
+ private javax.swing.JLabel lblPlayerDeck;
+ private javax.swing.JTextField txtPlayerDeck;
+ private javax.swing.JTextField txtPlayerName;
+ // End of variables declaration//GEN-END:variables
+
+}
+
+class DeckFilter extends FileFilter {
+
+ @Override
+ public boolean accept(File f) {
+ if (f.isDirectory())
+ return true;
+
+ String ext = null;
+ String s = f.getName();
+ int i = s.lastIndexOf('.');
+
+ if (i > 0 && i < s.length() - 1) {
+ ext = s.substring(i+1).toLowerCase();
+ }
+ return (ext==null)?false:ext.equals("dck");
+ }
+
+ @Override
+ public String getDescription() {
+ return "Deck Files";
+ }
+
+}
\ No newline at end of file
diff --git a/Mage.Client/src/mage/client/TablesPane.form b/Mage.Client/src/mage/client/TablesPane.form
new file mode 100644
index 00000000000..0eafeec3e87
--- /dev/null
+++ b/Mage.Client/src/mage/client/TablesPane.form
@@ -0,0 +1,35 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/TablesPane.java b/Mage.Client/src/mage/client/TablesPane.java
new file mode 100644
index 00000000000..c5f466e0f13
--- /dev/null
+++ b/Mage.Client/src/mage/client/TablesPane.java
@@ -0,0 +1,93 @@
+/*
+* 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.
+*/
+
+/*
+ * TablesPane.java
+ *
+ * Created on Dec 17, 2009, 9:21:42 AM
+ */
+
+package mage.client;
+
+import java.util.UUID;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class TablesPane extends MagePane {
+
+ /** Creates new form TablesPane */
+ public TablesPane() {
+ initComponents();
+ }
+
+ public void showTables() {
+ UUID roomId = MageFrame.getSession().getMainRoomId();
+ if (roomId != null) {
+ tablesPanel.showTables(roomId);
+ this.repaint();
+ }
+ }
+
+ public void hideTables() {
+ tablesPanel.hideTables();
+ }
+
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ tablesPanel = new mage.client.TablesPanel();
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(tablesPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 541, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(tablesPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 471, Short.MAX_VALUE)
+ );
+
+ pack();
+ }// //GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private mage.client.TablesPanel tablesPanel;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/Mage.Client/src/mage/client/TablesPanel.form b/Mage.Client/src/mage/client/TablesPanel.form
new file mode 100644
index 00000000000..a8da09d5bda
--- /dev/null
+++ b/Mage.Client/src/mage/client/TablesPanel.form
@@ -0,0 +1,127 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/TablesPanel.java b/Mage.Client/src/mage/client/TablesPanel.java
new file mode 100644
index 00000000000..a228337b646
--- /dev/null
+++ b/Mage.Client/src/mage/client/TablesPanel.java
@@ -0,0 +1,384 @@
+/*
+* 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.
+*/
+
+/*
+ * TablesPanel.java
+ *
+ * Created on 15-Dec-2009, 10:54:01 PM
+ */
+
+package mage.client;
+
+import mage.client.dialog.NewTableDialog;
+import mage.client.dialog.JoinTableDialog;
+import mage.client.dialog.TableWaitingDialog;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Observable;
+import java.util.Observer;
+import java.util.UUID;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JOptionPane;
+import javax.swing.Timer;
+import javax.swing.table.AbstractTableModel;
+import mage.Constants;
+import mage.cards.decks.DeckCardLists;
+import mage.client.remote.MageRemoteException;
+import mage.client.remote.Session;
+import mage.client.util.ButtonColumn;
+import mage.util.Logging;
+import mage.view.TableView;
+
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class TablesPanel extends javax.swing.JPanel implements Observer {
+
+ private final static Logger logger = Logging.getLogger(TablesPanel.class.getName());
+
+ private TableTableModel tableModel;
+ private UUID roomId;
+ private TablesWatchdog tablesWatchdog = new TablesWatchdog();
+ private JoinTableDialog joinTableDialog;
+ private NewTableDialog newTableDialog;
+ private TableWaitingDialog tableWaitingDialog;
+ private Session session;
+
+ /** Creates new form TablesPanel */
+ public TablesPanel() {
+
+ tableModel = new TableTableModel();
+
+ initComponents();
+
+ tableTables.createDefaultColumnsFromModel();
+
+ Action join = new AbstractAction()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ int modelRow = Integer.valueOf( e.getActionCommand() );
+ UUID tableId = UUID.fromString((String)tableModel.getValueAt(modelRow, 0));
+ String state = (String)tableModel.getValueAt(modelRow, 4);
+
+ if (state.equals("Join")) {
+ logger.info("Joining table " + tableId);
+
+ joinTableDialog.showDialog(roomId, tableId);
+ if (joinTableDialog.isJoined())
+ tableWaitingDialog.showDialog(roomId, tableId);
+ } else if (state.equals("Watch")) {
+ logger.info("Watching table " + tableId);
+ if (!session.watchTable(roomId, tableId))
+ hideTables();
+ } else if (state.equals("Replay")) {
+ logger.info("Replaying table " + tableId);
+ if (!session.replayTable(roomId, tableId))
+ hideTables();
+ }
+ }
+ };
+
+ ButtonColumn buttonColumn = new ButtonColumn(tableTables, join, 4);
+
+ }
+
+ public void update(Observable arg0, Object arg1) {
+ try {
+ tableModel.loadData(roomId);
+ this.tableTables.repaint();
+ } catch (MageRemoteException ex) {
+ hideTables();
+ }
+ }
+
+ public void showTables(UUID roomId) {
+
+ this.roomId = roomId;
+ session = MageFrame.getSession();
+ if (newTableDialog == null) {
+ newTableDialog = new NewTableDialog();
+ MageFrame.getDesktop().add(newTableDialog);
+ }
+ if (joinTableDialog == null) {
+ joinTableDialog = new JoinTableDialog();
+ MageFrame.getDesktop().add(joinTableDialog);
+ }
+ if (tableWaitingDialog == null) {
+ tableWaitingDialog = new TableWaitingDialog();
+ MageFrame.getDesktop().add(tableWaitingDialog);
+ }
+ UUID chatRoomId = session.getRoomChatId(roomId);
+ if (chatRoomId != null) {
+ this.chatPanel.connect(session.getRoomChatId(roomId));
+ tablesWatchdog.addObserver(this);
+ this.setVisible(true);
+ this.repaint();
+ }
+ else {
+ hideTables();
+ }
+ }
+
+ public void hideTables() {
+ if (tableWaitingDialog.isVisible()) {
+ tableWaitingDialog.closeDialog();
+ }
+ tablesWatchdog.deleteObservers();
+ this.chatPanel.disconnect();
+ this.setVisible(false);
+ }
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jPanel1 = new javax.swing.JPanel();
+ btnNewTable = new javax.swing.JButton();
+ btnQuickStart = new javax.swing.JButton();
+ jSplitPane1 = new javax.swing.JSplitPane();
+ chatPanel = new mage.client.chat.ChatPanel();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ tableTables = new javax.swing.JTable();
+
+ btnNewTable.setText("New Table");
+ btnNewTable.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnNewTableActionPerformed(evt);
+ }
+ });
+
+ btnQuickStart.setText("Quick Start");
+ btnQuickStart.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnQuickStartActionPerformed(evt);
+ }
+ });
+
+ javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
+ jPanel1.setLayout(jPanel1Layout);
+ jPanel1Layout.setHorizontalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(btnNewTable)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnQuickStart)
+ .addContainerGap(537, Short.MAX_VALUE))
+ );
+ jPanel1Layout.setVerticalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btnNewTable)
+ .addComponent(btnQuickStart))
+ .addContainerGap(16, Short.MAX_VALUE))
+ );
+
+ jSplitPane1.setDividerSize(3);
+ jSplitPane1.setResizeWeight(1.0);
+
+ chatPanel.setMinimumSize(new java.awt.Dimension(100, 43));
+ jSplitPane1.setRightComponent(chatPanel);
+
+ tableTables.setModel(this.tableModel);
+ jScrollPane1.setViewportView(tableTables);
+
+ jSplitPane1.setLeftComponent(jScrollPane1);
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 721, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(0, 0, 0)
+ .addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 518, Short.MAX_VALUE))
+ );
+ }// //GEN-END:initComponents
+
+ private void btnNewTableActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNewTableActionPerformed
+ newTableDialog.showDialog(roomId);
+ if (newTableDialog.getTable() != null) {
+ tableWaitingDialog.showDialog(roomId, newTableDialog.getTable().getTableId());
+ }
+}//GEN-LAST:event_btnNewTableActionPerformed
+
+ private void btnQuickStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQuickStartActionPerformed
+ TableView table;
+ try {
+ List playerTypes = new ArrayList();
+ playerTypes.add("Human");
+ playerTypes.add("Computer - default");
+ table = session.createTable(
+ roomId,
+ "Two Player Duel",
+ Constants.DeckType.CONSTRUCTED_EXTENDED,
+ playerTypes
+ );
+ session.joinTable(
+ roomId,
+ table.getTableId(),
+ 0,
+ "Human",
+ DeckCardLists.load("test.dck")
+ );
+ session.joinTable(
+ roomId,
+ table.getTableId(),
+ 1,
+ "Computer",
+ DeckCardLists.load("test.dck")
+ );
+ hideTables();
+ session.startGame(roomId, table.getTableId());
+ } catch (Exception ex) {
+ handleError(ex);
+ }
+ }//GEN-LAST:event_btnQuickStartActionPerformed
+
+ private void handleError(Exception ex) {
+ logger.log(Level.SEVERE, "Error loading deck", ex);
+ JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Error loading deck.", "Error", JOptionPane.ERROR_MESSAGE);
+ }
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnNewTable;
+ private javax.swing.JButton btnQuickStart;
+ private mage.client.chat.ChatPanel chatPanel;
+ private javax.swing.JPanel jPanel1;
+ private javax.swing.JScrollPane jScrollPane1;
+ private javax.swing.JSplitPane jSplitPane1;
+ private javax.swing.JTable tableTables;
+ // End of variables declaration//GEN-END:variables
+
+}
+
+class TableTableModel extends AbstractTableModel {
+ private String[] columnNames = new String[]{"Game Id", "Game Type", "Deck Type", "Status", "Action"};
+ private TableView[] tables = new TableView[0];
+
+
+ public void loadData(UUID roomId) throws MageRemoteException {
+ tables = MageFrame.getSession().getTables(roomId).toArray(new TableView[0]);
+ this.fireTableDataChanged();
+ }
+
+ @Override
+ public int getRowCount() {
+ return tables.length;
+ }
+
+ @Override
+ public int getColumnCount() {
+ return columnNames.length;
+ }
+
+ @Override
+ public Object getValueAt(int arg0, int arg1) {
+ switch (arg1) {
+ case 0:
+ return tables[arg0].getTableId().toString();
+ case 1:
+ return tables[arg0].getGameType().toString();
+ case 2:
+ return tables[arg0].getDeckType().toString();
+ case 3:
+ return tables[arg0].getTableState().toString();
+ case 4:
+ switch (tables[arg0].getTableState()) {
+ case WAITING:
+ return "Join";
+ case DUELING:
+ return "Watch";
+ case FINISHED:
+ return "Replay";
+ default:
+ return "";
+ }
+ }
+ return "";
+ }
+
+ @Override
+ public String getColumnName(int columnIndex) {
+ String colName = "";
+
+ if (columnIndex <= getColumnCount())
+ colName = columnNames[columnIndex];
+
+ return colName;
+ }
+
+ @Override
+ public Class getColumnClass(int columnIndex){
+ return String.class;
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ if (columnIndex != 4)
+ return false;
+ return true;
+ }
+
+}
+
+class TablesWatchdog extends Observable implements ActionListener {
+
+ Timer t = new Timer(1000, this); // check every second
+
+ public TablesWatchdog() {
+ t.start();
+ }
+
+ public void actionPerformed(ActionEvent arg0) {
+ setChanged();
+ notifyObservers();
+ }
+
+}
\ No newline at end of file
diff --git a/Mage.Client/src/mage/client/cards/BigCard.form b/Mage.Client/src/mage/client/cards/BigCard.form
new file mode 100644
index 00000000000..b80ecd45115
--- /dev/null
+++ b/Mage.Client/src/mage/client/cards/BigCard.form
@@ -0,0 +1,61 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/cards/BigCard.java b/Mage.Client/src/mage/client/cards/BigCard.java
new file mode 100644
index 00000000000..5e02fdef07e
--- /dev/null
+++ b/Mage.Client/src/mage/client/cards/BigCard.java
@@ -0,0 +1,129 @@
+/*
+* 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.
+*/
+
+/*
+ * BigCard.java
+ *
+ * Created on Jan 18, 2010, 3:21:33 PM
+ */
+
+package mage.client.cards;
+
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.Rectangle;
+import java.util.List;
+import java.util.UUID;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.StyledDocument;
+import static mage.client.util.Constants.*;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class BigCard extends javax.swing.JPanel {
+
+ protected Image bigImage;
+ protected UUID cardId;
+
+ public BigCard() {
+ initComponents();
+ }
+
+ public void setCard(UUID cardId, Image image, List strings) {
+ if (this.cardId == null || !this.cardId.equals(cardId)) {
+ this.cardId = cardId;
+ bigImage = image;
+ this.repaint();
+ drawText(strings);
+ }
+ }
+
+ private void drawText(java.util.List strings) {
+ text.setText("");
+ StyledDocument doc = text.getStyledDocument();
+
+ try {
+ for (String line: strings) {
+ doc.insertString(doc.getLength(), line + "\n", doc.getStyle("regular"));
+ }
+ } catch (BadLocationException ble) {
+ System.err.println("Couldn't insert initial text into text pane.");
+ }
+ text.setCaretPosition(0);
+ }
+
+ @Override
+ public void paintComponent(Graphics graphics) {
+ if (bigImage != null)
+ graphics.drawImage(bigImage, 0, 0, this);
+ super.paintComponent(graphics);
+ }
+
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ scrollPane = new javax.swing.JScrollPane();
+ text = new javax.swing.JTextPane();
+
+ setFocusable(false);
+ setMinimumSize(new Dimension(FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT));
+ setOpaque(false);
+ setPreferredSize(getMinimumSize());
+ setLayout(null);
+
+ scrollPane.setBorder(null);
+ scrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
+ scrollPane.setOpaque(false);
+
+ text.setEditable(false);
+ text.setFocusable(false);
+ text.setOpaque(false);
+ scrollPane.setViewportView(text);
+
+ add(scrollPane);
+ scrollPane.setBounds(20, 230, 210, 120);
+ scrollPane.setBounds(new Rectangle(CONTENT_MAX_XOFFSET, TEXT_MAX_YOFFSET, TEXT_MAX_WIDTH, TEXT_MAX_HEIGHT));
+ }// //GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JScrollPane scrollPane;
+ private javax.swing.JTextPane text;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/Mage.Client/src/mage/client/cards/Card.form b/Mage.Client/src/mage/client/cards/Card.form
new file mode 100644
index 00000000000..9b3fb336bf3
--- /dev/null
+++ b/Mage.Client/src/mage/client/cards/Card.form
@@ -0,0 +1,67 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/cards/Card.java b/Mage.Client/src/mage/client/cards/Card.java
new file mode 100644
index 00000000000..92b11074e0d
--- /dev/null
+++ b/Mage.Client/src/mage/client/cards/Card.java
@@ -0,0 +1,365 @@
+/*
+* 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.
+*/
+
+/*
+ * Card.java
+ *
+ * Created on 17-Dec-2009, 9:20:50 PM
+ */
+
+package mage.client.cards;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.RenderingHints;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import java.awt.image.BufferedImage;
+import java.util.UUID;
+import javax.swing.BorderFactory;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.Popup;
+import javax.swing.PopupFactory;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.Style;
+import javax.swing.text.StyleConstants;
+import javax.swing.text.StyleContext;
+import javax.swing.text.StyledDocument;
+import mage.Constants.CardType;
+import mage.client.MageFrame;
+import mage.client.remote.Session;
+import mage.client.util.ImageHelper;
+import mage.view.CardView;
+import static mage.client.util.Constants.*;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class Card extends javax.swing.JPanel implements MouseMotionListener, MouseListener, FocusListener {
+
+ protected static Session session = MageFrame.getSession();
+
+ protected Point p;
+
+ protected UUID gameId;
+ protected BigCard bigCard;
+ protected CardView card;
+ protected Popup popup;
+
+ protected TextPopup popupText = new TextPopup();
+ protected BufferedImage background;
+ protected BufferedImage image = new BufferedImage(FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT, BufferedImage.TYPE_INT_RGB);
+ protected BufferedImage small = new BufferedImage(FRAME_WIDTH, FRAME_HEIGHT, BufferedImage.TYPE_INT_RGB);
+
+ /** Creates new form Card */
+ public Card(CardView card, BigCard bigCard, UUID gameId) {
+ initComponents();
+
+ this.gameId = gameId;
+ this.card = card;
+ this.bigCard = bigCard;
+ background = ImageHelper.getBackground(card);
+
+ StyledDocument doc = text.getStyledDocument();
+ Style def = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);
+ Style regular = doc.addStyle("regular", def);
+ StyleConstants.setFontFamily(def, "arial");
+ Style s = doc.addStyle("small", regular);
+ StyleConstants.setFontSize(s, 9);
+
+ addMouseListener(this);
+ text.addMouseListener(this);
+ addFocusListener(this);
+ addMouseMotionListener(this);
+ text.addMouseMotionListener(this);
+ }
+
+ public UUID getCardId() {
+ return card.getId();
+ }
+
+ public void update(CardView card) {
+ this.card = card;
+ Graphics2D gImage = image.createGraphics();
+ Graphics2D gSmall = small.createGraphics();
+ String cardType = getType(card);
+
+ popupText.setText(getText(cardType));
+
+ gImage.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ gImage.setColor(Color.BLACK);
+ gImage.drawImage(background, 0, 0, this);
+
+ if (card.getManaCost().size() > 0)
+ ImageHelper.DrawCosts(card.getManaCost(), gImage, FRAME_MAX_WIDTH - SYMBOL_MAX_XOFFSET, SYMBOL_MAX_YOFFSET, this);
+
+ gSmall.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ gSmall.setColor(Color.BLACK);
+ gSmall.drawImage(ImageHelper.ScaleImage(image, FRAME_WIDTH, FRAME_HEIGHT), 0, 0, this);
+
+ gImage.setFont(new Font("Arial", Font.PLAIN, NAME_FONT_MAX_SIZE));
+ gImage.drawString(card.getName(), CONTENT_MAX_XOFFSET, NAME_MAX_YOFFSET);
+ if (card.getCardTypes().contains(CardType.CREATURE)) {
+ gImage.drawString(card.getPower() + "/" + card.getToughness(), POWBOX_MAX_LEFT + 10, POWBOX_MAX_TOP + 15);
+ }
+ else if (card.getCardTypes().contains(CardType.PLANESWALKER)) {
+ gImage.drawString(card.getLoyalty(), POWBOX_MAX_LEFT + 10, POWBOX_MAX_TOP + 15);
+ }
+
+ if (card.getCardTypes().size() > 0)
+ gImage.drawString(cardType, CONTENT_MAX_XOFFSET, TYPE_MAX_YOFFSET);
+
+ gImage.dispose();
+
+ gSmall.setFont(new Font("Arial", Font.PLAIN, NAME_FONT_SIZE));
+ gSmall.drawString(card.getName(), CONTENT_XOFFSET, NAME_YOFFSET+1);
+ if (card.getCardTypes().contains(CardType.CREATURE)) {
+ gSmall.drawString(card.getPower() + "/" + card.getToughness(), POWBOX_LEFT + 5, POWBOX_TOP + 8);
+ }
+ else if (card.getCardTypes().contains(CardType.PLANESWALKER)) {
+ gSmall.drawString(card.getLoyalty(), POWBOX_LEFT + 5, POWBOX_TOP + 8);
+ }
+
+ if (card.getCardTypes().size() > 0)
+ gSmall.drawString(cardType, CONTENT_XOFFSET, TYPE_YOFFSET);
+ drawText();
+
+ gSmall.dispose();
+ }
+
+ private String getText(String cardType) {
+ StringBuilder sb = new StringBuilder();
+ sb.append(card.getName());
+ sb.append("\n");
+ if (card.getManaCost().size() > 0) {
+ sb.append(card.getManaCost());
+ sb.append("\n");
+ }
+ sb.append(cardType);
+ sb.append("\n");
+ sb.append(card.getColor().toString());
+ sb.append("\n");
+ for (String rule: card.getRules()) {
+ sb.append(rule);
+ sb.append("\n");
+ }
+ if (card.getCardTypes().contains(CardType.CREATURE)) {
+ sb.append(card.getPower());
+ sb.append("/");
+ sb.append(card.getToughness());
+ }
+ else if (card.getCardTypes().contains(CardType.PLANESWALKER)) {
+ sb.append(card.getLoyalty());
+ }
+ return sb.toString();
+ }
+
+ private void drawText() {
+ text.setText("");
+ StyledDocument doc = text.getStyledDocument();
+
+ try {
+ for (String rule: card.getRules())
+ doc.insertString(doc.getLength(), rule + "\n", doc.getStyle("small"));
+ } catch (BadLocationException e) {
+ System.err.println("Couldn't insert initial text into text pane.");
+ }
+
+ text.setCaretPosition(0);
+ }
+
+ protected String getType(CardView card) {
+ StringBuilder sbType = new StringBuilder();
+
+ for (String superType: card.getSuperTypes()) {
+ sbType.append(superType);
+ sbType.append(" ");
+ }
+
+ for (mage.Constants.CardType cardType: card.getCardTypes()) {
+ sbType.append(cardType.toString());
+ sbType.append(" ");
+ }
+
+ if (card.getSubTypes().size() > 0) {
+ sbType.append("- ");
+ for (String subType: card.getSubTypes()) {
+ sbType.append(subType);
+ sbType.append(" ");
+ }
+ }
+
+ return sbType.toString();
+ }
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jScrollPane1 = new javax.swing.JScrollPane();
+ text = new javax.swing.JTextPane();
+
+ setMinimumSize(getPreferredSize());
+ setOpaque(false);
+ setPreferredSize(new Dimension(FRAME_WIDTH, FRAME_HEIGHT));
+ setLayout(null);
+
+ jScrollPane1.setBorder(null);
+ jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
+ jScrollPane1.setFocusable(false);
+ jScrollPane1.setOpaque(false);
+
+ text.setBorder(null);
+ text.setEditable(false);
+ text.setFont(new java.awt.Font("Arial", 0, 9));
+ text.setFocusable(false);
+ text.setOpaque(false);
+ jScrollPane1.setViewportView(text);
+
+ add(jScrollPane1);
+ jScrollPane1.setBounds(20, 110, 130, 100);
+ jScrollPane1.setBounds(new Rectangle(CONTENT_XOFFSET, TEXT_YOFFSET, TEXT_WIDTH, TEXT_HEIGHT));
+ }// //GEN-END:initComponents
+
+ @Override
+ public void paintComponent(Graphics graphics) {
+ Graphics2D g2 = (Graphics2D) graphics;
+ g2.drawImage(small, 0, 0, this);
+
+ //Add a border, red if card currently has focus
+ if (isFocusOwner()) {
+ g2.setColor(Color.RED);
+ } else {
+ g2.setColor(Color.BLACK);
+ }
+ g2.drawRect(0, 0, FRAME_WIDTH - 1, FRAME_HEIGHT - 1);
+ }
+
+ @Override
+ public void mouseDragged(MouseEvent arg0) {
+ }
+
+ @Override
+ public void mouseMoved(MouseEvent arg0) {
+ this.bigCard.setCard(card.getId(), image, card.getRules());
+ }
+
+ @Override
+ public void mouseClicked(MouseEvent arg0) {
+ requestFocusInWindow();
+ if (gameId != null)
+ session.sendPlayerUUID(gameId, card.getId());
+ }
+
+ @Override
+ public void mousePressed(MouseEvent arg0) {
+ }
+
+ @Override
+ public void mouseReleased(MouseEvent arg0) {
+ }
+
+ @Override
+ public void mouseEntered(MouseEvent arg0) {
+ if (popup != null)
+ popup.hide();
+ PopupFactory factory = PopupFactory.getSharedInstance();
+ popup = factory.getPopup(this, popupText, (int) this.getLocationOnScreen().getX() + FRAME_WIDTH, (int) this.getLocationOnScreen().getY() + 40);
+ popup.show();
+ //hack to get popup to resize to fit text
+ popup.hide();
+ popup = factory.getPopup(this, popupText, (int) this.getLocationOnScreen().getX() + FRAME_WIDTH, (int) this.getLocationOnScreen().getY() + 40);
+ popup.show();
+ }
+
+ @Override
+ public void mouseExited(MouseEvent arg0) {
+ if (popup != null)
+ popup.hide();
+ }
+
+ @Override
+ public void focusGained(FocusEvent arg0) {
+ this.repaint();
+ }
+
+ @Override
+ public void focusLost(FocusEvent arg0) {
+ if (popup != null)
+ popup.hide();
+ this.repaint();
+ }
+
+ protected JScrollPane getText() {
+ return jScrollPane1;
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JScrollPane jScrollPane1;
+ private javax.swing.JTextPane text;
+ // End of variables declaration//GEN-END:variables
+
+}
+
+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);
+ }
+}
\ No newline at end of file
diff --git a/Mage.Client/src/mage/client/cards/CardEventSource.java b/Mage.Client/src/mage/client/cards/CardEventSource.java
new file mode 100644
index 00000000000..fed1bc0035c
--- /dev/null
+++ b/Mage.Client/src/mage/client/cards/CardEventSource.java
@@ -0,0 +1,59 @@
+/*
+* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are
+* permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of
+* conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice, this list
+* of conditions and the following disclaimer in the documentation and/or other materials
+* provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+* The views and conclusions contained in the software and documentation are those of the
+* authors and should not be interpreted as representing official policies, either expressed
+* or implied, of BetaSteward_at_googlemail.com.
+*/
+
+package mage.client.cards;
+
+import java.io.Serializable;
+import java.util.UUID;
+import mage.client.util.Event;
+import mage.client.util.EventDispatcher;
+import mage.client.util.EventSource;
+import mage.client.util.Listener;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class CardEventSource implements EventSource, Serializable {
+
+ protected final EventDispatcher dispatcher = new EventDispatcher() {};
+
+ @Override
+ public void addListener(Listener listener) {
+ dispatcher.addListener(listener);
+ }
+
+ public void doubleClick(UUID cardId, String message) {
+ dispatcher.fireEvent(new Event(cardId, message));
+ }
+
+ public void clearListeners() {
+ dispatcher.clearListeners();
+ }
+
+}
diff --git a/Mage.Client/src/mage/client/cards/Cards.form b/Mage.Client/src/mage/client/cards/Cards.form
new file mode 100644
index 00000000000..9471ecf6a80
--- /dev/null
+++ b/Mage.Client/src/mage/client/cards/Cards.form
@@ -0,0 +1,49 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/cards/Cards.java b/Mage.Client/src/mage/client/cards/Cards.java
new file mode 100644
index 00000000000..66727ed99ae
--- /dev/null
+++ b/Mage.Client/src/mage/client/cards/Cards.java
@@ -0,0 +1,98 @@
+/*
+* 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.
+*/
+
+/*
+ * Cards.java
+ *
+ * Created on Dec 18, 2009, 10:40:12 AM
+ */
+
+package mage.client.cards;
+
+import java.awt.Dimension;
+import java.util.UUID;
+import mage.view.CardView;
+import mage.view.CardsView;
+import static mage.client.util.Constants.*;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class Cards extends javax.swing.JPanel {
+
+ /** Creates new form Cards */
+ public Cards() {
+ initComponents();
+ cardArea.setPreferredSize(new Dimension(FRAME_WIDTH, FRAME_HEIGHT));
+ }
+
+ public void loadCards(CardsView cards, BigCard bigCard, UUID gameId) {
+ cardArea.removeAll();
+ for (CardView card: cards) {
+ Card cardImg = new Card(card, bigCard, gameId);
+ cardArea.add(cardImg);
+ cardImg.update(card);
+ }
+ cardArea.setPreferredSize(new Dimension(cards.size() * FRAME_WIDTH, FRAME_HEIGHT));
+ cardArea.revalidate();
+ cardArea.repaint();
+ this.revalidate();
+ this.repaint();
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jScrollPane1 = new javax.swing.JScrollPane();
+ cardArea = new javax.swing.JPanel();
+
+ setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
+ setLayout(new java.awt.BorderLayout());
+
+ jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
+
+ cardArea.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 0, 0));
+ jScrollPane1.setViewportView(cardArea);
+
+ add(jScrollPane1, java.awt.BorderLayout.CENTER);
+ }// //GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JPanel cardArea;
+ private javax.swing.JScrollPane jScrollPane1;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/Mage.Client/src/mage/client/cards/CardsList.form b/Mage.Client/src/mage/client/cards/CardsList.form
new file mode 100644
index 00000000000..4b0169ba1c2
--- /dev/null
+++ b/Mage.Client/src/mage/client/cards/CardsList.form
@@ -0,0 +1,42 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/cards/CardsList.java b/Mage.Client/src/mage/client/cards/CardsList.java
new file mode 100644
index 00000000000..8a2f98264a3
--- /dev/null
+++ b/Mage.Client/src/mage/client/cards/CardsList.java
@@ -0,0 +1,146 @@
+/*
+* 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.
+*/
+
+/*
+ * CardsList.java
+ *
+ * Created on Dec 18, 2009, 10:40:12 AM
+ */
+
+package mage.client.cards;
+
+import java.awt.Dimension;
+import java.awt.Rectangle;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.util.Collection;
+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 CardsList extends javax.swing.JPanel implements MouseListener {
+
+ protected CardEventSource cardEventSource = new CardEventSource();
+
+ /** Creates new form Cards */
+ public CardsList() {
+ initComponents();
+ cardArea.setPreferredSize(new Dimension(FRAME_WIDTH, FRAME_HEIGHT));
+ }
+
+ public void loadCards(CardsView showCards, BigCard bigCard, UUID gameId) {
+ cardArea.removeAll();
+ if (showCards != null && showCards.size() > 0) {
+ Rectangle rectangle = new Rectangle(FRAME_WIDTH, FRAME_HEIGHT);
+ int count = 0;
+ 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);
+ if (count >= 10) {
+ rectangle.translate(FRAME_WIDTH, -200);
+ count = 0;
+ } else {
+ rectangle.translate(0, 20);
+ count++;
+ }
+ }
+ }
+ cardArea.setPreferredSize(new Dimension(FRAME_WIDTH, FRAME_HEIGHT + 200));
+ cardArea.revalidate();
+ this.revalidate();
+ this.repaint();
+ this.setVisible(true);
+ }
+
+
+ public void addCardEventListener(Listener 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jScrollPane1 = new javax.swing.JScrollPane();
+ cardArea = new javax.swing.JLayeredPane();
+
+ setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
+ setLayout(new java.awt.BorderLayout());
+
+ jScrollPane1.setViewportView(cardArea);
+
+ add(jScrollPane1, java.awt.BorderLayout.CENTER);
+ }// //GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JLayeredPane cardArea;
+ private javax.swing.JScrollPane jScrollPane1;
+ // End of variables declaration//GEN-END:variables
+
+ public void mouseClicked(MouseEvent e) {
+ if (e.getClickCount() == 2 && !e.isConsumed()) {
+ e.consume();
+ cardEventSource.doubleClick(((Card)e.getSource()).getCardId(), "double-click");
+ }
+ }
+
+ public void mousePressed(MouseEvent e) {
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ }
+
+ public void mouseEntered(MouseEvent e) {
+ }
+
+ public void mouseExited(MouseEvent e) {
+ }
+
+}
diff --git a/Mage.Client/src/mage/client/cards/Permanent.form b/Mage.Client/src/mage/client/cards/Permanent.form
new file mode 100644
index 00000000000..dac4a517ffa
--- /dev/null
+++ b/Mage.Client/src/mage/client/cards/Permanent.form
@@ -0,0 +1,20 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/cards/Permanent.java b/Mage.Client/src/mage/client/cards/Permanent.java
new file mode 100644
index 00000000000..791848b3c7d
--- /dev/null
+++ b/Mage.Client/src/mage/client/cards/Permanent.java
@@ -0,0 +1,198 @@
+/*
+* 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.
+*/
+
+/*
+ * Permanent.java
+ *
+ * Created on Dec 22, 2009, 3:25:49 PM
+ */
+
+package mage.client.cards;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Rectangle;
+import java.awt.RenderingHints;
+import java.awt.event.MouseEvent;
+import java.awt.image.BufferedImage;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+import mage.client.util.ImageHelper;
+import mage.view.PermanentView;
+import static mage.client.util.Constants.*;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class Permanent extends Card {
+
+ protected PermanentView permanent;
+
+ protected List links = new ArrayList();
+ protected boolean linked;
+ protected BufferedImage tappedImage = new BufferedImage(FRAME_HEIGHT, FRAME_WIDTH, BufferedImage.TYPE_INT_RGB);
+ protected BufferedImage flippedImage;
+
+ /** Creates new form Permanent */
+ public Permanent(PermanentView permanent, BigCard bigCard, UUID gameId) {
+ super(permanent, bigCard, gameId);
+ this.setSize(this.getPreferredSize());
+ this.permanent = permanent;
+ }
+
+ public UUID getPermanentId() {
+ return permanent.getId();
+ }
+
+ public List getLinks() {
+ return links;
+ }
+
+ public boolean isLinked() {
+ return linked;
+ }
+
+ public void setLinked(boolean linked) {
+ this.linked = linked;
+ }
+
+ @Override
+ public void mousePressed(MouseEvent e) {
+ p = e.getPoint();
+ e.consume();
+ }
+
+ @Override
+ public void mouseDragged(MouseEvent e) {
+ if (!linked) {
+ int dx = e.getX() - p.x;
+ int dy = e.getY() - p.y;
+ Rectangle r = this.getBounds();
+ r.x += dx;
+ r.y += dy;
+ if (r.x < 0) r.x = 0;
+ if (r.y < 0) r.y = 0;
+ this.setBounds(r);
+ this.repaint();
+ for (Permanent perm: links) {
+ r.x += 20;
+ r.y += 20;
+ perm.setBounds(r);
+ }
+ }
+ }
+
+ @Override
+ public void paintComponent(Graphics graphics) {
+ Graphics2D g2 = (Graphics2D) graphics;
+ this.setSize(this.getPreferredSize());
+ if (permanent.isTapped()) {
+ this.getText().setVisible(false);
+ g2.drawImage(tappedImage, 0, 0, this);
+ }
+ else {
+ this.getText().setVisible(true);
+ g2.drawImage(small, 0, 0, this);
+ }
+
+ //Add a border, red if card currently has focus
+ if (isFocusOwner()) {
+ g2.setColor(Color.RED);
+ } else {
+ g2.setColor(Color.BLACK);
+ }
+ if (permanent.isTapped()) {
+ g2.drawRect(0, 0, FRAME_HEIGHT - 1, FRAME_WIDTH - 1);
+ }
+ else {
+ g2.drawRect(0, 0, FRAME_WIDTH - 1, FRAME_HEIGHT - 1);
+ }
+
+ }
+
+ protected void generateTappedImage() {
+ Graphics2D g = (Graphics2D) tappedImage.getGraphics();
+ g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+
+ g.drawImage(this.createImage(ImageHelper.rotate(small)), 0, 0, this);
+
+ g.dispose();
+ }
+
+ public void update(PermanentView permanent) {
+ this.permanent = permanent;
+ super.update(permanent);
+ if (permanent.getDamage() > 0) {
+ Graphics2D g = image.createGraphics();
+ g.setColor(Color.RED);
+ g.drawString(Integer.toString(permanent.getDamage()), DAMAGE_MAX_LEFT, POWBOX_MAX_TOP + 15);
+ g.dispose();
+ }
+ generateTappedImage();
+ }
+
+ @Override
+ public Dimension getPreferredSize() {
+ if (permanent != null && permanent.isTapped()) {
+ return new Dimension(FRAME_HEIGHT, FRAME_WIDTH);
+ }
+ else {
+ return new Dimension(FRAME_WIDTH, FRAME_HEIGHT);
+ }
+ }
+
+ @Override
+ public Dimension getMinimumSize() {
+ return this.getPreferredSize();
+ }
+
+ public boolean overlaps(Rectangle r1) {
+ return this.getBounds().intersects(r1);
+ }
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ setLayout(null);
+ }// //GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/Mage.Client/src/mage/client/chat/ChatClientImpl.java b/Mage.Client/src/mage/client/chat/ChatClientImpl.java
new file mode 100644
index 00000000000..3c79aa3b928
--- /dev/null
+++ b/Mage.Client/src/mage/client/chat/ChatClientImpl.java
@@ -0,0 +1,85 @@
+/*
+* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are
+* permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of
+* conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice, this list
+* of conditions and the following disclaimer in the documentation and/or other materials
+* provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+* The views and conclusions contained in the software and documentation are those of the
+* authors and should not be interpreted as representing official policies, either expressed
+* or implied, of BetaSteward_at_googlemail.com.
+*/
+
+package mage.client.chat;
+
+import java.io.Serializable;
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+import java.util.UUID;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.JTextArea;
+import mage.interfaces.ChatClient;
+import mage.util.Logging;
+
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class ChatClientImpl implements ChatClient, Serializable {
+
+ private final static Logger logger = Logging.getLogger(ChatClientImpl.class.getName());
+
+ private JTextArea textArea;
+ private String userName;
+ private UUID clientId;
+
+ public ChatClientImpl(String userName, JTextArea textArea) {
+ this.clientId = UUID.randomUUID();
+ this.textArea = textArea;
+ try {
+ this.userName = userName;
+ UnicastRemoteObject.exportObject(this, 0);
+ } catch (RemoteException ex) {
+ logger.log(Level.SEVERE, null, ex);
+ }
+ }
+
+ @Override
+ public void receiveMessage(String message) throws RemoteException {
+ this.textArea.append(message + "\n");
+ textArea.setCaretPosition(textArea.getText().length() - 1);
+ }
+
+ @Override
+ public String getName() throws RemoteException {
+ return userName;
+ }
+
+ @Override
+ public UUID getId() throws RemoteException {
+ return clientId;
+ }
+
+ public UUID getIdLocal() {
+ return clientId;
+ }
+
+}
\ No newline at end of file
diff --git a/Mage.Client/src/mage/client/chat/ChatPanel.form b/Mage.Client/src/mage/client/chat/ChatPanel.form
new file mode 100644
index 00000000000..9a980c0d2c1
--- /dev/null
+++ b/Mage.Client/src/mage/client/chat/ChatPanel.form
@@ -0,0 +1,61 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/chat/ChatPanel.java b/Mage.Client/src/mage/client/chat/ChatPanel.java
new file mode 100644
index 00000000000..4a14495ddbb
--- /dev/null
+++ b/Mage.Client/src/mage/client/chat/ChatPanel.java
@@ -0,0 +1,135 @@
+/*
+* 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.
+*/
+
+/*
+ * ChatPanel.java
+ *
+ * Created on 15-Dec-2009, 11:04:31 PM
+ */
+
+package mage.client.chat;
+
+import java.awt.event.KeyEvent;
+import java.util.UUID;
+import java.util.logging.Logger;
+import mage.client.MageFrame;
+import mage.client.remote.Session;
+import mage.interfaces.ChatClient;
+import mage.util.Logging;
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class ChatPanel extends javax.swing.JPanel {
+
+ private final static Logger logger = Logging.getLogger(ChatPanel.class.getName());
+
+ private UUID chatId;
+ private UUID clientId;
+ private ChatClient client;
+ private Session session;
+
+
+ /** Creates new form ChatPanel */
+ public ChatPanel() {
+ initComponents();
+ }
+
+ public void connect(UUID chatId) {
+ session = MageFrame.getSession();
+ this.chatId = chatId;
+ client = new ChatClientImpl(session.getUserName(), this.txtConversation);
+ clientId = ((ChatClientImpl)client).getIdLocal();
+ session.joinChat(chatId, client);
+ }
+
+ public void disconnect() {
+ if (session.isConnected())
+ session.leaveChat(chatId, clientId);
+ }
+
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jScrollPane1 = new javax.swing.JScrollPane();
+ txtConversation = new javax.swing.JTextArea();
+ txtMessage = new javax.swing.JTextField();
+
+ txtConversation.setColumns(20);
+ txtConversation.setEditable(false);
+ txtConversation.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N
+ txtConversation.setLineWrap(true);
+ txtConversation.setRows(5);
+ txtConversation.setWrapStyleWord(true);
+ jScrollPane1.setViewportView(txtConversation);
+
+ txtMessage.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyTyped(java.awt.event.KeyEvent evt) {
+ txtMessageKeyTyped(evt);
+ }
+ });
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 179, Short.MAX_VALUE)
+ .addComponent(txtMessage, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 179, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 305, Short.MAX_VALUE)
+ .addGap(0, 0, 0)
+ .addComponent(txtMessage, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
+ );
+ }// //GEN-END:initComponents
+
+ private void txtMessageKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtMessageKeyTyped
+ if (evt.getKeyChar() == KeyEvent.VK_ENTER) {
+ session.sendChatMessage(chatId, this.txtMessage.getText());
+ this.txtMessage.setText("");
+ this.txtMessage.repaint();
+ }
+}//GEN-LAST:event_txtMessageKeyTyped
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JScrollPane jScrollPane1;
+ private javax.swing.JTextArea txtConversation;
+ private javax.swing.JTextField txtMessage;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/Mage.Client/src/mage/client/deckeditor/CardSelector.form b/Mage.Client/src/mage/client/deckeditor/CardSelector.form
new file mode 100644
index 00000000000..bdd19d1dd1f
--- /dev/null
+++ b/Mage.Client/src/mage/client/deckeditor/CardSelector.form
@@ -0,0 +1,118 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/deckeditor/CardSelector.java b/Mage.Client/src/mage/client/deckeditor/CardSelector.java
new file mode 100644
index 00000000000..db01019ff1a
--- /dev/null
+++ b/Mage.Client/src/mage/client/deckeditor/CardSelector.java
@@ -0,0 +1,255 @@
+/*
+* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are
+* permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of
+* conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice, this list
+* of conditions and the following disclaimer in the documentation and/or other materials
+* provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+* The views and conclusions contained in the software and documentation are those of the
+* authors and should not be interpreted as representing official policies, either expressed
+* or implied, of BetaSteward_at_googlemail.com.
+*/
+
+/*
+ * CardSelector.java
+ *
+ * Created on Feb 18, 2010, 2:49:03 PM
+ */
+
+package mage.client.deckeditor;
+
+import mage.Constants.Zone;
+import mage.cards.Cards;
+import mage.cards.CardsImpl;
+import mage.client.cards.BigCard;
+import mage.client.cards.CardsList;
+import mage.filter.Filter.ComparisonScope;
+import mage.filter.FilterCard;
+import mage.sets.AlaraReborn;
+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;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class CardSelector extends javax.swing.JPanel {
+
+ private Cards cards = new CardsImpl(Zone.OUTSIDE);
+ private FilterCard filter = new FilterCard();
+ private BigCard bigCard;
+
+ /** Creates new form CardSelector */
+ public CardSelector() {
+ initComponents();
+ }
+
+ public void loadCards(BigCard bigCard) {
+ this.bigCard = bigCard;
+ this.cards.clear();
+ cards.addAll(AlaraReborn.getInstance().createCards());
+ cards.addAll(Conflux.getInstance().createCards());
+ cards.addAll(Magic2010.getInstance().createCards());
+ cards.addAll(Planechase.getInstance().createCards());
+ cards.addAll(ShardsOfAlara.getInstance().createCards());
+ cards.addAll(Tenth.getInstance().createCards());
+ cards.addAll(Worldwake.getInstance().createCards());
+ cards.addAll(Zendikar.getInstance().createCards());
+ filter.setUseColor(true);
+ filter.getColor().setBlack(true);
+ filter.getColor().setBlue(true);
+ filter.getColor().setGreen(true);
+ filter.getColor().setWhite(true);
+ filter.getColor().setRed(true);
+ filter.setColorless(true);
+ filter.setUseColorless(true);
+ filter.setNotColor(false);
+ filter.setScopeColor(ComparisonScope.Any);
+ filterCards();
+ }
+
+ private void filterCards() {
+ this.cardsList1.loadCards(new CardsView(cards.getCards(filter)), bigCard, null);
+ }
+
+ public CardsList getCardsList() {
+ return this.cardsList1;
+ }
+
+ public Cards getCards() {
+ return cards;
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jToolBar1 = new javax.swing.JToolBar();
+ rdoRed = new javax.swing.JRadioButton();
+ rdoGreen = new javax.swing.JRadioButton();
+ rdoBlue = new javax.swing.JRadioButton();
+ rdoBlack = new javax.swing.JRadioButton();
+ rdoWhite = new javax.swing.JRadioButton();
+ rdoColorless = new javax.swing.JRadioButton();
+ cardsList1 = new mage.client.cards.CardsList();
+
+ jToolBar1.setRollover(true);
+
+ rdoRed.setSelected(true);
+ rdoRed.setText("Red ");
+ rdoRed.setFocusable(false);
+ rdoRed.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
+ rdoRed.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
+ rdoRed.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ rdoRedActionPerformed(evt);
+ }
+ });
+ jToolBar1.add(rdoRed);
+
+ rdoGreen.setSelected(true);
+ rdoGreen.setText("Green ");
+ rdoGreen.setFocusable(false);
+ rdoGreen.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
+ rdoGreen.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
+ rdoGreen.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ rdoGreenActionPerformed(evt);
+ }
+ });
+ jToolBar1.add(rdoGreen);
+
+ rdoBlue.setSelected(true);
+ rdoBlue.setText("Blue ");
+ rdoBlue.setFocusable(false);
+ rdoBlue.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
+ rdoBlue.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
+ rdoBlue.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ rdoBlueActionPerformed(evt);
+ }
+ });
+ jToolBar1.add(rdoBlue);
+
+ rdoBlack.setSelected(true);
+ rdoBlack.setText("Black ");
+ rdoBlack.setFocusable(false);
+ rdoBlack.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
+ rdoBlack.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
+ rdoBlack.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ rdoBlackActionPerformed(evt);
+ }
+ });
+ jToolBar1.add(rdoBlack);
+
+ rdoWhite.setSelected(true);
+ rdoWhite.setText("White ");
+ rdoWhite.setFocusable(false);
+ rdoWhite.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
+ rdoWhite.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
+ rdoWhite.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ rdoWhiteActionPerformed(evt);
+ }
+ });
+ jToolBar1.add(rdoWhite);
+
+ rdoColorless.setSelected(true);
+ rdoColorless.setText("Colorless");
+ rdoColorless.setFocusable(false);
+ rdoColorless.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
+ rdoColorless.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
+ rdoColorless.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ rdoColorlessActionPerformed(evt);
+ }
+ });
+ jToolBar1.add(rdoColorless);
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 825, Short.MAX_VALUE)
+ .addComponent(cardsList1, javax.swing.GroupLayout.DEFAULT_SIZE, 825, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(0, 0, 0)
+ .addComponent(cardsList1, javax.swing.GroupLayout.DEFAULT_SIZE, 340, Short.MAX_VALUE))
+ );
+ }// //GEN-END:initComponents
+
+ private void rdoGreenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoGreenActionPerformed
+ filter.getColor().setGreen(this.rdoGreen.isSelected());
+ filterCards();
+ }//GEN-LAST:event_rdoGreenActionPerformed
+
+ private void rdoBlackActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoBlackActionPerformed
+ filter.getColor().setBlack(this.rdoBlack.isSelected());
+ filterCards();
+ }//GEN-LAST:event_rdoBlackActionPerformed
+
+ private void rdoWhiteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoWhiteActionPerformed
+ filter.getColor().setWhite(this.rdoWhite.isSelected());
+ filterCards();
+ }//GEN-LAST:event_rdoWhiteActionPerformed
+
+ private void rdoRedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoRedActionPerformed
+ filter.getColor().setRed(this.rdoRed.isSelected());
+ filterCards();
+ }//GEN-LAST:event_rdoRedActionPerformed
+
+ private void rdoBlueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoBlueActionPerformed
+ filter.getColor().setBlue(this.rdoBlue.isSelected());
+ filterCards();
+ }//GEN-LAST:event_rdoBlueActionPerformed
+
+ private void rdoColorlessActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdoColorlessActionPerformed
+ filter.setColorless(this.rdoColorless.isSelected());
+ filterCards();
+ }//GEN-LAST:event_rdoColorlessActionPerformed
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private mage.client.cards.CardsList cardsList1;
+ private javax.swing.JToolBar jToolBar1;
+ private javax.swing.JRadioButton rdoBlack;
+ private javax.swing.JRadioButton rdoBlue;
+ private javax.swing.JRadioButton rdoColorless;
+ private javax.swing.JRadioButton rdoGreen;
+ private javax.swing.JRadioButton rdoRed;
+ private javax.swing.JRadioButton rdoWhite;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/Mage.Client/src/mage/client/deckeditor/DeckArea.form b/Mage.Client/src/mage/client/deckeditor/DeckArea.form
new file mode 100644
index 00000000000..5eaace8c59d
--- /dev/null
+++ b/Mage.Client/src/mage/client/deckeditor/DeckArea.form
@@ -0,0 +1,53 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/deckeditor/DeckArea.java b/Mage.Client/src/mage/client/deckeditor/DeckArea.java
new file mode 100644
index 00000000000..085c01b57a1
--- /dev/null
+++ b/Mage.Client/src/mage/client/deckeditor/DeckArea.java
@@ -0,0 +1,95 @@
+/*
+* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are
+* permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of
+* conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice, this list
+* of conditions and the following disclaimer in the documentation and/or other materials
+* provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+* The views and conclusions contained in the software and documentation are those of the
+* authors and should not be interpreted as representing official policies, either expressed
+* or implied, of BetaSteward_at_googlemail.com.
+*/
+
+
+/*
+ * DeckArea.java
+ *
+ * Created on Feb 18, 2010, 3:10:39 PM
+ */
+
+package mage.client.deckeditor;
+
+import mage.client.cards.CardsList;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class DeckArea extends javax.swing.JPanel {
+
+ /** Creates new form DeckArea */
+ public DeckArea() {
+ initComponents();
+ }
+
+ public CardsList getDeckList() {
+ return deckList;
+ }
+
+ public CardsList getSideboardList() {
+ return sideboardList;
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jSplitPane1 = new javax.swing.JSplitPane();
+ deckList = new mage.client.cards.CardsList();
+ sideboardList = new mage.client.cards.CardsList();
+
+ jSplitPane1.setResizeWeight(0.8);
+ jSplitPane1.setLeftComponent(deckList);
+ jSplitPane1.setRightComponent(sideboardList);
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 740, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 568, Short.MAX_VALUE)
+ );
+ }// //GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private mage.client.cards.CardsList deckList;
+ private javax.swing.JSplitPane jSplitPane1;
+ private mage.client.cards.CardsList sideboardList;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/Mage.Client/src/mage/client/deckeditor/DeckEditorPane.form b/Mage.Client/src/mage/client/deckeditor/DeckEditorPane.form
new file mode 100644
index 00000000000..69dff9f90b4
--- /dev/null
+++ b/Mage.Client/src/mage/client/deckeditor/DeckEditorPane.form
@@ -0,0 +1,35 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/deckeditor/DeckEditorPane.java b/Mage.Client/src/mage/client/deckeditor/DeckEditorPane.java
new file mode 100644
index 00000000000..e4bce886d38
--- /dev/null
+++ b/Mage.Client/src/mage/client/deckeditor/DeckEditorPane.java
@@ -0,0 +1,86 @@
+/*
+* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are
+* permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of
+* conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice, this list
+* of conditions and the following disclaimer in the documentation and/or other materials
+* provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+* The views and conclusions contained in the software and documentation are those of the
+* authors and should not be interpreted as representing official policies, either expressed
+* or implied, of BetaSteward_at_googlemail.com.
+*/
+
+/*
+ * DeckEditorPane.java
+ *
+ * Created on Dec 17, 2009, 9:21:42 AM
+ */
+
+package mage.client.deckeditor;
+
+import mage.client.*;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class DeckEditorPane extends MagePane {
+
+ /** Creates new form TablesPane */
+ public DeckEditorPane() {
+ initComponents();
+ }
+
+ public void showTables() {
+ this.deckEditorPanel1.showDeckEditor();
+ this.repaint();
+ }
+
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ deckEditorPanel1 = new mage.client.deckeditor.DeckEditorPanel();
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(deckEditorPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 885, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(deckEditorPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 626, Short.MAX_VALUE)
+ );
+
+ pack();
+ }// //GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private mage.client.deckeditor.DeckEditorPanel deckEditorPanel1;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/Mage.Client/src/mage/client/deckeditor/DeckEditorPanel.form b/Mage.Client/src/mage/client/deckeditor/DeckEditorPanel.form
new file mode 100644
index 00000000000..c662e1f64be
--- /dev/null
+++ b/Mage.Client/src/mage/client/deckeditor/DeckEditorPanel.form
@@ -0,0 +1,163 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/deckeditor/DeckEditorPanel.java b/Mage.Client/src/mage/client/deckeditor/DeckEditorPanel.java
new file mode 100644
index 00000000000..8f78b67b81e
--- /dev/null
+++ b/Mage.Client/src/mage/client/deckeditor/DeckEditorPanel.java
@@ -0,0 +1,308 @@
+/*
+* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are
+* permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of
+* conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice, this list
+* of conditions and the following disclaimer in the documentation and/or other materials
+* provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+* The views and conclusions contained in the software and documentation are those of the
+* authors and should not be interpreted as representing official policies, either expressed
+* or implied, of BetaSteward_at_googlemail.com.
+*/
+
+/*
+ * DeckEditorPanel.java
+ *
+ * Created on Feb 18, 2010, 2:47:04 PM
+ */
+
+package mage.client.deckeditor;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.util.UUID;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.JFileChooser;
+import javax.swing.filechooser.FileFilter;
+import mage.cards.Card;
+import mage.cards.decks.Deck;
+import mage.cards.decks.DeckCardLists;
+import mage.client.util.Event;
+import mage.client.util.Listener;
+import mage.view.CardsView;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class DeckEditorPanel extends javax.swing.JPanel {
+
+ private JFileChooser fcSelectDeck;
+ private Deck deck = new Deck();;
+
+ /** Creates new form DeckEditorPanel */
+ public DeckEditorPanel() {
+ initComponents();
+ fcSelectDeck = new JFileChooser();
+ fcSelectDeck.setAcceptAllFileFilterUsed(false);
+ fcSelectDeck.addChoosableFileFilter(new DeckFilter());
+ }
+
+ public void showDeckEditor() {
+ this.cardSelector.loadCards(this.bigCard);
+ this.cardSelector.setVisible(true);
+ this.jPanel1.setVisible(true);
+ this.cardSelector.getCardsList().clearCardEventListeners();
+ this.cardSelector.getCardsList().addCardEventListener(
+ new Listener () {
+ @Override
+ public void event(Event event) {
+ if (event.getEventName().equals("double-click")) {
+ deck.getCards().add(createCard(cardSelector.getCards().get((UUID)event.getSource()).getClass()));
+ refreshDeck();
+ }
+ }
+ }
+ );
+ this.deckArea.getDeckList().clearCardEventListeners();
+ this.deckArea.getDeckList().addCardEventListener(
+ new Listener () {
+ @Override
+ public void event(Event event) {
+ if (event.getEventName().equals("double-click")) {
+ deck.getCards().remove((UUID)event.getSource());
+ refreshDeck();
+ }
+ }
+ }
+ );
+
+ this.setVisible(true);
+ this.repaint();
+ }
+
+ private void refreshDeck() {
+ this.txtDeckName.setText(deck.getName());
+ deckArea.getDeckList().loadCards(new CardsView(deck.getCards()), bigCard, null);
+ deckArea.getSideboardList().loadCards(new CardsView(deck.getSideboard()), bigCard, null);
+ }
+
+ private Card createCard(Class clazz) {
+ try {
+ Constructor> con = clazz.getConstructor(new Class[]{UUID.class});
+ return (Card) con.newInstance(new Object[] {null});
+ } catch (Exception ex) {
+ Logger.getLogger(DeckEditorPanel.class.getName()).log(Level.SEVERE, null, ex);
+ return null;
+ }
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jSplitPane1 = new javax.swing.JSplitPane();
+ cardSelector = new mage.client.deckeditor.CardSelector();
+ deckArea = new mage.client.deckeditor.DeckArea();
+ jPanel1 = new javax.swing.JPanel();
+ bigCard = new mage.client.cards.BigCard();
+ txtDeckName = new javax.swing.JTextField();
+ lblDeckName = new javax.swing.JLabel();
+ btnSave = new javax.swing.JButton();
+ btnLoad = new javax.swing.JButton();
+ btnNew = new javax.swing.JButton();
+ btnExit = new javax.swing.JButton();
+
+ jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
+ jSplitPane1.setResizeWeight(0.5);
+ jSplitPane1.setTopComponent(cardSelector);
+ jSplitPane1.setRightComponent(deckArea);
+
+ bigCard.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
+
+ lblDeckName.setLabelFor(txtDeckName);
+ lblDeckName.setText("Deck Name:");
+
+ btnSave.setText("Save");
+ btnSave.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnSaveActionPerformed(evt);
+ }
+ });
+
+ btnLoad.setText("Load");
+ btnLoad.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnLoadActionPerformed(evt);
+ }
+ });
+
+ btnNew.setText("New");
+ btnNew.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnNewActionPerformed(evt);
+ }
+ });
+
+ btnExit.setText("Exit");
+ btnExit.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnExitActionPerformed(evt);
+ }
+ });
+
+ javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
+ jPanel1.setLayout(jPanel1Layout);
+ jPanel1Layout.setHorizontalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGap(6, 6, 6)
+ .addComponent(lblDeckName)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtDeckName, javax.swing.GroupLayout.DEFAULT_SIZE, 189, Short.MAX_VALUE))
+ .addComponent(bigCard, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(btnSave)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnLoad)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnNew)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnExit)))
+ .addContainerGap())
+ );
+ jPanel1Layout.setVerticalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(txtDeckName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(lblDeckName))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btnSave)
+ .addComponent(btnLoad)
+ .addComponent(btnNew)
+ .addComponent(btnExit))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 188, Short.MAX_VALUE)
+ .addComponent(bigCard, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ );
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(0, 0, 0)
+ .addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 604, Short.MAX_VALUE))
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(jSplitPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 615, Short.MAX_VALUE)
+ );
+ }// //GEN-END:initComponents
+
+ private void btnLoadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoadActionPerformed
+ int ret = fcSelectDeck.showOpenDialog(this);
+ if (ret == JFileChooser.APPROVE_OPTION) {
+ File file = fcSelectDeck.getSelectedFile();
+ try {
+ deck = Deck.load(DeckCardLists.load(file.getPath()));
+ } catch (Exception ex) {
+ Logger.getLogger(DeckEditorPanel.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ refreshDeck();
+ }
+ fcSelectDeck.setSelectedFile(null);
+ }//GEN-LAST:event_btnLoadActionPerformed
+
+ private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed
+ deck.setName(this.txtDeckName.getText());
+ int ret = fcSelectDeck.showSaveDialog(this);
+ if (ret == JFileChooser.APPROVE_OPTION) {
+ File file = fcSelectDeck.getSelectedFile();
+ try {
+ deck.getDeckCardLists().save(file.getPath());
+ } catch (Exception ex) {
+ Logger.getLogger(DeckEditorPanel.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+ }//GEN-LAST:event_btnSaveActionPerformed
+
+ private void btnNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNewActionPerformed
+ deck = new Deck();
+ refreshDeck();
+ }//GEN-LAST:event_btnNewActionPerformed
+
+ private void btnExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExitActionPerformed
+ this.setVisible(false);
+ }//GEN-LAST:event_btnExitActionPerformed
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private mage.client.cards.BigCard bigCard;
+ private javax.swing.JButton btnExit;
+ private javax.swing.JButton btnLoad;
+ private javax.swing.JButton btnNew;
+ private javax.swing.JButton btnSave;
+ private mage.client.deckeditor.CardSelector cardSelector;
+ private mage.client.deckeditor.DeckArea deckArea;
+ private javax.swing.JPanel jPanel1;
+ private javax.swing.JSplitPane jSplitPane1;
+ private javax.swing.JLabel lblDeckName;
+ private javax.swing.JTextField txtDeckName;
+ // End of variables declaration//GEN-END:variables
+
+}
+
+class DeckFilter extends FileFilter {
+
+ @Override
+ public boolean accept(File f) {
+ if (f.isDirectory())
+ return true;
+
+ String ext = null;
+ String s = f.getName();
+ int i = s.lastIndexOf('.');
+
+ if (i > 0 && i < s.length() - 1) {
+ ext = s.substring(i+1).toLowerCase();
+ }
+ return (ext==null)?false:ext.equals("dck");
+ }
+
+ @Override
+ public String getDescription() {
+ return "Deck Files";
+ }
+}
\ No newline at end of file
diff --git a/Mage.Client/src/mage/client/dialog/AboutDialog.form b/Mage.Client/src/mage/client/dialog/AboutDialog.form
new file mode 100644
index 00000000000..44a286f0f37
--- /dev/null
+++ b/Mage.Client/src/mage/client/dialog/AboutDialog.form
@@ -0,0 +1,98 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/dialog/AboutDialog.java b/Mage.Client/src/mage/client/dialog/AboutDialog.java
new file mode 100644
index 00000000000..efb969dc64b
--- /dev/null
+++ b/Mage.Client/src/mage/client/dialog/AboutDialog.java
@@ -0,0 +1,140 @@
+/*
+ * 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.
+ */
+
+/*
+ * AboutDialog.java
+ *
+ * Created on Mar 10, 2010, 8:19:41 AM
+ */
+
+package mage.client.dialog;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class AboutDialog extends MageDialog {
+
+ /** Creates new form AboutDialog */
+ public AboutDialog() {
+ initComponents();
+ this.modal = false;
+ }
+
+ public void showDialog() {
+ this.lblVersion.setText(MageDialog.class.getPackage().getImplementationVersion());
+ this.setVisible(true);
+ }
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ btnOk = new javax.swing.JButton();
+ jLabel1 = new javax.swing.JLabel();
+ lblVersion = new javax.swing.JLabel();
+ jLabel2 = new javax.swing.JLabel();
+ jLabel3 = new javax.swing.JLabel();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+
+ btnOk.setText("OK");
+ btnOk.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnOkActionPerformed(evt);
+ }
+ });
+
+ jLabel1.setText("MAGE client");
+
+ lblVersion.setText("version");
+
+ jLabel2.setText("Courtesy: ForgottenBeta@gmail.com");
+
+ jLabel3.setText("Thanks: KLo, Cosmo & Fritz");
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addContainerGap(154, Short.MAX_VALUE)
+ .addComponent(btnOk)
+ .addContainerGap())
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jLabel1)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(lblVersion)
+ .addContainerGap(104, Short.MAX_VALUE))
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jLabel2)
+ .addContainerGap(23, Short.MAX_VALUE))
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jLabel3)
+ .addContainerGap(70, Short.MAX_VALUE))
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel1)
+ .addComponent(lblVersion))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jLabel2)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jLabel3)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
+ .addComponent(btnOk)
+ .addContainerGap())
+ );
+
+ pack();
+ }// //GEN-END:initComponents
+
+ private void btnOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOkActionPerformed
+ this.setVisible(false);
+ }//GEN-LAST:event_btnOkActionPerformed
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnOk;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel2;
+ private javax.swing.JLabel jLabel3;
+ private javax.swing.JLabel lblVersion;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/Mage.Client/src/mage/client/dialog/CombatDialog.form b/Mage.Client/src/mage/client/dialog/CombatDialog.form
new file mode 100644
index 00000000000..4f40ab660c1
--- /dev/null
+++ b/Mage.Client/src/mage/client/dialog/CombatDialog.form
@@ -0,0 +1,42 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/dialog/CombatDialog.java b/Mage.Client/src/mage/client/dialog/CombatDialog.java
new file mode 100644
index 00000000000..e56f8bf82c1
--- /dev/null
+++ b/Mage.Client/src/mage/client/dialog/CombatDialog.java
@@ -0,0 +1,115 @@
+/*
+* 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.
+*/
+
+/*
+ * CombatDialog.java
+ *
+ * Created on Feb 10, 2010, 3:35:02 PM
+ */
+
+package mage.client.dialog;
+
+import java.awt.Dimension;
+import java.util.List;
+import java.util.UUID;
+import javax.swing.JLayeredPane;
+import mage.client.cards.BigCard;
+import mage.client.game.CombatGroup;
+import mage.view.CombatGroupView;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class CombatDialog extends MageDialog {
+
+ private UUID gameId;
+ private BigCard bigCard;
+
+ /** Creates new form CombatDialog */
+ public CombatDialog() {
+ initComponents();
+ this.setModal(false);
+ }
+
+ public void init(UUID gameId, BigCard bigCard) {
+ this.gameId = gameId;
+ this.bigCard = bigCard;
+ }
+
+ public void showDialog(List combat) {
+ combatArea.removeAll();
+ for (CombatGroupView group: combat) {
+ CombatGroup combatGroup = new CombatGroup();
+ combatGroup.init(gameId, bigCard);
+ combatGroup.update(group);
+ combatGroup.setVisible(true);
+// combatGroup.setPreferredSize(new Dimension(140, 440));
+ combatArea.add(combatGroup);
+ combatGroup.revalidate();
+ }
+// combatArea.setPreferredSize(new Dimension(140, 440));
+ pack();
+ this.revalidate();
+ this.repaint();
+ this.setVisible(true);
+ }
+
+ public void hideDialog() {
+ this.setVisible(false);
+ }
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jScrollPane1 = new javax.swing.JScrollPane();
+ combatArea = new javax.swing.JPanel();
+
+ setResizable(true);
+ setVisible(true);
+ getContentPane().setLayout(new java.awt.BorderLayout());
+
+ jScrollPane1.setViewportView(combatArea);
+
+ getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);
+
+ pack();
+ }// //GEN-END:initComponents
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JPanel combatArea;
+ private javax.swing.JScrollPane jScrollPane1;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/Mage.Client/src/mage/client/dialog/ConnectDialog.form b/Mage.Client/src/mage/client/dialog/ConnectDialog.form
new file mode 100644
index 00000000000..c62be0b92ea
--- /dev/null
+++ b/Mage.Client/src/mage/client/dialog/ConnectDialog.form
@@ -0,0 +1,133 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/dialog/ConnectDialog.java b/Mage.Client/src/mage/client/dialog/ConnectDialog.java
new file mode 100644
index 00000000000..05ad14da293
--- /dev/null
+++ b/Mage.Client/src/mage/client/dialog/ConnectDialog.java
@@ -0,0 +1,203 @@
+/*
+* 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.
+*/
+
+/*
+ * ConnectDialog.java
+ *
+ * Created on 20-Jan-2010, 9:37:07 PM
+ */
+
+package mage.client.dialog;
+
+import java.rmi.NotBoundException;
+import java.rmi.RemoteException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.JOptionPane;
+import mage.client.remote.Session;
+import mage.client.util.Config;
+import mage.util.Logging;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class ConnectDialog extends MageDialog {
+
+ private final static Logger logger = Logging.getLogger(ConnectDialog.class.getName());
+ private Session session;
+
+ /** Creates new form ConnectDialog */
+ public ConnectDialog(Session session) {
+ this.session = session;
+ initComponents();
+ }
+
+ public void showDialog() {
+ this.txtServer.setText(Config.serverName);
+ this.txtPort.setText(Integer.toString(Config.port));
+ this.setModal(true);
+ this.setVisible(true);
+ }
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ txtServer = new javax.swing.JTextField();
+ lblServer = new javax.swing.JLabel();
+ lblPort = new javax.swing.JLabel();
+ txtPort = new javax.swing.JTextField();
+ txtUserName = new javax.swing.JTextField();
+ lblUserName = new javax.swing.JLabel();
+ btnConnect = new javax.swing.JButton();
+ btnCancel = new javax.swing.JButton();
+
+ lblServer.setLabelFor(txtServer);
+ lblServer.setText("Server:");
+
+ lblPort.setLabelFor(txtPort);
+ lblPort.setText("Port:");
+
+ txtPort.addKeyListener(new java.awt.event.KeyAdapter() {
+ public void keyTyped(java.awt.event.KeyEvent evt) {
+ ConnectDialog.this.keyTyped(evt);
+ }
+ });
+
+ txtUserName.setText("me");
+
+ lblUserName.setLabelFor(txtUserName);
+ lblUserName.setText("User Name:");
+
+ btnConnect.setText("Connect");
+ btnConnect.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnConnectActionPerformed(evt);
+ }
+ });
+
+ btnCancel.setText("Cancel");
+ btnCancel.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnCancelActionPerformed(evt);
+ }
+ });
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addComponent(btnConnect)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnCancel))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(lblPort)
+ .addComponent(lblServer)
+ .addComponent(lblUserName))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(txtPort, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(131, 131, 131))
+ .addComponent(txtServer, javax.swing.GroupLayout.DEFAULT_SIZE, 268, Short.MAX_VALUE)
+ .addComponent(txtUserName, javax.swing.GroupLayout.DEFAULT_SIZE, 268, Short.MAX_VALUE))))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblServer)
+ .addComponent(txtServer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(txtPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(lblPort))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(txtUserName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(lblUserName))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 35, Short.MAX_VALUE)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btnCancel)
+ .addComponent(btnConnect))
+ .addContainerGap())
+ );
+
+ pack();
+ }// //GEN-END:initComponents
+
+ private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed
+ this.setVisible(false);
+ }//GEN-LAST:event_btnCancelActionPerformed
+
+ private void btnConnectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConnectActionPerformed
+
+ try {
+ session.connect(txtUserName.getText(), txtServer.getText(), Integer.valueOf(txtPort.getText()));
+ this.setVisible(false);
+ } catch (RemoteException ex) {
+ logger.log(Level.SEVERE, "Unable to connect to server", ex);
+ JOptionPane.showMessageDialog(rootPane, "Unable to connect to server");
+ } catch (NotBoundException ex) {
+ logger.log(Level.SEVERE, "Unable to connect to server", ex);
+ JOptionPane.showMessageDialog(rootPane, "Unable to connect to server");
+ }
+ }//GEN-LAST:event_btnConnectActionPerformed
+
+ private void keyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_keyTyped
+ char c = evt.getKeyChar();
+ if (!Character.isDigit(c))
+ evt.consume();
+ }//GEN-LAST:event_keyTyped
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnCancel;
+ private javax.swing.JButton btnConnect;
+ private javax.swing.JLabel lblPort;
+ private javax.swing.JLabel lblServer;
+ private javax.swing.JLabel lblUserName;
+ private javax.swing.JTextField txtPort;
+ private javax.swing.JTextField txtServer;
+ private javax.swing.JTextField txtUserName;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/Mage.Client/src/mage/client/dialog/ExileZoneDialog.form b/Mage.Client/src/mage/client/dialog/ExileZoneDialog.form
new file mode 100644
index 00000000000..cabd4e2962e
--- /dev/null
+++ b/Mage.Client/src/mage/client/dialog/ExileZoneDialog.form
@@ -0,0 +1,38 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/dialog/ExileZoneDialog.java b/Mage.Client/src/mage/client/dialog/ExileZoneDialog.java
new file mode 100644
index 00000000000..a6f342d27da
--- /dev/null
+++ b/Mage.Client/src/mage/client/dialog/ExileZoneDialog.java
@@ -0,0 +1,105 @@
+/*
+* 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.
+*/
+
+/*
+ * ExileZoneDialog.java
+ *
+ * Created on Feb 1, 2010, 3:00:35 PM
+ */
+
+package mage.client.dialog;
+
+import java.beans.PropertyVetoException;
+import java.util.UUID;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.JLayeredPane;
+import mage.client.MageFrame;
+import mage.client.cards.BigCard;
+import mage.view.ExileView;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class ExileZoneDialog extends MageDialog {
+
+ /** Creates new form ExileZoneDialog */
+ public ExileZoneDialog() {
+ initComponents();
+ this.setModal(false);
+ }
+
+ public void loadCards(ExileView exile, BigCard bigCard, UUID gameId) {
+ this.title = exile.getName();
+ if (exile.size() > 0) {
+ cards.loadCards(exile, bigCard, gameId);
+ if (getParent() != MageFrame.getDesktop() || this.isClosed)
+ MageFrame.getDesktop().add(this, JLayeredPane.PALETTE_LAYER);
+ try {
+ this.setIcon(false);
+ } catch (PropertyVetoException ex) {
+ Logger.getLogger(ShowCardsDialog.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+ this.setVisible(exile.size() > 0);
+ }
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ cards = new mage.client.cards.Cards();
+
+ setIconifiable(true);
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(cards, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 418, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(cards, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ );
+
+ pack();
+ }// //GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private mage.client.cards.Cards cards;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/Mage.Client/src/mage/client/dialog/JoinTableDialog.form b/Mage.Client/src/mage/client/dialog/JoinTableDialog.form
new file mode 100644
index 00000000000..7a276799fd2
--- /dev/null
+++ b/Mage.Client/src/mage/client/dialog/JoinTableDialog.form
@@ -0,0 +1,66 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/dialog/JoinTableDialog.java b/Mage.Client/src/mage/client/dialog/JoinTableDialog.java
new file mode 100644
index 00000000000..85e3db7c777
--- /dev/null
+++ b/Mage.Client/src/mage/client/dialog/JoinTableDialog.java
@@ -0,0 +1,159 @@
+/*
+* 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.
+*/
+
+
+/*
+ * JoinTableDialog.java
+ *
+ * Created on 15-Dec-2009, 11:18:48 PM
+ */
+
+package mage.client.dialog;
+
+import mage.client.*;
+import java.util.UUID;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.JOptionPane;
+import mage.cards.decks.DeckCardLists;
+import mage.client.remote.Session;
+import mage.util.Logging;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class JoinTableDialog extends MageDialog {
+
+ private final static Logger logger = Logging.getLogger(JoinTableDialog.class.getName());
+
+ private UUID tableId;
+ private UUID roomId;
+ private boolean joined = false;
+
+ /** Creates new form JoinTableDialog */
+ public JoinTableDialog() {
+ initComponents();
+ }
+
+ public void showDialog(UUID roomId, UUID tableId) {
+ this.roomId = roomId;
+ this.tableId = tableId;
+ this.setModal(true);
+ this.setVisible(true);
+ }
+
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ btnCancel = new javax.swing.JButton();
+ btnOK = new javax.swing.JButton();
+ newPlayerPanel = new mage.client.NewPlayerPanel();
+
+ btnCancel.setText("Cancel");
+ btnCancel.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnCancelActionPerformed(evt);
+ }
+ });
+
+ btnOK.setText("OK");
+ btnOK.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnOKActionPerformed(evt);
+ }
+ });
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addContainerGap(310, Short.MAX_VALUE)
+ .addComponent(btnOK)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnCancel)
+ .addContainerGap())
+ .addComponent(newPlayerPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 438, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addComponent(newPlayerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 14, Short.MAX_VALUE)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btnCancel)
+ .addComponent(btnOK))
+ .addContainerGap())
+ );
+
+ pack();
+ }// //GEN-END:initComponents
+
+ private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed
+ this.joined = false;
+ this.setVisible(false);
+ }//GEN-LAST:event_btnCancelActionPerformed
+
+ private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed
+ Session session = MageFrame.getSession();
+ try {
+ joined = session.joinTable(roomId, tableId, 1, this.newPlayerPanel.getPlayerName(), DeckCardLists.load(this.newPlayerPanel.getDeckFile()));
+ } catch (Exception ex) {
+ handleError(ex);
+ }
+ this.setVisible(false);
+ }//GEN-LAST:event_btnOKActionPerformed
+
+ /**
+ * @return the joined
+ */
+ public boolean isJoined() {
+ return joined;
+ }
+
+ private void handleError(Exception ex) {
+ logger.log(Level.SEVERE, "Error loading deck", ex);
+ JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Error loading deck.", "Error", JOptionPane.ERROR_MESSAGE);
+ }
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnCancel;
+ private javax.swing.JButton btnOK;
+ private mage.client.NewPlayerPanel newPlayerPanel;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/Mage.Client/src/mage/client/dialog/MageDialog.form b/Mage.Client/src/mage/client/dialog/MageDialog.form
new file mode 100644
index 00000000000..ee50ddc2d76
--- /dev/null
+++ b/Mage.Client/src/mage/client/dialog/MageDialog.form
@@ -0,0 +1,31 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/dialog/MageDialog.java b/Mage.Client/src/mage/client/dialog/MageDialog.java
new file mode 100644
index 00000000000..801a2836523
--- /dev/null
+++ b/Mage.Client/src/mage/client/dialog/MageDialog.java
@@ -0,0 +1,178 @@
+/*
+* 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.
+*/
+
+/*
+ * MageDialog.java
+ *
+ * Created on 15-Dec-2009, 10:28:27 PM
+ */
+
+package mage.client.dialog;
+
+import java.awt.AWTEvent;
+import java.awt.ActiveEvent;
+import java.awt.Component;
+import java.awt.EventQueue;
+import java.awt.MenuComponent;
+import java.awt.event.MouseEvent;
+import java.lang.reflect.InvocationTargetException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.SwingUtilities;
+import mage.util.Logging;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class MageDialog extends javax.swing.JInternalFrame {
+
+ private final static Logger logger = Logging.getLogger(MageDialog.class.getName());
+
+ protected boolean modal = false;
+
+ /** Creates new form MageDialog */
+ public MageDialog() {
+ initComponents();
+ }
+
+ @Override
+ public void show() {
+ this.setLocation(200, 200);
+ super.show();
+ if (this.modal) {
+ startModal();
+ }
+ }
+
+ @Override
+ public void setVisible(boolean value) {
+ super.setVisible(value);
+ if (modal) {
+ if (value) {
+ startModal();
+ } else {
+ if (SwingUtilities.isEventDispatchThread()) {
+ stopModal();
+ } else {
+ try {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ stopModal();
+ }
+ });
+ } catch (InterruptedException ex) {
+ logger.log(Level.SEVERE, null, ex);
+ } catch (InvocationTargetException ex) {
+ logger.log(Level.SEVERE, null, ex);
+ }
+ }
+ }
+ }
+ }
+
+ private synchronized void startModal() {
+
+ try {
+ if (SwingUtilities.isEventDispatchThread()) {
+ EventQueue theQueue = getToolkit().getSystemEventQueue();
+ while (isVisible()) {
+ AWTEvent event = theQueue.getNextEvent();
+ Object source = event.getSource();
+ boolean dispatch = true;
+
+ if (event instanceof MouseEvent) {
+ MouseEvent e = (MouseEvent) event;
+ MouseEvent m = SwingUtilities.convertMouseEvent((Component) e.getSource(), e, this);
+ if (!this.contains(m.getPoint()) && e.getID() != MouseEvent.MOUSE_DRAGGED) {
+ dispatch = false;
+ }
+ }
+
+ if (dispatch) {
+ if (event instanceof ActiveEvent) {
+ ((ActiveEvent) event).dispatch();
+ } else if (source instanceof Component) {
+ ((Component) source).dispatchEvent(event);
+ } else if (source instanceof MenuComponent) {
+ ((MenuComponent) source).dispatchEvent(event);
+ } else {
+ logger.info("Unable to dispatch: " + event);
+ }
+ }
+ }
+ } else {
+ while (isVisible()) {
+ wait();
+ }
+ }
+ } catch (InterruptedException ignored) {
+ }
+
+ }
+
+ private synchronized void stopModal() {
+ notifyAll();
+ }
+
+ public void setModal(boolean modal) {
+ this.modal = modal;
+ }
+
+ public boolean isModal() {
+ return this.modal;
+ }
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 394, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 274, Short.MAX_VALUE)
+ );
+
+ pack();
+ }// //GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/Mage.Client/src/mage/client/dialog/NewTableDialog.form b/Mage.Client/src/mage/client/dialog/NewTableDialog.form
new file mode 100644
index 00000000000..5af2848a2f9
--- /dev/null
+++ b/Mage.Client/src/mage/client/dialog/NewTableDialog.form
@@ -0,0 +1,144 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/dialog/NewTableDialog.java b/Mage.Client/src/mage/client/dialog/NewTableDialog.java
new file mode 100644
index 00000000000..63e7280eb65
--- /dev/null
+++ b/Mage.Client/src/mage/client/dialog/NewTableDialog.java
@@ -0,0 +1,272 @@
+/*
+* 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.
+*/
+
+/*
+ * NewTableDialog.java
+ *
+ * Created on 15-Dec-2009, 10:35:42 PM
+ */
+
+package mage.client.dialog;
+
+import mage.client.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JOptionPane;
+import mage.Constants;
+import mage.cards.decks.DeckCardLists;
+import mage.client.remote.Session;
+import mage.util.Logging;
+import mage.view.TableView;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class NewTableDialog extends MageDialog {
+
+ private final static Logger logger = Logging.getLogger(NewTableDialog.class.getName());
+
+ private TableView table;
+ private UUID playerId;
+ private UUID roomId;
+ private Session session;
+
+ /** Creates new form NewTableDialog */
+ public NewTableDialog() {
+ initComponents();
+ this.player2Panel.setVisible(false);
+ //for testing only
+// this.player1Panel.setPlayerName("human");
+// this.player2Panel.setPlayerName("computer");
+// //this.cbPlayer2Type.setSelectedItem(PlayerType.COMPUTER);
+// this.player2Panel.setVisible(true);
+// this.player1Panel.setDeckFile("test.dck");
+// this.player2Panel.setDeckFile("test.dck");
+
+ }
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ lblGameType = new javax.swing.JLabel();
+ cbGameType = new javax.swing.JComboBox();
+ lbDeckType = new javax.swing.JLabel();
+ cbDeckType = new javax.swing.JComboBox();
+ lbPlayer2Type = new javax.swing.JLabel();
+ cbPlayer2Type = new javax.swing.JComboBox();
+ btnOK = new javax.swing.JButton();
+ btnCancel = new javax.swing.JButton();
+ player2Panel = new mage.client.NewPlayerPanel();
+ player1Panel = new mage.client.NewPlayerPanel();
+
+ lblGameType.setText("Game Type:");
+
+ lbDeckType.setText("Deck Type:");
+
+ cbDeckType.setModel(new DefaultComboBoxModel(Constants.DeckType.values()));
+
+ lbPlayer2Type.setText("Player 2 Type:");
+
+ cbPlayer2Type.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ cbPlayer2TypeActionPerformed(evt);
+ }
+ });
+
+ btnOK.setText("OK");
+ btnOK.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnOKActionPerformed(evt);
+ }
+ });
+
+ btnCancel.setText("Cancel");
+ btnCancel.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnCancelActionPerformed(evt);
+ }
+ });
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addGap(25, 25, 25)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(lblGameType)
+ .addComponent(lbDeckType))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addComponent(cbDeckType, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .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()
+ .addContainerGap()
+ .addComponent(lbPlayer2Type)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(cbPlayer2Type, javax.swing.GroupLayout.PREFERRED_SIZE, 241, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(player1Panel, javax.swing.GroupLayout.DEFAULT_SIZE, 468, Short.MAX_VALUE))
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(player2Panel, javax.swing.GroupLayout.DEFAULT_SIZE, 468, Short.MAX_VALUE)))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(cbGameType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(lblGameType))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(cbDeckType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(lbDeckType))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(player1Panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(8, 8, 8)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lbPlayer2Type)
+ .addComponent(cbPlayer2Type, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(player2Panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(13, 13, 13)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btnOK)
+ .addComponent(btnCancel))
+ .addContainerGap(39, Short.MAX_VALUE))
+ );
+
+ pack();
+ }// //GEN-END:initComponents
+
+ private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed
+ this.table = null;
+ this.playerId = null;
+ this.setVisible(false);
+ }//GEN-LAST:event_btnCancelActionPerformed
+
+ private void cbPlayer2TypeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbPlayer2TypeActionPerformed
+ if (!this.cbPlayer2Type.getSelectedItem().equals("Human")) {
+ this.player2Panel.setVisible(true);
+ }
+ else {
+ this.player2Panel.setVisible(false);
+ }
+ }//GEN-LAST:event_cbPlayer2TypeActionPerformed
+
+ private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed
+ try {
+ List playerTypes = new ArrayList();
+ playerTypes.add("Human");
+ playerTypes.add((String) this.cbPlayer2Type.getSelectedItem());
+ table = session.createTable(
+ roomId,
+ (String)this.cbGameType.getSelectedItem(),
+ (Constants.DeckType)this.cbDeckType.getSelectedItem(),
+ playerTypes
+ );
+ session.joinTable(
+ roomId,
+ table.getTableId(),
+ 0,
+ this.player1Panel.getPlayerName(),
+ DeckCardLists.load(this.player1Panel.getDeckFile())
+ );
+ if (!this.cbPlayer2Type.getSelectedItem().equals("Human")) {
+ session.joinTable(
+ roomId,
+ table.getTableId(),
+ 1,
+ this.player2Panel.getPlayerName(),
+ DeckCardLists.load(this.player2Panel.getDeckFile())
+ );
+ }
+ } catch (Exception ex) {
+ handleError(ex);
+ }
+
+ this.setVisible(false);
+ }//GEN-LAST:event_btnOKActionPerformed
+
+ private void handleError(Exception ex) {
+ logger.log(Level.SEVERE, "Error loading deck", ex);
+ JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Error loading deck.", "Error", JOptionPane.ERROR_MESSAGE);
+ }
+
+ public void showDialog(UUID roomId) {
+ session = MageFrame.getSession();
+ cbGameType.setModel(new DefaultComboBoxModel(session.getGameTypes()));
+ cbPlayer2Type.setModel(new DefaultComboBoxModel(session.getPlayerTypes()));
+ this.roomId = roomId;
+ this.setModal(true);
+ this.setVisible(true);
+ }
+
+ public TableView getTable() {
+ return table;
+ }
+
+ public UUID getPlayerId() {
+ return playerId;
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnCancel;
+ private javax.swing.JButton btnOK;
+ private javax.swing.JComboBox cbDeckType;
+ private javax.swing.JComboBox cbGameType;
+ private javax.swing.JComboBox cbPlayer2Type;
+ private javax.swing.JLabel lbDeckType;
+ private javax.swing.JLabel lbPlayer2Type;
+ private javax.swing.JLabel lblGameType;
+ private mage.client.NewPlayerPanel player1Panel;
+ private mage.client.NewPlayerPanel player2Panel;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/Mage.Client/src/mage/client/dialog/PickChoiceDialog.form b/Mage.Client/src/mage/client/dialog/PickChoiceDialog.form
new file mode 100644
index 00000000000..3462b894ddd
--- /dev/null
+++ b/Mage.Client/src/mage/client/dialog/PickChoiceDialog.form
@@ -0,0 +1,100 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/dialog/PickChoiceDialog.java b/Mage.Client/src/mage/client/dialog/PickChoiceDialog.java
new file mode 100644
index 00000000000..2c9acfd4b48
--- /dev/null
+++ b/Mage.Client/src/mage/client/dialog/PickChoiceDialog.java
@@ -0,0 +1,150 @@
+/*
+* 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.
+*/
+
+/*
+ * PickNumberDialog.java
+ *
+ * Created on Feb 25, 2010, 12:03:39 PM
+ */
+
+package mage.client.dialog;
+
+import javax.swing.JLayeredPane;
+import mage.client.MageFrame;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class PickChoiceDialog extends MageDialog {
+
+ /** Creates new form PickNumberDialog */
+ public PickChoiceDialog() {
+ initComponents();
+ this.setModal(true);
+ }
+
+ public void showDialog(String message, String[] choices) {
+ this.lblMessage.setText(message);
+ this.lstChoices.setListData(choices);
+ MageFrame.getDesktop().add(this, JLayeredPane.PALETTE_LAYER);
+ this.setVisible(true);
+ }
+
+ public String getChoice() {
+ return (String)this.lstChoices.getSelectedValue();
+ }
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ btnCancel = new javax.swing.JButton();
+ btnOk = new javax.swing.JButton();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ lstChoices = new javax.swing.JList();
+ lblMessage = new javax.swing.JLabel();
+
+ btnCancel.setText("Cancel");
+ btnCancel.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnCancelActionPerformed(evt);
+ }
+ });
+
+ btnOk.setText("OK");
+ btnOk.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnOkActionPerformed(evt);
+ }
+ });
+
+ lstChoices.setModel(new javax.swing.AbstractListModel() {
+ String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
+ public int getSize() { return strings.length; }
+ public Object getElementAt(int i) { return strings[i]; }
+ });
+ jScrollPane1.setViewportView(lstChoices);
+
+ lblMessage.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
+ lblMessage.setText("message");
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(btnOk)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnCancel))
+ .addComponent(lblMessage, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(lblMessage)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btnCancel)
+ .addComponent(btnOk))
+ .addContainerGap())
+ );
+
+ pack();
+ }// //GEN-END:initComponents
+
+ private void btnOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOkActionPerformed
+ this.setVisible(false);
+ }//GEN-LAST:event_btnOkActionPerformed
+
+ private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed
+ this.setVisible(false);
+ }//GEN-LAST:event_btnCancelActionPerformed
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnCancel;
+ private javax.swing.JButton btnOk;
+ private javax.swing.JScrollPane jScrollPane1;
+ private javax.swing.JLabel lblMessage;
+ private javax.swing.JList lstChoices;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/Mage.Client/src/mage/client/dialog/PickNumberDialog.form b/Mage.Client/src/mage/client/dialog/PickNumberDialog.form
new file mode 100644
index 00000000000..eaaab5b6613
--- /dev/null
+++ b/Mage.Client/src/mage/client/dialog/PickNumberDialog.form
@@ -0,0 +1,76 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/dialog/PickNumberDialog.java b/Mage.Client/src/mage/client/dialog/PickNumberDialog.java
new file mode 100644
index 00000000000..8eafd783c07
--- /dev/null
+++ b/Mage.Client/src/mage/client/dialog/PickNumberDialog.java
@@ -0,0 +1,144 @@
+/*
+* 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.
+*/
+
+/*
+ * PickNumberDialog.java
+ *
+ * Created on Feb 25, 2010, 12:03:39 PM
+ */
+
+package mage.client.dialog;
+
+import javax.swing.SpinnerNumberModel;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class PickNumberDialog extends MageDialog {
+
+ private boolean cancel;
+
+ /** Creates new form PickNumberDialog */
+ public PickNumberDialog() {
+ initComponents();
+ this.setModal(true);
+ }
+
+ public void showDialog(int min, int max) {
+ this.spnAmount.setModel(new SpinnerNumberModel(min, min, max, 1));
+ this.btnCancel.setVisible(false);
+ this.setVisible(true);
+ }
+
+ public int getAmount() {
+ return ((Number)spnAmount.getValue()).intValue();
+ }
+
+ public boolean isCancel() {
+ return cancel;
+ }
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ spnAmount = new javax.swing.JSpinner();
+ btnCancel = new javax.swing.JButton();
+ btnOk = new javax.swing.JButton();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+
+ spnAmount.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(1), null, null, Integer.valueOf(1)));
+
+ btnCancel.setText("Cancel");
+ btnCancel.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnCancelActionPerformed(evt);
+ }
+ });
+
+ btnOk.setText("OK");
+ btnOk.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnOkActionPerformed(evt);
+ }
+ });
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(btnOk)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnCancel)
+ .addContainerGap())
+ .addGroup(layout.createSequentialGroup()
+ .addGap(61, 61, 61)
+ .addComponent(spnAmount, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(51, Short.MAX_VALUE))
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(spnAmount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btnCancel)
+ .addComponent(btnOk))
+ .addContainerGap())
+ );
+
+ pack();
+ }// //GEN-END:initComponents
+
+ private void btnOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOkActionPerformed
+ this.cancel = false;
+ this.setVisible(false);
+ }//GEN-LAST:event_btnOkActionPerformed
+
+ private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed
+ this.cancel = true;
+ this.setVisible(false);
+ }//GEN-LAST:event_btnCancelActionPerformed
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnCancel;
+ private javax.swing.JButton btnOk;
+ private javax.swing.JSpinner spnAmount;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/Mage.Client/src/mage/client/dialog/QuestionDialog.form b/Mage.Client/src/mage/client/dialog/QuestionDialog.form
new file mode 100644
index 00000000000..aa03e839ee4
--- /dev/null
+++ b/Mage.Client/src/mage/client/dialog/QuestionDialog.form
@@ -0,0 +1,75 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/dialog/QuestionDialog.java b/Mage.Client/src/mage/client/dialog/QuestionDialog.java
new file mode 100644
index 00000000000..89e080ab10d
--- /dev/null
+++ b/Mage.Client/src/mage/client/dialog/QuestionDialog.java
@@ -0,0 +1,137 @@
+/*
+* 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.
+*/
+
+
+/*
+ * QuestionDialog.java
+ *
+ * Created on Dec 23, 2009, 11:01:32 AM
+ */
+
+package mage.client.dialog;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class QuestionDialog extends MageDialog {
+
+ private boolean answer;
+
+ /** Creates new form QuestionDialog */
+ public QuestionDialog() {
+ initComponents();
+ }
+
+ public void showDialog(String question) {
+ this.lblQuestion.setText(question);
+ this.setModal(true);
+ this.setVisible(true);
+ }
+
+ public boolean getAnswer() {
+ return answer;
+ }
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ lblQuestion = new javax.swing.JLabel();
+ btnNo = new javax.swing.JButton();
+ btnYes = new javax.swing.JButton();
+
+ lblQuestion.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
+ lblQuestion.setText("question");
+
+ btnNo.setText("No");
+ btnNo.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnNoActionPerformed(evt);
+ }
+ });
+
+ btnYes.setText("Yes");
+ btnYes.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnYesActionPerformed(evt);
+ }
+ });
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(lblQuestion, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 207, Short.MAX_VALUE)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(btnYes)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnNo)))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(lblQuestion, javax.swing.GroupLayout.DEFAULT_SIZE, 35, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btnNo)
+ .addComponent(btnYes))
+ .addContainerGap())
+ );
+
+ pack();
+ }// //GEN-END:initComponents
+
+ private void btnYesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnYesActionPerformed
+ this.answer = true;
+ this.setVisible(false);
+ }//GEN-LAST:event_btnYesActionPerformed
+
+ private void btnNoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNoActionPerformed
+ this.answer = false;
+ this.setVisible(false);
+ }//GEN-LAST:event_btnNoActionPerformed
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnNo;
+ private javax.swing.JButton btnYes;
+ private javax.swing.JLabel lblQuestion;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/Mage.Client/src/mage/client/dialog/ShowCardsDialog.form b/Mage.Client/src/mage/client/dialog/ShowCardsDialog.form
new file mode 100644
index 00000000000..2ad48ee4cad
--- /dev/null
+++ b/Mage.Client/src/mage/client/dialog/ShowCardsDialog.form
@@ -0,0 +1,42 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/dialog/ShowCardsDialog.java b/Mage.Client/src/mage/client/dialog/ShowCardsDialog.java
new file mode 100644
index 00000000000..e9009788f5f
--- /dev/null
+++ b/Mage.Client/src/mage/client/dialog/ShowCardsDialog.java
@@ -0,0 +1,148 @@
+/*
+* 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.
+*/
+
+/*
+ * ShowCardsDialog.java
+ *
+ * Created on 3-Feb-2010, 8:59:11 PM
+ */
+
+package mage.client.dialog;
+
+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.Collection;
+import java.util.UUID;
+import javax.swing.JLayeredPane;
+import mage.client.MageFrame;
+import mage.client.cards.BigCard;
+import mage.client.cards.Card;
+import mage.view.CardView;
+import mage.view.CardsView;
+import static mage.client.util.Constants.*;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class ShowCardsDialog extends MageDialog implements MouseListener {
+
+ /** Creates new form ShowCardsDialog */
+ public ShowCardsDialog() {
+ initComponents();
+ this.setModal(false);
+ }
+
+ public void loadCards(String name, CardsView showCards, BigCard bigCard, UUID gameId) {
+ this.title = name;
+ cardArea.removeAll();
+ int columns = 1;
+ if (showCards != null && showCards.size() > 0) {
+ Rectangle rectangle = new Rectangle(FRAME_WIDTH, FRAME_HEIGHT);
+ int count = 0;
+ 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);
+ if (count >= 20) {
+ rectangle.translate(FRAME_WIDTH, -400);
+ columns++;
+ count = 0;
+ } else {
+ rectangle.translate(0, 20);
+ count++;
+ }
+ }
+ }
+ 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
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ @SuppressWarnings("unchecked")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jScrollPane1 = new javax.swing.JScrollPane();
+ cardArea = new javax.swing.JLayeredPane();
+
+ setClosable(true);
+ setResizable(true);
+ getContentPane().setLayout(new java.awt.BorderLayout());
+
+ jScrollPane1.setViewportView(cardArea);
+
+ getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);
+
+ pack();
+ }// //GEN-END:initComponents
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JLayeredPane cardArea;
+ private javax.swing.JScrollPane jScrollPane1;
+ // End of variables declaration//GEN-END:variables
+
+ public void mouseClicked(MouseEvent e) {
+ this.setVisible(false);
+ }
+
+ public void mousePressed(MouseEvent e) {
+
+ }
+
+ public void mouseReleased(MouseEvent e) {
+
+ }
+
+ public void mouseEntered(MouseEvent e) {
+
+ }
+
+ public void mouseExited(MouseEvent e) {
+
+ }
+
+
+}
diff --git a/Mage.Client/src/mage/client/dialog/TableWaitingDialog.form b/Mage.Client/src/mage/client/dialog/TableWaitingDialog.form
new file mode 100644
index 00000000000..e69d79a930a
--- /dev/null
+++ b/Mage.Client/src/mage/client/dialog/TableWaitingDialog.form
@@ -0,0 +1,119 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/dialog/TableWaitingDialog.java b/Mage.Client/src/mage/client/dialog/TableWaitingDialog.java
new file mode 100644
index 00000000000..f39dc83c346
--- /dev/null
+++ b/Mage.Client/src/mage/client/dialog/TableWaitingDialog.java
@@ -0,0 +1,311 @@
+/*
+* 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.
+*/
+
+/*
+ * TableWaitingDialog.java
+ *
+ * Created on Dec 16, 2009, 10:27:44 AM
+ */
+
+package mage.client.dialog;
+
+import mage.client.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Observable;
+import java.util.Observer;
+import java.util.UUID;
+import java.util.logging.Logger;
+import javax.swing.Timer;
+import javax.swing.table.AbstractTableModel;
+import mage.Constants.TableState;
+import mage.client.remote.Session;
+import mage.util.Logging;
+import mage.view.SeatView;
+import mage.view.TableView;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class TableWaitingDialog extends MageDialog implements Observer {
+
+ private final static Logger logger = Logging.getLogger(TableWaitingDialog.class.getName());
+
+ private UUID tableId;
+ private UUID roomId;
+ private Session session;
+ private TableWaitModel tableWaitModel;
+ private SeatsWatchdog seatsWatchdog = new SeatsWatchdog();
+
+ /** Creates new form TableWaitingDialog */
+ public TableWaitingDialog() {
+
+ session = MageFrame.getSession();
+ tableWaitModel = new TableWaitModel();
+
+ initComponents();
+
+ tableSeats.createDefaultColumnsFromModel();
+ }
+
+ public void update(Observable arg0, Object arg1) {
+ TableView table = session.getTable(roomId, tableId);
+ if (table != null) {
+ if (table.getTableState() == TableState.STARTING) {
+ this.btnStart.setEnabled(true);
+ } else {
+ this.btnStart.setEnabled(false);
+ }
+ tableWaitModel.loadData(table);
+ this.tableSeats.repaint();
+ }
+ else {
+ closeDialog();
+ }
+ }
+
+ public void showDialog(UUID roomId, UUID tableId) {
+ this.roomId = roomId;
+ this.tableId = tableId;
+ session = MageFrame.getSession();
+ if (session.isTableOwner(roomId, tableId)) {
+ this.btnStart.setVisible(true);
+ this.btnMoveDown.setVisible(true);
+ this.btnMoveUp.setVisible(true);
+ } else {
+ this.btnStart.setVisible(false);
+ this.btnMoveDown.setVisible(false);
+ this.btnMoveUp.setVisible(false);
+ }
+ UUID chatId = session.getTableChatId(tableId);
+ if (chatId != null) {
+ this.chatPanel.connect(chatId);
+ seatsWatchdog.addObserver(this);
+ this.setModal(true);
+ this.setVisible(true);
+ }
+ else {
+ closeDialog();
+ }
+ }
+
+ public void closeDialog() {
+ seatsWatchdog.deleteObservers();
+ this.chatPanel.disconnect();
+ setVisible(false);
+ }
+
+
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ btnMoveUp = new javax.swing.JButton();
+ btnMoveDown = new javax.swing.JButton();
+ btnCancel = new javax.swing.JButton();
+ btnStart = new javax.swing.JButton();
+ jSplitPane1 = new javax.swing.JSplitPane();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ tableSeats = new javax.swing.JTable();
+ chatPanel = new mage.client.chat.ChatPanel();
+
+ btnMoveUp.setText("Move Up");
+
+ btnMoveDown.setText("Move Down");
+
+ btnCancel.setText("Cancel");
+ btnCancel.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnCancelActionPerformed(evt);
+ }
+ });
+
+ btnStart.setText("Start");
+ btnStart.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnStartActionPerformed(evt);
+ }
+ });
+
+ jSplitPane1.setDividerLocation(450);
+ jSplitPane1.setDividerSize(3);
+ jSplitPane1.setResizeWeight(1.0);
+
+ tableSeats.setModel(tableWaitModel);
+ jScrollPane1.setViewportView(tableSeats);
+
+ jSplitPane1.setLeftComponent(jScrollPane1);
+ jSplitPane1.setRightComponent(chatPanel);
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(btnMoveDown)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnMoveUp)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 232, Short.MAX_VALUE)
+ .addComponent(btnStart)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnCancel)
+ .addContainerGap())
+ .addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 550, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 223, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btnMoveDown)
+ .addComponent(btnMoveUp)
+ .addComponent(btnCancel)
+ .addComponent(btnStart))
+ .addContainerGap())
+ );
+
+ pack();
+ }// //GEN-END:initComponents
+
+ private void btnStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnStartActionPerformed
+ closeDialog();
+ session.startGame(roomId, tableId);
+ }//GEN-LAST:event_btnStartActionPerformed
+
+ private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed
+ if (session.isTableOwner(roomId, tableId)) {
+ session.removeTable(roomId, tableId);
+ } else {
+ session.leaveTable(roomId, tableId);
+ }
+ closeDialog();
+ }//GEN-LAST:event_btnCancelActionPerformed
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnCancel;
+ private javax.swing.JButton btnMoveDown;
+ private javax.swing.JButton btnMoveUp;
+ private javax.swing.JButton btnStart;
+ private mage.client.chat.ChatPanel chatPanel;
+ private javax.swing.JScrollPane jScrollPane1;
+ private javax.swing.JSplitPane jSplitPane1;
+ private javax.swing.JTable tableSeats;
+ // End of variables declaration//GEN-END:variables
+
+}
+
+class TableWaitModel extends AbstractTableModel {
+ private String[] columnNames = new String[]{"Seat Num", "Player Id", "Name", "Player Type"};
+ private SeatView[] seats = new SeatView[0];
+
+
+ public void loadData(TableView table) {
+ seats = table.getSeats().toArray(new SeatView[0]);
+ this.fireTableDataChanged();
+ }
+
+ @Override
+ public int getRowCount() {
+ return seats.length;
+ }
+
+ @Override
+ public int getColumnCount() {
+ return columnNames.length;
+ }
+
+ @Override
+ public Object getValueAt(int arg0, int arg1) {
+ if (seats[arg0].getPlayerId() == null) {
+ if (arg1 == 0) {
+ return Integer.toString(arg0 + 1);
+ }
+ }
+ else {
+ switch (arg1) {
+ case 0:
+ return Integer.toString(arg0 + 1);
+ case 1:
+ return seats[arg0].getPlayerId().toString();
+ case 2:
+ return seats[arg0].getPlayerName();
+ case 3:
+ return seats[arg0].getPlayerType();
+ }
+ }
+ return "";
+ }
+
+ @Override
+ public String getColumnName(int columnIndex) {
+ String colName = "";
+
+ if (columnIndex <= getColumnCount())
+ colName = columnNames[columnIndex];
+
+ return colName;
+ }
+
+ @Override
+ public Class getColumnClass(int columnIndex){
+ return String.class;
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ if (columnIndex != 4)
+ return false;
+ return true;
+ }
+
+}
+
+class SeatsWatchdog extends Observable implements ActionListener {
+
+ Timer t = new Timer(1000, this); // check every second
+
+ public SeatsWatchdog() {
+ t.start();
+ }
+
+ public void actionPerformed(ActionEvent arg0) {
+ setChanged();
+ notifyObservers();
+ }
+
+}
\ No newline at end of file
diff --git a/Mage.Client/src/mage/client/game/AbilityPicker.java b/Mage.Client/src/mage/client/game/AbilityPicker.java
new file mode 100644
index 00000000000..a4e3617eb60
--- /dev/null
+++ b/Mage.Client/src/mage/client/game/AbilityPicker.java
@@ -0,0 +1,85 @@
+/*
+* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are
+* permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of
+* conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice, this list
+* of conditions and the following disclaimer in the documentation and/or other materials
+* provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+* The views and conclusions contained in the software and documentation are those of the
+* authors and should not be interpreted as representing official policies, either expressed
+* or implied, of BetaSteward_at_googlemail.com.
+*/
+
+package mage.client.game;
+
+import java.awt.Point;
+import java.awt.event.ActionEvent;
+import java.util.Map.Entry;
+import java.util.UUID;
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JPopupMenu;
+import mage.client.remote.Session;
+import mage.view.AbilityPickerView;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class AbilityPicker extends JPopupMenu {
+
+ private Session session;
+ private UUID gameId;
+
+ public AbilityPicker() {
+ }
+
+ public void init(Session session, UUID gameId) {
+ this.session = session;
+ this.gameId = gameId;
+ }
+
+ public void show(AbilityPickerView choices, Point p) {
+ this.removeAll();
+ for (Entry choice: choices.getChoices().entrySet()) {
+ this.add(new AbilityPickerAction(choice.getKey(), choice.getValue()));
+ }
+ this.setLocation(p);
+ this.setVisible(true);
+ }
+
+ private class AbilityPickerAction extends AbstractAction {
+
+ private static final long serialVersionUID = 1L;
+ private UUID id;
+
+ public AbilityPickerAction(UUID id, String choice) {
+ this.id = id;
+ putValue(Action.NAME, choice);
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ session.sendPlayerUUID(gameId, id);
+ setVisible(false);
+ }
+
+ }
+
+}
diff --git a/Mage.Client/src/mage/client/game/BattlefieldPanel.form b/Mage.Client/src/mage/client/game/BattlefieldPanel.form
new file mode 100644
index 00000000000..9c3d3fbde2d
--- /dev/null
+++ b/Mage.Client/src/mage/client/game/BattlefieldPanel.form
@@ -0,0 +1,20 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/game/BattlefieldPanel.java b/Mage.Client/src/mage/client/game/BattlefieldPanel.java
new file mode 100644
index 00000000000..3b309299524
--- /dev/null
+++ b/Mage.Client/src/mage/client/game/BattlefieldPanel.java
@@ -0,0 +1,207 @@
+/*
+* 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.
+*/
+
+/*
+ * BattlefieldPanel.java
+ *
+ * Created on 10-Jan-2010, 10:43:14 PM
+ */
+
+package mage.client.game;
+
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Rectangle;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ComponentListener;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.UUID;
+import mage.client.cards.BigCard;
+import mage.client.cards.Permanent;
+import mage.view.PermanentView;
+import static mage.client.util.Constants.*;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class BattlefieldPanel extends javax.swing.JPanel implements ComponentListener {
+
+ private Map permanents = new HashMap();
+ private UUID gameId;
+ private BigCard bigCard;
+
+ /** Creates new form BattlefieldPanel */
+ public BattlefieldPanel() {
+ initComponents();
+ }
+
+ public void init(UUID gameId, BigCard bigCard) {
+ this.gameId = gameId;
+ this.bigCard = bigCard;
+ }
+
+ public void update(Map battlefield) {
+ for (PermanentView permanent: battlefield.values()) {
+ if (!permanents.containsKey(permanent.getId())) {
+ addPermanent(permanent);
+ }
+ else {
+ permanents.get(permanent.getId()).update(permanent);
+ }
+ }
+ for (Iterator> i = permanents.entrySet().iterator(); i.hasNext();) {
+ Entry entry = i.next();
+ if (!battlefield.containsKey(entry.getKey())) {
+ removePermanent(entry.getKey());
+ i.remove();
+ }
+ }
+ for (PermanentView permanent: battlefield.values()) {
+ if (permanent.getAttachments() != null) {
+ groupAttachments(permanent);
+ }
+ }
+ }
+
+ private void addPermanent(PermanentView permanent) {
+ Permanent perm = new Permanent(permanent, bigCard, gameId);
+ perm.addComponentListener(this);
+ perm.setBounds(findEmptySpace(new Dimension(FRAME_WIDTH, FRAME_HEIGHT)));
+ permanents.put(permanent.getId(), perm);
+ this.add(perm);
+ perm.update(permanent);
+ }
+
+ private void groupAttachments(PermanentView permanent) {
+ Permanent perm = permanents.get(permanent.getId());
+ perm.getLinks().clear();
+ Rectangle r = perm.getBounds();
+ for (UUID attachmentId: permanent.getAttachments()) {
+ Permanent link = permanents.get(attachmentId);
+ perm.getLinks().add(link);
+ r.translate(20, 20);
+ link.setBounds(r);
+ }
+ }
+
+ private void removePermanent(UUID permanentId) {
+ for (Component comp: this.getComponents()) {
+ if (comp instanceof Permanent) {
+ if (((Permanent)comp).getPermanentId().equals(permanentId)) {
+ this.remove(comp);
+ }
+ }
+ }
+ }
+
+ private Rectangle findEmptySpace(Dimension size) {
+ int battlefieldWidth = this.getWidth();
+ Rectangle r = new Rectangle(size);
+ boolean intersects;
+ while (true) {
+ intersects = false;
+ for (Permanent perm: permanents.values()) {
+ Rectangle pr = perm.getBounds();
+ if (r.intersects(pr)) {
+ intersects = true;
+ if (pr.x + pr.width + r.width > battlefieldWidth)
+ r.setLocation(0, pr.y + pr.height + 1);
+ else
+ r.translate(pr.x + pr.width - r.x, 0);
+ break;
+ }
+ }
+ if (!intersects)
+ break;
+ }
+ return r;
+ }
+
+ @Override
+ public boolean isOptimizedDrawingEnabled () {
+ return false;
+ }
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ setLayout(null);
+ }// //GEN-END:initComponents
+
+ public void componentResized(ComponentEvent e) {
+ resizeBattlefield();
+ }
+
+ public void componentMoved(ComponentEvent e) {
+ resizeBattlefield();
+ }
+
+ public void componentShown(ComponentEvent e) {
+ resizeBattlefield();
+ }
+
+ public void componentHidden(ComponentEvent e) {
+ resizeBattlefield();
+ }
+
+ private void resizeBattlefield() {
+ 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();
+ }
+
+ }
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/Mage.Client/src/mage/client/game/CombatGroup.form b/Mage.Client/src/mage/client/game/CombatGroup.form
new file mode 100644
index 00000000000..9bd20c54257
--- /dev/null
+++ b/Mage.Client/src/mage/client/game/CombatGroup.form
@@ -0,0 +1,48 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/game/CombatGroup.java b/Mage.Client/src/mage/client/game/CombatGroup.java
new file mode 100644
index 00000000000..da76b1fe7f9
--- /dev/null
+++ b/Mage.Client/src/mage/client/game/CombatGroup.java
@@ -0,0 +1,115 @@
+/*
+* 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.
+*/
+
+/*
+ * CombatGroup.java
+ *
+ * Created on Feb 10, 2010, 3:36:55 PM
+ */
+
+package mage.client.game;
+
+import java.awt.Dimension;
+import java.util.UUID;
+import mage.client.cards.BigCard;
+import mage.view.CombatGroupView;
+import static mage.client.util.Constants.*;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class CombatGroup extends javax.swing.JPanel {
+
+ private UUID gameId;
+ private BigCard bigCard;
+
+ /** Creates new form CombatGroup */
+ public CombatGroup() {
+ initComponents();
+// setPreferredSize(new Dimension(160, 440));
+ }
+
+ public void init(UUID gameId, BigCard bigCard) {
+ this.gameId = gameId;
+ this.bigCard = bigCard;
+ }
+
+ public void update(CombatGroupView combatGroup) {
+ this.lblDefender.setText(combatGroup.getDefenderName());
+ this.attackers.loadCards(combatGroup.getAttackers(), bigCard, gameId);
+ attackers.setPreferredSize(new Dimension(FRAME_WIDTH + 6, FRAME_HEIGHT + 6));
+ this.blockers.loadCards(combatGroup.getBlockers(), bigCard, gameId);
+ blockers.setPreferredSize(new Dimension(FRAME_WIDTH + 6, FRAME_HEIGHT + 6));
+ this.attackers.setVisible(true);
+ this.blockers.setVisible(true);
+ }
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ blockers = new mage.client.cards.Cards();
+ attackers = new mage.client.cards.Cards();
+ lblDefender = new javax.swing.JLabel();
+
+ lblDefender.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
+ lblDefender.setText("jLabel1");
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(lblDefender, javax.swing.GroupLayout.DEFAULT_SIZE, 142, Short.MAX_VALUE)
+ .addComponent(blockers, javax.swing.GroupLayout.DEFAULT_SIZE, 142, Short.MAX_VALUE)
+ .addComponent(attackers, javax.swing.GroupLayout.DEFAULT_SIZE, 142, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(lblDefender)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(blockers, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(0, 0, 0)
+ .addComponent(attackers, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE))
+ );
+ }// //GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private mage.client.cards.Cards attackers;
+ private mage.client.cards.Cards blockers;
+ private javax.swing.JLabel lblDefender;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/Mage.Client/src/mage/client/game/FeedbackPanel.form b/Mage.Client/src/mage/client/game/FeedbackPanel.form
new file mode 100644
index 00000000000..9f1a805b92c
--- /dev/null
+++ b/Mage.Client/src/mage/client/game/FeedbackPanel.form
@@ -0,0 +1,96 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/game/FeedbackPanel.java b/Mage.Client/src/mage/client/game/FeedbackPanel.java
new file mode 100644
index 00000000000..a3d2e5901ca
--- /dev/null
+++ b/Mage.Client/src/mage/client/game/FeedbackPanel.java
@@ -0,0 +1,253 @@
+/*
+* 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.
+*/
+
+/*
+ * FeedbackPanel.java
+ *
+ * Created on 23-Dec-2009, 9:54:01 PM
+ */
+
+package mage.client.game;
+
+import java.awt.AWTEvent;
+import java.awt.ActiveEvent;
+import java.awt.Component;
+import java.awt.EventQueue;
+import java.awt.MenuComponent;
+import java.awt.event.ActionEvent;
+import java.awt.event.MouseEvent;
+import java.util.UUID;
+import java.util.logging.Logger;
+import javax.swing.SwingUtilities;
+import mage.client.MageFrame;
+import mage.client.remote.Session;
+import mage.util.Logging;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class FeedbackPanel extends javax.swing.JPanel {
+
+ private final static Logger logger = Logging.getLogger(FeedbackPanel.class.getName());
+
+ public enum FeedbackMode {
+ INFORM, QUESTION, CONFIRM, CANCEL, SELECT
+ }
+
+ private boolean selected = false;
+ private UUID gameId;
+ private Session session;
+ private FeedbackMode mode;
+
+ /** Creates new form FeedbackPanel */
+ public FeedbackPanel() {
+ initComponents();
+ }
+
+ public void init(UUID gameId) {
+ this.gameId = gameId;
+ session = MageFrame.getSession();
+ }
+
+ public void getFeedback(FeedbackMode mode, String message, boolean modal) {
+ this.lblMessage.setText(message);
+ this.selected = false;
+ this.mode = mode;
+ switch (this.mode) {
+ case INFORM:
+ this.btnLeft.setVisible(false);
+ this.btnRight.setVisible(false);
+ break;
+ case QUESTION:
+ this.btnLeft.setVisible(true);
+ this.btnLeft.setText("Yes");
+ this.btnRight.setVisible(true);
+ this.btnRight.setText("No");
+ break;
+ case CONFIRM:
+ this.btnLeft.setVisible(true);
+ this.btnLeft.setText("OK");
+ this.btnRight.setVisible(true);
+ this.btnRight.setText("Cancel");
+ break;
+ case CANCEL:
+ this.btnLeft.setVisible(false);
+ this.btnRight.setVisible(true);
+ this.btnRight.setText("Cancel");
+ break;
+ case SELECT:
+ this.btnLeft.setVisible(false);
+ this.btnRight.setVisible(true);
+ this.btnRight.setText("Done");
+ break;
+ }
+ if (modal)
+ startModal();
+ this.revalidate();
+ }
+
+ public void clear() {
+ stopModal();
+ this.btnLeft.setVisible(false);
+ this.btnRight.setVisible(false);
+ this.lblMessage.setText("");
+ }
+
+ private synchronized void startModal() {
+
+ try {
+ if (SwingUtilities.isEventDispatchThread()) {
+ EventQueue theQueue = getToolkit().getSystemEventQueue();
+ while (!selected) {
+ AWTEvent event = theQueue.getNextEvent();
+ Object source = event.getSource();
+ boolean dispatch = true;
+
+ if (event instanceof MouseEvent) {
+ MouseEvent e = (MouseEvent) event;
+ MouseEvent m = SwingUtilities.convertMouseEvent((Component) e.getSource(), e, this);
+ if (!this.contains(m.getPoint()) && e.getID() != MouseEvent.MOUSE_DRAGGED) {
+ dispatch = false;
+ }
+ }
+
+ if (dispatch) {
+ if (event instanceof ActiveEvent) {
+ ((ActiveEvent) event).dispatch();
+ } else if (source instanceof Component) {
+ ((Component) source).dispatchEvent(event);
+ } else if (source instanceof MenuComponent) {
+ ((MenuComponent) source).dispatchEvent(event);
+ } else {
+ logger.info("Unable to dispatch: " + event);
+ }
+ }
+ }
+ } else {
+ while (!selected) {
+ wait();
+ }
+ }
+ } catch (InterruptedException ignored) {
+ }
+
+ }
+
+ private synchronized void stopModal() {
+ notifyAll();
+ }
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ btnRight = new javax.swing.JButton();
+ btnLeft = new javax.swing.JButton();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ lblMessage = new javax.swing.JTextArea();
+
+ setBackground(new java.awt.Color(204, 204, 204));
+
+ btnRight.setText("Cancel");
+ btnRight.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnRightActionPerformed(evt);
+ }
+ });
+
+ btnLeft.setText("OK");
+ btnLeft.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnLeftActionPerformed(evt);
+ }
+ });
+
+ jScrollPane1.setBorder(javax.swing.BorderFactory.createEtchedBorder());
+ jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
+
+ lblMessage.setBackground(new java.awt.Color(204, 204, 204));
+ lblMessage.setColumns(20);
+ lblMessage.setEditable(false);
+ lblMessage.setLineWrap(true);
+ lblMessage.setRows(2);
+ lblMessage.setWrapStyleWord(true);
+ lblMessage.setBorder(null);
+ jScrollPane1.setViewportView(lblMessage);
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addContainerGap(106, Short.MAX_VALUE)
+ .addComponent(btnLeft)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnRight))
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 224, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 81, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btnRight)
+ .addComponent(btnLeft)))
+ );
+ }// //GEN-END:initComponents
+
+ private void btnRightActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRightActionPerformed
+ this.selected = true;
+ clear();
+ if (mode == FeedbackMode.SELECT && (evt.getModifiers() & ActionEvent.CTRL_MASK) == ActionEvent.CTRL_MASK)
+ session.sendPlayerInteger(gameId, 0);
+ else
+ session.sendPlayerBoolean(gameId, false);
+ }//GEN-LAST:event_btnRightActionPerformed
+
+ private void btnLeftActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLeftActionPerformed
+ this.selected = true;
+ clear();
+ session.sendPlayerBoolean(gameId, true);
+ }//GEN-LAST:event_btnLeftActionPerformed
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnLeft;
+ private javax.swing.JButton btnRight;
+ private javax.swing.JScrollPane jScrollPane1;
+ private javax.swing.JTextArea lblMessage;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/Mage.Client/src/mage/client/game/GamePane.form b/Mage.Client/src/mage/client/game/GamePane.form
new file mode 100644
index 00000000000..f2f67e79ec2
--- /dev/null
+++ b/Mage.Client/src/mage/client/game/GamePane.form
@@ -0,0 +1,41 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/game/GamePane.java b/Mage.Client/src/mage/client/game/GamePane.java
new file mode 100644
index 00000000000..bb98dfc626d
--- /dev/null
+++ b/Mage.Client/src/mage/client/game/GamePane.java
@@ -0,0 +1,97 @@
+/*
+* 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.
+*/
+
+/*
+ * GamePane.java
+ *
+ * Created on Dec 17, 2009, 9:34:10 AM
+ */
+
+package mage.client.game;
+
+import mage.client.*;
+import java.util.UUID;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class GamePane extends MagePane {
+
+ /** Creates new form GamePane */
+ public GamePane() {
+ initComponents();
+ }
+
+ public void showGame(UUID gameId, UUID playerId) {
+ gamePanel.showGame(gameId, playerId);
+ }
+
+ public void watchGame(UUID gameId) {
+ gamePanel.watchGame(gameId);
+ }
+
+ public void replayGame(UUID gameId) {
+ gamePanel.replayGame(gameId);
+ }
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jScrollPane1 = new javax.swing.JScrollPane();
+ gamePanel = new mage.client.game.GamePanel();
+
+ jScrollPane1.setViewportView(gamePanel);
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 894, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 651, Short.MAX_VALUE)
+ );
+
+ pack();
+ }// //GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private mage.client.game.GamePanel gamePanel;
+ private javax.swing.JScrollPane jScrollPane1;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/Mage.Client/src/mage/client/game/GamePanel.form b/Mage.Client/src/mage/client/game/GamePanel.form
new file mode 100644
index 00000000000..c2479912d30
--- /dev/null
+++ b/Mage.Client/src/mage/client/game/GamePanel.form
@@ -0,0 +1,430 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/game/GamePanel.java b/Mage.Client/src/mage/client/game/GamePanel.java
new file mode 100644
index 00000000000..f1d6d1aea9e
--- /dev/null
+++ b/Mage.Client/src/mage/client/game/GamePanel.java
@@ -0,0 +1,597 @@
+/*
+* 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.
+*/
+
+/*
+ * GamePanel.java
+ *
+ * Created on Dec 16, 2009, 9:29:58 AM
+ */
+
+package mage.client.game;
+
+import java.awt.MouseInfo;
+import java.util.logging.Level;
+import mage.client.*;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+import java.util.logging.Logger;
+import javax.swing.JLayeredPane;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import mage.cards.decks.DeckCardLists;
+import mage.client.dialog.CombatDialog;
+import mage.client.dialog.ExileZoneDialog;
+import mage.client.dialog.PickChoiceDialog;
+import mage.client.dialog.PickNumberDialog;
+import mage.client.dialog.ShowCardsDialog;
+import mage.client.game.FeedbackPanel.FeedbackMode;
+import mage.client.remote.GameClientImpl;
+import mage.client.remote.GameReplayClientImpl;
+import mage.client.remote.Session;
+import mage.interfaces.GameClient;
+import mage.interfaces.GameReplayClient;
+import mage.util.Logging;
+import mage.view.AbilityPickerView;
+import mage.view.CardsView;
+import mage.view.ExileView;
+import mage.view.GameView;
+import mage.view.PlayerView;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class GamePanel extends javax.swing.JPanel {
+
+ private final static Logger logger = Logging.getLogger(GamePanel.class.getName());
+
+ private Map players = new HashMap();
+ private Map exiles = new HashMap();
+ private UUID gameId;
+ private GameClient gameClient;
+ private GameReplayClient replayClient;
+ private Session session;
+ private CombatDialog combat = new CombatDialog();
+
+ /** Creates new form GamePanel */
+ public GamePanel() {
+ initComponents();
+ }
+
+ public void showGame(UUID gameId, UUID playerId) {
+ this.gameId = gameId;
+ session = MageFrame.getSession();
+ gameClient = new GameClientImpl(this);
+ this.feedbackPanel.init(gameId);
+ this.feedbackPanel.clear();
+ this.abilityPicker.init(session, gameId);
+ this.btnConcede.setVisible(true);
+ this.pnlReplay.setVisible(false);
+ this.btnStopWatching.setVisible(false);
+ this.setVisible(true);
+ this.chatPanel.connect(session.getGameChatId(gameId));
+ if (!session.joinGame(gameId, gameClient))
+ hideGame();
+ }
+
+ public void watchGame(UUID gameId) {
+ this.gameId = gameId;
+ gameClient = new GameClientImpl(this);
+ this.feedbackPanel.init(gameId);
+ this.feedbackPanel.clear();
+ this.btnConcede.setVisible(false);
+ this.btnStopWatching.setVisible(true);
+ this.pnlReplay.setVisible(false);
+ this.setVisible(true);
+ this.chatPanel.connect(session.getGameChatId(gameId));
+ if (!session.watchGame(gameId, gameClient))
+ hideGame();
+ }
+
+ public void replayGame(UUID gameId) {
+ this.gameId = gameId;
+ replayClient = new GameReplayClientImpl(this);
+ this.feedbackPanel.clear();
+ this.btnConcede.setVisible(false);
+ this.btnStopWatching.setVisible(false);
+ this.pnlReplay.setVisible(true);
+ this.setVisible(true);
+ if (!session.replayGame(gameId, replayClient))
+ hideGame();
+ }
+
+ public void hideGame() {
+ this.chatPanel.disconnect();
+ this.players.clear();
+ this.pnlBattlefield.removeAll();
+
+ this.setVisible(false);
+ }
+
+ public void init(GameView game) {
+ combat.init(gameId, bigCard);
+ MageFrame.getDesktop().add(combat, JLayeredPane.PALETTE_LAYER);
+ this.players.clear();
+ this.pnlBattlefield.removeAll();
+ for (PlayerView player: game.getPlayers()) {
+ PlayAreaPanel playerPanel = new PlayAreaPanel(player, bigCard, gameId);
+ players.put(player.getPlayerId(), playerPanel);
+ this.pnlBattlefield.add(playerPanel);
+ playerPanel.setVisible(true);
+ }
+ updateGame(game);
+ }
+
+ public void updateGame(GameView game) {
+ if (game.getHand() != null)
+ this.hand.loadCards(game.getHand(), bigCard, gameId);
+ else
+ this.hand.setVisible(false);
+ if (game.getPhase() != null)
+ this.txtPhase.setText(game.getPhase().toString());
+ if (game.getStep() != null)
+ this.txtStep.setText(game.getStep().toString());
+ this.txtActivePlayer.setText(game.getActivePlayerName());
+ this.txtPriority.setText(game.getPriorityPlayerName());
+ this.txtTurn.setText(Integer.toString(game.getTurn()));
+ for (PlayerView player: game.getPlayers()) {
+ players.get(player.getPlayerId()).update(player);
+ }
+ this.stack.loadCards(game.getStack(), bigCard, gameId);
+ for (ExileView exile: game.getExile()) {
+ if (!exiles.containsKey(exile.getId())) {
+ ExileZoneDialog newExile = new ExileZoneDialog();
+ exiles.put(exile.getId(), newExile);
+ }
+ exiles.get(exile.getId()).loadCards(exile, bigCard, gameId);
+ }
+ if (game.getCombat().size() > 0) {
+ combat.showDialog(game.getCombat());
+ }
+ else {
+ combat.hideDialog();
+ }
+ this.revalidate();
+ this.repaint();
+ }
+
+ public void ask(String question) {
+ this.feedbackPanel.getFeedback(FeedbackMode.QUESTION, question, true);
+ }
+
+ public void inform(String information, CardsView cardView, GameView gameView) {
+ updateGame(gameView);
+ if (cardView != null && cardView.size() > 0) {
+ showCards(information, cardView);
+ }
+ this.feedbackPanel.getFeedback(FeedbackMode.INFORM, information, false);
+ }
+
+ public void cancel(String message, CardsView cardView, GameView gameView) {
+ updateGame(gameView);
+ if (cardView != null && cardView.size() > 0) {
+ showCards(message, cardView);
+ }
+ this.feedbackPanel.getFeedback(FeedbackMode.CANCEL, message, false);
+ }
+
+ public void modalMessage(String message) {
+ JOptionPane.showMessageDialog(this, message, "", JOptionPane.INFORMATION_MESSAGE);
+ }
+
+ public int modalQuestion(String message, String title) {
+ return JOptionPane.showConfirmDialog(this, message, title, JOptionPane.YES_NO_OPTION);
+ }
+
+ public JPanel getHand() {
+ return hand;
+ }
+
+ public void select(String message, GameView gameView) {
+ updateGame(gameView);
+ this.feedbackPanel.getFeedback(FeedbackMode.SELECT, message, false);
+ }
+
+ public void playMana(String message, GameView gameView) {
+ updateGame(gameView);
+ this.feedbackPanel.getFeedback(FeedbackMode.CANCEL, message, false);
+ }
+
+ public void playXMana(String message, GameView gameView) {
+ updateGame(gameView);
+ this.feedbackPanel.getFeedback(FeedbackMode.CONFIRM, message, false);
+ }
+
+ public void replayMessage(String message) {
+ //TODO: implement this
+ }
+
+ public void pickAbility(AbilityPickerView choices) {
+ this.abilityPicker.show(choices, MouseInfo.getPointerInfo().getLocation());
+ }
+
+ public void revealCards(String name, CardsView cards) {
+ ShowCardsDialog showCards = new ShowCardsDialog();
+ MageFrame.getDesktop().add(showCards);
+ showCards.loadCards(name, cards, bigCard, gameId);
+ }
+
+ private void showCards(String title, CardsView cards) {
+ ShowCardsDialog showCards = new ShowCardsDialog();
+ showCards.loadCards(title, cards, bigCard, gameId);
+ }
+
+ public void getAmount(int min, int max) {
+ PickNumberDialog pickNumber = new PickNumberDialog();
+ pickNumber.showDialog(min, max);
+ if (pickNumber.isCancel())
+ session.sendPlayerBoolean(gameId, false);
+ else
+ session.sendPlayerInteger(gameId, pickNumber.getAmount());
+ }
+
+ public void getChoice(String message, String[] choices) {
+ PickChoiceDialog pickChoice = new PickChoiceDialog();
+ pickChoice.showDialog(message, choices);
+ session.sendPlayerString(gameId, pickChoice.getChoice());
+ }
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ abilityPicker = new mage.client.game.AbilityPicker();
+ jSplitPane1 = new javax.swing.JSplitPane();
+ jPanel3 = new javax.swing.JPanel();
+ pnlGameInfo = new javax.swing.JPanel();
+ lblPhase = new javax.swing.JLabel();
+ txtPhase = new javax.swing.JLabel();
+ lblStep = new javax.swing.JLabel();
+ txtStep = new javax.swing.JLabel();
+ lblTurn = new javax.swing.JLabel();
+ txtTurn = new javax.swing.JLabel();
+ txtActivePlayer = new javax.swing.JLabel();
+ lblActivePlayer = new javax.swing.JLabel();
+ txtPriority = new javax.swing.JLabel();
+ lblPriority = new javax.swing.JLabel();
+ feedbackPanel = new mage.client.game.FeedbackPanel();
+ btnConcede = new javax.swing.JButton();
+ btnStopWatching = new javax.swing.JButton();
+ bigCard = new mage.client.cards.BigCard();
+ stack = new mage.client.cards.Cards();
+ btnCheat = new javax.swing.JButton();
+ pnlReplay = new javax.swing.JPanel();
+ btnStopReplay = new javax.swing.JButton();
+ btnPreviousPlay = new javax.swing.JButton();
+ btnNextPlay = new javax.swing.JButton();
+ pnlHand = new javax.swing.JPanel();
+ hand = new mage.client.cards.Cards();
+ pnlBattlefield = new javax.swing.JPanel();
+ chatPanel = new mage.client.chat.ChatPanel();
+
+ jSplitPane1.setDividerLocation(1000);
+ jSplitPane1.setDividerSize(3);
+ jSplitPane1.setResizeWeight(1.0);
+
+ pnlGameInfo.setBorder(javax.swing.BorderFactory.createEtchedBorder());
+
+ lblPhase.setLabelFor(txtPhase);
+ lblPhase.setText("Phase:");
+
+ txtPhase.setText("Phase");
+ txtPhase.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(153, 153, 153), 1, true));
+ txtPhase.setMinimumSize(new java.awt.Dimension(0, 16));
+
+ lblStep.setLabelFor(txtStep);
+ lblStep.setText("Step:");
+
+ txtStep.setText("Step");
+ txtStep.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(153, 153, 153), 1, true));
+ txtStep.setMinimumSize(new java.awt.Dimension(0, 16));
+
+ lblTurn.setLabelFor(txtTurn);
+ lblTurn.setText("Turn:");
+
+ txtTurn.setText("Turn");
+ txtTurn.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(153, 153, 153), 1, true));
+ txtTurn.setMinimumSize(new java.awt.Dimension(0, 16));
+
+ txtActivePlayer.setText("Active Player");
+ txtActivePlayer.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(153, 153, 153), 1, true));
+ txtActivePlayer.setMinimumSize(new java.awt.Dimension(0, 16));
+
+ lblActivePlayer.setLabelFor(txtActivePlayer);
+ lblActivePlayer.setText("Active Player:");
+
+ txtPriority.setText("Priority Player");
+ txtPriority.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(153, 153, 153), 1, true));
+ txtPriority.setMinimumSize(new java.awt.Dimension(0, 16));
+
+ lblPriority.setLabelFor(txtPriority);
+ lblPriority.setText("Priority Player:");
+
+ feedbackPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
+ feedbackPanel.setMaximumSize(new java.awt.Dimension(208, 121));
+ feedbackPanel.setMinimumSize(new java.awt.Dimension(208, 121));
+
+ btnConcede.setText("Concede");
+ btnConcede.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnConcedeActionPerformed(evt);
+ }
+ });
+
+ btnStopWatching.setText("Stop Watching");
+ btnStopWatching.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnStopWatchingActionPerformed(evt);
+ }
+ });
+
+ btnCheat.setText("?");
+ btnCheat.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnCheatActionPerformed(evt);
+ }
+ });
+
+ btnStopReplay.setText("Stop");
+ btnStopReplay.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnStopReplayActionPerformed(evt);
+ }
+ });
+
+ btnPreviousPlay.setText("Previous");
+ btnPreviousPlay.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnPreviousPlayActionPerformed(evt);
+ }
+ });
+
+ btnNextPlay.setText("Next");
+ btnNextPlay.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnNextPlayActionPerformed(evt);
+ }
+ });
+
+ javax.swing.GroupLayout pnlReplayLayout = new javax.swing.GroupLayout(pnlReplay);
+ pnlReplay.setLayout(pnlReplayLayout);
+ pnlReplayLayout.setHorizontalGroup(
+ pnlReplayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(pnlReplayLayout.createSequentialGroup()
+ .addComponent(btnStopReplay)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnPreviousPlay)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnNextPlay))
+ );
+ pnlReplayLayout.setVerticalGroup(
+ pnlReplayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(pnlReplayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btnStopReplay)
+ .addComponent(btnPreviousPlay)
+ .addComponent(btnNextPlay))
+ );
+
+ javax.swing.GroupLayout pnlGameInfoLayout = new javax.swing.GroupLayout(pnlGameInfo);
+ pnlGameInfo.setLayout(pnlGameInfoLayout);
+ pnlGameInfoLayout.setHorizontalGroup(
+ pnlGameInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(pnlGameInfoLayout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(pnlGameInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(lblPriority)
+ .addComponent(lblPhase)
+ .addComponent(lblStep)
+ .addComponent(lblTurn)
+ .addComponent(lblActivePlayer))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(pnlGameInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(txtActivePlayer, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
+ .addComponent(txtPriority, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
+ .addComponent(txtTurn, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
+ .addComponent(txtStep, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
+ .addComponent(txtPhase, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE))
+ .addContainerGap())
+ .addGroup(pnlGameInfoLayout.createSequentialGroup()
+ .addGap(10, 10, 10)
+ .addComponent(btnConcede)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnStopWatching)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(btnCheat)
+ .addContainerGap(19, Short.MAX_VALUE))
+ .addComponent(bigCard, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)
+ .addComponent(feedbackPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)
+ .addComponent(stack, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE)
+ .addGroup(pnlGameInfoLayout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(pnlReplay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(51, Short.MAX_VALUE))
+ );
+ pnlGameInfoLayout.setVerticalGroup(
+ pnlGameInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(pnlGameInfoLayout.createSequentialGroup()
+ .addGroup(pnlGameInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblPhase)
+ .addComponent(txtPhase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(3, 3, 3)
+ .addGroup(pnlGameInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblStep)
+ .addComponent(txtStep, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(3, 3, 3)
+ .addGroup(pnlGameInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblTurn)
+ .addComponent(txtTurn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(3, 3, 3)
+ .addGroup(pnlGameInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblActivePlayer)
+ .addComponent(txtActivePlayer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(3, 3, 3)
+ .addGroup(pnlGameInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblPriority)
+ .addComponent(txtPriority, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(feedbackPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(0, 0, 0)
+ .addComponent(stack, javax.swing.GroupLayout.PREFERRED_SIZE, 209, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(0, 0, 0)
+ .addComponent(bigCard, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(pnlReplay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(pnlGameInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btnConcede)
+ .addComponent(btnStopWatching)
+ .addComponent(btnCheat)))
+ );
+
+ pnlHand.setBorder(javax.swing.BorderFactory.createEtchedBorder());
+
+ javax.swing.GroupLayout pnlHandLayout = new javax.swing.GroupLayout(pnlHand);
+ pnlHand.setLayout(pnlHandLayout);
+ pnlHandLayout.setHorizontalGroup(
+ pnlHandLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(hand, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 735, Short.MAX_VALUE)
+ );
+ pnlHandLayout.setVerticalGroup(
+ pnlHandLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(hand, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 209, Short.MAX_VALUE)
+ );
+
+ pnlBattlefield.setLayout(new java.awt.GridLayout(0, 1));
+
+ javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
+ jPanel3.setLayout(jPanel3Layout);
+ jPanel3Layout.setHorizontalGroup(
+ jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel3Layout.createSequentialGroup()
+ .addComponent(pnlGameInfo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(0, 0, 0)
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(pnlHand, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(pnlBattlefield, javax.swing.GroupLayout.DEFAULT_SIZE, 739, Short.MAX_VALUE)))
+ );
+ jPanel3Layout.setVerticalGroup(
+ jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
+ .addComponent(pnlBattlefield, javax.swing.GroupLayout.DEFAULT_SIZE, 632, Short.MAX_VALUE)
+ .addGap(0, 0, 0)
+ .addComponent(pnlHand, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addComponent(pnlGameInfo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ );
+
+ jSplitPane1.setLeftComponent(jPanel3);
+ jSplitPane1.setRightComponent(chatPanel);
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1078, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 847, Short.MAX_VALUE)
+ );
+ }// //GEN-END:initComponents
+
+ private void btnConcedeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConcedeActionPerformed
+ if (modalQuestion("Are you sure you want to concede?", "Confirm concede") == JOptionPane.YES_OPTION) {
+ session.concedeGame(gameId);
+ }
+ }//GEN-LAST:event_btnConcedeActionPerformed
+
+ private void btnStopWatchingActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnStopWatchingActionPerformed
+ if (modalQuestion("Are you sure you want to stop watching?", "Stop watching") == JOptionPane.YES_OPTION) {
+ session.stopWatching(gameId, ((GameClientImpl)gameClient).getIdLocal());
+ }
+ }//GEN-LAST:event_btnStopWatchingActionPerformed
+
+ private void btnStopReplayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnStopReplayActionPerformed
+ if (modalQuestion("Are you sure you want to stop replay?", "Stop replay") == JOptionPane.YES_OPTION) {
+ session.stopReplay();
+ }
+ }//GEN-LAST:event_btnStopReplayActionPerformed
+
+ private void btnNextPlayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNextPlayActionPerformed
+ session.nextPlay();
+ }//GEN-LAST:event_btnNextPlayActionPerformed
+
+ private void btnPreviousPlayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPreviousPlayActionPerformed
+ session.previousPlay();
+ }//GEN-LAST:event_btnPreviousPlayActionPerformed
+
+ private void btnCheatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCheatActionPerformed
+ try {
+ session.cheat(gameId, DeckCardLists.load("cheat.dck"));
+ } catch (Exception ex) {
+ logger.log(Level.SEVERE, null, ex);
+ }
+ }//GEN-LAST:event_btnCheatActionPerformed
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private mage.client.game.AbilityPicker abilityPicker;
+ private mage.client.cards.BigCard bigCard;
+ private javax.swing.JButton btnCheat;
+ private javax.swing.JButton btnConcede;
+ private javax.swing.JButton btnNextPlay;
+ private javax.swing.JButton btnPreviousPlay;
+ private javax.swing.JButton btnStopReplay;
+ private javax.swing.JButton btnStopWatching;
+ private mage.client.chat.ChatPanel chatPanel;
+ private mage.client.game.FeedbackPanel feedbackPanel;
+ private mage.client.cards.Cards hand;
+ private javax.swing.JPanel jPanel3;
+ private javax.swing.JSplitPane jSplitPane1;
+ private javax.swing.JLabel lblActivePlayer;
+ private javax.swing.JLabel lblPhase;
+ private javax.swing.JLabel lblPriority;
+ private javax.swing.JLabel lblStep;
+ private javax.swing.JLabel lblTurn;
+ private javax.swing.JPanel pnlBattlefield;
+ private javax.swing.JPanel pnlGameInfo;
+ private javax.swing.JPanel pnlHand;
+ private javax.swing.JPanel pnlReplay;
+ private mage.client.cards.Cards stack;
+ private javax.swing.JLabel txtActivePlayer;
+ private javax.swing.JLabel txtPhase;
+ private javax.swing.JLabel txtPriority;
+ private javax.swing.JLabel txtStep;
+ private javax.swing.JLabel txtTurn;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/Mage.Client/src/mage/client/game/ManaPool.form b/Mage.Client/src/mage/client/game/ManaPool.form
new file mode 100644
index 00000000000..b0619238725
--- /dev/null
+++ b/Mage.Client/src/mage/client/game/ManaPool.form
@@ -0,0 +1,174 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/game/ManaPool.java b/Mage.Client/src/mage/client/game/ManaPool.java
new file mode 100644
index 00000000000..309e5706c27
--- /dev/null
+++ b/Mage.Client/src/mage/client/game/ManaPool.java
@@ -0,0 +1,189 @@
+/*
+* 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.
+*/
+
+/*
+ * ManaPool.java
+ *
+ * Created on Dec 22, 2009, 9:52:00 AM
+ */
+
+package mage.client.game;
+
+import mage.view.ManaPoolView;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class ManaPool extends javax.swing.JPanel {
+
+ /** Creates new form ManaPool */
+ public ManaPool() {
+ initComponents();
+ }
+
+ public void update(ManaPoolView pool) {
+ this.btnBlack.setText(Integer.toString(pool.getBlack()));
+ this.btnRed.setText(Integer.toString(pool.getRed()));
+ this.btnWhite.setText(Integer.toString(pool.getWhite()));
+ this.btnGreen.setText(Integer.toString(pool.getGreen()));
+ this.btnBlue.setText(Integer.toString(pool.getBlue()));
+ this.btnColorless.setText(Integer.toString(pool.getColorless()));
+ }
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ lblBlack = new javax.swing.JLabel();
+ btnBlack = new javax.swing.JButton();
+ btnBlue = new javax.swing.JButton();
+ lblBlue = new javax.swing.JLabel();
+ lblGreen = new javax.swing.JLabel();
+ btnGreen = new javax.swing.JButton();
+ btnColorless = new javax.swing.JButton();
+ lblWhite = new javax.swing.JLabel();
+ lblColorless = new javax.swing.JLabel();
+ btnWhite = new javax.swing.JButton();
+ btnRed = new javax.swing.JButton();
+ lblRed = new javax.swing.JLabel();
+
+ lblBlack.setLabelFor(btnBlack);
+ lblBlack.setText("Black");
+
+ btnBlack.setText("0");
+
+ btnBlue.setText("0");
+
+ lblBlue.setLabelFor(btnBlack);
+ lblBlue.setText("Blue");
+
+ lblGreen.setLabelFor(btnBlack);
+ lblGreen.setText("Green");
+
+ btnGreen.setText("0");
+
+ btnColorless.setText("0");
+
+ lblWhite.setLabelFor(btnBlack);
+ lblWhite.setText("White");
+
+ lblColorless.setLabelFor(btnBlack);
+ lblColorless.setText("Colorless");
+
+ btnWhite.setText("0");
+
+ btnRed.setText("0");
+
+ lblRed.setLabelFor(btnBlack);
+ lblRed.setText("Red");
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(lblGreen)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 18, Short.MAX_VALUE)
+ .addComponent(btnGreen, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(lblColorless)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(btnColorless, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(lblWhite)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 19, Short.MAX_VALUE)
+ .addComponent(btnWhite, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(lblRed)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE)
+ .addComponent(btnRed, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(lblBlack)
+ .addComponent(lblBlue))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 23, Short.MAX_VALUE)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(btnBlack, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(btnBlue, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblBlack)
+ .addComponent(btnBlack, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(1, 1, 1)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btnBlue, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(lblBlue))
+ .addGap(1, 1, 1)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblGreen)
+ .addComponent(btnGreen, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(1, 1, 1)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblRed)
+ .addComponent(btnRed, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(1, 1, 1)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblWhite)
+ .addComponent(btnWhite, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(1, 1, 1)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblColorless)
+ .addComponent(btnColorless, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ );
+ }// //GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnBlack;
+ private javax.swing.JButton btnBlue;
+ private javax.swing.JButton btnColorless;
+ private javax.swing.JButton btnGreen;
+ private javax.swing.JButton btnRed;
+ private javax.swing.JButton btnWhite;
+ private javax.swing.JLabel lblBlack;
+ private javax.swing.JLabel lblBlue;
+ private javax.swing.JLabel lblColorless;
+ private javax.swing.JLabel lblGreen;
+ private javax.swing.JLabel lblRed;
+ private javax.swing.JLabel lblWhite;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/Mage.Client/src/mage/client/game/PlayAreaPanel.form b/Mage.Client/src/mage/client/game/PlayAreaPanel.form
new file mode 100644
index 00000000000..7c38b0f3dba
--- /dev/null
+++ b/Mage.Client/src/mage/client/game/PlayAreaPanel.form
@@ -0,0 +1,90 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/game/PlayAreaPanel.java b/Mage.Client/src/mage/client/game/PlayAreaPanel.java
new file mode 100644
index 00000000000..ffc6db906a5
--- /dev/null
+++ b/Mage.Client/src/mage/client/game/PlayAreaPanel.java
@@ -0,0 +1,142 @@
+/*
+* 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.
+*/
+
+/*
+ * PlayAreaPanel.java
+ *
+ * Created on Dec 22, 2009, 10:41:54 AM
+ */
+
+package mage.client.game;
+
+import java.util.UUID;
+import mage.client.cards.BigCard;
+import mage.view.PlayerView;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class PlayAreaPanel extends javax.swing.JPanel {
+
+
+ /** Creates new form PlayAreaPanel */
+ public PlayAreaPanel() {
+ initComponents();
+ }
+
+ public PlayAreaPanel(PlayerView player, BigCard bigCard, UUID gameId) {
+ this();
+ init(player, bigCard, gameId);
+ update(player);
+ }
+
+ public void init(PlayerView player, BigCard bigCard, UUID gameId) {
+ this.playerPanel.init(gameId, player.getPlayerId(), bigCard);
+ this.battlefieldPanel.init(gameId, bigCard);
+ }
+
+ public void update(PlayerView player) {
+ this.playerPanel.update(player);
+ this.manaPool.update(player.getManaPool());
+ this.battlefieldPanel.update(player.getBattlefield());
+ }
+
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jPanel1 = new javax.swing.JPanel();
+ playerPanel = new mage.client.game.PlayerPanel();
+ manaPool = new mage.client.game.ManaPool();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ battlefieldPanel = new mage.client.game.BattlefieldPanel();
+
+ jPanel1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
+
+ javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
+ jPanel1.setLayout(jPanel1Layout);
+ jPanel1Layout.setHorizontalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(manaPool, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE)
+ .addComponent(playerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ );
+ jPanel1Layout.setVerticalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addComponent(playerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(0, 0, 0)
+ .addComponent(manaPool, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(64, Short.MAX_VALUE))
+ );
+
+ javax.swing.GroupLayout battlefieldPanelLayout = new javax.swing.GroupLayout(battlefieldPanel);
+ battlefieldPanel.setLayout(battlefieldPanelLayout);
+ battlefieldPanelLayout.setHorizontalGroup(
+ battlefieldPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 522, Short.MAX_VALUE)
+ );
+ battlefieldPanelLayout.setVerticalGroup(
+ battlefieldPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 300, Short.MAX_VALUE)
+ );
+
+ jScrollPane1.setViewportView(battlefieldPanel);
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(0, 0, 0)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 524, Short.MAX_VALUE))
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 302, Short.MAX_VALUE)
+ );
+ }// //GEN-END:initComponents
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private mage.client.game.BattlefieldPanel battlefieldPanel;
+ private javax.swing.JPanel jPanel1;
+ private javax.swing.JScrollPane jScrollPane1;
+ private mage.client.game.ManaPool manaPool;
+ private mage.client.game.PlayerPanel playerPanel;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/Mage.Client/src/mage/client/game/PlayerPanel.form b/Mage.Client/src/mage/client/game/PlayerPanel.form
new file mode 100644
index 00000000000..a1141f257f8
--- /dev/null
+++ b/Mage.Client/src/mage/client/game/PlayerPanel.form
@@ -0,0 +1,156 @@
+
+
+
diff --git a/Mage.Client/src/mage/client/game/PlayerPanel.java b/Mage.Client/src/mage/client/game/PlayerPanel.java
new file mode 100644
index 00000000000..23aacef53d1
--- /dev/null
+++ b/Mage.Client/src/mage/client/game/PlayerPanel.java
@@ -0,0 +1,208 @@
+/*
+* 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.
+*/
+
+/*
+ * PlayerPanel.java
+ *
+ * Created on Nov 18, 2009, 3:01:31 PM
+ */
+
+package mage.client.game;
+
+import java.util.UUID;
+import mage.client.MageFrame;
+import mage.client.cards.BigCard;
+import mage.client.dialog.ShowCardsDialog;
+import mage.client.remote.Session;
+import mage.view.PlayerView;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class PlayerPanel extends javax.swing.JPanel {
+
+ private UUID playerId;
+ private UUID gameId;
+ private Session session;
+ private PlayerView player;
+
+ private ShowCardsDialog graveyard;
+ private BigCard bigCard;
+
+ /** Creates new form PlayerPanel */
+ public PlayerPanel() {
+ initComponents();
+ }
+
+ public void init(UUID gameId, UUID playerId, BigCard bigCard) {
+ this.gameId = gameId;
+ this.playerId = playerId;
+ this.bigCard = bigCard;
+ session = MageFrame.getSession();
+ }
+
+ public void update(PlayerView player) {
+ this.player = player;
+ this.txtLife.setText(Integer.toString(player.getLife()));
+ this.txtHand.setText(Integer.toString(player.getHandCount()));
+ this.txtLibrary.setText(Integer.toString(player.getLibraryCount()));
+ this.btnGrave.setText(Integer.toString(player.getGraveyard().size()));
+ this.btnPlayerName.setText(player.getName());
+ }
+
+ /** 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ btnPlayerName = new javax.swing.JButton();
+ lblLife = new javax.swing.JLabel();
+ lblLibrary = new javax.swing.JLabel();
+ lblHand = new javax.swing.JLabel();
+ txtLife = new javax.swing.JLabel();
+ txtLibrary = new javax.swing.JLabel();
+ txtHand = new javax.swing.JLabel();
+ lblGrave = new javax.swing.JLabel();
+ btnGrave = new javax.swing.JButton();
+
+ setName("Form"); // NOI18N
+
+ btnPlayerName.setText("Player Name"); // NOI18N
+ btnPlayerName.setName("btnPlayerName"); // NOI18N
+ btnPlayerName.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnPlayerNameActionPerformed(evt);
+ }
+ });
+
+ lblLife.setLabelFor(txtLife);
+ lblLife.setText("Life:"); // NOI18N
+ lblLife.setName("lblLife"); // NOI18N
+
+ lblLibrary.setLabelFor(txtLibrary);
+ lblLibrary.setText("Library:"); // NOI18N
+ lblLibrary.setName("lblLibrary"); // NOI18N
+
+ lblHand.setLabelFor(txtHand);
+ lblHand.setText("Hand:"); // NOI18N
+ lblHand.setName("lblHand"); // NOI18N
+
+ txtLife.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
+ txtLife.setName("txtLife"); // NOI18N
+
+ txtLibrary.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
+ txtLibrary.setName("txtLibrary"); // NOI18N
+
+ txtHand.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
+ txtHand.setName("txtHand"); // NOI18N
+
+ lblGrave.setLabelFor(btnGrave);
+ lblGrave.setText("Grave:"); // NOI18N
+ lblGrave.setName("lblGrave"); // NOI18N
+
+ btnGrave.setName("btnGrave"); // NOI18N
+ btnGrave.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnGraveActionPerformed(evt);
+ }
+ });
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+ this.setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(lblLife, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 42, Short.MAX_VALUE)
+ .addComponent(lblGrave, javax.swing.GroupLayout.DEFAULT_SIZE, 42, Short.MAX_VALUE)
+ .addComponent(lblHand, javax.swing.GroupLayout.DEFAULT_SIZE, 42, Short.MAX_VALUE)
+ .addComponent(lblLibrary, javax.swing.GroupLayout.DEFAULT_SIZE, 42, Short.MAX_VALUE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(txtLife, javax.swing.GroupLayout.DEFAULT_SIZE, 48, Short.MAX_VALUE)
+ .addComponent(txtLibrary, javax.swing.GroupLayout.DEFAULT_SIZE, 48, Short.MAX_VALUE)
+ .addComponent(txtHand, javax.swing.GroupLayout.DEFAULT_SIZE, 48, Short.MAX_VALUE)
+ .addComponent(btnGrave, javax.swing.GroupLayout.DEFAULT_SIZE, 48, Short.MAX_VALUE))
+ .addContainerGap())
+ .addComponent(btnPlayerName, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(btnPlayerName, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(txtLife, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(lblLife, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(txtLibrary, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(lblLibrary, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(txtHand, javax.swing.GroupLayout.DEFAULT_SIZE, 14, Short.MAX_VALUE)
+ .addComponent(lblHand))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(lblGrave)
+ .addComponent(btnGrave, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addContainerGap())
+ );
+ }// //GEN-END:initComponents
+
+ private void btnPlayerNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPlayerNameActionPerformed
+ session.sendPlayerUUID(gameId, playerId);
+ }//GEN-LAST:event_btnPlayerNameActionPerformed
+
+ private void btnGraveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGraveActionPerformed
+ if (graveyard == null) {
+ graveyard = new ShowCardsDialog();
+ }
+ graveyard.loadCards(player.getName() + " graveyard", player.getGraveyard(), bigCard, gameId);
+ }//GEN-LAST:event_btnGraveActionPerformed
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnGrave;
+ private javax.swing.JButton btnPlayerName;
+ private javax.swing.JLabel lblGrave;
+ private javax.swing.JLabel lblHand;
+ private javax.swing.JLabel lblLibrary;
+ private javax.swing.JLabel lblLife;
+ private javax.swing.JLabel txtHand;
+ private javax.swing.JLabel txtLibrary;
+ private javax.swing.JLabel txtLife;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/Mage.Client/src/mage/client/remote/ClientImpl.java b/Mage.Client/src/mage/client/remote/ClientImpl.java
new file mode 100644
index 00000000000..eb2cd31ef44
--- /dev/null
+++ b/Mage.Client/src/mage/client/remote/ClientImpl.java
@@ -0,0 +1,97 @@
+/*
+* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are
+* permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of
+* conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice, this list
+* of conditions and the following disclaimer in the documentation and/or other materials
+* provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+* The views and conclusions contained in the software and documentation are those of the
+* authors and should not be interpreted as representing official policies, either expressed
+* or implied, of BetaSteward_at_googlemail.com.
+*/
+
+package mage.client.remote;
+
+import java.io.Serializable;
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+import java.util.UUID;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import mage.client.MageFrame;
+import mage.interfaces.Client;
+import mage.util.Logging;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class ClientImpl implements Client, Serializable {
+
+ private final static Logger logger = Logging.getLogger(ClientImpl.class.getName());
+
+ private UUID clientId;
+ private String userName;
+ private MageFrame frame;
+
+ public ClientImpl(MageFrame frame, String userName) {
+
+ this.clientId = UUID.randomUUID();
+ this.userName = userName;
+ this.frame = frame;
+ try {
+ UnicastRemoteObject.exportObject(this, 0);
+ } catch (RemoteException ex) {
+ logger.log(Level.SEVERE, null, ex);
+ }
+
+ }
+
+ @Override
+ public UUID getId() throws RemoteException {
+ return clientId;
+ }
+
+ @Override
+ public UUID getPlayerId() throws RemoteException {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void gameStarted(UUID gameId, UUID playerId) throws RemoteException {
+ frame.showGame(gameId, playerId);
+ logger.info("Game client started for player " + playerId);
+ }
+
+ @Override
+ public String getUserName() throws RemoteException {
+ return userName;
+ }
+
+ @Override
+ public void watchGame(UUID gameId) throws RemoteException {
+ frame.watchGame(gameId);
+ }
+
+ @Override
+ public void replayGame(UUID gameId) throws RemoteException {
+ frame.replayGame(gameId);
+ }
+
+}
diff --git a/Mage.Client/src/mage/client/remote/GameClientImpl.java b/Mage.Client/src/mage/client/remote/GameClientImpl.java
new file mode 100644
index 00000000000..ea80ecbdd04
--- /dev/null
+++ b/Mage.Client/src/mage/client/remote/GameClientImpl.java
@@ -0,0 +1,151 @@
+/*
+* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are
+* permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of
+* conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice, this list
+* of conditions and the following disclaimer in the documentation and/or other materials
+* provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+* The views and conclusions contained in the software and documentation are those of the
+* authors and should not be interpreted as representing official policies, either expressed
+* or implied, of BetaSteward_at_googlemail.com.
+*/
+
+package mage.client.remote;
+
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+import java.util.UUID;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import mage.client.game.GamePanel;
+import mage.interfaces.GameClient;
+import mage.interfaces.MageException;
+import mage.util.Logging;
+import mage.view.AbilityPickerView;
+import mage.view.CardsView;
+import mage.view.GameView;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class GameClientImpl implements GameClient {
+
+ private final static Logger logger = Logging.getLogger(GameClientImpl.class.getName());
+
+ private UUID gameClientId;
+ private GamePanel gamePanel;
+
+ public GameClientImpl(GamePanel gamePanel) {
+ gameClientId = UUID.randomUUID();
+ this.gamePanel = gamePanel;
+ try {
+ UnicastRemoteObject.exportObject(this, 0);
+ } catch (RemoteException ex) {
+ logger.log(Level.SEVERE, null, ex);
+ }
+ }
+
+ @Override
+ public synchronized UUID getId() throws RemoteException {
+ return gameClientId;
+ }
+
+ public UUID getIdLocal() {
+ return gameClientId;
+ }
+
+ @Override
+ public synchronized void update(GameView gameView) throws RemoteException {
+ logger.info("Received update event for game");
+ gamePanel.updateGame(gameView);
+ }
+
+ @Override
+ public synchronized void init(GameView gameView) throws RemoteException {
+ gamePanel.init(gameView);
+ }
+
+ @Override
+ public synchronized void ask(String question, GameView gameView) throws RemoteException {
+ gamePanel.updateGame(gameView);
+ gamePanel.ask(question);
+ }
+
+ @Override
+ public synchronized void inform(String message, GameView gameView) throws RemoteException {
+ gamePanel.inform(message, null, gameView);
+ }
+
+ @Override
+ public synchronized void target(String message, CardsView cardView, boolean required, GameView gameView) throws RemoteException {
+ if (required) {
+ gamePanel.inform(message, cardView, gameView);
+ } else {
+ gamePanel.cancel(message, cardView, gameView);
+ }
+ }
+
+ @Override
+ public synchronized void gameOver(String message) throws RemoteException {
+ gamePanel.modalMessage(message);
+ gamePanel.hideGame();
+ }
+
+ @Override
+ public synchronized void select(String message, GameView gameView) throws RemoteException {
+ gamePanel.select(message, gameView);
+ }
+
+ @Override
+ public synchronized void playMana(String message, GameView gameView) throws RemoteException {
+ gamePanel.playMana(message, gameView);
+ }
+
+ @Override
+ public synchronized void playXMana(String message, GameView gameView) throws RemoteException {
+ gamePanel.playXMana(message, gameView);
+ }
+
+ @Override
+ public synchronized void chooseAbility(AbilityPickerView abilities) throws RemoteException {
+ gamePanel.pickAbility(abilities);
+ }
+
+ public void handleException(Exception ex) throws MageException {
+ logger.log(Level.SEVERE, "", ex);
+ throw new MageException("Server error");
+ }
+
+ @Override
+ public synchronized void revealCards(String name, CardsView cards) throws RemoteException {
+ gamePanel.revealCards(name, cards);
+ }
+
+ @Override
+ public synchronized void getAmount(int min, int max) throws RemoteException {
+ gamePanel.getAmount(min, max);
+ }
+
+ @Override
+ public synchronized void choose(String message, String[] choices) throws RemoteException {
+ gamePanel.getChoice(message, choices);
+ }
+
+}
diff --git a/Mage.Client/src/mage/client/remote/GameReplayClientImpl.java b/Mage.Client/src/mage/client/remote/GameReplayClientImpl.java
new file mode 100644
index 00000000000..71c18a76832
--- /dev/null
+++ b/Mage.Client/src/mage/client/remote/GameReplayClientImpl.java
@@ -0,0 +1,87 @@
+/*
+* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are
+* permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of
+* conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice, this list
+* of conditions and the following disclaimer in the documentation and/or other materials
+* provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+* The views and conclusions contained in the software and documentation are those of the
+* authors and should not be interpreted as representing official policies, either expressed
+* or implied, of BetaSteward_at_googlemail.com.
+*/
+
+package mage.client.remote;
+
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+import java.util.UUID;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import mage.client.game.GamePanel;
+import mage.interfaces.GameReplayClient;
+import mage.util.Logging;
+import mage.view.GameView;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class GameReplayClientImpl implements GameReplayClient {
+
+ private final static Logger logger = Logging.getLogger(GameClientImpl.class.getName());
+
+ private UUID replayClientId;
+ private GamePanel gamePanel;
+
+ public GameReplayClientImpl(GamePanel gamePanel) {
+ replayClientId = UUID.randomUUID();
+ this.gamePanel = gamePanel;
+ try {
+ UnicastRemoteObject.exportObject(this, 0);
+ } catch (RemoteException ex) {
+ logger.log(Level.SEVERE, null, ex);
+ }
+ }
+
+ @Override
+ public UUID getId() throws RemoteException {
+ return replayClientId;
+ }
+
+ @Override
+ public synchronized void update(GameView game) throws RemoteException {
+ gamePanel.updateGame(game);
+ }
+
+ @Override
+ public synchronized void init(GameView gameView) throws RemoteException {
+ gamePanel.init(gameView);
+ }
+
+ @Override
+ public synchronized void gameOver(String message) throws RemoteException {
+ gamePanel.modalMessage(message);
+ gamePanel.hideGame();
+ }
+
+ public synchronized void message(String message) throws RemoteException {
+ gamePanel.replayMessage(message);
+ }
+
+}
diff --git a/Mage.Client/src/mage/client/remote/MageRemoteException.java b/Mage.Client/src/mage/client/remote/MageRemoteException.java
new file mode 100644
index 00000000000..006252fd760
--- /dev/null
+++ b/Mage.Client/src/mage/client/remote/MageRemoteException.java
@@ -0,0 +1,37 @@
+/*
+* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are
+* permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of
+* conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice, this list
+* of conditions and the following disclaimer in the documentation and/or other materials
+* provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+* The views and conclusions contained in the software and documentation are those of the
+* authors and should not be interpreted as representing official policies, either expressed
+* or implied, of BetaSteward_at_googlemail.com.
+*/
+
+package mage.client.remote;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class MageRemoteException extends Exception {
+
+}
diff --git a/Mage.Client/src/mage/client/remote/Session.java b/Mage.Client/src/mage/client/remote/Session.java
new file mode 100644
index 00000000000..d662059bda4
--- /dev/null
+++ b/Mage.Client/src/mage/client/remote/Session.java
@@ -0,0 +1,491 @@
+/*
+* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are
+* permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of
+* conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice, this list
+* of conditions and the following disclaimer in the documentation and/or other materials
+* provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+* The views and conclusions contained in the software and documentation are those of the
+* authors and should not be interpreted as representing official policies, either expressed
+* or implied, of BetaSteward_at_googlemail.com.
+*/
+
+package mage.client.remote;
+
+import java.rmi.NotBoundException;
+import java.rmi.RemoteException;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+import java.util.Collection;
+import java.util.List;
+import java.util.UUID;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.swing.JOptionPane;
+import mage.Constants;
+import mage.cards.decks.DeckCardLists;
+import mage.client.MageFrame;
+import mage.client.util.Config;
+import mage.interfaces.ChatClient;
+import mage.interfaces.Client;
+import mage.interfaces.GameClient;
+import mage.interfaces.GameReplayClient;
+import mage.interfaces.MageException;
+import mage.interfaces.Server;
+import mage.util.Logging;
+import mage.view.TableView;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class Session {
+
+ private final static Logger logger = Logging.getLogger(Session.class.getName());
+
+ private UUID sessionId;
+ private Server server;
+ private Client client;
+ private String userName;
+ private MageFrame frame;
+ private String[] playerTypes;
+ private String[] gameTypes;
+
+ public Session(MageFrame frame) {
+ this.frame = frame;
+ }
+
+ public void connect(String userName, String serverName, int port) throws RemoteException, NotBoundException {
+ if (isConnected()) {
+ disconnect();
+ }
+ this.userName = userName;
+ this.client = new ClientImpl(frame, userName);
+ System.setSecurityManager(null);
+ Registry reg = LocateRegistry.getRegistry(serverName, port);
+ this.server = (Server) reg.lookup(Config.remoteServer);
+ try {
+ sessionId = server.registerClient(client);
+ playerTypes = server.getPlayerTypes();
+ gameTypes = server.getGameTypes();
+ logger.info("Connected to RMI server at " + serverName + ":" + port);
+ frame.enableButtons();
+ } catch (MageException ex) {
+ Logger.getLogger(Session.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+
+ public void disconnect() {
+
+ if (isConnected()) {
+ try {
+ server.deregisterClient(sessionId);
+ server = null;
+ logger.info("Disconnected ... ");
+ } catch (RemoteException ex) {
+ logger.log(Level.SEVERE, "Error disconnecting ...", ex);
+ } catch (MageException ex) {
+ logger.log(Level.SEVERE, "Error disconnecting ...", ex);
+ }
+ }
+ }
+
+ public boolean isConnected() {
+ return server != null;
+ }
+
+ public String[] getPlayerTypes() {
+ return playerTypes;
+ }
+
+ public String[] getGameTypes() {
+ return gameTypes;
+ }
+
+ public UUID getMainRoomId() {
+ try {
+ return server.getMainRoomId();
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return null;
+ }
+
+ public UUID getRoomChatId(UUID roomId) {
+ try {
+ return server.getRoomChatId(roomId);
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return null;
+ }
+
+ public UUID getTableChatId(UUID tableId) {
+ try {
+ return server.getTableChatId(tableId);
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return null;
+ }
+
+ public UUID getGameChatId(UUID gameId) {
+ try {
+ return server.getGameChatId(gameId);
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return null;
+ }
+
+ public TableView getTable(UUID roomId, UUID tableId) {
+ try {
+ return server.getTable(roomId, tableId);
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return null;
+ }
+
+ public boolean watchTable(UUID roomId, UUID tableId) {
+ try {
+ server.watchTable(sessionId, roomId, tableId);
+ return true;
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return false;
+ }
+
+ public boolean replayTable(UUID roomId, UUID tableId) {
+ try {
+ server.replayTable(sessionId, roomId, tableId);
+ return true;
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return false;
+ }
+
+ public boolean joinTable(UUID roomId, UUID tableId, int seat, String playerName, DeckCardLists deckList) {
+ try {
+ return server.joinTable(sessionId, roomId, tableId, seat, playerName, deckList);
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return false;
+ }
+
+ public Collection getTables(UUID roomId) throws MageRemoteException {
+ try {
+ return server.getTables(roomId);
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ throw new MageRemoteException();
+ } catch (MageException ex) {
+ handleMageException(ex);
+ throw new MageRemoteException();
+ }
+ }
+
+ public boolean sendPlayerUUID(UUID gameId, UUID data) {
+ try {
+ server.sendPlayerUUID(gameId, sessionId, data);
+ return true;
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return false;
+ }
+
+ public boolean sendPlayerBoolean(UUID gameId, boolean data) {
+ try {
+ server.sendPlayerBoolean(gameId, sessionId, data);
+ return true;
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return false;
+ }
+
+ public boolean sendPlayerInteger(UUID gameId, int data) {
+ try {
+ server.sendPlayerInteger(gameId, sessionId, data);
+ return true;
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return false;
+ }
+
+ public boolean sendPlayerString(UUID gameId, String data) {
+ try {
+ server.sendPlayerString(gameId, sessionId, data);
+ return true;
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return false;
+ }
+
+ public boolean joinChat(UUID chatId, ChatClient client) {
+ try {
+ server.joinChat(chatId, client);
+ return true;
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return false;
+ }
+
+ public boolean leaveChat(UUID chatId, UUID clientId) {
+ try {
+ server.leaveChat(chatId, clientId);
+ return true;
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return false;
+ }
+
+ public boolean sendChatMessage(UUID chatId, String message) {
+ try {
+ server.sendChatMessage(chatId, userName, message);
+ return true;
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return false;
+ }
+
+ public boolean joinGame(UUID gameId, GameClient gameClient) {
+ try {
+ server.joinGame(gameId, sessionId, gameClient);
+ return true;
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return false;
+ }
+
+ public boolean watchGame(UUID gameId, GameClient gameClient) {
+ try {
+ server.watchGame(gameId, sessionId, gameClient);
+ return true;
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return false;
+ }
+
+ public boolean replayGame(UUID gameId, GameReplayClient replayClient) {
+ try {
+ server.replayGame(gameId, sessionId, replayClient);
+ return true;
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return false;
+ }
+
+ public TableView createTable(UUID roomId, String gameType, Constants.DeckType deckType, List playerTypes) {
+ try {
+ return server.createTable(sessionId, roomId, gameType, deckType, playerTypes);
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return null;
+ }
+
+ public boolean isTableOwner(UUID roomId, UUID tableId) {
+ try {
+ return server.isTableOwner(sessionId, roomId, tableId);
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return false;
+ }
+
+ public boolean removeTable(UUID roomId, UUID tableId) {
+ try {
+ server.removeTable(sessionId, roomId, tableId);
+ return true;
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return false;
+ }
+
+ public boolean leaveTable(UUID roomId, UUID tableId) {
+ try {
+ server.leaveTable(sessionId, roomId, tableId);
+ return true;
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return false;
+ }
+
+ public boolean startGame(UUID roomId, UUID tableId) {
+ try {
+ server.startGame(sessionId, roomId, tableId);
+ return true;
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return false;
+ }
+
+ public boolean concedeGame(UUID gameId) {
+ try {
+ server.concedeGame(gameId, sessionId);
+ return true;
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return false;
+ }
+
+ public boolean stopWatching(UUID gameId, UUID gameClientId) {
+ try {
+ server.stopWatching(gameId, gameClientId);
+ return true;
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return false;
+ }
+
+ public boolean stopReplay() {
+ try {
+ server.stopReplay(sessionId);
+ return true;
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return false;
+ }
+
+ public boolean nextPlay() {
+ try {
+ server.nextPlay(sessionId);
+ return true;
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return false;
+ }
+
+ public boolean previousPlay() {
+ try {
+ server.previousPlay(sessionId);
+ return true;
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return false;
+ }
+
+ public boolean cheat(UUID gameId, DeckCardLists deckList) {
+ try {
+ server.cheat(gameId, sessionId, deckList);
+ return true;
+ } catch (RemoteException ex) {
+ handleRemoteException(ex);
+ } catch (MageException ex) {
+ handleMageException(ex);
+ }
+ return false;
+ }
+
+ private void handleRemoteException(RemoteException ex) {
+ server = null;
+ logger.log(Level.SEVERE, "Connection to server lost", ex);
+ JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Connection to server lost.", "Error", JOptionPane.ERROR_MESSAGE);
+ frame.disableButtons();
+ }
+
+ private void handleMageException(MageException ex) {
+ logger.log(Level.SEVERE, "Server error", ex);
+ JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Critical server error. Disconnecting", "Error", JOptionPane.ERROR_MESSAGE);
+ disconnect();
+ frame.disableButtons();
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+}
\ No newline at end of file
diff --git a/Mage.Client/src/mage/client/util/ButtonColumn.java b/Mage.Client/src/mage/client/util/ButtonColumn.java
new file mode 100644
index 00000000000..fa414eb93a2
--- /dev/null
+++ b/Mage.Client/src/mage/client/util/ButtonColumn.java
@@ -0,0 +1,132 @@
+/*
+* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are
+* permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of
+* conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice, this list
+* of conditions and the following disclaimer in the documentation and/or other materials
+* provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+* The views and conclusions contained in the software and documentation are those of the
+* authors and should not be interpreted as representing official policies, either expressed
+* or implied, of BetaSteward_at_googlemail.com.
+*/
+
+package mage.client.util;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import javax.swing.AbstractCellEditor;
+import javax.swing.Action;
+import javax.swing.JButton;
+import javax.swing.JTable;
+import javax.swing.UIManager;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumnModel;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class ButtonColumn extends AbstractCellEditor implements TableCellRenderer, TableCellEditor, ActionListener, MouseListener {
+
+ private JTable table;
+ private Action action;
+ private JButton renderButton;
+ private JButton editButton;
+ private String text;
+ private boolean isButtonColumnEditor;
+
+ public ButtonColumn(JTable table, Action action, int column) {
+ super();
+ this.table = table;
+ this.action = action;
+ renderButton = new JButton();
+
+ editButton = new JButton();
+ editButton.setFocusPainted(false);
+ editButton.addActionListener(this);
+
+ TableColumnModel columnModel = table.getColumnModel();
+ columnModel.getColumn(column).setCellRenderer(this);
+ columnModel.getColumn(column).setCellEditor(this);
+ table.addMouseListener(this);
+ }
+
+ public Object getCellEditorValue() {
+ return text;
+ }
+
+ public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
+ if (hasFocus)
+ {
+ renderButton.setForeground(table.getForeground());
+ renderButton.setBackground(UIManager.getColor("Button.background"));
+ }
+ else if (isSelected)
+ {
+ renderButton.setForeground(table.getSelectionForeground());
+ renderButton.setBackground(table.getSelectionBackground());
+ }
+ else
+ {
+ renderButton.setForeground(table.getForeground());
+ renderButton.setBackground(UIManager.getColor("Button.background"));
+ }
+
+ renderButton.setText( (value == null) ? "" : value.toString() );
+ return renderButton;
+ }
+
+ public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
+ text = (value == null) ? "" : value.toString();
+ editButton.setText( text );
+ return editButton;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ int row = table.convertRowIndexToModel( table.getEditingRow() );
+ fireEditingStopped();
+ ActionEvent event = new ActionEvent(table, ActionEvent.ACTION_PERFORMED, "" + row);
+ action.actionPerformed(event);
+
+ }
+
+ public void mousePressed(MouseEvent arg0) {
+ if (table.isEditing() && table.getCellEditor() == this)
+ isButtonColumnEditor = true;
+ }
+
+ public void mouseReleased(MouseEvent arg0) {
+ if (isButtonColumnEditor && table.isEditing())
+ table.getCellEditor().stopCellEditing();
+
+ isButtonColumnEditor = false;
+ }
+
+ public void mouseClicked(MouseEvent arg0) {}
+
+ public void mouseEntered(MouseEvent arg0) {}
+
+ public void mouseExited(MouseEvent arg0) {}
+
+
+}
diff --git a/Mage.Client/src/mage/client/util/Config.java b/Mage.Client/src/mage/client/util/Config.java
new file mode 100644
index 00000000000..5c59065db32
--- /dev/null
+++ b/Mage.Client/src/mage/client/util/Config.java
@@ -0,0 +1,87 @@
+/*
+* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are
+* permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of
+* conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice, this list
+* of conditions and the following disclaimer in the documentation and/or other materials
+* provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+* The views and conclusions contained in the software and documentation are those of the
+* authors and should not be interpreted as representing official policies, either expressed
+* or implied, of BetaSteward_at_googlemail.com.
+*/
+
+package mage.client.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import mage.util.Logging;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class Config {
+
+ private final static Logger logger = Logging.getLogger(Config.class.getName());
+
+ public static final String remoteServer;
+ public static final String serverName;
+ public static final int port;
+ public static final String cardsResourcePath;
+ public static final String frameResourcePath;
+ public static final String powerboxResourcePath;
+ public static final String cardArtResourcePath;
+ public static final String symbolsResourcePath;
+ public static final String resourcePath;
+ public static final boolean useResource;
+
+ static {
+ Properties p = new Properties();
+ try {
+ p.load(new FileInputStream(new File("config/config.properties")));
+ } catch (IOException ex) {
+ logger.log(Level.SEVERE, null, ex);
+ }
+ serverName = p.getProperty("server-name");
+ port = Integer.parseInt(p.getProperty("port"));
+ remoteServer = p.getProperty("remote-server");
+ cardsResourcePath = p.getProperty("cards-resource-path");
+ resourcePath = p.getProperty("resource-path");
+ File test = new File(cardsResourcePath);
+ if (test.isDirectory()) {
+ useResource = false;
+ frameResourcePath = cardsResourcePath + "Frame\\";
+ powerboxResourcePath = cardsResourcePath + "PowerBox\\";
+ cardArtResourcePath = cardsResourcePath + "Pics\\";
+ symbolsResourcePath = p.getProperty("symbols-resource-path");
+ }
+ else {
+ useResource = true;
+ frameResourcePath = resourcePath + "cards/frame/";
+ powerboxResourcePath = resourcePath + "cards/powerbox/";
+ cardArtResourcePath = resourcePath + "cards/art/";
+ symbolsResourcePath = resourcePath + "symbols/";
+ }
+ }
+
+}
diff --git a/Mage.Client/src/mage/client/util/Constants.java b/Mage.Client/src/mage/client/util/Constants.java
new file mode 100644
index 00000000000..2d32aab0f36
--- /dev/null
+++ b/Mage.Client/src/mage/client/util/Constants.java
@@ -0,0 +1,88 @@
+/*
+* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are
+* permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of
+* conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice, this list
+* of conditions and the following disclaimer in the documentation and/or other materials
+* provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+* The views and conclusions contained in the software and documentation are those of the
+* authors and should not be interpreted as representing official policies, either expressed
+* or implied, of BetaSteward_at_googlemail.com.
+*/
+
+package mage.client.util;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public final class Constants {
+ private Constants() {
+ throw new AssertionError();
+ }
+
+ public static final int FRAME_MAX_HEIGHT = 367;
+ public static final int FRAME_MAX_WIDTH = 256;
+ public static final int ART_MAX_HEIGHT = 168;
+ public static final int ART_MAX_WIDTH = 227;
+ public static final int SYMBOL_MAX_HEIGHT = 28;
+ public static final int SYMBOL_MAX_WIDTH = 28;
+ public static final int SYMBOL_MAX_XOFFSET = 27;
+ public static final int SYMBOL_MAX_YOFFSET = 15;
+ public static final int SYMBOL_MAX_SPACE = 28;
+ public static final int CONTENT_MAX_XOFFSET = 15;
+ public static final int ART_MAX_YOFFSET = 37;
+ public static final int NAME_MAX_YOFFSET = 27;
+ public static final int TYPE_MAX_YOFFSET = 223;
+ public static final int TEXT_MAX_YOFFSET = 232;
+ public static final int TEXT_MAX_WIDTH = 227;
+ public static final int TEXT_MAX_HEIGHT = 105;
+ public static final int NAME_FONT_MAX_SIZE = 13;
+ public static final int TEXT_FONT_MAX_SIZE = 11;
+ public static final int PARAGRAPH_MAX_SPACING = 4;
+ public static final int POWBOX_MAX_TOP = 336;
+ public static final int POWBOX_MAX_LEFT = 202;
+ public static final int DAMAGE_MAX_LEFT = 180;
+
+ public static final double SCALE_FACTOR = 0.5;
+
+ public static final int FRAME_HEIGHT = (int)(FRAME_MAX_HEIGHT * SCALE_FACTOR);
+ public static final int FRAME_WIDTH = (int)(FRAME_MAX_WIDTH * SCALE_FACTOR);
+ public static final int ART_HEIGHT = (int)(ART_MAX_HEIGHT * SCALE_FACTOR);
+ public static final int ART_WIDTH = (int)(ART_MAX_WIDTH * SCALE_FACTOR);
+ public static final int SYMBOL_HEIGHT = (int)(SYMBOL_MAX_HEIGHT * SCALE_FACTOR);
+ public static final int SYMBOL_WIDTH = (int)(SYMBOL_MAX_WIDTH * SCALE_FACTOR);
+ public static final int SYMBOL_XOFFSET = (int)(SYMBOL_MAX_XOFFSET * SCALE_FACTOR);
+ public static final int SYMBOL_YOFFSET = (int)(SYMBOL_MAX_YOFFSET * SCALE_FACTOR);
+ public static final int SYMBOL_SPACE = (int)(SYMBOL_MAX_SPACE * SCALE_FACTOR);
+ public static final int CONTENT_XOFFSET = (int)(CONTENT_MAX_XOFFSET * SCALE_FACTOR);
+ public static final int ART_YOFFSET = (int)(ART_MAX_YOFFSET * SCALE_FACTOR);
+ public static final int NAME_YOFFSET = (int)(NAME_MAX_YOFFSET * SCALE_FACTOR);
+ public static final int TYPE_YOFFSET = (int)(TYPE_MAX_YOFFSET * SCALE_FACTOR);
+ public static final int TEXT_YOFFSET = (int)(TEXT_MAX_YOFFSET * SCALE_FACTOR);
+ public static final int TEXT_WIDTH = (int)(TEXT_MAX_WIDTH * SCALE_FACTOR);
+ public static final int TEXT_HEIGHT = (int)(TEXT_MAX_HEIGHT * SCALE_FACTOR);
+ public static final int POWBOX_TOP = (int)(POWBOX_MAX_TOP * SCALE_FACTOR);
+ public static final int POWBOX_LEFT = (int)(POWBOX_MAX_LEFT * SCALE_FACTOR);
+ public static final int DAMAGE_LEFT = (int)(DAMAGE_MAX_LEFT * SCALE_FACTOR);
+ public static final int NAME_FONT_SIZE = Math.max(9, (int)(NAME_FONT_MAX_SIZE * SCALE_FACTOR));
+ public static final int TEXT_FONT_SIZE = Math.max(9, (int)(TEXT_FONT_MAX_SIZE * SCALE_FACTOR));
+ public static final int PARAGRAPH_SPACING = (int)(PARAGRAPH_MAX_SPACING * SCALE_FACTOR);
+
+}
diff --git a/Mage.Client/src/mage/client/util/Event.java b/Mage.Client/src/mage/client/util/Event.java
new file mode 100644
index 00000000000..22bb0ea4830
--- /dev/null
+++ b/Mage.Client/src/mage/client/util/Event.java
@@ -0,0 +1,53 @@
+/*
+* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are
+* permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of
+* conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice, this list
+* of conditions and the following disclaimer in the documentation and/or other materials
+* provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+* The views and conclusions contained in the software and documentation are those of the
+* authors and should not be interpreted as representing official policies, either expressed
+* or implied, of BetaSteward_at_googlemail.com.
+*/
+
+package mage.client.util;
+
+import java.io.Serializable;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class Event implements Serializable {
+ private Object source;
+ private String eventName;
+
+ public Event(Object source, String eventName) {
+ this.source = source;
+ this.eventName = eventName;
+ }
+
+ public Object getSource() {
+ return source;
+ }
+
+ public String getEventName() {
+ return eventName;
+ }
+}
diff --git a/Mage.Client/src/mage/client/util/EventDispatcher.java b/Mage.Client/src/mage/client/util/EventDispatcher.java
new file mode 100644
index 00000000000..e4a3de92076
--- /dev/null
+++ b/Mage.Client/src/mage/client/util/EventDispatcher.java
@@ -0,0 +1,62 @@
+/*
+* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are
+* permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of
+* conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice, this list
+* of conditions and the following disclaimer in the documentation and/or other materials
+* provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+* The views and conclusions contained in the software and documentation are those of the
+* authors and should not be interpreted as representing official policies, either expressed
+* or implied, of BetaSteward_at_googlemail.com.
+*/
+
+package mage.client.util;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public abstract class EventDispatcher implements Serializable {
+
+ private List> listeners = new CopyOnWriteArrayList>();
+
+ public void addListener(Listener listener) {
+ if (!listeners.contains(listener)) {
+ listeners.add(listener);
+ }
+ }
+
+ public void removeListener(Listener listener) {
+ listeners.remove(listener);
+ }
+
+ public void fireEvent(E event) {
+ for (Listener listener : listeners) {
+ listener.event(event);
+ }
+ }
+
+ public void clearListeners() {
+ listeners.clear();
+ }
+}
diff --git a/Mage.Client/src/mage/client/util/EventSource.java b/Mage.Client/src/mage/client/util/EventSource.java
new file mode 100644
index 00000000000..6cc851fd48b
--- /dev/null
+++ b/Mage.Client/src/mage/client/util/EventSource.java
@@ -0,0 +1,42 @@
+/*
+* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are
+* permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of
+* conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice, this list
+* of conditions and the following disclaimer in the documentation and/or other materials
+* provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+* The views and conclusions contained in the software and documentation are those of the
+* authors and should not be interpreted as representing official policies, either expressed
+* or implied, of BetaSteward_at_googlemail.com.
+*/
+
+package mage.client.util;
+
+import java.io.Serializable;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public interface EventSource extends Serializable {
+
+ void addListener(Listener listener);
+ void clearListeners();
+
+}
diff --git a/Mage.Client/src/mage/client/util/Frames.java b/Mage.Client/src/mage/client/util/Frames.java
new file mode 100644
index 00000000000..f37b524a878
--- /dev/null
+++ b/Mage.Client/src/mage/client/util/Frames.java
@@ -0,0 +1,60 @@
+/*
+* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are
+* permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of
+* conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice, this list
+* of conditions and the following disclaimer in the documentation and/or other materials
+* provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+* The views and conclusions contained in the software and documentation are those of the
+* authors and should not be interpreted as representing official policies, either expressed
+* or implied, of BetaSteward_at_googlemail.com.
+*/
+
+package mage.client.util;
+
+import java.awt.Image;
+import static mage.client.util.Constants.*;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class Frames {
+
+ public static Image Black = ImageHelper.loadImage(Config.frameResourcePath + "8 black.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
+ public static Image Blue = ImageHelper.loadImage(Config.frameResourcePath + "8 blue.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
+ public static Image Gold = ImageHelper.loadImage(Config.frameResourcePath + "8 gold.png", FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
+ public static Image Green = ImageHelper.loadImage(Config.frameResourcePath + "8 green.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 White = ImageHelper.loadImage(Config.frameResourcePath + "8 white.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 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 Swamp = ImageHelper.loadImage(Config.frameResourcePath + "8 land mana black.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 PowBoxLeft = ImageHelper.loadImage(Config.powerboxResourcePath + "graphic_card_powerbox_a_left.png");
+ public static Image PowBoxMid = ImageHelper.loadImage(Config.powerboxResourcePath + "graphic_card_powerbox_a_middle.png");
+ public static Image PowBoxRight = ImageHelper.loadImage(Config.powerboxResourcePath + "graphic_card_powerbox_a_right.png");
+
+}
diff --git a/Mage.Client/src/mage/client/util/ImageHelper.java b/Mage.Client/src/mage/client/util/ImageHelper.java
new file mode 100644
index 00000000000..9580045d648
--- /dev/null
+++ b/Mage.Client/src/mage/client/util/ImageHelper.java
@@ -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.
+*/
+
+package mage.client.util;
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.RenderingHints;
+import java.awt.image.BufferedImage;
+import java.awt.image.ImageObserver;
+import java.awt.image.MemoryImageSource;
+import java.awt.image.PixelGrabber;
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+import javax.imageio.ImageIO;
+import mage.Constants.CardType;
+import mage.view.CardView;
+import mage.view.StackAbilityView;
+import static mage.client.util.Constants.*;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class ImageHelper {
+ protected static HashMap images = new HashMap();
+ protected static HashMap backgrounds = new HashMap();
+
+ public static Image loadImage(String ref, int width, int height) {
+ Image image = loadImage(ref);
+ if (image != null)
+ return ScaleImage(image, width, height);
+ return null;
+ }
+
+ public static Image loadImage(String ref) {
+ if (!images.containsKey(ref)) {
+ try {
+ if (Config.useResource)
+ images.put(ref, ImageIO.read(ImageHelper.class.getResourceAsStream(ref)));
+ else
+ images.put(ref, ImageIO.read(new File(ref)));
+ } catch (Exception e) {
+ return null;
+ }
+ }
+ return images.get(ref);
+ }
+
+ public static BufferedImage getBackground(CardView card) {
+ // card background should be the same for all cards with the same name/art
+ String cardName = card.getName()+card.getArt();
+ if (backgrounds.containsKey(cardName)) {
+ return backgrounds.get(cardName);
+ }
+
+ BufferedImage background = new BufferedImage(FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT, BufferedImage.TYPE_INT_RGB);
+ Graphics2D g = (Graphics2D) background.getGraphics();
+ g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+ g.setColor(Color.WHITE);
+ g.fillRect(0, 0, FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT);
+ g.drawImage(getFrame(card), 0, 0, Color.WHITE, null);
+ if (!card.getArt().equals("")) {
+ Image art = loadImage(Config.cardArtResourcePath + card.getArt(), ART_MAX_WIDTH, ART_MAX_HEIGHT);
+ g.drawImage(art, CONTENT_MAX_XOFFSET, ART_MAX_YOFFSET, null);
+ }
+
+ if (card.getCardTypes().contains(CardType.CREATURE) || card.getCardTypes().contains(CardType.PLANESWALKER)) {
+ 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.PowBoxRight, POWBOX_MAX_LEFT + 38, POWBOX_MAX_TOP, null);
+ }
+
+ g.dispose();
+
+ backgrounds.put(cardName, background);
+ return background;
+ }
+
+ protected static Image getFrame(CardView card) {
+ if (card instanceof StackAbilityView) {
+ return Frames.Effect;
+ }
+
+ if (card.getCardTypes().contains(CardType.LAND)) {
+ return getLandFrame(card);
+ }
+ else {
+ if (card.getColor().isColorless()) {
+ return Frames.Grey;
+ } else if (card.getColor().isMulticolored()) {
+ return Frames.Gold;
+ } else {
+ if (card.getColor().isBlack()) {
+ return Frames.Black;
+ } else if (card.getColor().isBlue()) {
+ return Frames.Blue;
+ } else if (card.getColor().isRed()) {
+ return Frames.Red;
+ } else if (card.getColor().isGreen()) {
+ return Frames.Green;
+ } else if (card.getColor().isWhite()) {
+ return Frames.White;
+ }
+ }
+ }
+ return Frames.Grey;
+ }
+
+ protected static Image getLandFrame(CardView card) {
+ if (card.getSuperTypes().contains("Basic")) {
+ if (card.getSubTypes().contains("Forest")) {
+ return Frames.Forest;
+ }
+ else if (card.getSubTypes().contains("Island")) {
+ return Frames.Island;
+ }
+ else if (card.getSubTypes().contains("Mountain")) {
+ return Frames.Mountain;
+ }
+ else if (card.getSubTypes().contains("Plains")) {
+ return Frames.Plains;
+ }
+ else if (card.getSubTypes().contains("Swamp")) {
+ return Frames.Swamp;
+ }
+ }
+ return Frames.Grey;
+ }
+
+ public static Image ScaleImage(Image image, int width, int height) {
+ return image.getScaledInstance(width, height, Image.SCALE_SMOOTH);
+ }
+
+ public static MemoryImageSource rotate(Image image) {
+ int buffer[] = new int[FRAME_WIDTH * FRAME_HEIGHT];
+ int rotate[] = new int[FRAME_HEIGHT * FRAME_WIDTH];
+ PixelGrabber grabber = new PixelGrabber(image, 0, 0, FRAME_WIDTH, FRAME_HEIGHT, buffer, 0, FRAME_WIDTH);
+ try {
+ grabber.grabPixels();
+ }
+ catch(InterruptedException e) {
+ e.printStackTrace();
+ }
+ for(int y = 0; y < FRAME_HEIGHT; y++) {
+ for(int x = 0; x < FRAME_WIDTH; x++) {
+ rotate[((FRAME_WIDTH - x - 1) *FRAME_HEIGHT)+y] = buffer[(y*FRAME_WIDTH)+x];
+ }
+ }
+
+ return new MemoryImageSource(FRAME_HEIGHT, FRAME_WIDTH, rotate, 0, FRAME_HEIGHT);
+
+ }
+
+ public static void DrawCosts(List costs, Graphics2D g, int xOffset, int yOffset, ImageObserver o) {
+ if (costs.size() > 0) {
+ int costLeft = xOffset;
+ for (int i = costs.size() - 1; i >= 0; i--) {
+ String symbol = costs.get(i);
+ Image image = Symbols.getSymbol(symbol);
+ if (image != null) {
+ g.drawImage(image, costLeft, yOffset, o);
+ costLeft -= SYMBOL_SPACE;
+ }
+ else {
+ g.drawString(symbol, costLeft, yOffset + SYMBOL_SPACE);
+ costLeft -= SYMBOL_SPACE + 4;
+ }
+ }
+ }
+ }
+
+}
diff --git a/Mage.Client/src/mage/client/util/Listener.java b/Mage.Client/src/mage/client/util/Listener.java
new file mode 100644
index 00000000000..9f9cd5613ef
--- /dev/null
+++ b/Mage.Client/src/mage/client/util/Listener.java
@@ -0,0 +1,39 @@
+/*
+* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are
+* permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of
+* conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice, this list
+* of conditions and the following disclaimer in the documentation and/or other materials
+* provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+* The views and conclusions contained in the software and documentation are those of the
+* authors and should not be interpreted as representing official policies, either expressed
+* or implied, of BetaSteward_at_googlemail.com.
+*/
+
+package mage.client.util;
+
+import java.io.Serializable;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public interface Listener extends Serializable {
+ void event(E event);
+}
diff --git a/Mage.Client/src/mage/client/util/Symbols.java b/Mage.Client/src/mage/client/util/Symbols.java
new file mode 100644
index 00000000000..79024dfb9e2
--- /dev/null
+++ b/Mage.Client/src/mage/client/util/Symbols.java
@@ -0,0 +1,96 @@
+/*
+* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without modification, are
+* permitted provided that the following conditions are met:
+*
+* 1. Redistributions of source code must retain the above copyright notice, this list of
+* conditions and the following disclaimer.
+*
+* 2. Redistributions in binary form must reproduce the above copyright notice, this list
+* of conditions and the following disclaimer in the documentation and/or other materials
+* provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
+* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+* The views and conclusions contained in the software and documentation are those of the
+* authors and should not be interpreted as representing official policies, either expressed
+* or implied, of BetaSteward_at_googlemail.com.
+*/
+
+package mage.client.util;
+
+import java.awt.Image;
+import java.util.HashMap;
+import java.util.Map;
+import static mage.client.util.Constants.*;
+
+/**
+ *
+ * @author BetaSteward_at_googlemail.com
+ */
+public class Symbols {
+
+ public static Map symbols = new HashMap();
+
+ static {
+ symbols.put("{B}", ImageHelper.loadImage(Config.symbolsResourcePath + "mana_black.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{U}", ImageHelper.loadImage(Config.symbolsResourcePath + "mana_blue.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{G}", ImageHelper.loadImage(Config.symbolsResourcePath + "mana_green.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{R}", ImageHelper.loadImage(Config.symbolsResourcePath + "mana_red.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{W}", ImageHelper.loadImage(Config.symbolsResourcePath + "mana_white.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+
+ symbols.put("{0}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_0.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{1}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_1.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{2}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_2.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{3}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_3.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{4}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_4.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{5}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_5.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{6}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_6.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{7}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_7.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{8}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_8.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{9}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_9.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{10}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_10.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{11}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_11.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{12}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_12.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{13}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_13.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{14}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_14.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{15}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_15.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{16}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_16.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{X}", ImageHelper.loadImage(Config.symbolsResourcePath + "colorless_x.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+
+ symbols.put("{B/G}", ImageHelper.loadImage(Config.symbolsResourcePath + "black_green.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{B/R}", ImageHelper.loadImage(Config.symbolsResourcePath + "black_red.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{U/B}", ImageHelper.loadImage(Config.symbolsResourcePath + "blue_black.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{U/R}", ImageHelper.loadImage(Config.symbolsResourcePath + "blue_red.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{G/B}", ImageHelper.loadImage(Config.symbolsResourcePath + "green_blue.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{G/W}", ImageHelper.loadImage(Config.symbolsResourcePath + "green_white.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{R/G}", ImageHelper.loadImage(Config.symbolsResourcePath + "red_green.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{R/W}", ImageHelper.loadImage(Config.symbolsResourcePath + "red_white.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{W/B}", ImageHelper.loadImage(Config.symbolsResourcePath + "white_black.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{W/U}", ImageHelper.loadImage(Config.symbolsResourcePath + "white_blue.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+
+ symbols.put("{2/B}", ImageHelper.loadImage(Config.symbolsResourcePath + "two_black.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{2/U}", ImageHelper.loadImage(Config.symbolsResourcePath + "two_blue.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{2/G}", ImageHelper.loadImage(Config.symbolsResourcePath + "two_green.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{2/R}", ImageHelper.loadImage(Config.symbolsResourcePath + "two_red.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+ symbols.put("{2/W}", ImageHelper.loadImage(Config.symbolsResourcePath + "two_white.png", SYMBOL_WIDTH, SYMBOL_HEIGHT));
+
+ }
+
+ public static Image getSymbol(String symbol) {
+
+ if (symbols.containsKey(symbol))
+ return(symbols.get(symbol));
+ return null;
+
+ }
+}
diff --git a/Mage.Client/src/mage/client/util/resources/config.properties b/Mage.Client/src/mage/client/util/resources/config.properties
new file mode 100644
index 00000000000..7c8e6bc7d45
--- /dev/null
+++ b/Mage.Client/src/mage/client/util/resources/config.properties
@@ -0,0 +1,6 @@
+server-name=localhost
+port=17171
+remote-server=mage-server
+cards-resource-path=resources/images/cards/
+symbols-resource-path=resources/images/symbols/
+resource-path=resources/images/
\ No newline at end of file
diff --git a/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 black.png b/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 black.png
new file mode 100644
index 00000000000..e66069eef5b
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 black.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 blue.png b/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 blue.png
new file mode 100644
index 00000000000..d430c953f27
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 blue.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 gold.png b/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 gold.png
new file mode 100644
index 00000000000..2a681b37a93
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 gold.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 green.png b/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 green.png
new file mode 100644
index 00000000000..a830ccfff6f
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 green.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 grey.png b/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 grey.png
new file mode 100644
index 00000000000..bb4a0b49de0
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 grey.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 land mana black.png b/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 land mana black.png
new file mode 100644
index 00000000000..43f3af173d9
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 land mana black.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 land mana blue.png b/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 land mana blue.png
new file mode 100644
index 00000000000..05e017ac609
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 land mana blue.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 land mana green.png b/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 land mana green.png
new file mode 100644
index 00000000000..4bdb2888b41
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 land mana green.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 land mana red.png b/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 land mana red.png
new file mode 100644
index 00000000000..5f6ca1ebad1
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 land mana red.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 land mana white.png b/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 land mana white.png
new file mode 100644
index 00000000000..05f79e9d57a
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 land mana white.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 red.png b/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 red.png
new file mode 100644
index 00000000000..84417cdb405
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 red.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 white.png b/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 white.png
new file mode 100644
index 00000000000..65fb0651b0c
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/cards/frame/8 white.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/cards/powerbox/graphic_card_powerbox_a_left.png b/Mage.Client/src/mage/client/util/resources/images/cards/powerbox/graphic_card_powerbox_a_left.png
new file mode 100644
index 00000000000..10e5fe68ffb
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/cards/powerbox/graphic_card_powerbox_a_left.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/cards/powerbox/graphic_card_powerbox_a_middle.png b/Mage.Client/src/mage/client/util/resources/images/cards/powerbox/graphic_card_powerbox_a_middle.png
new file mode 100644
index 00000000000..13ec5b46dec
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/cards/powerbox/graphic_card_powerbox_a_middle.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/cards/powerbox/graphic_card_powerbox_a_right.png b/Mage.Client/src/mage/client/util/resources/images/cards/powerbox/graphic_card_powerbox_a_right.png
new file mode 100644
index 00000000000..9cce5967c24
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/cards/powerbox/graphic_card_powerbox_a_right.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/black_green.png b/Mage.Client/src/mage/client/util/resources/images/symbols/black_green.png
new file mode 100644
index 00000000000..97eca8af047
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/black_green.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/black_red.png b/Mage.Client/src/mage/client/util/resources/images/symbols/black_red.png
new file mode 100644
index 00000000000..5f84b0e7094
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/black_red.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/blue_black.png b/Mage.Client/src/mage/client/util/resources/images/symbols/blue_black.png
new file mode 100644
index 00000000000..7e7825a1a29
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/blue_black.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/blue_red.png b/Mage.Client/src/mage/client/util/resources/images/symbols/blue_red.png
new file mode 100644
index 00000000000..b3311455ddc
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/blue_red.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_0.png b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_0.png
new file mode 100644
index 00000000000..9d1e5c7316e
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_0.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_1.png b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_1.png
new file mode 100644
index 00000000000..9121d993140
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_1.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_10.png b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_10.png
new file mode 100644
index 00000000000..776671728cc
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_10.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_11.png b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_11.png
new file mode 100644
index 00000000000..cb67a18c0dc
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_11.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_12.png b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_12.png
new file mode 100644
index 00000000000..635a8fb7c73
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_12.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_13.png b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_13.png
new file mode 100644
index 00000000000..124fc411e4b
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_13.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_14.png b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_14.png
new file mode 100644
index 00000000000..14421a7ac97
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_14.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_15.png b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_15.png
new file mode 100644
index 00000000000..90c66a0ad6c
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_15.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_16.png b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_16.png
new file mode 100644
index 00000000000..359c0b6e086
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_16.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_2.png b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_2.png
new file mode 100644
index 00000000000..dc91d2fe3ff
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_2.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_3.png b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_3.png
new file mode 100644
index 00000000000..2360fb67d02
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_3.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_4.png b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_4.png
new file mode 100644
index 00000000000..5e7fee8e938
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_4.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_5.png b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_5.png
new file mode 100644
index 00000000000..d2ebd33b039
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_5.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_6.png b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_6.png
new file mode 100644
index 00000000000..c7d50fc83d7
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_6.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_7.png b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_7.png
new file mode 100644
index 00000000000..162a0209caa
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_7.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_8.png b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_8.png
new file mode 100644
index 00000000000..b8c0c5f0cd8
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_8.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_9.png b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_9.png
new file mode 100644
index 00000000000..f17d267cf2f
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_9.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_x.png b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_x.png
new file mode 100644
index 00000000000..4114acb1973
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/colorless_x.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/green_blue.png b/Mage.Client/src/mage/client/util/resources/images/symbols/green_blue.png
new file mode 100644
index 00000000000..dfb135de549
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/green_blue.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/green_white.png b/Mage.Client/src/mage/client/util/resources/images/symbols/green_white.png
new file mode 100644
index 00000000000..c9db56e9bdf
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/green_white.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/mana_black.png b/Mage.Client/src/mage/client/util/resources/images/symbols/mana_black.png
new file mode 100644
index 00000000000..25cfee0fcef
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/mana_black.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/mana_blue.png b/Mage.Client/src/mage/client/util/resources/images/symbols/mana_blue.png
new file mode 100644
index 00000000000..4bc7e3dca77
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/mana_blue.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/mana_green.png b/Mage.Client/src/mage/client/util/resources/images/symbols/mana_green.png
new file mode 100644
index 00000000000..deeaf15c243
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/mana_green.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/mana_red.png b/Mage.Client/src/mage/client/util/resources/images/symbols/mana_red.png
new file mode 100644
index 00000000000..2f9f1e2d69c
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/mana_red.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/mana_white.png b/Mage.Client/src/mage/client/util/resources/images/symbols/mana_white.png
new file mode 100644
index 00000000000..bad06179762
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/mana_white.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/red_green.png b/Mage.Client/src/mage/client/util/resources/images/symbols/red_green.png
new file mode 100644
index 00000000000..a91dc0254d6
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/red_green.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/red_white.png b/Mage.Client/src/mage/client/util/resources/images/symbols/red_white.png
new file mode 100644
index 00000000000..d810e8f7cf7
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/red_white.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/two_black.png b/Mage.Client/src/mage/client/util/resources/images/symbols/two_black.png
new file mode 100644
index 00000000000..8f5fe643fd8
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/two_black.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/two_blue.png b/Mage.Client/src/mage/client/util/resources/images/symbols/two_blue.png
new file mode 100644
index 00000000000..bd6ffa3066c
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/two_blue.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/two_green.png b/Mage.Client/src/mage/client/util/resources/images/symbols/two_green.png
new file mode 100644
index 00000000000..b32f91e3f5b
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/two_green.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/two_red.png b/Mage.Client/src/mage/client/util/resources/images/symbols/two_red.png
new file mode 100644
index 00000000000..2410856defa
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/two_red.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/two_white.png b/Mage.Client/src/mage/client/util/resources/images/symbols/two_white.png
new file mode 100644
index 00000000000..da38efe69d7
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/two_white.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/white_black.png b/Mage.Client/src/mage/client/util/resources/images/symbols/white_black.png
new file mode 100644
index 00000000000..762f4b8cdfc
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/white_black.png differ
diff --git a/Mage.Client/src/mage/client/util/resources/images/symbols/white_blue.png b/Mage.Client/src/mage/client/util/resources/images/symbols/white_blue.png
new file mode 100644
index 00000000000..b2c768daef7
Binary files /dev/null and b/Mage.Client/src/mage/client/util/resources/images/symbols/white_blue.png differ