mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
PMD fixes
This commit is contained in:
@@ -105,11 +105,10 @@ public class CardArea extends CardPanelContainer implements CardPanelMouseListen
|
||||
final int panelY = panel == this.getMouseDragPanel() ? this.mouseDragStartY : panel.getCardY();
|
||||
final int panelWidth = panel.getCardWidth();
|
||||
final int panelHeight = panel.getCardHeight();
|
||||
if ((x > panelX) && (x < (panelX + panelWidth))) {
|
||||
if ((y > panelY) && (y < (panelY + panelHeight))) {
|
||||
if ((x > panelX) && (x < (panelX + panelWidth)) && (y > panelY) && (y < (panelY + panelHeight))) {
|
||||
if (!panel.isDisplayEnabled()) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return panel;
|
||||
}
|
||||
}
|
||||
@@ -121,11 +120,10 @@ public class CardArea extends CardPanelContainer implements CardPanelMouseListen
|
||||
final int panelY = panel == this.getMouseDragPanel() ? this.mouseDragStartY : panel.getCardY();
|
||||
final int panelWidth = panel.getCardWidth();
|
||||
final int panelHeight = panel.getCardHeight();
|
||||
if ((x > panelX) && (x < (panelX + panelWidth))) {
|
||||
if ((y > panelY) && (y < (panelY + panelHeight))) {
|
||||
if ((x > panelX) && (x < (panelX + panelWidth)) && (y > panelY) && (y < (panelY + panelHeight))) {
|
||||
if (!panel.isDisplayEnabled()) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return panel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -319,8 +319,7 @@ public class CardPanel extends JPanel implements CardContainer {
|
||||
// + White borders for Core sets Unlimited - 9th +
|
||||
final int cornerSize = Math.max(4, Math.round(this.cardWidth * CardPanel.ROUNDED_CORNER_SIZE));
|
||||
|
||||
if (this.getGameCard() != null) {
|
||||
if ((!this.getGameCard().getImageFilename().equals("none"))
|
||||
if (this.getGameCard() != null && (!this.getGameCard().getImageFilename().equals("none"))
|
||||
&& (!this.getGameCard().getName().equals("Morph"))) {
|
||||
if ((this.getGameCard().getCurSetCode().equals("2ED"))
|
||||
|| (this.getGameCard().getCurSetCode().equals("3ED"))
|
||||
@@ -337,11 +336,9 @@ public class CardPanel extends JPanel implements CardContainer {
|
||||
if (!this.isSelected) {
|
||||
g2d.setColor(Color.black);
|
||||
final int offset = this.isTapped() ? 1 : 0;
|
||||
for (int i = 1, n = Math.max(1, Math.round(this.cardWidth
|
||||
* CardPanel.SELECTED_BORDER_SIZE)); i <= n; i++) {
|
||||
for (int i = 1, n = Math.max(1, Math.round(this.cardWidth * CardPanel.SELECTED_BORDER_SIZE)); i <= n; i++) {
|
||||
g2d.drawRoundRect(this.cardXOffset - i, (this.cardYOffset - i) + offset,
|
||||
(this.cardWidth + (i * 2)) - 1, (this.cardHeight + (i * 2)) - 1, cornerSize,
|
||||
cornerSize);
|
||||
(this.cardWidth + (i * 2)) - 1, (this.cardHeight + (i * 2)) - 1, cornerSize, cornerSize);
|
||||
}
|
||||
}
|
||||
g2d.setColor(Color.white);
|
||||
@@ -349,7 +346,6 @@ public class CardPanel extends JPanel implements CardContainer {
|
||||
g2d.setColor(Color.black);
|
||||
}
|
||||
}
|
||||
}
|
||||
// - White borders for Core sets Unlimited - 9th -
|
||||
|
||||
g2d.fillRoundRect(this.cardXOffset, this.cardYOffset, this.cardWidth, this.cardHeight, cornerSize, cornerSize);
|
||||
@@ -415,15 +411,13 @@ public class CardPanel extends JPanel implements CardContainer {
|
||||
(this.cardYOffset + this.cardHeight) - (this.cardHeight / 8) - 16);
|
||||
}
|
||||
|
||||
if (this.getCard() != null) {
|
||||
if (this.getGameCard().getFoil() > 0) {
|
||||
if (this.getCard() != null && this.getGameCard().getFoil() > 0) {
|
||||
final String fl = String.format("foil%02d", this.getCard().getFoil());
|
||||
final int z = Math.round(this.cardWidth * CardPanel.BLACK_BORDER_SIZE);
|
||||
ManaSymbols.draw(g, fl, this.cardXOffset + z, this.cardYOffset + z, this.cardWidth - (2 * z),
|
||||
this.cardHeight - (2 * z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
package arcane.ui;
|
||||
|
||||
import java.awt.Frame;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
import javax.swing.JScrollPane;
|
||||
@@ -44,10 +43,8 @@ public class HandArea extends CardArea {
|
||||
*
|
||||
* @param scrollPane
|
||||
* a {@link javax.swing.JScrollPane} object.
|
||||
* @param frame
|
||||
* a {@link java.awt.Frame} object.
|
||||
*/
|
||||
public HandArea(final JScrollPane scrollPane, final Frame frame) {
|
||||
public HandArea(final JScrollPane scrollPane) {
|
||||
super(scrollPane);
|
||||
|
||||
this.setDragEnabled(true);
|
||||
|
||||
@@ -234,6 +234,7 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
|
||||
|
||||
/**
|
||||
* TODO: Write javadoc for this method.
|
||||
*
|
||||
* @param allLands
|
||||
* @param allTokens
|
||||
*/
|
||||
@@ -329,8 +330,7 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
|
||||
if (!allowHeightOverflow && (rowWidth > this.playAreaWidth)) {
|
||||
break;
|
||||
}
|
||||
if (!allowHeightOverflow && ((this.getRowsHeight(rows)
|
||||
+ sourceRow.getHeight()) > this.playAreaHeight)) {
|
||||
if (!allowHeightOverflow && ((this.getRowsHeight(rows) + sourceRow.getHeight()) > this.playAreaHeight)) {
|
||||
break;
|
||||
}
|
||||
rows.add(insertIndex == -1 ? rows.size() : insertIndex, currentRow);
|
||||
@@ -341,13 +341,12 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
|
||||
// Add the last row if it is not empty and it fits.
|
||||
if (!currentRow.isEmpty()) {
|
||||
final int rowWidth = currentRow.getWidth();
|
||||
if (allowHeightOverflow || (rowWidth <= this.playAreaWidth)) {
|
||||
if (allowHeightOverflow || ((this.getRowsHeight(rows)
|
||||
+ sourceRow.getHeight()) <= this.playAreaHeight)) {
|
||||
if (allowHeightOverflow
|
||||
|| (rowWidth <= this.playAreaWidth)
|
||||
&& (allowHeightOverflow || ((this.getRowsHeight(rows) + sourceRow.getHeight()) <= this.playAreaHeight))) {
|
||||
rows.add(insertIndex == -1 ? rows.size() : insertIndex, currentRow);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Remove the wrapped stacks from the source row.
|
||||
for (final Row row : rows) {
|
||||
for (final Stack stack : row) {
|
||||
@@ -379,11 +378,10 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
|
||||
if (rowWidth > this.playAreaWidth) {
|
||||
break;
|
||||
}
|
||||
if (stack.getHeight() > row.getHeight()) {
|
||||
if (((this.getRowsHeight(rows) - row.getHeight()) + stack.getHeight()) > this.playAreaHeight) {
|
||||
if (stack.getHeight() > row.getHeight()
|
||||
&& (((this.getRowsHeight(rows) - row.getHeight()) + stack.getHeight()) > this.playAreaHeight)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
row.add(sourceRow.remove(0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1439,7 +1439,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display {
|
||||
pane.add(new ExternalPanel(playScroll), "humanPlay");
|
||||
|
||||
final JScrollPane handScroll = new JScrollPane();
|
||||
this.playerHandPanel = new HandArea(handScroll, this);
|
||||
this.playerHandPanel = new HandArea(handScroll);
|
||||
this.playerHandPanel.setBorder(BorderFactory.createEtchedBorder());
|
||||
handScroll.setViewportView(this.playerHandPanel);
|
||||
pane.add(new ExternalPanel(handScroll), "humanHand");
|
||||
|
||||
@@ -42,7 +42,7 @@ public class ViewHand extends FRoundedPanel {
|
||||
*/
|
||||
public ViewHand(ViewTopLevel v0) {
|
||||
final JScrollPane scroller = new JScrollPane();
|
||||
ViewHand.this.hand = new HandArea(scroller, null);
|
||||
ViewHand.this.hand = new HandArea(scroller);
|
||||
ViewHand.this.setBackground(AllZone.getSkin().getColor("theme"));
|
||||
topLevel = v0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user