Fixed a bug when showing and hiding drafted cards

This commit fixes the following bug:

1) Draft a couple of cards in draft mode
2) Hide a card
3) Show all cards
4) Hide another card

Here both cards got hidden, this commit makes sure
only the card in 4) gets hidden
This commit is contained in:
Kranken 2015-02-01 16:41:39 +01:00 committed by Anders Åstrand
parent 5d0a94c1b9
commit f8dd3a1491

View file

@ -382,10 +382,7 @@ public class DraftPanel extends javax.swing.JPanel {
menuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// Add the card to the hidden cards
cardsHidden.add(cardIdPopupMenu);
pickedCardsShown.remove(cardIdPopupMenu);
draftPicks.loadCards(CardsViewUtil.convertSimple(pickedCardsShown), bigCard, null);
hideThisCard(cardIdPopupMenu);
}
});
@ -393,11 +390,20 @@ public class DraftPanel extends javax.swing.JPanel {
}
private void hideThisCard(UUID card) {
// Add the card to the hidden cards
cardsHidden.add(card);
pickedCardsShown.remove(card);
draftPicks.loadCards(CardsViewUtil.convertSimple(pickedCardsShown), bigCard, null);
}
private void showAgainAllHiddenCards() {
// show again all hidden cards
// Add back the hidden cards to the shown set
for (UUID card : cardsHidden) {
pickedCardsShown.put(card, pickedCards.get(card));
}
cardsHidden.clear();
draftPicks.loadCards(CardsViewUtil.convertSimple(pickedCards), bigCard, null);
draftPicks.loadCards(CardsViewUtil.convertSimple(pickedCardsShown), bigCard, null);
}
/** This method is called from within the constructor to