summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/view/impl
diff options
context:
space:
mode:
Diffstat (limited to 'src/jrummikub/view/impl')
-rw-r--r--src/jrummikub/view/impl/TablePanel.java26
1 files changed, 13 insertions, 13 deletions
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);