mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 13:02:06 -08:00
Few lambda's and removed explicit type from creating lists and hashmaps
This commit is contained in:
parent
0a3c95dde5
commit
11dc1e10f1
130 changed files with 725 additions and 1105 deletions
|
|
@ -34,7 +34,12 @@
|
|||
|
||||
package mage.server.console;
|
||||
|
||||
import java.awt.Cursor;
|
||||
import mage.remote.Connection;
|
||||
import mage.remote.Connection.ProxyType;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
|
|
@ -43,13 +48,6 @@ import java.util.Arrays;
|
|||
import java.util.List;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.SwingWorker;
|
||||
import mage.remote.Connection;
|
||||
import mage.remote.Connection.ProxyType;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -166,40 +164,20 @@ public class ConnectDialog extends JDialog {
|
|||
});
|
||||
|
||||
btnConnect.setText("Connect");
|
||||
btnConnect.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnConnectActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
btnConnect.addActionListener(evt -> btnConnectActionPerformed(evt));
|
||||
|
||||
btnCancel.setText("Cancel");
|
||||
btnCancel.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnCancelActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
btnCancel.addActionListener(evt -> btnCancelActionPerformed(evt));
|
||||
|
||||
chkAutoConnect.setText("Automatically connect to this server next time");
|
||||
chkAutoConnect.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
chkAutoConnectActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
chkAutoConnect.addActionListener(evt -> chkAutoConnectActionPerformed(evt));
|
||||
|
||||
jButton1.setText("Find...");
|
||||
jButton1.setToolTipText("Find public server");
|
||||
jButton1.setName("findServerBtn"); // NOI18N
|
||||
jButton1.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
findPublicServerActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
jButton1.addActionListener(evt -> findPublicServerActionPerformed(evt));
|
||||
|
||||
cbProxyType.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
cbProxyTypeActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
cbProxyType.addActionListener(evt -> cbProxyTypeActionPerformed(evt));
|
||||
|
||||
lblProxyType.setLabelFor(cbProxyType);
|
||||
lblProxyType.setText("Proxy:");
|
||||
|
|
@ -254,11 +232,7 @@ public class ConnectDialog extends JDialog {
|
|||
|
||||
lblProxyPassword.setText("Password:");
|
||||
|
||||
txtPasswordField.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
txtPasswordFieldActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
txtPasswordField.addActionListener(evt -> txtPasswordFieldActionPerformed(evt));
|
||||
|
||||
javax.swing.GroupLayout pnlProxyAuthLayout = new javax.swing.GroupLayout(pnlProxyAuth);
|
||||
pnlProxyAuth.setLayout(pnlProxyAuthLayout);
|
||||
|
|
|
|||
|
|
@ -34,16 +34,6 @@
|
|||
|
||||
package mage.server.console;
|
||||
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.prefs.Preferences;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
import mage.interfaces.MageClient;
|
||||
import mage.interfaces.callback.ClientCallback;
|
||||
import mage.remote.Connection;
|
||||
|
|
@ -52,6 +42,14 @@ import mage.remote.SessionImpl;
|
|||
import mage.utils.MageVersion;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -101,12 +99,7 @@ public class ConsoleFrame extends javax.swing.JFrame implements MageClient {
|
|||
logger.fatal("", ex);
|
||||
}
|
||||
|
||||
pingTaskExecutor.scheduleAtFixedRate(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
session.ping();
|
||||
}
|
||||
}, 60, 60, TimeUnit.SECONDS);
|
||||
pingTaskExecutor.scheduleAtFixedRate(() -> session.ping(), 60, 60, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public boolean connect(Connection connection) {
|
||||
|
|
@ -157,11 +150,7 @@ public class ConsoleFrame extends javax.swing.JFrame implements MageClient {
|
|||
btnConnect.setFocusable(false);
|
||||
btnConnect.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
btnConnect.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
btnConnect.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnConnectActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
btnConnect.addActionListener(evt -> btnConnectActionPerformed(evt));
|
||||
jToolBar1.add(btnConnect);
|
||||
|
||||
btnSendMessage.setActionCommand("SendMessage");
|
||||
|
|
@ -170,11 +159,7 @@ public class ConsoleFrame extends javax.swing.JFrame implements MageClient {
|
|||
btnSendMessage.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
btnSendMessage.setText("Send Message");
|
||||
btnSendMessage.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||
btnSendMessage.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnSendMessageActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
btnSendMessage.addActionListener(evt -> btnSendMessageActionPerformed(evt));
|
||||
jToolBar1.add(btnSendMessage);
|
||||
|
||||
lblStatus.setText("Not Connected");
|
||||
|
|
@ -224,12 +209,9 @@ public class ConsoleFrame extends javax.swing.JFrame implements MageClient {
|
|||
logger.info("Starting MAGE server console version " + version);
|
||||
logger.info("Logging level: " + logger.getEffectiveLevel());
|
||||
|
||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
new ConsoleFrame().setVisible(true);
|
||||
logger.info("Started MAGE server console");
|
||||
}
|
||||
java.awt.EventQueue.invokeLater(() -> {
|
||||
new ConsoleFrame().setVisible(true);
|
||||
logger.info("Started MAGE server console");
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -252,12 +234,9 @@ public class ConsoleFrame extends javax.swing.JFrame implements MageClient {
|
|||
enableButtons();
|
||||
}
|
||||
else {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setStatusText(message);
|
||||
enableButtons();
|
||||
}
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
setStatusText(message);
|
||||
enableButtons();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -270,13 +249,10 @@ public class ConsoleFrame extends javax.swing.JFrame implements MageClient {
|
|||
disableButtons();
|
||||
}
|
||||
else {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
consolePanel1.stop();
|
||||
setStatusText("Not connected");
|
||||
disableButtons();
|
||||
}
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
consolePanel1.stop();
|
||||
setStatusText("Not connected");
|
||||
disableButtons();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -287,12 +263,7 @@ public class ConsoleFrame extends javax.swing.JFrame implements MageClient {
|
|||
JOptionPane.showMessageDialog(this, message);
|
||||
}
|
||||
else {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
JOptionPane.showMessageDialog(getFrame(), message);
|
||||
}
|
||||
});
|
||||
SwingUtilities.invokeLater(() -> JOptionPane.showMessageDialog(getFrame(), message));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -302,12 +273,7 @@ public class ConsoleFrame extends javax.swing.JFrame implements MageClient {
|
|||
JOptionPane.showMessageDialog(this, message, "Error", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
else {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
JOptionPane.showMessageDialog(getFrame(), message, "Error", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
});
|
||||
SwingUtilities.invokeLater(() -> JOptionPane.showMessageDialog(getFrame(), message, "Error", JOptionPane.ERROR_MESSAGE));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,25 +33,23 @@
|
|||
*/
|
||||
package mage.server.console;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import static javax.swing.JTable.AUTO_RESIZE_NEXT_COLUMN;
|
||||
import static javax.swing.JTable.AUTO_RESIZE_OFF;
|
||||
import javax.swing.SwingWorker;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import javax.swing.table.TableRowSorter;
|
||||
import mage.remote.Session;
|
||||
import mage.view.TableView;
|
||||
import mage.view.UserView;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import javax.swing.table.TableRowSorter;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import static javax.swing.JTable.AUTO_RESIZE_NEXT_COLUMN;
|
||||
import static javax.swing.JTable.AUTO_RESIZE_OFF;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -161,42 +159,22 @@ 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);
|
||||
}
|
||||
});
|
||||
btnDisconnect.addActionListener(evt -> btnDisconnectActionPerformed(evt));
|
||||
|
||||
btnEndSession.setText("End session");
|
||||
btnEndSession.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnEndSessionActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
btnEndSession.addActionListener(evt -> btnEndSessionActionPerformed(evt));
|
||||
|
||||
btnMuteUser.setText("Mute user");
|
||||
btnMuteUser.setActionCommand("Mute 1h");
|
||||
btnMuteUser.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnMuteUserActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
btnMuteUser.addActionListener(evt -> btnMuteUserActionPerformed(evt));
|
||||
|
||||
btnDeActivate.setText("(de)activate");
|
||||
btnDeActivate.setActionCommand("Mute 1h");
|
||||
btnDeActivate.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnDeActivateActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
btnDeActivate.addActionListener(evt -> btnDeActivateActionPerformed(evt));
|
||||
|
||||
btnLockUser.setText("Lock user");
|
||||
btnLockUser.setActionCommand("Mute 1h");
|
||||
btnLockUser.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnLockUserActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
btnLockUser.addActionListener(evt -> btnLockUserActionPerformed(evt));
|
||||
|
||||
lblMinutes.setText("Minutes");
|
||||
|
||||
|
|
@ -277,11 +255,7 @@ public class ConsolePanel extends javax.swing.JPanel {
|
|||
);
|
||||
|
||||
btnRemoveTable.setText("Remove Table");
|
||||
btnRemoveTable.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
btnRemoveTableActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
btnRemoveTable.addActionListener(evt -> btnRemoveTableActionPerformed(evt));
|
||||
|
||||
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
|
||||
jPanel6.setLayout(jPanel6Layout);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue