mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
fix label on 'Choose deck' button
This commit is contained in:
@@ -6,7 +6,9 @@ import java.util.Map.Entry;
|
|||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import com.google.common.base.Function;
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
|
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.card.ColorSet;
|
import forge.card.ColorSet;
|
||||||
import forge.deck.CardPool;
|
import forge.deck.CardPool;
|
||||||
@@ -28,6 +30,14 @@ public class DeckProxy implements InventoryItem {
|
|||||||
protected final Deck deck;
|
protected final Deck deck;
|
||||||
protected final IStorage<?> storage;
|
protected final IStorage<?> storage;
|
||||||
|
|
||||||
|
public static final Function<DeckProxy, String> FN_GET_NAME = new Function<DeckProxy, String>() {
|
||||||
|
@Override
|
||||||
|
public String apply(DeckProxy arg0) {
|
||||||
|
return arg0.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
// cached values
|
// cached values
|
||||||
protected ColorSet color;
|
protected ColorSet color;
|
||||||
protected Iterable<GameFormat> formats;
|
protected Iterable<GameFormat> formats;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import java.awt.event.ItemEvent;
|
|||||||
import java.awt.event.ItemListener;
|
import java.awt.event.ItemListener;
|
||||||
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.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
@@ -428,8 +429,9 @@ public enum VSubmenuConstructed implements IVSubmenu<CSubmenuConstructed> {
|
|||||||
mainDeckPanel.add(mainChooser, "grow, push, wrap");
|
mainDeckPanel.add(mainChooser, "grow, push, wrap");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onDeckClicked(int iPlayer, DeckType type, Iterable<DeckProxy> selectedDecks) {
|
protected void onDeckClicked(int iPlayer, DeckType type, Collection<DeckProxy> selectedDecks) {
|
||||||
String text = type.toString() + ": " + Lang.joinHomogenous(selectedDecks);
|
|
||||||
|
String text = type.toString() + ": " + Lang.joinHomogenous(selectedDecks, DeckProxy.FN_GET_NAME);
|
||||||
deckSelectorBtns.get(iPlayer).setText(text);
|
deckSelectorBtns.get(iPlayer).setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import java.awt.event.KeyEvent;
|
|||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -468,7 +469,7 @@ public abstract class ItemManager<T extends InventoryItem> extends JPanel {
|
|||||||
*
|
*
|
||||||
* @return Iterable<T>
|
* @return Iterable<T>
|
||||||
*/
|
*/
|
||||||
public Iterable<T> getSelectedItems() {
|
public Collection<T> getSelectedItems() {
|
||||||
return this.table.getSelectedItems();
|
return this.table.getSelectedItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import java.awt.event.FocusEvent;
|
|||||||
import java.awt.event.KeyAdapter;
|
import java.awt.event.KeyAdapter;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
@@ -80,7 +81,7 @@ public abstract class ItemView<T extends InventoryItem> {
|
|||||||
return index >= 0 ? getItemAtIndex(index) : null;
|
return index >= 0 ? getItemAtIndex(index) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Iterable<T> getSelectedItems() {
|
public final Collection<T> getSelectedItems() {
|
||||||
List<T> items = new ArrayList<T>();
|
List<T> items = new ArrayList<T>();
|
||||||
for (Integer i : getSelectedIndices()) {
|
for (Integer i : getSelectedIndices()) {
|
||||||
items.add(getItemAtIndex(i));
|
items.add(getItemAtIndex(i));
|
||||||
|
|||||||
Reference in New Issue
Block a user