From 62a55c0a918b1d91338a68ee89211006e11785bf Mon Sep 17 00:00:00 2001 From: Jannis Harder Date: Wed, 22 Jun 2011 02:00:06 +0200 Subject: Fixed warnings panel git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@569 72836036-5685-4462-b002-a69064685172 --- src/jrummikub/control/ApplicationControl.java | 36 +++++++++++++++++++++------ src/jrummikub/control/SaveControl.java | 10 ++++++++ 2 files changed, 38 insertions(+), 8 deletions(-) (limited to 'src/jrummikub') 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() { @@ -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() { @Override public void handle(final File file) { -- cgit v1.2.3