summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/control/network
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-06-10 17:32:44 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-06-10 17:32:44 +0200
commit8197b36e2b53d17ca4cd501fb5f3975e7bb5cbb8 (patch)
treebf8d311cd39a06b8e7b93e0ec4fe24fbeedb659a /src/jrummikub/control/network
parentec53437da1d1ddd56fc4a4ba5429d1f3e9c5c558 (diff)
downloadJRummikub-8197b36e2b53d17ca4cd501fb5f3975e7bb5cbb8.tar
JRummikub-8197b36e2b53d17ca4cd501fb5f3975e7bb5cbb8.zip
Use login control for displaying login panel
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@399 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/control/network')
-rw-r--r--src/jrummikub/control/network/LoginControl.java25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/jrummikub/control/network/LoginControl.java b/src/jrummikub/control/network/LoginControl.java
index e03625d..07e0b71 100644
--- a/src/jrummikub/control/network/LoginControl.java
+++ b/src/jrummikub/control/network/LoginControl.java
@@ -1,5 +1,9 @@
package jrummikub.control.network;
+import java.util.ArrayList;
+import java.util.List;
+
+import jrummikub.util.Connection;
import jrummikub.util.Event;
import jrummikub.util.Event3;
import jrummikub.util.IEvent;
@@ -12,30 +16,30 @@ public class LoginControl {
private IView view;
private Event3<String, String, String> loginEvent = new Event3<String, String, String>();
private Event cancelEvent = new Event();
+ private List<Connection> connections = new ArrayList<Connection>();
public LoginControl(final IView view) {
this.view = view;
- view.getLoginPanel().getLoginEvent()
+ connections.add(view.getLoginPanel().getLoginEvent()
.add(new IListener3<String, String, String>() {
@Override
public void handle(String userName, String password,
String channelName) {
- view.showLoginPanel(false);
+ abort();
loginEvent.emit(userName, password, channelName);
}
- });
+ }));
- view.getLoginPanel().getCancelEvent().add(new IListener() {
+ connections.add(view.getLoginPanel().getCancelEvent().add(new IListener() {
@Override
public void handle() {
- view.showLoginPanel(false);
+ abort();
cancelEvent.emit();
}
- });
+ }));
}
public void startLogin() {
- view.clearView();
view.showLoginPanel(true);
}
@@ -47,4 +51,11 @@ public class LoginControl {
return cancelEvent;
}
+ public void abort() {
+ view.showLoginPanel(false);
+ for (Connection c : connections) {
+ c.remove();
+ }
+ }
+
}