diff options
author | Ida Massow <massow@informatik.uni-luebeck.de> | 2011-06-19 16:11:20 +0200 |
---|---|---|
committer | Ida Massow <massow@informatik.uni-luebeck.de> | 2011-06-19 16:11:20 +0200 |
commit | 92fe29000b3a8da2adc498154521e7969b6f9c5f (patch) | |
tree | 03017bc91e5903ac011ae1a833bca82136871159 /src/jrummikub/control | |
parent | 0506b7f154a816d591f580466a294e1b6820774b (diff) | |
download | JRummikub-92fe29000b3a8da2adc498154521e7969b6f9c5f.tar JRummikub-92fe29000b3a8da2adc498154521e7969b6f9c5f.zip |
Load error, save default file, save disable
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@483 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/control')
-rw-r--r-- | src/jrummikub/control/ApplicationControl.java | 8 | ||||
-rw-r--r-- | src/jrummikub/control/SaveControl.java | 11 |
2 files changed, 16 insertions, 3 deletions
diff --git a/src/jrummikub/control/ApplicationControl.java b/src/jrummikub/control/ApplicationControl.java index bcf497f..d07a0f6 100644 --- a/src/jrummikub/control/ApplicationControl.java +++ b/src/jrummikub/control/ApplicationControl.java @@ -65,6 +65,12 @@ public class ApplicationControl { } }); + saveControl.getLoadErrorEvent().add(new IListener() { + @Override + public void handle() { + view.showError(); + } + }); } private void addLoginControlListeners() { @@ -123,10 +129,12 @@ public class ApplicationControl { saveControl.setGameState(null); settingsControl = new SettingsControl(view, new GameSettings()); + view.enableSave(false); settingsControl.getStartGameEvent().add(new IListener1<GameSettings>() { @Override public void handle(GameSettings settings) { + view.enableSave(true); settingsControl = null; saveControl.setGameSettings(settings); diff --git a/src/jrummikub/control/SaveControl.java b/src/jrummikub/control/SaveControl.java index bebe6c5..3e12a9d 100644 --- a/src/jrummikub/control/SaveControl.java +++ b/src/jrummikub/control/SaveControl.java @@ -9,6 +9,7 @@ import java.io.ObjectOutputStream; import jrummikub.model.GameSettings; import jrummikub.model.GameState; import jrummikub.model.IRoundState; +import jrummikub.util.Event; import jrummikub.util.Event3; import jrummikub.util.IEvent3; import jrummikub.util.IListener1; @@ -22,6 +23,7 @@ public class SaveControl { private GameState gameState; private IRoundState roundState; private Event3<GameSettings, GameState, IRoundState> loadEvent = new Event3<GameSettings, GameState, IRoundState>(); + private Event loadErrorEvent = new Event(); /** * Creates a new SaveControl @@ -96,17 +98,20 @@ public class SaveControl { stream.close(); if (gameState == null || gameSettings == null) { - // TODO Fehlermeldung - System.err.println("laden ging nicht"); + loadErrorEvent.emit(); return; } loadEvent.emit(gameSettings, gameState, roundState); } catch (Exception e) { - e.printStackTrace(); + loadErrorEvent.emit(); } } + + public Event getLoadErrorEvent(){ + return loadErrorEvent; + } private void save(File file) { if (gameState == null || gameSettings == null) { |