client registration is now a blocking call on the client side + added server messages handlers

This commit is contained in:
betasteward 2015-05-24 22:56:11 -04:00
parent d2ae55fff6
commit b68cd765b7
11 changed files with 194 additions and 31 deletions

View file

@ -1002,20 +1002,25 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
this.tablesPane.hideTables();
}
public void showGames(boolean setActive) {
MagePane topPanebefore = getTopMost(tablesPane);
if (!tablesPane.isVisible()) {
this.tablesPane.setVisible(true);
this.tablesPane.showTables();
}
if (setActive) {
setActive(tablesPane);
} else {
// if other panel was already shown, mamke sure it's topmost again
if (topPanebefore != null) {
setActive(topPanebefore);
public void showGames(final boolean setActive) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
MagePane topPanebefore = getTopMost(tablesPane);
if (!tablesPane.isVisible()) {
tablesPane.setVisible(true);
tablesPane.showTables();
}
if (setActive) {
setActive(tablesPane);
} else {
// if other panel was already shown, mamke sure it's topmost again
if (topPanebefore != null) {
setActive(topPanebefore);
}
}
}
}
});
}
public void hideGames() {
@ -1372,13 +1377,13 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
@Override
public void clientRegistered(ServerState state) {
this.serverState = state;
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
setWindowTitle();
showGames(false);
}
});
// SwingUtilities.invokeLater(new Runnable() {
// @Override
// public void run() {
// setWindowTitle();
// showGames(false);
// }
// });
}
@Override

View file

@ -366,7 +366,7 @@ public class ConnectDialog extends MageDialog {
if (result) {
lblStatus.setText("");
connected();
// MageFrame.getInstance().showGames(false);
MageFrame.getInstance().showGames(false);
} else {
lblStatus.setText("Could not connect");
}