mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
- Bugfix: "Double-click for decklist" crash on random generated decks (colors and themes).
- Further standardized messages and font sizes. - A little checkstyle.
This commit is contained in:
@@ -72,7 +72,11 @@ public enum CSubmenuGauntletBuild implements ICDoc {
|
|||||||
private final MouseAdapter madDecklist = new MouseAdapter() {
|
private final MouseAdapter madDecklist = new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(final MouseEvent e) {
|
public void mouseClicked(final MouseEvent e) {
|
||||||
if (e.getClickCount() == 2) { GauntletDeckUtil.showDecklist(((JList) e.getSource())); }
|
if (e.getClickCount() == 2) {
|
||||||
|
if (view.getRadColorDecks().isSelected()) { return; }
|
||||||
|
if (view.getRadThemeDecks().isSelected()) { return; }
|
||||||
|
|
||||||
|
GauntletDeckUtil.showDecklist(((JList) e.getSource())); }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,9 @@ public enum CSubmenuGauntletQuick implements ICDoc {
|
|||||||
@Override
|
@Override
|
||||||
public void mouseClicked(final MouseEvent e) {
|
public void mouseClicked(final MouseEvent e) {
|
||||||
if (e.getClickCount() == 2) {
|
if (e.getClickCount() == 2) {
|
||||||
|
if (view.getRadColorDecks().isSelected()) { return; }
|
||||||
|
if (view.getRadThemeDecks().isSelected()) { return; }
|
||||||
|
|
||||||
GauntletDeckUtil.showDecklist(((JList) e.getSource())); }
|
GauntletDeckUtil.showDecklist(((JList) e.getSource())); }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import forge.gui.toolbox.FList;
|
|||||||
import forge.gui.toolbox.FRadioButton;
|
import forge.gui.toolbox.FRadioButton;
|
||||||
import forge.gui.toolbox.FScrollPane;
|
import forge.gui.toolbox.FScrollPane;
|
||||||
import forge.gui.toolbox.FSkin;
|
import forge.gui.toolbox.FSkin;
|
||||||
import forge.gui.toolbox.FTextArea;
|
|
||||||
import forge.gui.toolbox.FTextField;
|
import forge.gui.toolbox.FTextField;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -70,11 +69,17 @@ public enum VSubmenuGauntletBuild implements IVSubmenu {
|
|||||||
|
|
||||||
private final JTextField txfFilename = new FTextField();
|
private final JTextField txfFilename = new FTextField();
|
||||||
|
|
||||||
private final FTextArea tarDesc1 = new FTextArea(
|
private final FLabel lblDesc1 = new FLabel.Builder()
|
||||||
"Use the left or right arrows to add or remove decks from the gauntlet.");
|
.text("Left/right arrows add or remove decks.")
|
||||||
|
.fontSize(12).build();
|
||||||
|
|
||||||
private final FTextArea tarDesc2 = new FTextArea(
|
private final FLabel lblDesc2 = new FLabel.Builder()
|
||||||
"Change the order of the opponents by using the up and down arrows.");
|
.text("Up/down arrows change opponent order.")
|
||||||
|
.fontSize(12).build();
|
||||||
|
|
||||||
|
private final FLabel lblDecklist = new FLabel.Builder()
|
||||||
|
.text("Double click a non-random deck for its decklist.")
|
||||||
|
.fontSize(12).build();
|
||||||
|
|
||||||
private final JLabel lblSave = new FLabel.Builder().text("Changes not yet saved.")
|
private final JLabel lblSave = new FLabel.Builder().text("Changes not yet saved.")
|
||||||
.build();
|
.build();
|
||||||
@@ -123,8 +128,6 @@ public enum VSubmenuGauntletBuild implements IVSubmenu {
|
|||||||
.icon(FSkin.getIcon(FSkin.InterfaceIcons.ICO_OPEN))
|
.icon(FSkin.getIcon(FSkin.InterfaceIcons.ICO_OPEN))
|
||||||
.text(" ").hoverable(true).build();
|
.text(" ").hoverable(true).build();
|
||||||
|
|
||||||
private final JTextField txfSearch = new FTextField();
|
|
||||||
|
|
||||||
private VSubmenuGauntletBuild() {
|
private VSubmenuGauntletBuild() {
|
||||||
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
lblTitle.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
||||||
|
|
||||||
@@ -155,37 +158,25 @@ public enum VSubmenuGauntletBuild implements IVSubmenu {
|
|||||||
pnlFileHandling.add(btnNew, "h 30px!, w 30px!, gap 0 5px 0 0");
|
pnlFileHandling.add(btnNew, "h 30px!, w 30px!, gap 0 5px 0 0");
|
||||||
pnlFileHandling.add(btnOpen, "h 30px!, w 30px!, gap 0 5px 0 0");
|
pnlFileHandling.add(btnOpen, "h 30px!, w 30px!, gap 0 5px 0 0");
|
||||||
|
|
||||||
// Radio button panel
|
// Radios panel
|
||||||
txfSearch.setText("Search");
|
|
||||||
txfSearch.setMargin(new Insets(5, 5, 5, 5));
|
|
||||||
txfSearch.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
|
||||||
txfSearch.setOpaque(true);
|
|
||||||
txfSearch.setEditable(true);
|
|
||||||
txfSearch.setFocusable(true);
|
|
||||||
txfSearch.setOpaque(true);
|
|
||||||
txfSearch.setBackground(FSkin.getColor(FSkin.Colors.CLR_THEME2));
|
|
||||||
|
|
||||||
pnlRadios.setOpaque(false);
|
pnlRadios.setOpaque(false);
|
||||||
pnlRadios.add(radUserDecks, "h 30px!, gap 0 0 0 5px");
|
pnlRadios.add(radUserDecks, "h 30px!, gap 0 0 0 5px");
|
||||||
pnlRadios.add(radQuestDecks, "h 30px!, gap 0 0 0 5px");
|
pnlRadios.add(radQuestDecks, "h 30px!, gap 0 0 0 5px");
|
||||||
pnlRadios.add(radColorDecks, "h 30px!, gap 0 0 0 5px");
|
pnlRadios.add(radColorDecks, "h 30px!, gap 0 0 0 5px");
|
||||||
pnlRadios.add(radThemeDecks, "h 30px!, gap 0 0 0 5px");
|
pnlRadios.add(radThemeDecks, "h 30px!, gap 0 0 0 5px");
|
||||||
//pnlRadios.add(txfSearch, "h 30px!, w 100%!, gap 0 0 0 5px");
|
|
||||||
|
|
||||||
// Directions panel
|
// Directions panel
|
||||||
final JPanel pnlSpacer = new JPanel();
|
final JPanel pnlSpacer = new JPanel();
|
||||||
pnlSpacer.setOpaque(false);
|
pnlSpacer.setOpaque(false);
|
||||||
tarDesc1.setFont(FSkin.getFont(14));
|
|
||||||
tarDesc2.setFont(FSkin.getFont(14));
|
|
||||||
|
|
||||||
pnlStrut.setOpaque(false);
|
pnlStrut.setOpaque(false);
|
||||||
lblSave.setForeground(Color.red);
|
lblSave.setForeground(Color.red);
|
||||||
lblSave.setVisible(false);
|
lblSave.setVisible(false);
|
||||||
pnlDirections.setOpaque(false);
|
pnlDirections.setOpaque(false);
|
||||||
pnlDirections.setLayout(new MigLayout("insets 0, gap 0, wrap"));
|
pnlDirections.setLayout(new MigLayout("insets 0, gap 0, wrap"));
|
||||||
pnlDirections.add(pnlSpacer, "pushy, growy");
|
pnlDirections.add(pnlSpacer, "w 100%!, pushy, growy");
|
||||||
pnlDirections.add(tarDesc1, "w 98%!, gap 1% 0 0 10px");
|
pnlDirections.add(lblDesc1, "gap 1% 0 0 10px");
|
||||||
pnlDirections.add(tarDesc2, "w 98%!, gap 1% 0 0 20px");
|
pnlDirections.add(lblDesc2, "gap 1% 0 0 10px");
|
||||||
|
pnlDirections.add(lblDecklist, "gap 1% 0 0 20px");
|
||||||
pnlDirections.add(lblSave, "ax center, gap 0 0 0 5px");
|
pnlDirections.add(lblSave, "ax center, gap 0 0 0 5px");
|
||||||
|
|
||||||
// Deck movement panel
|
// Deck movement panel
|
||||||
@@ -234,9 +225,9 @@ public enum VSubmenuGauntletBuild implements IVSubmenu {
|
|||||||
parentCell.getBody().add(pnlStrut, "w 40px!, gap 1% 1% 0 15px");
|
parentCell.getBody().add(pnlStrut, "w 40px!, gap 1% 1% 0 15px");
|
||||||
parentCell.getBody().add(pnlDirections, "w 48% - 20px!, gap 0 0 0 15px");
|
parentCell.getBody().add(pnlDirections, "w 48% - 20px!, gap 0 0 0 15px");
|
||||||
|
|
||||||
parentCell.getBody().add(scrLeft, "w 48% - 20px!, gap 1% 0 0 15px, pushy, growy");
|
parentCell.getBody().add(scrLeft, "w 48% - 20px!, gap 1% 0 0 25px, pushy, growy");
|
||||||
parentCell.getBody().add(pnlButtons, "w 40px!, gap 1% 1% 0 15px, pushy, growy");
|
parentCell.getBody().add(pnlButtons, "w 40px!, gap 1% 1% 0 25px, pushy, growy");
|
||||||
parentCell.getBody().add(scrRight, "w 48% - 20px!, gap 0 0 0 15px, pushy, growy");
|
parentCell.getBody().add(scrRight, "w 48% - 20px!, gap 0 0 0 25px, pushy, growy");
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {@link javax.swing.JList} */
|
/** @return {@link javax.swing.JList} */
|
||||||
@@ -309,11 +300,6 @@ public enum VSubmenuGauntletBuild implements IVSubmenu {
|
|||||||
return lblSave;
|
return lblSave;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return {@link forge.gui.toolbox.FLabel} */
|
|
||||||
public JTextField getTxfSearch() {
|
|
||||||
return this.txfSearch;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @return {@link javax.swing.JTextField} */
|
/** @return {@link javax.swing.JTextField} */
|
||||||
public JTextField getTxfFilename() {
|
public JTextField getTxfFilename() {
|
||||||
return txfFilename;
|
return txfFilename;
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ public enum VSubmenuGauntletQuick implements IVSubmenu {
|
|||||||
.text("Quick Gauntlet Builder").fontAlign(SwingConstants.CENTER)
|
.text("Quick Gauntlet Builder").fontAlign(SwingConstants.CENTER)
|
||||||
.opaque(true).fontSize(16).build();
|
.opaque(true).fontSize(16).build();
|
||||||
|
|
||||||
|
private final FLabel lblDecklist = new FLabel.Builder()
|
||||||
|
.text("Double click a non-random deck for its decklist.")
|
||||||
|
.fontSize(12).build();
|
||||||
|
|
||||||
private JSlider sliOpponents = new JSlider(JSlider.HORIZONTAL, 5, 50, 20);
|
private JSlider sliOpponents = new JSlider(JSlider.HORIZONTAL, 5, 50, 20);
|
||||||
//private JSlider sliGamesPerMatch = new JSlider(JSlider.HORIZONTAL, 1, 7, 3);
|
//private JSlider sliGamesPerMatch = new JSlider(JSlider.HORIZONTAL, 1, 7, 3);
|
||||||
|
|
||||||
@@ -88,7 +92,7 @@ public enum VSubmenuGauntletQuick implements IVSubmenu {
|
|||||||
|
|
||||||
private final JLabel lblDesc = new FLabel.Builder().text(
|
private final JLabel lblDesc = new FLabel.Builder().text(
|
||||||
"A new quick gauntlet is auto-saved. They can be loaded in the \"Load Gauntlet\" screen.")
|
"A new quick gauntlet is auto-saved. They can be loaded in the \"Load Gauntlet\" screen.")
|
||||||
.build();
|
.fontSize(12).build();
|
||||||
|
|
||||||
private final StartButton btnStart = new StartButton();
|
private final StartButton btnStart = new StartButton();
|
||||||
|
|
||||||
@@ -109,17 +113,6 @@ public enum VSubmenuGauntletQuick implements IVSubmenu {
|
|||||||
sliOpponents.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
sliOpponents.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
||||||
sliOpponents.setFont(FSkin.getFont(12));
|
sliOpponents.setFont(FSkin.getFont(12));
|
||||||
|
|
||||||
/*
|
|
||||||
sliGamesPerMatch.setMajorTickSpacing(2);
|
|
||||||
sliGamesPerMatch.setMinorTickSpacing(0);
|
|
||||||
sliGamesPerMatch.setPaintTicks(false);
|
|
||||||
sliGamesPerMatch.setPaintLabels(true);
|
|
||||||
sliGamesPerMatch.setSnapToTicks(true);
|
|
||||||
sliGamesPerMatch.setOpaque(false);
|
|
||||||
sliGamesPerMatch.setForeground(FSkin.getColor(FSkin.Colors.CLR_TEXT));
|
|
||||||
sliGamesPerMatch.setFont(FSkin.getFont(12));
|
|
||||||
*/
|
|
||||||
|
|
||||||
btnRandom.setOpaque(true);
|
btnRandom.setOpaque(true);
|
||||||
|
|
||||||
scrLoad.setOpaque(false);
|
scrLoad.setOpaque(false);
|
||||||
@@ -139,7 +132,6 @@ public enum VSubmenuGauntletQuick implements IVSubmenu {
|
|||||||
pnlOptions.add(lblOptions, "h 30px!, w 96%!, gap 2% 0 0 5px");
|
pnlOptions.add(lblOptions, "h 30px!, w 96%!, gap 2% 0 0 5px");
|
||||||
pnlOptions.add(sliOpponents, "h 40px!, w 96%!, gap 2% 0 0 5px, ax center");
|
pnlOptions.add(sliOpponents, "h 40px!, w 96%!, gap 2% 0 0 5px, ax center");
|
||||||
pnlOptions.add(lblDesc1, "w 96%!, gap 2% 0 0 20px");
|
pnlOptions.add(lblDesc1, "w 96%!, gap 2% 0 0 20px");
|
||||||
//pnlOptions.add(sliGamesPerMatch, "h 24px!, w 96%!, gap 2% 0 0 5px, ax center");
|
|
||||||
pnlOptions.add(lblDesc3, "w 96%!, gap 2% 0 0 0");
|
pnlOptions.add(lblDesc3, "w 96%!, gap 2% 0 0 0");
|
||||||
pnlOptions.setCornerDiameter(0);
|
pnlOptions.setCornerDiameter(0);
|
||||||
pnlOptions.add(boxUserDecks, "w 96%!, h 30px!, gap 2% 0 0 5px");
|
pnlOptions.add(boxUserDecks, "w 96%!, h 30px!, gap 2% 0 0 5px");
|
||||||
@@ -190,8 +182,8 @@ public enum VSubmenuGauntletQuick implements IVSubmenu {
|
|||||||
public void populate() {
|
public void populate() {
|
||||||
parentCell.getBody().setLayout(new MigLayout("insets 0, gap 0, wrap 2"));
|
parentCell.getBody().setLayout(new MigLayout("insets 0, gap 0, wrap 2"));
|
||||||
parentCell.getBody().add(lblTitle, "w 98%!, h 30px!, gap 1% 0 15px 15px, span 2");
|
parentCell.getBody().add(lblTitle, "w 98%!, h 30px!, gap 1% 0 15px 15px, span 2");
|
||||||
|
parentCell.getBody().add(lblDesc, "ax center, gap 0 0 0 5px, span 2");
|
||||||
parentCell.getBody().add(lblDesc, "ax center, gap 0 0 0 15px, span 2");
|
parentCell.getBody().add(lblDecklist, "ax center, gap 0 0 0 15px, span 2");
|
||||||
parentCell.getBody().add(pnlOptions, "w 40%!, gap 1% 1% 0 0, pushy, growy");
|
parentCell.getBody().add(pnlOptions, "w 40%!, gap 1% 1% 0 0, pushy, growy");
|
||||||
parentCell.getBody().add(pnlDecks, "w 57%!, pushy, growy");
|
parentCell.getBody().add(pnlDecks, "w 57%!, pushy, growy");
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ import forge.util.IStorage;
|
|||||||
public enum CSubmenuConstructed implements ICDoc {
|
public enum CSubmenuConstructed implements ICDoc {
|
||||||
/** */
|
/** */
|
||||||
SINGLETON_INSTANCE;
|
SINGLETON_INSTANCE;
|
||||||
|
private final VSubmenuConstructed view = VSubmenuConstructed.SINGLETON_INSTANCE;
|
||||||
|
|
||||||
private enum ESubmenuConstructedTypes { /** */
|
private enum ESubmenuConstructedTypes { /** */
|
||||||
COLORS, /** */
|
COLORS, /** */
|
||||||
@@ -70,7 +71,19 @@ public enum CSubmenuConstructed implements ICDoc {
|
|||||||
private final MouseAdapter madDecklist = new MouseAdapter() {
|
private final MouseAdapter madDecklist = new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(final MouseEvent e) {
|
public void mouseClicked(final MouseEvent e) {
|
||||||
if (e.getClickCount() == 2) { showDecklist(((JList) e.getSource())); }
|
if (e.getClickCount() == 2) {
|
||||||
|
final JList src = ((JList) e.getSource());
|
||||||
|
if (src.equals(view.getLstAIDecks())) {
|
||||||
|
if (view.getRadColorsAI().isSelected()) { return; }
|
||||||
|
if (view.getRadThemesAI().isSelected()) { return; }
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (view.getRadColorsHuman().isSelected()) { return; }
|
||||||
|
if (view.getRadThemesHuman().isSelected()) { return; }
|
||||||
|
}
|
||||||
|
|
||||||
|
showDecklist(src);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -103,7 +116,6 @@ public enum CSubmenuConstructed implements ICDoc {
|
|||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
final ForgePreferences prefs = Singletons.getModel().getPreferences();
|
final ForgePreferences prefs = Singletons.getModel().getPreferences();
|
||||||
final VSubmenuConstructed view = VSubmenuConstructed.SINGLETON_INSTANCE;
|
|
||||||
|
|
||||||
// Radio button event handling
|
// Radio button event handling
|
||||||
view.getRadColorsAI().addActionListener(new ActionListener() { @Override
|
view.getRadColorsAI().addActionListener(new ActionListener() { @Override
|
||||||
|
|||||||
@@ -45,6 +45,10 @@ public enum VSubmenuConstructed implements IVSubmenu {
|
|||||||
.text("Sanctioned Format: Constructed").fontAlign(SwingConstants.CENTER)
|
.text("Sanctioned Format: Constructed").fontAlign(SwingConstants.CENTER)
|
||||||
.fontSize(16).opaque(true).build();
|
.fontSize(16).opaque(true).build();
|
||||||
|
|
||||||
|
private final FLabel lblDecklist = new FLabel.Builder()
|
||||||
|
.text("Double click a non-random deck for its decklist.")
|
||||||
|
.fontSize(12).build();
|
||||||
|
|
||||||
private final JPanel pnlDecksHuman = new JPanel(new MigLayout("insets 0, gap 0, wrap"));
|
private final JPanel pnlDecksHuman = new JPanel(new MigLayout("insets 0, gap 0, wrap"));
|
||||||
private final JPanel pnlDecksAI = new JPanel(new MigLayout("insets 0, gap 0, wrap"));
|
private final JPanel pnlDecksAI = new JPanel(new MigLayout("insets 0, gap 0, wrap"));
|
||||||
private final JPanel pnlRadiosHuman = new JPanel(new MigLayout("insets 0, gap 0, wrap"));
|
private final JPanel pnlRadiosHuman = new JPanel(new MigLayout("insets 0, gap 0, wrap"));
|
||||||
@@ -167,6 +171,7 @@ public enum VSubmenuConstructed implements IVSubmenu {
|
|||||||
public void populate() {
|
public void populate() {
|
||||||
parentCell.getBody().setLayout(new MigLayout("insets 0, gap 0, wrap 2"));
|
parentCell.getBody().setLayout(new MigLayout("insets 0, gap 0, wrap 2"));
|
||||||
parentCell.getBody().add(lblTitle, "w 98%!, h 30px!, gap 1% 0 15px 15px, span 2");
|
parentCell.getBody().add(lblTitle, "w 98%!, h 30px!, gap 1% 0 15px 15px, span 2");
|
||||||
|
parentCell.getBody().add(lblDecklist, "h 20px!, span 2, ax center");
|
||||||
parentCell.getBody().add(pnlRadiosAI, "w 45%!, gap 1% 8% 20px 20px");
|
parentCell.getBody().add(pnlRadiosAI, "w 45%!, gap 1% 8% 20px 20px");
|
||||||
parentCell.getBody().add(pnlRadiosHuman, "w 45%!, gap 0 0 20px 20px");
|
parentCell.getBody().add(pnlRadiosHuman, "w 45%!, gap 0 0 20px 20px");
|
||||||
parentCell.getBody().add(pnlDecksAI, "w 45%!, gap 1% 8% 0 0, growy, pushy");
|
parentCell.getBody().add(pnlDecksAI, "w 45%!, gap 1% 8% 0 0, growy, pushy");
|
||||||
|
|||||||
Reference in New Issue
Block a user