summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/view/impl/View.java
diff options
context:
space:
mode:
authorJannis Harder <harder@informatik.uni-luebeck.de>2011-06-18 04:39:16 +0200
committerJannis Harder <harder@informatik.uni-luebeck.de>2011-06-18 04:39:16 +0200
commit823ef9d4fe63cb14a114dd01fda54387998071d5 (patch)
treedbf4f363eb9e0d8907dfd5d169e88e582cf1b61f /src/jrummikub/view/impl/View.java
parentc50fd5d7016354fbd462078e7ae296e2bc5ed86e (diff)
downloadJRummikub-823ef9d4fe63cb14a114dd01fda54387998071d5.tar
JRummikub-823ef9d4fe63cb14a114dd01fda54387998071d5.zip
Feedback
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@461 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/view/impl/View.java')
-rw-r--r--src/jrummikub/view/impl/View.java79
1 files changed, 52 insertions, 27 deletions
diff --git a/src/jrummikub/view/impl/View.java b/src/jrummikub/view/impl/View.java
index c18d3b3..83ca40b 100644
--- a/src/jrummikub/view/impl/View.java
+++ b/src/jrummikub/view/impl/View.java
@@ -154,7 +154,8 @@ public class View extends JFrame implements IView {
showSettingsPanel(false);
showLoginPanel(false);
showGameListPanel(false);
- getHandPanel().setStones(Collections.<Pair<Stone, Position>> emptyList());
+ getHandPanel().setStones(
+ Collections.<Pair<Stone, Position>> emptyList());
getTablePanel().setStoneSets(
Collections.<Pair<StoneSet, Position>> emptyList());
setSelectedStones(Collections.<Stone> emptyList());
@@ -305,8 +306,8 @@ public class View extends JFrame implements IView {
mainLayer.add(table);
playerPanel = new PlayerPanel();
- playerPanel.setBorder(new MatteBorder(PLAYER_PANEL_BORDER_WIDTH, 0, 0, 0,
- Color.BLACK));
+ playerPanel.setBorder(new MatteBorder(PLAYER_PANEL_BORDER_WIDTH, 0, 0,
+ 0, Color.BLACK));
mainLayer.add(playerPanel);
startTurnPanel = new StartTurnPanel();
@@ -397,6 +398,16 @@ public class View extends JFrame implements IView {
startTurnPanel.setCurrentPlayerName(playerName);
pausePanel.setCurrentPlayerName(playerName);
}
+
+ @Override
+ public void setInitialMeldError(int points) {
+ startTurnPanel.setInitialMeldError(points);
+ }
+
+ @Override
+ public void setInitialMeldFirstError() {
+ startTurnPanel.setInitialMeldFirstError();
+ }
@Override
public void setCurrentPlayerColor(Color color) {
@@ -414,6 +425,11 @@ public class View extends JFrame implements IView {
}
@Override
+ public IEvent getAcknowledgeInvalidEvent() {
+ return startTurnPanel.getAcknowledgeInvalidEvent();
+ }
+
+ @Override
public IEvent getNewRoundEvent() {
return winPanel.getNewRoundEvent();
}
@@ -430,24 +446,24 @@ public class View extends JFrame implements IView {
@SuppressWarnings("unchecked")
private List<Pair<Stone, Position>> createDecorationStones() {
- Pair<Stone, Position> stoneJ = new Pair<Stone, Position>(new Stone(-'J',
- StoneColor.BLACK), new Position(2.5f, 0));
- Pair<Stone, Position> stoneR = new Pair<Stone, Position>(new Stone(-'R',
- StoneColor.ORANGE), new Position(3.5f, 0));
- Pair<Stone, Position> stoneu1 = new Pair<Stone, Position>(new Stone(-'u',
- StoneColor.BLUE), new Position(4.5f, 0));
- Pair<Stone, Position> stonem1 = new Pair<Stone, Position>(new Stone(-'m',
- StoneColor.RED), new Position(5.5f, 0));
- Pair<Stone, Position> stonem2 = new Pair<Stone, Position>(new Stone(-'m',
- StoneColor.GREEN), new Position(6.5f, 0));
- Pair<Stone, Position> stonei = new Pair<Stone, Position>(new Stone(-'i',
- StoneColor.VIOLET), new Position(7.5f, 0));
- Pair<Stone, Position> stonek = new Pair<Stone, Position>(new Stone(-'k',
- StoneColor.AQUA), new Position(8.5f, 0));
- Pair<Stone, Position> stoneu2 = new Pair<Stone, Position>(new Stone(-'u',
- StoneColor.GRAY), new Position(9.5f, 0));
- Pair<Stone, Position> stoneb = new Pair<Stone, Position>(new Stone(-'b',
- StoneColor.BLACK), new Position(10.5f, 0));
+ Pair<Stone, Position> stoneJ = new Pair<Stone, Position>(new Stone(
+ -'J', StoneColor.BLACK), new Position(2.5f, 0));
+ Pair<Stone, Position> stoneR = new Pair<Stone, Position>(new Stone(
+ -'R', StoneColor.ORANGE), new Position(3.5f, 0));
+ Pair<Stone, Position> stoneu1 = new Pair<Stone, Position>(new Stone(
+ -'u', StoneColor.BLUE), new Position(4.5f, 0));
+ Pair<Stone, Position> stonem1 = new Pair<Stone, Position>(new Stone(
+ -'m', StoneColor.RED), new Position(5.5f, 0));
+ Pair<Stone, Position> stonem2 = new Pair<Stone, Position>(new Stone(
+ -'m', StoneColor.GREEN), new Position(6.5f, 0));
+ Pair<Stone, Position> stonei = new Pair<Stone, Position>(new Stone(
+ -'i', StoneColor.VIOLET), new Position(7.5f, 0));
+ Pair<Stone, Position> stonek = new Pair<Stone, Position>(new Stone(
+ -'k', StoneColor.AQUA), new Position(8.5f, 0));
+ Pair<Stone, Position> stoneu2 = new Pair<Stone, Position>(new Stone(
+ -'u', StoneColor.GRAY), new Position(9.5f, 0));
+ Pair<Stone, Position> stoneb = new Pair<Stone, Position>(new Stone(
+ -'b', StoneColor.BLACK), new Position(10.5f, 0));
Pair<Stone, Position> stone1 = new Pair<Stone, Position>(new Stone(
StoneColor.RED), new Position(2, 1));
@@ -462,9 +478,9 @@ public class View extends JFrame implements IView {
Pair<Stone, Position> stone6 = new Pair<Stone, Position>(new Stone(
StoneColor.BLACK), new Position(11, 1));
- return Arrays
- .asList(stoneJ, stoneR, stoneu1, stonem1, stonem2, stonei, stonek,
- stoneu2, stoneb, stone1, stone2, stone3, stone4, stone5, stone6);
+ return Arrays.asList(stoneJ, stoneR, stoneu1, stonem1, stonem2, stonei,
+ stonek, stoneu2, stoneb, stone1, stone2, stone3, stone4,
+ stone5, stone6);
}
@Override
@@ -475,17 +491,26 @@ public class View extends JFrame implements IView {
}
private void doSetBottomPanel(BottomPanelType type) {
- startTurnPanel.setVisible(type == BottomPanelType.START_TURN_PANEL);
+ boolean showStartTurnPanel = type == BottomPanelType.START_TURN_PANEL
+ || type == BottomPanelType.INVALID_TURN_PANEL;
+ startTurnPanel.setVisible(showStartTurnPanel);
+ startTurnPanel.setType(type);
winPanel.setVisible(type == BottomPanelType.WIN_PANEL);
- playerPanel.setVisible(type != BottomPanelType.START_TURN_PANEL
+ playerPanel.setVisible((!showStartTurnPanel)
&& type != BottomPanelType.WIN_PANEL && type != null);
if (type == BottomPanelType.START_GAME_PANEL) {
- table.setStoneSets(Collections.<Pair<StoneSet, Position>> emptyList());
+ table.setStoneSets(Collections
+ .<Pair<StoneSet, Position>> emptyList());
playerPanel.getHandPanel().setStones(createDecorationStones());
}
playerPanel.showButtons(type != BottomPanelType.START_GAME_PANEL);
playerPanel.enableButtons(type != BottomPanelType.COMPUTER_HAND_PANEL);
}
+
+ @Override
+ public void setStoneCollectionHidden(boolean enable) {
+ table.getStoneCollectionPanel().setHidden(enable);
+ }
}