mirror of
https://github.com/correl/mage.git
synced 2024-11-28 11:09:54 +00:00
another Server Console fix
This commit is contained in:
parent
4657ea0352
commit
b55dd5d787
2 changed files with 31 additions and 1 deletions
|
@ -90,7 +90,6 @@ public class ConsoleFrame extends javax.swing.JFrame implements MageClient {
|
||||||
|
|
||||||
public boolean connect(Connection connection) {
|
public boolean connect(Connection connection) {
|
||||||
if (session.connect(connection)) {
|
if (session.connect(connection)) {
|
||||||
|
|
||||||
this.consolePanel1.start();
|
this.consolePanel1.start();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -221,6 +220,7 @@ public class ConsoleFrame extends javax.swing.JFrame implements MageClient {
|
||||||
@Override
|
@Override
|
||||||
public void disconnected() {
|
public void disconnected() {
|
||||||
if (SwingUtilities.isEventDispatchThread()) {
|
if (SwingUtilities.isEventDispatchThread()) {
|
||||||
|
consolePanel1.stop();
|
||||||
setStatusText("Not connected");
|
setStatusText("Not connected");
|
||||||
disableButtons();
|
disableButtons();
|
||||||
}
|
}
|
||||||
|
@ -228,6 +228,7 @@ public class ConsoleFrame extends javax.swing.JFrame implements MageClient {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
consolePanel1.stop();
|
||||||
setStatusText("Not connected");
|
setStatusText("Not connected");
|
||||||
disableButtons();
|
disableButtons();
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,11 +36,14 @@ package mage.server.console;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.CancellationException;
|
||||||
|
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;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -48,6 +51,8 @@ import mage.view.UserView;
|
||||||
*/
|
*/
|
||||||
public class ConsolePanel extends javax.swing.JPanel {
|
public class ConsolePanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
|
private final static Logger logger = Logger.getLogger(ConsolePanel.class);
|
||||||
|
|
||||||
private TableUserModel tableUserModel;
|
private TableUserModel tableUserModel;
|
||||||
private TableTableModel tableTableModel;
|
private TableTableModel tableTableModel;
|
||||||
private UpdateUsersTask updateUsersTask;
|
private UpdateUsersTask updateUsersTask;
|
||||||
|
@ -394,6 +399,8 @@ class UpdateUsersTask extends SwingWorker<Void, List<UserView>> {
|
||||||
private Session session;
|
private Session session;
|
||||||
private ConsolePanel panel;
|
private ConsolePanel panel;
|
||||||
|
|
||||||
|
private final static Logger logger = Logger.getLogger(UpdateUsersTask.class);
|
||||||
|
|
||||||
UpdateUsersTask(Session session, ConsolePanel panel) {
|
UpdateUsersTask(Session session, ConsolePanel panel) {
|
||||||
this.session = session;
|
this.session = session;
|
||||||
this.panel = panel;
|
this.panel = panel;
|
||||||
|
@ -413,6 +420,16 @@ class UpdateUsersTask extends SwingWorker<Void, List<UserView>> {
|
||||||
panel.update(view.get(0));
|
panel.update(view.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void done() {
|
||||||
|
try {
|
||||||
|
get();
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
logger.fatal("Update Users Task error", ex);
|
||||||
|
} catch (ExecutionException ex) {
|
||||||
|
logger.fatal("Update Users Task error", ex);
|
||||||
|
} catch (CancellationException ex) {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class UpdateTablesTask extends SwingWorker<Void, Collection<TableView>> {
|
class UpdateTablesTask extends SwingWorker<Void, Collection<TableView>> {
|
||||||
|
@ -421,6 +438,8 @@ class UpdateTablesTask extends SwingWorker<Void, Collection<TableView>> {
|
||||||
private UUID roomId;
|
private UUID roomId;
|
||||||
private ConsolePanel panel;
|
private ConsolePanel panel;
|
||||||
|
|
||||||
|
private final static Logger logger = Logger.getLogger(UpdateTablesTask.class);
|
||||||
|
|
||||||
UpdateTablesTask(Session session, UUID roomId, ConsolePanel panel) {
|
UpdateTablesTask(Session session, UUID roomId, ConsolePanel panel) {
|
||||||
this.session = session;
|
this.session = session;
|
||||||
this.roomId = roomId;
|
this.roomId = roomId;
|
||||||
|
@ -441,4 +460,14 @@ class UpdateTablesTask extends SwingWorker<Void, Collection<TableView>> {
|
||||||
panel.update(view.get(0));
|
panel.update(view.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void done() {
|
||||||
|
try {
|
||||||
|
get();
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
logger.fatal("Update Tables Task error", ex);
|
||||||
|
} catch (ExecutionException ex) {
|
||||||
|
logger.fatal("Update Tables Task error", ex);
|
||||||
|
} catch (CancellationException ex) {}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue