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 (!panel.isDisplayEnabled()) {
|
||||
return null;
|
||||
}
|
||||
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 (!panel.isDisplayEnabled()) {
|
||||
return null;
|
||||
}
|
||||
if ((x > panelX) && (x < (panelX + panelWidth)) && (y > panelY) && (y < (panelY + panelHeight))) {
|
||||
if (!panel.isDisplayEnabled()) {
|
||||
return null;
|
||||
} else {
|
||||
return panel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -319,35 +319,31 @@ 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"))
|
||||
&& (!this.getGameCard().getName().equals("Morph"))) {
|
||||
if ((this.getGameCard().getCurSetCode().equals("2ED"))
|
||||
|| (this.getGameCard().getCurSetCode().equals("3ED"))
|
||||
|| (this.getGameCard().getCurSetCode().equals("4ED"))
|
||||
|| (this.getGameCard().getCurSetCode().equals("5ED"))
|
||||
|| (this.getGameCard().getCurSetCode().equals("6ED"))
|
||||
|| (this.getGameCard().getCurSetCode().equals("7ED"))
|
||||
|| (this.getGameCard().getCurSetCode().equals("8ED"))
|
||||
|| (this.getGameCard().getCurSetCode().equals("9ED"))
|
||||
|| (this.getGameCard().getCurSetCode().equals("CHR"))
|
||||
|| (this.getGameCard().getCurSetCode().equals("S99"))
|
||||
|| (this.getGameCard().getCurSetCode().equals("PTK"))
|
||||
|| (this.getGameCard().getCurSetCode().equals("S00"))) {
|
||||
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++) {
|
||||
g2d.drawRoundRect(this.cardXOffset - i, (this.cardYOffset - i) + offset,
|
||||
(this.cardWidth + (i * 2)) - 1, (this.cardHeight + (i * 2)) - 1, cornerSize,
|
||||
cornerSize);
|
||||
}
|
||||
}
|
||||
g2d.setColor(Color.white);
|
||||
} else {
|
||||
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"))
|
||||
|| (this.getGameCard().getCurSetCode().equals("4ED"))
|
||||
|| (this.getGameCard().getCurSetCode().equals("5ED"))
|
||||
|| (this.getGameCard().getCurSetCode().equals("6ED"))
|
||||
|| (this.getGameCard().getCurSetCode().equals("7ED"))
|
||||
|| (this.getGameCard().getCurSetCode().equals("8ED"))
|
||||
|| (this.getGameCard().getCurSetCode().equals("9ED"))
|
||||
|| (this.getGameCard().getCurSetCode().equals("CHR"))
|
||||
|| (this.getGameCard().getCurSetCode().equals("S99"))
|
||||
|| (this.getGameCard().getCurSetCode().equals("PTK"))
|
||||
|| (this.getGameCard().getCurSetCode().equals("S00"))) {
|
||||
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++) {
|
||||
g2d.drawRoundRect(this.cardXOffset - i, (this.cardYOffset - i) + offset,
|
||||
(this.cardWidth + (i * 2)) - 1, (this.cardHeight + (i * 2)) - 1, cornerSize, cornerSize);
|
||||
}
|
||||
}
|
||||
g2d.setColor(Color.white);
|
||||
} else {
|
||||
g2d.setColor(Color.black);
|
||||
}
|
||||
}
|
||||
// - White borders for Core sets Unlimited - 9th -
|
||||
@@ -415,13 +411,11 @@ public class CardPanel extends JPanel implements CardContainer {
|
||||
(this.cardYOffset + this.cardHeight) - (this.cardHeight / 8) - 16);
|
||||
}
|
||||
|
||||
if (this.getCard() != null) {
|
||||
if (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));
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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,11 +341,10 @@ 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)) {
|
||||
rows.add(insertIndex == -1 ? rows.size() : insertIndex, currentRow);
|
||||
}
|
||||
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.
|
||||
@@ -379,10 +378,9 @@ 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) {
|
||||
break;
|
||||
}
|
||||
if (stack.getHeight() > row.getHeight()
|
||||
&& (((this.getRowsHeight(rows) - row.getHeight()) + stack.getHeight()) > this.playAreaHeight)) {
|
||||
break;
|
||||
}
|
||||
row.add(sourceRow.remove(0));
|
||||
}
|
||||
|
||||
@@ -896,7 +896,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display {
|
||||
}
|
||||
}
|
||||
});
|
||||
//AllZone.getHumanPlayer().getZone(Zone.Hand).updateObservers();
|
||||
// AllZone.getHumanPlayer().getZone(Zone.Hand).updateObservers();
|
||||
// END, self hand
|
||||
|
||||
// self play
|
||||
@@ -1359,7 +1359,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display {
|
||||
playerLibraryLabel.setFont(this.statFont);
|
||||
|
||||
final JLabel playerHandLabel = new JLabel(ForgeProps.getLocalized(HumanHand.TITLE), SwingConstants.TRAILING);
|
||||
playerHandLabel.setFont(this.statFont);
|
||||
playerHandLabel.setFont(this.statFont);
|
||||
|
||||
// JLabel playerGraveLabel = new JLabel("Grave:",
|
||||
// SwingConstants.TRAILING);
|
||||
@@ -1367,13 +1367,13 @@ public class GuiDisplay extends JFrame implements CardContainer, Display {
|
||||
playerGraveButton.setText((String) this.humanGraveyardAction.getValue("buttonText"));
|
||||
playerGraveButton.setMargin(new Insets(0, 0, 0, 0));
|
||||
playerGraveButton.setHorizontalAlignment(SwingConstants.TRAILING);
|
||||
playerGraveButton.setFont(this.statFont);
|
||||
playerGraveButton.setFont(this.statFont);
|
||||
|
||||
final JButton playerFlashBackButton = new JButton(this.humanFlashbackAction);
|
||||
playerFlashBackButton.setText((String) this.humanFlashbackAction.getValue("buttonText"));
|
||||
playerFlashBackButton.setMargin(new Insets(0, 0, 0, 0));
|
||||
playerFlashBackButton.setHorizontalAlignment(SwingConstants.TRAILING);
|
||||
playerFlashBackButton.setFont(this.statFont);
|
||||
playerFlashBackButton.setFont(this.statFont);
|
||||
|
||||
final JPanel gravePanel = new JPanel(new BorderLayout());
|
||||
gravePanel.add(playerGraveButton, BorderLayout.EAST);
|
||||
@@ -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