diff options
author | Jannis Harder <harder@informatik.uni-luebeck.de> | 2011-06-22 10:38:11 +0200 |
---|---|---|
committer | Jannis Harder <harder@informatik.uni-luebeck.de> | 2011-06-22 10:38:11 +0200 |
commit | 73c1072ba68b152aeb85aa71ae751f5d8afb3a68 (patch) | |
tree | 4af4993084fbb33fedac67202adb25003d4f1380 /src | |
parent | f5aa073827980bdae3e530b6ea9d8c17807ad764 (diff) | |
download | JRummikub-73c1072ba68b152aeb85aa71ae751f5d8afb3a68.tar JRummikub-73c1072ba68b152aeb85aa71ae751f5d8afb3a68.zip |
Continued NetworkControlTest
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@592 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src')
-rw-r--r-- | src/jrummikub/control/network/NetworkControl.java | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/src/jrummikub/control/network/NetworkControl.java b/src/jrummikub/control/network/NetworkControl.java index 154ea06..d31442b 100644 --- a/src/jrummikub/control/network/NetworkControl.java +++ b/src/jrummikub/control/network/NetworkControl.java @@ -59,8 +59,8 @@ public class NetworkControl { this.connectionControl = connectionControl; this.saveControl = saveControl; - addConnectionSetupListeners(loginData, view); - addConnectionControlListeners(view); + addConnectionSetupListeners(loginData); + addConnectionControlListeners(); addViewEventListeners(); } @@ -98,11 +98,8 @@ public class NetworkControl { /** * Adds the listeners for connection control events - * - * @param view - * view for events */ - public void addConnectionControlListeners(final IView view) { + private void addConnectionControlListeners() { addOfferUpdateListener(); connections.add(connectionControl.getGameWithdrawalEvent().add( @@ -115,6 +112,24 @@ public class NetworkControl { updateGameList(); } })); + connections.add(connectionControl.getGameJoinAckEvent().add( + new IListener1<Boolean>() { + @Override + public void handle(Boolean ack) { + if (ack) { + createGameJoinControl(); + } else { + view.showGameListPanel(true); + } + } + })); + addConnectionLostListeners(); + } + + /** + * Adds the listeners for lost connection events + */ + private void addConnectionLostListeners() { connections.add(connectionControl.getParticipantLeftEvent().add( new IListener1<String>() { @Override @@ -123,23 +138,13 @@ public class NetworkControl { if (entry.getValue().getHost().equals(nickname)) { games.remove(entry.getKey()); gameMap.remove(entry.getKey()); + break; } } updateGameList(); } })); - connections.add(connectionControl.getGameJoinAckEvent().add( - new IListener1<Boolean>() { - @Override - public void handle(Boolean ack) { - if (ack) { - createGameJoinControl(); - } else { - view.showGameListPanel(true); - } - } - })); connections.add(connectionControl.getConnectionLostEvent().add( new IListener() { @Override @@ -181,8 +186,7 @@ public class NetworkControl { })); } - private void addConnectionSetupListeners(final LoginData loginData, - final IView view) { + private void addConnectionSetupListeners(final LoginData loginData) { connections.add(connectionControl.getConnectedEvent().add(new IListener() { @Override public void handle() { |