diff options
-rw-r--r-- | mock/jrummikub/view/MockSidePanel.java | 16 | ||||
-rw-r--r-- | mock/jrummikub/view/MockView.java | 11 | ||||
-rw-r--r-- | src/jrummikub/control/ApplicationControl.java | 1 | ||||
-rw-r--r-- | src/jrummikub/control/GameControl.java | 1 | ||||
-rw-r--r-- | src/jrummikub/view/IView.java | 8 | ||||
-rw-r--r-- | src/jrummikub/view/impl/SidePanel.java | 2 | ||||
-rw-r--r-- | src/jrummikub/view/impl/View.java | 13 |
7 files changed, 49 insertions, 3 deletions
diff --git a/mock/jrummikub/view/MockSidePanel.java b/mock/jrummikub/view/MockSidePanel.java new file mode 100644 index 0000000..af103a6 --- /dev/null +++ b/mock/jrummikub/view/MockSidePanel.java @@ -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 + + } + +} diff --git a/mock/jrummikub/view/MockView.java b/mock/jrummikub/view/MockView.java index d5fd88a..2e155e4 100644 --- a/mock/jrummikub/view/MockView.java +++ b/mock/jrummikub/view/MockView.java @@ -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 + + } + } diff --git a/src/jrummikub/control/ApplicationControl.java b/src/jrummikub/control/ApplicationControl.java index 1ed517f..2271526 100644 --- a/src/jrummikub/control/ApplicationControl.java +++ b/src/jrummikub/control/ApplicationControl.java @@ -123,6 +123,7 @@ public class ApplicationControl { * Starts the application by showing the game settings dialog panel */ public void startApplication() { + view.showSidePanel(false); view.showScorePanel(false); view.setBottomPanel(BottomPanelType.START_GAME_PANEL); saveControl.setGameSettings(null); diff --git a/src/jrummikub/control/GameControl.java b/src/jrummikub/control/GameControl.java index 7149464..babca99 100644 --- a/src/jrummikub/control/GameControl.java +++ b/src/jrummikub/control/GameControl.java @@ -98,6 +98,7 @@ public class GameControl { */ public void startGame() { view.getSidePanel().setGameSettings(gameSettings); + view.showSidePanel(true); startRound(); } diff --git a/src/jrummikub/view/IView.java b/src/jrummikub/view/IView.java index 00e286d..cb4846d 100644 --- a/src/jrummikub/view/IView.java +++ b/src/jrummikub/view/IView.java @@ -245,6 +245,14 @@ public interface IView { 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 * * @param points diff --git a/src/jrummikub/view/impl/SidePanel.java b/src/jrummikub/view/impl/SidePanel.java index fd0d376..9e83c91 100644 --- a/src/jrummikub/view/impl/SidePanel.java +++ b/src/jrummikub/view/impl/SidePanel.java @@ -87,7 +87,7 @@ class SidePanel extends JPanel implements ISidePanel { JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); initialMeldLabel = createRuleLine(panel, "Auslegeschranke", 0); - setNumberLabel = createRuleLine(panel, "Steinsätze", 1); + setNumberLabel = createRuleLine(panel, "Steins\u00e4tze", 1); highestValueLabel = createRuleLine(panel,"Steinwert", 2); handStonesLabel = createRuleLine(panel, "Startsteine", 3); jokerLabel = createRuleLine(panel, "Joker", 4); diff --git a/src/jrummikub/view/impl/View.java b/src/jrummikub/view/impl/View.java index 5755c73..caac01f 100644 --- a/src/jrummikub/view/impl/View.java +++ b/src/jrummikub/view/impl/View.java @@ -349,6 +349,7 @@ public class View extends JFrame implements IView { mainLayer.add(winPanel); sidePanel = new SidePanel(); + sidePanel.setVisible(false); mainLayer.add(sidePanel); sidePanel.setBorder(new MatteBorder(0, 0, TABLE_BORDER_WIDTH, 0, Color.BLACK)); @@ -379,11 +380,13 @@ public class View extends JFrame implements IView { playerPanel.setBounds(0, tableHeight, width, playerPanelHeight); playerPanel.rescale(); - int sideWidth = playerPanel.getLeftPanelWidth() + 1; + int sideWidth = sidePanel.isVisible() ? playerPanel.getLeftPanelWidth() + 1 : 0; table.setBounds(sideWidth, 0, width - sideWidth, tableHeight); table.validate(); - sidePanel.setBounds(0, 0, sideWidth, tableHeight); + if (sidePanel.isVisible()) { + sidePanel.setBounds(0, 0, sideWidth, tableHeight); + } startTurnPanel.setBounds(0, tableHeight, width, playerPanelHeight); pausePanel.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) { scorePanel.setVisible(show); } + + @Override + public void showSidePanel(boolean show) { + sidePanel.setVisible(show); + rescale(); + } @Override public void setCurrentPlayerName(String playerName) { |