summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/view/impl/StoneCollection.java
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-05-03 16:03:09 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-05-03 16:03:09 +0200
commit3e257e3979f1f58d8b5ceb7a2d4472201bb94c34 (patch)
treee5c737e91fb6ce740367f31a6aaee9a3995221cd /src/jrummikub/view/impl/StoneCollection.java
parente7b428c01986dd288c548f7daf86834ff12e4a2d (diff)
downloadJRummikub-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
Diffstat (limited to 'src/jrummikub/view/impl/StoneCollection.java')
-rw-r--r--src/jrummikub/view/impl/StoneCollection.java76
1 files changed, 0 insertions, 76 deletions
diff --git a/src/jrummikub/view/impl/StoneCollection.java b/src/jrummikub/view/impl/StoneCollection.java
deleted file mode 100644
index a374dd2..0000000
--- a/src/jrummikub/view/impl/StoneCollection.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package jrummikub.view.impl;
-
-import java.awt.Color;
-import java.awt.Graphics;
-import java.awt.Graphics2D;
-import java.awt.Insets;
-import java.util.Collection;
-import java.util.Collections;
-
-import javax.swing.border.EmptyBorder;
-
-import jrummikub.model.Position;
-import jrummikub.model.Stone;
-import jrummikub.view.IStoneCollection;
-
-/**
- * Implementation of the stone collection (selection)
- */
-@SuppressWarnings("serial")
-class StoneCollection extends StonePanel implements IStoneCollection {
- private final static int INSET = 7;
- private final static float STONE_SCALE = 1.1f;
-
- private Collection<Stone> selectedStones = Collections.emptyList();
-
- /**
- * Creates a new StoneCollection instance
- */
- StoneCollection() {
- super(STONE_SCALE);
-
- setOpaque(false);
- setVisible(false);
- setBorder(new EmptyBorder(INSET, INSET, INSET, INSET));
- }
-
- /**
- * Sets the stones to be shown in the collection
- *
- * @param stones
- * the selected stones
- */
- void setSelectedStones(Collection<Stone> stones) {
- selectedStones = stones;
-
- if (stones.isEmpty()) {
- setVisible(false);
- } else {
- setSize(getStonePainter().getStoneWidth() * stones.size() + 2 * INSET,
- getStonePainter().getStoneHeight() + 2 * INSET);
- setVisible(true);
-
- repaint();
- }
- }
-
- @Override
- public void paintComponent(Graphics g1) {
- Insets insets = getInsets();
- 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);
-
- if (!selectedStones.isEmpty()) {
- g1.setColor(new Color(0, 0, 0, 0.25f));
- g1.fillRoundRect(0, 0, getWidth(), getHeight(), INSET, INSET);
-
- float xpos = 0;
-
- for (Stone stone : selectedStones) {
- getStonePainter().paintStone(g, stone, new Position(xpos, 0), false);
- xpos++;
- }
- }
- }
-}