forked from External/mage
client + server improvements
This commit is contained in:
parent
f37f2d8b63
commit
94c5a0cdfb
20 changed files with 594 additions and 321 deletions
|
|
@ -34,12 +34,10 @@
|
|||
|
||||
package mage.server.console;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.prefs.Preferences;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.UnsupportedLookAndFeelException;
|
||||
import mage.server.console.remote.Session;
|
||||
import mage.utils.MageVersion;
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
|
|||
|
|
@ -120,6 +120,9 @@
|
|||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Disconnect"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnDisconnectActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
|
|
@ -208,6 +211,9 @@
|
|||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Remove"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnDeleteActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
|
|
|
|||
|
|
@ -134,6 +134,11 @@ public class ConsolePanel extends javax.swing.JPanel {
|
|||
jPanel4.setVerifyInputWhenFocusTarget(false);
|
||||
|
||||
btnDisconnect.setText("Disconnect");
|
||||
btnDisconnect.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnDisconnectActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
|
||||
jPanel4.setLayout(jPanel4Layout);
|
||||
|
|
@ -182,6 +187,11 @@ public class ConsolePanel extends javax.swing.JPanel {
|
|||
);
|
||||
|
||||
btnDelete.setText("Remove");
|
||||
btnDelete.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnDeleteActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
|
||||
jPanel6.setLayout(jPanel6Layout);
|
||||
|
|
@ -226,6 +236,17 @@ public class ConsolePanel extends javax.swing.JPanel {
|
|||
.addComponent(jSplitPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 395, Short.MAX_VALUE)
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void btnDisconnectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDisconnectActionPerformed
|
||||
int row = this.tblUsers.getSelectedRow();
|
||||
ConsoleFrame.getSession().disconnectUser((UUID)tableUserModel.getValueAt(row, 3));
|
||||
}//GEN-LAST:event_btnDisconnectActionPerformed
|
||||
|
||||
private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteActionPerformed
|
||||
int row = this.tblTables.getSelectedRow();
|
||||
ConsoleFrame.getSession().removeTable((UUID)tableTableModel.getValueAt(row, 7));
|
||||
}//GEN-LAST:event_btnDeleteActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton btnDelete;
|
||||
private javax.swing.JButton btnDisconnect;
|
||||
|
|
|
|||
|
|
@ -492,9 +492,9 @@ public class Session {
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean removeTable(UUID roomId, UUID tableId) {
|
||||
public boolean removeTable(UUID tableId) {
|
||||
try {
|
||||
server.removeTable(sessionId, roomId, tableId);
|
||||
server.removeTable(sessionId, tableId);
|
||||
return true;
|
||||
} catch (RemoteException ex) {
|
||||
handleRemoteException(ex);
|
||||
|
|
@ -672,6 +672,18 @@ public class Session {
|
|||
return null;
|
||||
}
|
||||
|
||||
public boolean disconnectUser(UUID userSessionId) {
|
||||
try {
|
||||
server.disconnectUser(sessionId, userSessionId);
|
||||
return true;
|
||||
} catch (RemoteException ex) {
|
||||
handleRemoteException(ex);
|
||||
} catch (MageException ex) {
|
||||
handleMageException(ex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void handleRemoteException(RemoteException ex) {
|
||||
logger.fatal("Communication error", ex);
|
||||
if (ex instanceof java.rmi.ConnectException) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue