summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/view/impl/View.java
diff options
context:
space:
mode:
authorIda Massow <massow@informatik.uni-luebeck.de>2011-06-11 00:02:42 +0200
committerIda Massow <massow@informatik.uni-luebeck.de>2011-06-11 00:02:42 +0200
commitcc4797fd8b894cc7e02346dc93f891cccb4c0a09 (patch)
treecfa8d3777d8b07ce488573a80ae04ff5aeed1775 /src/jrummikub/view/impl/View.java
parent9c553786f2e0e395149a5ef5e27d24d7d944fe3e (diff)
downloadJRummikub-cc4797fd8b894cc7e02346dc93f891cccb4c0a09.tar
JRummikub-cc4797fd8b894cc7e02346dc93f891cccb4c0a09.zip
Netzwerk hat Panel mit laufenden Spielen und einem funktionierenden Abbrechen-Button
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@406 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/view/impl/View.java')
-rw-r--r--src/jrummikub/view/impl/View.java72
1 files changed, 47 insertions, 25 deletions
diff --git a/src/jrummikub/view/impl/View.java b/src/jrummikub/view/impl/View.java
index 99e8924..01623d2 100644
--- a/src/jrummikub/view/impl/View.java
+++ b/src/jrummikub/view/impl/View.java
@@ -31,6 +31,7 @@ import jrummikub.util.IEvent;
import jrummikub.util.IEvent1;
import jrummikub.util.IListener;
import jrummikub.util.Pair;
+import jrummikub.view.IGameListPanel;
import jrummikub.view.IHandPanel;
import jrummikub.view.ILoginPanel;
import jrummikub.view.IPlayerPanel;
@@ -60,6 +61,7 @@ public class View extends JFrame implements IView {
private SettingsPanel settingsPanel;
private LoginPanel loginPanel;
private ScorePanel scorePanel;
+ private GameListPanel gameListPanel;
private BottomPanelType bottomPanelType;
@@ -107,6 +109,11 @@ public class View extends JFrame implements IView {
}
@Override
+ public IGameListPanel getGameListPanel() {
+ return gameListPanel;
+ }
+
+ @Override
public IEvent getMenuNewGameEvent() {
return menuNewGameEvent;
}
@@ -146,7 +153,9 @@ public class View extends JFrame implements IView {
showScorePanel(false);
showSettingsPanel(false);
showLoginPanel(false);
- getHandPanel().setStones(Collections.<Pair<Stone, Position>> emptyList());
+ showGameListPanel(false);
+ getHandPanel().setStones(
+ Collections.<Pair<Stone, Position>> emptyList());
getTablePanel().setStoneSets(
Collections.<Pair<StoneSet, Position>> emptyList());
setSelectedStones(Collections.<Stone> emptyList());
@@ -249,6 +258,12 @@ public class View extends JFrame implements IView {
layeredPane.setLayer(loginPanel, JLayeredPane.POPUP_LAYER);
layeredPane.add(loginPanel);
+ gameListPanel = new GameListPanel();
+ gameListPanel.setVisible(false);
+
+ layeredPane.setLayer(gameListPanel, JLayeredPane.POPUP_LAYER);
+ layeredPane.add(gameListPanel);
+
scorePanel = new ScorePanel();
scorePanel.setVisible(false);
layeredPane.setLayer(scorePanel, JLayeredPane.POPUP_LAYER);
@@ -291,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();
@@ -340,6 +355,7 @@ public class View extends JFrame implements IView {
settingsPanel.setBounds(width / 4, height / 4, width / 2, height / 2);
scorePanel.setBounds(width / 8, height / 4, width * 3 / 4, height / 2);
loginPanel.setBounds(width / 3, height / 3, width / 3, height / 3);
+ gameListPanel.setBounds(width / 4, height / 4, width / 2, height / 2);
}
@Override
@@ -363,6 +379,11 @@ public class View extends JFrame implements IView {
}
@Override
+ public void showGameListPanel(boolean show) {
+ gameListPanel.setVisible(show);
+ }
+
+ @Override
public void showScorePanel(boolean show) {
scorePanel.setVisible(show);
}
@@ -406,24 +427,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));
@@ -438,9 +459,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
@@ -457,7 +478,8 @@ public class View extends JFrame implements IView {
&& 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());
}