From f247b3666b295451da46851cfa71c5ae76b232ff Mon Sep 17 00:00:00 2001 From: Jannis Harder Date: Mon, 9 May 2011 18:36:03 +0200 Subject: Set select + collect on table git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@188 72836036-5685-4462-b002-a69064685172 --- src/jrummikub/control/TurnControl.java | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'src/jrummikub/control') 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() { + connections.add(view.getPlayerPanel().getHandPanel() + .getStoneClickEvent().add(new IListener2() { @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() { @@ -88,6 +88,14 @@ public class TurnControl { stoneClick(stone, collect); } })); + connections.add(view.getTablePanel().getSetClickEvent() + .add(new IListener2() { + + @Override + public void handle(Stone stone, Boolean collect) { + tableSetClick(stone, collect); + } + })); connections.add(view.getTablePanel().getClickEvent() .add(new IListener1() { @@ -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) { } -- cgit v1.2.3