Fixed tooltips not displayed for tokens.

This commit is contained in:
magenoxx 2011-06-13 19:56:43 +04:00
parent 8e788f3b32
commit 78bc920ba7
2 changed files with 116 additions and 113 deletions

View file

@ -93,7 +93,7 @@ public class CardView implements Serializable {
this.manaCost = card.getManaCost().getSymbols(); this.manaCost = card.getManaCost().getSymbols();
this.convertedManaCost = card.getManaCost().convertedManaCost(); this.convertedManaCost = card.getManaCost().convertedManaCost();
if (card instanceof PermanentToken) { if (card instanceof PermanentToken) {
this.rarity = Rarity.NA; this.rarity = Rarity.COMMON;
} else { } else {
this.rarity = card.getRarity(); this.rarity = card.getRarity();
} }

View file

@ -2,7 +2,6 @@ package org.mage.plugins.card.info;
import mage.Constants; import mage.Constants;
import mage.components.CardInfoPane; import mage.components.CardInfoPane;
import mage.game.permanent.Permanent;
import mage.utils.CardUtil; import mage.utils.CardUtil;
import mage.utils.ThreadUtils; import mage.utils.ThreadUtils;
import mage.view.CardView; import mage.view.CardView;
@ -39,6 +38,7 @@ public class CardInfoPaneImpl extends JEditorPane implements CardInfoPane {
ThreadUtils.threadPool.submit(new Runnable() { ThreadUtils.threadPool.submit(new Runnable() {
public void run() { public void run() {
try {
if (!card.equals(currentCard)) return; if (!card.equals(currentCard)) return;
String manaCost = ""; String manaCost = "";
@ -55,14 +55,14 @@ public class CardInfoPaneImpl extends JEditorPane implements CardInfoPane {
List<String> rules = card.getRules(); List<String> rules = card.getRules();
List<String> rulings = new ArrayList<String>(rules); List<String> rulings = new ArrayList<String>(rules);
try {
if (card instanceof PermanentView) { if (card instanceof PermanentView) {
List<CounterView> counters = ((PermanentView)card).getCounters(); List<CounterView> counters = ((PermanentView) card).getCounters();
int count = counters != null ? counters.size() : 0; int count = counters != null ? counters.size() : 0;
if (count > 0) { if (count > 0) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
int index = 0; int index = 0;
for (CounterView counter: ((PermanentView)card).getCounters()) { for (CounterView counter : ((PermanentView) card).getCounters()) {
if (counter.getCount() > 0) { if (counter.getCount() > 0) {
if (index == 0) { if (index == 0) {
sb.append("<b>Counters:</b> "); sb.append("<b>Counters:</b> ");
@ -76,9 +76,7 @@ public class CardInfoPaneImpl extends JEditorPane implements CardInfoPane {
rulings.add(sb.toString()); rulings.add(sb.toString());
} }
} }
} catch (Exception e) {
e.printStackTrace();
}
boolean smallImages = true; boolean smallImages = true;
int fontSize = 11; int fontSize = 11;
@ -122,7 +120,9 @@ public class CardInfoPaneImpl extends JEditorPane implements CardInfoPane {
break; break;
} }
String rarity = card.getRarity().getCode(); String rarity = card.getRarity().getCode();
if (card.getExpansionSetCode() != null) {
buffer.append(ManaSymbols.replaceSetCodeWithHTML(card.getExpansionSetCode().toUpperCase(), rarity)); buffer.append(ManaSymbols.replaceSetCodeWithHTML(card.getExpansionSetCode().toUpperCase(), rarity));
}
buffer.append("</td></tr></table>"); buffer.append("</td></tr></table>");
String pt = ""; String pt = "";
@ -153,7 +153,6 @@ public class CardInfoPaneImpl extends JEditorPane implements CardInfoPane {
} }
if (legal.length() > 0) { if (legal.length() > 0) {
//buffer.append("<br>"); //buffer.append("<br>");
legal = legal.replaceAll("\\{this\\}", card.getName()); legal = legal.replaceAll("\\{this\\}", card.getName());
@ -172,6 +171,10 @@ public class CardInfoPaneImpl extends JEditorPane implements CardInfoPane {
//ThreadUtils.sleep(300); //ThreadUtils.sleep(300);
} }
}); });
} catch (Exception e) {
e.printStackTrace();
}
} }
}); });
} }