summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/view
diff options
context:
space:
mode:
authorBennet Gerlach <bennet_gerlach@web.de>2011-05-31 20:42:46 +0200
committerBennet Gerlach <bennet_gerlach@web.de>2011-05-31 20:42:46 +0200
commit640a1e0fb67dd6de744670bf5f0980e89620ca4c (patch)
treea552669b586b54fb5ead1342aac08962eb476bab /src/jrummikub/view
parent6319ec8ab637ad1754a0d17d3243eb44df9089e5 (diff)
downloadJRummikub-640a1e0fb67dd6de744670bf5f0980e89620ca4c.tar
JRummikub-640a1e0fb67dd6de744670bf5f0980e89620ca4c.zip
Metric fixes
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@358 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/view')
-rw-r--r--src/jrummikub/view/IPlayerPanel.java16
-rw-r--r--src/jrummikub/view/IView.java20
-rw-r--r--src/jrummikub/view/impl/PlayerPanel.java32
3 files changed, 47 insertions, 21 deletions
diff --git a/src/jrummikub/view/IPlayerPanel.java b/src/jrummikub/view/IPlayerPanel.java
index 0181a9e..133adba 100644
--- a/src/jrummikub/view/IPlayerPanel.java
+++ b/src/jrummikub/view/IPlayerPanel.java
@@ -1,5 +1,6 @@
package jrummikub.view;
+import jrummikub.control.turn.TurnMode;
import jrummikub.util.IEvent;
/**
@@ -10,7 +11,7 @@ public interface IPlayerPanel {
* Sets the time the player has left for his turn
*
* @param time
- * the time left
+ * the time left
*/
public void setTimeLeft(int time);
@@ -23,8 +24,8 @@ public interface IPlayerPanel {
public IEvent getSortByGroupsEvent();
/**
- * The sort by runs event is emitted when the player wants to sort his
- * stones by runs
+ * The sort by runs event is emitted when the player wants to sort his stones
+ * by runs
*
* @return the event
*/
@@ -47,11 +48,8 @@ public interface IPlayerPanel {
/**
* Sets the buttons available to end the turn
*
- * @param inspectOnly
- * true for each player's first turn
- * @param mayRedeal
- * true if the player is allowed to trigger a redealing of all
- * stones
+ * @param turnMode
+ * the {@link TurnMode}
*/
- public abstract void setEndTurnMode(boolean inspectOnly, boolean mayRedeal);
+ public abstract void setEndTurnMode(TurnMode turnMode);
}
diff --git a/src/jrummikub/view/IView.java b/src/jrummikub/view/IView.java
index 41dbdf1..ab86b4b 100644
--- a/src/jrummikub/view/IView.java
+++ b/src/jrummikub/view/IView.java
@@ -121,9 +121,27 @@ public interface IView {
*/
public IEvent getNewGameEvent();
+ /**
+ * Sets the bottom panels type
+ *
+ * @param type
+ * the type of the bottom panel
+ */
public void setBottomPanel(BottomPanelType type);
+ /**
+ * Different types of bottom panels
+ */
public enum BottomPanelType {
- START_GAME_PANEL, START_TURN_PANEL, HUMAN_HAND_PANEL, COMPUTER_HAND_PANEL, WIN_PANEL
+ /** */
+ START_GAME_PANEL,
+ /** */
+ START_TURN_PANEL,
+ /** */
+ HUMAN_HAND_PANEL,
+ /** */
+ COMPUTER_HAND_PANEL,
+ /** */
+ WIN_PANEL
}
}
diff --git a/src/jrummikub/view/impl/PlayerPanel.java b/src/jrummikub/view/impl/PlayerPanel.java
index a16b32f..dcd22ed 100644
--- a/src/jrummikub/view/impl/PlayerPanel.java
+++ b/src/jrummikub/view/impl/PlayerPanel.java
@@ -17,6 +17,7 @@ import javax.swing.JProgressBar;
import javax.swing.UIManager;
import javax.swing.border.EmptyBorder;
+import jrummikub.control.turn.TurnMode;
import jrummikub.model.Position;
import jrummikub.model.Stone;
import jrummikub.util.Event;
@@ -268,8 +269,6 @@ class PlayerPanel extends JPanel implements IPlayerPanel {
addComponentListener(rescaleListener);
hand.addComponentListener(rescaleListener);
-
- setEndTurnMode(true, true);
}
private class LeftPanelResizeListener extends ComponentAdapter {
@@ -363,16 +362,27 @@ class PlayerPanel extends JPanel implements IPlayerPanel {
}
@Override
- public void setEndTurnMode(boolean inspectOnly, boolean mayRedeal) {
- if (!inspectOnly) {
- endTurnButton.setText("Zug beenden");
- } else if (!mayRedeal) {
+ public void setEndTurnMode(TurnMode turnMode) {
+
+ switch (turnMode) {
+ case MAY_REDEAL:
+ endTurnButton.setVisible(false);
+ keepStonesButton.setVisible(true);
+ redealButton.setVisible(true);
+ break;
+ case INSPECT_ONLY:
endTurnButton.setText("N\u00e4chster Spieler");
+ endTurnButton.setVisible(true);
+ keepStonesButton.setVisible(false);
+ redealButton.setVisible(false);
+ break;
+ case NORMAL_TURN:
+ endTurnButton.setText("Zug beenden");
+ endTurnButton.setVisible(true);
+ keepStonesButton.setVisible(false);
+ redealButton.setVisible(false);
+ break;
}
- boolean smallButtons = mayRedeal && inspectOnly;
- endTurnButton.setVisible(!smallButtons);
- keepStonesButton.setVisible(smallButtons);
- redealButton.setVisible(smallButtons);
}
void showButtons(boolean show) {
@@ -397,7 +407,7 @@ class PlayerPanel extends JPanel implements IPlayerPanel {
sortByGroupsButton.setEnabled(enable);
sortByRunsButton.setEnabled(enable);
if (!enable) {
- setEndTurnMode(false, false);
+ setEndTurnMode(TurnMode.NORMAL_TURN);
endTurnButton.setText("<html><center>Computer denkt nach");
hand.setStones(Collections.<Pair<Stone, Position>> emptyList());
handRowDownButton.setForeground(Color.GRAY);