summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/view
diff options
context:
space:
mode:
Diffstat (limited to 'src/jrummikub/view')
-rw-r--r--src/jrummikub/view/IView.java6
-rw-r--r--src/jrummikub/view/impl/StartTurnPanel.java12
-rw-r--r--src/jrummikub/view/impl/View.java8
3 files changed, 23 insertions, 3 deletions
diff --git a/src/jrummikub/view/IView.java b/src/jrummikub/view/IView.java
index c8f7ce0..72c3808 100644
--- a/src/jrummikub/view/IView.java
+++ b/src/jrummikub/view/IView.java
@@ -86,7 +86,9 @@ public interface IView {
*
* @return the event
*/
- IEvent getAcknowledgeInvalidEvent();
+ public IEvent getAcknowledgeInvalidEvent();
+
+ public IEvent getAcknowledgeConnectionLostEvent();
/**
* The quit event is emitted when the player wants to quit the game
@@ -367,6 +369,6 @@ public interface IView {
* Different types of bottom panels
*/
public enum BottomPanelType {
- START_GAME_PANEL, START_TURN_PANEL, START_REDEAL_TURN_PANEL, START_LAST_TURN_PANEL, INVALID_TURN_PANEL, HUMAN_HAND_PANEL, NONHUMAN_HAND_PANEL, WIN_PANEL, NETWORK_WIN_PANEL, NETWORK_CONNECTION_LOST_PANEL
+ START_GAME_PANEL, START_TURN_PANEL, START_REDEAL_TURN_PANEL, START_LAST_TURN_PANEL, INVALID_TURN_PANEL, HUMAN_HAND_PANEL, NONHUMAN_HAND_PANEL, WIN_PANEL, NETWORK_WIN_PANEL, NETWORK_CONNECTION_LOST_PANEL, NETWORK_SERVER_CONNECTION_LOST_PANEL
}
}
diff --git a/src/jrummikub/view/impl/StartTurnPanel.java b/src/jrummikub/view/impl/StartTurnPanel.java
index d3f139d..4f1a8e4 100644
--- a/src/jrummikub/view/impl/StartTurnPanel.java
+++ b/src/jrummikub/view/impl/StartTurnPanel.java
@@ -33,6 +33,7 @@ class StartTurnPanel extends JPanel {
private Event startTurnEvent = new Event();
private Event acknowledgeInvalidEvent = new Event();
+ private Event acknowledgeConnectionLostEvent = new Event();
private Event buttonEvent = startTurnEvent;
private BottomPanelType type;
@@ -97,6 +98,10 @@ class StartTurnPanel extends JPanel {
return acknowledgeInvalidEvent;
}
+ IEvent getAcknowledgeConnectionLostEvent() {
+ return acknowledgeConnectionLostEvent;
+ }
+
private void rescale() {
Insets insets = getInsets();
int x = insets.left, y = insets.top, width = getWidth() - insets.left
@@ -184,6 +189,13 @@ class StartTurnPanel extends JPanel {
startTurnButton.setText("N\u00E4chster Spieler");
buttonEvent = acknowledgeInvalidEvent;
break;
+
+ case NETWORK_SERVER_CONNECTION_LOST_PANEL:
+ startTurnLabel.setIcon(null);
+ startTurnLabel.setText("Die Verbindung zum Server wurde getrennt.");
+ startTurnButton.setText("OK");
+ buttonEvent = acknowledgeConnectionLostEvent;
+ break;
}
rescale();
diff --git a/src/jrummikub/view/impl/View.java b/src/jrummikub/view/impl/View.java
index 34ae800..06e2721 100644
--- a/src/jrummikub/view/impl/View.java
+++ b/src/jrummikub/view/impl/View.java
@@ -605,6 +605,11 @@ public class View extends JFrame implements IView {
}
@Override
+ public IEvent getAcknowledgeConnectionLostEvent() {
+ return startTurnPanel.getAcknowledgeConnectionLostEvent();
+ }
+
+ @Override
public IEvent getNewRoundEvent() {
return roundEndPanel.getNewRoundEvent();
}
@@ -667,7 +672,8 @@ public class View extends JFrame implements IView {
private void doSetBottomPanel(BottomPanelType type) {
boolean showStartTurnPanel = (type == BottomPanelType.START_TURN_PANEL
|| type == BottomPanelType.START_REDEAL_TURN_PANEL
- || type == BottomPanelType.START_LAST_TURN_PANEL || type == BottomPanelType.INVALID_TURN_PANEL);
+ || type == BottomPanelType.START_LAST_TURN_PANEL
+ || type == BottomPanelType.INVALID_TURN_PANEL || type == BottomPanelType.NETWORK_SERVER_CONNECTION_LOST_PANEL);
startTurnPanel.setType(type);
startTurnPanel.setVisible(showStartTurnPanel);