Show side panel only ingame

git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@487 72836036-5685-4462-b002-a69064685172
This commit is contained in:
Jannis Harder 2011-06-19 18:53:02 +02:00
parent 705698670a
commit dcf87994cb
7 changed files with 49 additions and 3 deletions

View file

@ -0,0 +1,16 @@
package jrummikub.view;
import jrummikub.model.GameSettings;
/**
* Mock class for the side panel
*/
public class MockSidePanel implements ISidePanel {
@Override
public void setGameSettings(GameSettings settings) {
// TODO Auto-generated method stub
}
}

View file

@ -256,4 +256,15 @@ public class MockView implements IView {
} }
@Override
public ISidePanel getSidePanel() {
return new MockSidePanel();
}
@Override
public void showSidePanel(boolean show) {
// TODO Auto-generated method stub
}
} }

View file

@ -123,6 +123,7 @@ public class ApplicationControl {
* Starts the application by showing the game settings dialog panel * Starts the application by showing the game settings dialog panel
*/ */
public void startApplication() { public void startApplication() {
view.showSidePanel(false);
view.showScorePanel(false); view.showScorePanel(false);
view.setBottomPanel(BottomPanelType.START_GAME_PANEL); view.setBottomPanel(BottomPanelType.START_GAME_PANEL);
saveControl.setGameSettings(null); saveControl.setGameSettings(null);

View file

@ -98,6 +98,7 @@ public class GameControl {
*/ */
public void startGame() { public void startGame() {
view.getSidePanel().setGameSettings(gameSettings); view.getSidePanel().setGameSettings(gameSettings);
view.showSidePanel(true);
startRound(); startRound();
} }

View file

@ -244,6 +244,14 @@ public interface IView {
*/ */
public void showGameListPanel(boolean show); public void showGameListPanel(boolean show);
/**
* Show/hide side panel
*
* @param show
* true to show
*/
void showSidePanel(boolean show);
/** /**
* Is set if a player tried to lay out less than initial meld threshold * Is set if a player tried to lay out less than initial meld threshold
* *

View file

@ -87,7 +87,7 @@ class SidePanel extends JPanel implements ISidePanel {
JPanel panel = new JPanel(); JPanel panel = new JPanel();
panel.setLayout(new GridBagLayout()); panel.setLayout(new GridBagLayout());
initialMeldLabel = createRuleLine(panel, "Auslegeschranke", 0); initialMeldLabel = createRuleLine(panel, "Auslegeschranke", 0);
setNumberLabel = createRuleLine(panel, "Steinsätze", 1); setNumberLabel = createRuleLine(panel, "Steins\u00e4tze", 1);
highestValueLabel = createRuleLine(panel,"Steinwert", 2); highestValueLabel = createRuleLine(panel,"Steinwert", 2);
handStonesLabel = createRuleLine(panel, "Startsteine", 3); handStonesLabel = createRuleLine(panel, "Startsteine", 3);
jokerLabel = createRuleLine(panel, "Joker", 4); jokerLabel = createRuleLine(panel, "Joker", 4);

View file

@ -349,6 +349,7 @@ public class View extends JFrame implements IView {
mainLayer.add(winPanel); mainLayer.add(winPanel);
sidePanel = new SidePanel(); sidePanel = new SidePanel();
sidePanel.setVisible(false);
mainLayer.add(sidePanel); mainLayer.add(sidePanel);
sidePanel.setBorder(new MatteBorder(0, 0, TABLE_BORDER_WIDTH, 0, sidePanel.setBorder(new MatteBorder(0, 0, TABLE_BORDER_WIDTH, 0,
Color.BLACK)); Color.BLACK));
@ -379,11 +380,13 @@ public class View extends JFrame implements IView {
playerPanel.setBounds(0, tableHeight, width, playerPanelHeight); playerPanel.setBounds(0, tableHeight, width, playerPanelHeight);
playerPanel.rescale(); playerPanel.rescale();
int sideWidth = playerPanel.getLeftPanelWidth() + 1; int sideWidth = sidePanel.isVisible() ? playerPanel.getLeftPanelWidth() + 1 : 0;
table.setBounds(sideWidth, 0, width - sideWidth, tableHeight); table.setBounds(sideWidth, 0, width - sideWidth, tableHeight);
table.validate(); table.validate();
sidePanel.setBounds(0, 0, sideWidth, tableHeight); if (sidePanel.isVisible()) {
sidePanel.setBounds(0, 0, sideWidth, tableHeight);
}
startTurnPanel.setBounds(0, tableHeight, width, playerPanelHeight); startTurnPanel.setBounds(0, tableHeight, width, playerPanelHeight);
pausePanel.setBounds(0, tableHeight, width, playerPanelHeight); pausePanel.setBounds(0, tableHeight, width, playerPanelHeight);
winPanel.setBounds(0, tableHeight, width, playerPanelHeight); winPanel.setBounds(0, tableHeight, width, playerPanelHeight);
@ -446,6 +449,12 @@ public class View extends JFrame implements IView {
public void showScorePanel(boolean show) { public void showScorePanel(boolean show) {
scorePanel.setVisible(show); scorePanel.setVisible(show);
} }
@Override
public void showSidePanel(boolean show) {
sidePanel.setVisible(show);
rescale();
}
@Override @Override
public void setCurrentPlayerName(String playerName) { public void setCurrentPlayerName(String playerName) {