Added svg support: new render for mana icons in tables (deck editor, draft)

This commit is contained in:
Oleg Agafonov 2017-11-26 00:50:25 +04:00
parent 471f49c9c8
commit 5cda60270c
4 changed files with 15 additions and 1 deletions

View file

@ -1,6 +1,5 @@
XMage.de 1 (Europe/Germany) fast :xmage.de:17171
woogerworks (North America/USA) :xmage.woogerworks.com:17171
xmage.lukeskywalk.com (North America) :xmage.lukeskywalk.com:17171
play.xmage.net (North America/Canada) :play.xmage.net:17171
XMageBr. (South America/Brazil) :magic.ncs3sistemas.com.br:17171
XMage.tahiti :xmage.tahiti.one:443

View file

@ -48,6 +48,7 @@ import mage.view.CardView;
import mage.view.CardsView;
import mage.view.SimpleCardView;
import org.mage.card.arcane.CardPanel;
import org.mage.card.arcane.ManaSymbolsCellRenderer;
import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
@ -164,6 +165,9 @@ public class CardsList extends javax.swing.JPanel implements MouseListener, ICar
mainTable.getColumnModel().getColumn(6).setPreferredWidth(15);
mainTable.getColumnModel().getColumn(7).setPreferredWidth(15);
// new mana render (svg support)
mainTable.getColumnModel().getColumn(mainModel.COLUMN_INDEX_COST).setCellRenderer(new ManaSymbolsCellRenderer());
if (PreferencesDialog.getCachedValue(PreferencesDialog.KEY_DRAFT_VIEW, "cardView").equals("listView")) {
jToggleListView.setSelected(true);
panelCardArea.setViewportView(mainTable);

View file

@ -64,6 +64,7 @@ import mage.filter.predicate.other.CardTextPredicate;
import mage.filter.predicate.other.ExpansionSetPredicate;
import mage.view.CardView;
import mage.view.CardsView;
import org.mage.card.arcane.ManaSymbolsCellRenderer;
/**
*
@ -133,6 +134,9 @@ public class CardSelector extends javax.swing.JPanel implements ComponentListene
mainTable.getColumnModel().getColumn(6).setPreferredWidth(15);
mainTable.getColumnModel().getColumn(7).setPreferredWidth(15);
// new mana render (svg support)
mainTable.getColumnModel().getColumn(mainModel.COLUMN_INDEX_COST).setCellRenderer(new ManaSymbolsCellRenderer());
// mainTable.setToolTipText(cardSelectorScrollPane.getToolTipText());
cardSelectorScrollPane.setViewportView(mainTable);
mainTable.setOpaque(false);

View file

@ -79,6 +79,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
private UpdateCountsCallback updateCountsCallback;
private final String column[] = {"Qty", "Name", "Cost", "Color", "Type", "Stats", "Rarity", "Set", "#"};
public final int COLUMN_INDEX_COST = 2;
private SortSetting sortSetting;
private int recentSortedColumn;
@ -239,6 +240,10 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
case 1:
return c.getName();
case 2:
// new svg images version
return ManaSymbols.getStringManaCost(c.getManaCost());
/*
// old html images version
String manaCost = "";
for (String m : c.getManaCost()) {
manaCost += m;
@ -246,6 +251,8 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
String castingCost = UI.getDisplayManaCost(manaCost);
castingCost = ManaSymbols.replaceSymbolsWithHTML(castingCost, ManaSymbols.Type.TABLE);
return "<html>" + castingCost + "</html>";
return castingCost;
*/
case 3:
return c.getColorText();
case 4: