diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-05-10 00:28:06 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-05-10 00:28:06 +0200 |
commit | 3338af2d439019fedced4be5b105ce06129a3712 (patch) | |
tree | 6c071a18fcabb1e2f8f0af7d8d323b7dc4a1148c /src | |
parent | 8e73d1ab3734b4e5b88edcf024ffc37bd03225e6 (diff) | |
download | JRummikub-3338af2d439019fedced4be5b105ce06129a3712.tar JRummikub-3338af2d439019fedced4be5b105ce06129a3712.zip |
Add tests for hand auto-sort
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@203 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src')
-rw-r--r-- | src/jrummikub/control/TurnControl.java | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/jrummikub/control/TurnControl.java b/src/jrummikub/control/TurnControl.java index bf921e4..e82b30f 100644 --- a/src/jrummikub/control/TurnControl.java +++ b/src/jrummikub/control/TurnControl.java @@ -21,7 +21,7 @@ import jrummikub.util.Pair; import jrummikub.view.IView; public class TurnControl { - private static class HandStoneComparator implements + static class HandStonePositionComparator implements Comparator<Pair<Stone, Position>> { @Override public int compare(Pair<Stone, Position> pair1, @@ -161,6 +161,20 @@ public class TurnControl { connectorClick(set, true); } })); + connections.add(view.getPlayerPanel().getSortByGroupsEvent() + .add(new IListener() { + @Override + public void handle() { + sortByGroups(); + } + })); + connections.add(view.getPlayerPanel().getSortByRunsEvent() + .add(new IListener() { + @Override + public void handle() { + sortByRuns(); + } + })); view.getPlayerPanel().getHandPanel().setStones(hand.clone()); view.enableStartTurnPanel(false); @@ -168,11 +182,11 @@ public class TurnControl { timer.startTimer(); } - private void sortByValue() { + private void sortByRuns() { } - private void sortByColor() { + private void sortByGroups() { } @@ -286,7 +300,7 @@ public class TurnControl { handPairs.add(entry); } - Collections.sort(handPairs, new HandStoneComparator()); + Collections.sort(handPairs, new HandStonePositionComparator()); List<Stone> handStones = new ArrayList<Stone>(); for (Pair<Stone, Position> entry : handPairs) { @@ -338,8 +352,7 @@ public class TurnControl { - selectedStones.size(), newPos.getY())); } } else { - table.drop(new StoneSet(selectedStones), new Position(pos.getX() - + (set.size() - selectedStones.size()) * 0.5f, pos.getY())); + table.drop(new StoneSet(selectedStones), new Position(RoundControl.HAND_WIDTH-1, RoundControl.HAND_HEIGHT-1)); } selectedStones.clear(); |