mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
Add "Folder" column to DeckManagers
This commit is contained in:
@@ -49,11 +49,11 @@ public class DeckProxy implements InventoryItem {
|
|||||||
private final Function<IHasName, Deck> fnGetDeck;
|
private final Function<IHasName, Deck> fnGetDeck;
|
||||||
|
|
||||||
public DeckProxy(Deck deck, GameType type, IStorage<? extends IHasName> storage) {
|
public DeckProxy(Deck deck, GameType type, IStorage<? extends IHasName> storage) {
|
||||||
this(deck, type, null, storage, null);
|
this(deck, type, "", storage, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DeckProxy(IHasName deck, Function<IHasName, Deck> fnGetDeck, GameType type, IStorage<? extends IHasName> storage) {
|
public DeckProxy(IHasName deck, Function<IHasName, Deck> fnGetDeck, GameType type, IStorage<? extends IHasName> storage) {
|
||||||
this(deck, type, null, storage, fnGetDeck);
|
this(deck, type, "", storage, fnGetDeck);
|
||||||
}
|
}
|
||||||
|
|
||||||
private DeckProxy(IHasName deck, GameType type, String path, IStorage<? extends IHasName> storage, Function<IHasName, Deck> fnGetDeck) {
|
private DeckProxy(IHasName deck, GameType type, String path, IStorage<? extends IHasName> storage, Function<IHasName, Deck> fnGetDeck) {
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ public final class DeckManager extends ItemManager<DeckProxy> {
|
|||||||
private Command cmdDelete, cmdSelect;
|
private Command cmdDelete, cmdSelect;
|
||||||
private final Map<ColumnDef, ItemColumn> columns = SColumnUtil.getColumns(
|
private final Map<ColumnDef, ItemColumn> columns = SColumnUtil.getColumns(
|
||||||
ColumnDef.DECK_ACTIONS,
|
ColumnDef.DECK_ACTIONS,
|
||||||
|
ColumnDef.DECK_FOLDER,
|
||||||
ColumnDef.NAME,
|
ColumnDef.NAME,
|
||||||
ColumnDef.DECK_COLOR,
|
ColumnDef.DECK_COLOR,
|
||||||
ColumnDef.DECK_FORMAT,
|
ColumnDef.DECK_FORMAT,
|
||||||
@@ -74,7 +75,8 @@ public final class DeckManager extends ItemManager<DeckProxy> {
|
|||||||
this.gametype = gt;
|
this.gametype = gt;
|
||||||
|
|
||||||
columns.get(ColumnDef.DECK_ACTIONS).setCellRenderer(new DeckActionsRenderer());
|
columns.get(ColumnDef.DECK_ACTIONS).setCellRenderer(new DeckActionsRenderer());
|
||||||
columns.get(ColumnDef.NAME).setSortPriority(1);
|
columns.get(ColumnDef.DECK_FOLDER).setSortPriority(1);
|
||||||
|
columns.get(ColumnDef.NAME).setSortPriority(2);
|
||||||
|
|
||||||
this.addSelectionListener(new ListSelectionListener() {
|
this.addSelectionListener(new ListSelectionListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -396,6 +396,19 @@ public class ItemColumn extends TableColumn {
|
|||||||
return toDeck(from.getKey());
|
return toDeck(from.getKey());
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
DECK_FOLDER("Folder", "Folder", 80, -1, -1, SortState.ASC, new ItemCellRenderer(),
|
||||||
|
new Function<Entry<InventoryItem, Integer>, Comparable<?>>() {
|
||||||
|
@Override
|
||||||
|
public Comparable<?> apply(final Entry<InventoryItem, Integer> from) {
|
||||||
|
return toDeckFolder(from.getKey());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new Function<Entry<? extends InventoryItem, Integer>, Object>() {
|
||||||
|
@Override
|
||||||
|
public Object apply(final Entry<? extends InventoryItem, Integer> from) {
|
||||||
|
return toDeckFolder(from.getKey());
|
||||||
|
}
|
||||||
|
}),
|
||||||
DECK_COLOR("Color", "Color", 70, 70, 70, SortState.ASC, new ColorSetRenderer(),
|
DECK_COLOR("Color", "Color", 70, 70, 70, SortState.ASC, new ColorSetRenderer(),
|
||||||
new Function<Entry<InventoryItem, Integer>, Comparable<?>>() {
|
new Function<Entry<InventoryItem, Integer>, Comparable<?>>() {
|
||||||
@Override
|
@Override
|
||||||
@@ -546,5 +559,8 @@ public class ItemColumn extends TableColumn {
|
|||||||
private static ColorSet toDeckColor(final InventoryItem i) {
|
private static ColorSet toDeckColor(final InventoryItem i) {
|
||||||
return i instanceof DeckProxy ? ((DeckProxy) i).getColor() : null;
|
return i instanceof DeckProxy ? ((DeckProxy) i).getColor() : null;
|
||||||
}
|
}
|
||||||
|
private static String toDeckFolder(final InventoryItem i) {
|
||||||
|
return i instanceof DeckProxy ? ((DeckProxy) i).getPath() + "/" : null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user