forked from External/mage
Add tracking for number of artifacts in card lists.
This commit is contained in:
parent
6a03522ee8
commit
8758c2de36
4 changed files with 72 additions and 19 deletions
|
|
@ -123,6 +123,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
|||
int instantCount = 0;
|
||||
int sorceryCount = 0;
|
||||
int enchantmentCount = 0;
|
||||
int artifactCount = 0;
|
||||
if (!merge) {
|
||||
this.clearCards();
|
||||
for (CardView card : showCards.values()) {
|
||||
|
|
@ -149,6 +150,9 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
|||
if (card.getCardTypes().contains(CardType.ENCHANTMENT)) {
|
||||
enchantmentCount++;
|
||||
}
|
||||
if (card.getCardTypes().contains(CardType.ARTIFACT)) {
|
||||
artifactCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -199,7 +203,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
|
|||
}
|
||||
|
||||
if (updateCountsCallback != null) {
|
||||
updateCountsCallback.update(cards.size(), creatureCount, landCount, sorceryCount, instantCount, enchantmentCount);
|
||||
updateCountsCallback.update(cards.size(), creatureCount, landCount, sorceryCount, instantCount, enchantmentCount, artifactCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,22 +14,25 @@ public class UpdateCountsCallback {
|
|||
private final javax.swing.JLabel lblSoerceryCount;
|
||||
private final javax.swing.JLabel lblInstantCount;
|
||||
private final javax.swing.JLabel lblEnchantmentCount;
|
||||
private final javax.swing.JLabel lblArtifactCount;
|
||||
|
||||
public UpdateCountsCallback(JLabel count, JLabel creatures, JLabel lands, JLabel sorceries, JLabel instants, JLabel enchantments) {
|
||||
public UpdateCountsCallback(JLabel count, JLabel creatures, JLabel lands, JLabel sorceries, JLabel instants, JLabel enchantments, JLabel artifacts) {
|
||||
this.lblCount = count;
|
||||
this.lblCreatureCount = creatures;
|
||||
this.lblLandCount = lands;
|
||||
this.lblSoerceryCount = sorceries;
|
||||
this.lblInstantCount = instants;
|
||||
this.lblEnchantmentCount = enchantments;
|
||||
this.lblArtifactCount = artifacts;
|
||||
}
|
||||
|
||||
public void update(int count, int creatures, int lands, int sorceries, int instants, int enchantments) {
|
||||
public void update(int count, int creatures, int lands, int sorceries, int instants, int enchantments, int artifacts) {
|
||||
this.lblCount.setText(Integer.toString(count));
|
||||
this.lblCreatureCount.setText(Integer.toString(creatures));
|
||||
this.lblLandCount.setText(Integer.toString(lands));
|
||||
this.lblSoerceryCount.setText(Integer.toString(sorceries));
|
||||
this.lblInstantCount.setText(Integer.toString(instants));
|
||||
this.lblEnchantmentCount.setText(Integer.toString(enchantments));
|
||||
this.lblArtifactCount.setText(Integer.toString(artifacts));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue