diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-05-03 16:03:09 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-05-03 16:03:09 +0200 |
commit | 3e257e3979f1f58d8b5ceb7a2d4472201bb94c34 (patch) | |
tree | e5c737e91fb6ce740367f31a6aaee9a3995221cd | |
parent | e7b428c01986dd288c548f7daf86834ff12e4a2d (diff) | |
download | JRummikub-3e257e3979f1f58d8b5ceb7a2d4472201bb94c34.tar JRummikub-3e257e3979f1f58d8b5ceb7a2d4472201bb94c34.zip |
Renamed everything in the view
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@75 72836036-5685-4462-b002-a69064685172
-rw-r--r-- | src/jrummikub/JRummikub.java | 28 | ||||
-rw-r--r-- | src/jrummikub/view/IHandPanel.java (renamed from src/jrummikub/view/IBoard.java) | 4 | ||||
-rw-r--r-- | src/jrummikub/view/IPlayerPanel.java | 2 | ||||
-rw-r--r-- | src/jrummikub/view/IStoneCollectionPanel.java (renamed from src/jrummikub/view/IStoneCollection.java) | 2 | ||||
-rw-r--r-- | src/jrummikub/view/ITablePanel.java (renamed from src/jrummikub/view/ITable.java) | 4 | ||||
-rw-r--r-- | src/jrummikub/view/IView.java | 2 | ||||
-rw-r--r-- | src/jrummikub/view/impl/AbstractStonePanel.java (renamed from src/jrummikub/view/impl/StonePanel.java) | 6 | ||||
-rw-r--r-- | src/jrummikub/view/impl/HandPanel.java (renamed from src/jrummikub/view/impl/Board.java) | 20 | ||||
-rw-r--r-- | src/jrummikub/view/impl/PlayerPanel.java | 16 | ||||
-rw-r--r-- | src/jrummikub/view/impl/StoneCollectionPanel.java (renamed from src/jrummikub/view/impl/StoneCollection.java) | 6 | ||||
-rw-r--r-- | src/jrummikub/view/impl/StonePainter.java | 4 | ||||
-rw-r--r-- | src/jrummikub/view/impl/TablePanel.java (renamed from src/jrummikub/view/impl/Table.java) | 16 | ||||
-rw-r--r-- | src/jrummikub/view/impl/View.java | 10 |
13 files changed, 60 insertions, 60 deletions
diff --git a/src/jrummikub/JRummikub.java b/src/jrummikub/JRummikub.java index 7d3ee28..6b76af6 100644 --- a/src/jrummikub/JRummikub.java +++ b/src/jrummikub/JRummikub.java @@ -33,9 +33,9 @@ public class JRummikub { view.getPlayerPanel().setCurrentPlayerName("Player 1"); view.getPlayerPanel().setTimeLeft(42); - view.getTable().setLeftPlayerName("Player 2"); - view.getTable().setTopPlayerName("Player 3"); - view.getTable().setRightPlayerName("Player 4"); + view.getTablePanel().setLeftPlayerName("Player 2"); + view.getTablePanel().setTopPlayerName("Player 3"); + view.getTablePanel().setRightPlayerName("Player 4"); view.getPlayerPanel().getSortByNumberEvent().add(new IListener() { @Override @@ -67,9 +67,9 @@ public class JRummikub { stones.put(stoneJoker, new Position(2.5f, 0)); stones.put(new Stone(StoneColor.BLACK), new Position(3.5f, 0)); - view.getPlayerPanel().getBoard().setStones(stones); + view.getPlayerPanel().getHandPanel().setStones(stones); - view.getPlayerPanel().getBoard().getClickEvent() + view.getPlayerPanel().getHandPanel().getClickEvent() .add(new IListener2<Position, Boolean>() { @Override public void fire(Position p, Boolean collect) { @@ -78,7 +78,7 @@ public class JRummikub { } }); - view.getPlayerPanel().getBoard().getRangeClickEvent() + view.getPlayerPanel().getHandPanel().getRangeClickEvent() .add(new IListener2<Position, Boolean>() { @Override public void fire(Position p, Boolean collect) { @@ -87,7 +87,7 @@ public class JRummikub { } }); - view.getPlayerPanel().getBoard().getSetClickEvent() + view.getPlayerPanel().getHandPanel().getSetClickEvent() .add(new IListener2<Position, Boolean>() { @Override public void fire(Position p, Boolean collect) { @@ -97,7 +97,7 @@ public class JRummikub { } }); - view.getTable().getClickEvent().add(new IListener2<Position, Boolean>() { + view.getTablePanel().getClickEvent().add(new IListener2<Position, Boolean>() { @Override public void fire(Position p, Boolean collect) { System.out.println("Table clicked at " + p @@ -105,7 +105,7 @@ public class JRummikub { } }); - view.getTable().getRangeClickEvent() + view.getTablePanel().getRangeClickEvent() .add(new IListener2<Position, Boolean>() { @Override public void fire(Position p, Boolean collect) { @@ -114,7 +114,7 @@ public class JRummikub { } }); - view.getTable().getSetClickEvent().add(new IListener2<Position, Boolean>() { + view.getTablePanel().getSetClickEvent().add(new IListener2<Position, Boolean>() { @Override public void fire(Position p, Boolean collect) { System.out.println("Table set-clicked at " + p @@ -123,7 +123,7 @@ public class JRummikub { } }); - view.getTable().getStoneCollection().getClickEvent() + view.getTablePanel().getStoneCollectionPanel().getClickEvent() .add(new IListener2<Position, Boolean>() { @Override public void fire(Position p, Boolean collect) { @@ -132,7 +132,7 @@ public class JRummikub { } }); - view.getTable().getStoneCollection().getRangeClickEvent() + view.getTablePanel().getStoneCollectionPanel().getRangeClickEvent() .add(new IListener2<Position, Boolean>() { @Override public void fire(Position p, Boolean collect) { @@ -141,7 +141,7 @@ public class JRummikub { } }); - view.getTable().getStoneCollection().getSetClickEvent() + view.getTablePanel().getStoneCollectionPanel().getSetClickEvent() .add(new IListener2<Position, Boolean>() { @Override public void fire(Position p, Boolean collect) { @@ -167,7 +167,7 @@ public class JRummikub { stoneSets.put(new StoneSet(stoneList), new Position(3.5f, 4)); - view.getTable().setStoneSets(stoneSets); + view.getTablePanel().setStoneSets(stoneSets); view.setSelectedStones(Arrays.asList(stoneJoker, stone8)); } diff --git a/src/jrummikub/view/IBoard.java b/src/jrummikub/view/IHandPanel.java index 1424dff..4573b93 100644 --- a/src/jrummikub/view/IBoard.java +++ b/src/jrummikub/view/IHandPanel.java @@ -6,9 +6,9 @@ import jrummikub.model.Position; import jrummikub.model.Stone; /** - * The view for a player's board that displayed his stones + * The view for a player's hand that displays his stones */ -public interface IBoard extends IClickable { +public interface IHandPanel extends IClickable { /** * Set the player's stones to display on the board * diff --git a/src/jrummikub/view/IPlayerPanel.java b/src/jrummikub/view/IPlayerPanel.java index e39ab65..f07ced4 100644 --- a/src/jrummikub/view/IPlayerPanel.java +++ b/src/jrummikub/view/IPlayerPanel.java @@ -9,7 +9,7 @@ public interface IPlayerPanel { /** * @return the board where the players hand stones are displayed */ - public IBoard getBoard(); + public IHandPanel getHandPanel(); /** * Sets the current player's name diff --git a/src/jrummikub/view/IStoneCollection.java b/src/jrummikub/view/IStoneCollectionPanel.java index 8b4148d..4c84508 100644 --- a/src/jrummikub/view/IStoneCollection.java +++ b/src/jrummikub/view/IStoneCollectionPanel.java @@ -3,5 +3,5 @@ package jrummikub.view; /** * The view of the collection that shows the stones a player has selected */ -public interface IStoneCollection extends IClickable { +public interface IStoneCollectionPanel extends IClickable { } diff --git a/src/jrummikub/view/ITable.java b/src/jrummikub/view/ITablePanel.java index e257d26..48eb357 100644 --- a/src/jrummikub/view/ITable.java +++ b/src/jrummikub/view/ITablePanel.java @@ -8,7 +8,7 @@ import jrummikub.model.StoneSet; /** * The view of the table, where the stone sets lie */ -public interface ITable extends IClickable { +public interface ITablePanel extends IClickable { /** * Sets the player name on the left label * @@ -47,5 +47,5 @@ public interface ITable extends IClickable { * * @return the stone collection */ - IStoneCollection getStoneCollection(); + IStoneCollectionPanel getStoneCollectionPanel(); } diff --git a/src/jrummikub/view/IView.java b/src/jrummikub/view/IView.java index cb4ab3e..8e59baa 100644 --- a/src/jrummikub/view/IView.java +++ b/src/jrummikub/view/IView.java @@ -13,7 +13,7 @@ public interface IView { * * @return the table */ - public ITable getTable(); + public ITablePanel getTablePanel(); /** * Returns the player panel diff --git a/src/jrummikub/view/impl/StonePanel.java b/src/jrummikub/view/impl/AbstractStonePanel.java index 9e84349..8ab18d8 100644 --- a/src/jrummikub/view/impl/StonePanel.java +++ b/src/jrummikub/view/impl/AbstractStonePanel.java @@ -14,7 +14,7 @@ import jrummikub.view.IClickable; * Base class for panels that draw stones */ @SuppressWarnings("serial") -abstract class StonePanel extends JPanel implements IClickable { +abstract class AbstractStonePanel extends JPanel implements IClickable { private StonePainter stonePainter; private Event2<Position, Boolean> clickEvent = new Event2<Position, Boolean>(); @@ -31,7 +31,7 @@ abstract class StonePanel extends JPanel implements IClickable { /** * Create a new StonePanel with default scale factor */ - public StonePanel() { + public AbstractStonePanel() { this(1); } @@ -41,7 +41,7 @@ abstract class StonePanel extends JPanel implements IClickable { * @param scale * the grid scale */ - public StonePanel(float scale) { + public AbstractStonePanel(float scale) { super(true); // Set double buffered stonePainter = new StonePainter(scale); diff --git a/src/jrummikub/view/impl/Board.java b/src/jrummikub/view/impl/HandPanel.java index 94571e0..1610c00 100644 --- a/src/jrummikub/view/impl/Board.java +++ b/src/jrummikub/view/impl/HandPanel.java @@ -18,20 +18,20 @@ import javax.swing.border.MatteBorder; import jrummikub.model.Position; import jrummikub.model.Stone; -import jrummikub.view.IBoard; +import jrummikub.view.IHandPanel; /** * Implementation of the board */ @SuppressWarnings("serial") -class Board extends StonePanel implements IBoard { - private final static int BOARD_HEIGHT = 2; - private final static int BOARD_WIDTH = 14; +class HandPanel extends AbstractStonePanel implements IHandPanel { + private final static int HAND_HEIGHT = 2; + private final static int HAND_WIDTH = 14; private final static BufferedImage BACKGROUND; static { ImageIcon image = new ImageIcon( - Board.class.getResource("/jrummikub/resource/wood.png")); + HandPanel.class.getResource("/jrummikub/resource/wood.png")); BACKGROUND = new BufferedImage(image.getIconWidth(), image.getIconHeight(), BufferedImage.TYPE_INT_RGB); @@ -45,7 +45,7 @@ class Board extends StonePanel implements IBoard { /** * Creates a new Board instance */ - Board() { + HandPanel() { setBorder(new MatteBorder(0, 1, 0, 1, Color.DARK_GRAY)); addComponentListener(new ComponentAdapter() { @@ -53,11 +53,11 @@ class Board extends StonePanel implements IBoard { @Override public void componentResized(ComponentEvent e) { Insets insets = getInsets(); - int size = (getHeight() - insets.top - insets.bottom) / BOARD_HEIGHT; + int size = (getHeight() - insets.top - insets.bottom) / HAND_HEIGHT; getStonePainter().setScale(size * StonePainter.HEIGHT_SCALE); - setSize(new Dimension(BOARD_WIDTH * getStonePainter().getStoneWidth() + setSize(new Dimension(HAND_WIDTH * getStonePainter().getStoneWidth() + insets.left + insets.right, getHeight())); } }); @@ -81,12 +81,12 @@ class Board extends StonePanel implements IBoard { int x = insets.left, y = insets.top, width = getWidth() - insets.left - insets.right, height = getHeight() - insets.top - insets.bottom; Graphics2D g = (Graphics2D) g1.create(x, y, width, height); - int size = height / BOARD_HEIGHT; + int size = height / HAND_HEIGHT; if (scaledBackground.getHeight() != size) scaledBackground = getScaledBackground(size); - for (int i = 0; i < BOARD_HEIGHT; ++i) { + for (int i = 0; i < HAND_HEIGHT; ++i) { for (int xpos = -size * i / 3; xpos < width; xpos += size) { g.drawImage(scaledBackground, xpos, size * i, null); } diff --git a/src/jrummikub/view/impl/PlayerPanel.java b/src/jrummikub/view/impl/PlayerPanel.java index 9136e85..0a7e64a 100644 --- a/src/jrummikub/view/impl/PlayerPanel.java +++ b/src/jrummikub/view/impl/PlayerPanel.java @@ -31,7 +31,7 @@ class PlayerPanel extends JPanel implements IPlayerPanel { private final static DecimalFormat secondFormat = new DecimalFormat("00"); - private Board board; + private HandPanel hand; private JPanel leftPanel, rightPanel; @@ -46,8 +46,8 @@ class PlayerPanel extends JPanel implements IPlayerPanel { private Event endTurnEvent = new Event(); @Override - public Board getBoard() { - return board; + public HandPanel getHandPanel() { + return hand; } @Override @@ -144,11 +144,11 @@ class PlayerPanel extends JPanel implements IPlayerPanel { Insets insets = getInsets(); int x = insets.left, y = insets.top, width = getWidth() - insets.left - insets.right, height = getHeight() - insets.top - insets.bottom; - int boardWidth = board.getWidth(); + int boardWidth = hand.getWidth(); int panelWidth = (width - boardWidth) / 2; leftPanel.setBounds(x, y, panelWidth, height); - board.setBounds(x + panelWidth, y, boardWidth, height); + hand.setBounds(x + panelWidth, y, boardWidth, height); rightPanel.setBounds(x + panelWidth + boardWidth, y, panelWidth, height); leftPanel.validate(); @@ -164,8 +164,8 @@ class PlayerPanel extends JPanel implements IPlayerPanel { createLeftPanel(); add(leftPanel); - board = new Board(); - add(board); + hand = new HandPanel(); + add(hand); createRightPanel(); add(rightPanel); @@ -178,7 +178,7 @@ class PlayerPanel extends JPanel implements IPlayerPanel { }; addComponentListener(rescaleListener); - board.addComponentListener(rescaleListener); + hand.addComponentListener(rescaleListener); } private class LeftPanelResizeListener extends ComponentAdapter { diff --git a/src/jrummikub/view/impl/StoneCollection.java b/src/jrummikub/view/impl/StoneCollectionPanel.java index a374dd2..e4ca1c6 100644 --- a/src/jrummikub/view/impl/StoneCollection.java +++ b/src/jrummikub/view/impl/StoneCollectionPanel.java @@ -11,13 +11,13 @@ import javax.swing.border.EmptyBorder; import jrummikub.model.Position; import jrummikub.model.Stone; -import jrummikub.view.IStoneCollection; +import jrummikub.view.IStoneCollectionPanel; /** * Implementation of the stone collection (selection) */ @SuppressWarnings("serial") -class StoneCollection extends StonePanel implements IStoneCollection { +class StoneCollectionPanel extends AbstractStonePanel implements IStoneCollectionPanel { private final static int INSET = 7; private final static float STONE_SCALE = 1.1f; @@ -26,7 +26,7 @@ class StoneCollection extends StonePanel implements IStoneCollection { /** * Creates a new StoneCollection instance */ - StoneCollection() { + StoneCollectionPanel() { super(STONE_SCALE); setOpaque(false); diff --git a/src/jrummikub/view/impl/StonePainter.java b/src/jrummikub/view/impl/StonePainter.java index 47c0e9b..b901e78 100644 --- a/src/jrummikub/view/impl/StonePainter.java +++ b/src/jrummikub/view/impl/StonePainter.java @@ -207,7 +207,7 @@ class StonePainter { - faceSize / 2, faceSize, faceSize)); } - private void paintStoneNumber(Graphics2D g, Rectangle r, Color color, int v) { + private void paintStoneValue(Graphics2D g, Rectangle r, Color color, int v) { int pos = r.y + (int) (TEXT_POS * r.height); g.setFont(new Font("SansSerif", Font.BOLD, r.height / 4)); @@ -266,7 +266,7 @@ class StonePainter { if (stone.isJoker()) { paintJoker(g, rect, color); } else { - paintStoneNumber(g, rect, color, stone.getValue()); + paintStoneValue(g, rect, color, stone.getValue()); } paintCircle(g, rect, background); diff --git a/src/jrummikub/view/impl/Table.java b/src/jrummikub/view/impl/TablePanel.java index 1d78ac1..b02a9a9 100644 --- a/src/jrummikub/view/impl/Table.java +++ b/src/jrummikub/view/impl/TablePanel.java @@ -18,22 +18,22 @@ import javax.swing.JLabel; import jrummikub.model.Position; import jrummikub.model.Stone; import jrummikub.model.StoneSet; -import jrummikub.view.IStoneCollection; -import jrummikub.view.ITable; +import jrummikub.view.IStoneCollectionPanel; +import jrummikub.view.ITablePanel; /** * The implementation of the table */ @SuppressWarnings("serial") -class Table extends StonePanel implements ITable { +class TablePanel extends AbstractStonePanel implements ITablePanel { private final static ImageIcon background = new ImageIcon( - Board.class.getResource("/jrummikub/resource/felt.png")); + HandPanel.class.getResource("/jrummikub/resource/felt.png")); private final static float DEFAULT_SCALE = 1; private final int COLLECTION_GAP = 5; private JLabel leftPlayerLabel, topPlayerLabel, rightPlayerLabel; - private StoneCollection stoneCollection; + private StoneCollectionPanel stoneCollection; private Map<StoneSet, Position> stoneSets = Collections.emptyMap(); private Collection<Stone> selectedStones = Collections.emptyList(); @@ -60,7 +60,7 @@ class Table extends StonePanel implements ITable { } @Override - public IStoneCollection getStoneCollection() { + public IStoneCollectionPanel getStoneCollectionPanel() { return stoneCollection; } @@ -92,7 +92,7 @@ class Table extends StonePanel implements ITable { /** * Creates a new Table instance */ - Table() { + TablePanel() { super(DEFAULT_SCALE); setLayout(null); @@ -117,7 +117,7 @@ class Table extends StonePanel implements ITable { rightPlayerLabel.setHorizontalTextPosition(JLabel.RIGHT); add(rightPlayerLabel); - stoneCollection = new StoneCollection(); + stoneCollection = new StoneCollectionPanel(); add(stoneCollection); ComponentListener rescaleListener = new ComponentAdapter() { diff --git a/src/jrummikub/view/impl/View.java b/src/jrummikub/view/impl/View.java index a257034..7ef0e18 100644 --- a/src/jrummikub/view/impl/View.java +++ b/src/jrummikub/view/impl/View.java @@ -11,7 +11,7 @@ import javax.swing.border.MatteBorder; import jrummikub.model.Stone; import jrummikub.view.IPlayerPanel; -import jrummikub.view.ITable; +import jrummikub.view.ITablePanel; import jrummikub.view.IView; /** @@ -19,7 +19,7 @@ import jrummikub.view.IView; */ @SuppressWarnings("serial") public class View extends JFrame implements IView { - private Table table; + private TablePanel table; private PlayerPanel playerPanel; private final static float PLAYER_PANEL_RATIO = 0.14f; @@ -30,7 +30,7 @@ public class View extends JFrame implements IView { return 2 * (int) (d / 2); } - public ITable getTable() { + public ITablePanel getTablePanel() { return table; } @@ -48,7 +48,7 @@ public class View extends JFrame implements IView { setSize(800, 600); setDefaultCloseOperation(EXIT_ON_CLOSE); - table = new Table(); + table = new TablePanel(); add(table); playerPanel = new PlayerPanel(); @@ -83,6 +83,6 @@ public class View extends JFrame implements IView { @Override public void setSelectedStones(Collection<Stone> stones) { table.setSelectedStones(stones); - playerPanel.getBoard().setSelectedStones(stones); + playerPanel.getHandPanel().setSelectedStones(stones); } } |