Metric fixes
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@358 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
6319ec8ab6
commit
640a1e0fb6
13 changed files with 153 additions and 99 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Reference in a new issue