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 panelY = panel == this.getMouseDragPanel() ? this.mouseDragStartY : panel.getCardY();
|
||||||
final int panelWidth = panel.getCardWidth();
|
final int panelWidth = panel.getCardWidth();
|
||||||
final int panelHeight = panel.getCardHeight();
|
final int panelHeight = panel.getCardHeight();
|
||||||
if ((x > panelX) && (x < (panelX + panelWidth))) {
|
if ((x > panelX) && (x < (panelX + panelWidth)) && (y > panelY) && (y < (panelY + panelHeight))) {
|
||||||
if ((y > panelY) && (y < (panelY + panelHeight))) {
|
if (!panel.isDisplayEnabled()) {
|
||||||
if (!panel.isDisplayEnabled()) {
|
return null;
|
||||||
return null;
|
} else {
|
||||||
}
|
|
||||||
return panel;
|
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 panelY = panel == this.getMouseDragPanel() ? this.mouseDragStartY : panel.getCardY();
|
||||||
final int panelWidth = panel.getCardWidth();
|
final int panelWidth = panel.getCardWidth();
|
||||||
final int panelHeight = panel.getCardHeight();
|
final int panelHeight = panel.getCardHeight();
|
||||||
if ((x > panelX) && (x < (panelX + panelWidth))) {
|
if ((x > panelX) && (x < (panelX + panelWidth)) && (y > panelY) && (y < (panelY + panelHeight))) {
|
||||||
if ((y > panelY) && (y < (panelY + panelHeight))) {
|
if (!panel.isDisplayEnabled()) {
|
||||||
if (!panel.isDisplayEnabled()) {
|
return null;
|
||||||
return null;
|
} else {
|
||||||
}
|
|
||||||
return panel;
|
return panel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -319,35 +319,31 @@ public class CardPanel extends JPanel implements CardContainer {
|
|||||||
// + White borders for Core sets Unlimited - 9th +
|
// + White borders for Core sets Unlimited - 9th +
|
||||||
final int cornerSize = Math.max(4, Math.round(this.cardWidth * CardPanel.ROUNDED_CORNER_SIZE));
|
final int cornerSize = Math.max(4, Math.round(this.cardWidth * CardPanel.ROUNDED_CORNER_SIZE));
|
||||||
|
|
||||||
if (this.getGameCard() != null) {
|
if (this.getGameCard() != null && (!this.getGameCard().getImageFilename().equals("none"))
|
||||||
if ((!this.getGameCard().getImageFilename().equals("none"))
|
&& (!this.getGameCard().getName().equals("Morph"))) {
|
||||||
&& (!this.getGameCard().getName().equals("Morph"))) {
|
if ((this.getGameCard().getCurSetCode().equals("2ED"))
|
||||||
if ((this.getGameCard().getCurSetCode().equals("2ED"))
|
|| (this.getGameCard().getCurSetCode().equals("3ED"))
|
||||||
|| (this.getGameCard().getCurSetCode().equals("3ED"))
|
|| (this.getGameCard().getCurSetCode().equals("4ED"))
|
||||||
|| (this.getGameCard().getCurSetCode().equals("4ED"))
|
|| (this.getGameCard().getCurSetCode().equals("5ED"))
|
||||||
|| (this.getGameCard().getCurSetCode().equals("5ED"))
|
|| (this.getGameCard().getCurSetCode().equals("6ED"))
|
||||||
|| (this.getGameCard().getCurSetCode().equals("6ED"))
|
|| (this.getGameCard().getCurSetCode().equals("7ED"))
|
||||||
|| (this.getGameCard().getCurSetCode().equals("7ED"))
|
|| (this.getGameCard().getCurSetCode().equals("8ED"))
|
||||||
|| (this.getGameCard().getCurSetCode().equals("8ED"))
|
|| (this.getGameCard().getCurSetCode().equals("9ED"))
|
||||||
|| (this.getGameCard().getCurSetCode().equals("9ED"))
|
|| (this.getGameCard().getCurSetCode().equals("CHR"))
|
||||||
|| (this.getGameCard().getCurSetCode().equals("CHR"))
|
|| (this.getGameCard().getCurSetCode().equals("S99"))
|
||||||
|| (this.getGameCard().getCurSetCode().equals("S99"))
|
|| (this.getGameCard().getCurSetCode().equals("PTK"))
|
||||||
|| (this.getGameCard().getCurSetCode().equals("PTK"))
|
|| (this.getGameCard().getCurSetCode().equals("S00"))) {
|
||||||
|| (this.getGameCard().getCurSetCode().equals("S00"))) {
|
if (!this.isSelected) {
|
||||||
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);
|
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 -
|
// - 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);
|
(this.cardYOffset + this.cardHeight) - (this.cardHeight / 8) - 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.getCard() != null) {
|
if (this.getCard() != null && this.getGameCard().getFoil() > 0) {
|
||||||
if (this.getGameCard().getFoil() > 0) {
|
final String fl = String.format("foil%02d", this.getCard().getFoil());
|
||||||
final String fl = String.format("foil%02d", this.getCard().getFoil());
|
final int z = Math.round(this.cardWidth * CardPanel.BLACK_BORDER_SIZE);
|
||||||
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),
|
||||||
ManaSymbols.draw(g, fl, this.cardXOffset + z, this.cardYOffset + z, this.cardWidth - (2 * z),
|
this.cardHeight - (2 * z));
|
||||||
this.cardHeight - (2 * z));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
*/
|
*/
|
||||||
package arcane.ui;
|
package arcane.ui;
|
||||||
|
|
||||||
import java.awt.Frame;
|
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
|
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
@@ -44,10 +43,8 @@ public class HandArea extends CardArea {
|
|||||||
*
|
*
|
||||||
* @param scrollPane
|
* @param scrollPane
|
||||||
* a {@link javax.swing.JScrollPane} object.
|
* 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);
|
super(scrollPane);
|
||||||
|
|
||||||
this.setDragEnabled(true);
|
this.setDragEnabled(true);
|
||||||
|
|||||||
@@ -234,6 +234,7 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: Write javadoc for this method.
|
* TODO: Write javadoc for this method.
|
||||||
|
*
|
||||||
* @param allLands
|
* @param allLands
|
||||||
* @param allTokens
|
* @param allTokens
|
||||||
*/
|
*/
|
||||||
@@ -329,8 +330,7 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
|
|||||||
if (!allowHeightOverflow && (rowWidth > this.playAreaWidth)) {
|
if (!allowHeightOverflow && (rowWidth > this.playAreaWidth)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!allowHeightOverflow && ((this.getRowsHeight(rows)
|
if (!allowHeightOverflow && ((this.getRowsHeight(rows) + sourceRow.getHeight()) > this.playAreaHeight)) {
|
||||||
+ sourceRow.getHeight()) > this.playAreaHeight)) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
rows.add(insertIndex == -1 ? rows.size() : insertIndex, currentRow);
|
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.
|
// Add the last row if it is not empty and it fits.
|
||||||
if (!currentRow.isEmpty()) {
|
if (!currentRow.isEmpty()) {
|
||||||
final int rowWidth = currentRow.getWidth();
|
final int rowWidth = currentRow.getWidth();
|
||||||
if (allowHeightOverflow || (rowWidth <= this.playAreaWidth)) {
|
if (allowHeightOverflow
|
||||||
if (allowHeightOverflow || ((this.getRowsHeight(rows)
|
|| (rowWidth <= this.playAreaWidth)
|
||||||
+ sourceRow.getHeight()) <= this.playAreaHeight)) {
|
&& (allowHeightOverflow || ((this.getRowsHeight(rows) + sourceRow.getHeight()) <= this.playAreaHeight))) {
|
||||||
rows.add(insertIndex == -1 ? rows.size() : insertIndex, currentRow);
|
rows.add(insertIndex == -1 ? rows.size() : insertIndex, currentRow);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Remove the wrapped stacks from the source row.
|
// Remove the wrapped stacks from the source row.
|
||||||
@@ -379,10 +378,9 @@ public class PlayArea extends CardPanelContainer implements CardPanelMouseListen
|
|||||||
if (rowWidth > this.playAreaWidth) {
|
if (rowWidth > this.playAreaWidth) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (stack.getHeight() > row.getHeight()) {
|
if (stack.getHeight() > row.getHeight()
|
||||||
if (((this.getRowsHeight(rows) - row.getHeight()) + stack.getHeight()) > this.playAreaHeight) {
|
&& (((this.getRowsHeight(rows) - row.getHeight()) + stack.getHeight()) > this.playAreaHeight)) {
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
row.add(sourceRow.remove(0));
|
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
|
// END, self hand
|
||||||
|
|
||||||
// self play
|
// self play
|
||||||
@@ -1359,7 +1359,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display {
|
|||||||
playerLibraryLabel.setFont(this.statFont);
|
playerLibraryLabel.setFont(this.statFont);
|
||||||
|
|
||||||
final JLabel playerHandLabel = new JLabel(ForgeProps.getLocalized(HumanHand.TITLE), SwingConstants.TRAILING);
|
final JLabel playerHandLabel = new JLabel(ForgeProps.getLocalized(HumanHand.TITLE), SwingConstants.TRAILING);
|
||||||
playerHandLabel.setFont(this.statFont);
|
playerHandLabel.setFont(this.statFont);
|
||||||
|
|
||||||
// JLabel playerGraveLabel = new JLabel("Grave:",
|
// JLabel playerGraveLabel = new JLabel("Grave:",
|
||||||
// SwingConstants.TRAILING);
|
// SwingConstants.TRAILING);
|
||||||
@@ -1367,13 +1367,13 @@ public class GuiDisplay extends JFrame implements CardContainer, Display {
|
|||||||
playerGraveButton.setText((String) this.humanGraveyardAction.getValue("buttonText"));
|
playerGraveButton.setText((String) this.humanGraveyardAction.getValue("buttonText"));
|
||||||
playerGraveButton.setMargin(new Insets(0, 0, 0, 0));
|
playerGraveButton.setMargin(new Insets(0, 0, 0, 0));
|
||||||
playerGraveButton.setHorizontalAlignment(SwingConstants.TRAILING);
|
playerGraveButton.setHorizontalAlignment(SwingConstants.TRAILING);
|
||||||
playerGraveButton.setFont(this.statFont);
|
playerGraveButton.setFont(this.statFont);
|
||||||
|
|
||||||
final JButton playerFlashBackButton = new JButton(this.humanFlashbackAction);
|
final JButton playerFlashBackButton = new JButton(this.humanFlashbackAction);
|
||||||
playerFlashBackButton.setText((String) this.humanFlashbackAction.getValue("buttonText"));
|
playerFlashBackButton.setText((String) this.humanFlashbackAction.getValue("buttonText"));
|
||||||
playerFlashBackButton.setMargin(new Insets(0, 0, 0, 0));
|
playerFlashBackButton.setMargin(new Insets(0, 0, 0, 0));
|
||||||
playerFlashBackButton.setHorizontalAlignment(SwingConstants.TRAILING);
|
playerFlashBackButton.setHorizontalAlignment(SwingConstants.TRAILING);
|
||||||
playerFlashBackButton.setFont(this.statFont);
|
playerFlashBackButton.setFont(this.statFont);
|
||||||
|
|
||||||
final JPanel gravePanel = new JPanel(new BorderLayout());
|
final JPanel gravePanel = new JPanel(new BorderLayout());
|
||||||
gravePanel.add(playerGraveButton, BorderLayout.EAST);
|
gravePanel.add(playerGraveButton, BorderLayout.EAST);
|
||||||
@@ -1439,7 +1439,7 @@ public class GuiDisplay extends JFrame implements CardContainer, Display {
|
|||||||
pane.add(new ExternalPanel(playScroll), "humanPlay");
|
pane.add(new ExternalPanel(playScroll), "humanPlay");
|
||||||
|
|
||||||
final JScrollPane handScroll = new JScrollPane();
|
final JScrollPane handScroll = new JScrollPane();
|
||||||
this.playerHandPanel = new HandArea(handScroll, this);
|
this.playerHandPanel = new HandArea(handScroll);
|
||||||
this.playerHandPanel.setBorder(BorderFactory.createEtchedBorder());
|
this.playerHandPanel.setBorder(BorderFactory.createEtchedBorder());
|
||||||
handScroll.setViewportView(this.playerHandPanel);
|
handScroll.setViewportView(this.playerHandPanel);
|
||||||
pane.add(new ExternalPanel(handScroll), "humanHand");
|
pane.add(new ExternalPanel(handScroll), "humanHand");
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class ViewHand extends FRoundedPanel {
|
|||||||
*/
|
*/
|
||||||
public ViewHand(ViewTopLevel v0) {
|
public ViewHand(ViewTopLevel v0) {
|
||||||
final JScrollPane scroller = new JScrollPane();
|
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"));
|
ViewHand.this.setBackground(AllZone.getSkin().getColor("theme"));
|
||||||
topLevel = v0;
|
topLevel = v0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user