diff --git a/Mage.Client/src/main/java/mage/client/dialog/JoinTableDialog.form b/Mage.Client/src/main/java/mage/client/dialog/JoinTableDialog.form
index 56d2b74137b..420454a9b19 100644
--- a/Mage.Client/src/main/java/mage/client/dialog/JoinTableDialog.form
+++ b/Mage.Client/src/main/java/mage/client/dialog/JoinTableDialog.form
@@ -26,11 +26,18 @@
+
+
+
+
+
+
+
@@ -41,7 +48,12 @@
-
+
+
+
+
+
+
@@ -70,5 +82,15 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/Mage.Client/src/main/java/mage/client/dialog/JoinTableDialog.java b/Mage.Client/src/main/java/mage/client/dialog/JoinTableDialog.java
index a0017becdb3..445468653c6 100644
--- a/Mage.Client/src/main/java/mage/client/dialog/JoinTableDialog.java
+++ b/Mage.Client/src/main/java/mage/client/dialog/JoinTableDialog.java
@@ -50,6 +50,7 @@ public class JoinTableDialog extends MageDialog {
public JoinTableDialog() {
initComponents();
newPlayerPanel.showLevel(false);
+ txtPassword.setText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_PASSWORD, ""));
}
public void showDialog(UUID roomId, UUID tableId) {
@@ -74,6 +75,8 @@ public class JoinTableDialog extends MageDialog {
btnCancel = new javax.swing.JButton();
btnOK = new javax.swing.JButton();
newPlayerPanel = new mage.client.table.NewPlayerPanel();
+ lblPassword = new javax.swing.JLabel();
+ txtPassword = new javax.swing.JTextField();
setTitle("Join Table");
@@ -91,6 +94,10 @@ public class JoinTableDialog extends MageDialog {
}
});
+ lblPassword.setText("Password:");
+
+ txtPassword.setText("password");
+
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
@@ -99,10 +106,16 @@ public class JoinTableDialog extends MageDialog {
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addGap(0, 0, Short.MAX_VALUE)
.addComponent(btnOK)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnCancel))
- .addComponent(newPlayerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 414, Short.MAX_VALUE))
+ .addComponent(newPlayerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 414, Short.MAX_VALUE)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(lblPassword)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
@@ -110,6 +123,10 @@ public class JoinTableDialog extends MageDialog {
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(newPlayerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblPassword)
+ .addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnCancel)
@@ -128,7 +145,8 @@ public class JoinTableDialog extends MageDialog {
private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed
Session session = MageFrame.getSession();
try {
- joined = session.joinTable(roomId, tableId, this.newPlayerPanel.getPlayerName(), "Human", 1, DeckImporterUtil.importDeck(this.newPlayerPanel.getDeckFile()));
+ PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_PASSWORD, txtPassword.getText());
+ joined = session.joinTable(roomId, tableId, this.newPlayerPanel.getPlayerName(), "Human", 1, DeckImporterUtil.importDeck(this.newPlayerPanel.getDeckFile()), this.txtPassword.getText());
} catch (Exception ex) {
handleError(ex);
}
@@ -151,7 +169,9 @@ public class JoinTableDialog extends MageDialog {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnCancel;
private javax.swing.JButton btnOK;
+ private javax.swing.JLabel lblPassword;
private mage.client.table.NewPlayerPanel newPlayerPanel;
+ private javax.swing.JTextField txtPassword;
// End of variables declaration//GEN-END:variables
}
diff --git a/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.form b/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.form
index 6f96a74f41b..874bb5df50b 100644
--- a/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.form
+++ b/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.form
@@ -40,14 +40,22 @@
-
-
+
+
+
+
+
-
+
+
+
+
-
+
+
+
+
-
@@ -102,6 +110,8 @@
+
+
@@ -155,7 +165,7 @@
-
+
@@ -186,6 +196,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -196,7 +216,7 @@
-
+
diff --git a/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java b/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java
index 29af39e8a46..c45cb305fdf 100644
--- a/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java
+++ b/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java
@@ -92,6 +92,8 @@ public class NewTableDialog extends MageDialog {
lblName = new javax.swing.JLabel();
txtName = new javax.swing.JTextField();
+ lblPassword = new javax.swing.JLabel();
+ txtPassword = new javax.swing.JTextField();
lbDeckType = new javax.swing.JLabel();
cbDeckType = new javax.swing.JComboBox();
lbTimeLimit = new javax.swing.JLabel();
@@ -123,10 +125,13 @@ public class NewTableDialog extends MageDialog {
lblName.setLabelFor(txtName);
lblName.setText("Name:");
+ lblPassword.setLabelFor(txtName);
+ lblPassword.setText("Password:");
+
lbDeckType.setText("Deck Type:");
lbTimeLimit.setText("Time Limit:");
- lbTimeLimit.setToolTipText("The activie time a player may use to finish the match. If the time runs out, the player looses the current game.");
+ lbTimeLimit.setToolTipText("The active time a player may use to finish the match. If his or her time runs out, the player looses the current game.");
lblGameType.setText("Game Type:");
@@ -206,13 +211,18 @@ public class NewTableDialog extends MageDialog {
.addComponent(lblFreeMulligans)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE)
.addComponent(spnFreeMulligans, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addComponent(cbDeckType, javax.swing.GroupLayout.PREFERRED_SIZE, 338, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
+ .addComponent(txtName, javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(cbDeckType, javax.swing.GroupLayout.Alignment.LEADING, 0, 338, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(lbTimeLimit)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(lbTimeLimit, javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(lblPassword, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(cbTimeLimit, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addComponent(txtName, javax.swing.GroupLayout.Alignment.TRAILING)))
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(cbTimeLimit, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
@@ -253,7 +263,9 @@ public class NewTableDialog extends MageDialog {
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(lblName))
+ .addComponent(lblName)
+ .addComponent(txtPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(lblPassword))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cbDeckType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
@@ -296,7 +308,7 @@ public class NewTableDialog extends MageDialog {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(pnlOtherPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, 185, Short.MAX_VALUE)
+ .addComponent(pnlOtherPlayers, javax.swing.GroupLayout.DEFAULT_SIZE, 189, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@@ -334,6 +346,7 @@ public class NewTableDialog extends MageDialog {
options.setRange((RangeOfInfluence) this.cbRange.getSelectedItem());
options.setWinsNeeded((Integer)this.spnNumWins.getValue());
options.setFreeMulligans((Integer)this.spnFreeMulligans.getValue());
+ options.setPassword(this.txtPassword.getText());
saveGameSettingsToPrefs(options, this.player1Panel.getDeckFile());
table = session.createTable(roomId, options);
@@ -342,7 +355,14 @@ public class NewTableDialog extends MageDialog {
return;
}
try {
- if (session.joinTable(roomId, table.getTableId(), this.player1Panel.getPlayerName(), "Human", 1, DeckImporterUtil.importDeck(this.player1Panel.getDeckFile()))) {
+ if (session.joinTable(
+ roomId,
+ table.getTableId(),
+ this.player1Panel.getPlayerName(),
+ "Human", 1,
+ DeckImporterUtil.importDeck(this.player1Panel.getDeckFile()),
+ this.txtPassword.getText())
+ ) {
for (TablePlayerPanel player: players) {
if (!player.getPlayerType().equals("Human")) {
if (!player.joinTable(roomId, table.getTableId())) {
@@ -488,6 +508,7 @@ public class NewTableDialog extends MageDialog {
*/
private void setGameSettingsFromPrefs () {
txtName.setText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_NAME, "Game"));
+ txtPassword.setText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_PASSWORD, ""));
String playerTypes = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_NEW_TABLE_PLAYER_TYPES, "Human");
prefPlayerTypes.clear();
@@ -539,6 +560,7 @@ public class NewTableDialog extends MageDialog {
*/
private void saveGameSettingsToPrefs(MatchOptions options, String deckFile) {
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_NAME, options.getName());
+ PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_PASSWORD, options.getPassword());
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_DECK_TYPE, options.getDeckType());
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_TIME_LIMIT, Integer.toString(options.getPriorityTime()));
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_GAME_TYPE, options.getGameType());
@@ -580,6 +602,7 @@ public class NewTableDialog extends MageDialog {
private javax.swing.JLabel lblName;
private javax.swing.JLabel lblNumPlayers;
private javax.swing.JLabel lblNumWins;
+ private javax.swing.JLabel lblPassword;
private javax.swing.JLabel lblRange;
private mage.client.table.NewPlayerPanel player1Panel;
private javax.swing.JPanel pnlOtherPlayers;
@@ -587,6 +610,7 @@ public class NewTableDialog extends MageDialog {
private javax.swing.JSpinner spnNumPlayers;
private javax.swing.JSpinner spnNumWins;
private javax.swing.JTextField txtName;
+ private javax.swing.JTextField txtPassword;
// End of variables declaration//GEN-END:variables
}
diff --git a/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java b/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java
index 676d35e42c0..68e6a178358 100644
--- a/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java
+++ b/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java
@@ -144,6 +144,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
// pref setting for new table dialog
public static final String KEY_NEW_TABLE_NAME = "newTableName";
+ public static final String KEY_NEW_TABLE_PASSWORD = "newTablePassword";
public static final String KEY_NEW_TABLE_DECK_TYPE = "newTableDeckType";
public static final String KEY_NEW_TABLE_TIME_LIMIT = "newTableTimeLimit";
public static final String KEY_NEW_TABLE_GAME_TYPE = "newTableGameType";
diff --git a/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.form b/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.form
index eaf7c22dac9..8d71cceb0ee 100644
--- a/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.form
+++ b/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.form
@@ -1,4 +1,4 @@
-
+