MCPcopy Create free account
hub / github.com/Card-Forge/forge / buildMenu

Method buildMenu

forge-gui-mobile/src/forge/deck/FDeckViewer.java:24–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22 private static FDeckViewer deckViewer;
23 private static FPopupMenu menu = new FPopupMenu() {
24 @Override
25 protected void buildMenu() {
26 Deck deck = deckViewer.deck;
27 for (Entry<DeckSection, CardPool> entry : deck) {
28 final DeckSection section = entry.getKey();
29 final CardPool pool = entry.getValue();
30 int count = pool.countAll();
31 if (count == 0) { continue; }
32
33 final String captionPrefix = section.getLocalizedName();
34 final FImage icon = FDeckEditor.iconFromDeckSection(section);
35
36 FMenuItem item = new FMenuItem(captionPrefix + " (" + count + ")", icon, e -> deckViewer.setCurrentSection(section));
37 if (section == deckViewer.currentSection) {
38 item.setSelected(true);
39 }
40 addItem(item);
41 }
42 addItem(new FMenuItem(Forge.getLocalizer().getMessage("btnCopyToClipboard"), Forge.hdbuttons ? FSkinImage.HDEXPORT : FSkinImage.BLANK, e -> copyDeckToClipboard(deckViewer.deck)));
43 }
44 };
45
46 public static void copyDeckToClipboard(Deck deck) {

Callers

nothing calls this directly

Calls 11

getLocalizedNameMethod · 0.95
iconFromDeckSectionMethod · 0.95
setSelectedMethod · 0.95
getLocalizerMethod · 0.95
copyDeckToClipboardMethod · 0.95
countAllMethod · 0.80
setCurrentSectionMethod · 0.80
addItemMethod · 0.65
getKeyMethod · 0.45
getValueMethod · 0.45
getMessageMethod · 0.45

Tested by

no test coverage detected