forked from External/mage
rolled back changes since 0.7.3 R2 - going to switch client/server architecture
This commit is contained in:
parent
1f72804968
commit
c38804af5f
103 changed files with 997 additions and 4921 deletions
|
|
@ -46,8 +46,6 @@ import mage.client.constants.Constants.DeckEditorMode;
|
|||
import mage.client.deckeditor.collection.viewer.CollectionViewerPane;
|
||||
import mage.client.dialog.*;
|
||||
import mage.client.plugins.impl.Plugins;
|
||||
import mage.interfaces.callback.ClientCallback;
|
||||
import mage.remote.Session;
|
||||
import mage.client.util.EDTExceptionHandler;
|
||||
import mage.client.util.gui.ArrowBuilder;
|
||||
import mage.components.ImagePanel;
|
||||
|
|
@ -73,37 +71,29 @@ import java.util.List;
|
|||
import java.util.prefs.Preferences;
|
||||
import javax.swing.event.PopupMenuEvent;
|
||||
import javax.swing.event.PopupMenuListener;
|
||||
import mage.client.chat.ChatPanel;
|
||||
import mage.client.components.MageUI;
|
||||
import mage.client.deckeditor.DeckEditorPane;
|
||||
import mage.client.draft.DraftPane;
|
||||
import mage.client.draft.DraftPanel;
|
||||
import mage.client.game.GamePane;
|
||||
import mage.client.game.GamePanel;
|
||||
import mage.client.remote.CallbackClientImpl;
|
||||
import mage.client.remote.Session;
|
||||
import mage.client.table.TablesPane;
|
||||
import mage.client.tournament.TournamentPane;
|
||||
import mage.client.tournament.TournamentPanel;
|
||||
import mage.constants.Constants.SessionState;
|
||||
import mage.game.match.MatchOptions;
|
||||
import mage.interfaces.Client;
|
||||
import mage.interfaces.callback.CallbackClient;
|
||||
import mage.utils.MageVersion;
|
||||
import mage.sets.Sets;
|
||||
import mage.remote.Connection;
|
||||
import mage.remote.Connection.ProxyType;
|
||||
import mage.utils.Connection;
|
||||
import mage.utils.Connection.ProxyType;
|
||||
import mage.view.TableView;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class MageFrame extends javax.swing.JFrame implements Client {
|
||||
public class MageFrame extends javax.swing.JFrame {
|
||||
|
||||
private final static Logger logger = Logger.getLogger(MageFrame.class);
|
||||
|
||||
private static Session session;
|
||||
private static CallbackClient callbackClient;
|
||||
private ConnectDialog connectDialog;
|
||||
private static Preferences prefs = Preferences.userNodeForPackage(MageFrame.class);
|
||||
private JLabel title;
|
||||
|
|
@ -112,10 +102,6 @@ public class MageFrame extends javax.swing.JFrame implements Client {
|
|||
private UUID clientId;
|
||||
private static MagePane activeFrame;
|
||||
|
||||
private static Map<UUID, ChatPanel> chats = new HashMap<UUID, ChatPanel>();
|
||||
private static Map<UUID, GamePanel> games = new HashMap<UUID, GamePanel>();
|
||||
private static Map<UUID, DraftPanel> drafts = new HashMap<UUID, DraftPanel>();
|
||||
private static Map<UUID, TournamentPanel> tournaments = new HashMap<UUID, TournamentPanel>();
|
||||
private static MageUI ui = new MageUI();
|
||||
|
||||
/**
|
||||
|
|
@ -133,7 +119,6 @@ public class MageFrame extends javax.swing.JFrame implements Client {
|
|||
return prefs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MageVersion getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
|
@ -171,7 +156,6 @@ public class MageFrame extends javax.swing.JFrame implements Client {
|
|||
this.setExtendedState(JFrame.MAXIMIZED_BOTH);
|
||||
|
||||
session = new Session(this);
|
||||
callbackClient = new CallbackClientImpl(this);
|
||||
connectDialog = new ConnectDialog();
|
||||
desktopPane.add(connectDialog, JLayeredPane.POPUP_LAYER);
|
||||
ui.addComponent(MageComponents.DESKTOP_PANE, desktopPane);
|
||||
|
|
@ -753,9 +737,9 @@ public class MageFrame extends javax.swing.JFrame implements Client {
|
|||
}//GEN-LAST:event_btnExitActionPerformed
|
||||
|
||||
private void btnConnectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConnectActionPerformed
|
||||
if (session.getState() == SessionState.CONNECTED) {
|
||||
if (session.isConnected()) {
|
||||
if (JOptionPane.showConfirmDialog(this, "Are you sure you want to disconnect?", "Confirm disconnect", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||
session.disconnect(false);
|
||||
session.disconnect();
|
||||
showMessage("You have disconnected");
|
||||
}
|
||||
} else {
|
||||
|
|
@ -770,7 +754,7 @@ public class MageFrame extends javax.swing.JFrame implements Client {
|
|||
}//GEN-LAST:event_btnAboutActionPerformed
|
||||
|
||||
public void exitApp() {
|
||||
session.disconnect(false);
|
||||
session.disconnect();
|
||||
Plugins.getInstance().shutdown();
|
||||
dispose();
|
||||
System.exit(0);
|
||||
|
|
@ -889,40 +873,10 @@ public class MageFrame extends javax.swing.JFrame implements Client {
|
|||
return ui;
|
||||
}
|
||||
|
||||
public static ChatPanel getChat(UUID chatId) {
|
||||
return chats.get(chatId);
|
||||
}
|
||||
|
||||
public static void addChat(UUID chatId, ChatPanel chatPanel) {
|
||||
chats.put(chatId, chatPanel);
|
||||
}
|
||||
|
||||
public static GamePanel getGame(UUID gameId) {
|
||||
return games.get(gameId);
|
||||
}
|
||||
|
||||
public static void addGame(UUID gameId, GamePanel gamePanel) {
|
||||
games.put(gameId, gamePanel);
|
||||
}
|
||||
|
||||
public static DraftPanel getDraft(UUID draftId) {
|
||||
return drafts.get(draftId);
|
||||
}
|
||||
|
||||
public static void addDraft(UUID draftId, DraftPanel draftPanel) {
|
||||
drafts.put(draftId, draftPanel);
|
||||
}
|
||||
|
||||
public static void addTournament(UUID tournamentId, TournamentPanel tournament) {
|
||||
tournaments.put(tournamentId, tournament);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connected(final String message) {
|
||||
if (SwingUtilities.isEventDispatchThread()) {
|
||||
setStatusText(message);
|
||||
|
|
@ -939,7 +893,6 @@ public class MageFrame extends javax.swing.JFrame implements Client {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnected() {
|
||||
if (SwingUtilities.isEventDispatchThread()) {
|
||||
setStatusText("Not connected");
|
||||
|
|
@ -960,7 +913,6 @@ public class MageFrame extends javax.swing.JFrame implements Client {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMessage(final String message) {
|
||||
if (SwingUtilities.isEventDispatchThread()) {
|
||||
JOptionPane.showMessageDialog(desktopPane, message);
|
||||
|
|
@ -975,7 +927,6 @@ public class MageFrame extends javax.swing.JFrame implements Client {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showError(final String message) {
|
||||
if (SwingUtilities.isEventDispatchThread()) {
|
||||
JOptionPane.showMessageDialog(desktopPane, message, "Error", JOptionPane.ERROR_MESSAGE);
|
||||
|
|
@ -990,11 +941,6 @@ public class MageFrame extends javax.swing.JFrame implements Client {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processCallback(ClientCallback callback) {
|
||||
callbackClient.processCallback(callback);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class MagePaneMenuItem extends JCheckBoxMenuItem {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue