diff options
author | Jannis Harder <harder@informatik.uni-luebeck.de> | 2011-05-09 18:36:03 +0200 |
---|---|---|
committer | Jannis Harder <harder@informatik.uni-luebeck.de> | 2011-05-09 18:36:03 +0200 |
commit | f247b3666b295451da46851cfa71c5ae76b232ff (patch) | |
tree | a1f599582435aaba3a2688c31c3831cf4daa4179 | |
parent | 38f4a5bb30d13d2d371af0d1c9d609921ac6311d (diff) | |
download | JRummikub-f247b3666b295451da46851cfa71c5ae76b232ff.tar JRummikub-f247b3666b295451da46851cfa71c5ae76b232ff.zip |
Set select + collect on table
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@188 72836036-5685-4462-b002-a69064685172
-rw-r--r-- | src/jrummikub/control/TurnControl.java | 26 |
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) { } |