removed 140 lines of unused constructors of ListChooser

This commit is contained in:
Maxmtg
2012-11-06 19:23:10 +00:00
parent aaeaf9bbab
commit 92eafe7846
4 changed files with 22 additions and 165 deletions

View File

@@ -171,7 +171,7 @@ public class GuiChoose {
* @return a {@link java.util.List} object. * @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) { 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); return getChoices(c);
} }

View File

@@ -749,11 +749,12 @@ public final class GuiDisplayUtil {
Collections.sort(cards); Collections.sort(cards);
// use standard forge's list selection dialog // use standard forge's list selection dialog
final ListChooser<CardPrinted> c = new ListChooser<CardPrinted>("Name the card", 0, 1, cards); final CardPrinted c = GuiChoose.oneOrNone("Name the card", cards);
if (c.show()) { if (c == null) return;
Card forgeCard = c.getSelectedValue().toForgeCard(p);
Singletons.getModel().getGame().getAction().moveToHand(forgeCard); Card forgeCard = c.toForgeCard(p);
} Singletons.getModel().getGame().getAction().moveToHand(forgeCard);
} }
public static void devModeCardToBattlefield() { public static void devModeCardToBattlefield() {
@@ -765,22 +766,23 @@ public final class GuiDisplayUtil {
Collections.sort(cards); Collections.sort(cards);
// use standard forge's list selection dialog // use standard forge's list selection dialog
final ListChooser<CardPrinted> c = new ListChooser<CardPrinted>("Name the card", 0, 1, cards); final CardPrinted c = GuiChoose.oneOrNone("Name the card", cards);
if (c.show()) { if (c == null) return;
Card forgeCard = c.getSelectedValue().toForgeCard(p);
Card forgeCard = c.toForgeCard(p);
final List<SpellAbility> choices = forgeCard.getBasicSpells();
if (choices.isEmpty()) return; // when would it happen? 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); 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); sa.setActivatingPlayer(p);
final GameState game = Singletons.getModel().getGame();
game.getAction().moveToHand(forgeCard); // this is really needed
game.getAction().playSpellAbilityForFree(sa);
final GameState game = Singletons.getModel().getGame();
game.getAction().moveToHand(forgeCard); // this is really needed
game.getAction().playSpellAbilityForFree(sa);
}
} }

View File

@@ -83,87 +83,6 @@ public class ListChooser<T> {
private JOptionPane optionPane; private JOptionPane optionPane;
private Action ok, cancel; 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> * <p>
@@ -186,36 +105,6 @@ public class ListChooser<T> {
this(title, message, minChoices, maxChoices, Arrays.asList(list)); 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> * <p>
* Constructor for ListChooser. * Constructor for ListChooser.
@@ -234,40 +123,6 @@ public class ListChooser<T> {
this(title, null, minChoices, maxChoices, 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 {@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> * <p>
* Constructor for ListChooser. * Constructor for ListChooser.

View File

@@ -544,7 +544,7 @@ public class QuestWinLose extends ControlWinLose {
i++; 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); ch.show(index);
final GameFormat selected = ch.getSelectedValue(); final GameFormat selected = ch.getSelectedValue();