diff options
author | Bennet Gerlach <bennet_gerlach@web.de> | 2011-05-04 23:14:10 +0200 |
---|---|---|
committer | Bennet Gerlach <bennet_gerlach@web.de> | 2011-05-04 23:14:10 +0200 |
commit | db7489a5c78551e4db52acd11656f2b872740f89 (patch) | |
tree | 59b89508489554b84f44fc208585b3e681dbfe52 /src/jrummikub/view | |
parent | b0a90ad6f052037260c6304b537a9550a7422e30 (diff) | |
download | JRummikub-db7489a5c78551e4db52acd11656f2b872740f89.tar JRummikub-db7489a5c78551e4db52acd11656f2b872740f89.zip |
New main
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@127 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/view')
-rw-r--r-- | src/jrummikub/view/ITablePanel.java | 3 | ||||
-rw-r--r-- | src/jrummikub/view/impl/TablePanel.java | 26 |
2 files changed, 15 insertions, 14 deletions
diff --git a/src/jrummikub/view/ITablePanel.java b/src/jrummikub/view/ITablePanel.java index f17d1fe..5c4198c 100644 --- a/src/jrummikub/view/ITablePanel.java +++ b/src/jrummikub/view/ITablePanel.java @@ -5,6 +5,7 @@ import java.util.Map; import jrummikub.model.Position; import jrummikub.model.StoneSet; import jrummikub.util.Event1; +import jrummikub.util.Pair; /** * The view of the table, where the stone sets lie @@ -40,7 +41,7 @@ public interface ITablePanel extends IStonePanel, IClickable { * @param stoneSets * set stone sets on the table */ - public void setStoneSets(Map<StoneSet, Position> stoneSets); + public void setStoneSets(Iterable<Pair<StoneSet, Position>> stoneSets); /** * Returns the stone collection (the panel showing the stones currently diff --git a/src/jrummikub/view/impl/TablePanel.java b/src/jrummikub/view/impl/TablePanel.java index abbb867..f400fac 100644 --- a/src/jrummikub/view/impl/TablePanel.java +++ b/src/jrummikub/view/impl/TablePanel.java @@ -45,7 +45,7 @@ class TablePanel extends AbstractStonePanel implements ITablePanel { private JLabel leftPlayerLabel, topPlayerLabel, rightPlayerLabel; private StoneCollectionPanel stoneCollection; - private Map<StoneSet, Position> stoneSets = Collections.emptyMap(); + private Iterable<Pair<StoneSet, Position>> stoneSets = Collections.emptySet(); private Collection<Stone> selectedStones = Collections.emptyList(); private Event1<StoneSet> leftConnectorClickEvent = new Event1<StoneSet>(); @@ -77,13 +77,13 @@ class TablePanel extends AbstractStonePanel implements ITablePanel { } @Override - public void setStoneSets(Map<StoneSet, Position> stoneSets) { + public void setStoneSets(Iterable<Pair<StoneSet, Position>> stoneSets) { Map<Stone, Position> stones = new HashMap<Stone, Position>(); - for (Map.Entry<StoneSet, Position> entry : stoneSets.entrySet()) { - float x = entry.getValue().getX(), y = entry.getValue().getY(); + for (Pair<StoneSet, Position> entry : stoneSets) { + float x = entry.getSecond().getX(), y = entry.getSecond().getY(); - for (Stone stone : entry.getKey()) { + for (Stone stone : entry.getFirst()) { stones.put(stone, new Position(x, y)); x++; } @@ -156,9 +156,9 @@ class TablePanel extends AbstractStonePanel implements ITablePanel { float minx = -MIN_VISIBLE_WIDTH / 2, maxx = MIN_VISIBLE_WIDTH / 2; float miny = -MIN_VISIBLE_HEIGHT / 2, maxy = MIN_VISIBLE_HEIGHT / 2; - for (Map.Entry<StoneSet, Position> entry : stoneSets.entrySet()) { - Position p = entry.getValue(); - StoneSet stoneSet = entry.getKey(); + for (Pair<StoneSet, Position> entry : stoneSets) { + Position p = entry.getSecond(); + StoneSet stoneSet = entry.getFirst(); if (p.getX() < minx) minx = p.getX(); @@ -205,9 +205,9 @@ class TablePanel extends AbstractStonePanel implements ITablePanel { } protected boolean handleOtherClickEvent(Position pos) { - for (Map.Entry<StoneSet, Position> entry : stoneSets.entrySet()) { - Position p = entry.getValue(); - StoneSet stoneSet = entry.getKey(); + for (Pair<StoneSet, Position> entry : stoneSets) { + Position p = entry.getSecond(); + StoneSet stoneSet = entry.getFirst(); float x = p.getX(), y = p.getY(); // left connector @@ -281,8 +281,8 @@ class TablePanel extends AbstractStonePanel implements ITablePanel { g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - for (Map.Entry<StoneSet, Position> entry : stoneSets.entrySet()) { - paintStoneSet(g, entry.getKey(), entry.getValue()); + for (Pair<StoneSet, Position> entry : stoneSets) { + paintStoneSet(g, entry.getFirst(), entry.getSecond()); } g.setTransform(oldTransform); |