mirror of
https://github.com/correl/mage.git
synced 2025-03-07 20:53:18 -10:00
added transfer data object to mouseExited. added desktoppane to ui components references.
This commit is contained in:
parent
65e5c59004
commit
0721c843d2
7 changed files with 41 additions and 4 deletions
Binary file not shown.
|
@ -143,6 +143,7 @@ public class MageFrame extends javax.swing.JFrame {
|
|||
desktopPane.add(combat, JLayeredPane.POPUP_LAYER);
|
||||
combat.hideDialog();
|
||||
desktopPane.add(pickNumber, JLayeredPane.POPUP_LAYER);
|
||||
session.getUI().addComponent(MageComponents.DESKTOP_PANE, desktopPane);
|
||||
if (autoConnect())
|
||||
enableButtons();
|
||||
else
|
||||
|
|
|
@ -4,7 +4,8 @@ public enum MageComponents {
|
|||
TABLES_MENU_BUTTON("btnGames"),
|
||||
NEW_GAME_BUTTON("btnNewTable"),
|
||||
NEW_TABLE_OK_BUTTON("btnOK"),
|
||||
TABLE_WAITING_START_BUTTON("btnStart");
|
||||
TABLE_WAITING_START_BUTTON("btnStart"),
|
||||
DESKTOP_PANE("desktopPane");
|
||||
|
||||
private String name;
|
||||
MageComponents(String name) {
|
||||
|
|
|
@ -35,6 +35,27 @@ public class MageUI {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
public Component getComponent(MageComponents name) throws InterruptedException {
|
||||
Object componentSync;
|
||||
synchronized (ui) {
|
||||
if (ui.containsKey(name)) {
|
||||
return ui.get(name);
|
||||
} else {
|
||||
componentSync = new Object();
|
||||
sync.put(name, componentSync);
|
||||
}
|
||||
}
|
||||
|
||||
synchronized (componentSync) {
|
||||
componentSync.wait();
|
||||
if (!ui.containsKey(name)) {
|
||||
throw new IllegalStateException("Component wasn't initialized. This should not happen.");
|
||||
}
|
||||
return ui.get(name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void addButton(MageComponents name, JButton button) {
|
||||
synchronized (ui) {
|
||||
|
@ -49,6 +70,17 @@ public class MageUI {
|
|||
}
|
||||
}
|
||||
|
||||
public void addComponent(MageComponents name, Component component) {
|
||||
synchronized (ui) {
|
||||
ui.put(name, component);
|
||||
if (sync.containsKey(name)) {
|
||||
synchronized (sync.get(name)) {
|
||||
sync.get(name).notifyAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void doClick(MageComponents name) throws InterruptedException {
|
||||
doClick(name, 0);
|
||||
}
|
||||
|
|
|
@ -6,5 +6,5 @@ public interface ActionCallback {
|
|||
void mouseClicked(MouseEvent e, TransferData data);
|
||||
void mouseMoved(MouseEvent e, TransferData data);
|
||||
void mouseEntered(MouseEvent e, TransferData data);
|
||||
void mouseExited(MouseEvent e);
|
||||
void mouseExited(MouseEvent e, TransferData dat);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public class EmptyCallback implements ActionCallback {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
public void mouseExited(MouseEvent e, TransferData data) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -592,7 +592,10 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
|
|||
synchronized (this) {
|
||||
if (popupShowing) {
|
||||
popupShowing = false;
|
||||
callback.mouseExited(e);
|
||||
data.component = this;
|
||||
data.card = this.gameCard;
|
||||
data.popupText = popupText;
|
||||
callback.mouseExited(e, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue