Extracted Session interface, moved implementation to SessionImpl

This commit is contained in:
magenoxx 2012-04-29 19:03:08 +04:00
parent 0970856fc8
commit 96cfb51686
11 changed files with 1265 additions and 1035 deletions

View file

@ -34,7 +34,6 @@
package mage.client; package mage.client;
import mage.Constants;
import mage.cards.Card; import mage.cards.Card;
import mage.cards.decks.Deck; import mage.cards.decks.Deck;
import mage.client.cards.CardsStorage; import mage.client.cards.CardsStorage;
@ -60,7 +59,6 @@ import mage.client.util.EDTExceptionHandler;
import mage.client.util.SettingsManager; import mage.client.util.SettingsManager;
import mage.client.util.gui.ArrowBuilder; import mage.client.util.gui.ArrowBuilder;
import mage.components.ImagePanel; import mage.components.ImagePanel;
import mage.game.match.MatchOptions;
import mage.interfaces.Action; import mage.interfaces.Action;
import mage.interfaces.MageClient; import mage.interfaces.MageClient;
import mage.interfaces.callback.CallbackClient; import mage.interfaces.callback.CallbackClient;
@ -68,10 +66,9 @@ import mage.interfaces.callback.ClientCallback;
import mage.remote.Connection; import mage.remote.Connection;
import mage.remote.Connection.ProxyType; import mage.remote.Connection.ProxyType;
import mage.remote.Session; import mage.remote.Session;
import mage.remote.SessionImpl;
import mage.server.Main; import mage.server.Main;
import mage.sets.Sets;
import mage.utils.MageVersion; import mage.utils.MageVersion;
import mage.view.TableView;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.mage.card.arcane.ManaSymbols; import org.mage.card.arcane.ManaSymbols;
@ -181,7 +178,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
SettingsManager.getInstance().setScreenWidthAndHeight(1024, 768); SettingsManager.getInstance().setScreenWidthAndHeight(1024, 768);
this.setExtendedState(JFrame.MAXIMIZED_BOTH); this.setExtendedState(JFrame.MAXIMIZED_BOTH);
session = new Session(this); session = new SessionImpl(this);
session.setEmbeddedMageServerAction(new Action() { session.setEmbeddedMageServerAction(new Action() {
@Override @Override
public void execute() { public void execute() {

View file

@ -27,29 +27,27 @@
*/ */
package mage.client.dialog; package mage.client.dialog;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JOptionPane;
import javax.swing.SpinnerNumberModel;
import mage.Constants.MultiplayerAttackOption; import mage.Constants.MultiplayerAttackOption;
import mage.Constants.RangeOfInfluence; import mage.Constants.RangeOfInfluence;
import mage.cards.decks.importer.DeckImporterUtil;
import mage.client.MageFrame; import mage.client.MageFrame;
import mage.client.components.MageComponents; import mage.client.components.MageComponents;
import mage.cards.decks.importer.DeckImporterUtil;
import mage.client.table.TablePlayerPanel; import mage.client.table.TablePlayerPanel;
import mage.client.util.Event; import mage.client.util.Event;
import mage.client.util.Listener; import mage.client.util.Listener;
import mage.game.match.MatchOptions; import mage.game.match.MatchOptions;
import mage.remote.Session; import mage.remote.Session;
import mage.sets.Sets;
import mage.view.GameTypeView; import mage.view.GameTypeView;
import mage.view.TableView; import mage.view.TableView;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import javax.swing.*;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/** /**
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com

View file

@ -29,7 +29,6 @@
package mage.client.dialog; package mage.client.dialog;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Point;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.UUID; import java.util.UUID;
@ -37,15 +36,11 @@ import java.util.UUID;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JLayeredPane; import javax.swing.JLayeredPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import mage.cards.CardDimensions; import mage.cards.CardDimensions;
import mage.client.MageFrame; import mage.client.MageFrame;
import mage.client.cards.BigCard; import mage.client.cards.BigCard;
import mage.client.cards.CardArea; import mage.client.cards.CardArea;
import mage.client.util.SettingsManager;
import mage.client.util.gui.GuiDisplayUtil;
import mage.remote.Session;
import mage.view.CardsView; import mage.view.CardsView;
/** /**

View file

@ -34,22 +34,22 @@
package mage.client.draft; package mage.client.draft;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.UUID;
import javax.swing.Timer;
import mage.client.MageFrame; import mage.client.MageFrame;
import mage.client.constants.Constants.SortBy;
import mage.client.plugins.impl.Plugins; import mage.client.plugins.impl.Plugins;
import mage.client.util.CardsViewUtil; import mage.client.util.CardsViewUtil;
import mage.remote.Session;
import mage.client.util.Event; import mage.client.util.Event;
import mage.client.util.Listener; import mage.client.util.Listener;
import mage.remote.Session;
import mage.view.CardsView; import mage.view.CardsView;
import mage.view.DraftPickView; import mage.view.DraftPickView;
import mage.view.DraftView; import mage.view.DraftView;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.UUID;
/** /**
* *
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com

View file

@ -36,7 +36,6 @@ package mage.client.game;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent;
import java.io.Serializable; import java.io.Serializable;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;

View file

@ -5,7 +5,6 @@ import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.prefs.Preferences;
import javax.swing.*; import javax.swing.*;

View file

@ -8,6 +8,7 @@ import mage.interfaces.MageClient;
import mage.interfaces.callback.ClientCallback; import mage.interfaces.callback.ClientCallback;
import mage.remote.Connection; import mage.remote.Connection;
import mage.remote.Session; import mage.remote.Session;
import mage.remote.SessionImpl;
import mage.utils.MageVersion; import mage.utils.MageVersion;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.junit.Ignore; import org.junit.Ignore;
@ -46,7 +47,7 @@ public class MultiConnectTest {
} }
public void connect() { public void connect() {
session = new Session(this); session = new SessionImpl(this);
Connection connection = new Connection(); Connection connection = new Connection();
connection.setUsername(username); connection.setUsername(username);
connection.setHost("localhost"); connection.setHost("localhost");

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -38,6 +38,7 @@ import mage.interfaces.MageClient;
import mage.interfaces.callback.ClientCallback; import mage.interfaces.callback.ClientCallback;
import mage.remote.Connection; import mage.remote.Connection;
import mage.remote.Session; import mage.remote.Session;
import mage.remote.SessionImpl;
import mage.utils.MageVersion; import mage.utils.MageVersion;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -79,7 +80,7 @@ public class ConsoleFrame extends javax.swing.JFrame implements MageClient {
initComponents(); initComponents();
try { try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
session = new Session(this); session = new SessionImpl(this);
connectDialog = new ConnectDialog(); connectDialog = new ConnectDialog();
} catch (Exception ex) { } catch (Exception ex) {
logger.fatal("", ex); logger.fatal("", ex);

View file

@ -40,6 +40,7 @@ import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import javax.swing.table.AbstractTableModel; import javax.swing.table.AbstractTableModel;
import mage.remote.Session; import mage.remote.Session;
import mage.view.TableView; import mage.view.TableView;
import mage.view.UserView; import mage.view.UserView;