summaryrefslogtreecommitdiffstats
path: root/src/jrummikub
diff options
context:
space:
mode:
authorJannis Harder <harder@informatik.uni-luebeck.de>2011-06-22 02:00:06 +0200
committerJannis Harder <harder@informatik.uni-luebeck.de>2011-06-22 02:00:06 +0200
commit62a55c0a918b1d91338a68ee89211006e11785bf (patch)
tree2a50a0f52d00b73b0a6cb7b2b37f48acb28a97b6 /src/jrummikub
parent79ae31b1c75e5f33760c500a08a504a195c565f8 (diff)
downloadJRummikub-62a55c0a918b1d91338a68ee89211006e11785bf.tar
JRummikub-62a55c0a918b1d91338a68ee89211006e11785bf.zip
Fixed warnings panel
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@569 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub')
-rw-r--r--src/jrummikub/control/ApplicationControl.java36
-rw-r--r--src/jrummikub/control/SaveControl.java10
2 files changed, 38 insertions, 8 deletions
diff --git a/src/jrummikub/control/ApplicationControl.java b/src/jrummikub/control/ApplicationControl.java
index 6909ce1..c0c3dad 100644
--- a/src/jrummikub/control/ApplicationControl.java
+++ b/src/jrummikub/control/ApplicationControl.java
@@ -43,14 +43,7 @@ public class ApplicationControl {
addQuitGameHandlers();
- view.getNetworkGameEvent().add(new IListener() {
- @Override
- public void handle() {
- abortControls();
-
- createLoginControl(true);
- }
- });
+ addNewNetworkGameHandler();
saveControl.getLoadEvent().add(
new IListener3<GameSettings, GameState, IRoundState>() {
@@ -72,6 +65,33 @@ public class ApplicationControl {
});
}
+ private void addNewNetworkGameHandler() {
+ view.getNetworkGameEvent().add(new IListener() {
+ @Override
+ public void handle() {
+ if (gameControl == null) {
+ abortControls();
+ createLoginControl(true);
+ } else {
+ showQuitWarning();
+ }
+ view.getQuitWarningPanel().setMode(QuitMode.QUIT_PROCESS);
+ view.showQuitWarningPanel(true);
+ tempConnection = view.getQuitWarningPanel().getQuitEvent()
+ .add(new IListener() {
+ @Override
+ public void handle() {
+ abortControls();
+ createLoginControl(true);
+ tempConnection.remove();
+ tempConnection = null;
+ }
+ });
+
+ }
+ });
+ }
+
private void addQuitGameHandlers() {
view.getMenuNewGameEvent().add(new IListener() {
@Override
diff --git a/src/jrummikub/control/SaveControl.java b/src/jrummikub/control/SaveControl.java
index 1b88d1c..5ecbb45 100644
--- a/src/jrummikub/control/SaveControl.java
+++ b/src/jrummikub/control/SaveControl.java
@@ -60,6 +60,16 @@ public class SaveControl {
});
}
});
+ view.getQuitWarningPanel().getCancelEvent().add(new IListener() {
+ @Override
+ public void handle() {
+ view.showQuitWarningPanel(false);
+ if (tempConnection != null) {
+ tempConnection.remove();
+ tempConnection = null;
+ }
+ }
+ });
view.getLoadFileEvent().add(new IListener1<File>() {
@Override
public void handle(final File file) {