mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 12:02:01 -08:00
Chat panel is one touch resizeable. Minor fix for delayed popup. Added sorting layout on BattlefieldPanel resize.
This commit is contained in:
parent
fa2a2888e1
commit
937ddf79a2
3 changed files with 32 additions and 12 deletions
|
|
@ -37,6 +37,7 @@ package mage.client.game;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
|
import java.awt.event.ComponentAdapter;
|
||||||
import java.awt.event.ComponentEvent;
|
import java.awt.event.ComponentEvent;
|
||||||
import java.awt.event.ComponentListener;
|
import java.awt.event.ComponentListener;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
@ -68,12 +69,20 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane implements Compon
|
||||||
private Map<String, JComponent> ui = new HashMap<String, JComponent>();
|
private Map<String, JComponent> ui = new HashMap<String, JComponent>();
|
||||||
|
|
||||||
protected static DefaultActionCallback defaultCallback = DefaultActionCallback.getInstance();
|
protected static DefaultActionCallback defaultCallback = DefaultActionCallback.getInstance();
|
||||||
|
protected static Map<UUID, PermanentView> battlefield;
|
||||||
|
|
||||||
/** Creates new form BattlefieldPanel */
|
/** Creates new form BattlefieldPanel */
|
||||||
public BattlefieldPanel(JScrollPane jScrollPane) {
|
public BattlefieldPanel(JScrollPane jScrollPane) {
|
||||||
ui.put("jScrollPane", jScrollPane);
|
ui.put("jScrollPane", jScrollPane);
|
||||||
ui.put("battlefieldPanel", this);
|
ui.put("battlefieldPanel", this);
|
||||||
initComponents();
|
initComponents();
|
||||||
|
|
||||||
|
addComponentListener(new ComponentAdapter(){
|
||||||
|
@Override
|
||||||
|
public void componentResized(ComponentEvent e) {
|
||||||
|
sortLayout();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(UUID gameId, BigCard bigCard) {
|
public void init(UUID gameId, BigCard bigCard) {
|
||||||
|
|
@ -103,18 +112,24 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane implements Compon
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
Plugins.getInstance().sortPermanents(ui, permanents.values());
|
BattlefieldPanel.battlefield = battlefield;
|
||||||
|
sortLayout();
|
||||||
for (PermanentView permanent: battlefield.values()) {
|
|
||||||
if (permanent.getAttachments() != null) {
|
|
||||||
groupAttachments(permanent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
invalidate();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void sortLayout() {
|
||||||
|
Plugins.getInstance().sortPermanents(ui, permanents.values());
|
||||||
|
if (battlefield == null) {return;}
|
||||||
|
|
||||||
|
for (PermanentView permanent: battlefield.values()) {
|
||||||
|
if (permanent.getAttachments() != null) {
|
||||||
|
groupAttachments(permanent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
private void addPermanent(PermanentView permanent) {
|
private void addPermanent(PermanentView permanent) {
|
||||||
MagePermanent perm = Plugins.getInstance().getMagePermanent(permanent, bigCard, Config.dimensions, gameId);
|
MagePermanent perm = Plugins.getInstance().getMagePermanent(permanent, bigCard, Config.dimensions, gameId);
|
||||||
perm.addComponentListener(this);
|
perm.addComponentListener(this);
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@
|
||||||
package mage.client.game;
|
package mage.client.game;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Dimension;
|
||||||
import java.awt.GridBagConstraints;
|
import java.awt.GridBagConstraints;
|
||||||
import java.awt.event.ComponentAdapter;
|
import java.awt.event.ComponentAdapter;
|
||||||
import java.awt.event.ComponentEvent;
|
import java.awt.event.ComponentEvent;
|
||||||
|
|
@ -410,6 +411,7 @@ public class GamePanel extends javax.swing.JPanel {
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||||
|
// </editor-fold>//GEN-END:initComponents
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
|
|
||||||
abilityPicker = new mage.client.game.AbilityPicker();
|
abilityPicker = new mage.client.game.AbilityPicker();
|
||||||
|
|
@ -440,8 +442,9 @@ public class GamePanel extends javax.swing.JPanel {
|
||||||
chatPanel = new mage.client.chat.ChatPanel();
|
chatPanel = new mage.client.chat.ChatPanel();
|
||||||
|
|
||||||
jSplitPane1.setBorder(null);
|
jSplitPane1.setBorder(null);
|
||||||
jSplitPane1.setDividerSize(3);
|
jSplitPane1.setDividerSize(7);
|
||||||
jSplitPane1.setResizeWeight(1.0);
|
jSplitPane1.setResizeWeight(1.0);
|
||||||
|
jSplitPane1.setOneTouchExpandable(true);
|
||||||
jSplitPane1.setMinimumSize(new java.awt.Dimension(26, 48));
|
jSplitPane1.setMinimumSize(new java.awt.Dimension(26, 48));
|
||||||
|
|
||||||
pnlGameInfo.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
pnlGameInfo.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||||
|
|
@ -636,6 +639,7 @@ public class GamePanel extends javax.swing.JPanel {
|
||||||
.addComponent(pnlGameInfo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addComponent(pnlGameInfo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
jPanel3.setMinimumSize(new Dimension(1024, 768));
|
||||||
jSplitPane1.setLeftComponent(jPanel3);
|
jSplitPane1.setLeftComponent(jPanel3);
|
||||||
|
|
||||||
chatPanel.setMinimumSize(new java.awt.Dimension(100, 48));
|
chatPanel.setMinimumSize(new java.awt.Dimension(100, 48));
|
||||||
|
|
@ -651,7 +655,7 @@ public class GamePanel extends javax.swing.JPanel {
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 798, Short.MAX_VALUE)
|
.addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 798, Short.MAX_VALUE)
|
||||||
);
|
);
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
}
|
||||||
|
|
||||||
private void btnConcedeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConcedeActionPerformed
|
private void btnConcedeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConcedeActionPerformed
|
||||||
if (modalQuestion("Are you sure you want to concede?", "Confirm concede") == JOptionPane.YES_OPTION) {
|
if (modalQuestion("Are you sure you want to concede?", "Confirm concede") == JOptionPane.YES_OPTION) {
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,7 @@ public class MageActionCallback implements ActionCallback {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseExited(MouseEvent e) {
|
public void mouseExited(MouseEvent e) {
|
||||||
|
this.popupCard = null;
|
||||||
if (popup != null) {
|
if (popup != null) {
|
||||||
popup.hide();
|
popup.hide();
|
||||||
ArrowBuilder.removeAllArrows();
|
ArrowBuilder.removeAllArrows();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue