mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
fixed auto reconnect feature
This commit is contained in:
parent
7e7a17e1d7
commit
2b8afe379a
6 changed files with 12 additions and 34 deletions
|
@ -949,16 +949,6 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
System.exit(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reconnect() {
|
||||
session.disconnect(false);
|
||||
tablesPane.clearChat();
|
||||
disableButtons();
|
||||
if (performConnect()) {
|
||||
enableButtons();
|
||||
}
|
||||
}
|
||||
|
||||
public void enableButtons() {
|
||||
btnConnect.setEnabled(true);
|
||||
btnConnect.setText("Disconnect");
|
||||
|
@ -1221,10 +1211,18 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setStatusText("Not connected");
|
||||
disableButtons();
|
||||
hideGames();
|
||||
hideTables();
|
||||
disableButtons();
|
||||
if (JOptionPane.showConfirmDialog(null, "The connection to server was lost. Reconnect?", "Warning", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||
session.disconnect(false);
|
||||
tablesPane.clearChat();
|
||||
if (performConnect()) {
|
||||
enableButtons();
|
||||
}
|
||||
} else {
|
||||
setStatusText("Not connected");
|
||||
hideGames();
|
||||
hideTables();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -74,11 +74,6 @@ public class MultiConnectTest {
|
|||
logger.info("disconnected");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reconnect() {
|
||||
logger.info("Not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMessage(String message) {
|
||||
logger.info("showMessage: " + message);
|
||||
|
|
|
@ -40,7 +40,6 @@ public interface MageClient extends CallbackClient {
|
|||
MageVersion getVersion();
|
||||
void connected(String message);
|
||||
void disconnected();
|
||||
void reconnect();
|
||||
void showMessage(String message);
|
||||
void showError(String message);
|
||||
|
||||
|
|
|
@ -54,7 +54,6 @@ import org.jboss.remoting.transport.bisocket.Bisocket;
|
|||
import org.jboss.remoting.transport.socket.SocketWrapper;
|
||||
import org.jboss.remoting.transporter.TransporterClient;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
import mage.constants.ManaType;
|
||||
|
@ -1318,9 +1317,6 @@ public class SessionImpl implements Session {
|
|||
if (isConnected()) {
|
||||
if (!server.ping(sessionId)) {
|
||||
logger.error(new StringBuilder("Ping failed: ").append(this.getUserName()).append(" Session: ").append(sessionId).append(" to MAGE server at ").append(connection.getHost()).append(":").append(connection.getPort()).toString());
|
||||
if (JOptionPane.showConfirmDialog(null, "The connection to server was lost. Reconnect?", "Warning", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||
client.reconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -257,11 +257,6 @@ public class ConsoleFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reconnect() {
|
||||
logger.info("Not implemented.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMessage(final String message) {
|
||||
if (SwingUtilities.isEventDispatchThread()) {
|
||||
|
|
|
@ -42,11 +42,6 @@ public class SimpleMageClient implements MageClient {
|
|||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reconnect() {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMessage(String message) {
|
||||
log.info(message);
|
||||
|
|
Loading…
Reference in a new issue