summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/control
diff options
context:
space:
mode:
Diffstat (limited to 'src/jrummikub/control')
-rw-r--r--src/jrummikub/control/TurnControl.java26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/jrummikub/control/TurnControl.java b/src/jrummikub/control/TurnControl.java
index 768f4f9..862058f 100644
--- a/src/jrummikub/control/TurnControl.java
+++ b/src/jrummikub/control/TurnControl.java
@@ -55,8 +55,8 @@ public class TurnControl {
connections.add(view.getPlayerPanel().getEndTurnEvent()
.add(endOfTurnListener));
- connections.add(view.getPlayerPanel().getHandPanel().getStoneClickEvent()
- .add(new IListener2<Stone, Boolean>() {
+ connections.add(view.getPlayerPanel().getHandPanel()
+ .getStoneClickEvent().add(new IListener2<Stone, Boolean>() {
@Override
public void handle(Stone stone, Boolean collect) {
@@ -79,7 +79,7 @@ public class TurnControl {
public void handle(Stone stone, Boolean collect) {
collectionSetClick(stone, collect);
}
- }));
+ }));
connections.add(view.getTablePanel().getStoneClickEvent()
.add(new IListener2<Stone, Boolean>() {
@@ -88,6 +88,14 @@ public class TurnControl {
stoneClick(stone, collect);
}
}));
+ connections.add(view.getTablePanel().getSetClickEvent()
+ .add(new IListener2<Stone, Boolean>() {
+
+ @Override
+ public void handle(Stone stone, Boolean collect) {
+ tableSetClick(stone, collect);
+ }
+ }));
connections.add(view.getTablePanel().getClickEvent()
.add(new IListener1<Position>() {
@@ -175,6 +183,18 @@ public class TurnControl {
view.setSelectedStones(selectedStones);
}
+ private void tableSetClick(Stone stone, Boolean collect) {
+ if (!collect) {
+ selectedStones.clear();
+ }
+ StoneSet selectedSet = table.findStoneSet(stone);
+ for (Stone setStone : selectedSet) {
+ selectedStones.remove(setStone);
+ selectedStones.add(setStone);
+ }
+ view.setSelectedStones(selectedStones);
+ }
+
private void leftConnectorClick(StoneSet set) {
}