mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
Merge origin/master
Conflicts: Mage.Sets/src/mage/cards/c/CogworkAssembler.java
This commit is contained in:
commit
a175ac3a1d
486 changed files with 6577 additions and 6675 deletions
|
@ -6,7 +6,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.mage</groupId>
|
<groupId>org.mage</groupId>
|
||||||
<artifactId>mage-root</artifactId>
|
<artifactId>mage-root</artifactId>
|
||||||
<version>1.4.20</version>
|
<version>1.4.21</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>org.mage</groupId>
|
<groupId>org.mage</groupId>
|
||||||
|
|
|
@ -39,13 +39,9 @@ import java.awt.Image;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.awt.SplashScreen;
|
import java.awt.SplashScreen;
|
||||||
import java.awt.Toolkit;
|
import java.awt.Toolkit;
|
||||||
import java.awt.event.AWTEventListener;
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.awt.event.ComponentAdapter;
|
import java.awt.event.ComponentAdapter;
|
||||||
import java.awt.event.ComponentEvent;
|
import java.awt.event.ComponentEvent;
|
||||||
import java.awt.event.ItemEvent;
|
import java.awt.event.ItemEvent;
|
||||||
import java.awt.event.ItemListener;
|
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.event.WindowAdapter;
|
import java.awt.event.WindowAdapter;
|
||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
|
@ -163,7 +159,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
|
|
||||||
private static MageFrame instance;
|
private static MageFrame instance;
|
||||||
|
|
||||||
private ConnectDialog connectDialog;
|
private final ConnectDialog connectDialog;
|
||||||
private final ErrorDialog errorDialog;
|
private final ErrorDialog errorDialog;
|
||||||
private static CallbackClient callbackClient;
|
private static CallbackClient callbackClient;
|
||||||
private static final Preferences PREFS = Preferences.userNodeForPackage(MageFrame.class);
|
private static final Preferences PREFS = Preferences.userNodeForPackage(MageFrame.class);
|
||||||
|
@ -254,12 +250,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
|
Toolkit.getDefaultToolkit().addAWTEventListener(event -> handleEvent(event), AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK);
|
||||||
@Override
|
|
||||||
public void eventDispatched(AWTEvent event) {
|
|
||||||
handleEvent(event);
|
|
||||||
}
|
|
||||||
}, AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK);
|
|
||||||
|
|
||||||
TConfig config = TConfig.current();
|
TConfig config = TConfig.current();
|
||||||
config.setArchiveDetector(new TArchiveDetector("zip"));
|
config.setArchiveDetector(new TArchiveDetector("zip"));
|
||||||
|
@ -307,12 +298,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
desktopPane.add(errorDialog, JLayeredPane.POPUP_LAYER);
|
desktopPane.add(errorDialog, JLayeredPane.POPUP_LAYER);
|
||||||
UI.addComponent(MageComponents.DESKTOP_PANE, desktopPane);
|
UI.addComponent(MageComponents.DESKTOP_PANE, desktopPane);
|
||||||
|
|
||||||
PING_TASK_EXECUTOR.scheduleAtFixedRate(new Runnable() {
|
PING_TASK_EXECUTOR.scheduleAtFixedRate(() -> SessionHandler.ping(), 60, 60, TimeUnit.SECONDS);
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
SessionHandler.ping();
|
|
||||||
}
|
|
||||||
}, 60, 60, TimeUnit.SECONDS);
|
|
||||||
|
|
||||||
updateMemUsageTask = new UpdateMemUsageTask(jMemUsageLabel);
|
updateMemUsageTask = new UpdateMemUsageTask(jMemUsageLabel);
|
||||||
|
|
||||||
|
@ -369,24 +355,21 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
|
|
||||||
setGUISize();
|
setGUISize();
|
||||||
|
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> {
|
||||||
@Override
|
disableButtons();
|
||||||
public void run() {
|
if (PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_CHECK, "false").equals("true")) {
|
||||||
disableButtons();
|
checkForNewImages();
|
||||||
if (PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CARD_IMAGES_CHECK, "false").equals("true")) {
|
|
||||||
checkForNewImages();
|
|
||||||
}
|
|
||||||
|
|
||||||
updateMemUsageTask.execute();
|
|
||||||
LOGGER.info("Client start up time: " + ((System.currentTimeMillis() - startTime) / 1000 + " seconds"));
|
|
||||||
if (autoConnect()) {
|
|
||||||
enableButtons();
|
|
||||||
} else {
|
|
||||||
connectDialog.showDialog();
|
|
||||||
}
|
|
||||||
setWindowTitle();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateMemUsageTask.execute();
|
||||||
|
LOGGER.info("Client start up time: " + ((System.currentTimeMillis() - startTime) / 1000 + " seconds"));
|
||||||
|
if (autoConnect()) {
|
||||||
|
enableButtons();
|
||||||
|
} else {
|
||||||
|
connectDialog.showDialog();
|
||||||
|
}
|
||||||
|
setWindowTitle();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (SystemUtil.isMacOSX()) {
|
if (SystemUtil.isMacOSX()) {
|
||||||
|
@ -532,12 +515,9 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
|
|
||||||
private AbstractButton createSwitchPanelsButton() {
|
private AbstractButton createSwitchPanelsButton() {
|
||||||
final JToggleButton switchPanelsButton = new JToggleButton("Switch panels");
|
final JToggleButton switchPanelsButton = new JToggleButton("Switch panels");
|
||||||
switchPanelsButton.addItemListener(new ItemListener() {
|
switchPanelsButton.addItemListener(e -> {
|
||||||
@Override
|
if (e.getStateChange() == ItemEvent.SELECTED) {
|
||||||
public void itemStateChanged(ItemEvent e) {
|
createAndShowSwitchPanelsMenu((JComponent) e.getSource(), switchPanelsButton);
|
||||||
if (e.getStateChange() == ItemEvent.SELECTED) {
|
|
||||||
createAndShowSwitchPanelsMenu((JComponent) e.getSource(), switchPanelsButton);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
switchPanelsButton.setFocusable(false);
|
switchPanelsButton.setFocusable(false);
|
||||||
|
@ -557,12 +537,9 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
menuItem = new MagePaneMenuItem(window);
|
menuItem = new MagePaneMenuItem(window);
|
||||||
menuItem.setFont(GUISizeHelper.menuFont);
|
menuItem.setFont(GUISizeHelper.menuFont);
|
||||||
menuItem.setState(i == 0);
|
menuItem.setState(i == 0);
|
||||||
menuItem.addActionListener(new ActionListener() {
|
menuItem.addActionListener(ae -> {
|
||||||
@Override
|
MagePane frame = ((MagePaneMenuItem) ae.getSource()).getFrame();
|
||||||
public void actionPerformed(ActionEvent ae) {
|
setActive(frame);
|
||||||
MagePane frame = ((MagePaneMenuItem) ae.getSource()).getFrame();
|
|
||||||
setActive(frame);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
menuItem.setIcon(window.getFrameIcon());
|
menuItem.setIcon(window.getFrameIcon());
|
||||||
menu.add(menuItem);
|
menu.add(menuItem);
|
||||||
|
@ -883,11 +860,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
btnPreferences.setFocusable(false);
|
btnPreferences.setFocusable(false);
|
||||||
btnPreferences.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
btnPreferences.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||||
btnPreferences.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnPreferences.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnPreferences.addActionListener(new java.awt.event.ActionListener() {
|
btnPreferences.addActionListener(evt -> btnPreferencesActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnPreferencesActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mageToolbar.add(btnPreferences);
|
mageToolbar.add(btnPreferences);
|
||||||
mageToolbar.add(jSeparator4);
|
mageToolbar.add(jSeparator4);
|
||||||
|
|
||||||
|
@ -896,11 +869,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
btnConnect.setFocusable(false);
|
btnConnect.setFocusable(false);
|
||||||
btnConnect.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
btnConnect.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||||
btnConnect.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnConnect.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnConnect.addActionListener(new java.awt.event.ActionListener() {
|
btnConnect.addActionListener(evt -> btnConnectActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnConnectActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mageToolbar.add(btnConnect);
|
mageToolbar.add(btnConnect);
|
||||||
|
|
||||||
lblStatus.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
lblStatus.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
||||||
|
@ -916,11 +885,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
btnDeckEditor.setFocusable(false);
|
btnDeckEditor.setFocusable(false);
|
||||||
btnDeckEditor.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
btnDeckEditor.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||||
btnDeckEditor.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnDeckEditor.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnDeckEditor.addActionListener(new java.awt.event.ActionListener() {
|
btnDeckEditor.addActionListener(evt -> btnDeckEditorActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnDeckEditorActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mageToolbar.add(btnDeckEditor);
|
mageToolbar.add(btnDeckEditor);
|
||||||
mageToolbar.add(jSeparator2);
|
mageToolbar.add(jSeparator2);
|
||||||
|
|
||||||
|
@ -930,11 +895,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
btnCollectionViewer.setFocusable(false);
|
btnCollectionViewer.setFocusable(false);
|
||||||
btnCollectionViewer.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
btnCollectionViewer.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||||
btnCollectionViewer.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnCollectionViewer.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnCollectionViewer.addActionListener(new java.awt.event.ActionListener() {
|
btnCollectionViewer.addActionListener(evt -> btnCollectionViewerActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnCollectionViewerActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mageToolbar.add(btnCollectionViewer);
|
mageToolbar.add(btnCollectionViewer);
|
||||||
mageToolbar.add(jSeparator5);
|
mageToolbar.add(jSeparator5);
|
||||||
|
|
||||||
|
@ -944,11 +905,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
btnSendFeedback.setFocusable(false);
|
btnSendFeedback.setFocusable(false);
|
||||||
btnSendFeedback.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
btnSendFeedback.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||||
btnSendFeedback.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnSendFeedback.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnSendFeedback.addActionListener(new java.awt.event.ActionListener() {
|
btnSendFeedback.addActionListener(evt -> btnSendFeedbackActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnSendFeedbackActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mageToolbar.add(btnSendFeedback);
|
mageToolbar.add(btnSendFeedback);
|
||||||
mageToolbar.add(jSeparator6);
|
mageToolbar.add(jSeparator6);
|
||||||
|
|
||||||
|
@ -958,11 +915,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
btnSymbols.setFocusable(false);
|
btnSymbols.setFocusable(false);
|
||||||
btnSymbols.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
btnSymbols.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||||
btnSymbols.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnSymbols.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnSymbols.addActionListener(new java.awt.event.ActionListener() {
|
btnSymbols.addActionListener(evt -> btnSymbolsActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnSymbolsActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mageToolbar.add(btnSymbols);
|
mageToolbar.add(btnSymbols);
|
||||||
mageToolbar.add(jSeparatorSymbols);
|
mageToolbar.add(jSeparatorSymbols);
|
||||||
|
|
||||||
|
@ -972,11 +925,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
btnImages.setFocusable(false);
|
btnImages.setFocusable(false);
|
||||||
btnImages.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
btnImages.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||||
btnImages.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnImages.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnImages.addActionListener(new java.awt.event.ActionListener() {
|
btnImages.addActionListener(evt -> btnImagesActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnImagesActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mageToolbar.add(btnImages);
|
mageToolbar.add(btnImages);
|
||||||
mageToolbar.add(jSeparatorImages);
|
mageToolbar.add(jSeparatorImages);
|
||||||
|
|
||||||
|
@ -986,11 +935,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
btnAbout.setFocusable(false);
|
btnAbout.setFocusable(false);
|
||||||
btnAbout.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
btnAbout.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||||
btnAbout.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnAbout.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnAbout.addActionListener(new java.awt.event.ActionListener() {
|
btnAbout.addActionListener(evt -> btnAboutActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnAboutActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mageToolbar.add(btnAbout);
|
mageToolbar.add(btnAbout);
|
||||||
mageToolbar.add(jSeparator7);
|
mageToolbar.add(jSeparator7);
|
||||||
|
|
||||||
|
@ -1192,12 +1137,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
if (SwingUtilities.isEventDispatchThread()) {
|
if (SwingUtilities.isEventDispatchThread()) {
|
||||||
userRequestDialog.showDialog(userRequestMessage);
|
userRequestDialog.showDialog(userRequestMessage);
|
||||||
} else {
|
} else {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> userRequestDialog.showDialog(userRequestMessage));
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
userRequestDialog.showDialog(userRequestMessage);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1206,12 +1146,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
if (SwingUtilities.isEventDispatchThread()) {
|
if (SwingUtilities.isEventDispatchThread()) {
|
||||||
errorDialog.showDialog(title, message);
|
errorDialog.showDialog(title, message);
|
||||||
} else {
|
} else {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> errorDialog.showDialog(title, message));
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
errorDialog.showDialog(title, message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1253,40 +1188,32 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
LOGGER.info("Logging level: " + LOGGER.getEffectiveLevel());
|
LOGGER.info("Logging level: " + LOGGER.getEffectiveLevel());
|
||||||
|
|
||||||
startTime = System.currentTimeMillis();
|
startTime = System.currentTimeMillis();
|
||||||
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
Thread.setDefaultUncaughtExceptionHandler((t, e) -> LOGGER.fatal(null, e));
|
||||||
@Override
|
SwingUtilities.invokeLater(() -> {
|
||||||
public void uncaughtException(Thread t, Throwable e) {
|
for (String arg : args) {
|
||||||
LOGGER.fatal(null, e);
|
if (arg.startsWith(LITE_MODE_ARG)) {
|
||||||
|
liteMode = true;
|
||||||
|
}
|
||||||
|
if (arg.startsWith(GRAY_MODE_ARG)) {
|
||||||
|
grayMode = true;
|
||||||
|
}
|
||||||
|
if (arg.startsWith(FILL_SCREEN_ARG)) {
|
||||||
|
fullscreenMode = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
if (!liteMode) {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
final SplashScreen splash = SplashScreen.getSplashScreen();
|
||||||
@Override
|
if (splash != null) {
|
||||||
public void run() {
|
Graphics2D g = splash.createGraphics();
|
||||||
for (String arg : args) {
|
if (g != null) {
|
||||||
if (arg.startsWith(LITE_MODE_ARG)) {
|
renderSplashFrame(g);
|
||||||
liteMode = true;
|
|
||||||
}
|
|
||||||
if (arg.startsWith(GRAY_MODE_ARG)) {
|
|
||||||
grayMode = true;
|
|
||||||
}
|
|
||||||
if (arg.startsWith(FILL_SCREEN_ARG)) {
|
|
||||||
fullscreenMode = true;
|
|
||||||
}
|
}
|
||||||
|
splash.update();
|
||||||
}
|
}
|
||||||
if (!liteMode) {
|
}
|
||||||
final SplashScreen splash = SplashScreen.getSplashScreen();
|
instance = new MageFrame();
|
||||||
if (splash != null) {
|
instance.setVisible(true);
|
||||||
Graphics2D g = splash.createGraphics();
|
|
||||||
if (g != null) {
|
|
||||||
renderSplashFrame(g);
|
|
||||||
}
|
|
||||||
splash.update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
instance = new MageFrame();
|
|
||||||
instance.setVisible(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1383,12 +1310,9 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
setStatusText(message);
|
setStatusText(message);
|
||||||
enableButtons();
|
enableButtons();
|
||||||
} else {
|
} else {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> {
|
||||||
@Override
|
setStatusText(message);
|
||||||
public void run() {
|
enableButtons();
|
||||||
setStatusText(message);
|
|
||||||
enableButtons();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1403,20 +1327,17 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
||||||
hideTables();
|
hideTables();
|
||||||
} else {
|
} else {
|
||||||
LOGGER.info("DISCONNECTED (NO Event Dispatch Thread)");
|
LOGGER.info("DISCONNECTED (NO Event Dispatch Thread)");
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> {
|
||||||
@Override
|
setStatusText("Not connected");
|
||||||
public void run() {
|
disableButtons();
|
||||||
setStatusText("Not connected");
|
hideGames();
|
||||||
disableButtons();
|
hideTables();
|
||||||
hideGames();
|
SessionHandler.disconnect(false);
|
||||||
hideTables();
|
if (errorCall) {
|
||||||
SessionHandler.disconnect(false);
|
UserRequestMessage message = new UserRequestMessage("Connection lost", "The connection to server was lost. Reconnect to " + currentConnection.getHost() + "?");
|
||||||
if (errorCall) {
|
message.setButton1("No", null);
|
||||||
UserRequestMessage message = new UserRequestMessage("Connection lost", "The connection to server was lost. Reconnect to " + currentConnection.getHost() + "?");
|
message.setButton2("Yes", PlayerAction.CLIENT_RECONNECT);
|
||||||
message.setButton1("No", null);
|
showUserRequestDialog(message);
|
||||||
message.setButton2("Yes", PlayerAction.CLIENT_RECONNECT);
|
|
||||||
showUserRequestDialog(message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -86,7 +86,6 @@ import mage.client.util.ImageHelper;
|
||||||
import mage.client.util.gui.ArrowBuilder;
|
import mage.client.util.gui.ArrowBuilder;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.EnlargeMode;
|
import mage.constants.EnlargeMode;
|
||||||
import mage.remote.Session;
|
|
||||||
import mage.view.AbilityView;
|
import mage.view.AbilityView;
|
||||||
import mage.view.CardView;
|
import mage.view.CardView;
|
||||||
import mage.view.CounterView;
|
import mage.view.CounterView;
|
||||||
|
@ -101,10 +100,10 @@ import org.apache.log4j.Logger;
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class Card extends MagePermanent implements MouseMotionListener, MouseListener, FocusListener, ComponentListener {
|
public class Card extends MagePermanent implements MouseMotionListener, MouseListener, FocusListener, ComponentListener {
|
||||||
|
|
||||||
protected static DefaultActionCallback callback = DefaultActionCallback.getInstance();
|
protected static final DefaultActionCallback callback = DefaultActionCallback.getInstance();
|
||||||
|
|
||||||
protected Point p;
|
protected Point p;
|
||||||
protected CardDimensions dimension;
|
protected final CardDimensions dimension;
|
||||||
|
|
||||||
protected final UUID gameId;
|
protected final UUID gameId;
|
||||||
protected final BigCard bigCard;
|
protected final BigCard bigCard;
|
||||||
|
@ -112,10 +111,10 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
|
||||||
protected Popup tooltipPopup;
|
protected Popup tooltipPopup;
|
||||||
protected boolean tooltipShowing;
|
protected boolean tooltipShowing;
|
||||||
|
|
||||||
protected TextPopup tooltipText = new TextPopup();
|
protected final TextPopup tooltipText = new TextPopup();
|
||||||
protected BufferedImage background;
|
protected BufferedImage background;
|
||||||
protected BufferedImage image = new BufferedImage(FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT, BufferedImage.TYPE_INT_RGB);
|
protected final BufferedImage image = new BufferedImage(FRAME_MAX_WIDTH, FRAME_MAX_HEIGHT, BufferedImage.TYPE_INT_RGB);
|
||||||
protected BufferedImage small;
|
protected final BufferedImage small;
|
||||||
protected String backgroundName;
|
protected String backgroundName;
|
||||||
|
|
||||||
// if this is set, it's opened if the user right clicks on the card panel
|
// if this is set, it's opened if the user right clicks on the card panel
|
||||||
|
|
|
@ -52,7 +52,7 @@ import org.mage.card.arcane.CardPanel;
|
||||||
|
|
||||||
public class CardArea extends JPanel implements MouseListener {
|
public class CardArea extends JPanel implements MouseListener {
|
||||||
|
|
||||||
protected CardEventSource cardEventSource = new CardEventSource();
|
protected final CardEventSource cardEventSource = new CardEventSource();
|
||||||
|
|
||||||
private boolean reloaded = false;
|
private boolean reloaded = false;
|
||||||
private final javax.swing.JLayeredPane cardArea;
|
private final javax.swing.JLayeredPane cardArea;
|
||||||
|
@ -89,7 +89,7 @@ public class CardArea extends JPanel implements MouseListener {
|
||||||
setGUISize();
|
setGUISize();
|
||||||
for (Component component : cardArea.getComponents()) {
|
for (Component component : cardArea.getComponents()) {
|
||||||
if (component instanceof CardPanel) {
|
if (component instanceof CardPanel) {
|
||||||
((CardPanel) component).setBounds(0, 0, cardDimension.width, cardDimension.height);
|
component.setBounds(0, 0, cardDimension.width, cardDimension.height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package mage.client.cards;
|
||||||
import mage.cards.MageCard;
|
import mage.cards.MageCard;
|
||||||
import mage.client.plugins.impl.Plugins;
|
import mage.client.plugins.impl.Plugins;
|
||||||
import mage.view.CardView;
|
import mage.view.CardView;
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
@ -11,13 +10,12 @@ import java.awt.event.MouseEvent;
|
||||||
import java.awt.event.MouseListener;
|
import java.awt.event.MouseListener;
|
||||||
import java.awt.event.MouseMotionListener;
|
import java.awt.event.MouseMotionListener;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by StravantUser on 2016-09-22.
|
* Created by StravantUser on 2016-09-22.
|
||||||
*/
|
*/
|
||||||
public class CardDraggerGlassPane implements MouseListener, MouseMotionListener {
|
public class CardDraggerGlassPane implements MouseListener, MouseMotionListener {
|
||||||
private DragCardSource source;
|
private final DragCardSource source;
|
||||||
private Component dragComponent;
|
private Component dragComponent;
|
||||||
private JRootPane currentRoot;
|
private JRootPane currentRoot;
|
||||||
private JComponent glassPane;
|
private JComponent glassPane;
|
||||||
|
|
|
@ -33,7 +33,6 @@ import mage.client.util.Event;
|
||||||
import mage.client.util.EventDispatcher;
|
import mage.client.util.EventDispatcher;
|
||||||
import mage.client.util.EventSource;
|
import mage.client.util.EventSource;
|
||||||
import mage.client.util.Listener;
|
import mage.client.util.Listener;
|
||||||
import mage.view.CardView;
|
|
||||||
import mage.view.SimpleCardView;
|
import mage.view.SimpleCardView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -39,7 +39,6 @@ import java.awt.Rectangle;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.event.MouseListener;
|
import java.awt.event.MouseListener;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -64,7 +63,7 @@ import org.mage.card.arcane.CardPanel;
|
||||||
*/
|
*/
|
||||||
public class CardGrid extends javax.swing.JLayeredPane implements MouseListener, ICardGrid {
|
public class CardGrid extends javax.swing.JLayeredPane implements MouseListener, ICardGrid {
|
||||||
|
|
||||||
protected CardEventSource cardEventSource = new CardEventSource();
|
protected final CardEventSource cardEventSource = new CardEventSource();
|
||||||
protected BigCard bigCard;
|
protected BigCard bigCard;
|
||||||
protected UUID gameId;
|
protected UUID gameId;
|
||||||
private final Map<UUID, MageCard> cards = new HashMap<>();
|
private final Map<UUID, MageCard> cards = new HashMap<>();
|
||||||
|
@ -154,22 +153,22 @@ public class CardGrid extends javax.swing.JLayeredPane implements MouseListener,
|
||||||
List<MageCard> sortedCards = new ArrayList<>(cards.values());
|
List<MageCard> sortedCards = new ArrayList<>(cards.values());
|
||||||
switch (sortSetting.getSortBy()) {
|
switch (sortSetting.getSortBy()) {
|
||||||
case NAME:
|
case NAME:
|
||||||
Collections.sort(sortedCards, new CardNameComparator());
|
sortedCards.sort(new CardNameComparator());
|
||||||
break;
|
break;
|
||||||
case CARD_TYPE:
|
case CARD_TYPE:
|
||||||
Collections.sort(sortedCards, new CardTypeComparator());
|
sortedCards.sort(new CardTypeComparator());
|
||||||
break;
|
break;
|
||||||
case RARITY:
|
case RARITY:
|
||||||
Collections.sort(sortedCards, new CardRarityComparator());
|
sortedCards.sort(new CardRarityComparator());
|
||||||
break;
|
break;
|
||||||
case COLOR:
|
case COLOR:
|
||||||
Collections.sort(sortedCards, new CardColorComparator());
|
sortedCards.sort(new CardColorComparator());
|
||||||
break;
|
break;
|
||||||
case COLOR_IDENTITY:
|
case COLOR_IDENTITY:
|
||||||
Collections.sort(sortedCards, new CardColorDetailedIdentity());
|
sortedCards.sort(new CardColorDetailedIdentity());
|
||||||
break;
|
break;
|
||||||
case CASTING_COST:
|
case CASTING_COST:
|
||||||
Collections.sort(sortedCards, new CardCostComparator());
|
sortedCards.sort(new CardCostComparator());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -409,7 +408,7 @@ class CardCostComparator implements Comparator<MageCard> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(MageCard o1, MageCard o2) {
|
public int compare(MageCard o1, MageCard o2) {
|
||||||
int val = Integer.valueOf(o1.getOriginal().getConvertedManaCost()).compareTo(Integer.valueOf(o2.getOriginal().getConvertedManaCost()));
|
int val = Integer.valueOf(o1.getOriginal().getConvertedManaCost()).compareTo(o2.getOriginal().getConvertedManaCost());
|
||||||
if (val == 0) {
|
if (val == 0) {
|
||||||
return o1.getOriginal().getName().compareTo(o2.getOriginal().getName());
|
return o1.getOriginal().getName().compareTo(o2.getOriginal().getName());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -37,8 +37,6 @@ import java.awt.Color;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -210,7 +208,7 @@ public class Cards extends javax.swing.JPanel {
|
||||||
tmp.setIsAbility(true);
|
tmp.setIsAbility(true);
|
||||||
tmp.overrideTargets(card.getTargets());
|
tmp.overrideTargets(card.getTargets());
|
||||||
tmp.overrideId(card.getId());
|
tmp.overrideId(card.getId());
|
||||||
tmp.setAbilityType(((StackAbilityView) card).getAbilityType());
|
tmp.setAbilityType(card.getAbilityType());
|
||||||
card = tmp;
|
card = tmp;
|
||||||
} else {
|
} else {
|
||||||
card.setAbilityType(null);
|
card.setAbilityType(null);
|
||||||
|
@ -258,7 +256,7 @@ public class Cards extends javax.swing.JPanel {
|
||||||
this.cardDimension = dimension;
|
this.cardDimension = dimension;
|
||||||
for (Component component : cardArea.getComponents()) {
|
for (Component component : cardArea.getComponents()) {
|
||||||
if (component instanceof CardPanel) {
|
if (component instanceof CardPanel) {
|
||||||
((CardPanel) component).setBounds(0, 0, dimension.width, dimension.height);
|
component.setBounds(0, 0, dimension.width, dimension.height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
layoutCards();
|
layoutCards();
|
||||||
|
@ -358,12 +356,7 @@ public class Cards extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// sort the cards
|
// sort the cards
|
||||||
Collections.sort(cardsToLayout, new Comparator<CardPanel>() {
|
cardsToLayout.sort((cp1, cp2) -> Integer.valueOf(cp1.getLocation().x).compareTo(cp2.getLocation().x));
|
||||||
@Override
|
|
||||||
public int compare(CardPanel cp1, CardPanel cp2) {
|
|
||||||
return Integer.valueOf(cp1.getLocation().x).compareTo(cp2.getLocation().x);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// relocate the cards
|
// relocate the cards
|
||||||
int dx = 0;
|
int dx = 0;
|
||||||
for (Component component : cardsToLayout) {
|
for (Component component : cardsToLayout) {
|
||||||
|
|
|
@ -83,7 +83,7 @@ import org.mage.card.arcane.CardPanel;
|
||||||
*/
|
*/
|
||||||
public class CardsList extends javax.swing.JPanel implements MouseListener, ICardGrid {
|
public class CardsList extends javax.swing.JPanel implements MouseListener, ICardGrid {
|
||||||
|
|
||||||
protected CardEventSource cardEventSource = new CardEventSource();
|
protected final CardEventSource cardEventSource = new CardEventSource();
|
||||||
private Dimension cardDimension;
|
private Dimension cardDimension;
|
||||||
private int rowHeight;
|
private int rowHeight;
|
||||||
private CardsView cards;
|
private CardsView cards;
|
||||||
|
@ -346,8 +346,8 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (comparator != null) {
|
if (comparator != null) {
|
||||||
Collections.sort(sortedCards, new CardViewNameComparator());
|
sortedCards.sort(new CardViewNameComparator());
|
||||||
Collections.sort(sortedCards, comparator);
|
sortedCards.sort(comparator);
|
||||||
}
|
}
|
||||||
CardView lastCard = null;
|
CardView lastCard = null;
|
||||||
for (CardView card : sortedCards) {
|
for (CardView card : sortedCards) {
|
||||||
|
@ -536,11 +536,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
||||||
chkPiles.setText("Piles");
|
chkPiles.setText("Piles");
|
||||||
chkPiles.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
chkPiles.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
||||||
chkPiles.setMargin(new java.awt.Insets(3, 2, 2, 2));
|
chkPiles.setMargin(new java.awt.Insets(3, 2, 2, 2));
|
||||||
chkPiles.addActionListener(new java.awt.event.ActionListener() {
|
chkPiles.addActionListener(evt -> chkPilesActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
chkPilesActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
cbSortBy.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "SortBy" }));
|
cbSortBy.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "SortBy" }));
|
||||||
cbSortBy.setToolTipText("Sort the cards if card view is active.");
|
cbSortBy.setToolTipText("Sort the cards if card view is active.");
|
||||||
|
@ -549,11 +545,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
||||||
cbSortBy.setName("SortBy"); // NOI18N
|
cbSortBy.setName("SortBy"); // NOI18N
|
||||||
cbSortBy.setOpaque(false);
|
cbSortBy.setOpaque(false);
|
||||||
cbSortBy.setPreferredSize(new java.awt.Dimension(120, 20));
|
cbSortBy.setPreferredSize(new java.awt.Dimension(120, 20));
|
||||||
cbSortBy.addActionListener(new java.awt.event.ActionListener() {
|
cbSortBy.addActionListener(evt -> cbSortByActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbSortByActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
bgView.add(jToggleListView);
|
bgView.add(jToggleListView);
|
||||||
jToggleListView.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/list_panel.png"))); // NOI18N
|
jToggleListView.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/list_panel.png"))); // NOI18N
|
||||||
|
@ -564,11 +556,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
||||||
jToggleListView.setMaximumSize(new java.awt.Dimension(37, 25));
|
jToggleListView.setMaximumSize(new java.awt.Dimension(37, 25));
|
||||||
jToggleListView.setMinimumSize(new java.awt.Dimension(37, 25));
|
jToggleListView.setMinimumSize(new java.awt.Dimension(37, 25));
|
||||||
jToggleListView.setPreferredSize(new java.awt.Dimension(44, 22));
|
jToggleListView.setPreferredSize(new java.awt.Dimension(44, 22));
|
||||||
jToggleListView.addActionListener(new java.awt.event.ActionListener() {
|
jToggleListView.addActionListener(evt -> jToggleListViewActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
jToggleListViewActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
bgView.add(jToggleCardView);
|
bgView.add(jToggleCardView);
|
||||||
jToggleCardView.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/card_panel.png"))); // NOI18N
|
jToggleCardView.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/card_panel.png"))); // NOI18N
|
||||||
|
@ -576,11 +564,7 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
|
||||||
jToggleCardView.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
|
jToggleCardView.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
|
||||||
jToggleCardView.setMargin(new java.awt.Insets(2, 6, 2, 6));
|
jToggleCardView.setMargin(new java.awt.Insets(2, 6, 2, 6));
|
||||||
jToggleCardView.setPreferredSize(new java.awt.Dimension(40, 22));
|
jToggleCardView.setPreferredSize(new java.awt.Dimension(40, 22));
|
||||||
jToggleCardView.addActionListener(new java.awt.event.ActionListener() {
|
jToggleCardView.addActionListener(evt -> jToggleCardViewActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
jToggleCardViewActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
javax.swing.GroupLayout panelControlLayout = new javax.swing.GroupLayout(panelControl);
|
javax.swing.GroupLayout panelControlLayout = new javax.swing.GroupLayout(panelControl);
|
||||||
panelControl.setLayout(panelControlLayout);
|
panelControl.setLayout(panelControlLayout);
|
||||||
|
|
|
@ -40,7 +40,6 @@ import java.awt.Rectangle;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.event.MouseListener;
|
import java.awt.event.MouseListener;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import mage.cards.CardDimensions;
|
import mage.cards.CardDimensions;
|
||||||
import mage.cards.MageCard;
|
import mage.cards.MageCard;
|
||||||
|
@ -62,7 +61,7 @@ public class DraftGrid extends javax.swing.JPanel implements MouseListener {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(DraftGrid.class);
|
private static final Logger logger = Logger.getLogger(DraftGrid.class);
|
||||||
|
|
||||||
protected CardEventSource cardEventSource = new CardEventSource();
|
protected final CardEventSource cardEventSource = new CardEventSource();
|
||||||
protected BigCard bigCard;
|
protected BigCard bigCard;
|
||||||
protected MageCard markedCard;
|
protected MageCard markedCard;
|
||||||
protected boolean emptyGrid;
|
protected boolean emptyGrid;
|
||||||
|
@ -126,7 +125,7 @@ public class DraftGrid extends javax.swing.JPanel implements MouseListener {
|
||||||
Dimension dimension = new Dimension(cardDimension.frameWidth, cardDimension.frameHeight);
|
Dimension dimension = new Dimension(cardDimension.frameWidth, cardDimension.frameHeight);
|
||||||
|
|
||||||
List<CardView> sortedCards = new ArrayList<>(booster.values());
|
List<CardView> sortedCards = new ArrayList<>(booster.values());
|
||||||
Collections.sort(sortedCards, new CardViewRarityComparator());
|
sortedCards.sort(new CardViewRarityComparator());
|
||||||
for (CardView card: sortedCards) {
|
for (CardView card: sortedCards) {
|
||||||
MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, dimension, null, true, true);
|
MageCard cardImg = Plugins.getInstance().getMageCard(card, bigCard, dimension, null, true, true);
|
||||||
cardImg.addMouseListener(this);
|
cardImg.addMouseListener(this);
|
||||||
|
|
|
@ -7,15 +7,12 @@ import java.awt.Graphics;
|
||||||
import java.awt.GridBagConstraints;
|
import java.awt.GridBagConstraints;
|
||||||
import java.awt.GridBagLayout;
|
import java.awt.GridBagLayout;
|
||||||
import java.awt.GridLayout;
|
import java.awt.GridLayout;
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.awt.event.KeyAdapter;
|
import java.awt.event.KeyAdapter;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -40,9 +37,11 @@ import javax.swing.JLabel;
|
||||||
import javax.swing.JLayeredPane;
|
import javax.swing.JLayeredPane;
|
||||||
import javax.swing.JMenu;
|
import javax.swing.JMenu;
|
||||||
import javax.swing.JMenuItem;
|
import javax.swing.JMenuItem;
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JPopupMenu;
|
import javax.swing.JPopupMenu;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
|
import mage.cards.Card;
|
||||||
import javax.swing.JSlider;
|
import javax.swing.JSlider;
|
||||||
import javax.swing.JTextField;
|
import javax.swing.JTextField;
|
||||||
import javax.swing.JToggleButton;
|
import javax.swing.JToggleButton;
|
||||||
|
@ -52,6 +51,9 @@ import javax.swing.SwingUtilities;
|
||||||
import mage.cards.MageCard;
|
import mage.cards.MageCard;
|
||||||
import mage.cards.decks.DeckCardInfo;
|
import mage.cards.decks.DeckCardInfo;
|
||||||
import mage.cards.decks.DeckCardLayout;
|
import mage.cards.decks.DeckCardLayout;
|
||||||
|
import mage.cards.repository.CardCriteria;
|
||||||
|
import mage.cards.repository.CardInfo;
|
||||||
|
import mage.cards.repository.CardRepository;
|
||||||
import mage.client.MageFrame;
|
import mage.client.MageFrame;
|
||||||
import mage.client.constants.Constants;
|
import mage.client.constants.Constants;
|
||||||
import mage.client.dialog.PreferencesDialog;
|
import mage.client.dialog.PreferencesDialog;
|
||||||
|
@ -66,6 +68,7 @@ import mage.client.util.Event;
|
||||||
import mage.client.util.GUISizeHelper;
|
import mage.client.util.GUISizeHelper;
|
||||||
import mage.client.util.Listener;
|
import mage.client.util.Listener;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
|
import mage.util.RandomUtil;
|
||||||
import mage.view.CardView;
|
import mage.view.CardView;
|
||||||
import mage.view.CardsView;
|
import mage.view.CardsView;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
@ -455,12 +458,9 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Sort {
|
public enum Sort {
|
||||||
NONE("No Sort", new Comparator<CardView>() {
|
NONE("No Sort", (o1, o2) -> {
|
||||||
@Override
|
// Always equal, sort into the first row
|
||||||
public int compare(CardView o1, CardView o2) {
|
return 0;
|
||||||
// Always equal, sort into the first row
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}),
|
}),
|
||||||
CARD_TYPE("Card Type", new CardViewCardTypeComparator()),
|
CARD_TYPE("Card Type", new CardViewCardTypeComparator()),
|
||||||
CMC("Converted Mana Cost", new CardViewCostComparator()),
|
CMC("Converted Mana Cost", new CardViewCostComparator()),
|
||||||
|
@ -508,44 +508,44 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
||||||
}
|
}
|
||||||
|
|
||||||
// Counters we use
|
// Counters we use
|
||||||
private CardTypeCounter creatureCounter = new CardTypeCounter() {
|
private final CardTypeCounter creatureCounter = new CardTypeCounter() {
|
||||||
@Override
|
@Override
|
||||||
protected boolean is(CardView card) {
|
protected boolean is(CardView card) {
|
||||||
return card.getCardTypes().contains(CardType.CREATURE);
|
return card.getCardTypes().contains(CardType.CREATURE);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private CardTypeCounter landCounter = new CardTypeCounter() {
|
private final CardTypeCounter landCounter = new CardTypeCounter() {
|
||||||
@Override
|
@Override
|
||||||
protected boolean is(CardView card) {
|
protected boolean is(CardView card) {
|
||||||
return card.getCardTypes().contains(CardType.LAND);
|
return card.getCardTypes().contains(CardType.LAND);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private CardTypeCounter artifactCounter = new CardTypeCounter() {
|
private final CardTypeCounter artifactCounter = new CardTypeCounter() {
|
||||||
@Override
|
@Override
|
||||||
protected boolean is(CardView card) {
|
protected boolean is(CardView card) {
|
||||||
return card.getCardTypes().contains(CardType.ARTIFACT);
|
return card.getCardTypes().contains(CardType.ARTIFACT);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private CardTypeCounter enchantmentCounter = new CardTypeCounter() {
|
private final CardTypeCounter enchantmentCounter = new CardTypeCounter() {
|
||||||
@Override
|
@Override
|
||||||
protected boolean is(CardView card) {
|
protected boolean is(CardView card) {
|
||||||
return card.getCardTypes().contains(CardType.ENCHANTMENT);
|
return card.getCardTypes().contains(CardType.ENCHANTMENT);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private CardTypeCounter instantCounter = new CardTypeCounter() {
|
private final CardTypeCounter instantCounter = new CardTypeCounter() {
|
||||||
@Override
|
@Override
|
||||||
protected boolean is(CardView card) {
|
protected boolean is(CardView card) {
|
||||||
return card.getCardTypes().contains(CardType.INSTANT);
|
return card.getCardTypes().contains(CardType.INSTANT);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private CardTypeCounter sorceryCounter = new CardTypeCounter() {
|
private final CardTypeCounter sorceryCounter = new CardTypeCounter() {
|
||||||
@Override
|
@Override
|
||||||
protected boolean is(CardView card) {
|
protected boolean is(CardView card) {
|
||||||
return card.getCardTypes().contains(CardType.SORCERY);
|
return card.getCardTypes().contains(CardType.SORCERY);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private CardTypeCounter planeswalkerCounter = new CardTypeCounter() {
|
private final CardTypeCounter planeswalkerCounter = new CardTypeCounter() {
|
||||||
@Override
|
@Override
|
||||||
protected boolean is(CardView card) {
|
protected boolean is(CardView card) {
|
||||||
return card.getCardTypes().contains(CardType.PLANESWALKER);
|
return card.getCardTypes().contains(CardType.PLANESWALKER);
|
||||||
|
@ -577,15 +577,15 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
||||||
void hideCards(Collection<CardView> card);
|
void hideCards(Collection<CardView> card);
|
||||||
|
|
||||||
void duplicateCards(Collection<CardView> cards);
|
void duplicateCards(Collection<CardView> cards);
|
||||||
|
|
||||||
void invertCardSelection(Collection<CardView> cards);
|
void invertCardSelection(Collection<CardView> cards);
|
||||||
|
|
||||||
void showAll();
|
void showAll();
|
||||||
};
|
}
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
public static int COUNT_LABEL_HEIGHT = 20;
|
public static final int COUNT_LABEL_HEIGHT = 20;
|
||||||
public static int GRID_PADDING = 10;
|
public static final int GRID_PADDING = 10;
|
||||||
|
|
||||||
private final static ImageIcon INSERT_ROW_ICON = new ImageIcon(DragCardGrid.class.getClassLoader().getResource("editor_insert_row.png"));
|
private final static ImageIcon INSERT_ROW_ICON = new ImageIcon(DragCardGrid.class.getClassLoader().getResource("editor_insert_row.png"));
|
||||||
private final static ImageIcon INSERT_COL_ICON = new ImageIcon(DragCardGrid.class.getClassLoader().getResource("editor_insert_col.png"));
|
private final static ImageIcon INSERT_COL_ICON = new ImageIcon(DragCardGrid.class.getClassLoader().getResource("editor_insert_col.png"));
|
||||||
|
@ -606,36 +606,38 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
||||||
JButton visibilityButton;
|
JButton visibilityButton;
|
||||||
JButton selectByButton;
|
JButton selectByButton;
|
||||||
JButton analyseButton;
|
JButton analyseButton;
|
||||||
|
JButton blingButton;
|
||||||
|
|
||||||
|
|
||||||
// Popup for toolbar
|
// Popup for toolbar
|
||||||
JPopupMenu filterPopup;
|
final JPopupMenu filterPopup;
|
||||||
JPopupMenu selectByTypePopup;
|
JPopupMenu selectByTypePopup;
|
||||||
|
|
||||||
JPopupMenu sortPopup;
|
final JPopupMenu sortPopup;
|
||||||
JPopupMenu selectByPopup;
|
final JPopupMenu selectByPopup;
|
||||||
JCheckBox separateCreaturesCb;
|
final JCheckBox separateCreaturesCb;
|
||||||
JTextField searchByTextField;
|
final JTextField searchByTextField;
|
||||||
JToggleButton multiplesButton;
|
JToggleButton multiplesButton;
|
||||||
|
|
||||||
JSlider cardSizeSlider;
|
final JSlider cardSizeSlider;
|
||||||
JLabel cardSizeSliderLabel;
|
final JLabel cardSizeSliderLabel;
|
||||||
|
|
||||||
Map<Sort, AbstractButton> sortButtons = new HashMap<>();
|
final Map<Sort, AbstractButton> sortButtons = new HashMap<>();
|
||||||
HashMap<CardType, AbstractButton> selectByTypeButtons = new HashMap<>();
|
final HashMap<CardType, AbstractButton> selectByTypeButtons = new HashMap<>();
|
||||||
|
|
||||||
JLabel deckNameAndCountLabel;
|
final JLabel deckNameAndCountLabel;
|
||||||
JLabel landCountLabel;
|
final JLabel landCountLabel;
|
||||||
JLabel creatureCountLabel;
|
final JLabel creatureCountLabel;
|
||||||
|
|
||||||
// Main two controls holding the scrollable card grid
|
// Main two controls holding the scrollable card grid
|
||||||
JScrollPane cardScroll;
|
final JScrollPane cardScroll;
|
||||||
JLayeredPane cardContent;
|
JLayeredPane cardContent;
|
||||||
|
|
||||||
// Drag onto insert arrow
|
// Drag onto insert arrow
|
||||||
JLabel insertArrow;
|
final JLabel insertArrow;
|
||||||
|
|
||||||
// Card area selection panel
|
// Card area selection panel
|
||||||
SelectionBox selectionPanel;
|
final SelectionBox selectionPanel;
|
||||||
Set<CardView> selectionDragStartCards;
|
Set<CardView> selectionDragStartCards;
|
||||||
int selectionDragStartX;
|
int selectionDragStartX;
|
||||||
int selectionDragStartY;
|
int selectionDragStartY;
|
||||||
|
@ -672,7 +674,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String name;
|
private final String name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Settings {
|
public static class Settings {
|
||||||
|
@ -756,9 +758,10 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
||||||
// Toolbar
|
// Toolbar
|
||||||
sortButton = new JButton("Sort");
|
sortButton = new JButton("Sort");
|
||||||
filterButton = new JButton("Filter");
|
filterButton = new JButton("Filter");
|
||||||
visibilityButton = new JButton("Visibility");
|
visibilityButton = new JButton("V"); // "Visibility" button
|
||||||
selectByButton = new JButton("Select By");
|
selectByButton = new JButton("Select By");
|
||||||
analyseButton = new JButton("Mana");
|
analyseButton = new JButton("M"); // "Mana" button
|
||||||
|
blingButton = new JButton("B"); // "Bling" button
|
||||||
|
|
||||||
// Name and count label
|
// Name and count label
|
||||||
deckNameAndCountLabel = new JLabel();
|
deckNameAndCountLabel = new JLabel();
|
||||||
|
@ -779,9 +782,10 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
||||||
toolbarInner.add(creatureCountLabel);
|
toolbarInner.add(creatureCountLabel);
|
||||||
toolbarInner.add(sortButton);
|
toolbarInner.add(sortButton);
|
||||||
toolbarInner.add(filterButton);
|
toolbarInner.add(filterButton);
|
||||||
toolbarInner.add(visibilityButton);
|
|
||||||
toolbarInner.add(selectByButton);
|
toolbarInner.add(selectByButton);
|
||||||
|
toolbarInner.add(visibilityButton);
|
||||||
toolbarInner.add(analyseButton);
|
toolbarInner.add(analyseButton);
|
||||||
|
toolbarInner.add(blingButton);
|
||||||
toolbar.add(toolbarInner, BorderLayout.WEST);
|
toolbar.add(toolbarInner, BorderLayout.WEST);
|
||||||
JPanel sliderPanel = new JPanel(new GridBagLayout());
|
JPanel sliderPanel = new JPanel(new GridBagLayout());
|
||||||
sliderPanel.setOpaque(false);
|
sliderPanel.setOpaque(false);
|
||||||
|
@ -929,6 +933,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
||||||
JMenuItem showAll = new JMenuItem("Show all");
|
JMenuItem showAll = new JMenuItem("Show all");
|
||||||
showAll.addActionListener(e -> showAll());
|
showAll.addActionListener(e -> showAll());
|
||||||
visPopup.add(showAll);
|
visPopup.add(showAll);
|
||||||
|
visibilityButton.setToolTipText("Visibility of cards. Right click to get the same options this provides");
|
||||||
visibilityButton.addMouseListener(new MouseAdapter() {
|
visibilityButton.addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
|
@ -956,15 +961,15 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
||||||
ButtonGroup selectByTypeModeGroup = new ButtonGroup();
|
ButtonGroup selectByTypeModeGroup = new ButtonGroup();
|
||||||
for (final CardType cardType : CardType.values()) {
|
for (final CardType cardType : CardType.values()) {
|
||||||
|
|
||||||
if (cardType == cardType.CONSPIRACY) {
|
if (cardType == cardType.CONSPIRACY) {
|
||||||
multiplesButton = new JToggleButton("Multiples");
|
multiplesButton = new JToggleButton("Multiples");
|
||||||
selectByTypeButtons.put(cardType, multiplesButton);
|
selectByTypeButtons.put(cardType, multiplesButton);
|
||||||
selectByTypeMode.add(multiplesButton);
|
selectByTypeMode.add(multiplesButton);
|
||||||
selectByTypeModeGroup.add(multiplesButton);
|
selectByTypeModeGroup.add(multiplesButton);
|
||||||
multiplesButton.addActionListener(e -> {
|
multiplesButton.addActionListener(e -> {
|
||||||
multiplesButton.setSelected(!multiplesButton.isSelected());
|
multiplesButton.setSelected(!multiplesButton.isSelected());
|
||||||
reselectBy();
|
reselectBy();
|
||||||
});
|
});
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1011,13 +1016,14 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
||||||
}
|
}
|
||||||
|
|
||||||
// Analyse Mana (aka #blue pips, #islands, #white pips, #plains etc.)
|
// Analyse Mana (aka #blue pips, #islands, #white pips, #plains etc.)
|
||||||
analyseButton.setToolTipText("Counts coloured/colourless mana costs. Counts land types.");
|
analyseButton.setToolTipText("Mana Analyser! Counts coloured/colourless mana costs. Counts land types.");
|
||||||
|
|
||||||
analyseButton.addActionListener(new ActionListener() {
|
analyseButton.addActionListener(evt -> analyseDeck());
|
||||||
public void actionPerformed(ActionEvent evt) {
|
|
||||||
analyseDeck();
|
// Bling button - aka Add in a premium 'JR', 'MBP', 'CS' etc card
|
||||||
}
|
blingButton.setToolTipText("Bling your deck! Select the original and added cards by selecting 'Multiples' in the selection options");
|
||||||
});
|
|
||||||
|
blingButton.addActionListener(evt -> blingDeck());
|
||||||
|
|
||||||
// Filter popup
|
// Filter popup
|
||||||
filterPopup = new JPopupMenu();
|
filterPopup = new JPopupMenu();
|
||||||
|
@ -1108,7 +1114,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
||||||
l.duplicateCards(toDuplicate);
|
l.duplicateCards(toDuplicate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void invertSelection() {
|
private void invertSelection() {
|
||||||
Collection<CardView> toInvert = allCards;
|
Collection<CardView> toInvert = allCards;
|
||||||
for (DragCardGridListener l : listeners) {
|
for (DragCardGridListener l : listeners) {
|
||||||
|
@ -1229,7 +1235,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
||||||
trimGrid();
|
trimGrid();
|
||||||
|
|
||||||
// First sort all cards by name
|
// First sort all cards by name
|
||||||
Collections.sort(allCards, new CardViewNameComparator());
|
allCards.sort(new CardViewNameComparator());
|
||||||
|
|
||||||
// Now re-insert all of the cards using the current sort
|
// Now re-insert all of the cards using the current sort
|
||||||
for (CardView card : allCards) {
|
for (CardView card : allCards) {
|
||||||
|
@ -1478,6 +1484,84 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
||||||
MageFrame.getInstance().showMessage(finalInfo);
|
MageFrame.getInstance().showMessage(finalInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void blingDeck() {
|
||||||
|
if (!(this.mode == Constants.DeckEditorMode.FREE_BUILDING)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (JOptionPane.showConfirmDialog(null, "Are you sure you want to bling your deck? This process will add cards!", "WARNING",
|
||||||
|
JOptionPane.YES_NO_OPTION) == JOptionPane.NO_OPTION) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
HashMap<String, Integer> pimpedSets = new HashMap<>();
|
||||||
|
HashMap<CardView, Integer> pimpedCards = new HashMap<>();
|
||||||
|
pimpedSets.put("CP", 1);
|
||||||
|
pimpedSets.put("JR", 1);
|
||||||
|
pimpedSets.put("MPS", 1);
|
||||||
|
pimpedSets.put("CLASH", 1);
|
||||||
|
pimpedSets.put("ARENA", 1);
|
||||||
|
pimpedSets.put("UGIN", 1);
|
||||||
|
pimpedSets.put("WMCQ", 1);
|
||||||
|
pimpedSets.put("APAC", 1);
|
||||||
|
pimpedSets.put("EURO", 1);
|
||||||
|
pimpedSets.put("FNMP", 1);
|
||||||
|
pimpedSets.put("MGDC", 1);
|
||||||
|
pimpedSets.put("MPRP", 1);
|
||||||
|
pimpedSets.put("EXP", 1);
|
||||||
|
pimpedSets.put("GPX", 1);
|
||||||
|
pimpedSets.put("GRC", 1);
|
||||||
|
pimpedSets.put("MBP", 1);
|
||||||
|
pimpedSets.put("MLP", 1);
|
||||||
|
pimpedSets.put("PLS", 1);
|
||||||
|
pimpedSets.put("PTC", 1);
|
||||||
|
pimpedSets.put("SUS", 1);
|
||||||
|
|
||||||
|
String[] sets = pimpedSets.keySet().toArray(new String[pimpedSets.keySet().size()]);
|
||||||
|
Boolean didModify = false;
|
||||||
|
|
||||||
|
for (ArrayList<ArrayList<CardView>> gridRow : cardGrid) {
|
||||||
|
for (ArrayList<CardView> stack : gridRow) {
|
||||||
|
for (CardView card : stack) {
|
||||||
|
if (card.getSuperTypes().contains("Basic")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pimpedSets.containsKey(card.getExpansionSetCode())) {
|
||||||
|
final CardCriteria cardCriteria = new CardCriteria();
|
||||||
|
cardCriteria.setCodes(sets);
|
||||||
|
cardCriteria.name(card.getName());
|
||||||
|
|
||||||
|
List<CardInfo> cardPool = CardRepository.instance.findCards(cardCriteria);
|
||||||
|
|
||||||
|
if (cardPool.size() > 0) {
|
||||||
|
Card acard = cardPool.get(RandomUtil.nextInt(cardPool.size())).getMockCard();
|
||||||
|
|
||||||
|
if (acard.getName().equals(card.getName())) {
|
||||||
|
CardView pimpedCard = new CardView(acard);
|
||||||
|
addCardView(pimpedCard, false);
|
||||||
|
eventSource.addSpecificCard(pimpedCard, "add-specific-card");
|
||||||
|
pimpedCards.put(pimpedCard, 1);
|
||||||
|
didModify = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (didModify) {
|
||||||
|
for (CardView c : pimpedCards.keySet()) {
|
||||||
|
sortIntoGrid(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
layoutGrid();
|
||||||
|
cardScroll.revalidate();
|
||||||
|
repaint();
|
||||||
|
JOptionPane.showMessageDialog(null, "Added " + pimpedCards.size() + " cards. You can select them and the originals by choosing 'Multiples'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Update the contents of the card grid
|
// Update the contents of the card grid
|
||||||
public void setCards(CardsView cardsView, DeckCardLayout layout, BigCard bigCard) {
|
public void setCards(CardsView cardsView, DeckCardLayout layout, BigCard bigCard) {
|
||||||
if (bigCard != null) {
|
if (bigCard != null) {
|
||||||
|
@ -1640,10 +1724,10 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
||||||
AbstractButton button = selectByTypeButtons.get(cardType);
|
AbstractButton button = selectByTypeButtons.get(cardType);
|
||||||
String text = cardType.toString();
|
String text = cardType.toString();
|
||||||
int numCards = getCount(cardType);
|
int numCards = getCount(cardType);
|
||||||
if (cardType == cardType.CONSPIRACY) {
|
if (cardType == cardType.CONSPIRACY) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numCards > 0) {
|
if (numCards > 0) {
|
||||||
button.setForeground(Color.BLACK);
|
button.setForeground(Color.BLACK);
|
||||||
text = text + " - " + numCards;
|
text = text + " - " + numCards;
|
||||||
|
@ -1659,7 +1743,7 @@ public class DragCardGrid extends JPanel implements DragCardSource, DragCardTarg
|
||||||
JMenuItem hide = new JMenuItem("Hide");
|
JMenuItem hide = new JMenuItem("Hide");
|
||||||
hide.addActionListener(e2 -> hideSelection());
|
hide.addActionListener(e2 -> hideSelection());
|
||||||
menu.add(hide);
|
menu.add(hide);
|
||||||
|
|
||||||
JMenuItem invertSelection = new JMenuItem("Invert Selection");
|
JMenuItem invertSelection = new JMenuItem("Invert Selection");
|
||||||
invertSelection.addActionListener(e2 -> invertSelection());
|
invertSelection.addActionListener(e2 -> invertSelection());
|
||||||
menu.add(invertSelection);
|
menu.add(invertSelection);
|
||||||
|
|
|
@ -2,7 +2,6 @@ package mage.client.cards;
|
||||||
|
|
||||||
import mage.view.CardView;
|
import mage.view.CardView;
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
|
|
|
@ -52,11 +52,9 @@ import mage.cards.Sets;
|
||||||
import static mage.client.constants.Constants.DAMAGE_MAX_LEFT;
|
import static mage.client.constants.Constants.DAMAGE_MAX_LEFT;
|
||||||
import static mage.client.constants.Constants.POWBOX_TEXT_MAX_TOP;
|
import static mage.client.constants.Constants.POWBOX_TEXT_MAX_TOP;
|
||||||
import mage.client.util.Config;
|
import mage.client.util.Config;
|
||||||
import mage.client.util.ImageHelper;
|
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.view.CounterView;
|
import mage.view.CounterView;
|
||||||
import mage.view.PermanentView;
|
import mage.view.PermanentView;
|
||||||
import org.mage.plugins.card.images.ImageCache;
|
|
||||||
import mage.client.util.TransformedImageCache;
|
import mage.client.util.TransformedImageCache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,9 +65,9 @@ public class Permanent extends Card {
|
||||||
|
|
||||||
protected PermanentView permanent;
|
protected PermanentView permanent;
|
||||||
|
|
||||||
protected List<MagePermanent> links = new ArrayList<>();
|
protected final List<MagePermanent> links = new ArrayList<>();
|
||||||
protected boolean linked;
|
protected boolean linked;
|
||||||
protected BufferedImage tappedImage;
|
protected final BufferedImage tappedImage;
|
||||||
protected BufferedImage flippedImage;
|
protected BufferedImage flippedImage;
|
||||||
|
|
||||||
/** Creates new form Permanent
|
/** Creates new form Permanent
|
||||||
|
|
|
@ -13,9 +13,7 @@ import javax.swing.JEditorPane;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JTextPane;
|
import javax.swing.JTextPane;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.event.HyperlinkEvent;
|
|
||||||
import javax.swing.event.HyperlinkEvent.EventType;
|
import javax.swing.event.HyperlinkEvent.EventType;
|
||||||
import javax.swing.event.HyperlinkListener;
|
|
||||||
import javax.swing.text.html.HTMLDocument;
|
import javax.swing.text.html.HTMLDocument;
|
||||||
import javax.swing.text.html.HTMLEditorKit;
|
import javax.swing.text.html.HTMLEditorKit;
|
||||||
|
|
||||||
|
@ -35,8 +33,8 @@ import mage.view.CardView;
|
||||||
*/
|
*/
|
||||||
public class ColorPane extends JEditorPane {
|
public class ColorPane extends JEditorPane {
|
||||||
|
|
||||||
HTMLEditorKit kit = new HTMLEditorKit();
|
final HTMLEditorKit kit = new HTMLEditorKit();
|
||||||
HTMLDocument doc = new HTMLDocument();
|
final HTMLDocument doc = new HTMLDocument();
|
||||||
private int tooltipDelay;
|
private int tooltipDelay;
|
||||||
private int tooltipCounter;
|
private int tooltipCounter;
|
||||||
private boolean hyperlinkEnabled = false;
|
private boolean hyperlinkEnabled = false;
|
||||||
|
@ -47,39 +45,28 @@ public class ColorPane extends JEditorPane {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addHyperlinkHandlers() {
|
private void addHyperlinkHandlers() {
|
||||||
addHyperlinkListener(new HyperlinkListener() {
|
addHyperlinkListener(e -> ThreadUtils.threadPool2.submit(() -> {
|
||||||
|
tooltipDelay = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_TOOLTIPS_DELAY, 300);
|
||||||
@Override
|
if (tooltipDelay == 0) {
|
||||||
public void hyperlinkUpdate(final HyperlinkEvent e) {
|
return;
|
||||||
ThreadUtils.threadPool2.submit(new Runnable() {
|
}
|
||||||
|
String name = e.getDescription().substring(1);
|
||||||
@Override
|
CardInfo card = CardRepository.instance.findCard(name);
|
||||||
public void run() {
|
try {
|
||||||
tooltipDelay = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_SHOW_TOOLTIPS_DELAY, 300);
|
final Component container = MageFrame.getUI().getComponent(MageComponents.POPUP_CONTAINER);
|
||||||
if (tooltipDelay == 0) {
|
if (e.getEventType() == EventType.EXITED) {
|
||||||
return;
|
setPopupVisibility(container, false);
|
||||||
}
|
}
|
||||||
String name = e.getDescription().substring(1);
|
if (e.getEventType() == EventType.ENTERED && card != null) {
|
||||||
CardInfo card = CardRepository.instance.findCard(name);
|
CardInfoPane cardInfoPane = (CardInfoPane) MageFrame.getUI().getComponent(MageComponents.CARD_INFO_PANE);
|
||||||
try {
|
cardInfoPane.setCard(new CardView(card.getMockCard()), container);
|
||||||
final Component container = MageFrame.getUI().getComponent(MageComponents.POPUP_CONTAINER);
|
setPopupVisibility(container, true);
|
||||||
if (e.getEventType() == EventType.EXITED) {
|
}
|
||||||
setPopupVisibility(container, false);
|
} catch (InterruptedException e1) {
|
||||||
}
|
e1.printStackTrace();
|
||||||
if (e.getEventType() == EventType.ENTERED && card != null) {
|
|
||||||
CardInfoPane cardInfoPane = (CardInfoPane) MageFrame.getUI().getComponent(MageComponents.CARD_INFO_PANE);
|
|
||||||
cardInfoPane.setCard(new CardView(card.getMockCard()), container);
|
|
||||||
setPopupVisibility(container, true);
|
|
||||||
}
|
|
||||||
} catch (InterruptedException e1) {
|
|
||||||
e1.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
}));
|
||||||
|
|
||||||
addMouseListener(new MouseAdapter() {
|
addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -96,22 +83,19 @@ public class ColorPane extends JEditorPane {
|
||||||
|
|
||||||
private void setPopupVisibility(final Component container, final boolean show) throws InterruptedException {
|
private void setPopupVisibility(final Component container, final boolean show) throws InterruptedException {
|
||||||
final Component c = MageFrame.getUI().getComponent(MageComponents.DESKTOP_PANE);
|
final Component c = MageFrame.getUI().getComponent(MageComponents.DESKTOP_PANE);
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> {
|
||||||
@Override
|
tooltipCounter += show ? 1 : -1;
|
||||||
public void run() {
|
if (tooltipCounter < 0) {
|
||||||
tooltipCounter += show ? 1 : -1;
|
tooltipCounter = 0;
|
||||||
if (tooltipCounter < 0) {
|
|
||||||
tooltipCounter = 0;
|
|
||||||
}
|
|
||||||
if (tooltipCounter > 0) {
|
|
||||||
Point location = new Point(getLocationOnScreen().x - container.getWidth(), MouseInfo.getPointerInfo().getLocation().y);
|
|
||||||
Component parentComponent = MageFrame.getInstance();
|
|
||||||
location = GuiDisplayUtil.keepComponentInsideParent(location, parentComponent.getLocationOnScreen(), container, parentComponent);
|
|
||||||
container.setLocation(location);
|
|
||||||
}
|
|
||||||
container.setVisible(tooltipCounter > 0);
|
|
||||||
c.repaint();
|
|
||||||
}
|
}
|
||||||
|
if (tooltipCounter > 0) {
|
||||||
|
Point location = new Point(getLocationOnScreen().x - container.getWidth(), MouseInfo.getPointerInfo().getLocation().y);
|
||||||
|
Component parentComponent = MageFrame.getInstance();
|
||||||
|
location = GuiDisplayUtil.keepComponentInsideParent(location, parentComponent.getLocationOnScreen(), container, parentComponent);
|
||||||
|
container.setLocation(location);
|
||||||
|
}
|
||||||
|
container.setVisible(tooltipCounter > 0);
|
||||||
|
c.repaint();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,8 @@
|
||||||
package mage.client.components;
|
package mage.client.components;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import javax.swing.DefaultDesktopManager;
|
import javax.swing.*;
|
||||||
import javax.swing.DesktopManager;
|
|
||||||
import javax.swing.JDesktopPane;
|
|
||||||
import javax.swing.JFrame;
|
|
||||||
import javax.swing.JInternalFrame;
|
|
||||||
import javax.swing.SwingUtilities;
|
|
||||||
import mage.client.dialog.CardInfoWindowDialog;
|
import mage.client.dialog.CardInfoWindowDialog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,24 +37,21 @@ public class MageDesktopManager extends DefaultDesktopManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> {
|
||||||
@Override
|
JFrame frame = new JFrame();
|
||||||
public void run() {
|
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||||
JFrame frame = new JFrame();
|
|
||||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
||||||
|
|
||||||
JDesktopPane desktopPane = new JDesktopPane();
|
JDesktopPane desktopPane = new JDesktopPane();
|
||||||
DesktopManager dm = new MageDesktopManager();
|
DesktopManager dm = new MageDesktopManager();
|
||||||
desktopPane.setDesktopManager(dm);
|
desktopPane.setDesktopManager(dm);
|
||||||
JInternalFrame internalFrame = new JInternalFrame("Test Internal Frame", true, false, true, true);
|
JInternalFrame internalFrame = new JInternalFrame("Test Internal Frame", true, false, true, true);
|
||||||
internalFrame.setSize(200, 150);
|
internalFrame.setSize(200, 150);
|
||||||
internalFrame.setVisible(true);
|
internalFrame.setVisible(true);
|
||||||
desktopPane.add(internalFrame);
|
desktopPane.add(internalFrame);
|
||||||
|
|
||||||
frame.add(desktopPane, BorderLayout.CENTER);
|
frame.add(desktopPane, BorderLayout.CENTER);
|
||||||
frame.setSize(800, 600);
|
frame.setSize(800, 600);
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class MageJDesktop extends JDesktopPane {
|
||||||
UIDefaults map = new UIDefaults();
|
UIDefaults map = new UIDefaults();
|
||||||
Painter painter = new Painter() {
|
Painter painter = new Painter() {
|
||||||
|
|
||||||
Color color = null;
|
final Color color = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics2D g, Object c, int w, int h) {
|
public void paint(Graphics2D g, Object c, int w, int h) {
|
||||||
|
|
|
@ -27,23 +27,13 @@ public class MageRoundPane extends JPanel {
|
||||||
private final Color defaultBackgroundColor = new Color(141, 130, 112, 200);
|
private final Color defaultBackgroundColor = new Color(141, 130, 112, 200);
|
||||||
private Color backgroundColor = defaultBackgroundColor;
|
private Color backgroundColor = defaultBackgroundColor;
|
||||||
private final int alpha = 0;
|
private final int alpha = 0;
|
||||||
private static Map<ShadowKey, BufferedImage> SHADOW_IMAGE_CACHE;
|
private static final Map<ShadowKey, BufferedImage> SHADOW_IMAGE_CACHE;
|
||||||
private static final Map<Key, BufferedImage> IMAGE_CACHE;
|
private static final Map<Key, BufferedImage> IMAGE_CACHE;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
SHADOW_IMAGE_CACHE = ImageCaches.register(new MapMaker().softValues().makeComputingMap(new Function<ShadowKey, BufferedImage>() {
|
SHADOW_IMAGE_CACHE = ImageCaches.register(new MapMaker().softValues().makeComputingMap((Function<ShadowKey, BufferedImage>) key -> createShadowImage(key)));
|
||||||
@Override
|
|
||||||
public BufferedImage apply(ShadowKey key) {
|
|
||||||
return createShadowImage(key);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
IMAGE_CACHE = ImageCaches.register(new MapMaker().softValues().makeComputingMap(new Function<Key, BufferedImage>() {
|
IMAGE_CACHE = ImageCaches.register(new MapMaker().softValues().makeComputingMap((Function<Key, BufferedImage>) key -> createImage(key)));
|
||||||
@Override
|
|
||||||
public BufferedImage apply(Key key) {
|
|
||||||
return createImage(key);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static class ShadowKey {
|
private final static class ShadowKey {
|
||||||
|
|
|
@ -14,7 +14,7 @@ import javax.swing.plaf.synth.SynthStyleFactory;
|
||||||
* @author nantuko
|
* @author nantuko
|
||||||
*/
|
*/
|
||||||
public class MageSynthStyleFactory extends SynthStyleFactory {
|
public class MageSynthStyleFactory extends SynthStyleFactory {
|
||||||
private SynthStyleFactory wrappedFactory;
|
private final SynthStyleFactory wrappedFactory;
|
||||||
|
|
||||||
public MageSynthStyleFactory(SynthStyleFactory factory) {
|
public MageSynthStyleFactory(SynthStyleFactory factory) {
|
||||||
this.wrappedFactory = factory;
|
this.wrappedFactory = factory;
|
||||||
|
|
|
@ -57,22 +57,19 @@ public class MageTextArea extends JEditorPane {
|
||||||
|
|
||||||
buffer.append("</b></center></body></html>");
|
buffer.append("</b></center></body></html>");
|
||||||
|
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> {
|
||||||
@Override
|
String promptText = buffer.toString();
|
||||||
public void run() {
|
MageTextArea.super.setText(promptText);
|
||||||
String promptText = buffer.toString();
|
// in case the text don't fit in the panel a tooltip with the text is added
|
||||||
MageTextArea.super.setText(promptText);
|
if (panelWidth > 0 && MageTextArea.this.getPreferredSize().getWidth() > panelWidth) {
|
||||||
// in case the text don't fit in the panel a tooltip with the text is added
|
String tooltip = "<html><center><body style='font-family:Dialog;font-size:"
|
||||||
if (panelWidth > 0 && MageTextArea.this.getPreferredSize().getWidth() > panelWidth) {
|
+ GUISizeHelper.gameDialogAreaFontSizeBig
|
||||||
String tooltip = "<html><center><body style='font-family:Dialog;font-size:"
|
+ ";color: #FFFFFF'><p width='500'>" + basicText + "</p></body></html>";
|
||||||
+ GUISizeHelper.gameDialogAreaFontSizeBig
|
MageTextArea.super.setToolTipText(tooltip);
|
||||||
+ ";color: #FFFFFF'><p width='500'>" + basicText + "</p></body></html>";
|
} else {
|
||||||
MageTextArea.super.setToolTipText(tooltip);
|
MageTextArea.super.setToolTipText(null);
|
||||||
} else {
|
|
||||||
MageTextArea.super.setToolTipText(null);
|
|
||||||
}
|
|
||||||
setCaretPosition(0);
|
|
||||||
}
|
}
|
||||||
|
setCaretPosition(0);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,12 +96,7 @@ public class MageUI {
|
||||||
while (!j.isEnabled()) {
|
while (!j.isEnabled()) {
|
||||||
Thread.sleep(10);
|
Thread.sleep(10);
|
||||||
}
|
}
|
||||||
Thread t = new Thread(new Runnable() {
|
Thread t = new Thread(() -> j.doClick());
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
j.doClick();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
t.start();
|
t.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class AbilityPicker extends JXPanel implements MouseWheelListener {
|
||||||
private static final String IMAGE_RIGHT_PATH = "/game/right.png";
|
private static final String IMAGE_RIGHT_PATH = "/game/right.png";
|
||||||
private static final String IMAGE_RIGHT_HOVERED_PATH = "/game/right_hovered.png";
|
private static final String IMAGE_RIGHT_HOVERED_PATH = "/game/right_hovered.png";
|
||||||
|
|
||||||
private static Color SELECTED_COLOR = new Color(64, 147, 208);
|
private static final Color SELECTED_COLOR = new Color(64, 147, 208);
|
||||||
private static Color BORDER_COLOR = new Color(0, 0, 0, 50);
|
private static Color BORDER_COLOR = new Color(0, 0, 0, 50);
|
||||||
|
|
||||||
private boolean selected = false;
|
private boolean selected = false;
|
||||||
|
|
|
@ -14,9 +14,9 @@ import java.awt.geom.RoundRectangle2D;
|
||||||
*/
|
*/
|
||||||
public class BackgroundPainter extends AbstractPainter {
|
public class BackgroundPainter extends AbstractPainter {
|
||||||
|
|
||||||
private Color bgColor = Color.black;
|
private final Color bgColor = Color.black;
|
||||||
|
|
||||||
float bgalpha = 0.6f;
|
final float bgalpha = 0.6f;
|
||||||
|
|
||||||
public BackgroundPainter() {
|
public BackgroundPainter() {
|
||||||
super();
|
super();
|
||||||
|
|
|
@ -16,10 +16,10 @@ import javax.swing.plaf.metal.MetalScrollButton;
|
||||||
*/
|
*/
|
||||||
public class MageScrollButton extends MetalScrollButton {
|
public class MageScrollButton extends MetalScrollButton {
|
||||||
|
|
||||||
private static ImageIcon buttonLeft;
|
private static final ImageIcon buttonLeft;
|
||||||
private static ImageIcon buttonRight;
|
private static final ImageIcon buttonRight;
|
||||||
private static ImageIcon buttonUp;
|
private static final ImageIcon buttonUp;
|
||||||
private static ImageIcon buttonDown;
|
private static final ImageIcon buttonDown;
|
||||||
|
|
||||||
private int width;
|
private int width;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ import javax.swing.plaf.metal.MetalScrollBarUI;
|
||||||
*/
|
*/
|
||||||
public class MageScrollbarUI extends MetalScrollBarUI {
|
public class MageScrollbarUI extends MetalScrollBarUI {
|
||||||
|
|
||||||
private static int ANTI_WIDTH = -3;
|
private static final int ANTI_WIDTH = -3;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void installUI(JComponent c) {
|
public void installUI(JComponent c) {
|
||||||
|
|
|
@ -21,11 +21,9 @@ public class MageFloatPane extends JEditorPane {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCard(final String text) {
|
public void setCard(final String text) {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> {
|
||||||
public void run() {
|
setText(text);
|
||||||
setText(text);
|
setCaretPosition(0);
|
||||||
setCaretPosition(0);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -279,7 +279,7 @@ public class DialogManager extends JComponent implements MouseListener,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseDragged(MouseEvent e) {
|
public void mouseDragged(MouseEvent e) {
|
||||||
if (bDragged == true) {
|
if (bDragged) {
|
||||||
dx = e.getX() - mx;
|
dx = e.getX() - mx;
|
||||||
dy = e.getY() - my;
|
dy = e.getY() - my;
|
||||||
|
|
||||||
|
|
|
@ -184,11 +184,7 @@ public class ChoiceDialog extends IDialogPanel {
|
||||||
jButtonOK.setBounds(new Rectangle(w / 2 - 40, h - 50, 60, 60));
|
jButtonOK.setBounds(new Rectangle(w / 2 - 40, h - 50, 60, 60));
|
||||||
jButtonOK.setToolTipText("Ok");
|
jButtonOK.setToolTipText("Ok");
|
||||||
|
|
||||||
jButtonOK.setObserver(new Command() {
|
jButtonOK.setObserver(() -> DialogManager.getManager(gameId).fadeOut((DialogContainer) getParent()));
|
||||||
public void execute() {
|
|
||||||
DialogManager.getManager(gameId).fadeOut((DialogContainer) getParent());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return jButtonOK;
|
return jButtonOK;
|
||||||
}
|
}
|
||||||
|
@ -204,27 +200,24 @@ public class ChoiceDialog extends IDialogPanel {
|
||||||
jButtonPrevPage.setBounds(new Rectangle(w / 2 - 125, h - 50, 60, 60));
|
jButtonPrevPage.setBounds(new Rectangle(w / 2 - 125, h - 50, 60, 60));
|
||||||
jButtonPrevPage.setVisible(false);
|
jButtonPrevPage.setVisible(false);
|
||||||
|
|
||||||
jButtonPrevPage.setObserver(new Command() {
|
jButtonPrevPage.setObserver(() -> {
|
||||||
|
if (page == 1) {
|
||||||
public void execute() {
|
return;
|
||||||
if (page == 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
AudioManager.playPrevPage();
|
|
||||||
|
|
||||||
page--;
|
|
||||||
getJButtonPrevPage().setVisible(false);
|
|
||||||
getJButtonOK().setVisible(false);
|
|
||||||
getJButtonNextPage().setVisible(false);
|
|
||||||
revalidate();
|
|
||||||
displayCards(params.getCards(), params.gameId, params.bigCard);
|
|
||||||
if (page != 1) {
|
|
||||||
getJButtonPrevPage().setVisible(true);
|
|
||||||
}
|
|
||||||
getJButtonOK().setVisible(true);
|
|
||||||
getJButtonNextPage().setVisible(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AudioManager.playPrevPage();
|
||||||
|
|
||||||
|
page--;
|
||||||
|
getJButtonPrevPage().setVisible(false);
|
||||||
|
getJButtonOK().setVisible(false);
|
||||||
|
getJButtonNextPage().setVisible(false);
|
||||||
|
revalidate();
|
||||||
|
displayCards(params.getCards(), params.gameId, params.bigCard);
|
||||||
|
if (page != 1) {
|
||||||
|
getJButtonPrevPage().setVisible(true);
|
||||||
|
}
|
||||||
|
getJButtonOK().setVisible(true);
|
||||||
|
getJButtonNextPage().setVisible(true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return jButtonPrevPage;
|
return jButtonPrevPage;
|
||||||
|
|
|
@ -32,9 +32,9 @@ public class StackDialog extends IDialogPanel {
|
||||||
private HoverButton jButtonResponse = null;
|
private HoverButton jButtonResponse = null;
|
||||||
|
|
||||||
private JLayeredPane jLayeredPane;
|
private JLayeredPane jLayeredPane;
|
||||||
private FeedbackPanel feedbackPanel;
|
private final FeedbackPanel feedbackPanel;
|
||||||
|
|
||||||
private UUID gameId;
|
private final UUID gameId;
|
||||||
|
|
||||||
private class CustomLabel extends JLabel {
|
private class CustomLabel extends JLabel {
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public class StackDialog extends IDialogPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the default constructor
|
* This is the default constructor
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package mage.client.components.tray;
|
package mage.client.components.tray;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import mage.client.MageFrame;
|
import mage.client.MageFrame;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.mage.plugins.card.utils.impl.ImageManagerImpl;
|
import org.mage.plugins.card.utils.impl.ImageManagerImpl;
|
||||||
|
@ -38,14 +37,11 @@ public class MageTray {
|
||||||
trayIcon = new TrayIcon(mainImage);
|
trayIcon = new TrayIcon(mainImage);
|
||||||
trayIcon.setImageAutoSize(true);
|
trayIcon.setImageAutoSize(true);
|
||||||
|
|
||||||
trayIcon.addActionListener(new ActionListener() {
|
trayIcon.addActionListener(e -> {
|
||||||
@Override
|
stopBlink();
|
||||||
public void actionPerformed(ActionEvent e) {
|
MageFrame frame = MageFrame.getInstance();
|
||||||
stopBlink();
|
frame.setVisible(true);
|
||||||
MageFrame frame = MageFrame.getInstance();
|
frame.setState(Frame.NORMAL);
|
||||||
frame.setVisible(true);
|
|
||||||
frame.setState(Frame.NORMAL);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
final SystemTray tray = SystemTray.getSystemTray();
|
final SystemTray tray = SystemTray.getSystemTray();
|
||||||
|
@ -59,47 +55,17 @@ public class MageTray {
|
||||||
MenuItem aboutItem = new MenuItem("About Mage");
|
MenuItem aboutItem = new MenuItem("About Mage");
|
||||||
MenuItem exitItem = new MenuItem("Exit");
|
MenuItem exitItem = new MenuItem("Exit");
|
||||||
|
|
||||||
imagesItem.addActionListener(new ActionListener() {
|
imagesItem.addActionListener(e -> MageFrame.getInstance().downloadImages());
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
MageFrame.getInstance().downloadImages();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
iconsItem.addActionListener(new ActionListener() {
|
iconsItem.addActionListener(e -> MageFrame.getInstance().downloadAdditionalResources());
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
MageFrame.getInstance().downloadAdditionalResources();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
stopBlinkItem.addActionListener(new ActionListener() {
|
stopBlinkItem.addActionListener(e -> stopBlink());
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
stopBlink();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
preferencesItem.addActionListener(new ActionListener() {
|
preferencesItem.addActionListener(e -> MageFrame.getInstance().btnPreferencesActionPerformed(null));
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
MageFrame.getInstance().btnPreferencesActionPerformed(null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
aboutItem.addActionListener(new ActionListener() {
|
aboutItem.addActionListener(e -> MageFrame.getInstance().btnAboutActionPerformed(null));
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
MageFrame.getInstance().btnAboutActionPerformed(null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
exitItem.addActionListener(new ActionListener() {
|
exitItem.addActionListener(e -> MageFrame.getInstance().exitApp());
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
MageFrame.getInstance().exitApp();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
popup.add(imagesItem);
|
popup.add(imagesItem);
|
||||||
popup.add(iconsItem);
|
popup.add(iconsItem);
|
||||||
|
@ -129,23 +95,20 @@ public class MageTray {
|
||||||
synchronized (MageTray.class) {
|
synchronized (MageTray.class) {
|
||||||
if (state == 0) {
|
if (state == 0) {
|
||||||
state = 1;
|
state = 1;
|
||||||
new Thread(new Runnable() {
|
new Thread(() -> {
|
||||||
@Override
|
try {
|
||||||
public void run() {
|
int i = 0;
|
||||||
try {
|
while (state != 3) {
|
||||||
int i = 0;
|
trayIcon.setImage(i == 0 ? mainImage : flashedImage);
|
||||||
while (state != 3) {
|
Thread.sleep(600);
|
||||||
trayIcon.setImage(i == 0 ? mainImage : flashedImage);
|
i = i == 0 ? 1 : 0;
|
||||||
Thread.sleep(600);
|
|
||||||
i = i == 0 ? 1 : 0;
|
|
||||||
}
|
|
||||||
trayIcon.setImage(mainImage);
|
|
||||||
state = 0;
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
trayIcon.setImage(mainImage);
|
||||||
|
state = 0;
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@ import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.decks.Deck;
|
import mage.cards.decks.Deck;
|
||||||
|
|
|
@ -69,7 +69,8 @@ public enum DeckGeneratorCMC {
|
||||||
add(new CMC(7, 100, 0.15f));
|
add(new CMC(7, 100, 0.15f));
|
||||||
}});
|
}});
|
||||||
|
|
||||||
private ArrayList<CMC> poolCMCs60, poolCMCs40;
|
private final ArrayList<CMC> poolCMCs60;
|
||||||
|
private final ArrayList<CMC> poolCMCs40;
|
||||||
|
|
||||||
DeckGeneratorCMC(ArrayList<CMC> CMCs60, ArrayList<CMC> CMCs40) {
|
DeckGeneratorCMC(ArrayList<CMC> CMCs60, ArrayList<CMC> CMCs40) {
|
||||||
this.poolCMCs60 = CMCs60;
|
this.poolCMCs60 = CMCs60;
|
||||||
|
|
|
@ -28,9 +28,7 @@
|
||||||
package mage.client.deck.generator;
|
package mage.client.deck.generator;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.awt.event.ItemEvent;
|
|
||||||
import java.awt.event.ItemListener;
|
import java.awt.event.ItemListener;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
@ -193,12 +191,9 @@ public class DeckGeneratorDialog {
|
||||||
// Advanced checkbox (enable/disable advanced configuration)
|
// Advanced checkbox (enable/disable advanced configuration)
|
||||||
cAdvanced = new JCheckBox("Advanced");
|
cAdvanced = new JCheckBox("Advanced");
|
||||||
cAdvanced.setToolTipText("Enable advanced configuration options");
|
cAdvanced.setToolTipText("Enable advanced configuration options");
|
||||||
cAdvanced.addItemListener(new ItemListener() {
|
cAdvanced.addItemListener(itemEvent -> {
|
||||||
@Override
|
boolean enable = cAdvanced.isSelected();
|
||||||
public void itemStateChanged(ItemEvent itemEvent) {
|
enableAdvancedPanel(enable);
|
||||||
boolean enable = cAdvanced.isSelected();
|
|
||||||
enableAdvancedPanel(enable);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Advanced Checkbox
|
// Advanced Checkbox
|
||||||
|
@ -216,23 +211,17 @@ public class DeckGeneratorDialog {
|
||||||
mainPanel.add(advancedPanel, c);
|
mainPanel.add(advancedPanel, c);
|
||||||
|
|
||||||
btnGenerate = new JButton("Ok");
|
btnGenerate = new JButton("Ok");
|
||||||
btnGenerate.addActionListener(new ActionListener() {
|
btnGenerate.addActionListener(e -> {
|
||||||
@Override
|
btnGenerate.setEnabled(false);
|
||||||
public void actionPerformed(ActionEvent e) {
|
colorsChooser.setEnabled(false);
|
||||||
btnGenerate.setEnabled(false);
|
selectedColors = (String) colorsChooser.getSelectedItem();
|
||||||
colorsChooser.setEnabled(false);
|
dlg.setVisible(false);
|
||||||
selectedColors = (String) colorsChooser.getSelectedItem();
|
MageFrame.getPreferences().put("genDeckColor", selectedColors);
|
||||||
dlg.setVisible(false);
|
|
||||||
MageFrame.getPreferences().put("genDeckColor", selectedColors);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
btnCancel = new JButton("Cancel");
|
btnCancel = new JButton("Cancel");
|
||||||
btnCancel.addActionListener(new ActionListener() {
|
btnCancel.addActionListener(e -> {
|
||||||
@Override
|
dlg.setVisible(false);
|
||||||
public void actionPerformed(ActionEvent e) {
|
selectedColors = null;
|
||||||
dlg.setVisible(false);
|
|
||||||
selectedColors = null;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
JButton[] options = {btnGenerate, btnCancel};
|
JButton[] options = {btnGenerate, btnCancel};
|
||||||
JOptionPane optionPane = new JOptionPane(mainPanel, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, options, options[1]);
|
JOptionPane optionPane = new JOptionPane(mainPanel, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, options, options[1]);
|
||||||
|
@ -308,12 +297,9 @@ public class DeckGeneratorDialog {
|
||||||
c.gridy = 2;
|
c.gridy = 2;
|
||||||
btnReset = new JButton("Reset");
|
btnReset = new JButton("Reset");
|
||||||
btnReset.setToolTipText("Reset advanced dialog to default values");
|
btnReset.setToolTipText("Reset advanced dialog to default values");
|
||||||
btnReset.addActionListener(new ActionListener() {
|
btnReset.addActionListener(actionEvent -> {
|
||||||
@Override
|
cbCMC.setSelectedItem(DeckGeneratorCMC.Default);
|
||||||
public void actionPerformed(ActionEvent actionEvent) {
|
adjustingSliderPanel.resetValues();
|
||||||
cbCMC.setSelectedItem(DeckGeneratorCMC.Default);
|
|
||||||
adjustingSliderPanel.resetValues();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
advancedPanel.add(btnReset, c);
|
advancedPanel.add(btnReset, c);
|
||||||
|
|
||||||
|
|
|
@ -44,12 +44,12 @@ public class DeckGeneratorPool
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
public static int DEFAULT_CREATURE_PERCENTAGE = 38;
|
public static final int DEFAULT_CREATURE_PERCENTAGE = 38;
|
||||||
public static int DEFAULT_NON_CREATURE_PERCENTAGE = 21;
|
public static final int DEFAULT_NON_CREATURE_PERCENTAGE = 21;
|
||||||
public static int DEFAULT_LAND_PERCENTAGE = 41;
|
public static final int DEFAULT_LAND_PERCENTAGE = 41;
|
||||||
|
|
||||||
private final List<ColoredManaSymbol> allowedColors;
|
private final List<ColoredManaSymbol> allowedColors;
|
||||||
private boolean colorlessAllowed;
|
private final boolean colorlessAllowed;
|
||||||
private final List<DeckGeneratorCMC.CMC> poolCMCs;
|
private final List<DeckGeneratorCMC.CMC> poolCMCs;
|
||||||
private final int creatureCount;
|
private final int creatureCount;
|
||||||
private final int nonCreatureCount;
|
private final int nonCreatureCount;
|
||||||
|
@ -58,14 +58,14 @@ public class DeckGeneratorPool
|
||||||
private final int deckSize;
|
private final int deckSize;
|
||||||
|
|
||||||
// Count how many copies of the card exists in the deck to check we don't go over 4 copies (or 1 for singleton)
|
// Count how many copies of the card exists in the deck to check we don't go over 4 copies (or 1 for singleton)
|
||||||
private Map<String, Integer> cardCounts = new HashMap<>();
|
private final Map<String, Integer> cardCounts = new HashMap<>();
|
||||||
// If there is only a single color selected to generate a deck
|
// If there is only a single color selected to generate a deck
|
||||||
private boolean monoColored = false;
|
private boolean monoColored = false;
|
||||||
// List of cards so far in the deck
|
// List of cards so far in the deck
|
||||||
private List<Card> deckCards = new ArrayList<>();
|
private final List<Card> deckCards = new ArrayList<>();
|
||||||
// List of reserve cards found to fix up undersized decks
|
// List of reserve cards found to fix up undersized decks
|
||||||
private List<Card> reserveSpells = new ArrayList<>();
|
private final List<Card> reserveSpells = new ArrayList<>();
|
||||||
private Deck deck;
|
private final Deck deck;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a card pool with specified criterea used when generating a deck.
|
* Creates a card pool with specified criterea used when generating a deck.
|
||||||
|
|
|
@ -29,8 +29,6 @@
|
||||||
package mage.client.deck.generator;
|
package mage.client.deck.generator;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.event.ChangeEvent;
|
|
||||||
import javax.swing.event.ChangeListener;
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -41,13 +39,13 @@ import java.util.List;
|
||||||
public class RatioAdjustingSliderPanel extends JPanel {
|
public class RatioAdjustingSliderPanel extends JPanel {
|
||||||
|
|
||||||
private JStorageSlider creatureSlider, nonCreatureSlider, landSlider;
|
private JStorageSlider creatureSlider, nonCreatureSlider, landSlider;
|
||||||
private List<JLabel> textLabels = new ArrayList<>();
|
private final List<JLabel> textLabels = new ArrayList<>();
|
||||||
private AdjustingSliderGroup sg;
|
private AdjustingSliderGroup sg;
|
||||||
|
|
||||||
private class JStorageSlider extends JSlider {
|
private class JStorageSlider extends JSlider {
|
||||||
|
|
||||||
// Slider stores its initial value to revert to when reset
|
// Slider stores its initial value to revert to when reset
|
||||||
private int defaultValue;
|
private final int defaultValue;
|
||||||
private int previousValue;
|
private int previousValue;
|
||||||
|
|
||||||
public JStorageSlider(int min, int max, int value) {
|
public JStorageSlider(int min, int max, int value) {
|
||||||
|
@ -86,12 +84,7 @@ public class RatioAdjustingSliderPanel extends JPanel {
|
||||||
storageSliders = new ArrayList<>();
|
storageSliders = new ArrayList<>();
|
||||||
for(JStorageSlider slider: sliders) {
|
for(JStorageSlider slider: sliders) {
|
||||||
storageSliders.add(slider);
|
storageSliders.add(slider);
|
||||||
slider.addChangeListener(new ChangeListener() {
|
slider.addChangeListener(e -> fireSliderChangedEvent((JStorageSlider) e.getSource()));
|
||||||
@Override
|
|
||||||
public void stateChanged(ChangeEvent e) {
|
|
||||||
fireSliderChangedEvent((JStorageSlider) e.getSource());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void fireSliderChangedEvent(JStorageSlider source) {
|
public void fireSliderChangedEvent(JStorageSlider source) {
|
||||||
|
@ -177,19 +170,16 @@ public class RatioAdjustingSliderPanel extends JPanel {
|
||||||
|
|
||||||
final JLabel label = new JLabel(" " + String.valueOf(slider.getValue()) + "%");
|
final JLabel label = new JLabel(" " + String.valueOf(slider.getValue()) + "%");
|
||||||
|
|
||||||
slider.addChangeListener(new ChangeListener() {
|
slider.addChangeListener(e -> {
|
||||||
@Override
|
String value = String.valueOf(slider.getValue());
|
||||||
public void stateChanged(ChangeEvent e) {
|
StringBuilder labelBuilder = new StringBuilder();
|
||||||
String value = String.valueOf(slider.getValue());
|
// Pad with spaces so all percentage labels are of equal size
|
||||||
StringBuilder labelBuilder = new StringBuilder();
|
for(int i = 0; i < (5-value.length()); i++) {
|
||||||
// Pad with spaces so all percentage labels are of equal size
|
labelBuilder.append(" ");
|
||||||
for(int i = 0; i < (5-value.length()); i++) {
|
|
||||||
labelBuilder.append(" ");
|
|
||||||
}
|
|
||||||
labelBuilder.append(value);
|
|
||||||
labelBuilder.append("%");
|
|
||||||
label.setText(labelBuilder.toString());
|
|
||||||
}
|
}
|
||||||
|
labelBuilder.append(value);
|
||||||
|
labelBuilder.append("%");
|
||||||
|
label.setText(labelBuilder.toString());
|
||||||
});
|
});
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,12 +83,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
private boolean limited = false;
|
private boolean limited = false;
|
||||||
private final SortSetting sortSetting;
|
private final SortSetting sortSetting;
|
||||||
|
|
||||||
private final ActionListener searchAction = new ActionListener() {
|
private final ActionListener searchAction = evt -> jButtonSearchActionPerformed(evt);
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent evt) {
|
|
||||||
jButtonSearchActionPerformed(evt);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new form CardSelector
|
* Creates new form CardSelector
|
||||||
|
@ -494,11 +489,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
tbRed.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
tbRed.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||||
tbRed.setSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/color_red.png"))); // NOI18N
|
tbRed.setSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/color_red.png"))); // NOI18N
|
||||||
tbRed.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
tbRed.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
tbRed.addActionListener(new java.awt.event.ActionListener() {
|
tbRed.addActionListener(evt -> tbRedActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
tbRedActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tbColor.add(tbRed);
|
tbColor.add(tbRed);
|
||||||
|
|
||||||
tbGreen.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/color_green_off.png"))); // NOI18N
|
tbGreen.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/color_green_off.png"))); // NOI18N
|
||||||
|
@ -510,11 +501,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
tbGreen.setSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/color_green.png"))); // NOI18N
|
tbGreen.setSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/color_green.png"))); // NOI18N
|
||||||
tbGreen.setVerifyInputWhenFocusTarget(false);
|
tbGreen.setVerifyInputWhenFocusTarget(false);
|
||||||
tbGreen.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
tbGreen.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
tbGreen.addActionListener(new java.awt.event.ActionListener() {
|
tbGreen.addActionListener(evt -> tbGreenActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
tbGreenActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tbColor.add(tbGreen);
|
tbColor.add(tbGreen);
|
||||||
|
|
||||||
tbBlue.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/color_blueOff.png"))); // NOI18N
|
tbBlue.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/color_blueOff.png"))); // NOI18N
|
||||||
|
@ -525,11 +512,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
tbBlue.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
tbBlue.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||||
tbBlue.setSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/color_blue.png"))); // NOI18N
|
tbBlue.setSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/color_blue.png"))); // NOI18N
|
||||||
tbBlue.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
tbBlue.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
tbBlue.addActionListener(new java.awt.event.ActionListener() {
|
tbBlue.addActionListener(evt -> tbBlueActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
tbBlueActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tbColor.add(tbBlue);
|
tbColor.add(tbBlue);
|
||||||
|
|
||||||
tbBlack.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/color_black_off.png"))); // NOI18N
|
tbBlack.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/color_black_off.png"))); // NOI18N
|
||||||
|
@ -540,11 +523,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
tbBlack.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
tbBlack.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||||
tbBlack.setSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/color_black.png"))); // NOI18N
|
tbBlack.setSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/color_black.png"))); // NOI18N
|
||||||
tbBlack.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
tbBlack.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
tbBlack.addActionListener(new java.awt.event.ActionListener() {
|
tbBlack.addActionListener(evt -> tbBlackActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
tbBlackActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tbColor.add(tbBlack);
|
tbColor.add(tbBlack);
|
||||||
|
|
||||||
tbWhite.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/color_white_off.png"))); // NOI18N
|
tbWhite.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/color_white_off.png"))); // NOI18N
|
||||||
|
@ -555,11 +534,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
tbWhite.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
tbWhite.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||||
tbWhite.setSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/color_white.png"))); // NOI18N
|
tbWhite.setSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/color_white.png"))); // NOI18N
|
||||||
tbWhite.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
tbWhite.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
tbWhite.addActionListener(new java.awt.event.ActionListener() {
|
tbWhite.addActionListener(evt -> tbWhiteActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
tbWhiteActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tbColor.add(tbWhite);
|
tbColor.add(tbWhite);
|
||||||
|
|
||||||
tbColorless.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/colorless_off.png"))); // NOI18N
|
tbColorless.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/colorless_off.png"))); // NOI18N
|
||||||
|
@ -570,11 +545,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
tbColorless.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
tbColorless.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||||
tbColorless.setSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/colorless.png"))); // NOI18N
|
tbColorless.setSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/colorless.png"))); // NOI18N
|
||||||
tbColorless.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
tbColorless.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
tbColorless.addActionListener(new java.awt.event.ActionListener() {
|
tbColorless.addActionListener(evt -> tbColorlessActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
tbColorlessActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tbColor.add(tbColorless);
|
tbColor.add(tbColorless);
|
||||||
tbColor.add(jSeparator1);
|
tbColor.add(jSeparator1);
|
||||||
|
|
||||||
|
@ -583,11 +554,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
cbExpansionSet.setMinimumSize(new java.awt.Dimension(250, 25));
|
cbExpansionSet.setMinimumSize(new java.awt.Dimension(250, 25));
|
||||||
cbExpansionSet.setName("cbExpansionSet"); // NOI18N
|
cbExpansionSet.setName("cbExpansionSet"); // NOI18N
|
||||||
cbExpansionSet.setPreferredSize(new java.awt.Dimension(250, 25));
|
cbExpansionSet.setPreferredSize(new java.awt.Dimension(250, 25));
|
||||||
cbExpansionSet.addActionListener(new java.awt.event.ActionListener() {
|
cbExpansionSet.addActionListener(evt -> cbExpansionSetActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbExpansionSetActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tbColor.add(cbExpansionSet);
|
tbColor.add(cbExpansionSet);
|
||||||
tbColor.add(jSeparator2);
|
tbColor.add(jSeparator2);
|
||||||
|
|
||||||
|
@ -596,22 +563,14 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
btnBooster.setFocusable(false);
|
btnBooster.setFocusable(false);
|
||||||
btnBooster.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
btnBooster.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||||
btnBooster.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnBooster.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnBooster.addActionListener(new java.awt.event.ActionListener() {
|
btnBooster.addActionListener(evt -> btnBoosterActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnBoosterActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tbColor.add(btnBooster);
|
tbColor.add(btnBooster);
|
||||||
|
|
||||||
btnClear.setText("Clear");
|
btnClear.setText("Clear");
|
||||||
btnClear.setFocusable(false);
|
btnClear.setFocusable(false);
|
||||||
btnClear.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
btnClear.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||||
btnClear.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnClear.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnClear.addActionListener(new java.awt.event.ActionListener() {
|
btnClear.addActionListener(evt -> btnClearActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnClearActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tbColor.add(btnClear);
|
tbColor.add(btnClear);
|
||||||
|
|
||||||
tbTypes.setFloatable(false);
|
tbTypes.setFloatable(false);
|
||||||
|
@ -627,11 +586,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
tbLand.setFocusable(false);
|
tbLand.setFocusable(false);
|
||||||
tbLand.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
tbLand.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||||
tbLand.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
tbLand.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
tbLand.addActionListener(new java.awt.event.ActionListener() {
|
tbLand.addActionListener(evt -> tbLandActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
tbLandActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tbTypes.add(tbLand);
|
tbTypes.add(tbLand);
|
||||||
|
|
||||||
tbCreatures.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/type_creatures.png"))); // NOI18N
|
tbCreatures.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/type_creatures.png"))); // NOI18N
|
||||||
|
@ -642,11 +597,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
tbCreatures.setFocusable(false);
|
tbCreatures.setFocusable(false);
|
||||||
tbCreatures.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
tbCreatures.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||||
tbCreatures.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
tbCreatures.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
tbCreatures.addActionListener(new java.awt.event.ActionListener() {
|
tbCreatures.addActionListener(evt -> tbCreaturesActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
tbCreaturesActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tbTypes.add(tbCreatures);
|
tbTypes.add(tbCreatures);
|
||||||
|
|
||||||
tbArifiacts.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/type_artifact.png"))); // NOI18N
|
tbArifiacts.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/type_artifact.png"))); // NOI18N
|
||||||
|
@ -657,11 +608,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
tbArifiacts.setFocusable(false);
|
tbArifiacts.setFocusable(false);
|
||||||
tbArifiacts.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
tbArifiacts.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||||
tbArifiacts.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
tbArifiacts.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
tbArifiacts.addActionListener(new java.awt.event.ActionListener() {
|
tbArifiacts.addActionListener(evt -> tbArifiactsActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
tbArifiactsActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tbTypes.add(tbArifiacts);
|
tbTypes.add(tbArifiacts);
|
||||||
|
|
||||||
tbSorceries.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/type_sorcery.png"))); // NOI18N
|
tbSorceries.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/type_sorcery.png"))); // NOI18N
|
||||||
|
@ -672,11 +619,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
tbSorceries.setFocusable(false);
|
tbSorceries.setFocusable(false);
|
||||||
tbSorceries.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
tbSorceries.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||||
tbSorceries.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
tbSorceries.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
tbSorceries.addActionListener(new java.awt.event.ActionListener() {
|
tbSorceries.addActionListener(evt -> tbSorceriesActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
tbSorceriesActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tbTypes.add(tbSorceries);
|
tbTypes.add(tbSorceries);
|
||||||
|
|
||||||
tbInstants.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/type_instant.png"))); // NOI18N
|
tbInstants.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/type_instant.png"))); // NOI18N
|
||||||
|
@ -687,11 +630,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
tbInstants.setFocusable(false);
|
tbInstants.setFocusable(false);
|
||||||
tbInstants.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
tbInstants.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||||
tbInstants.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
tbInstants.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
tbInstants.addActionListener(new java.awt.event.ActionListener() {
|
tbInstants.addActionListener(evt -> tbInstantsActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
tbInstantsActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tbTypes.add(tbInstants);
|
tbTypes.add(tbInstants);
|
||||||
|
|
||||||
tbEnchantments.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/type_enchantment.png"))); // NOI18N
|
tbEnchantments.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/type_enchantment.png"))); // NOI18N
|
||||||
|
@ -702,11 +641,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
tbEnchantments.setFocusable(false);
|
tbEnchantments.setFocusable(false);
|
||||||
tbEnchantments.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
tbEnchantments.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||||
tbEnchantments.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
tbEnchantments.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
tbEnchantments.addActionListener(new java.awt.event.ActionListener() {
|
tbEnchantments.addActionListener(evt -> tbEnchantmentsActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
tbEnchantmentsActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tbTypes.add(tbEnchantments);
|
tbTypes.add(tbEnchantments);
|
||||||
|
|
||||||
tbPlaneswalkers.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/type_planeswalker.png"))); // NOI18N
|
tbPlaneswalkers.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/type_planeswalker.png"))); // NOI18N
|
||||||
|
@ -717,11 +652,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
tbPlaneswalkers.setFocusable(false);
|
tbPlaneswalkers.setFocusable(false);
|
||||||
tbPlaneswalkers.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
tbPlaneswalkers.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||||
tbPlaneswalkers.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
tbPlaneswalkers.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
tbPlaneswalkers.addActionListener(new java.awt.event.ActionListener() {
|
tbPlaneswalkers.addActionListener(evt -> tbPlaneswalkersActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
tbPlaneswalkersActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tbTypes.add(tbPlaneswalkers);
|
tbTypes.add(tbPlaneswalkers);
|
||||||
tbTypes.add(jSeparator6);
|
tbTypes.add(jSeparator6);
|
||||||
|
|
||||||
|
@ -730,11 +661,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
chkPiles.setFocusable(false);
|
chkPiles.setFocusable(false);
|
||||||
chkPiles.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
chkPiles.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
|
||||||
chkPiles.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
chkPiles.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
chkPiles.addActionListener(new java.awt.event.ActionListener() {
|
chkPiles.addActionListener(evt -> chkPilesActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
chkPilesActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tbTypes.add(chkPiles);
|
tbTypes.add(chkPiles);
|
||||||
tbTypes.add(jSeparator3);
|
tbTypes.add(jSeparator3);
|
||||||
|
|
||||||
|
@ -742,11 +669,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
cbSortBy.setMaximumSize(new java.awt.Dimension(120, 20));
|
cbSortBy.setMaximumSize(new java.awt.Dimension(120, 20));
|
||||||
cbSortBy.setMinimumSize(new java.awt.Dimension(120, 20));
|
cbSortBy.setMinimumSize(new java.awt.Dimension(120, 20));
|
||||||
cbSortBy.setPreferredSize(new java.awt.Dimension(120, 20));
|
cbSortBy.setPreferredSize(new java.awt.Dimension(120, 20));
|
||||||
cbSortBy.addActionListener(new java.awt.event.ActionListener() {
|
cbSortBy.addActionListener(evt -> cbSortByActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbSortByActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tbTypes.add(cbSortBy);
|
tbTypes.add(cbSortBy);
|
||||||
tbTypes.add(jSeparator4);
|
tbTypes.add(jSeparator4);
|
||||||
|
|
||||||
|
@ -761,11 +684,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
jToggleListView.setMaximumSize(new java.awt.Dimension(37, 22));
|
jToggleListView.setMaximumSize(new java.awt.Dimension(37, 22));
|
||||||
jToggleListView.setMinimumSize(new java.awt.Dimension(37, 22));
|
jToggleListView.setMinimumSize(new java.awt.Dimension(37, 22));
|
||||||
jToggleListView.setPreferredSize(new java.awt.Dimension(37, 22));
|
jToggleListView.setPreferredSize(new java.awt.Dimension(37, 22));
|
||||||
jToggleListView.addActionListener(new java.awt.event.ActionListener() {
|
jToggleListView.addActionListener(evt -> jToggleListViewActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
jToggleListViewActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tbTypes.add(jToggleListView);
|
tbTypes.add(jToggleListView);
|
||||||
|
|
||||||
bgView.add(jToggleCardView);
|
bgView.add(jToggleCardView);
|
||||||
|
@ -780,11 +699,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
jToggleCardView.setName(""); // NOI18N
|
jToggleCardView.setName(""); // NOI18N
|
||||||
jToggleCardView.setPreferredSize(new java.awt.Dimension(37, 22));
|
jToggleCardView.setPreferredSize(new java.awt.Dimension(37, 22));
|
||||||
jToggleCardView.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
jToggleCardView.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
jToggleCardView.addActionListener(new java.awt.event.ActionListener() {
|
jToggleCardView.addActionListener(evt -> jToggleCardViewActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
jToggleCardViewActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tbTypes.add(jToggleCardView);
|
tbTypes.add(jToggleCardView);
|
||||||
|
|
||||||
cardSelectorScrollPane.setToolTipText("<HTML>Double click to add the card to the main deck.<br/>\nALT + Double click to add the card to the sideboard.");
|
cardSelectorScrollPane.setToolTipText("<HTML>Double click to add the card to the main deck.<br/>\nALT + Double click to add the card to the sideboard.");
|
||||||
|
@ -798,11 +713,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
jButtonAddToMain.setMaximumSize(new java.awt.Dimension(42, 23));
|
jButtonAddToMain.setMaximumSize(new java.awt.Dimension(42, 23));
|
||||||
jButtonAddToMain.setMinimumSize(new java.awt.Dimension(42, 23));
|
jButtonAddToMain.setMinimumSize(new java.awt.Dimension(42, 23));
|
||||||
jButtonAddToMain.setPreferredSize(new java.awt.Dimension(40, 28));
|
jButtonAddToMain.setPreferredSize(new java.awt.Dimension(40, 28));
|
||||||
jButtonAddToMain.addActionListener(new java.awt.event.ActionListener() {
|
jButtonAddToMain.addActionListener(evt -> jButtonAddToMainActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
jButtonAddToMainActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jButtonAddToSideboard.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/sideboard_in.png"))); // NOI18N
|
jButtonAddToSideboard.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/sideboard_in.png"))); // NOI18N
|
||||||
jButtonAddToSideboard.setToolTipText("<html>Add selected cards to sideboard.<br/>\nAlternative: <strong>ALT key + Double click</strong> the card in card selector to move a card to the sideboard.");
|
jButtonAddToSideboard.setToolTipText("<html>Add selected cards to sideboard.<br/>\nAlternative: <strong>ALT key + Double click</strong> the card in card selector to move a card to the sideboard.");
|
||||||
|
@ -810,11 +721,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
jButtonAddToSideboard.setMaximumSize(new java.awt.Dimension(100, 30));
|
jButtonAddToSideboard.setMaximumSize(new java.awt.Dimension(100, 30));
|
||||||
jButtonAddToSideboard.setMinimumSize(new java.awt.Dimension(10, 30));
|
jButtonAddToSideboard.setMinimumSize(new java.awt.Dimension(10, 30));
|
||||||
jButtonAddToSideboard.setPreferredSize(new java.awt.Dimension(40, 28));
|
jButtonAddToSideboard.setPreferredSize(new java.awt.Dimension(40, 28));
|
||||||
jButtonAddToSideboard.addActionListener(new java.awt.event.ActionListener() {
|
jButtonAddToSideboard.addActionListener(evt -> jButtonAddToSideboardActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
jButtonAddToSideboardActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jLabelSearch.setText("Search:");
|
jLabelSearch.setText("Search:");
|
||||||
jLabelSearch.setToolTipText("Searches for card names and in the rule text of the card.");
|
jLabelSearch.setToolTipText("Searches for card names and in the rule text of the card.");
|
||||||
|
@ -823,19 +730,11 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
|
|
||||||
jButtonSearch.setText("Search");
|
jButtonSearch.setText("Search");
|
||||||
jButtonSearch.setToolTipText("Performs the search.");
|
jButtonSearch.setToolTipText("Performs the search.");
|
||||||
jButtonSearch.addActionListener(new java.awt.event.ActionListener() {
|
jButtonSearch.addActionListener(evt -> jButtonSearchActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
jButtonSearchActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jButtonClean.setText("Clear");
|
jButtonClean.setText("Clear");
|
||||||
jButtonClean.setToolTipText("Clears the search field.");
|
jButtonClean.setToolTipText("Clears the search field.");
|
||||||
jButtonClean.addActionListener(new java.awt.event.ActionListener() {
|
jButtonClean.addActionListener(evt -> jButtonCleanActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
jButtonCleanActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
cardCountLabel.setText("Card count:");
|
cardCountLabel.setText("Card count:");
|
||||||
cardCountLabel.setToolTipText("Number of cards currently shown.");
|
cardCountLabel.setToolTipText("Number of cards currently shown.");
|
||||||
|
@ -848,11 +747,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
jButtonRemoveFromMain.setMaximumSize(new java.awt.Dimension(42, 23));
|
jButtonRemoveFromMain.setMaximumSize(new java.awt.Dimension(42, 23));
|
||||||
jButtonRemoveFromMain.setMinimumSize(new java.awt.Dimension(42, 23));
|
jButtonRemoveFromMain.setMinimumSize(new java.awt.Dimension(42, 23));
|
||||||
jButtonRemoveFromMain.setPreferredSize(new java.awt.Dimension(40, 28));
|
jButtonRemoveFromMain.setPreferredSize(new java.awt.Dimension(40, 28));
|
||||||
jButtonRemoveFromMain.addActionListener(new java.awt.event.ActionListener() {
|
jButtonRemoveFromMain.addActionListener(evt -> jButtonRemoveFromMainActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
jButtonRemoveFromMainActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jButtonRemoveFromSideboard.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/sideboard_out.png"))); // NOI18N
|
jButtonRemoveFromSideboard.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/sideboard_out.png"))); // NOI18N
|
||||||
jButtonRemoveFromSideboard.setToolTipText("Remove selected cards from sideboard.");
|
jButtonRemoveFromSideboard.setToolTipText("Remove selected cards from sideboard.");
|
||||||
|
@ -860,11 +755,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
jButtonRemoveFromSideboard.setMaximumSize(new java.awt.Dimension(10, 30));
|
jButtonRemoveFromSideboard.setMaximumSize(new java.awt.Dimension(10, 30));
|
||||||
jButtonRemoveFromSideboard.setMinimumSize(new java.awt.Dimension(100, 30));
|
jButtonRemoveFromSideboard.setMinimumSize(new java.awt.Dimension(100, 30));
|
||||||
jButtonRemoveFromSideboard.setPreferredSize(new java.awt.Dimension(40, 28));
|
jButtonRemoveFromSideboard.setPreferredSize(new java.awt.Dimension(40, 28));
|
||||||
jButtonRemoveFromSideboard.addActionListener(new java.awt.event.ActionListener() {
|
jButtonRemoveFromSideboard.addActionListener(evt -> jButtonRemoveFromSideboardActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
jButtonRemoveFromSideboardActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
javax.swing.GroupLayout cardSelectorBottomPanelLayout = new javax.swing.GroupLayout(cardSelectorBottomPanel);
|
javax.swing.GroupLayout cardSelectorBottomPanelLayout = new javax.swing.GroupLayout(cardSelectorBottomPanel);
|
||||||
cardSelectorBottomPanel.setLayout(cardSelectorBottomPanelLayout);
|
cardSelectorBottomPanel.setLayout(cardSelectorBottomPanelLayout);
|
||||||
|
@ -1132,12 +1023,7 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> currentView.refresh());
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
currentView.refresh();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private TableModel mainModel;
|
private TableModel mainModel;
|
||||||
|
|
|
@ -55,9 +55,9 @@ import mage.view.CardsView;
|
||||||
*/
|
*/
|
||||||
public class DeckArea extends javax.swing.JPanel {
|
public class DeckArea extends javax.swing.JPanel {
|
||||||
|
|
||||||
private CardEventSource maindeckVirtualEvent = new CardEventSource();
|
private final CardEventSource maindeckVirtualEvent = new CardEventSource();
|
||||||
private CardEventSource sideboardVirtualEvent = new CardEventSource();
|
private final CardEventSource sideboardVirtualEvent = new CardEventSource();
|
||||||
private Set<UUID> hiddenCards = new HashSet<>();
|
private final Set<UUID> hiddenCards = new HashSet<>();
|
||||||
private Deck lastDeck = new Deck();
|
private Deck lastDeck = new Deck();
|
||||||
private BigCard lastBigCard = null;
|
private BigCard lastBigCard = null;
|
||||||
private int dividerLocationNormal = 0;
|
private int dividerLocationNormal = 0;
|
||||||
|
|
|
@ -44,6 +44,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.Timer;
|
import javax.swing.Timer;
|
||||||
import javax.swing.filechooser.FileFilter;
|
import javax.swing.filechooser.FileFilter;
|
||||||
|
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.Sets;
|
import mage.cards.Sets;
|
||||||
import mage.cards.decks.Deck;
|
import mage.cards.decks.Deck;
|
||||||
|
@ -73,7 +74,6 @@ import mage.view.SimpleCardView;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
public class DeckEditorPanel extends javax.swing.JPanel {
|
public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
|
@ -82,7 +82,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
private final JFileChooser fcSelectDeck;
|
private final JFileChooser fcSelectDeck;
|
||||||
private final JFileChooser fcImportDeck;
|
private final JFileChooser fcImportDeck;
|
||||||
private Deck deck = new Deck();
|
private Deck deck = new Deck();
|
||||||
private Map<UUID, Card> temporaryCards = new HashMap<>(); // Cards dragged out of one part of the view into another
|
private final Map<UUID, Card> temporaryCards = new HashMap<>(); // Cards dragged out of one part of the view into another
|
||||||
private boolean isShowCardInfo = false;
|
private boolean isShowCardInfo = false;
|
||||||
private UUID tableId;
|
private UUID tableId;
|
||||||
private DeckEditorMode mode;
|
private DeckEditorMode mode;
|
||||||
|
@ -108,21 +108,18 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
jSplitPane1.setOpaque(false);
|
jSplitPane1.setOpaque(false);
|
||||||
restoreDividerLocationsAndDeckAreaSettings();
|
restoreDividerLocationsAndDeckAreaSettings();
|
||||||
countdown = new Timer(1000,
|
countdown = new Timer(1000,
|
||||||
new ActionListener() {
|
e -> {
|
||||||
@Override
|
if (--timeout > 0) {
|
||||||
public void actionPerformed(ActionEvent e) {
|
setTimeout(timeout);
|
||||||
if (--timeout > 0) {
|
} else {
|
||||||
setTimeout(timeout);
|
if (updateDeckTask != null) {
|
||||||
} else {
|
updateDeckTask.cancel(true);
|
||||||
if (updateDeckTask != null) {
|
}
|
||||||
updateDeckTask.cancel(true);
|
setTimeout(0);
|
||||||
|
countdown.stop();
|
||||||
|
removeDeckEditor();
|
||||||
}
|
}
|
||||||
setTimeout(0);
|
});
|
||||||
countdown.stop();
|
|
||||||
removeDeckEditor();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Set up tracking to save the deck editor settings when the deck editor is hidden.
|
// Set up tracking to save the deck editor settings when the deck editor is hidden.
|
||||||
addHierarchyListener((HierarchyEvent e) -> {
|
addHierarchyListener((HierarchyEvent e) -> {
|
||||||
|
@ -265,213 +262,204 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
for (ICardGrid component : this.cardSelector.getCardGridComponents()) {
|
for (ICardGrid component : this.cardSelector.getCardGridComponents()) {
|
||||||
component.clearCardEventListeners();
|
component.clearCardEventListeners();
|
||||||
component.addCardEventListener(
|
component.addCardEventListener(
|
||||||
new Listener<Event>() {
|
(Listener<Event>) event -> {
|
||||||
@Override
|
switch (event.getEventName()) {
|
||||||
public void event(Event event) {
|
case "double-click":
|
||||||
switch (event.getEventName()) {
|
|
||||||
case "double-click":
|
|
||||||
moveSelectorCardToDeck(event);
|
|
||||||
break;
|
|
||||||
case "alt-double-click":
|
|
||||||
if (mode == DeckEditorMode.FREE_BUILDING) {
|
|
||||||
moveSelectorCardToSideboard(event);
|
|
||||||
} else {
|
|
||||||
// because in match mode selector is used as sideboard the card goes to deck also for shift click
|
|
||||||
moveSelectorCardToDeck(event);
|
moveSelectorCardToDeck(event);
|
||||||
}
|
break;
|
||||||
break;
|
case "alt-double-click":
|
||||||
case "remove-main":
|
if (mode == DeckEditorMode.FREE_BUILDING) {
|
||||||
DeckEditorPanel.this.deckArea.getDeckList().removeSelection();
|
moveSelectorCardToSideboard(event);
|
||||||
break;
|
} else {
|
||||||
case "remove-sideboard":
|
// because in match mode selector is used as sideboard the card goes to deck also for shift click
|
||||||
DeckEditorPanel.this.deckArea.getSideboardList().removeSelection();
|
moveSelectorCardToDeck(event);
|
||||||
break;
|
}
|
||||||
}
|
break;
|
||||||
refreshDeck();
|
case "remove-main":
|
||||||
}
|
DeckEditorPanel.this.deckArea.getDeckList().removeSelection();
|
||||||
});
|
break;
|
||||||
|
case "remove-sideboard":
|
||||||
|
DeckEditorPanel.this.deckArea.getSideboardList().removeSelection();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
refreshDeck();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
this.deckArea.clearDeckEventListeners();
|
this.deckArea.clearDeckEventListeners();
|
||||||
this.deckArea.addDeckEventListener(
|
this.deckArea.addDeckEventListener(
|
||||||
new Listener<Event>() {
|
(Listener<Event>) event -> {
|
||||||
@Override
|
if (mode == DeckEditorMode.FREE_BUILDING){
|
||||||
public void event(Event event) {
|
switch (event.getEventName()) {
|
||||||
if (mode.equals(DeckEditorMode.FREE_BUILDING)) {
|
case "double-click": {
|
||||||
switch (event.getEventName()) {
|
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||||
case "double-click": {
|
for (Card card : deck.getCards()) {
|
||||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
if (card.getId().equals(cardView.getId())) {
|
||||||
for (Card card : deck.getCards()) {
|
deck.getCards().remove(card);
|
||||||
if (card.getId().equals(cardView.getId())) {
|
break;
|
||||||
deck.getCards().remove(card);
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
hidePopup();
|
||||||
|
refreshDeck();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
hidePopup();
|
case "alt-double-click": {
|
||||||
refreshDeck();
|
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||||
break;
|
for (Card card : deck.getCards()) {
|
||||||
}
|
if (card.getId().equals(cardView.getId())) {
|
||||||
case "alt-double-click": {
|
deck.getCards().remove(card);
|
||||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
deck.getSideboard().add(card);
|
||||||
for (Card card : deck.getCards()) {
|
break;
|
||||||
if (card.getId().equals(cardView.getId())) {
|
}
|
||||||
deck.getCards().remove(card);
|
|
||||||
deck.getSideboard().add(card);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
hidePopup();
|
||||||
|
refreshDeck();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
hidePopup();
|
case "set-number": {
|
||||||
refreshDeck();
|
setCardNumberToCardsList(event, deck.getCards());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "set-number": {
|
case "remove-specific-card": {
|
||||||
setCardNumberToCardsList(event, deck.getCards());
|
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||||
break;
|
for (Card card : deck.getCards()) {
|
||||||
}
|
if (card.getId().equals(cardView.getId())) {
|
||||||
case "remove-specific-card": {
|
deck.getCards().remove(card);
|
||||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
storeTemporaryCard(card);
|
||||||
for (Card card : deck.getCards()) {
|
break;
|
||||||
if (card.getId().equals(cardView.getId())) {
|
}
|
||||||
deck.getCards().remove(card);
|
|
||||||
storeTemporaryCard(card);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "add-specific-card": {
|
||||||
|
SimpleCardView cardView = (CardView) event.getSource();
|
||||||
|
deck.getCards().add(retrieveTemporaryCard(cardView));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case "add-specific-card": {
|
}else{
|
||||||
SimpleCardView cardView = (CardView) event.getSource();
|
// constructing phase or sideboarding during match -> card goes always to sideboard
|
||||||
deck.getCards().add(retrieveTemporaryCard(cardView));
|
switch (event.getEventName()) {
|
||||||
break;
|
case "double-click":
|
||||||
|
case "alt-double-click": {
|
||||||
|
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||||
|
for (Card card : deck.getCards()) {
|
||||||
|
if (card.getId().equals(cardView.getId())) {
|
||||||
|
deck.getCards().remove(card);
|
||||||
|
deck.getSideboard().add(card);
|
||||||
|
cardSelector.loadSideboard(new ArrayList<>(deck.getSideboard()), getBigCard());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hidePopup();
|
||||||
|
refreshDeck();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "remove-specific-card": {
|
||||||
|
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||||
|
for (Card card : deck.getCards()) {
|
||||||
|
if (card.getId().equals(cardView.getId())) {
|
||||||
|
deck.getCards().remove(card);
|
||||||
|
storeTemporaryCard(card);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "add-specific-card": {
|
||||||
|
SimpleCardView cardView = (CardView) event.getSource();
|
||||||
|
deck.getCards().add(retrieveTemporaryCard(cardView));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
});
|
||||||
// constructing phase or sideboarding during match -> card goes always to sideboard
|
|
||||||
switch (event.getEventName()) {
|
|
||||||
case "double-click":
|
|
||||||
case "alt-double-click": {
|
|
||||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
|
||||||
for (Card card : deck.getCards()) {
|
|
||||||
if (card.getId().equals(cardView.getId())) {
|
|
||||||
deck.getCards().remove(card);
|
|
||||||
deck.getSideboard().add(card);
|
|
||||||
cardSelector.loadSideboard(new ArrayList<>(deck.getSideboard()), getBigCard());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
hidePopup();
|
|
||||||
refreshDeck();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "remove-specific-card": {
|
|
||||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
|
||||||
for (Card card : deck.getCards()) {
|
|
||||||
if (card.getId().equals(cardView.getId())) {
|
|
||||||
deck.getCards().remove(card);
|
|
||||||
storeTemporaryCard(card);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "add-specific-card": {
|
|
||||||
SimpleCardView cardView = (CardView) event.getSource();
|
|
||||||
deck.getCards().add(retrieveTemporaryCard(cardView));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.deckArea.clearSideboardEventListeners();
|
this.deckArea.clearSideboardEventListeners();
|
||||||
this.deckArea.addSideboardEventListener(
|
this.deckArea.addSideboardEventListener(
|
||||||
new Listener<Event>() {
|
(Listener<Event>) event -> {
|
||||||
@Override
|
if (mode == DeckEditorMode.FREE_BUILDING) {
|
||||||
public void event(Event event) {
|
// normal edit mode
|
||||||
if (mode.equals(DeckEditorMode.FREE_BUILDING)) {
|
switch (event.getEventName()) {
|
||||||
// normal edit mode
|
case "double-click":
|
||||||
switch (event.getEventName()) {
|
// remove card from sideboard (don't add it to deck)
|
||||||
case "double-click":
|
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||||
// remove card from sideboard (don't add it to deck)
|
for (Card card : deck.getSideboard()) {
|
||||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
if (card.getId().equals(cardView.getId())) {
|
||||||
for (Card card : deck.getSideboard()) {
|
deck.getSideboard().remove(card);
|
||||||
if (card.getId().equals(cardView.getId())) {
|
break;
|
||||||
deck.getSideboard().remove(card);
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
hidePopup();
|
||||||
hidePopup();
|
refreshDeck();
|
||||||
refreshDeck();
|
break;
|
||||||
break;
|
case "alt-double-click":
|
||||||
case "alt-double-click":
|
// remove card from sideboard
|
||||||
// remove card from sideboard
|
cardView = (SimpleCardView) event.getSource();
|
||||||
cardView = (SimpleCardView) event.getSource();
|
for (Card card : deck.getSideboard()) {
|
||||||
for (Card card : deck.getSideboard()) {
|
if (card.getId().equals(cardView.getId())) {
|
||||||
if (card.getId().equals(cardView.getId())) {
|
deck.getSideboard().remove(card);
|
||||||
deck.getSideboard().remove(card);
|
deck.getCards().add(card);
|
||||||
deck.getCards().add(card);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
|
hidePopup();
|
||||||
|
refreshDeck();
|
||||||
|
break;
|
||||||
|
case "set-number": {
|
||||||
|
setCardNumberToCardsList(event, deck.getSideboard());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "remove-specific-card": {
|
||||||
|
cardView = (SimpleCardView) event.getSource();
|
||||||
|
for (Card card : deck.getSideboard()) {
|
||||||
|
if (card.getId().equals(cardView.getId())) {
|
||||||
|
deck.getSideboard().remove(card);
|
||||||
|
storeTemporaryCard(card);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "add-specific-card": {
|
||||||
|
cardView = (CardView) event.getSource();
|
||||||
|
deck.getSideboard().add(retrieveTemporaryCard(cardView));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
hidePopup();
|
|
||||||
refreshDeck();
|
|
||||||
break;
|
|
||||||
case "set-number": {
|
|
||||||
setCardNumberToCardsList(event, deck.getSideboard());
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case "remove-specific-card": {
|
} else {
|
||||||
cardView = (SimpleCardView) event.getSource();
|
// construct phase or sideboarding during match
|
||||||
for (Card card : deck.getSideboard()) {
|
switch (event.getEventName()) {
|
||||||
if (card.getId().equals(cardView.getId())) {
|
case "remove-specific-card": {
|
||||||
deck.getSideboard().remove(card);
|
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||||
storeTemporaryCard(card);
|
for (Card card : deck.getSideboard()) {
|
||||||
break;
|
if (card.getId().equals(cardView.getId())) {
|
||||||
|
deck.getSideboard().remove(card);
|
||||||
|
storeTemporaryCard(card);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
case "add-specific-card": {
|
||||||
}
|
SimpleCardView cardView = (CardView) event.getSource();
|
||||||
case "add-specific-card": {
|
deck.getSideboard().add(retrieveTemporaryCard(cardView));
|
||||||
cardView = (CardView) event.getSource();
|
break;
|
||||||
deck.getSideboard().add(retrieveTemporaryCard(cardView));
|
}
|
||||||
break;
|
case "double-click":
|
||||||
|
case "alt-double-click":
|
||||||
|
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
||||||
|
for (Card card : deck.getSideboard()) {
|
||||||
|
if (card.getId().equals(cardView.getId())) {
|
||||||
|
deck.getSideboard().remove(card);
|
||||||
|
deck.getCards().add(card);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hidePopup();
|
||||||
|
refreshDeck();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
});
|
||||||
// construct phase or sideboarding during match
|
|
||||||
switch (event.getEventName()) {
|
|
||||||
case "remove-specific-card": {
|
|
||||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
|
||||||
for (Card card : deck.getSideboard()) {
|
|
||||||
if (card.getId().equals(cardView.getId())) {
|
|
||||||
deck.getSideboard().remove(card);
|
|
||||||
storeTemporaryCard(card);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "add-specific-card": {
|
|
||||||
SimpleCardView cardView = (CardView) event.getSource();
|
|
||||||
deck.getSideboard().add(retrieveTemporaryCard(cardView));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "double-click":
|
|
||||||
case "alt-double-click":
|
|
||||||
SimpleCardView cardView = (SimpleCardView) event.getSource();
|
|
||||||
for (Card card : deck.getSideboard()) {
|
|
||||||
if (card.getId().equals(cardView.getId())) {
|
|
||||||
deck.getSideboard().remove(card);
|
|
||||||
deck.getCards().add(card);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
hidePopup();
|
|
||||||
refreshDeck();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
refreshDeck();
|
refreshDeck();
|
||||||
|
|
||||||
this.setVisible(true);
|
this.setVisible(true);
|
||||||
|
@ -485,7 +473,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
List<Card> toDelete = new ArrayList<>();
|
List<Card> toDelete = new ArrayList<>();
|
||||||
for (Card card : cards) {
|
for (Card card : cards) {
|
||||||
if (card.getName().equals(cardView.getName())
|
if (card.getName().equals(cardView.getName())
|
||||||
&& card.getCardNumber() == cardView.getCardNumber()
|
&& Objects.equals(card.getCardNumber(), cardView.getCardNumber())
|
||||||
&& card.getExpansionSetCode().equals(cardView.getExpansionSetCode())) {
|
&& card.getExpansionSetCode().equals(cardView.getExpansionSetCode())) {
|
||||||
cardsFound++;
|
cardsFound++;
|
||||||
if (cardsFound > numberToSet) {
|
if (cardsFound > numberToSet) {
|
||||||
|
@ -515,9 +503,8 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
CardInfo cardInfo = CardRepository.instance.findCard(cardView.getExpansionSetCode(), cardView.getCardNumber());
|
CardInfo cardInfo = CardRepository.instance.findCard(cardView.getExpansionSetCode(), cardView.getCardNumber());
|
||||||
Card card = null;
|
Card card = null;
|
||||||
if (mode == DeckEditorMode.SIDEBOARDING || mode == DeckEditorMode.LIMITED_BUILDING) {
|
if (mode == DeckEditorMode.SIDEBOARDING || mode == DeckEditorMode.LIMITED_BUILDING) {
|
||||||
Iterator sideboard = deck.getSideboard().iterator();
|
for (Object o : deck.getSideboard()) {
|
||||||
while (sideboard.hasNext()) {
|
card = (Card) o;
|
||||||
card = (Card) sideboard.next();
|
|
||||||
if (card.getId().equals(cardView.getId())) {
|
if (card.getId().equals(cardView.getId())) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -611,7 +598,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
AudioManager.playOnCountdown1();
|
AudioManager.playOnCountdown1();
|
||||||
}
|
}
|
||||||
if (timeToSubmit > 0) {
|
if (timeToSubmit > 0) {
|
||||||
timeToSubmit --;
|
timeToSubmit--;
|
||||||
btnSubmitTimer.setText("Submit (" + timeToSubmit + ")");
|
btnSubmitTimer.setText("Submit (" + timeToSubmit + ")");
|
||||||
btnSubmitTimer.setToolTipText("Submit your deck in " + timeToSubmit + " seconds!");
|
btnSubmitTimer.setToolTipText("Submit your deck in " + timeToSubmit + " seconds!");
|
||||||
}
|
}
|
||||||
|
@ -658,105 +645,62 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
lblDeckName.setText("Deck Name:");
|
lblDeckName.setText("Deck Name:");
|
||||||
|
|
||||||
btnSave.setText("Save");
|
btnSave.setText("Save");
|
||||||
btnSave.addActionListener(new java.awt.event.ActionListener() {
|
btnSave.addActionListener(evt -> btnSaveActionPerformed(evt));
|
||||||
@Override
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnSaveActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnLoad.setText("Load");
|
btnLoad.setText("Load");
|
||||||
btnLoad.addActionListener(new java.awt.event.ActionListener() {
|
btnLoad.addActionListener(evt -> btnLoadActionPerformed(evt));
|
||||||
@Override
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnLoadActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnNew.setText("New");
|
btnNew.setText("New");
|
||||||
btnNew.addActionListener(new java.awt.event.ActionListener() {
|
btnNew.addActionListener(evt -> btnNewActionPerformed(evt));
|
||||||
@Override
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnNewActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnExit.setText("Exit");
|
btnExit.setText("Exit");
|
||||||
btnExit.addActionListener(new java.awt.event.ActionListener() {
|
btnExit.addActionListener(evt -> btnExitActionPerformed(evt));
|
||||||
@Override
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnExitActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnImport.setText("Import");
|
btnImport.setText("Import");
|
||||||
btnImport.setName("btnImport"); // NOI18N
|
btnImport.setName("btnImport"); // NOI18N
|
||||||
btnImport.addActionListener(new java.awt.event.ActionListener() {
|
btnImport.addActionListener(evt -> {
|
||||||
@Override
|
Object[] options = {"File", "Clipboard", "Append from Clipboard"};
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
Object[] options = {"File", "Clipboard", "Append from Clipboard"};
|
|
||||||
|
|
||||||
int n = JOptionPane.showOptionDialog(MageFrame.getDesktop(),
|
int n = JOptionPane.showOptionDialog(MageFrame.getDesktop(),
|
||||||
"Where would you like to import from?",
|
"Where would you like to import from?",
|
||||||
"Deck import",
|
"Deck import",
|
||||||
JOptionPane.YES_NO_CANCEL_OPTION,
|
JOptionPane.YES_NO_CANCEL_OPTION,
|
||||||
JOptionPane.QUESTION_MESSAGE,
|
JOptionPane.QUESTION_MESSAGE,
|
||||||
null,
|
null,
|
||||||
options,
|
options,
|
||||||
options[0]
|
options[0]
|
||||||
);
|
);
|
||||||
|
|
||||||
logger.info(n);
|
logger.info(n);
|
||||||
|
|
||||||
switch (n) {
|
switch (n) {
|
||||||
case 0:
|
case 0:
|
||||||
btnImportActionPerformed(evt);
|
btnImportActionPerformed(evt);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
btnImportFromClipboardActionPerformed(evt);
|
btnImportFromClipboardActionPerformed(evt);
|
||||||
case 2:
|
case 2:
|
||||||
btnImportFromClipboardActionWAppendPerformed(evt);
|
btnImportFromClipboardActionWAppendPerformed(evt);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
btnSubmit.setText("Submit");
|
btnSubmit.setText("Submit");
|
||||||
btnSubmitTimer.setToolTipText("Submit your deck now!");
|
btnSubmitTimer.setToolTipText("Submit your deck now!");
|
||||||
btnSubmit.setName("btnSubmit"); // NOI18N
|
btnSubmit.setName("btnSubmit"); // NOI18N
|
||||||
btnSubmit.addActionListener(new java.awt.event.ActionListener() {
|
btnSubmit.addActionListener(evt -> btnSubmitActionPerformed(evt));
|
||||||
@Override
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnSubmitActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnSubmitTimer.setText("Submit (60s)");
|
btnSubmitTimer.setText("Submit (60s)");
|
||||||
btnSubmitTimer.setToolTipText("Submit your deck in one minute!");
|
btnSubmitTimer.setToolTipText("Submit your deck in one minute!");
|
||||||
btnSubmitTimer.setName("btnSubmitTimer");
|
btnSubmitTimer.setName("btnSubmitTimer");
|
||||||
btnSubmitTimer.addActionListener(new java.awt.event.ActionListener() {
|
btnSubmitTimer.addActionListener(evt -> btnSubmitTimerActionPerformed(evt));
|
||||||
@Override
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnSubmitTimerActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnAddLand.setText("Add Land");
|
btnAddLand.setText("Add Land");
|
||||||
btnAddLand.setName("btnAddLand"); // NOI18N
|
btnAddLand.setName("btnAddLand"); // NOI18N
|
||||||
btnAddLand.addActionListener(new java.awt.event.ActionListener() {
|
btnAddLand.addActionListener(evt -> btnAddLandActionPerformed(evt));
|
||||||
@Override
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnAddLandActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnGenDeck.setText("Generate");
|
btnGenDeck.setText("Generate");
|
||||||
btnGenDeck.setName("btnGenDeck");
|
btnGenDeck.setName("btnGenDeck");
|
||||||
btnGenDeck.addActionListener(new java.awt.event.ActionListener() {
|
btnGenDeck.addActionListener(evt -> btnGenDeckActionPerformed(evt));
|
||||||
@Override
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnGenDeckActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
txtTimeRemaining.setEditable(false);
|
txtTimeRemaining.setEditable(false);
|
||||||
txtTimeRemaining.setForeground(java.awt.Color.red);
|
txtTimeRemaining.setForeground(java.awt.Color.red);
|
||||||
|
@ -767,84 +711,84 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
jPanel1.setLayout(jPanel1Layout);
|
jPanel1.setLayout(jPanel1Layout);
|
||||||
jPanel1Layout.setHorizontalGroup(
|
jPanel1Layout.setHorizontalGroup(
|
||||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
/*.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
|
/*.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(jLayeredPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE))*/
|
.addComponent(jLayeredPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE))*/
|
||||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||||
.addGap(6, 6, 6)
|
.addGap(6, 6, 6)
|
||||||
.addComponent(lblDeckName)
|
.addComponent(lblDeckName)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(txtDeckName, javax.swing.GroupLayout.DEFAULT_SIZE, 189, Short.MAX_VALUE))
|
.addComponent(txtDeckName, javax.swing.GroupLayout.DEFAULT_SIZE, 189, Short.MAX_VALUE))
|
||||||
.addComponent(cardInfoPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(cardInfoPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(bigCard, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(bigCard, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(btnSave)
|
.addComponent(btnSave)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(btnLoad)
|
.addComponent(btnLoad)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(btnNew)
|
.addComponent(btnNew)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(btnExit))
|
.addComponent(btnExit))
|
||||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(btnImport)
|
.addComponent(btnImport)
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(btnGenDeck)
|
.addComponent(btnGenDeck)
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(btnAddLand)
|
.addComponent(btnAddLand)
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(btnSubmit)
|
.addComponent(btnSubmit)
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(btnSubmitTimer))
|
.addComponent(btnSubmitTimer))
|
||||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(txtTimeRemaining))
|
.addComponent(txtTimeRemaining))
|
||||||
)
|
)
|
||||||
.addContainerGap()));
|
.addContainerGap()));
|
||||||
jPanel1Layout.setVerticalGroup(
|
jPanel1Layout.setVerticalGroup(
|
||||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(txtDeckName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(txtDeckName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(lblDeckName))
|
.addComponent(lblDeckName))
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(btnSave)
|
.addComponent(btnSave)
|
||||||
.addComponent(btnLoad)
|
.addComponent(btnLoad)
|
||||||
.addComponent(btnNew)
|
.addComponent(btnNew)
|
||||||
.addComponent(btnExit))
|
.addComponent(btnExit))
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(btnImport)
|
.addComponent(btnImport)
|
||||||
.addComponent(btnGenDeck)
|
.addComponent(btnGenDeck)
|
||||||
.addComponent(btnAddLand)
|
.addComponent(btnAddLand)
|
||||||
.addComponent(btnSubmit)
|
.addComponent(btnSubmit)
|
||||||
.addComponent(btnSubmitTimer))
|
.addComponent(btnSubmitTimer))
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
.addComponent(txtTimeRemaining))
|
.addComponent(txtTimeRemaining))
|
||||||
//.addComponent(jLayeredPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
|
//.addComponent(jLayeredPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, isShowCardInfo ? 30 : 159, Short.MAX_VALUE)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, isShowCardInfo ? 30 : 159, Short.MAX_VALUE)
|
||||||
.addComponent(cardInfoPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(cardInfoPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 104, Short.MAX_VALUE)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 104, Short.MAX_VALUE)
|
||||||
.addComponent(bigCard, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)));
|
.addComponent(bigCard, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)));
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||||
this.setLayout(layout);
|
this.setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addGap(0, 0, 0)
|
.addGap(0, 0, 0)
|
||||||
.addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 604, Short.MAX_VALUE)));
|
.addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 604, Short.MAX_VALUE)));
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
.addComponent(jSplitPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 615, Short.MAX_VALUE));
|
.addComponent(jSplitPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 615, Short.MAX_VALUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1054,17 +998,15 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
timeToSubmit = 60;
|
timeToSubmit = 60;
|
||||||
this.btnSubmitTimer.setEnabled(false);
|
this.btnSubmitTimer.setEnabled(false);
|
||||||
|
|
||||||
ScheduledFuture scheduledFuture = scheduledExecutorService.schedule(new Callable() {
|
ScheduledFuture scheduledFuture = scheduledExecutorService.schedule((Callable) () -> {
|
||||||
public Object call() throws Exception {
|
if (updateDeckTask != null) {
|
||||||
if (updateDeckTask != null) {
|
updateDeckTask.cancel(true);
|
||||||
updateDeckTask.cancel(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SessionHandler.submitDeck(tableId, deck.getDeckCardLists())) {
|
|
||||||
removeDeckEditor();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (SessionHandler.submitDeck(tableId, deck.getDeckCardLists())) {
|
||||||
|
removeDeckEditor();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}, 60, TimeUnit.SECONDS);
|
}, 60, TimeUnit.SECONDS);
|
||||||
}//GEN-LAST:event_btnSubmitTimerActionPerformed
|
}//GEN-LAST:event_btnSubmitTimerActionPerformed
|
||||||
|
|
||||||
|
@ -1081,7 +1023,7 @@ public class DeckEditorPanel extends javax.swing.JPanel {
|
||||||
deck = Deck.load(DeckImporterUtil.importDeck(path), true, true);
|
deck = Deck.load(DeckImporterUtil.importDeck(path), true, true);
|
||||||
} catch (GameException ex) {
|
} catch (GameException ex) {
|
||||||
JOptionPane.showMessageDialog(MageFrame.getDesktop(), ex.getMessage(), "Error loading generated deck", JOptionPane.ERROR_MESSAGE);
|
JOptionPane.showMessageDialog(MageFrame.getDesktop(), ex.getMessage(), "Error loading generated deck", JOptionPane.ERROR_MESSAGE);
|
||||||
}catch (DeckGeneratorException ex) {
|
} catch (DeckGeneratorException ex) {
|
||||||
JOptionPane.showMessageDialog(MageFrame.getDesktop(), ex.getMessage(), "Generator error", JOptionPane.ERROR_MESSAGE);
|
JOptionPane.showMessageDialog(MageFrame.getDesktop(), ex.getMessage(), "Generator error", JOptionPane.ERROR_MESSAGE);
|
||||||
} finally {
|
} finally {
|
||||||
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||||
|
|
|
@ -23,18 +23,8 @@ public class DeckImportFromClipboardDialog extends JDialog {
|
||||||
setModal(true);
|
setModal(true);
|
||||||
getRootPane().setDefaultButton(buttonOK);
|
getRootPane().setDefaultButton(buttonOK);
|
||||||
|
|
||||||
buttonOK.addActionListener(new ActionListener() {
|
buttonOK.addActionListener(e -> onOK());
|
||||||
@Override
|
buttonCancel.addActionListener(e -> onCancel());
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
onOK();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
buttonCancel.addActionListener(new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
onCancel();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
||||||
addWindowListener(new WindowAdapter() {
|
addWindowListener(new WindowAdapter() {
|
||||||
|
@ -45,12 +35,7 @@ public class DeckImportFromClipboardDialog extends JDialog {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Close on "ESC"
|
// Close on "ESC"
|
||||||
contentPane.registerKeyboardAction(new ActionListener() {
|
contentPane.registerKeyboardAction(e -> onCancel(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
onCancel();
|
|
||||||
}
|
|
||||||
}, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onOK() {
|
private void onOK() {
|
||||||
|
@ -94,21 +79,15 @@ public class DeckImportFromClipboardDialog extends JDialog {
|
||||||
javax.swing.border.TitledBorder.TOP, new java.awt.Font("Dialog", java.awt.Font.PLAIN, 12),
|
javax.swing.border.TitledBorder.TOP, new java.awt.Font("Dialog", java.awt.Font.PLAIN, 12),
|
||||||
java.awt.Color.BLACK), contentPane.getBorder()));
|
java.awt.Color.BLACK), contentPane.getBorder()));
|
||||||
|
|
||||||
contentPane.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
|
contentPane.addPropertyChangeListener(e -> {
|
||||||
@Override
|
if ("border".equals(e.getPropertyName())) {
|
||||||
public void propertyChange(java.beans.PropertyChangeEvent e) {
|
throw new RuntimeException();
|
||||||
if ("border".equals(e.getPropertyName())) {
|
|
||||||
throw new RuntimeException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
contentPane.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
|
contentPane.addPropertyChangeListener(e -> {
|
||||||
@Override
|
if ("border".equals(e.getPropertyName())) {
|
||||||
public void propertyChange(java.beans.PropertyChangeEvent e) {
|
throw new RuntimeException();
|
||||||
if ("border".equals(e.getPropertyName())) {
|
|
||||||
throw new RuntimeException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -41,10 +41,10 @@ public abstract class SortSetting {
|
||||||
boolean ascending;
|
boolean ascending;
|
||||||
boolean pilesToggle;
|
boolean pilesToggle;
|
||||||
|
|
||||||
String prefSortBy;
|
final String prefSortBy;
|
||||||
String prefSortIndex;
|
final String prefSortIndex;
|
||||||
String prefSortAscending;
|
final String prefSortAscending;
|
||||||
String prefPilesToggle;
|
final String prefPilesToggle;
|
||||||
|
|
||||||
public SortSetting(String prefSortBy, String prefSortIndex, String prefSortAscending, String prefPilesToggle) {
|
public SortSetting(String prefSortBy, String prefSortIndex, String prefSortAscending, String prefPilesToggle) {
|
||||||
this.prefSortBy = prefSortBy;
|
this.prefSortBy = prefSortBy;
|
||||||
|
|
|
@ -31,8 +31,6 @@ import java.awt.Color;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.GridBagLayout;
|
import java.awt.GridBagLayout;
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import javax.swing.Box;
|
import javax.swing.Box;
|
||||||
import javax.swing.BoxLayout;
|
import javax.swing.BoxLayout;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
|
@ -58,8 +56,8 @@ public final class CollectionViewerPanel extends JPanel {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(CollectionViewerPanel.class);
|
private static final Logger logger = Logger.getLogger(CollectionViewerPanel.class);
|
||||||
|
|
||||||
protected static String LAYOYT_CONFIG_KEY = "collectionViewerLayoutConfig";
|
protected static final String LAYOYT_CONFIG_KEY = "collectionViewerLayoutConfig";
|
||||||
protected static String FORMAT_CONFIG_KEY = "collectionViewerFormat";
|
protected static final String FORMAT_CONFIG_KEY = "collectionViewerFormat";
|
||||||
|
|
||||||
public CollectionViewerPanel() {
|
public CollectionViewerPanel() {
|
||||||
initComponents();
|
initComponents();
|
||||||
|
@ -107,26 +105,20 @@ public final class CollectionViewerPanel extends JPanel {
|
||||||
small3x3.setForeground(Color.white);
|
small3x3.setForeground(Color.white);
|
||||||
boolean selected3x3 = MageFrame.getPreferences().get(LAYOYT_CONFIG_KEY, MageBook.LAYOUT_3x3).equals(MageBook.LAYOUT_3x3);
|
boolean selected3x3 = MageFrame.getPreferences().get(LAYOYT_CONFIG_KEY, MageBook.LAYOUT_3x3).equals(MageBook.LAYOUT_3x3);
|
||||||
small3x3.setSelected(selected3x3);
|
small3x3.setSelected(selected3x3);
|
||||||
small3x3.addActionListener(new ActionListener() {
|
small3x3.addActionListener(e -> {
|
||||||
@Override
|
big4x4.setSelected(false);
|
||||||
public void actionPerformed(ActionEvent e) {
|
mageBook.updateSize(MageBook.LAYOUT_3x3);
|
||||||
big4x4.setSelected(false);
|
MageFrame.getPreferences().put(LAYOYT_CONFIG_KEY, MageBook.LAYOUT_3x3);
|
||||||
mageBook.updateSize(MageBook.LAYOUT_3x3);
|
|
||||||
MageFrame.getPreferences().put(LAYOYT_CONFIG_KEY, MageBook.LAYOUT_3x3);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
jPanel1.add(small3x3);
|
jPanel1.add(small3x3);
|
||||||
|
|
||||||
big4x4 = new JRadioButton("4x4");
|
big4x4 = new JRadioButton("4x4");
|
||||||
big4x4.setForeground(Color.white);
|
big4x4.setForeground(Color.white);
|
||||||
big4x4.setSelected(!selected3x3);
|
big4x4.setSelected(!selected3x3);
|
||||||
big4x4.addActionListener(new ActionListener() {
|
big4x4.addActionListener(e -> {
|
||||||
@Override
|
small3x3.setSelected(false);
|
||||||
public void actionPerformed(ActionEvent e) {
|
mageBook.updateSize(MageBook.LAYOUT_4x4);
|
||||||
small3x3.setSelected(false);
|
MageFrame.getPreferences().put(LAYOYT_CONFIG_KEY, MageBook.LAYOUT_4x4);
|
||||||
mageBook.updateSize(MageBook.LAYOUT_4x4);
|
|
||||||
MageFrame.getPreferences().put(LAYOYT_CONFIG_KEY, MageBook.LAYOUT_4x4);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
jPanel1.add(big4x4);
|
jPanel1.add(big4x4);
|
||||||
|
|
||||||
|
@ -143,31 +135,18 @@ public final class CollectionViewerPanel extends JPanel {
|
||||||
jPanel1.add(buttonPanel);
|
jPanel1.add(buttonPanel);
|
||||||
|
|
||||||
JButton prev = new JButton("Prev");
|
JButton prev = new JButton("Prev");
|
||||||
prev.addActionListener(new ActionListener() {
|
prev.addActionListener(e -> mageBook.prev());
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
mageBook.prev();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
buttonPanel.add(prev);
|
buttonPanel.add(prev);
|
||||||
|
|
||||||
JButton next = new JButton("Next");
|
JButton next = new JButton("Next");
|
||||||
next.addActionListener(new ActionListener() {
|
next.addActionListener(e -> mageBook.next());
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
mageBook.next();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
buttonPanel.add(next);
|
buttonPanel.add(next);
|
||||||
|
|
||||||
formats.addActionListener(new ActionListener() {
|
formats.addActionListener(e -> {
|
||||||
@Override
|
if (mageBook != null) {
|
||||||
public void actionPerformed(ActionEvent e) {
|
String format = (String)formats.getSelectedItem();
|
||||||
if (mageBook != null) {
|
MageFrame.getPreferences().put(CollectionViewerPanel.FORMAT_CONFIG_KEY, format);
|
||||||
String format = (String)formats.getSelectedItem();
|
mageBook.updateDispayedSets(format);
|
||||||
MageFrame.getPreferences().put(CollectionViewerPanel.FORMAT_CONFIG_KEY, format);
|
|
||||||
mageBook.updateDispayedSets(format);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -197,12 +176,7 @@ public final class CollectionViewerPanel extends JPanel {
|
||||||
);
|
);
|
||||||
|
|
||||||
btnExit.setText("Exit");
|
btnExit.setText("Exit");
|
||||||
btnExit.addActionListener(new java.awt.event.ActionListener() {
|
btnExit.addActionListener(evt -> btnExitActionPerformed(evt));
|
||||||
@Override
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnExitActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ import java.awt.image.BufferedImage;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
@ -52,7 +51,6 @@ import mage.client.MageFrame;
|
||||||
import mage.client.cards.BigCard;
|
import mage.client.cards.BigCard;
|
||||||
import mage.client.components.HoverButton;
|
import mage.client.components.HoverButton;
|
||||||
import mage.client.plugins.impl.Plugins;
|
import mage.client.plugins.impl.Plugins;
|
||||||
import mage.client.util.Command;
|
|
||||||
import mage.client.util.Config;
|
import mage.client.util.Config;
|
||||||
import mage.client.util.ImageHelper;
|
import mage.client.util.ImageHelper;
|
||||||
import mage.client.util.NaturalOrderCardNumberComparator;
|
import mage.client.util.NaturalOrderCardNumberComparator;
|
||||||
|
@ -110,32 +108,26 @@ public class MageBook extends JComponent {
|
||||||
pageLeft = new HoverButton(null, image, image, image, new Rectangle(64, 64));
|
pageLeft = new HoverButton(null, image, image, image, new Rectangle(64, 64));
|
||||||
pageLeft.setBounds(0, 0, 64, 64);
|
pageLeft.setBounds(0, 0, 64, 64);
|
||||||
pageLeft.setVisible(false);
|
pageLeft.setVisible(false);
|
||||||
pageLeft.setObserver(new Command() {
|
pageLeft.setObserver(() -> {
|
||||||
@Override
|
currentPage--;
|
||||||
public void execute() {
|
if (currentPage == 0) {
|
||||||
currentPage--;
|
pageLeft.setVisible(false);
|
||||||
if (currentPage == 0) {
|
|
||||||
pageLeft.setVisible(false);
|
|
||||||
}
|
|
||||||
pageRight.setVisible(true);
|
|
||||||
AudioManager.playPrevPage();
|
|
||||||
showCards();
|
|
||||||
}
|
}
|
||||||
|
pageRight.setVisible(true);
|
||||||
|
AudioManager.playPrevPage();
|
||||||
|
showCards();
|
||||||
});
|
});
|
||||||
|
|
||||||
image = ImageHelper.loadImage(RIGHT_PAGE_BUTTON_IMAGE_PATH);
|
image = ImageHelper.loadImage(RIGHT_PAGE_BUTTON_IMAGE_PATH);
|
||||||
pageRight = new HoverButton(null, image, image, image, new Rectangle(64, 64));
|
pageRight = new HoverButton(null, image, image, image, new Rectangle(64, 64));
|
||||||
pageRight.setBounds(conf.WIDTH - 2 * LEFT_RIGHT_PAGES_WIDTH - 64, 0, 64, 64);
|
pageRight.setBounds(conf.WIDTH - 2 * LEFT_RIGHT_PAGES_WIDTH - 64, 0, 64, 64);
|
||||||
pageRight.setVisible(false);
|
pageRight.setVisible(false);
|
||||||
pageRight.setObserver(new Command() {
|
pageRight.setObserver(() -> {
|
||||||
@Override
|
currentPage++;
|
||||||
public void execute() {
|
pageLeft.setVisible(true);
|
||||||
currentPage++;
|
pageRight.setVisible(false);
|
||||||
pageLeft.setVisible(true);
|
AudioManager.playNextPage();
|
||||||
pageRight.setVisible(false);
|
showCards();
|
||||||
AudioManager.playNextPage();
|
|
||||||
showCards();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
addSetTabs();
|
addSetTabs();
|
||||||
|
@ -179,21 +171,18 @@ public class MageBook extends JComponent {
|
||||||
tab.setBounds(0, y, 39, 120);
|
tab.setBounds(0, y, 39, 120);
|
||||||
final String _set = set;
|
final String _set = set;
|
||||||
final int _index = count;
|
final int _index = count;
|
||||||
tab.setObserver(new Command() {
|
tab.setObserver(() -> {
|
||||||
@Override
|
if (!currentSet.equals(_set) || currentPage != 0) {
|
||||||
public void execute() {
|
AudioManager.playAnotherTab();
|
||||||
if (!currentSet.equals(_set) || currentPage != 0) {
|
synchronized (MageBook.this) {
|
||||||
AudioManager.playAnotherTab();
|
selectedTab = _index;
|
||||||
synchronized (MageBook.this) {
|
|
||||||
selectedTab = _index;
|
|
||||||
}
|
|
||||||
currentPage = 0;
|
|
||||||
currentSet = _set;
|
|
||||||
pageLeft.setVisible(false);
|
|
||||||
pageRight.setVisible(false);
|
|
||||||
addSetTabs();
|
|
||||||
showCards();
|
|
||||||
}
|
}
|
||||||
|
currentPage = 0;
|
||||||
|
currentSet = _set;
|
||||||
|
pageLeft.setVisible(false);
|
||||||
|
pageRight.setVisible(false);
|
||||||
|
addSetTabs();
|
||||||
|
showCards();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
tabs.add(tab);
|
tabs.add(tab);
|
||||||
|
@ -269,7 +258,7 @@ public class MageBook extends JComponent {
|
||||||
CardCriteria criteria = new CardCriteria();
|
CardCriteria criteria = new CardCriteria();
|
||||||
criteria.setCodes(set);
|
criteria.setCodes(set);
|
||||||
List<CardInfo> cards = CardRepository.instance.findCards(criteria);
|
List<CardInfo> cards = CardRepository.instance.findCards(criteria);
|
||||||
Collections.sort(cards, new NaturalOrderCardNumberComparator());
|
cards.sort(new NaturalOrderCardNumberComparator());
|
||||||
int start = page * conf.CARDS_PER_PAGE;
|
int start = page * conf.CARDS_PER_PAGE;
|
||||||
int end = page * conf.CARDS_PER_PAGE + conf.CARDS_PER_PAGE;
|
int end = page * conf.CARDS_PER_PAGE + conf.CARDS_PER_PAGE;
|
||||||
if (end > cards.size()) {
|
if (end > cards.size()) {
|
||||||
|
@ -334,12 +323,15 @@ public class MageBook extends JComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateSize(String size) {
|
public void updateSize(String size) {
|
||||||
if (size.equals(LAYOUT_3x3)) {
|
switch (size) {
|
||||||
this.conf = new _3x3Configuration();
|
case LAYOUT_3x3:
|
||||||
} else if (size.equals(LAYOUT_4x4)) {
|
this.conf = new _3x3Configuration();
|
||||||
this.conf = new _4x4Configuration();
|
break;
|
||||||
} else {
|
case LAYOUT_4x4:
|
||||||
return;
|
this.conf = new _4x4Configuration();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
currentPage = 0;
|
currentPage = 0;
|
||||||
pageLeft.setVisible(false);
|
pageLeft.setVisible(false);
|
||||||
|
@ -412,7 +404,7 @@ public class MageBook extends JComponent {
|
||||||
private ImagePanel jPanelCenter;
|
private ImagePanel jPanelCenter;
|
||||||
private JPanel jPanelRight;
|
private JPanel jPanelRight;
|
||||||
private JLayeredPane jLayeredPane;
|
private JLayeredPane jLayeredPane;
|
||||||
private BigCard bigCard;
|
private final BigCard bigCard;
|
||||||
private HoverButton pageLeft;
|
private HoverButton pageLeft;
|
||||||
private HoverButton pageRight;
|
private HoverButton pageRight;
|
||||||
|
|
||||||
|
@ -423,7 +415,7 @@ public class MageBook extends JComponent {
|
||||||
private static final Logger log = Logger.getLogger(MageBook.class);
|
private static final Logger log = Logger.getLogger(MageBook.class);
|
||||||
private Dimension cardDimension;
|
private Dimension cardDimension;
|
||||||
private java.util.List<String> setsToDisplay = new ArrayList<>();
|
private java.util.List<String> setsToDisplay = new ArrayList<>();
|
||||||
private java.util.List<HoverButton> tabs = new ArrayList<>();
|
private final java.util.List<HoverButton> tabs = new ArrayList<>();
|
||||||
private int selectedTab;
|
private int selectedTab;
|
||||||
|
|
||||||
private static final String CENTER_PANEL_IMAGE_PATH = "/book_bg.jpg";
|
private static final String CENTER_PANEL_IMAGE_PATH = "/book_bg.jpg";
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package mage.client.deckeditor.collection.viewer;
|
package mage.client.deckeditor.collection.viewer;
|
||||||
|
|
||||||
import javax.swing.JFrame;
|
import javax.swing.*;
|
||||||
|
|
||||||
import mage.cards.repository.CardScanner;
|
import mage.cards.repository.CardScanner;
|
||||||
import mage.client.plugins.impl.Plugins;
|
import mage.client.plugins.impl.Plugins;
|
||||||
import org.mage.card.arcane.ManaSymbols;
|
import org.mage.card.arcane.ManaSymbols;
|
||||||
|
@ -14,7 +15,7 @@ public class TestMageBook extends JFrame {
|
||||||
ManaSymbols.loadImages();
|
ManaSymbols.loadImages();
|
||||||
CardScanner.scan();
|
CardScanner.scan();
|
||||||
JFrame frame = new TestMageBook();
|
JFrame frame = new TestMageBook();
|
||||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||||
frame.add(new MageBook(null));
|
frame.add(new MageBook(null));
|
||||||
frame.pack();
|
frame.pack();
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
|
|
|
@ -36,7 +36,6 @@ import java.awt.event.MouseEvent;
|
||||||
import java.awt.event.MouseListener;
|
import java.awt.event.MouseListener;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -76,7 +75,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
||||||
|
|
||||||
private static final Logger log = Logger.getLogger(TableModel.class);
|
private static final Logger log = Logger.getLogger(TableModel.class);
|
||||||
|
|
||||||
protected CardEventSource cardEventSource = new CardEventSource();
|
protected final CardEventSource cardEventSource = new CardEventSource();
|
||||||
protected BigCard bigCard;
|
protected BigCard bigCard;
|
||||||
protected UUID gameId;
|
protected UUID gameId;
|
||||||
private final Map<UUID, CardView> cards = new LinkedHashMap<>();
|
private final Map<UUID, CardView> cards = new LinkedHashMap<>();
|
||||||
|
@ -437,7 +436,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
||||||
recentAscending = ascending;
|
recentAscending = ascending;
|
||||||
|
|
||||||
MageCardComparator sorter = new MageCardComparator(column, ascending);
|
MageCardComparator sorter = new MageCardComparator(column, ascending);
|
||||||
Collections.sort(view, sorter);
|
view.sort(sorter);
|
||||||
|
|
||||||
fireTableDataChanged();
|
fireTableDataChanged();
|
||||||
|
|
||||||
|
|
|
@ -77,11 +77,7 @@ public class AboutDialog extends MageDialog {
|
||||||
setTitle("About XMage");
|
setTitle("About XMage");
|
||||||
|
|
||||||
btnOk.setText("OK");
|
btnOk.setText("OK");
|
||||||
btnOk.addActionListener(new java.awt.event.ActionListener() {
|
btnOk.addActionListener(this::btnOkActionPerformed);
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnOkActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jLabel1.setText("XMage client");
|
jLabel1.setText("XMage client");
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ package mage.client.dialog;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.SortedSet;
|
import java.util.SortedSet;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
@ -73,7 +72,7 @@ public class AddLandDialog extends MageDialog {
|
||||||
public void showDialog(Deck deck, DeckEditorMode mode) {
|
public void showDialog(Deck deck, DeckEditorMode mode) {
|
||||||
this.deck = deck;
|
this.deck = deck;
|
||||||
SortedSet<String> landSetNames = new TreeSet<>();
|
SortedSet<String> landSetNames = new TreeSet<>();
|
||||||
if (!mode.equals(DeckEditorMode.FREE_BUILDING)) {
|
if (mode!=DeckEditorMode.FREE_BUILDING) {
|
||||||
// decide from which sets basic lands are taken from
|
// decide from which sets basic lands are taken from
|
||||||
for (String setCode : deck.getExpansionSetCodes()) {
|
for (String setCode : deck.getExpansionSetCodes()) {
|
||||||
ExpansionInfo expansionInfo = ExpansionRepository.instance.getSetByCode(setCode);
|
ExpansionInfo expansionInfo = ExpansionRepository.instance.getSetByCode(setCode);
|
||||||
|
@ -183,44 +182,32 @@ public class AddLandDialog extends MageDialog {
|
||||||
|
|
||||||
lblForest.setText("Forest");
|
lblForest.setText("Forest");
|
||||||
|
|
||||||
spnForest.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1)));
|
spnForest.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1));
|
||||||
|
|
||||||
lblIsland.setText("Island");
|
lblIsland.setText("Island");
|
||||||
|
|
||||||
spnIsland.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1)));
|
spnIsland.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1));
|
||||||
|
|
||||||
lblMountain.setText("Mountain");
|
lblMountain.setText("Mountain");
|
||||||
|
|
||||||
spnMountain.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1)));
|
spnMountain.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1));
|
||||||
|
|
||||||
lblPains.setText("Plains");
|
lblPains.setText("Plains");
|
||||||
|
|
||||||
spnPlains.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1)));
|
spnPlains.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1));
|
||||||
|
|
||||||
lblSwamp.setText("Swamp");
|
lblSwamp.setText("Swamp");
|
||||||
|
|
||||||
spnSwamp.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1)));
|
spnSwamp.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1));
|
||||||
|
|
||||||
btnAdd.setText("Add");
|
btnAdd.setText("Add");
|
||||||
btnAdd.addActionListener(new java.awt.event.ActionListener() {
|
btnAdd.addActionListener(evt -> btnAddActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnAddActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnCancel.setText("Cancel");
|
btnCancel.setText("Cancel");
|
||||||
btnCancel.addActionListener(new java.awt.event.ActionListener() {
|
btnCancel.addActionListener(evt -> btnCancelActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnCancelActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnAutoAdd.setText("Suggest");
|
btnAutoAdd.setText("Suggest");
|
||||||
btnAutoAdd.addActionListener(new java.awt.event.ActionListener() {
|
btnAutoAdd.addActionListener(evt -> btnAutoAddActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnAutoAddActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
|
|
|
@ -65,13 +65,13 @@ public class CardInfoWindowDialog extends MageDialog {
|
||||||
|
|
||||||
private static final Logger LOGGER = Logger.getLogger(CardInfoWindowDialog.class);
|
private static final Logger LOGGER = Logger.getLogger(CardInfoWindowDialog.class);
|
||||||
|
|
||||||
public static enum ShowType {
|
public enum ShowType {
|
||||||
REVEAL, REVEAL_TOP_LIBRARY, LOOKED_AT, EXILE, GRAVEYARD, OTHER
|
REVEAL, REVEAL_TOP_LIBRARY, LOOKED_AT, EXILE, GRAVEYARD, OTHER
|
||||||
};
|
}
|
||||||
|
|
||||||
private ShowType showType;
|
private final ShowType showType;
|
||||||
private boolean positioned;
|
private boolean positioned;
|
||||||
private String name;
|
private final String name;
|
||||||
|
|
||||||
public CardInfoWindowDialog(ShowType showType, String name) {
|
public CardInfoWindowDialog(ShowType showType, String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
@ -185,22 +185,19 @@ public class CardInfoWindowDialog extends MageDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showAndPositionWindow() {
|
private void showAndPositionWindow() {
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> {
|
||||||
@Override
|
int width = CardInfoWindowDialog.this.getWidth();
|
||||||
public void run() {
|
int height = CardInfoWindowDialog.this.getHeight();
|
||||||
int width = CardInfoWindowDialog.this.getWidth();
|
if (width > 0 && height > 0) {
|
||||||
int height = CardInfoWindowDialog.this.getHeight();
|
Point centered = SettingsManager.getInstance().getComponentPosition(width, height);
|
||||||
if (width > 0 && height > 0) {
|
if (!positioned) {
|
||||||
Point centered = SettingsManager.getInstance().getComponentPosition(width, height);
|
int xPos = centered.x / 2;
|
||||||
if (!positioned) {
|
int yPos = centered.y / 2;
|
||||||
int xPos = centered.x / 2;
|
CardInfoWindowDialog.this.setLocation(xPos, yPos);
|
||||||
int yPos = centered.y / 2;
|
show();
|
||||||
CardInfoWindowDialog.this.setLocation(xPos, yPos);
|
positioned = true;
|
||||||
show();
|
|
||||||
positioned = true;
|
|
||||||
}
|
|
||||||
GuiDisplayUtil.keepComponentInsideFrame(centered.x, centered.y, CardInfoWindowDialog.this);
|
|
||||||
}
|
}
|
||||||
|
GuiDisplayUtil.keepComponentInsideFrame(centered.x, centered.y, CardInfoWindowDialog.this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
package mage.client.dialog;
|
package mage.client.dialog;
|
||||||
|
|
||||||
import java.awt.Cursor;
|
import java.awt.Cursor;
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.BufferedWriter;
|
import java.io.BufferedWriter;
|
||||||
|
@ -78,15 +77,10 @@ public class ConnectDialog extends MageDialog {
|
||||||
private static final Logger logger = Logger.getLogger(ConnectDialog.class);
|
private static final Logger logger = Logger.getLogger(ConnectDialog.class);
|
||||||
private Connection connection;
|
private Connection connection;
|
||||||
private ConnectTask task;
|
private ConnectTask task;
|
||||||
private RegisterUserDialog registerUserDialog;
|
private final RegisterUserDialog registerUserDialog;
|
||||||
private ResetPasswordDialog resetPasswordDialog;
|
private final ResetPasswordDialog resetPasswordDialog;
|
||||||
|
|
||||||
private final ActionListener connectAction = new ActionListener() {
|
private final ActionListener connectAction = evt -> btnConnectActionPerformed(evt);
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent evt) {
|
|
||||||
btnConnectActionPerformed(evt);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new form ConnectDialog
|
* Creates new form ConnectDialog
|
||||||
|
@ -179,11 +173,7 @@ public class ConnectDialog extends MageDialog {
|
||||||
btnFind.setText("Find...");
|
btnFind.setText("Find...");
|
||||||
btnFind.setToolTipText("Shows the list of public servers");
|
btnFind.setToolTipText("Shows the list of public servers");
|
||||||
btnFind.setName("findServerBtn"); // NOI18N
|
btnFind.setName("findServerBtn"); // NOI18N
|
||||||
btnFind.addActionListener(new java.awt.event.ActionListener() {
|
btnFind.addActionListener(evt -> findPublicServerActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
findPublicServerActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lblPort.setLabelFor(txtPort);
|
lblPort.setLabelFor(txtPort);
|
||||||
lblPort.setText("Port:");
|
lblPort.setText("Port:");
|
||||||
|
@ -207,56 +197,28 @@ public class ConnectDialog extends MageDialog {
|
||||||
|
|
||||||
chkAutoConnect.setText("Automatically connect to this server next time");
|
chkAutoConnect.setText("Automatically connect to this server next time");
|
||||||
chkAutoConnect.setToolTipText("<HTML>If active this connect dialog will not be shown if you choose to connect.<br>\nInstead XMage tries to connect to the last server you were connected to.");
|
chkAutoConnect.setToolTipText("<HTML>If active this connect dialog will not be shown if you choose to connect.<br>\nInstead XMage tries to connect to the last server you were connected to.");
|
||||||
chkAutoConnect.addActionListener(new java.awt.event.ActionListener() {
|
chkAutoConnect.addActionListener(evt -> chkAutoConnectActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
chkAutoConnectActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
chkForceUpdateDB.setText("Force update of card database");
|
chkForceUpdateDB.setText("Force update of card database");
|
||||||
chkForceUpdateDB.setToolTipText("<HTML>If active the comparison of the server cards database to the client database will be enforced.<br>If not, the comparison will only done if the database version of the client is lower than the version of the server.");
|
chkForceUpdateDB.setToolTipText("<HTML>If active the comparison of the server cards database to the client database will be enforced.<br>If not, the comparison will only done if the database version of the client is lower than the version of the server.");
|
||||||
chkForceUpdateDB.addActionListener(new java.awt.event.ActionListener() {
|
chkForceUpdateDB.addActionListener(evt -> chkForceUpdateDBActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
chkForceUpdateDBActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jProxySettingsButton.setText("Proxy Settings...");
|
jProxySettingsButton.setText("Proxy Settings...");
|
||||||
jProxySettingsButton.addActionListener(new java.awt.event.ActionListener() {
|
jProxySettingsButton.addActionListener(evt -> jProxySettingsButtonActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
jProxySettingsButtonActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnConnect.setText("Connect");
|
btnConnect.setText("Connect");
|
||||||
btnConnect.addActionListener(new java.awt.event.ActionListener() {
|
btnConnect.addActionListener(evt -> btnConnectActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnConnectActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnCancel.setText("Cancel");
|
btnCancel.setText("Cancel");
|
||||||
btnCancel.addActionListener(new java.awt.event.ActionListener() {
|
btnCancel.addActionListener(evt -> btnCancelActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnCancelActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnRegister.setText("Register new user");
|
btnRegister.setText("Register new user");
|
||||||
btnRegister.setToolTipText("<html>XMage now supports user authentication.<br>Register your account before you log in.<html>");
|
btnRegister.setToolTipText("<html>XMage now supports user authentication.<br>Register your account before you log in.<html>");
|
||||||
btnRegister.addActionListener(new java.awt.event.ActionListener() {
|
btnRegister.addActionListener(evt -> btnRegisterActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnRegisterActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnForgotPassword.setText("Forgot password");
|
btnForgotPassword.setText("Forgot password");
|
||||||
btnForgotPassword.setToolTipText("<html>You can reset your password if you have registered<br>your account with an email address.</html>");
|
btnForgotPassword.setToolTipText("<html>You can reset your password if you have registered<br>your account with an email address.</html>");
|
||||||
btnForgotPassword.addActionListener(new java.awt.event.ActionListener() {
|
btnForgotPassword.addActionListener(evt -> btnForgotPasswordActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnForgotPasswordActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnFind1.setText("X");
|
btnFind1.setText("X");
|
||||||
btnFind1.setToolTipText("Connect to xmage.de");
|
btnFind1.setToolTipText("Connect to xmage.de");
|
||||||
|
@ -268,11 +230,7 @@ public class ConnectDialog extends MageDialog {
|
||||||
btnFind1.setMinimumSize(new java.awt.Dimension(42, 23));
|
btnFind1.setMinimumSize(new java.awt.Dimension(42, 23));
|
||||||
btnFind1.setName("connectXmageDeBtn"); // NOI18N
|
btnFind1.setName("connectXmageDeBtn"); // NOI18N
|
||||||
btnFind1.setPreferredSize(new java.awt.Dimension(23, 23));
|
btnFind1.setPreferredSize(new java.awt.Dimension(23, 23));
|
||||||
btnFind1.addActionListener(new java.awt.event.ActionListener() {
|
btnFind1.addActionListener(evt -> connectXmageDe(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
connectXmageDe(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnFind2.setText("L");
|
btnFind2.setText("L");
|
||||||
btnFind2.setToolTipText("Connect to localhost");
|
btnFind2.setToolTipText("Connect to localhost");
|
||||||
|
@ -282,11 +240,7 @@ public class ConnectDialog extends MageDialog {
|
||||||
btnFind2.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
|
btnFind2.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
|
||||||
btnFind2.setName("connectLocalhostBtn"); // NOI18N
|
btnFind2.setName("connectLocalhostBtn"); // NOI18N
|
||||||
btnFind2.setPreferredSize(new java.awt.Dimension(23, 23));
|
btnFind2.setPreferredSize(new java.awt.Dimension(23, 23));
|
||||||
btnFind2.addActionListener(new java.awt.event.ActionListener() {
|
btnFind2.addActionListener(evt -> connectLocalhost(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
connectLocalhost(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnFind3.setText("W");
|
btnFind3.setText("W");
|
||||||
btnFind3.setToolTipText("Connect to woogerworks");
|
btnFind3.setToolTipText("Connect to woogerworks");
|
||||||
|
@ -296,11 +250,7 @@ public class ConnectDialog extends MageDialog {
|
||||||
btnFind3.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
|
btnFind3.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);
|
||||||
btnFind3.setName("connectWoogerworksBtn"); // NOI18N
|
btnFind3.setName("connectWoogerworksBtn"); // NOI18N
|
||||||
btnFind3.setPreferredSize(new java.awt.Dimension(23, 23));
|
btnFind3.setPreferredSize(new java.awt.Dimension(23, 23));
|
||||||
btnFind3.addActionListener(new java.awt.event.ActionListener() {
|
btnFind3.addActionListener(evt -> connectWoogerworks(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
connectWoogerworks(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
|
|
|
@ -76,11 +76,7 @@ public class ErrorDialog extends MageDialog {
|
||||||
setTitle("Error");
|
setTitle("Error");
|
||||||
|
|
||||||
btnOK.setText("OK");
|
btnOK.setText("OK");
|
||||||
btnOK.addActionListener(new java.awt.event.ActionListener() {
|
btnOK.addActionListener(this::btnOKActionPerformed);
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnOKActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lblMessage.setColumns(20);
|
lblMessage.setColumns(20);
|
||||||
lblMessage.setEditable(false);
|
lblMessage.setEditable(false);
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
|
|
||||||
package mage.client.dialog;
|
package mage.client.dialog;
|
||||||
|
|
||||||
import mage.client.MageFrame;
|
|
||||||
import mage.client.SessionHandler;
|
import mage.client.SessionHandler;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
@ -43,7 +42,7 @@ public class FeedbackDialog extends javax.swing.JDialog {
|
||||||
|
|
||||||
private static final Logger log = Logger.getLogger(PreferencesDialog.class);
|
private static final Logger log = Logger.getLogger(PreferencesDialog.class);
|
||||||
|
|
||||||
private String[] feedbackTypes = {"", "Bug or \"something doesn't work\"",
|
private final String[] feedbackTypes = {"", "Bug or \"something doesn't work\"",
|
||||||
"Feature or \"I need that function\"",
|
"Feature or \"I need that function\"",
|
||||||
"Thank you or \"Devs, you are so cool!\"",
|
"Thank you or \"Devs, you are so cool!\"",
|
||||||
"Question or \"I'm so curious about\""};
|
"Question or \"I'm so curious about\""};
|
||||||
|
@ -186,18 +185,10 @@ public class FeedbackDialog extends javax.swing.JDialog {
|
||||||
jTabbedPane1.addTab("Give feedback", jPanel6);
|
jTabbedPane1.addTab("Give feedback", jPanel6);
|
||||||
|
|
||||||
sendButton.setText("Send");
|
sendButton.setText("Send");
|
||||||
sendButton.addActionListener(new java.awt.event.ActionListener() {
|
sendButton.addActionListener(evt -> sendButtonActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
sendButtonActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
cancelButton.setText("Cancel");
|
cancelButton.setText("Cancel");
|
||||||
cancelButton.addActionListener(new java.awt.event.ActionListener() {
|
cancelButton.addActionListener(evt -> cancelButtonActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cancelButtonActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
|
@ -294,14 +285,12 @@ public class FeedbackDialog extends javax.swing.JDialog {
|
||||||
* @param args the command line arguments
|
* @param args the command line arguments
|
||||||
*/
|
*/
|
||||||
public static void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
java.awt.EventQueue.invokeLater(() -> {
|
||||||
public void run() {
|
if (!dialog.isVisible()) {
|
||||||
if (!dialog.isVisible()) {
|
dialog.setLocation(300, 200);
|
||||||
dialog.setLocation(300, 200);
|
dialog.setVisible(true);
|
||||||
dialog.setVisible(true);
|
} else {
|
||||||
} else {
|
dialog.requestFocus();
|
||||||
dialog.requestFocus();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ import mage.view.PlayerView;
|
||||||
*/
|
*/
|
||||||
public class GameEndDialog extends MageDialog {
|
public class GameEndDialog extends MageDialog {
|
||||||
|
|
||||||
private final DateFormat df = DateFormat.getDateTimeInstance();;
|
private final DateFormat df = DateFormat.getDateTimeInstance();
|
||||||
|
|
||||||
|
|
||||||
/** Creates new form GameEndDialog
|
/** Creates new form GameEndDialog
|
||||||
|
@ -290,11 +290,7 @@ public class GameEndDialog extends MageDialog {
|
||||||
tabPane.addTab("Statistics", tabStatistics);
|
tabPane.addTab("Statistics", tabStatistics);
|
||||||
|
|
||||||
btnOk.setText("OK");
|
btnOk.setText("OK");
|
||||||
btnOk.addActionListener(new java.awt.event.ActionListener() {
|
btnOk.addActionListener(evt -> btnOkActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnOkActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
|
|
|
@ -85,18 +85,10 @@ public class JoinTableDialog extends MageDialog {
|
||||||
setTitle("Join Table");
|
setTitle("Join Table");
|
||||||
|
|
||||||
btnCancel.setText("Cancel");
|
btnCancel.setText("Cancel");
|
||||||
btnCancel.addActionListener(new java.awt.event.ActionListener() {
|
btnCancel.addActionListener(evt -> btnCancelActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnCancelActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnOK.setText("OK");
|
btnOK.setText("OK");
|
||||||
btnOK.addActionListener(new java.awt.event.ActionListener() {
|
btnOK.addActionListener(evt -> btnOKActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnOKActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lblPassword.setText("Password:");
|
lblPassword.setText("Password:");
|
||||||
|
|
||||||
|
|
|
@ -97,12 +97,7 @@ public class MageDialog extends javax.swing.JInternalFrame {
|
||||||
stopModal();
|
stopModal();
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
SwingUtilities.invokeAndWait(new Runnable() {
|
SwingUtilities.invokeAndWait(() -> stopModal());
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
stopModal();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (InterruptedException ex) {
|
} catch (InterruptedException ex) {
|
||||||
LOGGER.fatal("MageDialog error", ex);
|
LOGGER.fatal("MageDialog error", ex);
|
||||||
} catch (InvocationTargetException ex) {
|
} catch (InvocationTargetException ex) {
|
||||||
|
|
|
@ -32,7 +32,6 @@ import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
|
@ -145,11 +144,7 @@ public class NewTableDialog extends MageDialog {
|
||||||
|
|
||||||
lblGameType.setText("Game Type:");
|
lblGameType.setText("Game Type:");
|
||||||
|
|
||||||
cbGameType.addActionListener(new java.awt.event.ActionListener() {
|
cbGameType.addActionListener(evt -> cbGameTypeActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbGameTypeActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
chkRollbackTurnsAllowed.setText("Allow rollbacks");
|
chkRollbackTurnsAllowed.setText("Allow rollbacks");
|
||||||
chkRollbackTurnsAllowed.setToolTipText("<HTML>Allow to rollback to the start of previous turns<br>\nif all players agree.\n");
|
chkRollbackTurnsAllowed.setToolTipText("<HTML>Allow to rollback to the start of previous turns<br>\nif all players agree.\n");
|
||||||
|
@ -163,11 +158,7 @@ public class NewTableDialog extends MageDialog {
|
||||||
lblNumPlayers.setLabelFor(spnNumPlayers);
|
lblNumPlayers.setLabelFor(spnNumPlayers);
|
||||||
lblNumPlayers.setText("Players");
|
lblNumPlayers.setText("Players");
|
||||||
|
|
||||||
spnNumPlayers.addChangeListener(new javax.swing.event.ChangeListener() {
|
spnNumPlayers.addChangeListener(evt -> numPlayersChanged(evt));
|
||||||
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
|
||||||
numPlayersChanged(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lblRange.setLabelFor(cbRange);
|
lblRange.setLabelFor(cbRange);
|
||||||
lblRange.setText("Range of Influence");
|
lblRange.setText("Range of Influence");
|
||||||
|
@ -188,11 +179,7 @@ public class NewTableDialog extends MageDialog {
|
||||||
lblNumWins.setText("Wins");
|
lblNumWins.setText("Wins");
|
||||||
lblNumWins.setToolTipText("How many games has a player to win to win the match.");
|
lblNumWins.setToolTipText("How many games has a player to win to win the match.");
|
||||||
|
|
||||||
spnNumWins.addChangeListener(new javax.swing.event.ChangeListener() {
|
spnNumWins.addChangeListener(evt -> spnNumWinsnumPlayersChanged(evt));
|
||||||
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
|
||||||
spnNumWinsnumPlayersChanged(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||||
jLabel1.setText("Player 1 (You)");
|
jLabel1.setText("Player 1 (You)");
|
||||||
|
@ -203,18 +190,10 @@ public class NewTableDialog extends MageDialog {
|
||||||
pnlOtherPlayers.setLayout(new java.awt.GridLayout(0, 1));
|
pnlOtherPlayers.setLayout(new java.awt.GridLayout(0, 1));
|
||||||
|
|
||||||
btnOK.setText("OK");
|
btnOK.setText("OK");
|
||||||
btnOK.addActionListener(new java.awt.event.ActionListener() {
|
btnOK.addActionListener(evt -> btnOKActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnOKActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnCancel.setText("Cancel");
|
btnCancel.setText("Cancel");
|
||||||
btnCancel.addActionListener(new java.awt.event.ActionListener() {
|
btnCancel.addActionListener(evt -> btnCancelActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnCancelActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lblQuitRatio.setText("Allowed quit %");
|
lblQuitRatio.setText("Allowed quit %");
|
||||||
lblEdhPowerLevel.setText("EDH power level");
|
lblEdhPowerLevel.setText("EDH power level");
|
||||||
|
@ -534,12 +513,7 @@ public class NewTableDialog extends MageDialog {
|
||||||
playerPanel.init(players.size() + 2, playerType);
|
playerPanel.init(players.size() + 2, playerType);
|
||||||
players.add(playerPanel);
|
players.add(playerPanel);
|
||||||
playerPanel.addPlayerTypeEventListener(
|
playerPanel.addPlayerTypeEventListener(
|
||||||
new Listener<Event>() {
|
(Listener<Event>) event -> drawPlayers()
|
||||||
@Override
|
|
||||||
public void event(Event event) {
|
|
||||||
drawPlayers();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -697,12 +671,11 @@ public class NewTableDialog extends MageDialog {
|
||||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_SKILL_LEVEL, options.getSkillLevel().toString());
|
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_SKILL_LEVEL, options.getSkillLevel().toString());
|
||||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_QUIT_RATIO, Integer.toString(options.getQuitRatio()));
|
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_QUIT_RATIO, Integer.toString(options.getQuitRatio()));
|
||||||
StringBuilder playerTypesString = new StringBuilder();
|
StringBuilder playerTypesString = new StringBuilder();
|
||||||
ListIterator iterator = players.listIterator();
|
for (Object player : players) {
|
||||||
while (iterator.hasNext()) {
|
|
||||||
if (playerTypesString.length() > 0) {
|
if (playerTypesString.length() > 0) {
|
||||||
playerTypesString.append(",");
|
playerTypesString.append(",");
|
||||||
}
|
}
|
||||||
TablePlayerPanel tpp = (TablePlayerPanel) iterator.next();
|
TablePlayerPanel tpp = (TablePlayerPanel) player;
|
||||||
playerTypesString.append(tpp.getPlayerType());
|
playerTypesString.append(tpp.getPlayerType());
|
||||||
}
|
}
|
||||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_PLAYER_TYPES, playerTypesString.toString());
|
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TABLE_PLAYER_TYPES, playerTypesString.toString());
|
||||||
|
|
|
@ -65,7 +65,6 @@ import mage.game.draft.DraftOptions;
|
||||||
import mage.game.draft.DraftOptions.TimingOption;
|
import mage.game.draft.DraftOptions.TimingOption;
|
||||||
import mage.game.tournament.LimitedOptions;
|
import mage.game.tournament.LimitedOptions;
|
||||||
import mage.game.tournament.TournamentOptions;
|
import mage.game.tournament.TournamentOptions;
|
||||||
import mage.remote.Session;
|
|
||||||
import mage.view.GameTypeView;
|
import mage.view.GameTypeView;
|
||||||
import mage.view.TableView;
|
import mage.view.TableView;
|
||||||
import mage.view.TournamentTypeView;
|
import mage.view.TournamentTypeView;
|
||||||
|
@ -215,11 +214,7 @@ public class NewTournamentDialog extends MageDialog {
|
||||||
lblTournamentType.setText("Tournament Type:");
|
lblTournamentType.setText("Tournament Type:");
|
||||||
|
|
||||||
cbTournamentType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
cbTournamentType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||||
cbTournamentType.addActionListener(new java.awt.event.ActionListener() {
|
cbTournamentType.addActionListener(evt -> cbTournamentTypeActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbTournamentTypeActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lbDeckType.setText("Deck Type:");
|
lbDeckType.setText("Deck Type:");
|
||||||
lbDeckType.setFocusable(false);
|
lbDeckType.setFocusable(false);
|
||||||
|
@ -227,11 +222,7 @@ public class NewTournamentDialog extends MageDialog {
|
||||||
lblGameType.setText("Game Type:");
|
lblGameType.setText("Game Type:");
|
||||||
lblGameType.setFocusable(false);
|
lblGameType.setFocusable(false);
|
||||||
|
|
||||||
cbGameType.addActionListener(new java.awt.event.ActionListener() {
|
cbGameType.addActionListener(evt -> cbGameTypeActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbGameTypeActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lblFreeMulligans.setText("Free Mulligans:");
|
lblFreeMulligans.setText("Free Mulligans:");
|
||||||
|
|
||||||
|
@ -240,30 +231,18 @@ public class NewTournamentDialog extends MageDialog {
|
||||||
lblNumWins.setText("Wins:");
|
lblNumWins.setText("Wins:");
|
||||||
|
|
||||||
spnNumWins.setToolTipText("To win a match a player has to win this number of games.");
|
spnNumWins.setToolTipText("To win a match a player has to win this number of games.");
|
||||||
spnNumWins.addChangeListener(new javax.swing.event.ChangeListener() {
|
spnNumWins.addChangeListener(evt -> spnNumWinsnumPlayersChanged(evt));
|
||||||
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
|
||||||
spnNumWinsnumPlayersChanged(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lblDraftCube.setText("Draft Cube:");
|
lblDraftCube.setText("Draft Cube:");
|
||||||
|
|
||||||
cbDraftCube.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
cbDraftCube.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||||
cbDraftCube.addActionListener(new java.awt.event.ActionListener() {
|
cbDraftCube.addActionListener(evt -> cbDraftCubeActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbDraftCubeActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lblNumRounds.setText("Number of Swiss Rounds:");
|
lblNumRounds.setText("Number of Swiss Rounds:");
|
||||||
lblNumRounds.setToolTipText("<html>The number of rounds the swiss tournament has in total.<br>\nThe tournaments ends after that number of rounds or<br> \nif there are less than two players left in the tournament.");
|
lblNumRounds.setToolTipText("<html>The number of rounds the swiss tournament has in total.<br>\nThe tournaments ends after that number of rounds or<br> \nif there are less than two players left in the tournament.");
|
||||||
|
|
||||||
spnNumRounds.setToolTipText("<html>The number of rounds the swiss tournament has in total.<br>\nThe tournaments ends after that number of rounds or<br> \nif there are less than two players left in the tournament.");
|
spnNumRounds.setToolTipText("<html>The number of rounds the swiss tournament has in total.<br>\nThe tournaments ends after that number of rounds or<br> \nif there are less than two players left in the tournament.");
|
||||||
spnNumRounds.addChangeListener(new javax.swing.event.ChangeListener() {
|
spnNumRounds.addChangeListener(evt -> spnNumRoundsnumPlayersChanged(evt));
|
||||||
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
|
||||||
spnNumRoundsnumPlayersChanged(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lblPacks.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
lblPacks.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||||
lblPacks.setText("Packs");
|
lblPacks.setText("Packs");
|
||||||
|
@ -273,28 +252,16 @@ public class NewTournamentDialog extends MageDialog {
|
||||||
|
|
||||||
lblNbrPlayers.setText("Players:");
|
lblNbrPlayers.setText("Players:");
|
||||||
|
|
||||||
spnNumPlayers.addChangeListener(new javax.swing.event.ChangeListener() {
|
spnNumPlayers.addChangeListener(evt -> spnNumPlayersStateChanged(evt));
|
||||||
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
|
||||||
spnNumPlayersStateChanged(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lblNbrSeats.setText("Seats:");
|
lblNbrSeats.setText("Seats:");
|
||||||
|
|
||||||
spnNumSeats.addChangeListener(new javax.swing.event.ChangeListener() {
|
spnNumSeats.addChangeListener(evt -> spnNumSeatsStateChanged(evt));
|
||||||
public void stateChanged(javax.swing.event.ChangeEvent evt) {
|
|
||||||
spnNumSeatsStateChanged(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jLabel6.setText("Timing:");
|
jLabel6.setText("Timing:");
|
||||||
|
|
||||||
cbDraftTiming.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
cbDraftTiming.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||||
cbDraftTiming.addActionListener(new java.awt.event.ActionListener() {
|
cbDraftTiming.addActionListener(evt -> cbDraftTimingActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbDraftTimingActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
javax.swing.GroupLayout pnlDraftOptionsLayout = new javax.swing.GroupLayout(pnlDraftOptions);
|
javax.swing.GroupLayout pnlDraftOptionsLayout = new javax.swing.GroupLayout(pnlDraftOptions);
|
||||||
pnlDraftOptions.setLayout(pnlDraftOptionsLayout);
|
pnlDraftOptions.setLayout(pnlDraftOptionsLayout);
|
||||||
|
@ -348,18 +315,10 @@ public class NewTournamentDialog extends MageDialog {
|
||||||
);
|
);
|
||||||
|
|
||||||
btnOk.setText("OK");
|
btnOk.setText("OK");
|
||||||
btnOk.addActionListener(new java.awt.event.ActionListener() {
|
btnOk.addActionListener(evt -> btnOkActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnOkActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnCancel.setText("Cancel");
|
btnCancel.setText("Cancel");
|
||||||
btnCancel.addActionListener(new java.awt.event.ActionListener() {
|
btnCancel.addActionListener(evt -> btnCancelActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnCancelActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
pnlRandomPacks.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
pnlRandomPacks.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||||
pnlRandomPacks.setToolTipText("");
|
pnlRandomPacks.setToolTipText("");
|
||||||
|
@ -887,13 +846,7 @@ public class NewTournamentDialog extends MageDialog {
|
||||||
btnSelectRandomPacks.setAlignmentX(Component.LEFT_ALIGNMENT);
|
btnSelectRandomPacks.setAlignmentX(Component.LEFT_ALIGNMENT);
|
||||||
btnSelectRandomPacks.setText("Select packs to be included in the pool");
|
btnSelectRandomPacks.setText("Select packs to be included in the pool");
|
||||||
btnSelectRandomPacks.setToolTipText(RandomPacksSelectorDialog.randomDraftDescription);
|
btnSelectRandomPacks.setToolTipText(RandomPacksSelectorDialog.randomDraftDescription);
|
||||||
btnSelectRandomPacks.addActionListener(new java.awt.event.ActionListener() {
|
btnSelectRandomPacks.addActionListener(evt -> showRandomPackSelectorDialog());
|
||||||
@Override
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
showRandomPackSelectorDialog();
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
pnlRandomPacks.add(btnSelectRandomPacks);
|
pnlRandomPacks.add(btnSelectRandomPacks);
|
||||||
}
|
}
|
||||||
this.pack();
|
this.pack();
|
||||||
|
@ -925,12 +878,7 @@ public class NewTournamentDialog extends MageDialog {
|
||||||
pack.setModel(new DefaultComboBoxModel(ExpansionRepository.instance.getWithBoostersSortedByReleaseDate()));
|
pack.setModel(new DefaultComboBoxModel(ExpansionRepository.instance.getWithBoostersSortedByReleaseDate()));
|
||||||
pnlPacks.add(pack);
|
pnlPacks.add(pack);
|
||||||
packs.add(pack);
|
packs.add(pack);
|
||||||
pack.addActionListener(new java.awt.event.ActionListener() {
|
pack.addActionListener(evt -> packActionPerformed(evt));
|
||||||
@Override
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
packActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
this.pack();
|
this.pack();
|
||||||
this.revalidate();
|
this.revalidate();
|
||||||
|
@ -980,12 +928,9 @@ public class NewTournamentDialog extends MageDialog {
|
||||||
this.pnlOtherPlayers.removeAll();
|
this.pnlOtherPlayers.removeAll();
|
||||||
for (TournamentPlayerPanel panel: players) {
|
for (TournamentPlayerPanel panel: players) {
|
||||||
this.pnlOtherPlayers.add(panel);
|
this.pnlOtherPlayers.add(panel);
|
||||||
panel.getPlayerType().addActionListener(new java.awt.event.ActionListener() {
|
panel.getPlayerType().addActionListener(evt -> {
|
||||||
@Override
|
if (!automaticChange) {
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
playerActionPerformed(evt);
|
||||||
if (!automaticChange) {
|
|
||||||
playerActionPerformed(evt);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,28 +134,16 @@ public class PickChoiceDialog extends MageDialog {
|
||||||
|
|
||||||
btnAutoSelect.setText("Auto select");
|
btnAutoSelect.setText("Auto select");
|
||||||
btnAutoSelect.setToolTipText("If you select an effect with \"Auto select\", this effect will be selected the next time automatically first.");
|
btnAutoSelect.setToolTipText("If you select an effect with \"Auto select\", this effect will be selected the next time automatically first.");
|
||||||
btnAutoSelect.addActionListener(new java.awt.event.ActionListener() {
|
btnAutoSelect.addActionListener(evt -> btnAutoSelectActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnAutoSelectActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnCancel.setText("Cancel");
|
btnCancel.setText("Cancel");
|
||||||
btnCancel.addActionListener(new java.awt.event.ActionListener() {
|
btnCancel.addActionListener(evt -> btnCancelActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnCancelActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnOk.setText("OK");
|
btnOk.setText("OK");
|
||||||
btnOk.addActionListener(new java.awt.event.ActionListener() {
|
btnOk.addActionListener(evt -> btnOkActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnOkActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lstChoices.setModel(new javax.swing.AbstractListModel() {
|
lstChoices.setModel(new javax.swing.AbstractListModel() {
|
||||||
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
|
final String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
|
||||||
public int getSize() { return strings.length; }
|
public int getSize() { return strings.length; }
|
||||||
public Object getElementAt(int i) { return strings[i]; }
|
public Object getElementAt(int i) { return strings[i]; }
|
||||||
});
|
});
|
||||||
|
|
|
@ -90,21 +90,13 @@ public class PickNumberDialog extends MageDialog {
|
||||||
jScrollPane1 = new javax.swing.JScrollPane();
|
jScrollPane1 = new javax.swing.JScrollPane();
|
||||||
lblMessage = new javax.swing.JTextPane();
|
lblMessage = new javax.swing.JTextPane();
|
||||||
|
|
||||||
spnAmount.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(1), null, null, Integer.valueOf(1)));
|
spnAmount.setModel(new javax.swing.SpinnerNumberModel(1, null, null, 1));
|
||||||
|
|
||||||
btnCancel.setText("Cancel");
|
btnCancel.setText("Cancel");
|
||||||
btnCancel.addActionListener(new java.awt.event.ActionListener() {
|
btnCancel.addActionListener(evt -> btnCancelActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnCancelActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnOk.setText("OK");
|
btnOk.setText("OK");
|
||||||
btnOk.addActionListener(new java.awt.event.ActionListener() {
|
btnOk.addActionListener(evt -> btnOkActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnOkActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,6 @@ package mage.client.dialog;
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import javax.swing.JLayeredPane;
|
import javax.swing.JLayeredPane;
|
||||||
|
@ -69,12 +67,7 @@ public class PickPileDialog extends MageDialog {
|
||||||
panel.add(pile1, BorderLayout.CENTER);
|
panel.add(pile1, BorderLayout.CENTER);
|
||||||
|
|
||||||
JButton btnChoosePile1 = new JButton("Pile 1");
|
JButton btnChoosePile1 = new JButton("Pile 1");
|
||||||
btnChoosePile1.addActionListener(new ActionListener() {
|
btnChoosePile1.addActionListener(e -> btnPile1ActionPerformed(e));
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
btnPile1ActionPerformed(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
panel.add(btnChoosePile1, BorderLayout.NORTH);
|
panel.add(btnChoosePile1, BorderLayout.NORTH);
|
||||||
|
|
||||||
JPanel panel_1 = new JPanel();
|
JPanel panel_1 = new JPanel();
|
||||||
|
@ -85,12 +78,7 @@ public class PickPileDialog extends MageDialog {
|
||||||
panel_1.add(pile2, BorderLayout.CENTER);
|
panel_1.add(pile2, BorderLayout.CENTER);
|
||||||
|
|
||||||
JButton btnChoosePile2 = new JButton("Pile 2");
|
JButton btnChoosePile2 = new JButton("Pile 2");
|
||||||
btnChoosePile2.addActionListener(new ActionListener() {
|
btnChoosePile2.addActionListener(e -> btnPile2ActionPerformed(e));
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
btnPile2ActionPerformed(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
panel_1.add(btnChoosePile2, BorderLayout.NORTH);
|
panel_1.add(btnChoosePile2, BorderLayout.NORTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -320,8 +320,8 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
public static final String OPEN_CONNECTION_TAB = "Open-Connection-Tab";
|
public static final String OPEN_CONNECTION_TAB = "Open-Connection-Tab";
|
||||||
public static final String OPEN_PHASES_TAB = "Open-Phases-Tab";
|
public static final String OPEN_PHASES_TAB = "Open-Phases-Tab";
|
||||||
|
|
||||||
public static String PHASE_ON = "on";
|
public static final String PHASE_ON = "on";
|
||||||
public static String PHASE_OFF = "off";
|
public static final String PHASE_OFF = "off";
|
||||||
|
|
||||||
private static final Map<Integer, JPanel> PANELS = new HashMap<>();
|
private static final Map<Integer, JPanel> PANELS = new HashMap<>();
|
||||||
|
|
||||||
|
@ -590,11 +590,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
showCardName.setToolTipText("Write the card's name on the card to make the card name more recognizable.");
|
showCardName.setToolTipText("Write the card's name on the card to make the card name more recognizable.");
|
||||||
showCardName.setActionCommand("");
|
showCardName.setActionCommand("");
|
||||||
showCardName.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
|
showCardName.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
|
||||||
showCardName.addActionListener(new java.awt.event.ActionListener() {
|
showCardName.addActionListener(evt -> showCardNameActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
showCardNameActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
tooltipDelayLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
tooltipDelayLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
||||||
tooltipDelayLabel.setText("Delay in milliseconds for showing the card tooltip text");
|
tooltipDelayLabel.setText("Delay in milliseconds for showing the card tooltip text");
|
||||||
|
@ -636,71 +632,43 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
nonLandPermanentsInOnePile.setSelected(true);
|
nonLandPermanentsInOnePile.setSelected(true);
|
||||||
nonLandPermanentsInOnePile.setText("Put non-land permanents in same row as creatures");
|
nonLandPermanentsInOnePile.setText("Put non-land permanents in same row as creatures");
|
||||||
nonLandPermanentsInOnePile.setToolTipText("<html>If activated, all non land permanents are shown in one row.<br>\nFirst creatures than other permanents. If not activated, creatures are<br>\nshown in a separate row.");
|
nonLandPermanentsInOnePile.setToolTipText("<html>If activated, all non land permanents are shown in one row.<br>\nFirst creatures than other permanents. If not activated, creatures are<br>\nshown in a separate row.");
|
||||||
nonLandPermanentsInOnePile.addActionListener(new java.awt.event.ActionListener() {
|
nonLandPermanentsInOnePile.addActionListener(evt -> nonLandPermanentsInOnePileActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
nonLandPermanentsInOnePileActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
showPlayerNamesPermanently.setSelected(true);
|
showPlayerNamesPermanently.setSelected(true);
|
||||||
showPlayerNamesPermanently.setText("Show player names on avatar permanently");
|
showPlayerNamesPermanently.setText("Show player names on avatar permanently");
|
||||||
showPlayerNamesPermanently.setToolTipText("Instead showing the names only if you hover over the avatar with the mouse, the name is shown all the time.");
|
showPlayerNamesPermanently.setToolTipText("Instead showing the names only if you hover over the avatar with the mouse, the name is shown all the time.");
|
||||||
showPlayerNamesPermanently.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
showPlayerNamesPermanently.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
||||||
showPlayerNamesPermanently.addActionListener(new java.awt.event.ActionListener() {
|
showPlayerNamesPermanently.addActionListener(evt -> showPlayerNamesPermanentlyActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
showPlayerNamesPermanentlyActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
showAbilityPickerForced.setSelected(true);
|
showAbilityPickerForced.setSelected(true);
|
||||||
showAbilityPickerForced.setText("Show ability picker for abilities or spells without costs");
|
showAbilityPickerForced.setText("Show ability picker for abilities or spells without costs");
|
||||||
showAbilityPickerForced.setToolTipText("This prevents you from accidently activating abilities without other costs than tapping or casting spells with 0 mana costs.");
|
showAbilityPickerForced.setToolTipText("This prevents you from accidently activating abilities without other costs than tapping or casting spells with 0 mana costs.");
|
||||||
showAbilityPickerForced.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
showAbilityPickerForced.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
||||||
showAbilityPickerForced.addActionListener(new java.awt.event.ActionListener() {
|
showAbilityPickerForced.addActionListener(evt -> showAbilityPickerForcedActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
showAbilityPickerForcedActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
cbAllowRequestToShowHandCards.setSelected(true);
|
cbAllowRequestToShowHandCards.setSelected(true);
|
||||||
cbAllowRequestToShowHandCards.setText("Allow requests from players and spectators to show your hand cards");
|
cbAllowRequestToShowHandCards.setText("Allow requests from players and spectators to show your hand cards");
|
||||||
cbAllowRequestToShowHandCards.setToolTipText("<html>This is the default setting used for your matches. If activated other players or spectators<br>\nof your match can send a request so you can allow them to see your hand cards.");
|
cbAllowRequestToShowHandCards.setToolTipText("<html>This is the default setting used for your matches. If activated other players or spectators<br>\nof your match can send a request so you can allow them to see your hand cards.");
|
||||||
cbAllowRequestToShowHandCards.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
cbAllowRequestToShowHandCards.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
||||||
cbAllowRequestToShowHandCards.addActionListener(new java.awt.event.ActionListener() {
|
cbAllowRequestToShowHandCards.addActionListener(evt -> cbAllowRequestToShowHandCardsActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbAllowRequestToShowHandCardsActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
cbShowStormCounter.setSelected(true);
|
cbShowStormCounter.setSelected(true);
|
||||||
cbShowStormCounter.setText("Show the number of spell casts during the current turn");
|
cbShowStormCounter.setText("Show the number of spell casts during the current turn");
|
||||||
cbShowStormCounter.setToolTipText("<html>Adds a little box left to the short keys line with the number<br>\nof spells already cast during the current turn (storm counter).");
|
cbShowStormCounter.setToolTipText("<html>Adds a little box left to the short keys line with the number<br>\nof spells already cast during the current turn (storm counter).");
|
||||||
cbShowStormCounter.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
cbShowStormCounter.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
||||||
cbShowStormCounter.addActionListener(new java.awt.event.ActionListener() {
|
cbShowStormCounter.addActionListener(evt -> cbShowStormCounterActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbShowStormCounterActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
cbConfirmEmptyManaPool.setSelected(true);
|
cbConfirmEmptyManaPool.setSelected(true);
|
||||||
cbConfirmEmptyManaPool.setText("Confirm if you want to pass a phase/step but there is still mana in your mana pool");
|
cbConfirmEmptyManaPool.setText("Confirm if you want to pass a phase/step but there is still mana in your mana pool");
|
||||||
cbConfirmEmptyManaPool.setToolTipText("<html>If activated you get a confirm message if you pass priority while stack is empty<br>\n and you still have mana in your mana pool.");
|
cbConfirmEmptyManaPool.setToolTipText("<html>If activated you get a confirm message if you pass priority while stack is empty<br>\n and you still have mana in your mana pool.");
|
||||||
cbConfirmEmptyManaPool.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
cbConfirmEmptyManaPool.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
||||||
cbConfirmEmptyManaPool.addActionListener(new java.awt.event.ActionListener() {
|
cbConfirmEmptyManaPool.addActionListener(evt -> cbConfirmEmptyManaPoolActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbConfirmEmptyManaPoolActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
cbAskMoveToGraveOrder.setSelected(true);
|
cbAskMoveToGraveOrder.setSelected(true);
|
||||||
cbAskMoveToGraveOrder.setText("Ask player for setting order cards go to graveyard");
|
cbAskMoveToGraveOrder.setText("Ask player for setting order cards go to graveyard");
|
||||||
cbAskMoveToGraveOrder.setToolTipText("<html>If activated and multiple cards go to the graveyard at the same time<br>\nthe player is asked to set the order of the cards.");
|
cbAskMoveToGraveOrder.setToolTipText("<html>If activated and multiple cards go to the graveyard at the same time<br>\nthe player is asked to set the order of the cards.");
|
||||||
cbAskMoveToGraveOrder.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
cbAskMoveToGraveOrder.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
||||||
cbAskMoveToGraveOrder.addActionListener(new java.awt.event.ActionListener() {
|
cbAskMoveToGraveOrder.addActionListener(evt -> cbAskMoveToGraveOrderActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbAskMoveToGraveOrderActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
org.jdesktop.layout.GroupLayout main_gameLayout = new org.jdesktop.layout.GroupLayout(main_game);
|
org.jdesktop.layout.GroupLayout main_gameLayout = new org.jdesktop.layout.GroupLayout(main_game);
|
||||||
main_game.setLayout(main_gameLayout);
|
main_game.setLayout(main_gameLayout);
|
||||||
|
@ -744,20 +712,12 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
cbGameLogAutoSave.setSelected(true);
|
cbGameLogAutoSave.setSelected(true);
|
||||||
cbGameLogAutoSave.setText("Auto save game logs (to \"../Mage.Client/gamelogs/\" directory)");
|
cbGameLogAutoSave.setText("Auto save game logs (to \"../Mage.Client/gamelogs/\" directory)");
|
||||||
cbGameLogAutoSave.setToolTipText("The logs of all your games will be saved to the mentioned folder if this option is switched on.");
|
cbGameLogAutoSave.setToolTipText("The logs of all your games will be saved to the mentioned folder if this option is switched on.");
|
||||||
cbGameLogAutoSave.addActionListener(new java.awt.event.ActionListener() {
|
cbGameLogAutoSave.addActionListener(evt -> cbGameLogAutoSaveActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbGameLogAutoSaveActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
cbDraftLogAutoSave.setSelected(true);
|
cbDraftLogAutoSave.setSelected(true);
|
||||||
cbDraftLogAutoSave.setText("Auto save draft logs (to \"../Mage.Client/gamelogs/\" directory)");
|
cbDraftLogAutoSave.setText("Auto save draft logs (to \"../Mage.Client/gamelogs/\" directory)");
|
||||||
cbDraftLogAutoSave.setToolTipText("The logs of all your games will be saved to the mentioned folder if this option is switched on.");
|
cbDraftLogAutoSave.setToolTipText("The logs of all your games will be saved to the mentioned folder if this option is switched on.");
|
||||||
cbDraftLogAutoSave.addActionListener(new java.awt.event.ActionListener() {
|
cbDraftLogAutoSave.addActionListener(evt -> cbDraftLogAutoSaveActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbDraftLogAutoSaveActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
org.jdesktop.layout.GroupLayout main_gamelogLayout = new org.jdesktop.layout.GroupLayout(main_gamelog);
|
org.jdesktop.layout.GroupLayout main_gamelogLayout = new org.jdesktop.layout.GroupLayout(main_gamelog);
|
||||||
main_gamelog.setLayout(main_gamelogLayout);
|
main_gamelog.setLayout(main_gamelogLayout);
|
||||||
|
@ -1258,75 +1218,47 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
cbStopAttack.setText("Stop on declare attackers step if you skip steps (F4/F5/F7) and attackers are available");
|
cbStopAttack.setText("Stop on declare attackers step if you skip steps (F4/F5/F7) and attackers are available");
|
||||||
cbStopAttack.setToolTipText("If you use F4, F5 or F7 to skip steps, you stop on declare attackers step if attackers are available. If this option is not activated, you also skip the declare attackers step with this actions. F9 does always skip the declare attackers step.");
|
cbStopAttack.setToolTipText("If you use F4, F5 or F7 to skip steps, you stop on declare attackers step if attackers are available. If this option is not activated, you also skip the declare attackers step with this actions. F9 does always skip the declare attackers step.");
|
||||||
cbStopAttack.setActionCommand("");
|
cbStopAttack.setActionCommand("");
|
||||||
cbStopAttack.addActionListener(new java.awt.event.ActionListener() {
|
cbStopAttack.addActionListener(evt -> cbStopAttackActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbStopAttackActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
phases_stopSettings.add(cbStopAttack);
|
phases_stopSettings.add(cbStopAttack);
|
||||||
|
|
||||||
cbStopBlock.setText("Stop on your declare blockers step also if no blockers available");
|
cbStopBlock.setText("Stop on your declare blockers step also if no blockers available");
|
||||||
cbStopBlock.setToolTipText("Also if you have no blockers to declare, the game stops at the declare blockers step.");
|
cbStopBlock.setToolTipText("Also if you have no blockers to declare, the game stops at the declare blockers step.");
|
||||||
cbStopBlock.setActionCommand("");
|
cbStopBlock.setActionCommand("");
|
||||||
cbStopBlock.addActionListener(new java.awt.event.ActionListener() {
|
cbStopBlock.addActionListener(evt -> cbStopBlockActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbStopBlockActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
phases_stopSettings.add(cbStopBlock);
|
phases_stopSettings.add(cbStopBlock);
|
||||||
|
|
||||||
cbStopOnAllMain.setText("Skip with F7 to next main phase (if not activated skip always to your next main phase)");
|
cbStopOnAllMain.setText("Skip with F7 to next main phase (if not activated skip always to your next main phase)");
|
||||||
cbStopOnAllMain.setToolTipText("If activated F7 skips to next main phases (regardless of the active players).");
|
cbStopOnAllMain.setToolTipText("If activated F7 skips to next main phases (regardless of the active players).");
|
||||||
cbStopOnAllMain.setActionCommand("");
|
cbStopOnAllMain.setActionCommand("");
|
||||||
cbStopOnAllMain.addActionListener(new java.awt.event.ActionListener() {
|
cbStopOnAllMain.addActionListener(evt -> cbStopOnAllMainActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbStopOnAllMainActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
phases_stopSettings.add(cbStopOnAllMain);
|
phases_stopSettings.add(cbStopOnAllMain);
|
||||||
|
|
||||||
cbStopOnAllEnd.setText("Skip with F5 to next end step (if not activated only to end steps of opponents)");
|
cbStopOnAllEnd.setText("Skip with F5 to next end step (if not activated only to end steps of opponents)");
|
||||||
cbStopOnAllEnd.setToolTipText("If activated - F5 skips to the next end step (regardless of the current player)");
|
cbStopOnAllEnd.setToolTipText("If activated - F5 skips to the next end step (regardless of the current player)");
|
||||||
cbStopOnAllEnd.setActionCommand("");
|
cbStopOnAllEnd.setActionCommand("");
|
||||||
cbStopOnAllEnd.setPreferredSize(new java.awt.Dimension(300, 25));
|
cbStopOnAllEnd.setPreferredSize(new java.awt.Dimension(300, 25));
|
||||||
cbStopOnAllEnd.addActionListener(new java.awt.event.ActionListener() {
|
cbStopOnAllEnd.addActionListener(evt -> cbStopOnAllEndActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbStopOnAllEndActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
phases_stopSettings.add(cbStopOnAllEnd);
|
phases_stopSettings.add(cbStopOnAllEnd);
|
||||||
|
|
||||||
cbPassPriorityCast.setText("Pass priority automatically after you have put a spell on the stack");
|
cbPassPriorityCast.setText("Pass priority automatically after you have put a spell on the stack");
|
||||||
cbPassPriorityCast.setToolTipText("If activated the system passes priority automatically for you if you have put a spell on the stack.");
|
cbPassPriorityCast.setToolTipText("If activated the system passes priority automatically for you if you have put a spell on the stack.");
|
||||||
cbPassPriorityCast.setActionCommand("");
|
cbPassPriorityCast.setActionCommand("");
|
||||||
cbPassPriorityCast.setPreferredSize(new java.awt.Dimension(300, 25));
|
cbPassPriorityCast.setPreferredSize(new java.awt.Dimension(300, 25));
|
||||||
cbPassPriorityCast.addActionListener(new java.awt.event.ActionListener() {
|
cbPassPriorityCast.addActionListener(evt -> cbPassPriorityCastActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbPassPriorityCastActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
phases_stopSettings.add(cbPassPriorityCast);
|
phases_stopSettings.add(cbPassPriorityCast);
|
||||||
|
|
||||||
cbPassPriorityActivation.setText("Pass priority automatically after you have put an activated ability on the stack");
|
cbPassPriorityActivation.setText("Pass priority automatically after you have put an activated ability on the stack");
|
||||||
cbPassPriorityActivation.setToolTipText("If activated the system passes priority for you automatically after you have put an activated ability on the stack.");
|
cbPassPriorityActivation.setToolTipText("If activated the system passes priority for you automatically after you have put an activated ability on the stack.");
|
||||||
cbPassPriorityActivation.setActionCommand("");
|
cbPassPriorityActivation.setActionCommand("");
|
||||||
cbPassPriorityActivation.setPreferredSize(new java.awt.Dimension(300, 25));
|
cbPassPriorityActivation.setPreferredSize(new java.awt.Dimension(300, 25));
|
||||||
cbPassPriorityActivation.addActionListener(new java.awt.event.ActionListener() {
|
cbPassPriorityActivation.addActionListener(evt -> cbPassPriorityActivationActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbPassPriorityActivationActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
phases_stopSettings.add(cbPassPriorityActivation);
|
phases_stopSettings.add(cbPassPriorityActivation);
|
||||||
|
|
||||||
cbAutoOrderTrigger.setText("Set order for your triggers automatically if all have the same text");
|
cbAutoOrderTrigger.setText("Set order for your triggers automatically if all have the same text");
|
||||||
cbAutoOrderTrigger.setToolTipText("<HTML>If activated the order to put on the stack your triggers that trigger at the same time<br/>\nis set automatically if all have the same text.");
|
cbAutoOrderTrigger.setToolTipText("<HTML>If activated the order to put on the stack your triggers that trigger at the same time<br/>\nis set automatically if all have the same text.");
|
||||||
cbAutoOrderTrigger.setActionCommand("");
|
cbAutoOrderTrigger.setActionCommand("");
|
||||||
cbAutoOrderTrigger.setPreferredSize(new java.awt.Dimension(300, 25));
|
cbAutoOrderTrigger.setPreferredSize(new java.awt.Dimension(300, 25));
|
||||||
cbAutoOrderTrigger.addActionListener(new java.awt.event.ActionListener() {
|
cbAutoOrderTrigger.addActionListener(evt -> cbAutoOrderTriggerActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbAutoOrderTriggerActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
phases_stopSettings.add(cbAutoOrderTrigger);
|
phases_stopSettings.add(cbAutoOrderTrigger);
|
||||||
|
|
||||||
org.jdesktop.layout.GroupLayout tabPhasesLayout = new org.jdesktop.layout.GroupLayout(tabPhases);
|
org.jdesktop.layout.GroupLayout tabPhasesLayout = new org.jdesktop.layout.GroupLayout(tabPhases);
|
||||||
|
@ -1448,34 +1380,18 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
panelCardImages.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Card images:"));
|
panelCardImages.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Card images:"));
|
||||||
|
|
||||||
cbUseDefaultImageFolder.setText("Use default location to save images");
|
cbUseDefaultImageFolder.setText("Use default location to save images");
|
||||||
cbUseDefaultImageFolder.addActionListener(new java.awt.event.ActionListener() {
|
cbUseDefaultImageFolder.addActionListener(evt -> cbUseDefaultImageFolderActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbUseDefaultImageFolderActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
txtImageFolderPath.setToolTipText("The selected image will be used as background picture. You have to restart MAGE to view a changed background image.");
|
txtImageFolderPath.setToolTipText("The selected image will be used as background picture. You have to restart MAGE to view a changed background image.");
|
||||||
|
|
||||||
btnBrowseImageLocation.setText("Browse...");
|
btnBrowseImageLocation.setText("Browse...");
|
||||||
btnBrowseImageLocation.addActionListener(new java.awt.event.ActionListener() {
|
btnBrowseImageLocation.addActionListener(evt -> btnBrowseImageLocationActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnBrowseImageLocationActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
cbCheckForNewImages.setText("Check for new images on startup");
|
cbCheckForNewImages.setText("Check for new images on startup");
|
||||||
cbCheckForNewImages.addActionListener(new java.awt.event.ActionListener() {
|
cbCheckForNewImages.addActionListener(evt -> cbCheckForNewImagesActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbCheckForNewImagesActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
cbSaveToZipFiles.setText("Store images in zip files");
|
cbSaveToZipFiles.setText("Store images in zip files");
|
||||||
cbSaveToZipFiles.addActionListener(new java.awt.event.ActionListener() {
|
cbSaveToZipFiles.addActionListener(evt -> cbSaveToZipFilesActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbSaveToZipFilesActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
cbPreferedImageLanguage.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
cbPreferedImageLanguage.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||||
|
|
||||||
|
@ -1546,51 +1462,23 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
panelBackgroundImages.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Background images setting:"));
|
panelBackgroundImages.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Background images setting:"));
|
||||||
|
|
||||||
cbUseDefaultBackground.setText("Use default image");
|
cbUseDefaultBackground.setText("Use default image");
|
||||||
cbUseDefaultBackground.addActionListener(new java.awt.event.ActionListener() {
|
cbUseDefaultBackground.addActionListener(evt -> cbUseDefaultBackgroundActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbUseDefaultBackgroundActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
txtBackgroundImagePath.addActionListener(new java.awt.event.ActionListener() {
|
txtBackgroundImagePath.addActionListener(evt -> txtBackgroundImagePathActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
txtBackgroundImagePathActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnBrowseBackgroundImage.setText("Browse...");
|
btnBrowseBackgroundImage.setText("Browse...");
|
||||||
btnBrowseBackgroundImage.addActionListener(new java.awt.event.ActionListener() {
|
btnBrowseBackgroundImage.addActionListener(evt -> btnBrowseBackgroundImageActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnBrowseBackgroundImageActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
txtBattlefieldImagePath.addActionListener(new java.awt.event.ActionListener() {
|
txtBattlefieldImagePath.addActionListener(evt -> txtBattlefieldImagePathActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
txtBattlefieldImagePathActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnBrowseBattlefieldImage.setText("Browse...");
|
btnBrowseBattlefieldImage.setText("Browse...");
|
||||||
btnBrowseBattlefieldImage.addActionListener(new java.awt.event.ActionListener() {
|
btnBrowseBattlefieldImage.addActionListener(evt -> btnBrowseBattlefieldImageActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnBrowseBattlefieldImageActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
cbUseDefaultBattleImage.setText("Use default battlefield image");
|
cbUseDefaultBattleImage.setText("Use default battlefield image");
|
||||||
cbUseDefaultBattleImage.addActionListener(new java.awt.event.ActionListener() {
|
cbUseDefaultBattleImage.addActionListener(evt -> cbUseDefaultBattleImageActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbUseDefaultBattleImageActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
cbUseRandomBattleImage.setText("Select random battlefield image");
|
cbUseRandomBattleImage.setText("Select random battlefield image");
|
||||||
cbUseRandomBattleImage.addActionListener(new java.awt.event.ActionListener() {
|
cbUseRandomBattleImage.addActionListener(evt -> cbUseRandomBattleImageActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbUseRandomBattleImageActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jLabel14.setText("Background:");
|
jLabel14.setText("Background:");
|
||||||
|
|
||||||
|
@ -1650,25 +1538,13 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Card rendering:"));
|
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Card rendering:"));
|
||||||
|
|
||||||
cbCardRenderImageFallback.setText("Fall back to plain image based rendering");
|
cbCardRenderImageFallback.setText("Fall back to plain image based rendering");
|
||||||
cbCardRenderImageFallback.addActionListener(new java.awt.event.ActionListener() {
|
cbCardRenderImageFallback.addActionListener(evt -> cbCardRenderImageFallbackActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbCardRenderImageFallbackActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
cbCardRenderShowReminderText.setText("Show reminder text in rendered card textboxes");
|
cbCardRenderShowReminderText.setText("Show reminder text in rendered card textboxes");
|
||||||
cbCardRenderShowReminderText.addActionListener(new java.awt.event.ActionListener() {
|
cbCardRenderShowReminderText.addActionListener(evt -> cbCardRenderShowReminderTextActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbCardRenderShowReminderTextActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
cbCardRenderHideSetSymbol.setText("Hide set symbols on cards (more space on the type line for card types)");
|
cbCardRenderHideSetSymbol.setText("Hide set symbols on cards (more space on the type line for card types)");
|
||||||
cbCardRenderHideSetSymbol.addActionListener(new java.awt.event.ActionListener() {
|
cbCardRenderHideSetSymbol.addActionListener(evt -> cbCardRenderHideSetSymbolActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbCardRenderHideSetSymbolActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
|
org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
|
||||||
jPanel1.setLayout(jPanel1Layout);
|
jPanel1.setLayout(jPanel1Layout);
|
||||||
|
@ -1723,38 +1599,22 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
|
|
||||||
cbEnableGameSounds.setText("Enable game sounds");
|
cbEnableGameSounds.setText("Enable game sounds");
|
||||||
cbEnableGameSounds.setToolTipText("Sounds that will be played for certain actions (e.g. play land, attack, etc.) during the game.");
|
cbEnableGameSounds.setToolTipText("Sounds that will be played for certain actions (e.g. play land, attack, etc.) during the game.");
|
||||||
cbEnableGameSounds.addActionListener(new java.awt.event.ActionListener() {
|
cbEnableGameSounds.addActionListener(evt -> cbEnableGameSoundsActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbEnableGameSoundsActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
sounds_clips.add(cbEnableGameSounds);
|
sounds_clips.add(cbEnableGameSounds);
|
||||||
|
|
||||||
cbEnableDraftSounds.setText("Enable draft sounds");
|
cbEnableDraftSounds.setText("Enable draft sounds");
|
||||||
cbEnableDraftSounds.setToolTipText("Sounds that will be played during drafting for card picking or warining if time runs out.");
|
cbEnableDraftSounds.setToolTipText("Sounds that will be played during drafting for card picking or warining if time runs out.");
|
||||||
cbEnableDraftSounds.addActionListener(new java.awt.event.ActionListener() {
|
cbEnableDraftSounds.addActionListener(evt -> cbEnableDraftSoundsActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbEnableDraftSoundsActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
sounds_clips.add(cbEnableDraftSounds);
|
sounds_clips.add(cbEnableDraftSounds);
|
||||||
|
|
||||||
cbEnableSkipButtonsSounds.setText("Enable skip button sounds");
|
cbEnableSkipButtonsSounds.setText("Enable skip button sounds");
|
||||||
cbEnableSkipButtonsSounds.setToolTipText("Sounds that will be played if a priority skip action (F4/F5/F7/F9) or cancel skip action (F3) is used.");
|
cbEnableSkipButtonsSounds.setToolTipText("Sounds that will be played if a priority skip action (F4/F5/F7/F9) or cancel skip action (F3) is used.");
|
||||||
cbEnableSkipButtonsSounds.addActionListener(new java.awt.event.ActionListener() {
|
cbEnableSkipButtonsSounds.addActionListener(evt -> cbEnableSkipButtonsSoundsActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbEnableSkipButtonsSoundsActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
sounds_clips.add(cbEnableSkipButtonsSounds);
|
sounds_clips.add(cbEnableSkipButtonsSounds);
|
||||||
|
|
||||||
cbEnableOtherSounds.setText("Enable other sounds");
|
cbEnableOtherSounds.setText("Enable other sounds");
|
||||||
cbEnableOtherSounds.setToolTipText("Sounds that will be played for actions outside of games (e.g. whisper, player joins your game, player submits a deck ...).");
|
cbEnableOtherSounds.setToolTipText("Sounds that will be played for actions outside of games (e.g. whisper, player joins your game, player submits a deck ...).");
|
||||||
cbEnableOtherSounds.addActionListener(new java.awt.event.ActionListener() {
|
cbEnableOtherSounds.addActionListener(evt -> cbEnableOtherSoundsActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbEnableOtherSoundsActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
sounds_clips.add(cbEnableOtherSounds);
|
sounds_clips.add(cbEnableOtherSounds);
|
||||||
|
|
||||||
sounds_backgroundMusic.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Music"));
|
sounds_backgroundMusic.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Music"));
|
||||||
|
@ -1762,27 +1622,15 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
cbEnableBattlefieldBGM.setText("Play music during match");
|
cbEnableBattlefieldBGM.setText("Play music during match");
|
||||||
cbEnableBattlefieldBGM.setToolTipText("During your matches music will be played from the seleced folder.");
|
cbEnableBattlefieldBGM.setToolTipText("During your matches music will be played from the seleced folder.");
|
||||||
cbEnableBattlefieldBGM.setActionCommand("Play automatically during matches");
|
cbEnableBattlefieldBGM.setActionCommand("Play automatically during matches");
|
||||||
cbEnableBattlefieldBGM.addActionListener(new java.awt.event.ActionListener() {
|
cbEnableBattlefieldBGM.addActionListener(evt -> cbEnableBattlefieldBGMActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbEnableBattlefieldBGMActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jLabel16.setText("Playing from folder:");
|
jLabel16.setText("Playing from folder:");
|
||||||
jLabel16.setToolTipText("");
|
jLabel16.setToolTipText("");
|
||||||
|
|
||||||
txtBattlefieldIBGMPath.addActionListener(new java.awt.event.ActionListener() {
|
txtBattlefieldIBGMPath.addActionListener(evt -> txtBattlefieldIBGMPathActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
txtBattlefieldIBGMPathActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnBattlefieldBGMBrowse.setText("Browse...");
|
btnBattlefieldBGMBrowse.setText("Browse...");
|
||||||
btnBattlefieldBGMBrowse.addActionListener(new java.awt.event.ActionListener() {
|
btnBattlefieldBGMBrowse.addActionListener(evt -> btnBattlefieldBGMBrowseActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnBattlefieldBGMBrowseActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
org.jdesktop.layout.GroupLayout sounds_backgroundMusicLayout = new org.jdesktop.layout.GroupLayout(sounds_backgroundMusic);
|
org.jdesktop.layout.GroupLayout sounds_backgroundMusicLayout = new org.jdesktop.layout.GroupLayout(sounds_backgroundMusic);
|
||||||
sounds_backgroundMusic.setLayout(sounds_backgroundMusicLayout);
|
sounds_backgroundMusic.setLayout(sounds_backgroundMusicLayout);
|
||||||
|
@ -2337,11 +2185,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
|
|
||||||
lblProxyType.setText("Proxy:");
|
lblProxyType.setText("Proxy:");
|
||||||
|
|
||||||
cbProxyType.addActionListener(new java.awt.event.ActionListener() {
|
cbProxyType.addActionListener(evt -> cbProxyTypeActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbProxyTypeActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
pnlProxySettings.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
pnlProxySettings.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||||
|
|
||||||
|
@ -2359,18 +2203,10 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
|
|
||||||
lblProxyPassword.setText("Password:");
|
lblProxyPassword.setText("Password:");
|
||||||
|
|
||||||
txtPasswordField.addActionListener(new java.awt.event.ActionListener() {
|
txtPasswordField.addActionListener(evt -> txtPasswordFieldActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
txtPasswordFieldActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
rememberPswd.setText("Remember Password");
|
rememberPswd.setText("Remember Password");
|
||||||
rememberPswd.addActionListener(new java.awt.event.ActionListener() {
|
rememberPswd.addActionListener(evt -> rememberPswdActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
rememberPswdActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jLabel11.setFont(new java.awt.Font("Tahoma", 2, 10)); // NOI18N
|
jLabel11.setFont(new java.awt.Font("Tahoma", 2, 10)); // NOI18N
|
||||||
jLabel11.setText("Note: password won't be encrypted!");
|
jLabel11.setText("Note: password won't be encrypted!");
|
||||||
|
@ -2517,11 +2353,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
controlsDescriptionLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP);
|
controlsDescriptionLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP);
|
||||||
|
|
||||||
bttnResetControls.setText("Reset to default");
|
bttnResetControls.setText("Reset to default");
|
||||||
bttnResetControls.addActionListener(new java.awt.event.ActionListener() {
|
bttnResetControls.addActionListener(evt -> bttnResetControlsActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
bttnResetControlsActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
org.jdesktop.layout.GroupLayout tabControlsLayout = new org.jdesktop.layout.GroupLayout(tabControls);
|
org.jdesktop.layout.GroupLayout tabControlsLayout = new org.jdesktop.layout.GroupLayout(tabControls);
|
||||||
tabControls.setLayout(tabControlsLayout);
|
tabControls.setLayout(tabControlsLayout);
|
||||||
|
@ -2613,22 +2445,14 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
saveButton.setMinimumSize(new java.awt.Dimension(100, 30));
|
saveButton.setMinimumSize(new java.awt.Dimension(100, 30));
|
||||||
saveButton.setPreferredSize(new java.awt.Dimension(100, 30));
|
saveButton.setPreferredSize(new java.awt.Dimension(100, 30));
|
||||||
saveButton.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
|
saveButton.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
|
||||||
saveButton.addActionListener(new java.awt.event.ActionListener() {
|
saveButton.addActionListener(evt -> saveButtonActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
saveButtonActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
exitButton.setText("Exit");
|
exitButton.setText("Exit");
|
||||||
exitButton.setMaximumSize(new java.awt.Dimension(100, 30));
|
exitButton.setMaximumSize(new java.awt.Dimension(100, 30));
|
||||||
exitButton.setMinimumSize(new java.awt.Dimension(100, 30));
|
exitButton.setMinimumSize(new java.awt.Dimension(100, 30));
|
||||||
exitButton.setPreferredSize(new java.awt.Dimension(100, 30));
|
exitButton.setPreferredSize(new java.awt.Dimension(100, 30));
|
||||||
exitButton.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
|
exitButton.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);
|
||||||
exitButton.addActionListener(new java.awt.event.ActionListener() {
|
exitButton.addActionListener(evt -> exitButtonActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
exitButtonActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
|
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
|
@ -3097,7 +2921,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
}//GEN-LAST:event_cbCardRenderHideSetSymbolActionPerformed
|
}//GEN-LAST:event_cbCardRenderHideSetSymbolActionPerformed
|
||||||
|
|
||||||
private void bttnResetControlsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bttnResetControlsActionPerformed
|
private void bttnResetControlsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bttnResetControlsActionPerformed
|
||||||
getKeybindButtons().stream().forEach((bttn) -> {
|
getKeybindButtons().forEach((bttn) -> {
|
||||||
String id = bttn.getKey();
|
String id = bttn.getKey();
|
||||||
int keyCode = getDefaultControlKey(id);
|
int keyCode = getDefaultControlKey(id);
|
||||||
bttn.setKeyCode(keyCode);
|
bttn.setKeyCode(keyCode);
|
||||||
|
@ -3166,43 +2990,40 @@ public class PreferencesDialog extends javax.swing.JDialog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final int openedTab = param;
|
final int openedTab = param;
|
||||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
java.awt.EventQueue.invokeLater(() -> {
|
||||||
@Override
|
if (!dialog.isVisible()) {
|
||||||
public void run() {
|
Preferences prefs = MageFrame.getPreferences();
|
||||||
if (!dialog.isVisible()) {
|
|
||||||
Preferences prefs = MageFrame.getPreferences();
|
|
||||||
|
|
||||||
// Main & Phases
|
// Main & Phases
|
||||||
loadPhases(prefs);
|
loadPhases(prefs);
|
||||||
|
|
||||||
// Gui Size
|
// Gui Size
|
||||||
loadGuiSize(prefs);
|
loadGuiSize(prefs);
|
||||||
|
|
||||||
// Images
|
// Images
|
||||||
loadImagesSettings(prefs);
|
loadImagesSettings(prefs);
|
||||||
|
|
||||||
// Sounds
|
// Sounds
|
||||||
loadSoundSettings(prefs);
|
loadSoundSettings(prefs);
|
||||||
|
|
||||||
// Connection
|
// Connection
|
||||||
loadProxySettings(prefs);
|
loadProxySettings(prefs);
|
||||||
|
|
||||||
// Controls
|
// Controls
|
||||||
loadControlSettings(prefs);
|
loadControlSettings(prefs);
|
||||||
|
|
||||||
// Selected avatar
|
// Selected avatar
|
||||||
loadSelectedAvatar(prefs);
|
loadSelectedAvatar(prefs);
|
||||||
|
|
||||||
dialog.reset();
|
dialog.reset();
|
||||||
// open specified tab before displaying
|
// open specified tab before displaying
|
||||||
openTab(openedTab);
|
openTab(openedTab);
|
||||||
|
|
||||||
dialog.setLocation(300, 200);
|
dialog.setLocation(300, 200);
|
||||||
|
|
||||||
dialog.setVisible(true);
|
dialog.setVisible(true);
|
||||||
} else {
|
} else {
|
||||||
dialog.requestFocus();
|
dialog.requestFocus();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,18 +75,10 @@ public class QuestionDialog extends MageDialog {
|
||||||
lblQuestion.setText("question");
|
lblQuestion.setText("question");
|
||||||
|
|
||||||
btnNo.setText("No");
|
btnNo.setText("No");
|
||||||
btnNo.addActionListener(new java.awt.event.ActionListener() {
|
btnNo.addActionListener(evt -> btnNoActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnNoActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnYes.setText("Yes");
|
btnYes.setText("Yes");
|
||||||
btnYes.addActionListener(new java.awt.event.ActionListener() {
|
btnYes.addActionListener(evt -> btnYesActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnYesActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
|
|
|
@ -135,19 +135,11 @@ public class RandomPacksSelectorDialog extends javax.swing.JDialog {
|
||||||
|
|
||||||
btnNone.setText("Select none");
|
btnNone.setText("Select none");
|
||||||
btnNone.setActionCommand("none");
|
btnNone.setActionCommand("none");
|
||||||
btnNone.addActionListener(new java.awt.event.ActionListener() {
|
btnNone.addActionListener(evt -> btnNoneActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnNoneActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
pnlSelect.add(btnNone);
|
pnlSelect.add(btnNone);
|
||||||
|
|
||||||
btnAll.setText("Select all");
|
btnAll.setText("Select all");
|
||||||
btnAll.addActionListener(new java.awt.event.ActionListener() {
|
btnAll.addActionListener(evt -> btnAllActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnAllActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
pnlSelect.add(btnAll);
|
pnlSelect.add(btnAll);
|
||||||
|
|
||||||
pnlApply.setLayout(new javax.swing.BoxLayout(pnlApply, javax.swing.BoxLayout.LINE_AXIS));
|
pnlApply.setLayout(new javax.swing.BoxLayout(pnlApply, javax.swing.BoxLayout.LINE_AXIS));
|
||||||
|
@ -158,11 +150,7 @@ public class RandomPacksSelectorDialog extends javax.swing.JDialog {
|
||||||
} else if (isRichManDraft) {
|
} else if (isRichManDraft) {
|
||||||
btnApply.setToolTipText("At least 1 pack must be selected");
|
btnApply.setToolTipText("At least 1 pack must be selected");
|
||||||
}
|
}
|
||||||
btnApply.addActionListener(new java.awt.event.ActionListener() {
|
btnApply.addActionListener(evt -> btnApplyActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnApplyActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
pnlApply.add(btnApply);
|
pnlApply.add(btnApply);
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||||
|
|
|
@ -14,7 +14,7 @@ import org.apache.log4j.Logger;
|
||||||
public class RegisterUserDialog extends MageDialog {
|
public class RegisterUserDialog extends MageDialog {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(ConnectDialog.class);
|
private static final Logger logger = Logger.getLogger(ConnectDialog.class);
|
||||||
private ConnectDialog connectDialog;
|
private final ConnectDialog connectDialog;
|
||||||
private Connection connection;
|
private Connection connection;
|
||||||
private ConnectTask task;
|
private ConnectTask task;
|
||||||
|
|
||||||
|
@ -78,25 +78,13 @@ public class RegisterUserDialog extends MageDialog {
|
||||||
lblPassword.setLabelFor(txtPassword);
|
lblPassword.setLabelFor(txtPassword);
|
||||||
lblPassword.setText("Password:");
|
lblPassword.setText("Password:");
|
||||||
|
|
||||||
txtUserName.addActionListener(new java.awt.event.ActionListener() {
|
txtUserName.addActionListener(evt -> txtUserNameActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
txtUserNameActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnRegister.setText("Register");
|
btnRegister.setText("Register");
|
||||||
btnRegister.addActionListener(new java.awt.event.ActionListener() {
|
btnRegister.addActionListener(evt -> btnRegisterActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnRegisterActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnCancel.setText("Cancel");
|
btnCancel.setText("Cancel");
|
||||||
btnCancel.addActionListener(new java.awt.event.ActionListener() {
|
btnCancel.addActionListener(evt -> btnCancelActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnCancelActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lblStatus.setToolTipText("");
|
lblStatus.setToolTipText("");
|
||||||
|
|
||||||
|
@ -112,7 +100,7 @@ public class RegisterUserDialog extends MageDialog {
|
||||||
|
|
||||||
lblEmailReasoning.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
|
lblEmailReasoning.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
|
||||||
lblEmailReasoning.setLabelFor(txtEmail);
|
lblEmailReasoning.setLabelFor(txtEmail);
|
||||||
lblEmailReasoning.setText("(used for password reset)");
|
lblEmailReasoning.setText("(used for password reset and sending initial password)");
|
||||||
lblEmailReasoning.setToolTipText("");
|
lblEmailReasoning.setToolTipText("");
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||||
|
|
|
@ -14,7 +14,7 @@ import org.apache.log4j.Logger;
|
||||||
public class ResetPasswordDialog extends MageDialog {
|
public class ResetPasswordDialog extends MageDialog {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(ResetPasswordDialog.class);
|
private static final Logger logger = Logger.getLogger(ResetPasswordDialog.class);
|
||||||
private ConnectDialog connectDialog;
|
private final ConnectDialog connectDialog;
|
||||||
private Connection connection;
|
private Connection connection;
|
||||||
private GetAuthTokenTask getAuthTokenTask;
|
private GetAuthTokenTask getAuthTokenTask;
|
||||||
private ResetPasswordTask resetPasswordTask;
|
private ResetPasswordTask resetPasswordTask;
|
||||||
|
@ -88,11 +88,7 @@ public class ResetPasswordDialog extends MageDialog {
|
||||||
lblPasswordConfirmation.setText("New password:");
|
lblPasswordConfirmation.setText("New password:");
|
||||||
|
|
||||||
btnSubmitNewPassword.setText("Submit a new password");
|
btnSubmitNewPassword.setText("Submit a new password");
|
||||||
btnSubmitNewPassword.addActionListener(new java.awt.event.ActionListener() {
|
btnSubmitNewPassword.addActionListener(evt -> btnSubmitNewPasswordActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnSubmitNewPasswordActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lblPasswordConfirmationReasoning.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
|
lblPasswordConfirmationReasoning.setFont(new java.awt.Font("Lucida Grande", 0, 10)); // NOI18N
|
||||||
lblPasswordConfirmationReasoning.setLabelFor(txtPasswordConfirmation);
|
lblPasswordConfirmationReasoning.setLabelFor(txtPasswordConfirmation);
|
||||||
|
@ -157,11 +153,7 @@ public class ResetPasswordDialog extends MageDialog {
|
||||||
lblEmail.setText("Email:");
|
lblEmail.setText("Email:");
|
||||||
|
|
||||||
btnGetAuthToken.setText("Email an auth token");
|
btnGetAuthToken.setText("Email an auth token");
|
||||||
btnGetAuthToken.addActionListener(new java.awt.event.ActionListener() {
|
btnGetAuthToken.addActionListener(evt -> btnGetAuthTokenActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnGetAuthTokenActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
||||||
jPanel1.setLayout(jPanel1Layout);
|
jPanel1.setLayout(jPanel1Layout);
|
||||||
|
@ -196,11 +188,7 @@ public class ResetPasswordDialog extends MageDialog {
|
||||||
);
|
);
|
||||||
|
|
||||||
btnCancel.setText("Cancel");
|
btnCancel.setText("Cancel");
|
||||||
btnCancel.addActionListener(new java.awt.event.ActionListener() {
|
btnCancel.addActionListener(evt -> btnCancelActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnCancelActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lblServer.setLabelFor(txtServer);
|
lblServer.setLabelFor(txtServer);
|
||||||
lblServer.setText("Server:");
|
lblServer.setText("Server:");
|
||||||
|
|
|
@ -129,21 +129,18 @@ public class ShowCardsDialog extends MageDialog {
|
||||||
this.repaint();
|
this.repaint();
|
||||||
this.setModal(modal);
|
this.setModal(modal);
|
||||||
|
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> {
|
||||||
@Override
|
if (!positioned) {
|
||||||
public void run() {
|
int width = ShowCardsDialog.this.getWidth();
|
||||||
if (!positioned) {
|
int height = ShowCardsDialog.this.getHeight();
|
||||||
int width = ShowCardsDialog.this.getWidth();
|
if (width > 0 && height > 0) {
|
||||||
int height = ShowCardsDialog.this.getHeight();
|
Point centered = SettingsManager.getInstance().getComponentPosition(width, height);
|
||||||
if (width > 0 && height > 0) {
|
ShowCardsDialog.this.setLocation(centered.x, centered.y);
|
||||||
Point centered = SettingsManager.getInstance().getComponentPosition(width, height);
|
positioned = true;
|
||||||
ShowCardsDialog.this.setLocation(centered.x, centered.y);
|
GuiDisplayUtil.keepComponentInsideScreen(centered.x, centered.y, ShowCardsDialog.this);
|
||||||
positioned = true;
|
|
||||||
GuiDisplayUtil.keepComponentInsideScreen(centered.x, centered.y, ShowCardsDialog.this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ShowCardsDialog.this.setVisible(true);
|
|
||||||
}
|
}
|
||||||
|
ShowCardsDialog.this.setVisible(true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -206,34 +206,18 @@ public class TableWaitingDialog extends MageDialog {
|
||||||
|
|
||||||
btnMoveUp.setText("Move Up");
|
btnMoveUp.setText("Move Up");
|
||||||
btnMoveUp.setEnabled(false);
|
btnMoveUp.setEnabled(false);
|
||||||
btnMoveUp.addActionListener(new java.awt.event.ActionListener() {
|
btnMoveUp.addActionListener(evt -> btnMoveUpActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnMoveUpActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnMoveDown.setText("Move Down");
|
btnMoveDown.setText("Move Down");
|
||||||
btnMoveDown.setEnabled(false);
|
btnMoveDown.setEnabled(false);
|
||||||
btnMoveDown.addActionListener(new java.awt.event.ActionListener() {
|
btnMoveDown.addActionListener(evt -> btnMoveDownActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnMoveDownActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnCancel.setText("Cancel");
|
btnCancel.setText("Cancel");
|
||||||
btnCancel.addActionListener(new java.awt.event.ActionListener() {
|
btnCancel.addActionListener(evt -> btnCancelActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnCancelActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnStart.setText("Start");
|
btnStart.setText("Start");
|
||||||
btnStart.setEnabled(false);
|
btnStart.setEnabled(false);
|
||||||
btnStart.addActionListener(new java.awt.event.ActionListener() {
|
btnStart.addActionListener(evt -> btnStartActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnStartActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jSplitPane1.setDividerLocation(300);
|
jSplitPane1.setDividerLocation(300);
|
||||||
jSplitPane1.setDividerSize(3);
|
jSplitPane1.setDividerSize(3);
|
||||||
|
|
|
@ -35,7 +35,6 @@ package mage.client.dialog;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import javax.swing.plaf.basic.BasicInternalFrameTitlePane;
|
|
||||||
import javax.swing.plaf.basic.BasicInternalFrameUI;
|
import javax.swing.plaf.basic.BasicInternalFrameUI;
|
||||||
import mage.client.MageFrame;
|
import mage.client.MageFrame;
|
||||||
import mage.client.util.GUISizeHelper;
|
import mage.client.util.GUISizeHelper;
|
||||||
|
@ -76,7 +75,7 @@ public class UserRequestDialog extends MageDialog {
|
||||||
btn3.setMinimumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
|
btn3.setMinimumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
|
||||||
btn3.setMaximumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
|
btn3.setMaximumSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
|
||||||
btn3.setPreferredSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
|
btn3.setPreferredSize(new Dimension(50 + 4 * font.getSize(), 2 * font.getSize() + 10));
|
||||||
JComponent c = (BasicInternalFrameTitlePane) ((BasicInternalFrameUI) this.getUI()).getNorthPane();
|
JComponent c = ((BasicInternalFrameUI) this.getUI()).getNorthPane();
|
||||||
c.setMinimumSize(new Dimension(c.getMinimumSize().width, font.getSize() + 10));
|
c.setMinimumSize(new Dimension(c.getMinimumSize().width, font.getSize() + 10));
|
||||||
c.setMaximumSize(new Dimension(c.getMaximumSize().width, font.getSize() + 10));
|
c.setMaximumSize(new Dimension(c.getMaximumSize().width, font.getSize() + 10));
|
||||||
c.setPreferredSize(new Dimension(c.getPreferredSize().width, font.getSize() + 10));
|
c.setPreferredSize(new Dimension(c.getPreferredSize().width, font.getSize() + 10));
|
||||||
|
@ -138,31 +137,19 @@ public class UserRequestDialog extends MageDialog {
|
||||||
btn3.setMaximumSize(new java.awt.Dimension(150, 50));
|
btn3.setMaximumSize(new java.awt.Dimension(150, 50));
|
||||||
btn3.setMinimumSize(new java.awt.Dimension(75, 25));
|
btn3.setMinimumSize(new java.awt.Dimension(75, 25));
|
||||||
btn3.setPreferredSize(new java.awt.Dimension(150, 50));
|
btn3.setPreferredSize(new java.awt.Dimension(150, 50));
|
||||||
btn3.addActionListener(new java.awt.event.ActionListener() {
|
btn3.addActionListener(evt -> btn3ActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btn3ActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btn2.setText("btn2");
|
btn2.setText("btn2");
|
||||||
btn2.setMaximumSize(new java.awt.Dimension(150, 50));
|
btn2.setMaximumSize(new java.awt.Dimension(150, 50));
|
||||||
btn2.setMinimumSize(new java.awt.Dimension(75, 25));
|
btn2.setMinimumSize(new java.awt.Dimension(75, 25));
|
||||||
btn2.setPreferredSize(new java.awt.Dimension(150, 50));
|
btn2.setPreferredSize(new java.awt.Dimension(150, 50));
|
||||||
btn2.addActionListener(new java.awt.event.ActionListener() {
|
btn2.addActionListener(evt -> btn2ActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btn2ActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btn1.setText("btn1");
|
btn1.setText("btn1");
|
||||||
btn1.setMaximumSize(new java.awt.Dimension(150, 50));
|
btn1.setMaximumSize(new java.awt.Dimension(150, 50));
|
||||||
btn1.setMinimumSize(new java.awt.Dimension(75, 25));
|
btn1.setMinimumSize(new java.awt.Dimension(75, 25));
|
||||||
btn1.setPreferredSize(new java.awt.Dimension(150, 50));
|
btn1.setPreferredSize(new java.awt.Dimension(150, 50));
|
||||||
btn1.addActionListener(new java.awt.event.ActionListener() {
|
btn1.addActionListener(evt -> btn1ActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btn1ActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
|
|
|
@ -105,7 +105,7 @@ public class DraftPanel extends javax.swing.JPanel {
|
||||||
// all cards picked
|
// all cards picked
|
||||||
protected SimpleCardsView pickedCards;
|
protected SimpleCardsView pickedCards;
|
||||||
// all cards picked
|
// all cards picked
|
||||||
protected SimpleCardsView pickedCardsShown = new SimpleCardsView();
|
protected final SimpleCardsView pickedCardsShown = new SimpleCardsView();
|
||||||
// id of card with popup menu
|
// id of card with popup menu
|
||||||
protected UUID cardIdPopupMenu;
|
protected UUID cardIdPopupMenu;
|
||||||
|
|
||||||
|
@ -145,17 +145,14 @@ public class DraftPanel extends javax.swing.JPanel {
|
||||||
draftLeftPane.setOpaque(false);
|
draftLeftPane.setOpaque(false);
|
||||||
|
|
||||||
countdown = new Timer(1000,
|
countdown = new Timer(1000,
|
||||||
new ActionListener() {
|
e -> {
|
||||||
@Override
|
if (--timeout > 0) {
|
||||||
public void actionPerformed(ActionEvent e) {
|
setTimeout(timeout);
|
||||||
if (--timeout > 0) {
|
} else {
|
||||||
setTimeout(timeout);
|
setTimeout(0);
|
||||||
} else {
|
countdown.stop();
|
||||||
setTimeout(0);
|
}
|
||||||
countdown.stop();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,18 +303,15 @@ public class DraftPanel extends javax.swing.JPanel {
|
||||||
loadCardsToPickedCardsArea(draftPickView.getPicks());
|
loadCardsToPickedCardsArea(draftPickView.getPicks());
|
||||||
|
|
||||||
this.draftPicks.clearCardEventListeners();
|
this.draftPicks.clearCardEventListeners();
|
||||||
this.draftPicks.addCardEventListener(new Listener<Event>() {
|
this.draftPicks.addCardEventListener((Listener<Event>) event -> {
|
||||||
@Override
|
if (event.getEventName().equals("show-popup-menu")) {
|
||||||
public void event(Event event) {
|
if (event.getSource() != null) {
|
||||||
if (event.getEventName().equals("show-popup-menu")) {
|
// Popup Menu Card
|
||||||
if (event.getSource() != null) {
|
cardIdPopupMenu = ((SimpleCardView) event.getSource()).getId();
|
||||||
// Popup Menu Card
|
popupMenuCardPanel.show(event.getComponent(), event.getxPos(), event.getyPos());
|
||||||
cardIdPopupMenu = ((SimpleCardView) event.getSource()).getId();
|
} else {
|
||||||
popupMenuCardPanel.show(event.getComponent(), event.getxPos(), event.getyPos());
|
// Popup Menu area
|
||||||
} else {
|
popupMenuPickedArea.show(event.getComponent(), event.getxPos(), event.getyPos());
|
||||||
// Popup Menu area
|
|
||||||
popupMenuPickedArea.show(event.getComponent(), event.getxPos(), event.getyPos());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -327,25 +321,22 @@ public class DraftPanel extends javax.swing.JPanel {
|
||||||
draftBooster.loadBooster(CardsViewUtil.convertSimple(draftPickView.getBooster()), bigCard);
|
draftBooster.loadBooster(CardsViewUtil.convertSimple(draftPickView.getBooster()), bigCard);
|
||||||
this.draftBooster.clearCardEventListeners();
|
this.draftBooster.clearCardEventListeners();
|
||||||
this.draftBooster.addCardEventListener(
|
this.draftBooster.addCardEventListener(
|
||||||
new Listener<Event>() {
|
(Listener<Event>) event -> {
|
||||||
@Override
|
if (event.getEventName().equals("pick-a-card")) {
|
||||||
public void event(Event event) {
|
SimpleCardView source = (SimpleCardView) event.getSource();
|
||||||
if (event.getEventName().equals("pick-a-card")) {
|
DraftPickView view = SessionHandler.sendCardPick(draftId, source.getId(), cardsHidden);
|
||||||
SimpleCardView source = (SimpleCardView) event.getSource();
|
if (view != null) {
|
||||||
DraftPickView view = SessionHandler.sendCardPick(draftId, source.getId(), cardsHidden);
|
loadCardsToPickedCardsArea(view.getPicks());
|
||||||
if (view != null) {
|
draftBooster.loadBooster(EMPTY_VIEW, bigCard);
|
||||||
loadCardsToPickedCardsArea(view.getPicks());
|
Plugins.getInstance().getActionCallback().hideOpenComponents();
|
||||||
draftBooster.loadBooster(EMPTY_VIEW, bigCard);
|
setMessage("Waiting for other players");
|
||||||
Plugins.getInstance().getActionCallback().hideOpenComponents();
|
}
|
||||||
setMessage("Waiting for other players");
|
}
|
||||||
|
if (event.getEventName().equals("mark-a-card")) {
|
||||||
|
SimpleCardView source = (SimpleCardView) event.getSource();
|
||||||
|
SessionHandler.sendCardMark(draftId, source.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event.getEventName().equals("mark-a-card")) {
|
|
||||||
SimpleCardView source = (SimpleCardView) event.getSource();
|
|
||||||
SessionHandler.sendCardMark(draftId, source.getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
setMessage("Pick a card");
|
setMessage("Pick a card");
|
||||||
if (!MageFrame.getInstance().isActive()) {
|
if (!MageFrame.getInstance().isActive()) {
|
||||||
|
@ -422,12 +413,7 @@ public class DraftPanel extends javax.swing.JPanel {
|
||||||
popupMenuPickedArea.add(menuItem);
|
popupMenuPickedArea.add(menuItem);
|
||||||
|
|
||||||
// Confirm (F9)
|
// Confirm (F9)
|
||||||
menuItem.addActionListener(new ActionListener() {
|
menuItem.addActionListener(e -> showAgainAllHiddenCards());
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
showAgainAllHiddenCards();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// popupMenuPickedArea.addSeparator();
|
// popupMenuPickedArea.addSeparator();
|
||||||
}
|
}
|
||||||
|
@ -440,12 +426,7 @@ public class DraftPanel extends javax.swing.JPanel {
|
||||||
popupMenuCardPanel.add(menuItem);
|
popupMenuCardPanel.add(menuItem);
|
||||||
|
|
||||||
// Hide Card
|
// Hide Card
|
||||||
menuItem.addActionListener(new ActionListener() {
|
menuItem.addActionListener(e -> hideThisCard(cardIdPopupMenu));
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
hideThisCard(cardIdPopupMenu);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// popupMenuCardPanel.addSeparator();
|
// popupMenuCardPanel.addSeparator();
|
||||||
}
|
}
|
||||||
|
@ -608,11 +589,7 @@ public class DraftPanel extends javax.swing.JPanel {
|
||||||
draftLeftPane.setVerifyInputWhenFocusTarget(false);
|
draftLeftPane.setVerifyInputWhenFocusTarget(false);
|
||||||
|
|
||||||
btnQuitTournament.setText("Quit Tournament");
|
btnQuitTournament.setText("Quit Tournament");
|
||||||
btnQuitTournament.addActionListener(new java.awt.event.ActionListener() {
|
btnQuitTournament.addActionListener(evt -> btnQuitTournamentActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnQuitTournamentActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lblPack1.setText("Pack 1:");
|
lblPack1.setText("Pack 1:");
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class AbilityPicker extends JPopupMenu implements PopupMenuListener {
|
||||||
|
|
||||||
private class AbilityPickerAction extends AbstractAction {
|
private class AbilityPickerAction extends AbstractAction {
|
||||||
|
|
||||||
private UUID id;
|
private final UUID id;
|
||||||
|
|
||||||
public AbilityPickerAction(UUID id, String choice) {
|
public AbilityPickerAction(UUID id, String choice) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
|
|
@ -299,13 +299,10 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
||||||
}
|
}
|
||||||
} else if (comp instanceof MagePermanent) {
|
} else if (comp instanceof MagePermanent) {
|
||||||
if (((MagePermanent) comp).getOriginal().getId().equals(permanentId)) {
|
if (((MagePermanent) comp).getOriginal().getId().equals(permanentId)) {
|
||||||
Thread t = new Thread(new Runnable() {
|
Thread t = new Thread(() -> {
|
||||||
@Override
|
Plugins.getInstance().onRemoveCard((MagePermanent) comp, count);
|
||||||
public void run() {
|
comp.setVisible(false);
|
||||||
Plugins.getInstance().onRemoveCard((MagePermanent) comp, count);
|
BattlefieldPanel.this.jPanel.remove(comp);
|
||||||
comp.setVisible(false);
|
|
||||||
BattlefieldPanel.this.jPanel.remove(comp);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
t.start();
|
t.start();
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,6 @@ import static mage.constants.Constants.Option.ORIGINAL_ID;
|
||||||
import static mage.constants.Constants.Option.SECOND_MESSAGE;
|
import static mage.constants.Constants.Option.SECOND_MESSAGE;
|
||||||
import static mage.constants.Constants.Option.SPECIAL_BUTTON;
|
import static mage.constants.Constants.Option.SPECIAL_BUTTON;
|
||||||
import mage.constants.PlayerAction;
|
import mage.constants.PlayerAction;
|
||||||
import mage.remote.Session;
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -184,17 +183,14 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
||||||
* Close game window by pressing OK button after 8 seconds
|
* Close game window by pressing OK button after 8 seconds
|
||||||
*/
|
*/
|
||||||
private void endWithTimeout() {
|
private void endWithTimeout() {
|
||||||
Runnable task = new Runnable() {
|
Runnable task = () -> {
|
||||||
@Override
|
LOGGER.info("Ending game...");
|
||||||
public void run() {
|
Component c = MageFrame.getGame(gameId);
|
||||||
LOGGER.info("Ending game...");
|
while (c != null && !(c instanceof GamePane)) {
|
||||||
Component c = MageFrame.getGame(gameId);
|
c = c.getParent();
|
||||||
while (c != null && !(c instanceof GamePane)) {
|
}
|
||||||
c = c.getParent();
|
if (c != null && c.isVisible()) { // check if GamePanel still visible
|
||||||
}
|
FeedbackPanel.this.btnRight.doClick();
|
||||||
if (c != null && ((GamePane) c).isVisible()) { // check if GamePanel still visible
|
|
||||||
FeedbackPanel.this.btnRight.doClick();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
WORKER.schedule(task, 8, TimeUnit.SECONDS);
|
WORKER.schedule(task, 8, TimeUnit.SECONDS);
|
||||||
|
@ -255,36 +251,16 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
||||||
setBackground(new java.awt.Color(0, 0, 0, 80));
|
setBackground(new java.awt.Color(0, 0, 0, 80));
|
||||||
|
|
||||||
btnRight.setText("Cancel");
|
btnRight.setText("Cancel");
|
||||||
btnRight.addActionListener(new java.awt.event.ActionListener() {
|
btnRight.addActionListener(evt -> btnRightActionPerformed(evt));
|
||||||
@Override
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnRightActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnLeft.setText("OK");
|
btnLeft.setText("OK");
|
||||||
btnLeft.addActionListener(new java.awt.event.ActionListener() {
|
btnLeft.addActionListener(evt -> btnLeftActionPerformed(evt));
|
||||||
@Override
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnLeftActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnSpecial.setText("Special");
|
btnSpecial.setText("Special");
|
||||||
btnSpecial.addActionListener(new java.awt.event.ActionListener() {
|
btnSpecial.addActionListener(evt -> btnSpecialActionPerformed(evt));
|
||||||
@Override
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnSpecialActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnUndo.setText("Undo");
|
btnUndo.setText("Undo");
|
||||||
btnUndo.addActionListener(new java.awt.event.ActionListener() {
|
btnUndo.addActionListener(evt -> btnUndoActionPerformed(evt));
|
||||||
@Override
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnUndoActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,12 +50,9 @@ public class GamePane extends MagePane {
|
||||||
public GamePane() {
|
public GamePane() {
|
||||||
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
|
||||||
initComponents();
|
initComponents();
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> {
|
||||||
@Override
|
gamePanel.setJLayeredPane(getLayeredPane());
|
||||||
public void run() {
|
gamePanel.installComponents();
|
||||||
gamePanel.setJLayeredPane(getLayeredPane());
|
|
||||||
gamePanel.installComponents();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@ import java.awt.AWTEvent;
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import static java.awt.Component.LEFT_ALIGNMENT;
|
|
||||||
import java.awt.Container;
|
import java.awt.Container;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
|
@ -53,7 +52,6 @@ import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -263,20 +261,12 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
resizeTimer = new Timer(1000, new ActionListener() {
|
resizeTimer = new Timer(1000, evt -> SwingUtilities.invokeLater(() -> {
|
||||||
@Override
|
resizeTimer.stop();
|
||||||
public void actionPerformed(ActionEvent evt) {
|
setGUISize();
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
feedbackPanel.changeGUISize();
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
resizeTimer.stop();
|
|
||||||
setGUISize();
|
|
||||||
feedbackPanel.changeGUISize();
|
|
||||||
|
|
||||||
}
|
}));
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
pnlHelperHandButtonsStackArea.addComponentListener(componentAdapterPlayField);
|
pnlHelperHandButtonsStackArea.addComponentListener(componentAdapterPlayField);
|
||||||
initComponents = false;
|
initComponents = false;
|
||||||
|
@ -1124,12 +1114,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
private void removeClosedCardInfoWindows(Map<String, CardInfoWindowDialog> windowMap) {
|
private void removeClosedCardInfoWindows(Map<String, CardInfoWindowDialog> windowMap) {
|
||||||
// Remove closed window objects from the maps
|
// Remove closed window objects from the maps
|
||||||
for (Iterator<Map.Entry<String, CardInfoWindowDialog>> iterator = windowMap.entrySet().iterator(); iterator.hasNext();) {
|
windowMap.entrySet().removeIf(entry -> entry.getValue().isClosed());
|
||||||
Map.Entry<String, CardInfoWindowDialog> entry = iterator.next();
|
|
||||||
if (entry.getValue().isClosed()) {
|
|
||||||
iterator.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ask(String question, GameView gameView, int messageId, Map<String, Serializable> options) {
|
public void ask(String question, GameView gameView, int messageId, Map<String, Serializable> options) {
|
||||||
|
@ -1700,20 +1685,10 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
final BasicSplitPaneUI myUi = (BasicSplitPaneUI) jSplitPane0.getUI();
|
final BasicSplitPaneUI myUi = (BasicSplitPaneUI) jSplitPane0.getUI();
|
||||||
final BasicSplitPaneDivider divider = myUi.getDivider();
|
final BasicSplitPaneDivider divider = myUi.getDivider();
|
||||||
final JButton upArrowButton = (JButton) divider.getComponent(0);
|
final JButton upArrowButton = (JButton) divider.getComponent(0);
|
||||||
upArrowButton.addActionListener(new ActionListener() {
|
upArrowButton.addActionListener(actionEvent -> PreferencesDialog.saveValue(PreferencesDialog.KEY_BIG_CARD_TOGGLED, "up"));
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent actionEvent) {
|
|
||||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_BIG_CARD_TOGGLED, "up");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
final JButton downArrowButton = (JButton) divider.getComponent(1);
|
final JButton downArrowButton = (JButton) divider.getComponent(1);
|
||||||
downArrowButton.addActionListener(new ActionListener() {
|
downArrowButton.addActionListener(actionEvent -> PreferencesDialog.saveValue(PreferencesDialog.KEY_BIG_CARD_TOGGLED, "down"));
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent actionEvent) {
|
|
||||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_BIG_CARD_TOGGLED, "down");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
KeyStroke ksAltEReleased = KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.ALT_MASK, true);
|
KeyStroke ksAltEReleased = KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.ALT_MASK, true);
|
||||||
this.getInputMap(c).put(ksAltEReleased, "ENLARGE_RELEASE");
|
this.getInputMap(c).put(ksAltEReleased, "ENLARGE_RELEASE");
|
||||||
|
@ -1772,44 +1747,19 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
stackObjects.setBackgroundColor(new Color(0, 0, 0, 40));
|
stackObjects.setBackgroundColor(new Color(0, 0, 0, 40));
|
||||||
|
|
||||||
btnStopReplay.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/control_stop.png")));
|
btnStopReplay.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/control_stop.png")));
|
||||||
btnStopReplay.addActionListener(new java.awt.event.ActionListener() {
|
btnStopReplay.addActionListener(evt -> btnStopReplayActionPerformed(evt));
|
||||||
@Override
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnStopReplayActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnNextPlay.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/control_stop_right.png")));
|
btnNextPlay.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/control_stop_right.png")));
|
||||||
btnNextPlay.addActionListener(new java.awt.event.ActionListener() {
|
btnNextPlay.addActionListener(evt -> btnNextPlayActionPerformed(evt));
|
||||||
@Override
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnNextPlayActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnPlay.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/control_right.png")));
|
btnPlay.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/control_right.png")));
|
||||||
btnPlay.addActionListener(new java.awt.event.ActionListener() {
|
btnPlay.addActionListener(evt -> btnPlayActionPerformed(evt));
|
||||||
@Override
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnPlayActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnSkipForward.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/control_double_stop_right.png")));
|
btnSkipForward.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/control_double_stop_right.png")));
|
||||||
btnSkipForward.addActionListener(new java.awt.event.ActionListener() {
|
btnSkipForward.addActionListener(evt -> btnSkipForwardActionPerformed(evt));
|
||||||
@Override
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnSkipForwardActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnPreviousPlay.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/control_stop_left.png")));
|
btnPreviousPlay.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/control_stop_left.png")));
|
||||||
btnPreviousPlay.addActionListener(new java.awt.event.ActionListener() {
|
btnPreviousPlay.addActionListener(evt -> btnPreviousPlayActionPerformed(evt));
|
||||||
@Override
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnPreviousPlayActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
initPopupMenuTriggerOrder();
|
initPopupMenuTriggerOrder();
|
||||||
|
|
||||||
|
@ -2251,21 +2201,18 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
// Event listener for the ShowCardsDialog
|
// Event listener for the ShowCardsDialog
|
||||||
private Listener<Event> getShowCardsEventListener(final ShowCardsDialog dialog) {
|
private Listener<Event> getShowCardsEventListener(final ShowCardsDialog dialog) {
|
||||||
return new Listener<Event>() {
|
return (Listener<Event>) event -> {
|
||||||
@Override
|
if (event.getEventName().equals("show-popup-menu")) {
|
||||||
public void event(Event event) {
|
if (event.getComponent() != null && event.getComponent() instanceof CardPanel) {
|
||||||
if (event.getEventName().equals("show-popup-menu")) {
|
JPopupMenu menu = ((CardPanel) event.getComponent()).getPopupMenu();
|
||||||
if (event.getComponent() != null && event.getComponent() instanceof CardPanel) {
|
if (menu != null) {
|
||||||
JPopupMenu menu = ((CardPanel) event.getComponent()).getPopupMenu();
|
cardViewPopupMenu = ((CardView) event.getSource());
|
||||||
if (menu != null) {
|
menu.show(event.getComponent(), event.getxPos(), event.getyPos());
|
||||||
cardViewPopupMenu = ((CardView) event.getSource());
|
|
||||||
menu.show(event.getComponent(), event.getxPos(), event.getyPos());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event.getEventName().equals("action-consumed")) {
|
}
|
||||||
dialog.removeDialog();
|
if (event.getEventName().equals("action-consumed")) {
|
||||||
}
|
dialog.removeDialog();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -2312,12 +2259,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
private void initPopupMenuTriggerOrder() {
|
private void initPopupMenuTriggerOrder() {
|
||||||
|
|
||||||
ActionListener actionListener = new ActionListener() {
|
ActionListener actionListener = e -> handleTriggerOrderPopupMenuEvent(e);
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
handleTriggerOrderPopupMenuEvent(e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
popupMenuTriggerOrder = new JPopupMenu();
|
popupMenuTriggerOrder = new JPopupMenu();
|
||||||
|
|
||||||
|
@ -2366,7 +2308,7 @@ public final class GamePanel extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use Cmd on OSX since Ctrl+click is already used to simulate right click
|
// Use Cmd on OSX since Ctrl+click is already used to simulate right click
|
||||||
private static int holdPriorityMask = System.getProperty("os.name").contains("Mac OS X") ? InputEvent.META_DOWN_MASK : InputEvent.CTRL_DOWN_MASK;
|
private static final int holdPriorityMask = System.getProperty("os.name").contains("Mac OS X") ? InputEvent.META_DOWN_MASK : InputEvent.CTRL_DOWN_MASK;
|
||||||
|
|
||||||
public void handleEvent(AWTEvent event) {
|
public void handleEvent(AWTEvent event) {
|
||||||
if (event instanceof InputEvent) {
|
if (event instanceof InputEvent) {
|
||||||
|
|
|
@ -48,7 +48,7 @@ import javax.swing.ScrollPaneConstants;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.ToolTipManager;
|
import javax.swing.ToolTipManager;
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
import mage.client.MageFrame;
|
|
||||||
import mage.client.SessionHandler;
|
import mage.client.SessionHandler;
|
||||||
import mage.client.components.MageTextArea;
|
import mage.client.components.MageTextArea;
|
||||||
import mage.client.game.FeedbackPanel.FeedbackMode;
|
import mage.client.game.FeedbackPanel.FeedbackMode;
|
||||||
|
@ -59,7 +59,6 @@ import static mage.constants.PlayerAction.REQUEST_AUTO_ANSWER_ID_YES;
|
||||||
import static mage.constants.PlayerAction.REQUEST_AUTO_ANSWER_RESET_ALL;
|
import static mage.constants.PlayerAction.REQUEST_AUTO_ANSWER_RESET_ALL;
|
||||||
import static mage.constants.PlayerAction.REQUEST_AUTO_ANSWER_TEXT_NO;
|
import static mage.constants.PlayerAction.REQUEST_AUTO_ANSWER_TEXT_NO;
|
||||||
import static mage.constants.PlayerAction.REQUEST_AUTO_ANSWER_TEXT_YES;
|
import static mage.constants.PlayerAction.REQUEST_AUTO_ANSWER_TEXT_YES;
|
||||||
import mage.remote.Session;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Panel with buttons that copy the state of feedback panel.
|
* Panel with buttons that copy the state of feedback panel.
|
||||||
|
@ -200,52 +199,30 @@ public class HelperPanel extends JPanel {
|
||||||
};
|
};
|
||||||
|
|
||||||
btnLeft.addMouseListener(checkPopupAdapter);
|
btnLeft.addMouseListener(checkPopupAdapter);
|
||||||
btnLeft.addActionListener(new ActionListener() {
|
btnLeft.addActionListener(evt -> {
|
||||||
@Override
|
if (linkLeft != null) {
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
clickButton(linkLeft);
|
||||||
if (linkLeft != null) {
|
|
||||||
clickButton(linkLeft);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
btnRight.addMouseListener(checkPopupAdapter);
|
btnRight.addMouseListener(checkPopupAdapter);
|
||||||
btnRight.addActionListener(new ActionListener() {
|
btnRight.addActionListener(evt -> {
|
||||||
@Override
|
if (linkRight != null) {
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
clickButton(linkRight);
|
||||||
if (linkRight != null) {
|
|
||||||
clickButton(linkRight);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
btnSpecial.addActionListener(new ActionListener() {
|
btnSpecial.addActionListener(evt -> {
|
||||||
@Override
|
if (linkSpecial != null) {
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
clickButton(linkSpecial);
|
||||||
if (linkSpecial != null) {
|
|
||||||
clickButton(linkSpecial);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
btnUndo.addActionListener(new java.awt.event.ActionListener() {
|
btnUndo.addActionListener(evt -> {
|
||||||
@Override
|
if (linkUndo != null) {
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
{
|
||||||
if (linkUndo != null) {
|
Thread worker = new Thread(() -> SwingUtilities.invokeLater(() -> linkUndo.doClick()));
|
||||||
{
|
worker.start();
|
||||||
Thread worker = new Thread() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
linkUndo.doClick();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
worker.start();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -279,19 +256,11 @@ public class HelperPanel extends JPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clickButton(final JButton button) {
|
private void clickButton(final JButton button) {
|
||||||
Thread worker = new Thread() {
|
Thread worker = new Thread(() -> SwingUtilities.invokeLater(() -> {
|
||||||
@Override
|
setState("", false, "", false, null);
|
||||||
public void run() {
|
setSpecial("", false);
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
button.doClick();
|
||||||
@Override
|
}));
|
||||||
public void run() {
|
|
||||||
setState("", false, "", false, null);
|
|
||||||
setSpecial("", false);
|
|
||||||
button.doClick();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
worker.start();
|
worker.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,12 +332,7 @@ public class HelperPanel extends JPanel {
|
||||||
|
|
||||||
private void initPopupMenuTriggerOrder() {
|
private void initPopupMenuTriggerOrder() {
|
||||||
|
|
||||||
ActionListener actionListener = new ActionListener() {
|
ActionListener actionListener = e -> handleAutoAnswerPopupMenuEvent(e);
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
handleAutoAnswerPopupMenuEvent(e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
popupMenuAskYes = new JPopupMenu();
|
popupMenuAskYes = new JPopupMenu();
|
||||||
popupMenuAskNo = new JPopupMenu();
|
popupMenuAskNo = new JPopupMenu();
|
||||||
|
|
|
@ -29,7 +29,6 @@ package mage.client.game;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
|
@ -158,44 +157,41 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
JMenuItem menuItem;
|
JMenuItem menuItem;
|
||||||
|
|
||||||
ActionListener skipListener = new ActionListener() {
|
ActionListener skipListener = e -> {
|
||||||
@Override
|
switch (e.getActionCommand()) {
|
||||||
public void actionPerformed(ActionEvent e) {
|
case "F2": {
|
||||||
switch (e.getActionCommand()) {
|
if (gamePanel.getFeedbackPanel() != null) {
|
||||||
case "F2": {
|
gamePanel.getFeedbackPanel().pressOKYesOrDone();
|
||||||
if (gamePanel.getFeedbackPanel() != null) {
|
|
||||||
gamePanel.getFeedbackPanel().pressOKYesOrDone();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "F3": {
|
|
||||||
SessionHandler.sendPlayerAction(PlayerAction.PASS_PRIORITY_CANCEL_ALL_ACTIONS, gameId, null);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "F4": {
|
|
||||||
SessionHandler.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_NEXT_TURN, gameId, null);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "F5": {
|
|
||||||
SessionHandler.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_TURN_END_STEP, gameId, null);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "F6": {
|
|
||||||
SessionHandler.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_NEXT_TURN_SKIP_STACK, gameId, null);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "F7": {
|
|
||||||
SessionHandler.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_NEXT_MAIN_PHASE, gameId, null);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "F9": {
|
|
||||||
SessionHandler.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_MY_NEXT_TURN, gameId, null);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "F11": {
|
|
||||||
SessionHandler.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_END_STEP_BEFORE_MY_NEXT_TURN, gameId, null);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "F3": {
|
||||||
|
SessionHandler.sendPlayerAction(PlayerAction.PASS_PRIORITY_CANCEL_ALL_ACTIONS, gameId, null);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "F4": {
|
||||||
|
SessionHandler.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_NEXT_TURN, gameId, null);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "F5": {
|
||||||
|
SessionHandler.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_TURN_END_STEP, gameId, null);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "F6": {
|
||||||
|
SessionHandler.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_NEXT_TURN_SKIP_STACK, gameId, null);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "F7": {
|
||||||
|
SessionHandler.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_NEXT_MAIN_PHASE, gameId, null);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "F9": {
|
||||||
|
SessionHandler.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_MY_NEXT_TURN, gameId, null);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "F11": {
|
||||||
|
SessionHandler.sendPlayerAction(PlayerAction.PASS_PRIORITY_UNTIL_END_STEP_BEFORE_MY_NEXT_TURN, gameId, null);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -216,13 +212,10 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
holdPriorityMenuItem.setMnemonic(KeyEvent.VK_P);
|
holdPriorityMenuItem.setMnemonic(KeyEvent.VK_P);
|
||||||
holdPriorityMenuItem.setToolTipText("<html>Hold priority after casting a spell or activating an ability, instead of automatically passing priority.");
|
holdPriorityMenuItem.setToolTipText("<html>Hold priority after casting a spell or activating an ability, instead of automatically passing priority.");
|
||||||
popupMenu.add(holdPriorityMenuItem);
|
popupMenu.add(holdPriorityMenuItem);
|
||||||
holdPriorityMenuItem.addActionListener(new ActionListener() {
|
holdPriorityMenuItem.addActionListener(e -> {
|
||||||
@Override
|
boolean holdPriority = ((JCheckBoxMenuItem) e.getSource()).getState();
|
||||||
public void actionPerformed(ActionEvent e) {
|
gamePanel.setMenuStates(manaPoolMenuItem1.getState(), manaPoolMenuItem2.getState(), useFirstManaAbilityItem.getState(), holdPriority);
|
||||||
boolean holdPriority = ((JCheckBoxMenuItem) e.getSource()).getState();
|
gamePanel.holdPriority(holdPriority);
|
||||||
gamePanel.setMenuStates(manaPoolMenuItem1.getState(), manaPoolMenuItem2.getState(), useFirstManaAbilityItem.getState(), holdPriority);
|
|
||||||
gamePanel.holdPriority(holdPriority);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
JMenu skipMenu = new JMenu("Skip");
|
JMenu skipMenu = new JMenu("Skip");
|
||||||
|
@ -287,14 +280,11 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
manaPoolMenu.add(manaPoolMenuItem1);
|
manaPoolMenu.add(manaPoolMenuItem1);
|
||||||
|
|
||||||
// Auto pay mana from mana pool
|
// Auto pay mana from mana pool
|
||||||
manaPoolMenuItem1.addActionListener(new ActionListener() {
|
manaPoolMenuItem1.addActionListener(e -> {
|
||||||
@Override
|
boolean manaPoolAutomatic = ((JCheckBoxMenuItem) e.getSource()).getState();
|
||||||
public void actionPerformed(ActionEvent e) {
|
PreferencesDialog.saveValue(KEY_GAME_MANA_AUTOPAYMENT, manaPoolAutomatic ? "true" : "false");
|
||||||
boolean manaPoolAutomatic = ((JCheckBoxMenuItem) e.getSource()).getState();
|
gamePanel.setMenuStates(manaPoolAutomatic, manaPoolMenuItem2.getState(), useFirstManaAbilityItem.getState(), holdPriorityMenuItem.getState());
|
||||||
PreferencesDialog.saveValue(KEY_GAME_MANA_AUTOPAYMENT, manaPoolAutomatic ? "true" : "false");
|
SessionHandler.sendPlayerAction(manaPoolAutomatic ? PlayerAction.MANA_AUTO_PAYMENT_ON : PlayerAction.MANA_AUTO_PAYMENT_OFF, gameId, null);
|
||||||
gamePanel.setMenuStates(manaPoolAutomatic, manaPoolMenuItem2.getState(), useFirstManaAbilityItem.getState(), holdPriorityMenuItem.getState());
|
|
||||||
SessionHandler.sendPlayerAction(manaPoolAutomatic ? PlayerAction.MANA_AUTO_PAYMENT_ON : PlayerAction.MANA_AUTO_PAYMENT_OFF, gameId, null);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
manaPoolMenuItem2 = new JCheckBoxMenuItem("No automatic usage for mana already in the pool", true);
|
manaPoolMenuItem2 = new JCheckBoxMenuItem("No automatic usage for mana already in the pool", true);
|
||||||
|
@ -305,14 +295,11 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
manaPoolMenu.add(manaPoolMenuItem2);
|
manaPoolMenu.add(manaPoolMenuItem2);
|
||||||
|
|
||||||
// Auto pay mana from mana pool
|
// Auto pay mana from mana pool
|
||||||
manaPoolMenuItem2.addActionListener(new ActionListener() {
|
manaPoolMenuItem2.addActionListener(e -> {
|
||||||
@Override
|
boolean manaPoolAutomaticRestricted = ((JCheckBoxMenuItem) e.getSource()).getState();
|
||||||
public void actionPerformed(ActionEvent e) {
|
PreferencesDialog.saveValue(KEY_GAME_MANA_AUTOPAYMENT_ONLY_ONE, manaPoolAutomaticRestricted ? "true" : "false");
|
||||||
boolean manaPoolAutomaticRestricted = ((JCheckBoxMenuItem) e.getSource()).getState();
|
gamePanel.setMenuStates(manaPoolMenuItem1.getState(), manaPoolAutomaticRestricted, useFirstManaAbilityItem.getState(), holdPriorityMenuItem.getState());
|
||||||
PreferencesDialog.saveValue(KEY_GAME_MANA_AUTOPAYMENT_ONLY_ONE, manaPoolAutomaticRestricted ? "true" : "false");
|
SessionHandler.sendPlayerAction(manaPoolAutomaticRestricted ? PlayerAction.MANA_AUTO_PAYMENT_RESTRICTED_ON : PlayerAction.MANA_AUTO_PAYMENT_RESTRICTED_OFF, gameId, null);
|
||||||
gamePanel.setMenuStates(manaPoolMenuItem1.getState(), manaPoolAutomaticRestricted, useFirstManaAbilityItem.getState(), holdPriorityMenuItem.getState());
|
|
||||||
SessionHandler.sendPlayerAction(manaPoolAutomaticRestricted ? PlayerAction.MANA_AUTO_PAYMENT_RESTRICTED_ON : PlayerAction.MANA_AUTO_PAYMENT_RESTRICTED_OFF, gameId, null);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
useFirstManaAbilityItem = new JCheckBoxMenuItem("Use first mana ability when tapping lands", false);
|
useFirstManaAbilityItem = new JCheckBoxMenuItem("Use first mana ability when tapping lands", false);
|
||||||
|
@ -323,14 +310,11 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
manaPoolMenu.add(useFirstManaAbilityItem);
|
manaPoolMenu.add(useFirstManaAbilityItem);
|
||||||
|
|
||||||
// Use first mana ability of lands
|
// Use first mana ability of lands
|
||||||
useFirstManaAbilityItem.addActionListener(new ActionListener() {
|
useFirstManaAbilityItem.addActionListener(e -> {
|
||||||
@Override
|
boolean useFirstManaAbility = ((JCheckBoxMenuItem) e.getSource()).getState();
|
||||||
public void actionPerformed(ActionEvent e) {
|
PreferencesDialog.saveValue(KEY_USE_FIRST_MANA_ABILITY, useFirstManaAbility ? "true" : "false");
|
||||||
boolean useFirstManaAbility = ((JCheckBoxMenuItem) e.getSource()).getState();
|
gamePanel.setMenuStates(manaPoolMenuItem1.getState(), manaPoolMenuItem2.getState(), useFirstManaAbility, holdPriorityMenuItem.getState());
|
||||||
PreferencesDialog.saveValue(KEY_USE_FIRST_MANA_ABILITY, useFirstManaAbility ? "true" : "false");
|
SessionHandler.sendPlayerAction(useFirstManaAbility ? PlayerAction.USE_FIRST_MANA_ABILITY_ON : PlayerAction.USE_FIRST_MANA_ABILITY_OFF, gameId, null);
|
||||||
gamePanel.setMenuStates(manaPoolMenuItem1.getState(), manaPoolMenuItem2.getState(), useFirstManaAbility, holdPriorityMenuItem.getState());
|
|
||||||
SessionHandler.sendPlayerAction(useFirstManaAbility ? PlayerAction.USE_FIRST_MANA_ABILITY_ON : PlayerAction.USE_FIRST_MANA_ABILITY_OFF, gameId, null);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
JMenu automaticConfirmsMenu = new JMenu("Automatic confirms");
|
JMenu automaticConfirmsMenu = new JMenu("Automatic confirms");
|
||||||
|
@ -342,36 +326,21 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
menuItem.setToolTipText("Reset all effects that were added to the list of auto select replacement effects this game.");
|
menuItem.setToolTipText("Reset all effects that were added to the list of auto select replacement effects this game.");
|
||||||
automaticConfirmsMenu.add(menuItem);
|
automaticConfirmsMenu.add(menuItem);
|
||||||
// Reset the replacement effcts that were auto selected for the game
|
// Reset the replacement effcts that were auto selected for the game
|
||||||
menuItem.addActionListener(new ActionListener() {
|
menuItem.addActionListener(e -> SessionHandler.sendPlayerAction(PlayerAction.RESET_AUTO_SELECT_REPLACEMENT_EFFECTS, gameId, null));
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
SessionHandler.sendPlayerAction(PlayerAction.RESET_AUTO_SELECT_REPLACEMENT_EFFECTS, gameId, null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
menuItem = new JMenuItem("Triggered abilities - reset auto stack order");
|
menuItem = new JMenuItem("Triggered abilities - reset auto stack order");
|
||||||
menuItem.setMnemonic(KeyEvent.VK_T);
|
menuItem.setMnemonic(KeyEvent.VK_T);
|
||||||
menuItem.setToolTipText("Deletes all triggered ability order settings you added during the game.");
|
menuItem.setToolTipText("Deletes all triggered ability order settings you added during the game.");
|
||||||
automaticConfirmsMenu.add(menuItem);
|
automaticConfirmsMenu.add(menuItem);
|
||||||
// Reset the replacement effcts that were auto selected for the game
|
// Reset the replacement effcts that were auto selected for the game
|
||||||
menuItem.addActionListener(new ActionListener() {
|
menuItem.addActionListener(e -> SessionHandler.sendPlayerAction(PlayerAction.TRIGGER_AUTO_ORDER_RESET_ALL, gameId, null));
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
SessionHandler.sendPlayerAction(PlayerAction.TRIGGER_AUTO_ORDER_RESET_ALL, gameId, null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
menuItem = new JMenuItem("Use requests - reset automatic answers");
|
menuItem = new JMenuItem("Use requests - reset automatic answers");
|
||||||
menuItem.setMnemonic(KeyEvent.VK_T);
|
menuItem.setMnemonic(KeyEvent.VK_T);
|
||||||
menuItem.setToolTipText("Deletes all defined automatic answers for Yes/No usage requests.");
|
menuItem.setToolTipText("Deletes all defined automatic answers for Yes/No usage requests.");
|
||||||
automaticConfirmsMenu.add(menuItem);
|
automaticConfirmsMenu.add(menuItem);
|
||||||
// Reset the replacement effcts that were auto selected for the game
|
// Reset the replacement effcts that were auto selected for the game
|
||||||
menuItem.addActionListener(new ActionListener() {
|
menuItem.addActionListener(e -> SessionHandler.sendPlayerAction(PlayerAction.REQUEST_AUTO_ANSWER_RESET_ALL, gameId, null));
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
SessionHandler.sendPlayerAction(PlayerAction.REQUEST_AUTO_ANSWER_RESET_ALL, gameId, null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
JMenu handCardsMenu = new JMenu("Cards on hand");
|
JMenu handCardsMenu = new JMenu("Cards on hand");
|
||||||
handCardsMenu.setMnemonic(KeyEvent.VK_H);
|
handCardsMenu.setMnemonic(KeyEvent.VK_H);
|
||||||
|
@ -383,12 +352,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
handCardsMenu.add(menuItem);
|
handCardsMenu.add(menuItem);
|
||||||
|
|
||||||
// Request to see hand cards
|
// Request to see hand cards
|
||||||
menuItem.addActionListener(new ActionListener() {
|
menuItem.addActionListener(e -> SessionHandler.sendPlayerAction(PlayerAction.REQUEST_PERMISSION_TO_SEE_HAND_CARDS, gameId, playerId));
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
SessionHandler.sendPlayerAction(PlayerAction.REQUEST_PERMISSION_TO_SEE_HAND_CARDS, gameId, playerId);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
allowViewHandCardsMenuItem = new JCheckBoxMenuItem("Allow requests to show from other users", allowRequestToShowHandCards);
|
allowViewHandCardsMenuItem = new JCheckBoxMenuItem("Allow requests to show from other users", allowRequestToShowHandCards);
|
||||||
allowViewHandCardsMenuItem.setMnemonic(KeyEvent.VK_A);
|
allowViewHandCardsMenuItem.setMnemonic(KeyEvent.VK_A);
|
||||||
|
@ -396,13 +360,10 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
handCardsMenu.add(allowViewHandCardsMenuItem);
|
handCardsMenu.add(allowViewHandCardsMenuItem);
|
||||||
|
|
||||||
// Requests allowed
|
// Requests allowed
|
||||||
allowViewHandCardsMenuItem.addActionListener(new ActionListener() {
|
allowViewHandCardsMenuItem.addActionListener(e -> {
|
||||||
@Override
|
boolean requestsAllowed = ((JCheckBoxMenuItem) e.getSource()).getState();
|
||||||
public void actionPerformed(ActionEvent e) {
|
PreferencesDialog.setPrefValue(KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, requestsAllowed);
|
||||||
boolean requestsAllowed = ((JCheckBoxMenuItem) e.getSource()).getState();
|
SessionHandler.sendPlayerAction(requestsAllowed ? PlayerAction.PERMISSION_REQUESTS_ALLOWED_ON : PlayerAction.PERMISSION_REQUESTS_ALLOWED_OFF, gameId, null);
|
||||||
PreferencesDialog.setPrefValue(KEY_GAME_ALLOW_REQUEST_SHOW_HAND_CARDS, requestsAllowed);
|
|
||||||
SessionHandler.sendPlayerAction(requestsAllowed ? PlayerAction.PERMISSION_REQUESTS_ALLOWED_ON : PlayerAction.PERMISSION_REQUESTS_ALLOWED_OFF, gameId, null);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
menuItem = new JMenuItem("Revoke all permission(s) to see your hand cards");
|
menuItem = new JMenuItem("Revoke all permission(s) to see your hand cards");
|
||||||
|
@ -411,21 +372,13 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
handCardsMenu.add(menuItem);
|
handCardsMenu.add(menuItem);
|
||||||
|
|
||||||
// revoke permissions to see hand cards
|
// revoke permissions to see hand cards
|
||||||
menuItem.addActionListener(new ActionListener() {
|
menuItem.addActionListener(e -> SessionHandler.sendPlayerAction(PlayerAction.REVOKE_PERMISSIONS_TO_SEE_HAND_CARDS, gameId, null));
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
SessionHandler.sendPlayerAction(PlayerAction.REVOKE_PERMISSIONS_TO_SEE_HAND_CARDS, gameId, null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.rollbackTurnsAllowed) {
|
if (options.rollbackTurnsAllowed) {
|
||||||
ActionListener rollBackActionListener = new ActionListener() {
|
ActionListener rollBackActionListener = e -> {
|
||||||
@Override
|
int turnsToRollBack = Integer.parseInt(e.getActionCommand());
|
||||||
public void actionPerformed(ActionEvent e) {
|
SessionHandler.sendPlayerAction(PlayerAction.ROLLBACK_TURNS, gameId, turnsToRollBack);
|
||||||
int turnsToRollBack = Integer.parseInt(e.getActionCommand());
|
|
||||||
SessionHandler.sendPlayerAction(PlayerAction.ROLLBACK_TURNS, gameId, turnsToRollBack);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
JMenu rollbackMainItem = new JMenu("Rollback");
|
JMenu rollbackMainItem = new JMenu("Rollback");
|
||||||
|
@ -463,26 +416,23 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
concedeMenu.setMnemonic(KeyEvent.VK_C);
|
concedeMenu.setMnemonic(KeyEvent.VK_C);
|
||||||
popupMenu.add(concedeMenu);
|
popupMenu.add(concedeMenu);
|
||||||
|
|
||||||
ActionListener concedeListener = new ActionListener() {
|
ActionListener concedeListener = e -> {
|
||||||
@Override
|
switch (e.getActionCommand()) {
|
||||||
public void actionPerformed(ActionEvent e) {
|
case "Game": {
|
||||||
switch (e.getActionCommand()) {
|
UserRequestMessage message = new UserRequestMessage("Confirm concede game", "Are you sure you want to concede the game?");
|
||||||
case "Game": {
|
message.setButton1("No", null);
|
||||||
UserRequestMessage message = new UserRequestMessage("Confirm concede game", "Are you sure you want to concede the game?");
|
message.setButton2("Yes", PlayerAction.CLIENT_CONCEDE_GAME);
|
||||||
message.setButton1("No", null);
|
message.setGameId(gameId);
|
||||||
message.setButton2("Yes", PlayerAction.CLIENT_CONCEDE_GAME);
|
MageFrame.getInstance().showUserRequestDialog(message);
|
||||||
message.setGameId(gameId);
|
break;
|
||||||
MageFrame.getInstance().showUserRequestDialog(message);
|
}
|
||||||
break;
|
case "Match": {
|
||||||
}
|
UserRequestMessage message = new UserRequestMessage("Confirm concede match", "Are you sure you want to concede the complete match?");
|
||||||
case "Match": {
|
message.setButton1("No", null);
|
||||||
UserRequestMessage message = new UserRequestMessage("Confirm concede match", "Are you sure you want to concede the complete match?");
|
message.setButton2("Yes", PlayerAction.CLIENT_CONCEDE_MATCH);
|
||||||
message.setButton1("No", null);
|
message.setGameId(gameId);
|
||||||
message.setButton2("Yes", PlayerAction.CLIENT_CONCEDE_MATCH);
|
MageFrame.getInstance().showUserRequestDialog(message);
|
||||||
message.setGameId(gameId);
|
break;
|
||||||
MageFrame.getInstance().showUserRequestDialog(message);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -531,27 +481,19 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
popupMenu.add(menuItem);
|
popupMenu.add(menuItem);
|
||||||
|
|
||||||
// Stop watching
|
// Stop watching
|
||||||
menuItem.addActionListener(new ActionListener() {
|
menuItem.addActionListener(e -> {
|
||||||
@Override
|
UserRequestMessage message = new UserRequestMessage("Confirm stop watching game", "Are you sure you want to stop watching the game?");
|
||||||
public void actionPerformed(ActionEvent e) {
|
message.setButton1("No", null);
|
||||||
UserRequestMessage message = new UserRequestMessage("Confirm stop watching game", "Are you sure you want to stop watching the game?");
|
message.setButton2("Yes", PlayerAction.CLIENT_STOP_WATCHING);
|
||||||
message.setButton1("No", null);
|
message.setGameId(gameId);
|
||||||
message.setButton2("Yes", PlayerAction.CLIENT_STOP_WATCHING);
|
MageFrame.getInstance().showUserRequestDialog(message);
|
||||||
message.setGameId(gameId);
|
|
||||||
MageFrame.getInstance().showUserRequestDialog(message);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
menuItem = new JMenuItem("Request permission to see hand cards");
|
menuItem = new JMenuItem("Request permission to see hand cards");
|
||||||
popupMenu.add(menuItem);
|
popupMenu.add(menuItem);
|
||||||
|
|
||||||
// Request to see hand cards
|
// Request to see hand cards
|
||||||
menuItem.addActionListener(new ActionListener() {
|
menuItem.addActionListener(e -> SessionHandler.sendPlayerAction(PlayerAction.REQUEST_PERMISSION_TO_SEE_HAND_CARDS, gameId, playerId));
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
SessionHandler.sendPlayerAction(PlayerAction.REQUEST_PERMISSION_TO_SEE_HAND_CARDS, gameId, playerId);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
battlefieldPanel.getMainPanel().addMouseListener(new MouseAdapter() {
|
battlefieldPanel.getMainPanel().addMouseListener(new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -610,12 +552,7 @@ public class PlayAreaPanel extends javax.swing.JPanel {
|
||||||
battlefieldPanel.setTopPanelBattlefield(options.topRow);
|
battlefieldPanel.setTopPanelBattlefield(options.topRow);
|
||||||
|
|
||||||
btnCheat.setText("Cheat");
|
btnCheat.setText("Cheat");
|
||||||
btnCheat.addActionListener(new java.awt.event.ActionListener() {
|
btnCheat.addActionListener(evt -> btnCheatActionPerformed(evt));
|
||||||
@Override
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnCheatActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
|
|
|
@ -38,8 +38,6 @@ import java.awt.Dimension;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
|
@ -58,7 +56,7 @@ import javax.swing.LayoutStyle.ComponentPlacement;
|
||||||
import javax.swing.SwingConstants;
|
import javax.swing.SwingConstants;
|
||||||
import javax.swing.border.Border;
|
import javax.swing.border.Border;
|
||||||
import javax.swing.border.LineBorder;
|
import javax.swing.border.LineBorder;
|
||||||
import mage.MageException;
|
|
||||||
import mage.cards.decks.importer.DckDeckImporter;
|
import mage.cards.decks.importer.DckDeckImporter;
|
||||||
import mage.client.MageFrame;
|
import mage.client.MageFrame;
|
||||||
import mage.client.SessionHandler;
|
import mage.client.SessionHandler;
|
||||||
|
@ -68,7 +66,6 @@ import mage.client.components.MageRoundPane;
|
||||||
import mage.client.components.ext.dlg.DialogManager;
|
import mage.client.components.ext.dlg.DialogManager;
|
||||||
import mage.client.dialog.PreferencesDialog;
|
import mage.client.dialog.PreferencesDialog;
|
||||||
import mage.client.util.CardsViewUtil;
|
import mage.client.util.CardsViewUtil;
|
||||||
import mage.client.util.Command;
|
|
||||||
import mage.client.util.ImageHelper;
|
import mage.client.util.ImageHelper;
|
||||||
import mage.client.util.gui.BufferedImageBuilder;
|
import mage.client.util.gui.BufferedImageBuilder;
|
||||||
import mage.client.util.gui.countryBox.CountryUtil;
|
import mage.client.util.gui.countryBox.CountryUtil;
|
||||||
|
@ -141,22 +138,16 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
if (priorityTime > 0) {
|
if (priorityTime > 0) {
|
||||||
long delay = 1000L;
|
long delay = 1000L;
|
||||||
|
|
||||||
timer = new PriorityTimer(priorityTime, delay, new mage.interfaces.Action() {
|
timer = new PriorityTimer(priorityTime, delay, () -> {
|
||||||
@Override
|
// do nothing
|
||||||
public void execute() throws MageException {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
final PriorityTimer pt = timer;
|
final PriorityTimer pt = timer;
|
||||||
timer.setTaskOnTick(new mage.interfaces.Action() {
|
timer.setTaskOnTick(() -> {
|
||||||
@Override
|
int priorityTimeValue = pt.getCount();
|
||||||
public void execute() throws MageException {
|
String text = getPriorityTimeLeftString(priorityTimeValue);
|
||||||
int priorityTimeValue = pt.getCount();
|
PlayerPanelExt.this.avatar.setTopText(text);
|
||||||
String text = getPriorityTimeLeftString(priorityTimeValue);
|
PlayerPanelExt.this.timerLabel.setText(text);
|
||||||
PlayerPanelExt.this.avatar.setTopText(text);
|
PlayerPanelExt.this.avatar.repaint();
|
||||||
PlayerPanelExt.this.timerLabel.setText(text);
|
|
||||||
PlayerPanelExt.this.avatar.repaint();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
timer.init(gameId);
|
timer.init(gameId);
|
||||||
}
|
}
|
||||||
|
@ -414,12 +405,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
avatar.setTextAlwaysVisible(true);
|
avatar.setTextAlwaysVisible(true);
|
||||||
}
|
}
|
||||||
avatar.setTextOffsetButtonY(10);
|
avatar.setTextOffsetButtonY(10);
|
||||||
avatar.setObserver(new Command() {
|
avatar.setObserver(() -> SessionHandler.sendPlayerUUID(gameId, playerId));
|
||||||
@Override
|
|
||||||
public void execute() {
|
|
||||||
SessionHandler.sendPlayerUUID(gameId, playerId);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// timer area /small layout)
|
// timer area /small layout)
|
||||||
timerLabel.setToolTipText("Time left");
|
timerLabel.setToolTipText("Time left");
|
||||||
|
@ -462,12 +448,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
library = new HoverButton(null, resizedLibrary, resizedLibrary, resizedLibrary, r);
|
library = new HoverButton(null, resizedLibrary, resizedLibrary, resizedLibrary, r);
|
||||||
library.setToolTipText("Library");
|
library.setToolTipText("Library");
|
||||||
library.setOpaque(false);
|
library.setOpaque(false);
|
||||||
library.setObserver(new Command() {
|
library.setObserver(() -> btnLibraryActionPerformed(null));
|
||||||
@Override
|
|
||||||
public void execute() {
|
|
||||||
btnLibraryActionPerformed(null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Grave count and open graveyard button
|
// Grave count and open graveyard button
|
||||||
r = new Rectangle(21, 21);
|
r = new Rectangle(21, 21);
|
||||||
|
@ -478,12 +459,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
grave = new HoverButton(null, resizedGrave, resizedGrave, resizedGrave, r);
|
grave = new HoverButton(null, resizedGrave, resizedGrave, resizedGrave, r);
|
||||||
grave.setToolTipText("Graveyard");
|
grave.setToolTipText("Graveyard");
|
||||||
grave.setOpaque(false);
|
grave.setOpaque(false);
|
||||||
grave.setObserver(new Command() {
|
grave.setObserver(() -> btnGraveActionPerformed(null));
|
||||||
@Override
|
|
||||||
public void execute() {
|
|
||||||
btnGraveActionPerformed(null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
exileLabel = new JLabel();
|
exileLabel = new JLabel();
|
||||||
exileLabel.setToolTipText("Exile");
|
exileLabel.setToolTipText("Exile");
|
||||||
|
@ -493,12 +469,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
exileZone = new HoverButton(null, resized, resized, resized, r);
|
exileZone = new HoverButton(null, resized, resized, resized, r);
|
||||||
exileZone.setToolTipText("Exile");
|
exileZone.setToolTipText("Exile");
|
||||||
exileZone.setOpaque(false);
|
exileZone.setOpaque(false);
|
||||||
exileZone.setObserver(new Command() {
|
exileZone.setObserver(() -> btnExileZoneActionPerformed(null));
|
||||||
@Override
|
|
||||||
public void execute() {
|
|
||||||
btnExileZoneActionPerformed(null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
exileZone.setBounds(25, 0, 21, 21);
|
exileZone.setBounds(25, 0, 21, 21);
|
||||||
|
|
||||||
// Cheat button
|
// Cheat button
|
||||||
|
@ -508,12 +479,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
cheat = new JButton();
|
cheat = new JButton();
|
||||||
cheat.setIcon(new ImageIcon(resized));
|
cheat.setIcon(new ImageIcon(resized));
|
||||||
cheat.setToolTipText("Cheat button");
|
cheat.setToolTipText("Cheat button");
|
||||||
cheat.addActionListener(new ActionListener() {
|
cheat.addActionListener(e -> btnCheatActionPerformed(e));
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
btnCheatActionPerformed(e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
zonesPanel = new JPanel();
|
zonesPanel = new JPanel();
|
||||||
zonesPanel.setPreferredSize(new Dimension(100, 60));
|
zonesPanel.setPreferredSize(new Dimension(100, 60));
|
||||||
|
@ -527,12 +493,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
commandZone = new HoverButton(null, resized, resized, resized, r);
|
commandZone = new HoverButton(null, resized, resized, resized, r);
|
||||||
commandZone.setToolTipText("Command Zone (Commander and Emblems)");
|
commandZone.setToolTipText("Command Zone (Commander and Emblems)");
|
||||||
commandZone.setOpaque(false);
|
commandZone.setOpaque(false);
|
||||||
commandZone.setObserver(new Command() {
|
commandZone.setObserver(() -> btnCommandZoneActionPerformed(null));
|
||||||
@Override
|
|
||||||
public void execute() {
|
|
||||||
btnCommandZoneActionPerformed(null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
commandZone.setBounds(5, 0, 21, 21);
|
commandZone.setBounds(5, 0, 21, 21);
|
||||||
zonesPanel.add(commandZone);
|
zonesPanel.add(commandZone);
|
||||||
|
|
||||||
|
@ -569,12 +530,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
btnPlayer.setText("Player");
|
btnPlayer.setText("Player");
|
||||||
btnPlayer.setVisible(false);
|
btnPlayer.setVisible(false);
|
||||||
btnPlayer.setToolTipText("Player");
|
btnPlayer.setToolTipText("Player");
|
||||||
btnPlayer.addActionListener(new ActionListener() {
|
btnPlayer.addActionListener(e -> SessionHandler.sendPlayerUUID(gameId, playerId));
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
SessionHandler.sendPlayerUUID(gameId, playerId);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Add mana symbols
|
// Add mana symbols
|
||||||
JLabel manaCountLabelW = new JLabel();
|
JLabel manaCountLabelW = new JLabel();
|
||||||
|
@ -587,12 +543,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
|
|
||||||
btnWhiteMana.setToolTipText("White mana");
|
btnWhiteMana.setToolTipText("White mana");
|
||||||
btnWhiteMana.setOpaque(false);
|
btnWhiteMana.setOpaque(false);
|
||||||
btnWhiteMana.setObserver(new Command() {
|
btnWhiteMana.setObserver(() -> btnManaActionPerformed(ManaType.WHITE));
|
||||||
@Override
|
|
||||||
public void execute() {
|
|
||||||
btnManaActionPerformed(ManaType.WHITE);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
JLabel manaCountLabelU = new JLabel();
|
JLabel manaCountLabelU = new JLabel();
|
||||||
manaCountLabelU.setToolTipText("Blue mana");
|
manaCountLabelU.setToolTipText("Blue mana");
|
||||||
|
@ -603,12 +554,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
HoverButton btnBlueMana = new HoverButton(null, imageManaU, imageManaU, imageManaU, r);
|
HoverButton btnBlueMana = new HoverButton(null, imageManaU, imageManaU, imageManaU, r);
|
||||||
btnBlueMana.setToolTipText("Blue mana");
|
btnBlueMana.setToolTipText("Blue mana");
|
||||||
btnBlueMana.setOpaque(false);
|
btnBlueMana.setOpaque(false);
|
||||||
btnBlueMana.setObserver(new Command() {
|
btnBlueMana.setObserver(() -> btnManaActionPerformed(ManaType.BLUE));
|
||||||
@Override
|
|
||||||
public void execute() {
|
|
||||||
btnManaActionPerformed(ManaType.BLUE);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
JLabel manaCountLabelB = new JLabel();
|
JLabel manaCountLabelB = new JLabel();
|
||||||
manaCountLabelB.setToolTipText("Black mana");
|
manaCountLabelB.setToolTipText("Black mana");
|
||||||
|
@ -619,12 +565,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
HoverButton btnBlackMana = new HoverButton(null, imageManaB, imageManaB, imageManaB, r);
|
HoverButton btnBlackMana = new HoverButton(null, imageManaB, imageManaB, imageManaB, r);
|
||||||
btnBlackMana.setToolTipText("Black mana");
|
btnBlackMana.setToolTipText("Black mana");
|
||||||
btnBlackMana.setOpaque(false);
|
btnBlackMana.setOpaque(false);
|
||||||
btnBlackMana.setObserver(new Command() {
|
btnBlackMana.setObserver(() -> btnManaActionPerformed(ManaType.BLACK));
|
||||||
@Override
|
|
||||||
public void execute() {
|
|
||||||
btnManaActionPerformed(ManaType.BLACK);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
JLabel manaCountLabelR = new JLabel();
|
JLabel manaCountLabelR = new JLabel();
|
||||||
manaCountLabelR.setToolTipText("Red mana");
|
manaCountLabelR.setToolTipText("Red mana");
|
||||||
|
@ -635,12 +576,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
HoverButton btnRedMana = new HoverButton(null, imageManaR, imageManaR, imageManaR, r);
|
HoverButton btnRedMana = new HoverButton(null, imageManaR, imageManaR, imageManaR, r);
|
||||||
btnRedMana.setToolTipText("Red mana");
|
btnRedMana.setToolTipText("Red mana");
|
||||||
btnRedMana.setOpaque(false);
|
btnRedMana.setOpaque(false);
|
||||||
btnRedMana.setObserver(new Command() {
|
btnRedMana.setObserver(() -> btnManaActionPerformed(ManaType.RED));
|
||||||
@Override
|
|
||||||
public void execute() {
|
|
||||||
btnManaActionPerformed(ManaType.RED);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
JLabel manaCountLabelG = new JLabel();
|
JLabel manaCountLabelG = new JLabel();
|
||||||
manaCountLabelG.setToolTipText("Green mana");
|
manaCountLabelG.setToolTipText("Green mana");
|
||||||
|
@ -651,12 +587,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
HoverButton btnGreenMana = new HoverButton(null, imageManaG, imageManaG, imageManaG, r);
|
HoverButton btnGreenMana = new HoverButton(null, imageManaG, imageManaG, imageManaG, r);
|
||||||
btnGreenMana.setToolTipText("Green mana");
|
btnGreenMana.setToolTipText("Green mana");
|
||||||
btnGreenMana.setOpaque(false);
|
btnGreenMana.setOpaque(false);
|
||||||
btnGreenMana.setObserver(new Command() {
|
btnGreenMana.setObserver(() -> btnManaActionPerformed(ManaType.GREEN));
|
||||||
@Override
|
|
||||||
public void execute() {
|
|
||||||
btnManaActionPerformed(ManaType.GREEN);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
JLabel manaCountLabelX = new JLabel();
|
JLabel manaCountLabelX = new JLabel();
|
||||||
manaCountLabelX.setToolTipText("Colorless mana");
|
manaCountLabelX.setToolTipText("Colorless mana");
|
||||||
|
@ -667,12 +598,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
||||||
HoverButton btnColorlessMana = new HoverButton(null, imageManaX, imageManaX, imageManaX, r);
|
HoverButton btnColorlessMana = new HoverButton(null, imageManaX, imageManaX, imageManaX, r);
|
||||||
btnColorlessMana.setToolTipText("Colorless mana");
|
btnColorlessMana.setToolTipText("Colorless mana");
|
||||||
btnColorlessMana.setOpaque(false);
|
btnColorlessMana.setOpaque(false);
|
||||||
btnColorlessMana.setObserver(new Command() {
|
btnColorlessMana.setObserver(() -> btnManaActionPerformed(ManaType.COLORLESS));
|
||||||
@Override
|
|
||||||
public void execute() {
|
|
||||||
btnManaActionPerformed(ManaType.COLORLESS);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
GroupLayout gl_panelBackground = new GroupLayout(panelBackground);
|
GroupLayout gl_panelBackground = new GroupLayout(panelBackground);
|
||||||
gl_panelBackground.setHorizontalGroup(
|
gl_panelBackground.setHorizontalGroup(
|
||||||
|
|
|
@ -7,8 +7,6 @@ import java.awt.event.MouseEvent;
|
||||||
import java.awt.event.MouseWheelEvent;
|
import java.awt.event.MouseWheelEvent;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -24,6 +22,7 @@ import javax.swing.JPopupMenu;
|
||||||
import javax.swing.Popup;
|
import javax.swing.Popup;
|
||||||
import javax.swing.PopupFactory;
|
import javax.swing.PopupFactory;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import mage.cards.MageCard;
|
import mage.cards.MageCard;
|
||||||
import mage.cards.action.ActionCallback;
|
import mage.cards.action.ActionCallback;
|
||||||
import mage.cards.action.TransferData;
|
import mage.cards.action.TransferData;
|
||||||
|
@ -80,6 +79,7 @@ public class MageActionCallback implements ActionCallback {
|
||||||
|
|
||||||
CLOSED, NORMAL, ROTATED
|
CLOSED, NORMAL, ROTATED
|
||||||
}
|
}
|
||||||
|
|
||||||
private Date enlargeredViewOpened;
|
private Date enlargeredViewOpened;
|
||||||
private volatile EnlargedWindowState enlargedWindowState = EnlargedWindowState.CLOSED;
|
private volatile EnlargedWindowState enlargedWindowState = EnlargedWindowState.CLOSED;
|
||||||
//private volatile boolean enlargedImageWindowOpen = false;
|
//private volatile boolean enlargedImageWindowOpen = false;
|
||||||
|
@ -158,7 +158,7 @@ public class MageActionCallback implements ActionCallback {
|
||||||
|| !tooltipCard.equals(data.card)
|
|| !tooltipCard.equals(data.card)
|
||||||
|| SessionHandler.getSession() == null
|
|| SessionHandler.getSession() == null
|
||||||
|| !popupTextWindowOpen
|
|| !popupTextWindowOpen
|
||||||
|| !enlargedWindowState.equals(EnlargedWindowState.CLOSED)) {
|
|| enlargedWindowState != EnlargedWindowState.CLOSED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,25 +177,22 @@ public class MageActionCallback implements ActionCallback {
|
||||||
|
|
||||||
public void showPopup(final Component popupContainer, final Component infoPane) throws InterruptedException {
|
public void showPopup(final Component popupContainer, final Component infoPane) throws InterruptedException {
|
||||||
final Component c = MageFrame.getUI().getComponent(MageComponents.DESKTOP_PANE);
|
final Component c = MageFrame.getUI().getComponent(MageComponents.DESKTOP_PANE);
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> {
|
||||||
@Override
|
if (!popupTextWindowOpen
|
||||||
public void run() {
|
|| enlargedWindowState != EnlargedWindowState.CLOSED) {
|
||||||
if (!popupTextWindowOpen
|
return;
|
||||||
|| !enlargedWindowState.equals(EnlargedWindowState.CLOSED)) {
|
}
|
||||||
return;
|
if (data.locationOnScreen == null) {
|
||||||
}
|
data.locationOnScreen = data.component.getLocationOnScreen();
|
||||||
if (data.locationOnScreen == null) {
|
}
|
||||||
data.locationOnScreen = data.component.getLocationOnScreen();
|
|
||||||
}
|
|
||||||
|
|
||||||
Point location = new Point((int) data.locationOnScreen.getX() + data.popupOffsetX - 40, (int) data.locationOnScreen.getY() + data.popupOffsetY - 40);
|
Point location = new Point((int) data.locationOnScreen.getX() + data.popupOffsetX - 40, (int) data.locationOnScreen.getY() + data.popupOffsetY - 40);
|
||||||
location = GuiDisplayUtil.keepComponentInsideParent(location, parentPoint, infoPane, parentComponent);
|
location = GuiDisplayUtil.keepComponentInsideParent(location, parentPoint, infoPane, parentComponent);
|
||||||
location.translate(-parentPoint.x, -parentPoint.y);
|
location.translate(-parentPoint.x, -parentPoint.y);
|
||||||
popupContainer.setLocation(location);
|
popupContainer.setLocation(location);
|
||||||
popupContainer.setVisible(true);
|
popupContainer.setVisible(true);
|
||||||
c.repaint();
|
c.repaint();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -257,7 +254,7 @@ public class MageActionCallback implements ActionCallback {
|
||||||
if (this.startedDragging && prevCardPanel != null && card != null) {
|
if (this.startedDragging && prevCardPanel != null && card != null) {
|
||||||
for (Component component : card.getCardArea().getComponents()) {
|
for (Component component : card.getCardArea().getComponents()) {
|
||||||
if (component instanceof CardPanel) {
|
if (component instanceof CardPanel) {
|
||||||
if (cardPanels.contains((CardPanel) component)) {
|
if (cardPanels.contains(component)) {
|
||||||
component.setLocation(component.getLocation().x, component.getLocation().y - GO_DOWN_ON_DRAG_Y_OFFSET);
|
component.setLocation(component.getLocation().x, component.getLocation().y - GO_DOWN_ON_DRAG_Y_OFFSET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -331,7 +328,7 @@ public class MageActionCallback implements ActionCallback {
|
||||||
for (Component component : container.getComponents()) {
|
for (Component component : container.getComponents()) {
|
||||||
if (component instanceof CardPanel) {
|
if (component instanceof CardPanel) {
|
||||||
if (!component.equals(card)) {
|
if (!component.equals(card)) {
|
||||||
if (!cardPanels.contains((CardPanel) component)) {
|
if (!cardPanels.contains(component)) {
|
||||||
component.setLocation(component.getLocation().x, component.getLocation().y + GO_DOWN_ON_DRAG_Y_OFFSET);
|
component.setLocation(component.getLocation().x, component.getLocation().y + GO_DOWN_ON_DRAG_Y_OFFSET);
|
||||||
}
|
}
|
||||||
cardPanels.add((CardPanel) component);
|
cardPanels.add((CardPanel) component);
|
||||||
|
@ -347,12 +344,7 @@ public class MageActionCallback implements ActionCallback {
|
||||||
private void sortLayout(List<CardPanel> cards, CardPanel source, boolean includeSource) {
|
private void sortLayout(List<CardPanel> cards, CardPanel source, boolean includeSource) {
|
||||||
source.getLocation().x -= COMPARE_GAP_X; // this creates nice effect
|
source.getLocation().x -= COMPARE_GAP_X; // this creates nice effect
|
||||||
|
|
||||||
Collections.sort(cards, new Comparator<CardPanel>() {
|
cards.sort((cp1, cp2) -> Integer.valueOf(cp1.getLocation().x).compareTo(cp2.getLocation().x));
|
||||||
@Override
|
|
||||||
public int compare(CardPanel cp1, CardPanel cp2) {
|
|
||||||
return Integer.valueOf(cp1.getLocation().x).compareTo(cp2.getLocation().x);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
int dx = 0;
|
int dx = 0;
|
||||||
boolean createdGapForSource = false;
|
boolean createdGapForSource = false;
|
||||||
|
@ -412,7 +404,7 @@ public class MageActionCallback implements ActionCallback {
|
||||||
} else {
|
} else {
|
||||||
popupTextWindowOpen = true;
|
popupTextWindowOpen = true;
|
||||||
}
|
}
|
||||||
if (!enlargedWindowState.equals(EnlargedWindowState.CLOSED)) {
|
if (enlargedWindowState != EnlargedWindowState.CLOSED) {
|
||||||
cancelTimeout();
|
cancelTimeout();
|
||||||
displayEnlargedCard(mageCard.getOriginal(), transferData);
|
displayEnlargedCard(mageCard.getOriginal(), transferData);
|
||||||
}
|
}
|
||||||
|
@ -427,7 +419,6 @@ public class MageActionCallback implements ActionCallback {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hides the text popup window
|
* Hides the text popup window
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public void hideTooltipPopup() {
|
public void hideTooltipPopup() {
|
||||||
this.tooltipCard = null;
|
this.tooltipCard = null;
|
||||||
|
@ -471,13 +462,13 @@ public class MageActionCallback implements ActionCallback {
|
||||||
@Override
|
@Override
|
||||||
public void mouseWheelMoved(MouseWheelEvent e, TransferData transferData) {
|
public void mouseWheelMoved(MouseWheelEvent e, TransferData transferData) {
|
||||||
int notches = e.getWheelRotation();
|
int notches = e.getWheelRotation();
|
||||||
if (!enlargedWindowState.equals(EnlargedWindowState.CLOSED)) {
|
if (enlargedWindowState != EnlargedWindowState.CLOSED) {
|
||||||
// same move direction will be ignored, opposite direction closes the enlarged window
|
// same move direction will be ignored, opposite direction closes the enlarged window
|
||||||
if (new Date().getTime() - enlargeredViewOpened.getTime() > 1000) {
|
if (new Date().getTime() - enlargeredViewOpened.getTime() > 1000) {
|
||||||
// if the opening is back more than 1 seconds close anyway
|
// if the opening is back more than 1 seconds close anyway
|
||||||
hideEnlargedCard();
|
hideEnlargedCard();
|
||||||
handleOverNewView(transferData);
|
handleOverNewView(transferData);
|
||||||
} else if (enlargeMode.equals(EnlargeMode.NORMAL)) {
|
} else if (enlargeMode == EnlargeMode.NORMAL) {
|
||||||
if (notches > 0) {
|
if (notches > 0) {
|
||||||
hideEnlargedCard();
|
hideEnlargedCard();
|
||||||
handleOverNewView(transferData);
|
handleOverNewView(transferData);
|
||||||
|
@ -501,10 +492,10 @@ public class MageActionCallback implements ActionCallback {
|
||||||
* Show the big card image on mouse position while hovering over a card
|
* Show the big card image on mouse position while hovering over a card
|
||||||
*
|
*
|
||||||
* @param showAlternative defines if the original image (if it's a copied
|
* @param showAlternative defines if the original image (if it's a copied
|
||||||
* card) or the opposite side of a transformable card will be shown
|
* card) or the opposite side of a transformable card will be shown
|
||||||
*/
|
*/
|
||||||
public void enlargeCard(EnlargeMode showAlternative) {
|
public void enlargeCard(EnlargeMode showAlternative) {
|
||||||
if (enlargedWindowState.equals(EnlargedWindowState.CLOSED)) {
|
if (enlargedWindowState == EnlargedWindowState.CLOSED) {
|
||||||
this.enlargeMode = showAlternative;
|
this.enlargeMode = showAlternative;
|
||||||
CardView cardView = null;
|
CardView cardView = null;
|
||||||
if (popupData != null) {
|
if (popupData != null) {
|
||||||
|
@ -525,7 +516,7 @@ public class MageActionCallback implements ActionCallback {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hideEnlargedCard() {
|
public void hideEnlargedCard() {
|
||||||
if (!enlargedWindowState.equals(EnlargedWindowState.CLOSED)) {
|
if (enlargedWindowState != EnlargedWindowState.CLOSED) {
|
||||||
enlargedWindowState = EnlargedWindowState.CLOSED;
|
enlargedWindowState = EnlargedWindowState.CLOSED;
|
||||||
try {
|
try {
|
||||||
Component cardPreviewContainer = MageFrame.getUI().getComponent(MageComponents.CARD_PREVIEW_CONTAINER);
|
Component cardPreviewContainer = MageFrame.getUI().getComponent(MageComponents.CARD_PREVIEW_CONTAINER);
|
||||||
|
@ -540,78 +531,75 @@ public class MageActionCallback implements ActionCallback {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayEnlargedCard(final CardView cardView, final TransferData transferData) {
|
private void displayEnlargedCard(final CardView cardView, final TransferData transferData) {
|
||||||
ThreadUtils.threadPool3.submit(new Runnable() {
|
ThreadUtils.threadPool3.submit(() -> {
|
||||||
@Override
|
if (cardView == null) {
|
||||||
public void run() {
|
return;
|
||||||
if (cardView == null) {
|
}
|
||||||
|
try {
|
||||||
|
if (enlargedWindowState == EnlargedWindowState.CLOSED) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
if (enlargedWindowState.equals(EnlargedWindowState.CLOSED)) {
|
MageComponents mageComponentCardPreviewContainer;
|
||||||
return;
|
MageComponents mageComponentCardPreviewPane;
|
||||||
|
if (cardView.isToRotate()) {
|
||||||
|
if (enlargedWindowState == EnlargedWindowState.NORMAL) {
|
||||||
|
hideEnlargedCard();
|
||||||
|
enlargedWindowState = EnlargedWindowState.ROTATED;
|
||||||
}
|
}
|
||||||
|
mageComponentCardPreviewContainer = MageComponents.CARD_PREVIEW_CONTAINER_ROTATED;
|
||||||
MageComponents mageComponentCardPreviewContainer;
|
mageComponentCardPreviewPane = MageComponents.CARD_PREVIEW_PANE_ROTATED;
|
||||||
MageComponents mageComponentCardPreviewPane;
|
} else {
|
||||||
if (cardView.isToRotate()) {
|
if (enlargedWindowState == EnlargedWindowState.ROTATED) {
|
||||||
if (enlargedWindowState.equals(EnlargedWindowState.NORMAL)) {
|
hideEnlargedCard();
|
||||||
hideEnlargedCard();
|
enlargedWindowState = EnlargedWindowState.NORMAL;
|
||||||
enlargedWindowState = EnlargedWindowState.ROTATED;
|
|
||||||
}
|
|
||||||
mageComponentCardPreviewContainer = MageComponents.CARD_PREVIEW_CONTAINER_ROTATED;
|
|
||||||
mageComponentCardPreviewPane = MageComponents.CARD_PREVIEW_PANE_ROTATED;
|
|
||||||
} else {
|
|
||||||
if (enlargedWindowState.equals(EnlargedWindowState.ROTATED)) {
|
|
||||||
hideEnlargedCard();
|
|
||||||
enlargedWindowState = EnlargedWindowState.NORMAL;
|
|
||||||
}
|
|
||||||
mageComponentCardPreviewContainer = MageComponents.CARD_PREVIEW_CONTAINER;
|
|
||||||
mageComponentCardPreviewPane = MageComponents.CARD_PREVIEW_PANE;
|
|
||||||
}
|
}
|
||||||
final Component popupContainer = MageFrame.getUI().getComponent(mageComponentCardPreviewContainer);
|
mageComponentCardPreviewContainer = MageComponents.CARD_PREVIEW_CONTAINER;
|
||||||
Component cardPreviewPane = MageFrame.getUI().getComponent(mageComponentCardPreviewPane);
|
mageComponentCardPreviewPane = MageComponents.CARD_PREVIEW_PANE;
|
||||||
Component parentComponent = SwingUtilities.getRoot(transferData.component);
|
|
||||||
if (cardPreviewPane != null && parentComponent != null) {
|
|
||||||
Point parentPoint = parentComponent.getLocationOnScreen();
|
|
||||||
transferData.locationOnScreen = transferData.component.getLocationOnScreen();
|
|
||||||
Point location = new Point((int) transferData.locationOnScreen.getX() + transferData.popupOffsetX - 40, (int) transferData.locationOnScreen.getY() + transferData.popupOffsetY - 40);
|
|
||||||
location = GuiDisplayUtil.keepComponentInsideParent(location, parentPoint, cardPreviewPane, parentComponent);
|
|
||||||
location.translate(-parentPoint.x, -parentPoint.y);
|
|
||||||
popupContainer.setLocation(location);
|
|
||||||
popupContainer.setVisible(true);
|
|
||||||
|
|
||||||
MageCard mageCard = (MageCard) transferData.component;
|
|
||||||
Image image = null;
|
|
||||||
switch (enlargeMode) {
|
|
||||||
case COPY:
|
|
||||||
if (cardView instanceof PermanentView) {
|
|
||||||
image = ImageCache.getImageOriginal(((PermanentView) cardView).getOriginal());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ALTERNATE:
|
|
||||||
if (cardView.getAlternateName() != null) {
|
|
||||||
if (cardView instanceof PermanentView && !cardView.isFlipCard() && !cardView.canTransform() && ((PermanentView) cardView).isCopy()) {
|
|
||||||
image = ImageCache.getImageOriginal(((PermanentView) cardView).getOriginal());
|
|
||||||
} else {
|
|
||||||
image = ImageCache.getImageOriginalAlternateName(cardView);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (image == null) {
|
|
||||||
image = mageCard.getImage();
|
|
||||||
}
|
|
||||||
// shows the card in the popup Container
|
|
||||||
BigCard bigCard = (BigCard) cardPreviewPane;
|
|
||||||
displayCardInfo(mageCard, image, bigCard);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
LOGGER.warn("No Card preview Pane in Mage Frame defined. Card: " + cardView.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOGGER.warn("Problem dring display of enlarged card", e);
|
|
||||||
}
|
}
|
||||||
|
final Component popupContainer = MageFrame.getUI().getComponent(mageComponentCardPreviewContainer);
|
||||||
|
Component cardPreviewPane = MageFrame.getUI().getComponent(mageComponentCardPreviewPane);
|
||||||
|
Component parentComponent = SwingUtilities.getRoot(transferData.component);
|
||||||
|
if (cardPreviewPane != null && parentComponent != null) {
|
||||||
|
Point parentPoint = parentComponent.getLocationOnScreen();
|
||||||
|
transferData.locationOnScreen = transferData.component.getLocationOnScreen();
|
||||||
|
Point location = new Point((int) transferData.locationOnScreen.getX() + transferData.popupOffsetX - 40, (int) transferData.locationOnScreen.getY() + transferData.popupOffsetY - 40);
|
||||||
|
location = GuiDisplayUtil.keepComponentInsideParent(location, parentPoint, cardPreviewPane, parentComponent);
|
||||||
|
location.translate(-parentPoint.x, -parentPoint.y);
|
||||||
|
popupContainer.setLocation(location);
|
||||||
|
popupContainer.setVisible(true);
|
||||||
|
|
||||||
|
MageCard mageCard = (MageCard) transferData.component;
|
||||||
|
Image image = null;
|
||||||
|
switch (enlargeMode) {
|
||||||
|
case COPY:
|
||||||
|
if (cardView instanceof PermanentView) {
|
||||||
|
image = ImageCache.getImageOriginal(((PermanentView) cardView).getOriginal());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ALTERNATE:
|
||||||
|
if (cardView.getAlternateName() != null) {
|
||||||
|
if (cardView instanceof PermanentView && !cardView.isFlipCard() && !cardView.canTransform() && ((PermanentView) cardView).isCopy()) {
|
||||||
|
image = ImageCache.getImageOriginal(((PermanentView) cardView).getOriginal());
|
||||||
|
} else {
|
||||||
|
image = ImageCache.getImageOriginalAlternateName(cardView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (image == null) {
|
||||||
|
image = mageCard.getImage();
|
||||||
|
}
|
||||||
|
// shows the card in the popup Container
|
||||||
|
BigCard bigCard = (BigCard) cardPreviewPane;
|
||||||
|
displayCardInfo(mageCard, image, bigCard);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
LOGGER.warn("No Card preview Pane in Mage Frame defined. Card: " + cardView.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.warn("Problem dring display of enlarged card", e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -621,7 +609,7 @@ public class MageActionCallback implements ActionCallback {
|
||||||
// XXX: scaled to fit width
|
// XXX: scaled to fit width
|
||||||
bigCard.setCard(mageCard.getOriginal().getId(), enlargeMode, image, mageCard.getOriginal().getRules(), mageCard.getOriginal().isToRotate());
|
bigCard.setCard(mageCard.getOriginal().getId(), enlargeMode, image, mageCard.getOriginal().getRules(), mageCard.getOriginal().isToRotate());
|
||||||
// if it's an ability, show only the ability text as overlay
|
// if it's an ability, show only the ability text as overlay
|
||||||
if (mageCard.getOriginal().isAbility() && enlargeMode.equals(EnlargeMode.NORMAL)) {
|
if (mageCard.getOriginal().isAbility() && enlargeMode == EnlargeMode.NORMAL) {
|
||||||
bigCard.showTextComponent();
|
bigCard.showTextComponent();
|
||||||
} else {
|
} else {
|
||||||
bigCard.hideTextComponent();
|
bigCard.hideTextComponent();
|
||||||
|
@ -637,12 +625,7 @@ public class MageActionCallback implements ActionCallback {
|
||||||
|
|
||||||
private synchronized void startHideTimeout() {
|
private synchronized void startHideTimeout() {
|
||||||
cancelTimeout();
|
cancelTimeout();
|
||||||
hideTimeout = timeoutExecutor.schedule(new Runnable() {
|
hideTimeout = timeoutExecutor.schedule(this::hideEnlargedCard, 700, TimeUnit.MILLISECONDS);
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
hideEnlargedCard();
|
|
||||||
}
|
|
||||||
}, 700, TimeUnit.MILLISECONDS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void cancelTimeout() {
|
private synchronized void cancelTimeout() {
|
||||||
|
|
|
@ -79,302 +79,299 @@ public class CallbackClientImpl implements CallbackClient {
|
||||||
public synchronized void processCallback(final ClientCallback callback) {
|
public synchronized void processCallback(final ClientCallback callback) {
|
||||||
SaveObjectUtil.saveObject(callback.getData(), callback.getMethod());
|
SaveObjectUtil.saveObject(callback.getData(), callback.getMethod());
|
||||||
callback.setData(CompressUtil.decompress(callback.getData()));
|
callback.setData(CompressUtil.decompress(callback.getData()));
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> {
|
||||||
@Override
|
try {
|
||||||
public void run() {
|
logger.debug(callback.getMessageId() + " -- " + callback.getMethod());
|
||||||
try {
|
switch (callback.getMethod()) {
|
||||||
logger.debug(callback.getMessageId() + " -- " + callback.getMethod());
|
case "startGame": {
|
||||||
switch (callback.getMethod()) {
|
TableClientMessage message = (TableClientMessage) callback.getData();
|
||||||
case "startGame": {
|
GameManager.getInstance().setCurrentPlayerUUID(message.getPlayerId());
|
||||||
TableClientMessage message = (TableClientMessage) callback.getData();
|
gameStarted(message.getGameId(), message.getPlayerId());
|
||||||
GameManager.getInstance().setCurrentPlayerUUID(message.getPlayerId());
|
break;
|
||||||
gameStarted(message.getGameId(), message.getPlayerId());
|
}
|
||||||
break;
|
case "startTournament": {
|
||||||
|
TableClientMessage message = (TableClientMessage) callback.getData();
|
||||||
|
tournamentStarted(message.getGameId(), message.getPlayerId());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "startDraft": {
|
||||||
|
TableClientMessage message = (TableClientMessage) callback.getData();
|
||||||
|
draftStarted(message.getGameId(), message.getPlayerId());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "replayGame":
|
||||||
|
replayGame(callback.getObjectId());
|
||||||
|
break;
|
||||||
|
case "showTournament":
|
||||||
|
showTournament(callback.getObjectId());
|
||||||
|
break;
|
||||||
|
case "watchGame":
|
||||||
|
watchGame(callback.getObjectId());
|
||||||
|
break;
|
||||||
|
case "chatMessage": {
|
||||||
|
ChatMessage message = (ChatMessage) callback.getData();
|
||||||
|
ChatPanelBasic panel = MageFrame.getChat(callback.getObjectId());
|
||||||
|
if (panel != null) {
|
||||||
|
// play the sound related to the message
|
||||||
|
if (message.getSoundToPlay() != null) {
|
||||||
|
switch (message.getSoundToPlay()) {
|
||||||
|
case PlayerLeft:
|
||||||
|
AudioManager.playPlayerLeft();
|
||||||
|
break;
|
||||||
|
case PlayerQuitTournament:
|
||||||
|
AudioManager.playPlayerQuitTournament();
|
||||||
|
break;
|
||||||
|
case PlayerSubmittedDeck:
|
||||||
|
AudioManager.playPlayerSubmittedDeck();
|
||||||
|
break;
|
||||||
|
case PlayerWhispered:
|
||||||
|
AudioManager.playPlayerWhispered();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// send start message to chat if not done yet
|
||||||
|
if (!panel.isStartMessageDone()) {
|
||||||
|
createChatStartMessage(panel);
|
||||||
|
}
|
||||||
|
// send the message to subchat if exists and it's not a game message
|
||||||
|
if (!message.getMessageType().equals(MessageType.GAME) && panel.getConnectedChat() != null) {
|
||||||
|
panel.getConnectedChat().receiveMessage(message.getUsername(), message.getMessage(), message.getTime(), message.getMessageType(), ChatMessage.MessageColor.BLACK);
|
||||||
|
} else {
|
||||||
|
panel.receiveMessage(message.getUsername(), message.getMessage(), message.getTime(), message.getMessageType(), message.getColor());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
case "startTournament": {
|
break;
|
||||||
TableClientMessage message = (TableClientMessage) callback.getData();
|
}
|
||||||
tournamentStarted(message.getGameId(), message.getPlayerId());
|
case "serverMessage":
|
||||||
break;
|
if (callback.getData() != null) {
|
||||||
}
|
|
||||||
case "startDraft": {
|
|
||||||
TableClientMessage message = (TableClientMessage) callback.getData();
|
|
||||||
draftStarted(message.getGameId(), message.getPlayerId());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "replayGame":
|
|
||||||
replayGame(callback.getObjectId());
|
|
||||||
break;
|
|
||||||
case "showTournament":
|
|
||||||
showTournament(callback.getObjectId());
|
|
||||||
break;
|
|
||||||
case "watchGame":
|
|
||||||
watchGame(callback.getObjectId());
|
|
||||||
break;
|
|
||||||
case "chatMessage": {
|
|
||||||
ChatMessage message = (ChatMessage) callback.getData();
|
ChatMessage message = (ChatMessage) callback.getData();
|
||||||
ChatPanelBasic panel = MageFrame.getChat(callback.getObjectId());
|
if (message.getColor().equals(ChatMessage.MessageColor.RED)) {
|
||||||
if (panel != null) {
|
JOptionPane.showMessageDialog(null, message.getMessage(), "Server message", JOptionPane.WARNING_MESSAGE);
|
||||||
// play the sound related to the message
|
} else {
|
||||||
if (message.getSoundToPlay() != null) {
|
JOptionPane.showMessageDialog(null, message.getMessage(), "Server message", JOptionPane.INFORMATION_MESSAGE);
|
||||||
switch (message.getSoundToPlay()) {
|
}
|
||||||
case PlayerLeft:
|
}
|
||||||
AudioManager.playPlayerLeft();
|
break;
|
||||||
break;
|
case "joinedTable": {
|
||||||
case PlayerQuitTournament:
|
TableClientMessage message = (TableClientMessage) callback.getData();
|
||||||
AudioManager.playPlayerQuitTournament();
|
joinedTable(message.getRoomId(), message.getTableId(), message.getFlag());
|
||||||
break;
|
break;
|
||||||
case PlayerSubmittedDeck:
|
}
|
||||||
AudioManager.playPlayerSubmittedDeck();
|
case "replayInit": {
|
||||||
break;
|
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||||
case PlayerWhispered:
|
if (panel != null) {
|
||||||
AudioManager.playPlayerWhispered();
|
panel.init((GameView) callback.getData());
|
||||||
break;
|
}
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
// send start message to chat if not done yet
|
case "replayDone": {
|
||||||
if (!panel.isStartMessageDone()) {
|
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||||
createChatStartMessage(panel);
|
if (panel != null) {
|
||||||
}
|
panel.endMessage((String) callback.getData(), callback.getMessageId());
|
||||||
// send the message to subchat if exists and it's not a game message
|
}
|
||||||
if (!message.getMessageType().equals(MessageType.GAME) && panel.getConnectedChat() != null) {
|
break;
|
||||||
panel.getConnectedChat().receiveMessage(message.getUsername(), message.getMessage(), message.getTime(), message.getMessageType(), ChatMessage.MessageColor.BLACK);
|
}
|
||||||
} else {
|
case "replayUpdate": {
|
||||||
panel.receiveMessage(message.getUsername(), message.getMessage(), message.getTime(), message.getMessageType(), message.getColor());
|
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||||
}
|
if (panel != null) {
|
||||||
|
panel.updateGame((GameView) callback.getData());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "gameInit": {
|
||||||
|
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||||
|
if (panel != null) {
|
||||||
|
panel.init((GameView) callback.getData());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "gameOver": {
|
||||||
|
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||||
|
if (panel != null) {
|
||||||
|
panel.endMessage((String) callback.getData(), callback.getMessageId());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "gameError":
|
||||||
|
frame.showErrorDialog("Game Error", (String) callback.getData());
|
||||||
|
break;
|
||||||
|
case "gameAsk": {
|
||||||
|
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||||
|
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||||
|
if (panel != null) {
|
||||||
|
panel.ask(message.getMessage(), message.getGameView(), callback.getMessageId(), message.getOptions());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "gameTarget": // e.g. Pick triggered ability
|
||||||
|
{
|
||||||
|
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||||
|
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||||
|
if (panel != null) {
|
||||||
|
panel.pickTarget(message.getMessage(), message.getCardsView(), message.getGameView(),
|
||||||
|
message.getTargets(), message.isFlag(), message.getOptions(), callback.getMessageId());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "gameSelect": {
|
||||||
|
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||||
|
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||||
|
if (panel != null) {
|
||||||
|
panel.select(message.getMessage(), message.getGameView(), callback.getMessageId(), message.getOptions());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "gameChooseAbility": {
|
||||||
|
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||||
|
if (panel != null) {
|
||||||
|
panel.pickAbility((AbilityPickerView) callback.getData());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "gameChoosePile": {
|
||||||
|
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||||
|
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||||
|
if (panel != null) {
|
||||||
|
panel.pickPile(message.getMessage(), message.getPile1(), message.getPile2());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "gameChooseChoice": {
|
||||||
|
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||||
|
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||||
|
|
||||||
}
|
if (panel != null) {
|
||||||
break;
|
panel.getChoice(message.getChoice(), callback.getObjectId());
|
||||||
}
|
}
|
||||||
case "serverMessage":
|
break;
|
||||||
if (callback.getData() != null) {
|
}
|
||||||
ChatMessage message = (ChatMessage) callback.getData();
|
case "gamePlayMana": {
|
||||||
if (message.getColor().equals(ChatMessage.MessageColor.RED)) {
|
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||||
JOptionPane.showMessageDialog(null, message.getMessage(), "Server message", JOptionPane.WARNING_MESSAGE);
|
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||||
} else {
|
if (panel != null) {
|
||||||
JOptionPane.showMessageDialog(null, message.getMessage(), "Server message", JOptionPane.INFORMATION_MESSAGE);
|
panel.playMana(message.getMessage(), message.getGameView(), message.getOptions(), callback.getMessageId());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "gamePlayXMana": {
|
||||||
|
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||||
|
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||||
|
if (panel != null) {
|
||||||
|
panel.playXMana(message.getMessage(), message.getGameView(), callback.getMessageId());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "gameSelectAmount": {
|
||||||
|
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||||
|
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||||
|
if (panel != null) {
|
||||||
|
panel.getAmount(message.getMin(), message.getMax(), message.getMessage());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "gameUpdate": {
|
||||||
|
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||||
|
if (panel != null) {
|
||||||
|
panel.updateGame((GameView) callback.getData());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "endGameInfo":
|
||||||
|
MageFrame.getInstance().showGameEndDialog((GameEndView) callback.getData());
|
||||||
|
break;
|
||||||
|
case "showUserMessage":
|
||||||
|
List<String> messageData = (List<String>) callback.getData();
|
||||||
|
if (messageData.size() == 2) {
|
||||||
|
JOptionPane.showMessageDialog(null, messageData.get(1), messageData.get(0), JOptionPane.WARNING_MESSAGE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "gameInform":
|
||||||
|
if (callback.getMessageId() > gameInformMessageId) {
|
||||||
|
{
|
||||||
|
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||||
|
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||||
|
if (panel != null) {
|
||||||
|
panel.inform(message.getMessage(), message.getGameView(), callback.getMessageId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case "joinedTable": {
|
|
||||||
TableClientMessage message = (TableClientMessage) callback.getData();
|
|
||||||
joinedTable(message.getRoomId(), message.getTableId(), message.getFlag());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "replayInit": {
|
|
||||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
|
||||||
if (panel != null) {
|
|
||||||
panel.init((GameView) callback.getData());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "replayDone": {
|
|
||||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
|
||||||
if (panel != null) {
|
|
||||||
panel.endMessage((String) callback.getData(), callback.getMessageId());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "replayUpdate": {
|
|
||||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
|
||||||
if (panel != null) {
|
|
||||||
panel.updateGame((GameView) callback.getData());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "gameInit": {
|
|
||||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
|
||||||
if (panel != null) {
|
|
||||||
panel.init((GameView) callback.getData());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "gameOver": {
|
|
||||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
|
||||||
if (panel != null) {
|
|
||||||
panel.endMessage((String) callback.getData(), callback.getMessageId());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "gameError":
|
|
||||||
frame.showErrorDialog("Game Error", (String) callback.getData());
|
|
||||||
break;
|
|
||||||
case "gameAsk": {
|
|
||||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
|
||||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
|
||||||
if (panel != null) {
|
|
||||||
panel.ask(message.getMessage(), message.getGameView(), callback.getMessageId(), message.getOptions());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "gameTarget": // e.g. Pick triggered ability
|
|
||||||
{
|
|
||||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
|
||||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
|
||||||
if (panel != null) {
|
|
||||||
panel.pickTarget(message.getMessage(), message.getCardsView(), message.getGameView(),
|
|
||||||
message.getTargets(), message.isFlag(), message.getOptions(), callback.getMessageId());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "gameSelect": {
|
|
||||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
|
||||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
|
||||||
if (panel != null) {
|
|
||||||
panel.select(message.getMessage(), message.getGameView(), callback.getMessageId(), message.getOptions());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "gameChooseAbility": {
|
|
||||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
|
||||||
if (panel != null) {
|
|
||||||
panel.pickAbility((AbilityPickerView) callback.getData());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "gameChoosePile": {
|
|
||||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
|
||||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
|
||||||
if (panel != null) {
|
|
||||||
panel.pickPile(message.getMessage(), message.getPile1(), message.getPile2());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "gameChooseChoice": {
|
|
||||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
|
||||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
|
||||||
|
|
||||||
if (panel != null) {
|
|
||||||
panel.getChoice(message.getChoice(), callback.getObjectId());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "gamePlayMana": {
|
|
||||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
|
||||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
|
||||||
if (panel != null) {
|
|
||||||
panel.playMana(message.getMessage(), message.getGameView(), message.getOptions(), callback.getMessageId());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "gamePlayXMana": {
|
|
||||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
|
||||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
|
||||||
if (panel != null) {
|
|
||||||
panel.playXMana(message.getMessage(), message.getGameView(), callback.getMessageId());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "gameSelectAmount": {
|
|
||||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
|
||||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
|
||||||
if (panel != null) {
|
|
||||||
panel.getAmount(message.getMin(), message.getMax(), message.getMessage());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "gameUpdate": {
|
|
||||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
|
||||||
if (panel != null) {
|
|
||||||
panel.updateGame((GameView) callback.getData());
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "endGameInfo":
|
|
||||||
MageFrame.getInstance().showGameEndDialog((GameEndView) callback.getData());
|
|
||||||
break;
|
|
||||||
case "showUserMessage":
|
|
||||||
List<String> messageData = (List<String>) callback.getData();
|
|
||||||
if (messageData.size() == 2) {
|
|
||||||
JOptionPane.showMessageDialog(null, messageData.get(1), messageData.get(0), JOptionPane.WARNING_MESSAGE);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case "gameInform":
|
|
||||||
if (callback.getMessageId() > gameInformMessageId) {
|
|
||||||
{
|
|
||||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
|
||||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
|
||||||
if (panel != null) {
|
|
||||||
panel.inform(message.getMessage(), message.getGameView(), callback.getMessageId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// no longer needed because phase skip handling on server side now
|
// no longer needed because phase skip handling on server side now
|
||||||
} else {
|
} else {
|
||||||
logger.warn(new StringBuilder("message out of sequence - ignoring").append("MessageId = ").append(callback.getMessageId()).append(" method = ").append(callback.getMethod()));
|
logger.warn(new StringBuilder("message out of sequence - ignoring").append("MessageId = ").append(callback.getMessageId()).append(" method = ").append(callback.getMethod()));
|
||||||
//logger.warn("message out of sequence - ignoring");
|
//logger.warn("message out of sequence - ignoring");
|
||||||
}
|
|
||||||
gameInformMessageId = messageId;
|
|
||||||
break;
|
|
||||||
case "gameInformPersonal": {
|
|
||||||
GameClientMessage message = (GameClientMessage) callback.getData();
|
|
||||||
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
|
||||||
if (panel != null) {
|
|
||||||
JOptionPane.showMessageDialog(panel, message.getMessage(), "Game message",
|
|
||||||
JOptionPane.INFORMATION_MESSAGE);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case "sideboard": {
|
gameInformMessageId = messageId;
|
||||||
TableClientMessage message = (TableClientMessage) callback.getData();
|
break;
|
||||||
DeckView deckView = message.getDeck();
|
case "gameInformPersonal": {
|
||||||
Deck deck = DeckUtil.construct(deckView);
|
GameClientMessage message = (GameClientMessage) callback.getData();
|
||||||
if (message.getFlag()) {
|
GamePanel panel = MageFrame.getGame(callback.getObjectId());
|
||||||
construct(deck, message.getTableId(), message.getTime());
|
if (panel != null) {
|
||||||
} else {
|
JOptionPane.showMessageDialog(panel, message.getMessage(), "Game message",
|
||||||
sideboard(deck, message.getTableId(), message.getTime());
|
JOptionPane.INFORMATION_MESSAGE);
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case "construct": {
|
break;
|
||||||
TableClientMessage message = (TableClientMessage) callback.getData();
|
}
|
||||||
DeckView deckView = message.getDeck();
|
case "sideboard": {
|
||||||
Deck deck = DeckUtil.construct(deckView);
|
TableClientMessage message = (TableClientMessage) callback.getData();
|
||||||
|
DeckView deckView = message.getDeck();
|
||||||
|
Deck deck = DeckUtil.construct(deckView);
|
||||||
|
if (message.getFlag()) {
|
||||||
construct(deck, message.getTableId(), message.getTime());
|
construct(deck, message.getTableId(), message.getTime());
|
||||||
break;
|
} else {
|
||||||
|
sideboard(deck, message.getTableId(), message.getTime());
|
||||||
}
|
}
|
||||||
case "draftOver":
|
break;
|
||||||
MageFrame.removeDraft(callback.getObjectId());
|
}
|
||||||
break;
|
case "construct": {
|
||||||
case "draftPick": {
|
TableClientMessage message = (TableClientMessage) callback.getData();
|
||||||
DraftClientMessage message = (DraftClientMessage) callback.getData();
|
DeckView deckView = message.getDeck();
|
||||||
DraftPanel panel = MageFrame.getDraft(callback.getObjectId());
|
Deck deck = DeckUtil.construct(deckView);
|
||||||
if (panel != null) {
|
construct(deck, message.getTableId(), message.getTime());
|
||||||
panel.loadBooster(message.getDraftPickView());
|
break;
|
||||||
}
|
}
|
||||||
break;
|
case "draftOver":
|
||||||
|
MageFrame.removeDraft(callback.getObjectId());
|
||||||
|
break;
|
||||||
|
case "draftPick": {
|
||||||
|
DraftClientMessage message = (DraftClientMessage) callback.getData();
|
||||||
|
DraftPanel panel = MageFrame.getDraft(callback.getObjectId());
|
||||||
|
if (panel != null) {
|
||||||
|
panel.loadBooster(message.getDraftPickView());
|
||||||
}
|
}
|
||||||
case "draftUpdate": {
|
break;
|
||||||
DraftPanel panel = MageFrame.getDraft(callback.getObjectId());
|
}
|
||||||
if (panel != null) {
|
case "draftUpdate": {
|
||||||
panel.updateDraft((DraftView) callback.getData());
|
DraftPanel panel = MageFrame.getDraft(callback.getObjectId());
|
||||||
}
|
if (panel != null) {
|
||||||
break;
|
panel.updateDraft((DraftView) callback.getData());
|
||||||
}
|
|
||||||
case "draftInform": // if (callback.getMessageId() > messageId) {
|
|
||||||
{
|
|
||||||
DraftClientMessage message = (DraftClientMessage) callback.getData();
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "draftInform": // if (callback.getMessageId() > messageId) {
|
||||||
|
{
|
||||||
|
DraftClientMessage message = (DraftClientMessage) callback.getData();
|
||||||
|
}
|
||||||
// } else {
|
// } else {
|
||||||
// logger.warn("message out of sequence - ignoring");
|
// logger.warn("message out of sequence - ignoring");
|
||||||
// }
|
// }
|
||||||
break;
|
break;
|
||||||
case "draftInit": {
|
case "draftInit": {
|
||||||
DraftClientMessage message = (DraftClientMessage) callback.getData();
|
DraftClientMessage message = (DraftClientMessage) callback.getData();
|
||||||
DraftPanel panel = MageFrame.getDraft(callback.getObjectId());
|
DraftPanel panel = MageFrame.getDraft(callback.getObjectId());
|
||||||
if (panel != null) {
|
if (panel != null) {
|
||||||
panel.loadBooster(message.getDraftPickView());
|
panel.loadBooster(message.getDraftPickView());
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case "tournamentInit":
|
break;
|
||||||
break;
|
|
||||||
case "userRequestDialog":
|
|
||||||
frame.showUserRequestDialog((UserRequestMessage) callback.getData());
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
messageId = callback.getMessageId();
|
case "tournamentInit":
|
||||||
} catch (Exception ex) {
|
break;
|
||||||
handleException(ex);
|
case "userRequestDialog":
|
||||||
|
frame.showUserRequestDialog((UserRequestMessage) callback.getData());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
messageId = callback.getMessageId();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
handleException(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -391,28 +388,28 @@ public class CallbackClientImpl implements CallbackClient {
|
||||||
.append("<br/>Turn mousewheel up (ALT-e) - enlarge image of card the mousepointer hovers over")
|
.append("<br/>Turn mousewheel up (ALT-e) - enlarge image of card the mousepointer hovers over")
|
||||||
.append("<br/>Turn mousewheel down (ALT-s) - enlarge original/alternate image of card the mousepointer hovers over")
|
.append("<br/>Turn mousewheel down (ALT-s) - enlarge original/alternate image of card the mousepointer hovers over")
|
||||||
.append("<br/><b>")
|
.append("<br/><b>")
|
||||||
.append(KeyEvent.getKeyText((Integer) PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONTROL_CONFIRM, 113)))
|
.append(KeyEvent.getKeyText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONTROL_CONFIRM, 113)))
|
||||||
.append("</b> - Confirm \"Ok\", \"Yes\" or \"Done\" button")
|
.append("</b> - Confirm \"Ok\", \"Yes\" or \"Done\" button")
|
||||||
.append("<br/><b>")
|
.append("<br/><b>")
|
||||||
.append(KeyEvent.getKeyText((Integer) PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONTROL_NEXT_TURN, 115)))
|
.append(KeyEvent.getKeyText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONTROL_NEXT_TURN, 115)))
|
||||||
.append("</b> - Skip current turn but stop on declare attackers/blockers and something on the stack")
|
.append("</b> - Skip current turn but stop on declare attackers/blockers and something on the stack")
|
||||||
.append("<br/><b>")
|
.append("<br/><b>")
|
||||||
.append(KeyEvent.getKeyText((Integer) PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONTROL_END_STEP, 116)))
|
.append(KeyEvent.getKeyText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONTROL_END_STEP, 116)))
|
||||||
.append("</b> - Skip to next end step but stop on declare attackers/blockers and something on the stack")
|
.append("</b> - Skip to next end step but stop on declare attackers/blockers and something on the stack")
|
||||||
.append("<br/><b>")
|
.append("<br/><b>")
|
||||||
.append(KeyEvent.getKeyText((Integer) PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONTROL_SKIP_STEP, 117)))
|
.append(KeyEvent.getKeyText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONTROL_SKIP_STEP, 117)))
|
||||||
.append("</b> - Skip current turn but stop on declare attackers/blockers")
|
.append("</b> - Skip current turn but stop on declare attackers/blockers")
|
||||||
.append("<br/><b>")
|
.append("<br/><b>")
|
||||||
.append(KeyEvent.getKeyText((Integer) PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONTROL_MAIN_STEP, 118)))
|
.append(KeyEvent.getKeyText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONTROL_MAIN_STEP, 118)))
|
||||||
.append("</b> - Skip to next main phase but stop on declare attackers/blockers and something on the stack")
|
.append("</b> - Skip to next main phase but stop on declare attackers/blockers and something on the stack")
|
||||||
.append("<br/><b>")
|
.append("<br/><b>")
|
||||||
.append(KeyEvent.getKeyText((Integer) PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONTROL_YOUR_TURN, 120)))
|
.append(KeyEvent.getKeyText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONTROL_YOUR_TURN, 120)))
|
||||||
.append("</b> - Skip everything until your next turn")
|
.append("</b> - Skip everything until your next turn")
|
||||||
.append("<br/><b>")
|
.append("<br/><b>")
|
||||||
.append(KeyEvent.getKeyText((Integer) PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONTROL_PRIOR_END, 122)))
|
.append(KeyEvent.getKeyText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONTROL_PRIOR_END, 122)))
|
||||||
.append("</b> - Skip everything until the end step just prior to your turn")
|
.append("</b> - Skip everything until the end step just prior to your turn")
|
||||||
.append("<br/><b>")
|
.append("<br/><b>")
|
||||||
.append(KeyEvent.getKeyText((Integer) PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONTROL_CANCEL_SKIP, 114)))
|
.append(KeyEvent.getKeyText(PreferencesDialog.getCachedValue(PreferencesDialog.KEY_CONTROL_CANCEL_SKIP, 114)))
|
||||||
.append("</b> - Undo F4/F5/F7/F9/F11")
|
.append("</b> - Undo F4/F5/F7/F9/F11")
|
||||||
.append("<br/><b>").append(System.getProperty("os.name").contains("Mac OS X") ? "Cmd" : "Ctrl").append(" + click</b> - Hold priority while casting a spell or activating an ability").toString(),
|
.append("<br/><b>").append(System.getProperty("os.name").contains("Mac OS X") ? "Cmd" : "Ctrl").append(" + click</b> - Hold priority while casting a spell or activating an ability").toString(),
|
||||||
null, MessageType.USER_INFO, ChatMessage.MessageColor.BLUE);
|
null, MessageType.USER_INFO, ChatMessage.MessageColor.BLUE);
|
||||||
|
|
|
@ -153,18 +153,10 @@ public class NewPlayerPanel extends javax.swing.JPanel {
|
||||||
lblPlayerDeck.setText("Deck:");
|
lblPlayerDeck.setText("Deck:");
|
||||||
|
|
||||||
btnPlayerDeck.setText("...");
|
btnPlayerDeck.setText("...");
|
||||||
btnPlayerDeck.addActionListener(new java.awt.event.ActionListener() {
|
btnPlayerDeck.addActionListener(evt -> btnPlayerDeckActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnPlayerDeckActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnGenerate.setText("Generate");
|
btnGenerate.setText("Generate");
|
||||||
btnGenerate.addActionListener(new java.awt.event.ActionListener() {
|
btnGenerate.addActionListener(evt -> btnGenerateActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnGenerateActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lblLevel.setText("Skill:");
|
lblLevel.setText("Skill:");
|
||||||
|
|
||||||
|
|
|
@ -394,7 +394,7 @@ public class PlayersChatPanel extends javax.swing.JPanel {
|
||||||
class ColumnHeaderToolTips extends MouseMotionAdapter {
|
class ColumnHeaderToolTips extends MouseMotionAdapter {
|
||||||
|
|
||||||
int curCol;
|
int curCol;
|
||||||
Map<Integer, String> tips = new HashMap<>();
|
final Map<Integer, String> tips = new HashMap<>();
|
||||||
|
|
||||||
public void setToolTip(Integer mCol, String tooltip) {
|
public void setToolTip(Integer mCol, String tooltip) {
|
||||||
if (tooltip == null) {
|
if (tooltip == null) {
|
||||||
|
|
|
@ -34,17 +34,14 @@
|
||||||
|
|
||||||
package mage.client.table;
|
package mage.client.table;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import javax.swing.DefaultComboBoxModel;
|
import javax.swing.DefaultComboBoxModel;
|
||||||
import mage.cards.decks.importer.DeckImporterUtil;
|
import mage.cards.decks.importer.DeckImporterUtil;
|
||||||
import mage.client.MageFrame;
|
|
||||||
import mage.client.SessionHandler;
|
import mage.client.SessionHandler;
|
||||||
import mage.client.util.Config;
|
import mage.client.util.Config;
|
||||||
import mage.client.util.Event;
|
import mage.client.util.Event;
|
||||||
import mage.client.util.Listener;
|
import mage.client.util.Listener;
|
||||||
import mage.remote.Session;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -52,7 +49,7 @@ import mage.remote.Session;
|
||||||
*/
|
*/
|
||||||
public class TablePlayerPanel extends javax.swing.JPanel {
|
public class TablePlayerPanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
protected PlayerTypeEventSource playerTypeEventSource = new PlayerTypeEventSource();
|
protected final PlayerTypeEventSource playerTypeEventSource = new PlayerTypeEventSource();
|
||||||
|
|
||||||
|
|
||||||
/** Creates new form TablePlayerPanel */
|
/** Creates new form TablePlayerPanel */
|
||||||
|
@ -78,7 +75,7 @@ public class TablePlayerPanel extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean joinTable(UUID roomId, UUID tableId) throws FileNotFoundException, IOException, ClassNotFoundException {
|
public boolean joinTable(UUID roomId, UUID tableId) throws IOException, ClassNotFoundException {
|
||||||
if (!this.cbPlayerType.getSelectedItem().equals("Human")) {
|
if (!this.cbPlayerType.getSelectedItem().equals("Human")) {
|
||||||
return SessionHandler.joinTable(roomId, tableId, this.newPlayerPanel.getPlayerName(), (String)this.cbPlayerType.getSelectedItem(), this.newPlayerPanel.getLevel(), DeckImporterUtil.importDeck(this.newPlayerPanel.getDeckFile()),"");
|
return SessionHandler.joinTable(roomId, tableId, this.newPlayerPanel.getPlayerName(), (String)this.cbPlayerType.getSelectedItem(), this.newPlayerPanel.getLevel(), DeckImporterUtil.importDeck(this.newPlayerPanel.getDeckFile()),"");
|
||||||
}
|
}
|
||||||
|
@ -114,11 +111,7 @@ public class TablePlayerPanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
lbPlayerType.setText("Type:");
|
lbPlayerType.setText("Type:");
|
||||||
|
|
||||||
cbPlayerType.addActionListener(new java.awt.event.ActionListener() {
|
cbPlayerType.addActionListener(evt -> cbPlayerTypeActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbPlayerTypeActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lblPlayerNum.setFont(new java.awt.Font("Tahoma", 1, 11));
|
lblPlayerNum.setFont(new java.awt.Font("Tahoma", 1, 11));
|
||||||
lblPlayerNum.setText("Player #");
|
lblPlayerNum.setText("Player #");
|
||||||
|
|
|
@ -29,7 +29,7 @@ package mage.client.table;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import mage.client.MageFrame;
|
|
||||||
import mage.client.MagePane;
|
import mage.client.MagePane;
|
||||||
import mage.client.SessionHandler;
|
import mage.client.SessionHandler;
|
||||||
import mage.client.plugins.impl.Plugins;
|
import mage.client.plugins.impl.Plugins;
|
||||||
|
|
|
@ -82,6 +82,7 @@ import mage.client.dialog.PreferencesDialog;
|
||||||
import static mage.client.dialog.PreferencesDialog.KEY_TABLES_COLUMNS_ORDER;
|
import static mage.client.dialog.PreferencesDialog.KEY_TABLES_COLUMNS_ORDER;
|
||||||
import static mage.client.dialog.PreferencesDialog.KEY_TABLES_COLUMNS_WIDTH;
|
import static mage.client.dialog.PreferencesDialog.KEY_TABLES_COLUMNS_WIDTH;
|
||||||
import mage.client.dialog.TableWaitingDialog;
|
import mage.client.dialog.TableWaitingDialog;
|
||||||
|
import static mage.client.table.TablesPanel.PASSWORDED;
|
||||||
import mage.client.util.ButtonColumn;
|
import mage.client.util.ButtonColumn;
|
||||||
import mage.client.util.GUISizeHelper;
|
import mage.client.util.GUISizeHelper;
|
||||||
import mage.client.util.MageTableRowSorter;
|
import mage.client.util.MageTableRowSorter;
|
||||||
|
@ -109,8 +110,9 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
private static final Logger LOGGER = Logger.getLogger(TablesPanel.class);
|
private static final Logger LOGGER = Logger.getLogger(TablesPanel.class);
|
||||||
private static final int[] DEFAULT_COLUMNS_WIDTH = {35, 150, 120, 180, 80, 120, 80, 60, 40, 40, 60};
|
private static final int[] DEFAULT_COLUMNS_WIDTH = {35, 150, 120, 180, 80, 120, 80, 60, 40, 40, 60};
|
||||||
|
|
||||||
private TableTableModel tableModel;
|
public static final String PASSWORDED = "***";
|
||||||
private MatchesTableModel matchesModel;
|
private final TableTableModel tableModel;
|
||||||
|
private final MatchesTableModel matchesModel;
|
||||||
private UUID roomId;
|
private UUID roomId;
|
||||||
private UpdateTablesTask updateTablesTask;
|
private UpdateTablesTask updateTablesTask;
|
||||||
private UpdatePlayersTask updatePlayersTask;
|
private UpdatePlayersTask updatePlayersTask;
|
||||||
|
@ -118,15 +120,15 @@ 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 GameChooser gameChooser;
|
private final GameChooser gameChooser;
|
||||||
private List<String> messages;
|
private List<String> messages;
|
||||||
private int currentMessage;
|
private int currentMessage;
|
||||||
private MageTableRowSorter activeTablesSorter;
|
private final MageTableRowSorter activeTablesSorter;
|
||||||
|
|
||||||
private final ButtonColumn actionButton1;
|
private final ButtonColumn actionButton1;
|
||||||
private final ButtonColumn actionButton2;
|
private final ButtonColumn actionButton2;
|
||||||
|
|
||||||
JToggleButton[] filterButtons;
|
final JToggleButton[] filterButtons;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new form TablesPanel
|
* Creates new form TablesPanel
|
||||||
|
@ -138,7 +140,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
gameChooser = new GameChooser();
|
gameChooser = new GameChooser();
|
||||||
|
|
||||||
initComponents();
|
initComponents();
|
||||||
// tableModel.setSession(session);
|
// tableModel.setSession(session);
|
||||||
|
|
||||||
tableTables.createDefaultColumnsFromModel();
|
tableTables.createDefaultColumnsFromModel();
|
||||||
|
|
||||||
|
@ -180,9 +182,9 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
UUID gameId = (UUID) tableModel.getValueAt(modelRow, TableTableModel.ACTION_COLUMN + 2);
|
UUID gameId = (UUID) tableModel.getValueAt(modelRow, TableTableModel.ACTION_COLUMN + 2);
|
||||||
String action = (String) tableModel.getValueAt(modelRow, TableTableModel.ACTION_COLUMN);
|
String action = (String) tableModel.getValueAt(modelRow, TableTableModel.ACTION_COLUMN);
|
||||||
String deckType = (String) tableModel.getValueAt(modelRow, TableTableModel.COLUMN_DECK_TYPE);
|
String deckType = (String) tableModel.getValueAt(modelRow, TableTableModel.COLUMN_DECK_TYPE);
|
||||||
String status = (String) tableModel.getValueAt(modelRow, TableTableModel.COLUMN_STATUS);
|
|
||||||
boolean isTournament = (Boolean) tableModel.getValueAt(modelRow, TableTableModel.ACTION_COLUMN + 1);
|
boolean isTournament = (Boolean) tableModel.getValueAt(modelRow, TableTableModel.ACTION_COLUMN + 1);
|
||||||
String owner = (String) tableModel.getValueAt(modelRow, TableTableModel.COLUMN_OWNER);
|
String owner = (String) tableModel.getValueAt(modelRow, TableTableModel.COLUMN_OWNER);
|
||||||
|
String pwdColumn = (String) tableModel.getValueAt(modelRow, TableTableModel.COLUMN_PASSWORD);
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case "Join":
|
case "Join":
|
||||||
if (owner.equals(SessionHandler.getUserName()) || owner.startsWith(SessionHandler.getUserName() + ",")) {
|
if (owner.equals(SessionHandler.getUserName()) || owner.startsWith(SessionHandler.getUserName() + ",")) {
|
||||||
|
@ -209,10 +211,10 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
if (isTournament) {
|
if (isTournament) {
|
||||||
LOGGER.info("Joining tournament " + tableId);
|
LOGGER.info("Joining tournament " + tableId);
|
||||||
if (deckType.startsWith("Limited")) {
|
if (deckType.startsWith("Limited")) {
|
||||||
if (!status.endsWith("PW")) {
|
if (PASSWORDED.equals(pwdColumn)) {
|
||||||
SessionHandler.joinTournamentTable(roomId, tableId, SessionHandler.getUserName(), "Human", 1, null, "");
|
|
||||||
} else {
|
|
||||||
joinTableDialog.showDialog(roomId, tableId, true, deckType.startsWith("Limited"));
|
joinTableDialog.showDialog(roomId, tableId, true, deckType.startsWith("Limited"));
|
||||||
|
} else {
|
||||||
|
SessionHandler.joinTournamentTable(roomId, tableId, SessionHandler.getUserName(), "Human", 1, null, "");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
joinTableDialog.showDialog(roomId, tableId, true, deckType.startsWith("Limited"));
|
joinTableDialog.showDialog(roomId, tableId, true, deckType.startsWith("Limited"));
|
||||||
|
@ -266,7 +268,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
// MageFrame.getDesktop().showTournament(tournamentId);
|
// MageFrame.getDesktop().showTournament(tournamentId);
|
||||||
break;
|
break;
|
||||||
case "Show":;
|
case "Show":
|
||||||
if (matchesModel.isTournament(modelRow)) {
|
if (matchesModel.isTournament(modelRow)) {
|
||||||
LOGGER.info("Showing tournament table " + matchesModel.getTableId(modelRow));
|
LOGGER.info("Showing tournament table " + matchesModel.getTableId(modelRow));
|
||||||
SessionHandler.watchTable(roomId, matchesModel.getTableId(modelRow));
|
SessionHandler.watchTable(roomId, matchesModel.getTableId(modelRow));
|
||||||
|
@ -505,12 +507,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
MageFrame.getUI().addButton(MageComponents.NEW_GAME_BUTTON, btnNewTable);
|
MageFrame.getUI().addButton(MageComponents.NEW_GAME_BUTTON, btnNewTable);
|
||||||
|
|
||||||
// divider locations have to be set with delay else values set are overwritten with system defaults
|
// divider locations have to be set with delay else values set are overwritten with system defaults
|
||||||
Executors.newSingleThreadScheduledExecutor().schedule(new Runnable() {
|
Executors.newSingleThreadScheduledExecutor().schedule(() -> restoreDividerLocations(), 300, TimeUnit.MILLISECONDS);
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
restoreDividerLocations();
|
|
||||||
}
|
|
||||||
}, 300, TimeUnit.MILLISECONDS);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -617,10 +614,10 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
List<RowFilter<Object, Object>> ratingFilterList = new ArrayList<>();
|
List<RowFilter<Object, Object>> ratingFilterList = new ArrayList<>();
|
||||||
if (btnRated.isSelected()){
|
if (btnRated.isSelected()) {
|
||||||
ratingFilterList.add(RowFilter.regexFilter("^Rated", TableTableModel.COLUMN_RATING));
|
ratingFilterList.add(RowFilter.regexFilter("^Rated", TableTableModel.COLUMN_RATING));
|
||||||
}
|
}
|
||||||
if (btnUnrated.isSelected()){
|
if (btnUnrated.isSelected()) {
|
||||||
ratingFilterList.add(RowFilter.regexFilter("^Unrated", TableTableModel.COLUMN_RATING));
|
ratingFilterList.add(RowFilter.regexFilter("^Unrated", TableTableModel.COLUMN_RATING));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -670,7 +667,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
filterList.addAll(ratingFilterList);
|
filterList.addAll(ratingFilterList);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (passwordFilterList.size() > 1) {
|
if (passwordFilterList.size() > 1) {
|
||||||
filterList.add(RowFilter.orFilter(passwordFilterList));
|
filterList.add(RowFilter.orFilter(passwordFilterList));
|
||||||
} else if (passwordFilterList.size() == 1) {
|
} else if (passwordFilterList.size() == 1) {
|
||||||
filterList.addAll(passwordFilterList);
|
filterList.addAll(passwordFilterList);
|
||||||
|
@ -749,20 +746,12 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
btnNewTable.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/match_new.png"))); // NOI18N
|
btnNewTable.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/match_new.png"))); // NOI18N
|
||||||
btnNewTable.setToolTipText("Creates a new match table.");
|
btnNewTable.setToolTipText("Creates a new match table.");
|
||||||
btnNewTable.setMargin(new java.awt.Insets(2, 2, 2, 2));
|
btnNewTable.setMargin(new java.awt.Insets(2, 2, 2, 2));
|
||||||
btnNewTable.addActionListener(new java.awt.event.ActionListener() {
|
btnNewTable.addActionListener(evt -> btnNewTableActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnNewTableActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnNewTournament.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/tourney_new.png"))); // NOI18N
|
btnNewTournament.setIcon(new javax.swing.ImageIcon(getClass().getResource("/buttons/tourney_new.png"))); // NOI18N
|
||||||
btnNewTournament.setToolTipText("Creates a new tourney table.");
|
btnNewTournament.setToolTipText("Creates a new tourney table.");
|
||||||
btnNewTournament.setMargin(new java.awt.Insets(2, 2, 2, 2));
|
btnNewTournament.setMargin(new java.awt.Insets(2, 2, 2, 2));
|
||||||
btnNewTournament.addActionListener(new java.awt.event.ActionListener() {
|
btnNewTournament.addActionListener(evt -> btnNewTournamentActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnNewTournamentActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
filterBar1.setFloatable(false);
|
filterBar1.setFloatable(false);
|
||||||
filterBar1.setForeground(new java.awt.Color(102, 102, 255));
|
filterBar1.setForeground(new java.awt.Color(102, 102, 255));
|
||||||
|
@ -778,11 +767,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
btnStateWaiting.setRequestFocusEnabled(false);
|
btnStateWaiting.setRequestFocusEnabled(false);
|
||||||
btnStateWaiting.setVerifyInputWhenFocusTarget(false);
|
btnStateWaiting.setVerifyInputWhenFocusTarget(false);
|
||||||
btnStateWaiting.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnStateWaiting.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnStateWaiting.addActionListener(new java.awt.event.ActionListener() {
|
btnStateWaiting.addActionListener(evt -> btnFilterActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnFilterActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
filterBar1.add(btnStateWaiting);
|
filterBar1.add(btnStateWaiting);
|
||||||
|
|
||||||
btnStateActive.setSelected(true);
|
btnStateActive.setSelected(true);
|
||||||
|
@ -794,11 +779,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
btnStateActive.setRequestFocusEnabled(false);
|
btnStateActive.setRequestFocusEnabled(false);
|
||||||
btnStateActive.setVerifyInputWhenFocusTarget(false);
|
btnStateActive.setVerifyInputWhenFocusTarget(false);
|
||||||
btnStateActive.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnStateActive.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnStateActive.addActionListener(new java.awt.event.ActionListener() {
|
btnStateActive.addActionListener(evt -> btnFilterActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnFilterActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
filterBar1.add(btnStateActive);
|
filterBar1.add(btnStateActive);
|
||||||
|
|
||||||
btnStateFinished.setSelected(true);
|
btnStateFinished.setSelected(true);
|
||||||
|
@ -810,11 +791,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
btnStateFinished.setRequestFocusEnabled(false);
|
btnStateFinished.setRequestFocusEnabled(false);
|
||||||
btnStateFinished.setVerifyInputWhenFocusTarget(false);
|
btnStateFinished.setVerifyInputWhenFocusTarget(false);
|
||||||
btnStateFinished.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnStateFinished.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnStateFinished.addActionListener(new java.awt.event.ActionListener() {
|
btnStateFinished.addActionListener(evt -> btnStateFinishedActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnStateFinishedActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
filterBar1.add(btnStateFinished);
|
filterBar1.add(btnStateFinished);
|
||||||
filterBar1.add(jSeparator1);
|
filterBar1.add(jSeparator1);
|
||||||
|
|
||||||
|
@ -828,11 +805,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
btnTypeMatch.setRequestFocusEnabled(false);
|
btnTypeMatch.setRequestFocusEnabled(false);
|
||||||
btnTypeMatch.setVerifyInputWhenFocusTarget(false);
|
btnTypeMatch.setVerifyInputWhenFocusTarget(false);
|
||||||
btnTypeMatch.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnTypeMatch.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnTypeMatch.addActionListener(new java.awt.event.ActionListener() {
|
btnTypeMatch.addActionListener(evt -> btnFilterActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnFilterActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
filterBar1.add(btnTypeMatch);
|
filterBar1.add(btnTypeMatch);
|
||||||
|
|
||||||
btnTypeTourneyConstructed.setSelected(true);
|
btnTypeTourneyConstructed.setSelected(true);
|
||||||
|
@ -843,11 +816,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
btnTypeTourneyConstructed.setFocusable(false);
|
btnTypeTourneyConstructed.setFocusable(false);
|
||||||
btnTypeTourneyConstructed.setRequestFocusEnabled(false);
|
btnTypeTourneyConstructed.setRequestFocusEnabled(false);
|
||||||
btnTypeTourneyConstructed.setVerifyInputWhenFocusTarget(false);
|
btnTypeTourneyConstructed.setVerifyInputWhenFocusTarget(false);
|
||||||
btnTypeTourneyConstructed.addActionListener(new java.awt.event.ActionListener() {
|
btnTypeTourneyConstructed.addActionListener(evt -> btnFilterActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnFilterActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
filterBar1.add(btnTypeTourneyConstructed);
|
filterBar1.add(btnTypeTourneyConstructed);
|
||||||
|
|
||||||
btnTypeTourneyLimited.setSelected(true);
|
btnTypeTourneyLimited.setSelected(true);
|
||||||
|
@ -859,11 +828,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
btnTypeTourneyLimited.setMaximumSize(new java.awt.Dimension(72, 20));
|
btnTypeTourneyLimited.setMaximumSize(new java.awt.Dimension(72, 20));
|
||||||
btnTypeTourneyLimited.setRequestFocusEnabled(false);
|
btnTypeTourneyLimited.setRequestFocusEnabled(false);
|
||||||
btnTypeTourneyLimited.setVerifyInputWhenFocusTarget(false);
|
btnTypeTourneyLimited.setVerifyInputWhenFocusTarget(false);
|
||||||
btnTypeTourneyLimited.addActionListener(new java.awt.event.ActionListener() {
|
btnTypeTourneyLimited.addActionListener(evt -> btnFilterActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnFilterActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
filterBar1.add(btnTypeTourneyLimited);
|
filterBar1.add(btnTypeTourneyLimited);
|
||||||
filterBar1.add(jSeparator4);
|
filterBar1.add(jSeparator4);
|
||||||
|
|
||||||
|
@ -877,11 +842,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
btnSkillBeginner.setRequestFocusEnabled(false);
|
btnSkillBeginner.setRequestFocusEnabled(false);
|
||||||
btnSkillBeginner.setVerifyInputWhenFocusTarget(false);
|
btnSkillBeginner.setVerifyInputWhenFocusTarget(false);
|
||||||
btnSkillBeginner.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnSkillBeginner.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnSkillBeginner.addActionListener(new java.awt.event.ActionListener() {
|
btnSkillBeginner.addActionListener(evt -> btnFilterActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnFilterActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
filterBar1.add(btnSkillBeginner);
|
filterBar1.add(btnSkillBeginner);
|
||||||
|
|
||||||
btnSkillCasual.setSelected(true);
|
btnSkillCasual.setSelected(true);
|
||||||
|
@ -894,11 +855,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
btnSkillCasual.setRequestFocusEnabled(false);
|
btnSkillCasual.setRequestFocusEnabled(false);
|
||||||
btnSkillCasual.setVerifyInputWhenFocusTarget(false);
|
btnSkillCasual.setVerifyInputWhenFocusTarget(false);
|
||||||
btnSkillCasual.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnSkillCasual.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnSkillCasual.addActionListener(new java.awt.event.ActionListener() {
|
btnSkillCasual.addActionListener(evt -> btnFilterActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnFilterActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
filterBar1.add(btnSkillCasual);
|
filterBar1.add(btnSkillCasual);
|
||||||
|
|
||||||
btnSkillSerious.setSelected(true);
|
btnSkillSerious.setSelected(true);
|
||||||
|
@ -911,11 +868,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
btnSkillSerious.setRequestFocusEnabled(false);
|
btnSkillSerious.setRequestFocusEnabled(false);
|
||||||
btnSkillSerious.setVerifyInputWhenFocusTarget(false);
|
btnSkillSerious.setVerifyInputWhenFocusTarget(false);
|
||||||
btnSkillSerious.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnSkillSerious.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnSkillSerious.addActionListener(new java.awt.event.ActionListener() {
|
btnSkillSerious.addActionListener(evt -> btnFilterActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnFilterActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
filterBar1.add(btnSkillSerious);
|
filterBar1.add(btnSkillSerious);
|
||||||
|
|
||||||
filterBar1.add(jSeparator4);
|
filterBar1.add(jSeparator4);
|
||||||
|
@ -929,11 +882,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
btnRated.setRequestFocusEnabled(false);
|
btnRated.setRequestFocusEnabled(false);
|
||||||
btnRated.setVerifyInputWhenFocusTarget(false);
|
btnRated.setVerifyInputWhenFocusTarget(false);
|
||||||
btnRated.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnRated.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnRated.addActionListener(new java.awt.event.ActionListener() {
|
btnRated.addActionListener(evt -> btnFilterActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnFilterActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
filterBar1.add(btnRated);
|
filterBar1.add(btnRated);
|
||||||
|
|
||||||
btnUnrated.setSelected(true);
|
btnUnrated.setSelected(true);
|
||||||
|
@ -945,11 +894,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
btnUnrated.setRequestFocusEnabled(false);
|
btnUnrated.setRequestFocusEnabled(false);
|
||||||
btnUnrated.setVerifyInputWhenFocusTarget(false);
|
btnUnrated.setVerifyInputWhenFocusTarget(false);
|
||||||
btnUnrated.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnUnrated.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnUnrated.addActionListener(new java.awt.event.ActionListener() {
|
btnUnrated.addActionListener(evt -> btnFilterActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnFilterActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
filterBar1.add(btnUnrated);
|
filterBar1.add(btnUnrated);
|
||||||
|
|
||||||
// second filter line
|
// second filter line
|
||||||
|
@ -966,11 +911,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
btnFormatBlock.setRequestFocusEnabled(false);
|
btnFormatBlock.setRequestFocusEnabled(false);
|
||||||
btnFormatBlock.setVerifyInputWhenFocusTarget(false);
|
btnFormatBlock.setVerifyInputWhenFocusTarget(false);
|
||||||
btnFormatBlock.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnFormatBlock.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnFormatBlock.addActionListener(new java.awt.event.ActionListener() {
|
btnFormatBlock.addActionListener(evt -> btnFilterActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnFilterActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
filterBar2.add(btnFormatBlock);
|
filterBar2.add(btnFormatBlock);
|
||||||
|
|
||||||
btnFormatStandard.setSelected(true);
|
btnFormatStandard.setSelected(true);
|
||||||
|
@ -982,11 +923,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
btnFormatStandard.setRequestFocusEnabled(false);
|
btnFormatStandard.setRequestFocusEnabled(false);
|
||||||
btnFormatStandard.setVerifyInputWhenFocusTarget(false);
|
btnFormatStandard.setVerifyInputWhenFocusTarget(false);
|
||||||
btnFormatStandard.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnFormatStandard.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnFormatStandard.addActionListener(new java.awt.event.ActionListener() {
|
btnFormatStandard.addActionListener(evt -> btnFilterActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnFilterActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
filterBar2.add(btnFormatStandard);
|
filterBar2.add(btnFormatStandard);
|
||||||
|
|
||||||
btnFormatModern.setSelected(true);
|
btnFormatModern.setSelected(true);
|
||||||
|
@ -996,11 +933,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
btnFormatModern.setFocusable(false);
|
btnFormatModern.setFocusable(false);
|
||||||
btnFormatModern.setRequestFocusEnabled(false);
|
btnFormatModern.setRequestFocusEnabled(false);
|
||||||
btnFormatModern.setVerifyInputWhenFocusTarget(false);
|
btnFormatModern.setVerifyInputWhenFocusTarget(false);
|
||||||
btnFormatModern.addActionListener(new java.awt.event.ActionListener() {
|
btnFormatModern.addActionListener(evt -> btnFilterActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnFilterActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
filterBar2.add(btnFormatModern);
|
filterBar2.add(btnFormatModern);
|
||||||
|
|
||||||
btnFormatLegacy.setSelected(true);
|
btnFormatLegacy.setSelected(true);
|
||||||
|
@ -1012,11 +945,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
btnFormatLegacy.setRequestFocusEnabled(false);
|
btnFormatLegacy.setRequestFocusEnabled(false);
|
||||||
btnFormatLegacy.setVerifyInputWhenFocusTarget(false);
|
btnFormatLegacy.setVerifyInputWhenFocusTarget(false);
|
||||||
btnFormatLegacy.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnFormatLegacy.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnFormatLegacy.addActionListener(new java.awt.event.ActionListener() {
|
btnFormatLegacy.addActionListener(evt -> btnFilterActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnFilterActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
filterBar2.add(btnFormatLegacy);
|
filterBar2.add(btnFormatLegacy);
|
||||||
|
|
||||||
btnFormatVintage.setSelected(true);
|
btnFormatVintage.setSelected(true);
|
||||||
|
@ -1028,11 +957,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
btnFormatVintage.setRequestFocusEnabled(false);
|
btnFormatVintage.setRequestFocusEnabled(false);
|
||||||
btnFormatVintage.setVerifyInputWhenFocusTarget(false);
|
btnFormatVintage.setVerifyInputWhenFocusTarget(false);
|
||||||
btnFormatVintage.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnFormatVintage.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnFormatVintage.addActionListener(new java.awt.event.ActionListener() {
|
btnFormatVintage.addActionListener(evt -> btnFilterActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnFilterActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
filterBar2.add(btnFormatVintage);
|
filterBar2.add(btnFormatVintage);
|
||||||
filterBar2.add(jSeparator3);
|
filterBar2.add(jSeparator3);
|
||||||
|
|
||||||
|
@ -1045,11 +970,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
btnFormatCommander.setRequestFocusEnabled(false);
|
btnFormatCommander.setRequestFocusEnabled(false);
|
||||||
btnFormatCommander.setVerifyInputWhenFocusTarget(false);
|
btnFormatCommander.setVerifyInputWhenFocusTarget(false);
|
||||||
btnFormatCommander.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnFormatCommander.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnFormatCommander.addActionListener(new java.awt.event.ActionListener() {
|
btnFormatCommander.addActionListener(evt -> btnFilterActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnFilterActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
filterBar2.add(btnFormatCommander);
|
filterBar2.add(btnFormatCommander);
|
||||||
|
|
||||||
btnFormatTinyLeader.setSelected(true);
|
btnFormatTinyLeader.setSelected(true);
|
||||||
|
@ -1059,11 +980,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
btnFormatTinyLeader.setFocusable(false);
|
btnFormatTinyLeader.setFocusable(false);
|
||||||
btnFormatTinyLeader.setRequestFocusEnabled(false);
|
btnFormatTinyLeader.setRequestFocusEnabled(false);
|
||||||
btnFormatTinyLeader.setVerifyInputWhenFocusTarget(false);
|
btnFormatTinyLeader.setVerifyInputWhenFocusTarget(false);
|
||||||
btnFormatTinyLeader.addActionListener(new java.awt.event.ActionListener() {
|
btnFormatTinyLeader.addActionListener(evt -> btnFilterActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnFilterActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
filterBar2.add(btnFormatTinyLeader);
|
filterBar2.add(btnFormatTinyLeader);
|
||||||
filterBar2.add(jSeparator2);
|
filterBar2.add(jSeparator2);
|
||||||
|
|
||||||
|
@ -1076,11 +993,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
btnFormatLimited.setRequestFocusEnabled(false);
|
btnFormatLimited.setRequestFocusEnabled(false);
|
||||||
btnFormatLimited.setVerifyInputWhenFocusTarget(false);
|
btnFormatLimited.setVerifyInputWhenFocusTarget(false);
|
||||||
btnFormatLimited.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnFormatLimited.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnFormatLimited.addActionListener(new java.awt.event.ActionListener() {
|
btnFormatLimited.addActionListener(evt -> btnFilterActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnFilterActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
filterBar2.add(btnFormatLimited);
|
filterBar2.add(btnFormatLimited);
|
||||||
|
|
||||||
btnFormatOther.setSelected(true);
|
btnFormatOther.setSelected(true);
|
||||||
|
@ -1090,11 +1003,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
btnFormatOther.setFocusable(false);
|
btnFormatOther.setFocusable(false);
|
||||||
btnFormatOther.setRequestFocusEnabled(false);
|
btnFormatOther.setRequestFocusEnabled(false);
|
||||||
btnFormatOther.setVerifyInputWhenFocusTarget(false);
|
btnFormatOther.setVerifyInputWhenFocusTarget(false);
|
||||||
btnFormatOther.addActionListener(new java.awt.event.ActionListener() {
|
btnFormatOther.addActionListener(evt -> btnFilterActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnFilterActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
filterBar2.add(btnFormatOther);
|
filterBar2.add(btnFormatOther);
|
||||||
filterBar2.add(jSeparator5);
|
filterBar2.add(jSeparator5);
|
||||||
|
|
||||||
|
@ -1107,11 +1016,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
btnOpen.setRequestFocusEnabled(false);
|
btnOpen.setRequestFocusEnabled(false);
|
||||||
btnOpen.setVerifyInputWhenFocusTarget(false);
|
btnOpen.setVerifyInputWhenFocusTarget(false);
|
||||||
btnOpen.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnOpen.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnOpen.addActionListener(new java.awt.event.ActionListener() {
|
btnOpen.addActionListener(evt -> btnFilterActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnFilterActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
filterBar2.add(btnOpen);
|
filterBar2.add(btnOpen);
|
||||||
|
|
||||||
btnPassword.setSelected(true);
|
btnPassword.setSelected(true);
|
||||||
|
@ -1123,22 +1028,14 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
btnPassword.setRequestFocusEnabled(false);
|
btnPassword.setRequestFocusEnabled(false);
|
||||||
btnPassword.setVerifyInputWhenFocusTarget(false);
|
btnPassword.setVerifyInputWhenFocusTarget(false);
|
||||||
btnPassword.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnPassword.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnPassword.addActionListener(new java.awt.event.ActionListener() {
|
btnPassword.addActionListener(evt -> btnFilterActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnFilterActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
filterBar2.add(btnPassword);
|
filterBar2.add(btnPassword);
|
||||||
|
|
||||||
btnQuickStart.setText("Quick Start");
|
btnQuickStart.setText("Quick Start");
|
||||||
btnQuickStart.setFocusable(false);
|
btnQuickStart.setFocusable(false);
|
||||||
btnQuickStart.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
btnQuickStart.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||||
btnQuickStart.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
btnQuickStart.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
|
||||||
btnQuickStart.addActionListener(new java.awt.event.ActionListener() {
|
btnQuickStart.addActionListener(evt -> btnQuickStartActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnQuickStartActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
javax.swing.GroupLayout jPanelTopLayout = new javax.swing.GroupLayout(jPanelTop);
|
javax.swing.GroupLayout jPanelTopLayout = new javax.swing.GroupLayout(jPanelTop);
|
||||||
jPanelTop.setLayout(jPanelTopLayout);
|
jPanelTop.setLayout(jPanelTopLayout);
|
||||||
|
@ -1235,11 +1132,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
jButtonFooterNext.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
jButtonFooterNext.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
|
||||||
jButtonFooterNext.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
jButtonFooterNext.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||||
jButtonFooterNext.setOpaque(false);
|
jButtonFooterNext.setOpaque(false);
|
||||||
jButtonFooterNext.addActionListener(new java.awt.event.ActionListener() {
|
jButtonFooterNext.addActionListener(evt -> jButtonFooterNextActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
jButtonFooterNextActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
jPanelBottom.add(jButtonFooterNext);
|
jPanelBottom.add(jButtonFooterNext);
|
||||||
|
|
||||||
jLabelFooterLabel.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
jLabelFooterLabel.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
|
||||||
|
@ -1380,8 +1273,8 @@ public class TablesPanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
class TableTableModel extends AbstractTableModel {
|
class TableTableModel extends AbstractTableModel {
|
||||||
|
|
||||||
ImageIcon tourneyIcon = new javax.swing.ImageIcon(getClass().getResource("/tables/tourney_icon.png"));
|
final ImageIcon tourneyIcon = new javax.swing.ImageIcon(getClass().getResource("/tables/tourney_icon.png"));
|
||||||
ImageIcon matchIcon = new javax.swing.ImageIcon(getClass().getResource("/tables/match_icon.png"));
|
final ImageIcon matchIcon = new javax.swing.ImageIcon(getClass().getResource("/tables/match_icon.png"));
|
||||||
|
|
||||||
public static final int COLUMN_ICON = 0;
|
public static final int COLUMN_ICON = 0;
|
||||||
public static final int COLUMN_DECK_TYPE = 1; // column the deck type is located (starting with 0) Start string is used to check for Limited
|
public static final int COLUMN_DECK_TYPE = 1; // column the deck type is located (starting with 0) Start string is used to check for Limited
|
||||||
|
@ -1400,8 +1293,6 @@ class TableTableModel extends AbstractTableModel {
|
||||||
|
|
||||||
private TableView[] tables = new TableView[0];
|
private TableView[] tables = new TableView[0];
|
||||||
private static final DateFormat timeFormatter = new SimpleDateFormat("HH:mm:ss");
|
private static final DateFormat timeFormatter = new SimpleDateFormat("HH:mm:ss");
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
public void loadData(Collection<TableView> tables) throws MageRemoteException {
|
public void loadData(Collection<TableView> tables) throws MageRemoteException {
|
||||||
this.tables = tables.toArray(new TableView[0]);
|
this.tables = tables.toArray(new TableView[0]);
|
||||||
|
@ -1418,7 +1309,6 @@ class TableTableModel extends AbstractTableModel {
|
||||||
return columnNames.length;
|
return columnNames.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getValueAt(int arg0, int arg1) {
|
public Object getValueAt(int arg0, int arg1) {
|
||||||
switch (arg1) {
|
switch (arg1) {
|
||||||
|
@ -1435,7 +1325,7 @@ class TableTableModel extends AbstractTableModel {
|
||||||
case 5:
|
case 5:
|
||||||
return tables[arg0].getTableStateText();
|
return tables[arg0].getTableStateText();
|
||||||
case 6:
|
case 6:
|
||||||
return tables[arg0].isPassworded() ? "***" : "";
|
return tables[arg0].isPassworded() ? PASSWORDED : "";
|
||||||
case 7:
|
case 7:
|
||||||
return timeFormatter.format(tables[arg0].getCreateTime());
|
return timeFormatter.format(tables[arg0].getCreateTime());
|
||||||
case 8:
|
case 8:
|
||||||
|
@ -1570,7 +1460,7 @@ class UpdatePlayersTask extends SwingWorker<Void, Collection<RoomUsersView>> {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(UpdatePlayersTask.class);
|
private static final Logger logger = Logger.getLogger(UpdatePlayersTask.class);
|
||||||
|
|
||||||
UpdatePlayersTask( UUID roomId, PlayersChatPanel chat) {
|
UpdatePlayersTask(UUID roomId, PlayersChatPanel chat) {
|
||||||
|
|
||||||
this.roomId = roomId;
|
this.roomId = roomId;
|
||||||
this.chat = chat;
|
this.chat = chat;
|
||||||
|
@ -1746,7 +1636,6 @@ class UpdateMatchesTask extends SwingWorker<Void, Collection<MatchView>> {
|
||||||
|
|
||||||
class GameChooser extends JPopupMenu {
|
class GameChooser extends JPopupMenu {
|
||||||
|
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,9 +38,7 @@ import java.util.UUID;
|
||||||
import javax.swing.DefaultComboBoxModel;
|
import javax.swing.DefaultComboBoxModel;
|
||||||
import javax.swing.JComboBox;
|
import javax.swing.JComboBox;
|
||||||
import mage.cards.decks.DeckCardLists;
|
import mage.cards.decks.DeckCardLists;
|
||||||
import mage.client.MageFrame;
|
|
||||||
import mage.client.SessionHandler;
|
import mage.client.SessionHandler;
|
||||||
import mage.remote.Session;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -101,11 +99,7 @@ public class TournamentPlayerPanel extends javax.swing.JPanel {
|
||||||
jLabel1.setText("Type:");
|
jLabel1.setText("Type:");
|
||||||
|
|
||||||
cbPlayerType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
cbPlayerType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||||
cbPlayerType.addActionListener(new java.awt.event.ActionListener() {
|
cbPlayerType.addActionListener(evt -> cbPlayerTypeActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
cbPlayerTypeActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lblPlayerNum.setFont(new java.awt.Font("Tahoma", 1, 11));
|
lblPlayerNum.setFont(new java.awt.Font("Tahoma", 1, 11));
|
||||||
lblPlayerNum.setText("Player Num:");
|
lblPlayerNum.setText("Player Num:");
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class TournamentPanel extends javax.swing.JPanel {
|
||||||
private boolean firstInitDone = false;
|
private boolean firstInitDone = false;
|
||||||
|
|
||||||
private final TournamentPlayersTableModel playersModel;
|
private final TournamentPlayersTableModel playersModel;
|
||||||
private TournamentMatchesTableModel matchesModel;
|
private final TournamentMatchesTableModel matchesModel;
|
||||||
private UpdateTournamentTask updateTask;
|
private UpdateTournamentTask updateTask;
|
||||||
private final DateFormat df;
|
private final DateFormat df;
|
||||||
|
|
||||||
|
@ -358,11 +358,7 @@ public class TournamentPanel extends javax.swing.JPanel {
|
||||||
txtName.setMaximumSize(new java.awt.Dimension(50, 22));
|
txtName.setMaximumSize(new java.awt.Dimension(50, 22));
|
||||||
txtName.setOpaque(false);
|
txtName.setOpaque(false);
|
||||||
txtName.setRequestFocusEnabled(false);
|
txtName.setRequestFocusEnabled(false);
|
||||||
txtName.addActionListener(new java.awt.event.ActionListener() {
|
txtName.addActionListener(evt -> txtNameActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
txtNameActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
txtType.setEditable(false);
|
txtType.setEditable(false);
|
||||||
txtType.setHorizontalAlignment(javax.swing.JTextField.LEFT);
|
txtType.setHorizontalAlignment(javax.swing.JTextField.LEFT);
|
||||||
|
@ -394,19 +390,11 @@ public class TournamentPanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
btnQuitTournament.setText("Quit Tournament");
|
btnQuitTournament.setText("Quit Tournament");
|
||||||
btnQuitTournament.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
btnQuitTournament.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||||
btnQuitTournament.addActionListener(new java.awt.event.ActionListener() {
|
btnQuitTournament.addActionListener(evt -> btnQuitTournamentActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnQuitTournamentActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnCloseWindow.setText("Close Window");
|
btnCloseWindow.setText("Close Window");
|
||||||
btnCloseWindow.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
btnCloseWindow.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||||
btnCloseWindow.addActionListener(new java.awt.event.ActionListener() {
|
btnCloseWindow.addActionListener(evt -> btnCloseWindowActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnCloseWindowActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lblName.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
|
lblName.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
|
||||||
lblName.setText("Name:");
|
lblName.setText("Name:");
|
||||||
|
|
|
@ -9,7 +9,7 @@ import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
public class DelayedViewerThread extends Thread {
|
public class DelayedViewerThread extends Thread {
|
||||||
private static DelayedViewerThread fInstance = new DelayedViewerThread();
|
private static final DelayedViewerThread fInstance = new DelayedViewerThread();
|
||||||
|
|
||||||
public static DelayedViewerThread getInstance() {
|
public static DelayedViewerThread getInstance() {
|
||||||
return fInstance;
|
return fInstance;
|
||||||
|
|
|
@ -36,11 +36,10 @@ package mage.client.unusedFiles;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.client.MageFrame;
|
|
||||||
import mage.client.SessionHandler;
|
import mage.client.SessionHandler;
|
||||||
import mage.client.cards.BigCard;
|
import mage.client.cards.BigCard;
|
||||||
import mage.client.dialog.ShowCardsDialog;
|
import mage.client.dialog.ShowCardsDialog;
|
||||||
import mage.remote.Session;
|
|
||||||
import mage.view.PlayerView;
|
import mage.view.PlayerView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -108,11 +107,7 @@ public class PlayerPanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
btnPlayerName.setText("Player Name"); // NOI18N
|
btnPlayerName.setText("Player Name"); // NOI18N
|
||||||
btnPlayerName.setName("btnPlayerName"); // NOI18N
|
btnPlayerName.setName("btnPlayerName"); // NOI18N
|
||||||
btnPlayerName.addActionListener(new java.awt.event.ActionListener() {
|
btnPlayerName.addActionListener(evt -> btnPlayerNameActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnPlayerNameActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lblLife.setLabelFor(txtLife);
|
lblLife.setLabelFor(txtLife);
|
||||||
lblLife.setText("Life:"); // NOI18N
|
lblLife.setText("Life:"); // NOI18N
|
||||||
|
@ -140,11 +135,7 @@ public class PlayerPanel extends javax.swing.JPanel {
|
||||||
lblGrave.setName("lblGrave"); // NOI18N
|
lblGrave.setName("lblGrave"); // NOI18N
|
||||||
|
|
||||||
btnGrave.setName("btnGrave"); // NOI18N
|
btnGrave.setName("btnGrave"); // NOI18N
|
||||||
btnGrave.addActionListener(new java.awt.event.ActionListener() {
|
btnGrave.addActionListener(evt -> btnGraveActionPerformed(evt));
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
btnGraveActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||||
this.setLayout(layout);
|
this.setLayout(layout);
|
||||||
|
|
|
@ -4,7 +4,6 @@ import java.awt.event.MouseEvent;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.client.SessionHandler;
|
import mage.client.SessionHandler;
|
||||||
import mage.remote.Session;
|
|
||||||
import mage.view.CardView;
|
import mage.view.CardView;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import java.util.UUID;
|
||||||
* @author nantuko
|
* @author nantuko
|
||||||
*/
|
*/
|
||||||
public class GameManager {
|
public class GameManager {
|
||||||
private static GameManager fInstance = new GameManager();
|
private static final GameManager fInstance = new GameManager();
|
||||||
|
|
||||||
public static GameManager getInstance() {
|
public static GameManager getInstance() {
|
||||||
return fInstance;
|
return fInstance;
|
||||||
|
|
|
@ -49,8 +49,8 @@ import org.mage.card.arcane.UI;
|
||||||
*/
|
*/
|
||||||
public class ImageHelper {
|
public class ImageHelper {
|
||||||
|
|
||||||
protected static HashMap<String, BufferedImage> images = new HashMap<>();
|
protected static final HashMap<String, BufferedImage> images = new HashMap<>();
|
||||||
protected static HashMap<String, BufferedImage> backgrounds = new HashMap<>();
|
protected static final HashMap<String, BufferedImage> backgrounds = new HashMap<>();
|
||||||
|
|
||||||
public static BufferedImage loadImage(String ref, int width, int height) {
|
public static BufferedImage loadImage(String ref, int width, int height) {
|
||||||
BufferedImage image = loadImage(ref);
|
BufferedImage image = loadImage(ref);
|
||||||
|
|
|
@ -181,7 +181,7 @@ public class NaturalOrderComparator implements Comparator
|
||||||
|
|
||||||
System.out.println("Scrambled: " + scrambled);
|
System.out.println("Scrambled: " + scrambled);
|
||||||
|
|
||||||
Collections.sort(scrambled, new NaturalOrderComparator());
|
scrambled.sort(new NaturalOrderComparator());
|
||||||
|
|
||||||
System.out.println("Sorted: " + scrambled);
|
System.out.println("Sorted: " + scrambled);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import org.mage.card.arcane.CardPanel;
|
||||||
* @author nantuko
|
* @author nantuko
|
||||||
*/
|
*/
|
||||||
public class SettingsManager {
|
public class SettingsManager {
|
||||||
private static SettingsManager fInstance = new SettingsManager();
|
private static final SettingsManager fInstance = new SettingsManager();
|
||||||
|
|
||||||
public static SettingsManager getInstance() {
|
public static SettingsManager getInstance() {
|
||||||
return fInstance;
|
return fInstance;
|
||||||
|
@ -68,5 +68,5 @@ public class SettingsManager {
|
||||||
private int screenWidth;
|
private int screenWidth;
|
||||||
private int screenHeight;
|
private int screenHeight;
|
||||||
|
|
||||||
private Rectangle cardSize = CardPanel.CARD_SIZE_FULL;
|
private final Rectangle cardSize = CardPanel.CARD_SIZE_FULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,27 +68,19 @@ public class TransformedImageCache {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Map<Key, Map<BufferedImage, BufferedImage>> IMAGE_CACHE;
|
static final Map<Key, Map<BufferedImage, BufferedImage>> IMAGE_CACHE;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
// TODO: can we use a single map?
|
// TODO: can we use a single map?
|
||||||
IMAGE_CACHE = ImageCaches.register(new MapMaker().softValues().makeComputingMap(new Function<Key, Map<BufferedImage, BufferedImage>>() {
|
IMAGE_CACHE = ImageCaches.register(new MapMaker().softValues().makeComputingMap((Function<Key, Map<BufferedImage, BufferedImage>>) key -> new MapMaker().weakKeys().softValues().makeComputingMap(image -> {
|
||||||
@Override
|
if (key.width != image.getWidth() || key.height != image.getHeight()) {
|
||||||
public Map<BufferedImage, BufferedImage> apply(final Key key) {
|
image = resizeImage(image, key.width, key.height);
|
||||||
return new MapMaker().weakKeys().softValues().makeComputingMap(new Function<BufferedImage, BufferedImage>() {
|
|
||||||
@Override
|
|
||||||
public BufferedImage apply(BufferedImage image) {
|
|
||||||
if (key.width != image.getWidth() || key.height != image.getHeight()) {
|
|
||||||
image = resizeImage(image, key.width, key.height);
|
|
||||||
}
|
|
||||||
if (key.angle != 0.0) {
|
|
||||||
image = rotateImage(image, key.angle);
|
|
||||||
}
|
|
||||||
return image;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}));
|
if (key.angle != 0.0) {
|
||||||
|
image = rotateImage(image, key.angle);
|
||||||
|
}
|
||||||
|
return image;
|
||||||
|
})));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BufferedImage rotateImage(BufferedImage image, double angle) {
|
private static BufferedImage rotateImage(BufferedImage image, double angle) {
|
||||||
|
|
|
@ -9,5 +9,5 @@ public enum AudioGroup {
|
||||||
GameSounds,
|
GameSounds,
|
||||||
DraftSounds,
|
DraftSounds,
|
||||||
SkipSounds,
|
SkipSounds,
|
||||||
OtherSounds;
|
OtherSounds
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,8 +39,8 @@ public class LinePool {
|
||||||
* from the timer thread to prevent deadlocks in PulseAudio internals.
|
* from the timer thread to prevent deadlocks in PulseAudio internals.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private Mixer mixer;
|
private final Mixer mixer;
|
||||||
private int alwaysActive;
|
private final int alwaysActive;
|
||||||
|
|
||||||
public LinePool() {
|
public LinePool() {
|
||||||
this(new AudioFormat(22050, 16, 1, true, false), 4, 1);
|
this(new AudioFormat(22050, 16, 1, true, false), 4, 1);
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class MusicPlayer {
|
||||||
private static final Logger log = Logger.getLogger(AudioManager.class);
|
private static final Logger log = Logger.getLogger(AudioManager.class);
|
||||||
String filepath;
|
String filepath;
|
||||||
String filename;
|
String filename;
|
||||||
List filelist = new List();
|
final List filelist = new List();
|
||||||
static MusicPlayer player = null;
|
static MusicPlayer player = null;
|
||||||
|
|
||||||
//open file and add list
|
//open file and add list
|
||||||
|
@ -138,11 +138,11 @@ public class MusicPlayer {
|
||||||
breaked = false;
|
breaked = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
class PlayThread extends Thread {
|
class PlayThread extends Thread {
|
||||||
|
|
||||||
byte tempBuffer[] = new byte[320];
|
final byte[] tempBuffer = new byte[320];
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
|
@ -165,5 +165,5 @@ public class MusicPlayer {
|
||||||
log.error("Thread error: " + e);
|
log.error("Thread error: " + e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public class ArrowBuilder {
|
public class ArrowBuilder {
|
||||||
|
|
||||||
private static ArrowBuilder instance;
|
private static final ArrowBuilder instance;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
instance = new ArrowBuilder();
|
instance = new ArrowBuilder();
|
||||||
|
@ -38,7 +38,7 @@ public class ArrowBuilder {
|
||||||
private int currentHeight;
|
private int currentHeight;
|
||||||
|
|
||||||
public enum Type {
|
public enum Type {
|
||||||
PAIRED, SOURCE, TARGET, COMBAT, ENCHANT_PLAYERS;
|
PAIRED, SOURCE, TARGET, COMBAT, ENCHANT_PLAYERS
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -103,16 +103,8 @@ public class ArrowBuilder {
|
||||||
|
|
||||||
synchronized (map) {
|
synchronized (map) {
|
||||||
p.add(arrow);
|
p.add(arrow);
|
||||||
Map<Type, java.util.List<Arrow>> innerMap = map.get(gameId);
|
Map<Type, java.util.List<Arrow>> innerMap = map.computeIfAbsent(gameId, k -> new HashMap<Type, List<Arrow>>());
|
||||||
if (innerMap == null) {
|
java.util.List<Arrow> arrows = innerMap.computeIfAbsent(type, k -> new ArrayList<Arrow>());
|
||||||
innerMap = new HashMap<Type, List<Arrow>>();
|
|
||||||
map.put(gameId, innerMap);
|
|
||||||
}
|
|
||||||
java.util.List<Arrow> arrows = innerMap.get(type);
|
|
||||||
if (arrows == null) {
|
|
||||||
arrows = new ArrayList<Arrow>();
|
|
||||||
innerMap.put(type, arrows);
|
|
||||||
}
|
|
||||||
arrows.add(arrow);
|
arrows.add(arrow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,25 +49,19 @@ public class BufferedImageBuilder {
|
||||||
|
|
||||||
private void waitForImage(BufferedImage bufferedImage) {
|
private void waitForImage(BufferedImage bufferedImage) {
|
||||||
final ImageLoadStatus imageLoadStatus = new ImageLoadStatus();
|
final ImageLoadStatus imageLoadStatus = new ImageLoadStatus();
|
||||||
bufferedImage.getHeight(new ImageObserver() {
|
bufferedImage.getHeight((img, infoflags, x, y, width, height) -> {
|
||||||
@Override
|
if (infoflags == ImageObserver.ALLBITS) {
|
||||||
public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
|
imageLoadStatus.heightDone = true;
|
||||||
if (infoflags == ALLBITS) {
|
return true;
|
||||||
imageLoadStatus.heightDone = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
bufferedImage.getWidth(new ImageObserver() {
|
bufferedImage.getWidth((img, infoflags, x, y, width, height) -> {
|
||||||
@Override
|
if (infoflags == ImageObserver.ALLBITS) {
|
||||||
public boolean imageUpdate(Image img, int infoflags, int x, int y, int width, int height) {
|
imageLoadStatus.widthDone = true;
|
||||||
if (infoflags == ALLBITS) {
|
return true;
|
||||||
imageLoadStatus.widthDone = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
while (!imageLoadStatus.widthDone && !imageLoadStatus.heightDone) {
|
while (!imageLoadStatus.widthDone && !imageLoadStatus.heightDone) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -156,8 +156,8 @@ public class GuiDisplayUtil {
|
||||||
if (card.getMageObjectType().canHaveCounters()) {
|
if (card.getMageObjectType().canHaveCounters()) {
|
||||||
ArrayList<CounterView> counters = new ArrayList<>();
|
ArrayList<CounterView> counters = new ArrayList<>();
|
||||||
if (card instanceof PermanentView) {
|
if (card instanceof PermanentView) {
|
||||||
if (((PermanentView) card).getCounters() != null) {
|
if (card.getCounters() != null) {
|
||||||
counters = new ArrayList<>(((PermanentView) card).getCounters());
|
counters = new ArrayList<>(card.getCounters());
|
||||||
}
|
}
|
||||||
} else if (card.getCounters() != null) {
|
} else if (card.getCounters() != null) {
|
||||||
counters = new ArrayList<>(card.getCounters());
|
counters = new ArrayList<>(card.getCounters());
|
||||||
|
|
|
@ -37,9 +37,9 @@ import mage.client.dialog.MageDialog;
|
||||||
*/
|
*/
|
||||||
public class MageDialogState {
|
public class MageDialogState {
|
||||||
|
|
||||||
Dimension dimension;
|
final Dimension dimension;
|
||||||
int xPos;
|
final int xPos;
|
||||||
int yPos;
|
final int yPos;
|
||||||
|
|
||||||
public MageDialogState(MageDialog mageDialog) {
|
public MageDialogState(MageDialog mageDialog) {
|
||||||
this.dimension = mageDialog.getSize();
|
this.dimension = mageDialog.getSize();
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
package mage.client.util.gui;
|
package mage.client.util.gui;
|
||||||
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.awt.event.FocusEvent;
|
import java.awt.event.FocusEvent;
|
||||||
import java.awt.event.FocusListener;
|
import java.awt.event.FocusListener;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
|
@ -50,9 +48,9 @@ import mage.client.cards.CardsList;
|
||||||
*/
|
*/
|
||||||
public class TableSpinnerEditor extends DefaultCellEditor {
|
public class TableSpinnerEditor extends DefaultCellEditor {
|
||||||
|
|
||||||
JSpinner spinner;
|
final JSpinner spinner;
|
||||||
JSpinner.DefaultEditor editor;
|
final JSpinner.DefaultEditor editor;
|
||||||
JTextField textField;
|
final JTextField textField;
|
||||||
boolean valueSet;
|
boolean valueSet;
|
||||||
private JTable table;
|
private JTable table;
|
||||||
private int lastRow = -1;
|
private int lastRow = -1;
|
||||||
|
@ -60,7 +58,7 @@ public class TableSpinnerEditor extends DefaultCellEditor {
|
||||||
private int lastOriginalHeigh;
|
private int lastOriginalHeigh;
|
||||||
private int currentOriginalHeigh;
|
private int currentOriginalHeigh;
|
||||||
private static final int NEEDED_HIGH = 24;
|
private static final int NEEDED_HIGH = 24;
|
||||||
CardsList cardsList;
|
final CardsList cardsList;
|
||||||
|
|
||||||
// Initializes the spinner.
|
// Initializes the spinner.
|
||||||
public TableSpinnerEditor(CardsList cardsList) {
|
public TableSpinnerEditor(CardsList cardsList) {
|
||||||
|
@ -83,12 +81,9 @@ public class TableSpinnerEditor extends DefaultCellEditor {
|
||||||
table.setRowHeight(lastRow, NEEDED_HIGH);
|
table.setRowHeight(lastRow, NEEDED_HIGH);
|
||||||
}
|
}
|
||||||
|
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> {
|
||||||
@Override
|
if (valueSet) {
|
||||||
public void run() {
|
textField.setCaretPosition(1);
|
||||||
if (valueSet) {
|
|
||||||
textField.setCaretPosition(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -101,12 +96,7 @@ public class TableSpinnerEditor extends DefaultCellEditor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
textField.addActionListener(new ActionListener() {
|
textField.addActionListener(ae -> stopCellEditing());
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent ae) {
|
|
||||||
stopCellEditing();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void resetRow() {
|
private synchronized void resetRow() {
|
||||||
|
@ -129,12 +119,7 @@ public class TableSpinnerEditor extends DefaultCellEditor {
|
||||||
if (!valueSet) {
|
if (!valueSet) {
|
||||||
spinner.setValue(value);
|
spinner.setValue(value);
|
||||||
}
|
}
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(() -> textField.requestFocus());
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
textField.requestFocus();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return spinner;
|
return spinner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class CountryCellRenderer extends DefaultTableCellRenderer {
|
||||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
|
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
|
||||||
JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
||||||
if (value == null || ((String) value).isEmpty()) {
|
if (value == null || ((String) value).isEmpty()) {
|
||||||
value = (String) "world";
|
value = "world";
|
||||||
}
|
}
|
||||||
label.setToolTipText(CountryUtil.getCountryName((String) value));
|
label.setToolTipText(CountryUtil.getCountryName((String) value));
|
||||||
label.setIcon(CountryUtil.getCountryFlagIcon((String) value));
|
label.setIcon(CountryUtil.getCountryFlagIcon((String) value));
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue