protected void measure(Event event, Object element) {
CardTemplate card = CardPool.instance().lookup((Document)element);
if (card == null || !(card instanceof CardTemplateAdapter))
return;
CardTemplateAdapter adapter = (CardTemplateAdapter)card;
event.width = CardTemplate.MANA_SYMBOL_SIZE * adapter.getManaSymbolCount();
event.height = Math.max(event.height, CardTemplate.MANA_SYMBOL_SIZE + 2);
}
@Override
protected void paint(Event event, Object element) {
Document doc = (Document)element;
CardTemplate card = CardPool.instance().lookup(doc);
TableItem item = (TableItem ) event.item;
if (card == null || item == null || !(card instanceof CardTemplateAdapter))
return;
CardTemplateAdapter adapter = (CardTemplateAdapter)card;
Image image = adapter.getCastingCost();
if (image != null) {
Rectangle imagebounds = image.getBounds();
Rectangle bounds = item.getBounds(event.index);
int x = event.x + bounds.width - imagebounds.width;