mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Add View Deck button to make FDeckViewer more discoverable
This commit is contained in:
@@ -36,7 +36,8 @@ public class FDeckChooser extends JPanel implements IDecksComboBoxListener {
|
|||||||
private DeckType selectedDeckType = DeckType.COLOR_DECK;
|
private DeckType selectedDeckType = DeckType.COLOR_DECK;
|
||||||
|
|
||||||
private final DeckManager lstDecks = new DeckManager(GameType.Constructed);
|
private final DeckManager lstDecks = new DeckManager(GameType.Constructed);
|
||||||
private final FLabel btnRandom = new FLabel.ButtonBuilder().text("Random").fontSize(14).build();
|
private final FLabel btnViewDeck = new FLabel.ButtonBuilder().text("View Deck").fontSize(14).build();
|
||||||
|
private final FLabel btnRandom = new FLabel.ButtonBuilder().fontSize(14).build();
|
||||||
|
|
||||||
private boolean isAi;
|
private boolean isAi;
|
||||||
|
|
||||||
@@ -46,14 +47,16 @@ public class FDeckChooser extends JPanel implements IDecksComboBoxListener {
|
|||||||
public FDeckChooser(boolean forAi) {
|
public FDeckChooser(boolean forAi) {
|
||||||
setOpaque(false);
|
setOpaque(false);
|
||||||
isAi = forAi;
|
isAi = forAi;
|
||||||
lstDecks.setItemActivateCommand(new Command() {
|
Command cmdViewDeck = new Command() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (selectedDeckType != DeckType.COLOR_DECK && selectedDeckType != DeckType.THEME_DECK) {
|
if (selectedDeckType != DeckType.COLOR_DECK && selectedDeckType != DeckType.THEME_DECK) {
|
||||||
FDeckViewer.show(getDeck());
|
FDeckViewer.show(getDeck());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
lstDecks.setItemActivateCommand(cmdViewDeck);
|
||||||
|
btnViewDeck.setCommand(cmdViewDeck);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
@@ -76,7 +79,6 @@ public class FDeckChooser extends JPanel implements IDecksComboBoxListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public DeckManager getLstDecks() { return lstDecks; }
|
public DeckManager getLstDecks() { return lstDecks; }
|
||||||
private FLabel getBtnRandom() { return btnRandom; }
|
|
||||||
|
|
||||||
private void updateCustom() {
|
private void updateCustom() {
|
||||||
lstDecks.setAllowMultipleSelections(false);
|
lstDecks.setAllowMultipleSelections(false);
|
||||||
@@ -84,8 +86,8 @@ public class FDeckChooser extends JPanel implements IDecksComboBoxListener {
|
|||||||
lstDecks.setPool(Singletons.getModel().getDecks().getConstructed());
|
lstDecks.setPool(Singletons.getModel().getDecks().getConstructed());
|
||||||
lstDecks.update();
|
lstDecks.update();
|
||||||
|
|
||||||
getBtnRandom().setText("Random Deck");
|
btnRandom.setText("Random Deck");
|
||||||
getBtnRandom().setCommand(new Command() {
|
btnRandom.setCommand(new Command() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
DeckgenUtil.randomSelect(lstDecks);
|
DeckgenUtil.randomSelect(lstDecks);
|
||||||
@@ -149,8 +151,8 @@ public class FDeckChooser extends JPanel implements IDecksComboBoxListener {
|
|||||||
lstDecks.setPool(decks);
|
lstDecks.setPool(decks);
|
||||||
lstDecks.update(true);
|
lstDecks.update(true);
|
||||||
|
|
||||||
getBtnRandom().setText("Random Colors");
|
btnRandom.setText("Random Colors");
|
||||||
getBtnRandom().setCommand(new Command() {
|
btnRandom.setCommand(new Command() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
DeckgenUtil.randomSelectColors(lstDecks);
|
DeckgenUtil.randomSelectColors(lstDecks);
|
||||||
@@ -183,8 +185,8 @@ public class FDeckChooser extends JPanel implements IDecksComboBoxListener {
|
|||||||
lstDecks.setPool(decks);
|
lstDecks.setPool(decks);
|
||||||
lstDecks.update(true);
|
lstDecks.update(true);
|
||||||
|
|
||||||
getBtnRandom().setText("Random Deck");
|
btnRandom.setText("Random Deck");
|
||||||
getBtnRandom().setCommand(new Command() {
|
btnRandom.setCommand(new Command() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
DeckgenUtil.randomSelect(lstDecks);
|
DeckgenUtil.randomSelect(lstDecks);
|
||||||
@@ -205,8 +207,8 @@ public class FDeckChooser extends JPanel implements IDecksComboBoxListener {
|
|||||||
lstDecks.setPool(decks);
|
lstDecks.setPool(decks);
|
||||||
lstDecks.update(false, true);
|
lstDecks.update(false, true);
|
||||||
|
|
||||||
getBtnRandom().setText("Random Deck");
|
btnRandom.setText("Random Deck");
|
||||||
getBtnRandom().setCommand(new Command() {
|
btnRandom.setCommand(new Command() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
DeckgenUtil.randomSelect(lstDecks);
|
DeckgenUtil.randomSelect(lstDecks);
|
||||||
@@ -231,8 +233,8 @@ public class FDeckChooser extends JPanel implements IDecksComboBoxListener {
|
|||||||
lstDecks.setPool(decks);
|
lstDecks.setPool(decks);
|
||||||
lstDecks.update(false, true);
|
lstDecks.update(false, true);
|
||||||
|
|
||||||
getBtnRandom().setText("Random Deck");
|
btnRandom.setText("Random Deck");
|
||||||
getBtnRandom().setCommand(new Command() {
|
btnRandom.setCommand(new Command() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
DeckgenUtil.randomSelect(lstDecks);
|
DeckgenUtil.randomSelect(lstDecks);
|
||||||
@@ -271,10 +273,11 @@ public class FDeckChooser extends JPanel implements IDecksComboBoxListener {
|
|||||||
public void populate() {
|
public void populate() {
|
||||||
setupUI();
|
setupUI();
|
||||||
removeAll();
|
removeAll();
|
||||||
this.setLayout(new MigLayout("insets 0, gap 0, flowy"));
|
this.setLayout(new MigLayout("insets 0, gap 0"));
|
||||||
decksComboBox.addTo(this, "w 10:100%, h 30px!, gapbottom 5px");
|
decksComboBox.addTo(this, "w 100%, h 30px!, gapbottom 5px, spanx 2, wrap");
|
||||||
this.add(new ItemManagerContainer(lstDecks), "w 10:100%, growy, pushy");
|
this.add(new ItemManagerContainer(lstDecks), "w 100%, growy, pushy, spanx 2, wrap");
|
||||||
this.add(btnRandom, "w 10:100%, h 30px!, gaptop 5px");
|
this.add(btnViewDeck, "w 50%-3px, h 30px!, gaptop 5px, gapright 6px");
|
||||||
|
this.add(btnRandom, "w 50%-3px, h 30px!, gaptop 5px");
|
||||||
if (isShowing()) {
|
if (isShowing()) {
|
||||||
validate();
|
validate();
|
||||||
repaint();
|
repaint();
|
||||||
|
|||||||
Reference in New Issue
Block a user