fixed bug that prevented joining a game

This commit is contained in:
BetaSteward 2011-05-20 23:24:26 -04:00
parent 3b056b2d6f
commit 5621b8a518

View file

@ -48,7 +48,6 @@ import mage.client.remote.Session;
import mage.client.util.ButtonColumn; import mage.client.util.ButtonColumn;
import mage.game.match.MatchOptions; import mage.game.match.MatchOptions;
import mage.sets.Sets; import mage.sets.Sets;
import mage.util.Logging;
import mage.view.TableView; import mage.view.TableView;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -59,7 +58,6 @@ import java.awt.event.ActionEvent;
import java.beans.PropertyVetoException; import java.beans.PropertyVetoException;
import java.util.*; import java.util.*;
import java.util.List; import java.util.List;
import java.util.logging.Level;
/** /**
@ -77,7 +75,6 @@ public class TablesPanel extends javax.swing.JPanel {
private JoinTableDialog joinTableDialog; private JoinTableDialog joinTableDialog;
private NewTableDialog newTableDialog; private NewTableDialog newTableDialog;
private NewTournamentDialog newTournamentDialog; private NewTournamentDialog newTournamentDialog;
private TableWaitingDialog tableWaitingDialog;
private Session session; private Session session;
/** Creates new form TablesPanel */ /** Creates new form TablesPanel */
@ -126,14 +123,15 @@ public class TablesPanel extends javax.swing.JPanel {
} }
if (isTournament) { if (isTournament) {
logger.info("Joining tournament " + tableId); logger.info("Joining tournament " + tableId);
if (session.joinTournamentTable(roomId, tableId, session.getUserName(), "Human", 1)) if (session.joinTournamentTable(roomId, tableId, session.getUserName(), "Human", 1)) {
tableWaitingDialog.showDialog(roomId, tableId, true); showTableWaitingDialog(roomId, tableId, true);
}
} }
else { else {
logger.info("Joining table " + tableId); logger.info("Joining table " + tableId);
joinTableDialog.showDialog(roomId, tableId); joinTableDialog.showDialog(roomId, tableId);
if (joinTableDialog.isJoined()) if (joinTableDialog.isJoined())
tableWaitingDialog.showDialog(roomId, tableId, false); showTableWaitingDialog(roomId, tableId, false);
} }
} else if (state.equals("Watch")) { } else if (state.equals("Watch")) {
logger.info("Watching table " + tableId); logger.info("Watching table " + tableId);
@ -194,10 +192,6 @@ public class TablesPanel extends javax.swing.JPanel {
joinTableDialog = new JoinTableDialog(); joinTableDialog = new JoinTableDialog();
MageFrame.getDesktop().add(joinTableDialog); MageFrame.getDesktop().add(joinTableDialog);
} }
/*if (tableWaitingDialog == null) {
tableWaitingDialog = new TableWaitingDialog();
MageFrame.getDesktop().add(tableWaitingDialog);
}*/
UUID chatRoomId = session.getRoomChatId(roomId); UUID chatRoomId = session.getRoomChatId(roomId);
if (chatRoomId != null) { if (chatRoomId != null) {
this.chatPanel.connect(chatRoomId); this.chatPanel.connect(chatRoomId);
@ -214,9 +208,6 @@ public class TablesPanel extends javax.swing.JPanel {
} }
public void hideTables() { public void hideTables() {
/*if (tableWaitingDialog != null && tableWaitingDialog.isVisible()) {
tableWaitingDialog.closeDialog();
}*/
for (Component component : MageFrame.getDesktop().getComponents()) { for (Component component : MageFrame.getDesktop().getComponents()) {
if (component instanceof TableWaitingDialog) { if (component instanceof TableWaitingDialog) {
((TableWaitingDialog)component).closeDialog(); ((TableWaitingDialog)component).closeDialog();
@ -236,6 +227,12 @@ public class TablesPanel extends javax.swing.JPanel {
c.setVisible(false); c.setVisible(false);
} }
private void showTableWaitingDialog(UUID roomId, UUID tableId, boolean isTournament) {
TableWaitingDialog tableWaitingDialog = new TableWaitingDialog();
MageFrame.getDesktop().add(tableWaitingDialog, JLayeredPane.MODAL_LAYER);
tableWaitingDialog.showDialog(roomId, tableId, isTournament);
}
/** This method is called from within the constructor to /** This method is called from within the constructor to
* initialize the form. * initialize the form.
* WARNING: Do NOT modify this code. The content of this method is * WARNING: Do NOT modify this code. The content of this method is
@ -328,11 +325,8 @@ public class TablesPanel extends javax.swing.JPanel {
private void btnNewTableActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNewTableActionPerformed private void btnNewTableActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNewTableActionPerformed
newTableDialog.showDialog(roomId); newTableDialog.showDialog(roomId);
if (newTableDialog.getTable() != null) { if (newTableDialog.getTable() != null)
tableWaitingDialog = new TableWaitingDialog(); showTableWaitingDialog(roomId, newTableDialog.getTable().getTableId(), false);
MageFrame.getDesktop().add(tableWaitingDialog, JLayeredPane.MODAL_LAYER);
tableWaitingDialog.showDialog(roomId, newTableDialog.getTable().getTableId(), false);
}
}//GEN-LAST:event_btnNewTableActionPerformed }//GEN-LAST:event_btnNewTableActionPerformed
private void btnQuickStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQuickStartActionPerformed private void btnQuickStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQuickStartActionPerformed
@ -359,7 +353,7 @@ public class TablesPanel extends javax.swing.JPanel {
MageFrame.getDesktop().add(newTournamentDialog); MageFrame.getDesktop().add(newTournamentDialog);
newTournamentDialog.showDialog(roomId); newTournamentDialog.showDialog(roomId);
if (newTournamentDialog.getTable() != null) { if (newTournamentDialog.getTable() != null) {
tableWaitingDialog.showDialog(roomId, newTournamentDialog.getTable().getTableId(), true); showTableWaitingDialog(roomId, newTournamentDialog.getTable().getTableId(), true);
} }
}//GEN-LAST:event_btnNewTournamentActionPerformed }//GEN-LAST:event_btnNewTournamentActionPerformed