mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
Merge branch 'deck-viewer' into 'master'
improve "Copy to Clipboard" - merge reprinted cards See merge request core-developers/forge!215
This commit is contained in:
@@ -30,6 +30,8 @@ import java.awt.event.ActionListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class FDeckViewer extends FDialog {
|
||||
@@ -171,6 +173,8 @@ public class FDeckViewer extends FDialog {
|
||||
final String nl = System.getProperty("line.separator");
|
||||
final StringBuilder deckList = new StringBuilder();
|
||||
final String dName = deck.getName();
|
||||
String cardName;
|
||||
SortedMap<String, Integer> sectionCards;
|
||||
deckList.append(dName == null ? "" : dName + nl + nl);
|
||||
|
||||
for (DeckSection s : DeckSection.values()){
|
||||
@@ -179,12 +183,22 @@ public class FDeckViewer extends FDialog {
|
||||
continue;
|
||||
}
|
||||
deckList.append(s.toString()).append(": ");
|
||||
sectionCards = new TreeMap<>();
|
||||
if (s.isSingleCard()) {
|
||||
deckList.append(cp.get(0).getName()).append(nl);
|
||||
}
|
||||
else {
|
||||
deckList.append(nl);
|
||||
for (final Entry<PaperCard, Integer> ev : cp) {
|
||||
cardName = ev.getKey().toString();
|
||||
if (sectionCards.containsKey(cardName)) {
|
||||
sectionCards.put(cardName, (int)sectionCards.get(cardName) + ev.getValue());
|
||||
}
|
||||
else {
|
||||
sectionCards.put(cardName, ev.getValue());
|
||||
}
|
||||
}
|
||||
for (final Entry<String, Integer> ev: sectionCards.entrySet()) {
|
||||
deckList.append(ev.getValue()).append(" ").append(ev.getKey()).append(nl);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user