mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 20:41:58 -08:00
* Animate Dead (finished). Only Battlefield layout can't handle a attached card in graveyard yet.
This commit is contained in:
parent
813841eccd
commit
220331dcd9
4 changed files with 70 additions and 47 deletions
|
|
@ -57,7 +57,7 @@ public class RelativeLayout implements LayoutManager2, java.io.Serializable {
|
|||
private static final int MINIMUM = 0;
|
||||
private static final int PREFERRED = 1;
|
||||
|
||||
private Map<Component, Float> constraints = new HashMap<Component, Float>();
|
||||
private final Map<Component, Float> constraints = new HashMap<>();
|
||||
|
||||
/**
|
||||
* The axis of the Components within the Container.
|
||||
|
|
@ -222,6 +222,7 @@ public class RelativeLayout implements LayoutManager2, java.io.Serializable {
|
|||
/**
|
||||
* Change size of relative components to fill the space available For X-AXIS aligned components the height will be
|
||||
* filled. For Y-AXIS aligned components the width will be filled.
|
||||
* @param fill
|
||||
*/
|
||||
public void setFill(boolean fill) {
|
||||
this.fill = fill;
|
||||
|
|
@ -238,6 +239,7 @@ public class RelativeLayout implements LayoutManager2, java.io.Serializable {
|
|||
|
||||
/**
|
||||
* Specify the number of pixels by which the fill size is decreased when setFill(true) has been specified.
|
||||
* @param fillGap
|
||||
*/
|
||||
public void setFillGap(int fillGap) {
|
||||
this.fillGap = fillGap;
|
||||
|
|
@ -258,6 +260,7 @@ public class RelativeLayout implements LayoutManager2, java.io.Serializable {
|
|||
* DO_NOTHING FIRST - extra pixels added to the first relative component LAST - extra pixels added to the last
|
||||
* relative component LARGEST (default) - extra pixels added to the larger relative component EQUAL - a single pixel
|
||||
* is added to each relative component (until pixels are used up)
|
||||
* @param roundingPolicy
|
||||
*/
|
||||
public void setRoundingPolicy(int roundingPolicy) {
|
||||
this.roundingPolicy = roundingPolicy;
|
||||
|
|
@ -275,6 +278,8 @@ public class RelativeLayout implements LayoutManager2, java.io.Serializable {
|
|||
|
||||
/**
|
||||
* Not supported
|
||||
* @param name
|
||||
* @param component
|
||||
*/
|
||||
@Override
|
||||
public void addLayoutComponent(String name, Component component) {
|
||||
|
|
@ -310,7 +315,7 @@ public class RelativeLayout implements LayoutManager2, java.io.Serializable {
|
|||
* of a column layout is the largest preferred height of each row in the container, plus the vertical padding times
|
||||
* the number of rows minus one, plus the top and bottom insets of the target container.
|
||||
*
|
||||
* @param target the container in which to do the layout
|
||||
* @param parent the container in which to do the layout
|
||||
* @return the preferred dimensions to lay out the subcomponents of the specified container
|
||||
* @see java.awt.RelativeLayout#minimumLayoutSize
|
||||
* @see java.awt.Container#getPreferredSize()
|
||||
|
|
@ -329,7 +334,7 @@ public class RelativeLayout implements LayoutManager2, java.io.Serializable {
|
|||
* layout is the largest minimum height of each row in the container, plus the vertical padding times the number of
|
||||
* rows minus one, plus the top and bottom insets of the target container.
|
||||
*
|
||||
* @param target the container in which to do the layout
|
||||
* @param parent the container in which to do the layout
|
||||
* @return the minimum dimensions needed to lay out the subcomponents of the specified container
|
||||
* @see java.awt.RelativeLayout#preferredLayoutSize
|
||||
* @see java.awt.Container#doLayout
|
||||
|
|
@ -349,7 +354,7 @@ public class RelativeLayout implements LayoutManager2, java.io.Serializable {
|
|||
* the layout. The container's free space equals the container's size minus any insets and any specified horizontal
|
||||
* or vertical gap. All components in a grid layout are given the same size.
|
||||
*
|
||||
* @param target the container in which to do the layout
|
||||
* @param parent the container in which to do the layout
|
||||
* @see java.awt.Container
|
||||
* @see java.awt.Container#doLayout
|
||||
*/
|
||||
|
|
@ -581,7 +586,7 @@ public class RelativeLayout implements LayoutManager2, java.io.Serializable {
|
|||
Float constraint = constraints.get(component);
|
||||
|
||||
if (constraint != null) {
|
||||
int space = (int) (spaceAvailable * constraint.floatValue() / relativeTotal);
|
||||
int space = (int) (spaceAvailable * constraint / relativeTotal);
|
||||
relativeSpace[i] = space;
|
||||
spaceUsed += space;
|
||||
}
|
||||
|
|
@ -750,6 +755,8 @@ public class RelativeLayout implements LayoutManager2, java.io.Serializable {
|
|||
|
||||
/**
|
||||
* There is no maximum.
|
||||
* @param target
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Dimension maximumLayoutSize(Container target) {
|
||||
|
|
@ -758,6 +765,8 @@ public class RelativeLayout implements LayoutManager2, java.io.Serializable {
|
|||
|
||||
/**
|
||||
* Returns the alignment along the x axis. Use center alignment.
|
||||
* @param parent
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public float getLayoutAlignmentX(Container parent) {
|
||||
|
|
@ -766,6 +775,8 @@ public class RelativeLayout implements LayoutManager2, java.io.Serializable {
|
|||
|
||||
/**
|
||||
* Returns the alignment along the y axis. Use center alignment.
|
||||
* @param parent
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public float getLayoutAlignmentY(Container parent) {
|
||||
|
|
@ -774,6 +785,7 @@ public class RelativeLayout implements LayoutManager2, java.io.Serializable {
|
|||
|
||||
/**
|
||||
* Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.
|
||||
* @param target
|
||||
*/
|
||||
@Override
|
||||
public void invalidateLayout(Container target) {
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ import mage.client.plugins.impl.Plugins;
|
|||
import mage.client.util.Config;
|
||||
import mage.client.util.audio.AudioManager;
|
||||
import mage.client.util.layout.CardLayoutStrategy;
|
||||
import mage.client.util.layout.impl.OldCardLayoutStrategy;
|
||||
import mage.constants.CardType;
|
||||
import mage.utils.CardUtil;
|
||||
import mage.view.CounterView;
|
||||
|
|
@ -56,6 +55,7 @@ import java.awt.event.ComponentEvent;
|
|||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import mage.client.util.layout.impl.OldCardLayoutStrategy;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -75,7 +75,7 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
|||
private JScrollPane jScrollPane;
|
||||
private int width;
|
||||
|
||||
private CardLayoutStrategy layoutStrategy = new OldCardLayoutStrategy();
|
||||
private final CardLayoutStrategy layoutStrategy = new OldCardLayoutStrategy();
|
||||
|
||||
//private static int iCounter = 0;
|
||||
|
||||
|
|
@ -137,7 +137,7 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
|||
if (s1 != s2) {
|
||||
changed = true;
|
||||
} else if (s1 > 0) {
|
||||
Set<UUID> attachmentIds = new HashSet<UUID>();
|
||||
Set<UUID> attachmentIds = new HashSet<>();
|
||||
attachmentIds.addAll(permanent.getAttachments());
|
||||
for (MagePermanent magePermanent : oldMagePermanent.getLinks()) {
|
||||
if (!attachmentIds.contains(magePermanent.getOriginalPermanent().getId())) {
|
||||
|
|
@ -164,7 +164,7 @@ public class BattlefieldPanel extends javax.swing.JLayeredPane {
|
|||
List<CounterView> counters2 = permanent.getCounters();
|
||||
if (counters1 == null && counters2 != null || counters1 != null && counters2 == null) {
|
||||
changed = true;
|
||||
} else if (counters1 != null && counters1.size() != counters2.size()) {
|
||||
} else if (counters1 != null && counters2 != null && counters1.size() != counters2.size()) {
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue