use of org.magic.game.gui.components.Draggable in project MtgDesktopCompanion by nicho92.
the class CardTransfertHandler method importData.
@Override
public boolean importData(TransferSupport support) {
if (!canImport(support))
return false;
try {
Draggable target = (Draggable) support.getComponent();
DisplayableCard src = (DisplayableCard) support.getTransferable().getTransferData(localObjectFlavor);
if ((((Draggable) src.getParent()).getOrigine() != target.getOrigine())) {
src.getParent().revalidate();
target.updatePanel();
src.getParent().repaint();
GameManager.getInstance().getStack().put(new CardSpell(src.getName(), src.getText(), src));
logger.debug("move " + src.getMagicCard().getName() + " from " + ((Draggable) src.getParent()).getOrigine() + " to " + target.getOrigine());
((Draggable) src.getParent()).moveCard(src, target.getOrigine());
target.addComponent(src);
} else {
target.postTreatment(src);
}
return true;
} catch (Exception ufe) {
logger.error("Error transfert", ufe);
}
return false;
}
Aggregations