mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 10:40:06 -08:00
* Small change to the server console.
This commit is contained in:
parent
85b13b88c8
commit
3b60734bab
2 changed files with 31 additions and 20 deletions
|
|
@ -308,7 +308,6 @@
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JTextField" name="jUserName">
|
<Component class="javax.swing.JTextField" name="jUserName">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" value=""/>
|
|
||||||
<Property name="name" type="java.lang.String" value="Username" noResource="true"/>
|
<Property name="name" type="java.lang.String" value="Username" noResource="true"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
</Component>
|
</Component>
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,10 @@ public class ConsolePanel extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public JTextField getjUserName() {
|
||||||
|
return jUserName;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is called from within the constructor to initialize the form.
|
* This method is called from within the constructor to initialize the form.
|
||||||
* WARNING: Do NOT modify this code. The content of this method is always
|
* WARNING: Do NOT modify this code. The content of this method is always
|
||||||
|
|
@ -280,7 +284,6 @@ public class ConsolePanel extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
jUserName.setText("");
|
|
||||||
jUserName.setName("Username"); // NOI18N
|
jUserName.setName("Username"); // NOI18N
|
||||||
|
|
||||||
jLabel1.setText("Username:");
|
jLabel1.setText("Username:");
|
||||||
|
|
@ -346,27 +349,32 @@ public class ConsolePanel extends javax.swing.JPanel {
|
||||||
private void btnEndSessionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEndSessionActionPerformed
|
private void btnEndSessionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEndSessionActionPerformed
|
||||||
int row = this.tblUsers.convertRowIndexToModel(tblUsers.getSelectedRow());
|
int row = this.tblUsers.convertRowIndexToModel(tblUsers.getSelectedRow());
|
||||||
String userSessionId = (String) tableUserModel.getValueAt(row, TableUserModel.POS_GAME_INFO);
|
String userSessionId = (String) tableUserModel.getValueAt(row, TableUserModel.POS_GAME_INFO);
|
||||||
|
|
||||||
if (JOptionPane.showConfirmDialog(null, "Are you sure you mean to end userSessionId " + userSessionId + '?', "WARNING",
|
if (JOptionPane.showConfirmDialog(null, "Are you sure you mean to end userSessionId " + userSessionId + '?', "WARNING",
|
||||||
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||||
ConsoleFrame.getSession().endUserSession(userSessionId);
|
ConsoleFrame.getSession().endUserSession(userSessionId);
|
||||||
}
|
}
|
||||||
}//GEN-LAST:event_btnEndSessionActionPerformed
|
}//GEN-LAST:event_btnEndSessionActionPerformed
|
||||||
|
|
||||||
private void btnMuteUserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMuteUserActionPerformed
|
private void btnMuteUserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMuteUserActionPerformed
|
||||||
int row = this.tblUsers.convertRowIndexToModel(tblUsers.getSelectedRow());
|
int row = this.tblUsers.convertRowIndexToModel(tblUsers.getSelectedRow());
|
||||||
String userName = (String) tableUserModel.getValueAt(row, TableUserModel.POS_USER_NAME);
|
String userName = (String) tableUserModel.getValueAt(row, TableUserModel.POS_USER_NAME);
|
||||||
long durationMinute = ((Number) spinnerMuteDurationMinutes.getValue()).longValue();
|
long durationMinute = ((Number) spinnerMuteDurationMinutes.getValue()).longValue();
|
||||||
if (JOptionPane.showConfirmDialog(null, "Are you sure you mean to mute user: " + userName + " for " + durationMinute + " minutes?", "WARNING",
|
if (JOptionPane.showConfirmDialog(null, "Are you sure you mean to mute user: " + userName + " for " + durationMinute + " minutes?", "WARNING",
|
||||||
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||||
ConsoleFrame.getSession().muteUserChat(userName, durationMinute);
|
ConsoleFrame.getSession().muteUserChat(userName, durationMinute);
|
||||||
}
|
}
|
||||||
}//GEN-LAST:event_btnMuteUserActionPerformed
|
}//GEN-LAST:event_btnMuteUserActionPerformed
|
||||||
|
|
||||||
private void btnDeActivateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeActivateActionPerformed
|
private void btnDeActivateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeActivateActionPerformed
|
||||||
int row = this.tblUsers.convertRowIndexToModel(tblUsers.getSelectedRow());
|
String userName;
|
||||||
String userName = (String) tableUserModel.getValueAt(row, TableUserModel.POS_USER_NAME);
|
if (!getjUserName().getText().isEmpty()) {
|
||||||
|
userName = getjUserName().getText();
|
||||||
|
} else {
|
||||||
|
int row = this.tblUsers.convertRowIndexToModel(tblUsers.getSelectedRow());
|
||||||
|
userName = (String) tableUserModel.getValueAt(row, TableUserModel.POS_USER_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
if (JOptionPane.showConfirmDialog(null, "Did you want to set user: " + userName + " to active?", "WARNING",
|
if (JOptionPane.showConfirmDialog(null, "Did you want to set user: " + userName + " to active?", "WARNING",
|
||||||
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||||
ConsoleFrame.getSession().setActivation(userName, true);
|
ConsoleFrame.getSession().setActivation(userName, true);
|
||||||
|
|
@ -374,13 +382,13 @@ public class ConsolePanel extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
if (JOptionPane.showConfirmDialog(null, "Did you want to set user: " + userName + " to inactive?", "WARNING",
|
if (JOptionPane.showConfirmDialog(null, "Did you want to set user: " + userName + " to inactive?", "WARNING",
|
||||||
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||||
ConsoleFrame.getSession().setActivation(userName, false);
|
ConsoleFrame.getSession().setActivation(userName, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (JOptionPane.showConfirmDialog(null, "Are you sure you mean to toggle activation for user: " + userName + '?', "WARNING",
|
if (JOptionPane.showConfirmDialog(null, "Are you sure you mean to toggle activation for user: " + userName + '?', "WARNING",
|
||||||
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||||
ConsoleFrame.getSession().toggleActivation(userName);
|
ConsoleFrame.getSession().toggleActivation(userName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}//GEN-LAST:event_btnDeActivateActionPerformed
|
}//GEN-LAST:event_btnDeActivateActionPerformed
|
||||||
|
|
||||||
|
|
@ -389,7 +397,7 @@ public class ConsolePanel extends javax.swing.JPanel {
|
||||||
String userName = (String) tableUserModel.getValueAt(row, TableUserModel.POS_USER_NAME);
|
String userName = (String) tableUserModel.getValueAt(row, TableUserModel.POS_USER_NAME);
|
||||||
long durationMinute = ((Number) spinnerMuteDurationMinutes.getValue()).longValue();
|
long durationMinute = ((Number) spinnerMuteDurationMinutes.getValue()).longValue();
|
||||||
if (JOptionPane.showConfirmDialog(null, "Are you sure you mean to lock user: " + userName + " for " + durationMinute + " minutes?", "WARNING",
|
if (JOptionPane.showConfirmDialog(null, "Are you sure you mean to lock user: " + userName + " for " + durationMinute + " minutes?", "WARNING",
|
||||||
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
|
||||||
ConsoleFrame.getSession().lockUser(userName, durationMinute);
|
ConsoleFrame.getSession().lockUser(userName, durationMinute);
|
||||||
}
|
}
|
||||||
}//GEN-LAST:event_btnLockUserActionPerformed
|
}//GEN-LAST:event_btnLockUserActionPerformed
|
||||||
|
|
@ -416,7 +424,7 @@ public class ConsolePanel extends javax.swing.JPanel {
|
||||||
private javax.swing.JScrollPane jScrollPane1;
|
private javax.swing.JScrollPane jScrollPane1;
|
||||||
private javax.swing.JScrollPane jScrollPane2;
|
private javax.swing.JScrollPane jScrollPane2;
|
||||||
private javax.swing.JSplitPane jSplitPane1;
|
private javax.swing.JSplitPane jSplitPane1;
|
||||||
public javax.swing.JTextField jUserName;
|
private javax.swing.JTextField jUserName;
|
||||||
private javax.swing.JLabel lblMinutes;
|
private javax.swing.JLabel lblMinutes;
|
||||||
private javax.swing.JSpinner spinnerMuteDurationMinutes;
|
private javax.swing.JSpinner spinnerMuteDurationMinutes;
|
||||||
private javax.swing.JTable tblTables;
|
private javax.swing.JTable tblTables;
|
||||||
|
|
@ -597,10 +605,10 @@ class UpdateUsersTask extends SwingWorker<Void, List<UserView>> {
|
||||||
protected Void doInBackground() throws Exception {
|
protected Void doInBackground() throws Exception {
|
||||||
while (!isCancelled()) {
|
while (!isCancelled()) {
|
||||||
List<UserView> users = session.getUsers();
|
List<UserView> users = session.getUsers();
|
||||||
if (!panel.jUserName.getText().equals("")) {
|
if (!panel.getjUserName().getText().equals("")) {
|
||||||
List<UserView> users2 = new ArrayList<>();
|
List<UserView> users2 = new ArrayList<>();
|
||||||
for (UserView user : users) {
|
for (UserView user : users) {
|
||||||
if (user.getUserName().toUpperCase().matches(".*" + panel.jUserName.getText().toUpperCase() + ".*")) {
|
if (user.getUserName().toUpperCase().matches(".*" + panel.getjUserName().getText().toUpperCase() + ".*")) {
|
||||||
users2.add(user);
|
users2.add(user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -651,6 +659,10 @@ class UpdateUsersTask extends SwingWorker<Void, List<UserView>> {
|
||||||
panel.update(view.get(0));
|
panel.update(view.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ConsolePanel getPanel() {
|
||||||
|
return panel;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void done() {
|
protected void done() {
|
||||||
try {
|
try {
|
||||||
|
|
@ -682,16 +694,16 @@ class UpdateTablesTask extends SwingWorker<Void, Collection<TableView>> {
|
||||||
protected Void doInBackground() throws Exception {
|
protected Void doInBackground() throws Exception {
|
||||||
while (!isCancelled()) {
|
while (!isCancelled()) {
|
||||||
Collection<TableView> tableViews = session.getTables(roomId);
|
Collection<TableView> tableViews = session.getTables(roomId);
|
||||||
if (!panel.jUserName.getText().equals("")) {
|
if (!panel.getjUserName().getText().equals("")) {
|
||||||
Collection<TableView> tableViews2 = new ArrayList<>();
|
Collection<TableView> tableViews2 = new ArrayList<>();
|
||||||
for (TableView table : tableViews) {
|
for (TableView table : tableViews) {
|
||||||
if (table.getControllerName().toUpperCase().matches(".*" + panel.jUserName.getText().toUpperCase() + ".*")) {
|
if (table.getControllerName().toUpperCase().matches(".*" + panel.getjUserName().getText().toUpperCase() + ".*")) {
|
||||||
tableViews2.add(table);
|
tableViews2.add(table);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tableViews = tableViews2;
|
tableViews = tableViews2;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.publish(tableViews);
|
this.publish(tableViews);
|
||||||
Thread.sleep(3000);
|
Thread.sleep(3000);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue