minor changes (removed unused imports, added @Override ...)

This commit is contained in:
North 2011-09-24 22:37:53 +03:00
parent e72da7f4ed
commit 27c8514d64
6 changed files with 48 additions and 31 deletions

View file

@ -27,16 +27,12 @@
*/
package mage.client.deckeditor.collection.viewer;
import mage.client.MagePane;
import mage.client.plugins.impl.Plugins;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.Component;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JComponent;
import mage.client.MagePane;
import mage.client.plugins.impl.Plugins;
/**
* Collection viewer pane.

View file

@ -27,19 +27,21 @@
*/
package mage.client.deckeditor.collection.viewer;
import java.awt.Color;
import java.awt.Component;
import java.awt.GridBagLayout;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import mage.client.cards.BigCard;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
/**
* Pane with big card and mage book.
*
* @author nantuko
*/
public class CollectionViewerPanel extends JPanel {
public final class CollectionViewerPanel extends JPanel {
public CollectionViewerPanel() {
initComponents();
}
@ -77,6 +79,7 @@ public class CollectionViewerPanel extends JPanel {
btnExit.setText("Exit");
btnExit.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnExitActionPerformed(evt);
}
@ -93,7 +96,7 @@ public class CollectionViewerPanel extends JPanel {
c.setVisible(false);
}
private class MageBookContainer extends JPanel {
private final class MageBookContainer extends JPanel {
public MageBookContainer() {
super();
initComponents();

View file

@ -82,6 +82,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
private int recentSortedColumn;
private boolean recentAscending;
@Override
public void loadCards(CardsView showCards, SortBy sortBy, boolean piles, BigCard bigCard, UUID gameId) {
this.bigCard = bigCard;
this.gameId = gameId;
@ -162,18 +163,22 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
cards.clear();
}
@Override
public int getRowCount() {
return view.size();
}
@Override
public int getColumnCount() {
return column.length;
}
@Override
public String getColumnName(int n) {
return column[n];
}
@Override
public Object getValueAt(int row, int column) {
return getColumn(view.get(row), column);
}
@ -237,6 +242,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
}
}
@Override
public void drawCards(SortBy sortBy, boolean piles) {
fireTableDataChanged();
}
@ -251,10 +257,12 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
}
}
@Override
public void addCardEventListener(Listener<Event> listener) {
cardEventSource.addListener(listener);
}
@Override
public void clearCardEventListeners() {
cardEventSource.clearListeners();
}
@ -273,9 +281,11 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
// updates card detail, listens to any key strokes
table.addKeyListener(new KeyListener() {
@Override
public void keyPressed(KeyEvent ev) {}
@Override
public void keyTyped(KeyEvent ev) {}
@Override
public void keyReleased(KeyEvent ev) {
int row = table.getSelectedRow();
if (row != -1) {
@ -286,6 +296,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
// updates card detail, listens to any mouse clicks
table.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
int row = table.getSelectedRow();
if (row != -1) {
@ -296,6 +307,7 @@ public class TableModel extends AbstractTableModel implements ICardGrid {
// sorts
MouseListener mouse = new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
TableColumnModel columnModel = table.getColumnModel();
int viewColumn = columnModel.getColumnIndexAtX(e.getX());

View file

@ -1,10 +1,6 @@
package mage.client.util.gui;
import java.awt.BorderLayout;
import java.awt.Color;
import javax.swing.BorderFactory;
import javax.swing.JInternalFrame;
import javax.swing.JPanel;
/**
@ -62,7 +58,6 @@ public class ArrowBuilder {
arrow.setColor(color);
arrow.setArrowLocation(startX, startY, endX, endY);
arrow.setBounds(0, 0, Math.max(startX, endX) + 30, Math.max(startY, endY) + 30); // 30 is offset for arrow heads (being cut otherwise)
//System.out.println(" Adding arrow (startX=" + startX + ", startY=" + startY +", endX=" + endX + ", endY=" + endY + ")");
p.add(arrow);
p.revalidate();
p.repaint();

View file

@ -40,21 +40,17 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
static public final double FLIPPED_ANGLE = Math.PI;
static public final float ASPECT_RATIO = 3.5f / 2.5f;
static public final int POPUP_X_GAP = 1; // prevent popup window from blinking
//static public final float ASPECT_RATIO = 1.0f;
static public CardPanel dragAnimationPanel;
public static final Rectangle CARD_SIZE_FULL = new Rectangle(101, 149);
static private final float ROUNDED_CORNER_SIZE = 0.1f;
//static private final float SELECTED_BORDER_SIZE = 0.01f;
static private final float BLACK_BORDER_SIZE = 0.03f;
static private final int TEXT_GLOW_SIZE = 6;
static private final float TEXT_GLOW_INTENSITY = 3f;
static private final float rotCenterToTopCorner = 1.0295630140987000315797369464196f;
static private final float rotCenterToBottomCorner = 0.7071067811865475244008443621048f;
static private final int DEFAULT_DELAY_PERIOD = 300;
static private final float ROT_CENTER_TO_TOP_CORNER = 1.0295630140987000315797369464196f;
static private final float ROT_CENTER_TO_BOTTOM_CORNER = 0.7071067811865475244008443621048f;
public CardView gameCard;
@ -185,6 +181,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
popupText.setText(getText(cardType, newGameCard));
Util.threadPool.submit(new Runnable() {
@Override
public void run() {
try {
tappedAngle = isTapped() ? CardPanel.TAPPED_ANGLE : 0;
@ -233,6 +230,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
}
}
@Override
public boolean isFoil() {
return this.isFoil;
}
@ -329,6 +327,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
this.showCastingCost = showCastingCost;
}
@Override
public void paint(Graphics g) {
if (!displayEnabled) return;
if (!isValid()) super.validate();
@ -346,6 +345,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
super.paint(g2d);
}
@Override
protected void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
@ -403,6 +403,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
*/
}
@Override
protected void paintChildren(Graphics g) {
super.paintChildren(g);
@ -417,6 +418,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
}
}
@Override
public void layout() {
int borderSize = Math.round(cardWidth * BLACK_BORDER_SIZE);
imagePanel.setLocation(cardXOffset + borderSize, cardYOffset + borderSize);
@ -457,6 +459,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
imagePanel.setScalingType(ScalingType.bilinear);
}
@Override
public String toString() {
return gameCard.toString();
}
@ -467,8 +470,8 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
cardHeight = height;
int rotCenterX = Math.round(width / 2f);
int rotCenterY = height - rotCenterX;
int rotCenterToTopCorner = Math.round(width * CardPanel.rotCenterToTopCorner);
int rotCenterToBottomCorner = Math.round(width * CardPanel.rotCenterToBottomCorner);
int rotCenterToTopCorner = Math.round(width * CardPanel.ROT_CENTER_TO_TOP_CORNER);
int rotCenterToBottomCorner = Math.round(width * CardPanel.ROT_CENTER_TO_BOTTOM_CORNER);
int xOffset = rotCenterX - rotCenterToBottomCorner;
int yOffset = rotCenterY - rotCenterToTopCorner;
cardXOffset = -xOffset;
@ -478,6 +481,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
setBounds(x + xOffset, y + yOffset, width, height);
}
@Override
public void repaint() {
Rectangle b = getBounds();
JRootPane rootPane = SwingUtilities.getRootPane(this);
@ -525,6 +529,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
}
}
@Override
public float getAlpha() {
return alpha;
}
@ -537,8 +542,10 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
return cardYOffset;
}
@Override
public void updateImage() {
Util.threadPool.submit(new Runnable() {
@Override
public void run() {
try {
tappedAngle = isTapped() ? CardPanel.TAPPED_ANGLE : 0;
@ -762,7 +769,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
return data;
}
protected String getType(CardView card) {
final protected String getType(CardView card) {
StringBuilder sbType = new StringBuilder();
for (String superType : card.getSuperTypes()) {
@ -783,7 +790,7 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
return sbType.toString();
}
protected String getText(String cardType, CardView card) {
final protected String getText(String cardType, CardView card) {
StringBuilder sb = new StringBuilder();
if (card instanceof StackAbilityView || card instanceof AbilityView) {
for (String rule : card.getRules()) {