Search in sources :

Example 1 with CardEventProducer

use of mage.client.cards.CardEventProducer in project mage by magefree.

the class MageActionCallback method popupMenuCard.

@Override
public void popupMenuCard(MouseEvent e, TransferData data) {
    // send popup menu request over card
    if (e.isConsumed()) {
        return;
    }
    e.consume();
    if (data.getComponent().getCardContainer() instanceof CardEventProducer) {
        CardEventProducer area = (CardEventProducer) data.getComponent().getCardContainer();
        mage.client.util.Event clientEvent = new mage.client.util.Event(data.getComponent().getOriginal(), ClientEventType.CARD_POPUP_MENU, 0, e.getX(), e.getY(), data.getComponent(), e, false);
        area.getCardEventSource().fireEvent(clientEvent);
    }
}
Also used : BufferedImage(java.awt.image.BufferedImage) java.util(java.util) MouseWheelEvent(java.awt.event.MouseWheelEvent) MouseEvent(java.awt.event.MouseEvent) CardEventProducer(mage.client.cards.CardEventProducer)

Example 2 with CardEventProducer

use of mage.client.cards.CardEventProducer in project mage by magefree.

the class MageActionCallback method mouseClicked.

@Override
public void mouseClicked(MouseEvent e, TransferData data, boolean doubleClick) {
    // send mouse clicked event to the card's area and other cards list components for processing
    if (e.isConsumed()) {
        return;
    }
    if (data.getComponent().getCardContainer() instanceof CardEventProducer) {
        ClientEventType clickType = doubleClick ? ClientEventType.CARD_DOUBLE_CLICK : ClientEventType.CARD_CLICK;
        CardEventProducer cardContainer = (CardEventProducer) data.getComponent().getCardContainer();
        mage.client.util.Event clientEvent = new mage.client.util.Event(data.getComponent().getOriginal(), clickType, 0, e.getX(), e.getY(), data.getComponent(), e, false);
        cardContainer.getCardEventSource().fireEvent(clientEvent);
    }
}
Also used : BufferedImage(java.awt.image.BufferedImage) java.util(java.util) ClientEventType(mage.client.util.ClientEventType) MouseWheelEvent(java.awt.event.MouseWheelEvent) MouseEvent(java.awt.event.MouseEvent) CardEventProducer(mage.client.cards.CardEventProducer)

Example 3 with CardEventProducer

use of mage.client.cards.CardEventProducer in project mage by magefree.

the class MageActionCallback method popupMenuPanel.

@Override
public void popupMenuPanel(MouseEvent e, Component sourceComponent) {
    // over non card component
    if (e.isConsumed()) {
        return;
    }
    e.consume();
    if (sourceComponent instanceof CardEventProducer) {
        CardEventProducer area = (CardEventProducer) sourceComponent;
        // card param must be empty
        mage.client.util.Event clientEvent = new mage.client.util.Event(null, ClientEventType.CARD_POPUP_MENU, 0, e.getX(), e.getY(), e.getComponent(), e, false);
        area.getCardEventSource().fireEvent(clientEvent);
    }
}
Also used : BufferedImage(java.awt.image.BufferedImage) java.util(java.util) MouseWheelEvent(java.awt.event.MouseWheelEvent) MouseEvent(java.awt.event.MouseEvent) CardEventProducer(mage.client.cards.CardEventProducer)

Aggregations

MouseEvent (java.awt.event.MouseEvent)3 MouseWheelEvent (java.awt.event.MouseWheelEvent)3 BufferedImage (java.awt.image.BufferedImage)3 java.util (java.util)3 CardEventProducer (mage.client.cards.CardEventProducer)3 ClientEventType (mage.client.util.ClientEventType)1