mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
removed 140 lines of unused constructors of ListChooser
This commit is contained in:
@@ -171,7 +171,7 @@ public class GuiChoose {
|
||||
* @return a {@link java.util.List} object.
|
||||
*/
|
||||
private static <T> List<T> getChoices(final String message, final int min, final int max, final T[] choices) {
|
||||
final ListChooser<T> c = new ListChooser<T>(message, min, max, choices);
|
||||
final ListChooser<T> c = new ListChooser<T>(message, null, min, max, choices);
|
||||
return getChoices(c);
|
||||
}
|
||||
|
||||
|
||||
@@ -749,11 +749,12 @@ public final class GuiDisplayUtil {
|
||||
Collections.sort(cards);
|
||||
|
||||
// use standard forge's list selection dialog
|
||||
final ListChooser<CardPrinted> c = new ListChooser<CardPrinted>("Name the card", 0, 1, cards);
|
||||
if (c.show()) {
|
||||
Card forgeCard = c.getSelectedValue().toForgeCard(p);
|
||||
final CardPrinted c = GuiChoose.oneOrNone("Name the card", cards);
|
||||
if (c == null) return;
|
||||
|
||||
Card forgeCard = c.toForgeCard(p);
|
||||
Singletons.getModel().getGame().getAction().moveToHand(forgeCard);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void devModeCardToBattlefield() {
|
||||
@@ -765,22 +766,23 @@ public final class GuiDisplayUtil {
|
||||
Collections.sort(cards);
|
||||
|
||||
// use standard forge's list selection dialog
|
||||
final ListChooser<CardPrinted> c = new ListChooser<CardPrinted>("Name the card", 0, 1, cards);
|
||||
if (c.show()) {
|
||||
Card forgeCard = c.getSelectedValue().toForgeCard(p);
|
||||
final CardPrinted c = GuiChoose.oneOrNone("Name the card", cards);
|
||||
if (c == null) return;
|
||||
|
||||
Card forgeCard = c.toForgeCard(p);
|
||||
|
||||
final List<SpellAbility> choices = forgeCard.getBasicSpells();
|
||||
if (choices.isEmpty()) return; // when would it happen?
|
||||
|
||||
final SpellAbility sa = choices.size() == 1 ? choices.get(0) : GuiChoose.oneOrNone("Choose", choices);
|
||||
if (sa == null) return; // happends if cancelled
|
||||
if (sa == null) return; // happens if cancelled
|
||||
|
||||
sa.setActivatingPlayer(p);
|
||||
|
||||
final GameState game = Singletons.getModel().getGame();
|
||||
game.getAction().moveToHand(forgeCard); // this is really needed
|
||||
game.getAction().playSpellAbilityForFree(sa);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -83,87 +83,6 @@ public class ListChooser<T> {
|
||||
private JOptionPane optionPane;
|
||||
private Action ok, cancel;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for ListChooser.
|
||||
* </p>
|
||||
*
|
||||
* @param title
|
||||
* a {@link java.lang.String} object.
|
||||
* @param list
|
||||
* a T object.
|
||||
*/
|
||||
public ListChooser(final String title, final T[] list) {
|
||||
this(title, 1, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for ListChooser.
|
||||
* </p>
|
||||
*
|
||||
* @param title
|
||||
* a {@link java.lang.String} object.
|
||||
* @param numChoices
|
||||
* a int.
|
||||
* @param list
|
||||
* a T object.
|
||||
*/
|
||||
public ListChooser(final String title, final int numChoices, final T[] list) {
|
||||
this(title, numChoices, numChoices, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for ListChooser.
|
||||
* </p>
|
||||
*
|
||||
* @param title
|
||||
* a {@link java.lang.String} object.
|
||||
* @param minChoices
|
||||
* a int.
|
||||
* @param maxChoices
|
||||
* a int.
|
||||
* @param list
|
||||
* a T object.
|
||||
*/
|
||||
public ListChooser(final String title, final int minChoices, final int maxChoices, final T[] list) {
|
||||
this(title, null, minChoices, maxChoices, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for ListChooser.
|
||||
* </p>
|
||||
*
|
||||
* @param title
|
||||
* a {@link java.lang.String} object.
|
||||
* @param message
|
||||
* a {@link java.lang.String} object.
|
||||
* @param list
|
||||
* a T object.
|
||||
*/
|
||||
public ListChooser(final String title, final String message, final T[] list) {
|
||||
this(title, message, 1, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for ListChooser.
|
||||
* </p>
|
||||
*
|
||||
* @param title
|
||||
* a {@link java.lang.String} object.
|
||||
* @param message
|
||||
* a {@link java.lang.String} object.
|
||||
* @param numChoices
|
||||
* a int.
|
||||
* @param list
|
||||
* a T object.
|
||||
*/
|
||||
public ListChooser(final String title, final String message, final int numChoices, final T[] list) {
|
||||
this(title, message, numChoices, numChoices, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -186,36 +105,6 @@ public class ListChooser<T> {
|
||||
this(title, message, minChoices, maxChoices, Arrays.asList(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for ListChooser.
|
||||
* </p>
|
||||
*
|
||||
* @param title
|
||||
* a {@link java.lang.String} object.
|
||||
* @param list
|
||||
* a {@link java.util.List} object.
|
||||
*/
|
||||
public ListChooser(final String title, final List<T> list) {
|
||||
this(title, 1, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for ListChooser.
|
||||
* </p>
|
||||
*
|
||||
* @param title
|
||||
* a {@link java.lang.String} object.
|
||||
* @param numChoices
|
||||
* a int.
|
||||
* @param list
|
||||
* a {@link java.util.List} object.
|
||||
*/
|
||||
public ListChooser(final String title, final int numChoices, final Collection<T> list) {
|
||||
this(title, numChoices, numChoices, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for ListChooser.
|
||||
@@ -234,40 +123,6 @@ public class ListChooser<T> {
|
||||
this(title, null, minChoices, maxChoices, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for ListChooser.
|
||||
* </p>
|
||||
*
|
||||
* @param title
|
||||
* a {@link java.lang.String} object.
|
||||
* @param message
|
||||
* a {@link java.lang.String} object.
|
||||
* @param list
|
||||
* a {@link java.util.List} object.
|
||||
*/
|
||||
public ListChooser(final String title, final String message, final Collection<T> list) {
|
||||
this(title, message, 1, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for ListChooser.
|
||||
* </p>
|
||||
*
|
||||
* @param title
|
||||
* a {@link java.lang.String} object.
|
||||
* @param message
|
||||
* a {@link java.lang.String} object.
|
||||
* @param numChoices
|
||||
* a int.
|
||||
* @param list
|
||||
* a {@link java.util.List} object.
|
||||
*/
|
||||
public ListChooser(final String title, final String message, final int numChoices, final Collection<T> list) {
|
||||
this(title, message, numChoices, numChoices, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Constructor for ListChooser.
|
||||
|
||||
@@ -544,7 +544,7 @@ public class QuestWinLose extends ControlWinLose {
|
||||
i++;
|
||||
}
|
||||
|
||||
final ListChooser<GameFormat> ch = new ListChooser<GameFormat>("Choose bonus booster format", 1, formats);
|
||||
final ListChooser<GameFormat> ch = new ListChooser<GameFormat>("Choose bonus booster format", 1, 1, formats);
|
||||
ch.show(index);
|
||||
|
||||
final GameFormat selected = ch.getSelectedValue();
|
||||
|
||||
Reference in New Issue
Block a user