From ec53437da1d1ddd56fc4a4ba5429d1f3e9c5c558 Mon Sep 17 00:00:00 2001 From: Ida Massow Date: Fri, 10 Jun 2011 17:05:50 +0200 Subject: LoginControl ist fertig und getestet git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@398 72836036-5685-4462-b002-a69064685172 --- src/jrummikub/control/network/LoginControl.java | 26 ++++++++++++++++++++++++- src/jrummikub/view/impl/View.java | 1 + 2 files changed, 26 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/jrummikub/control/network/LoginControl.java b/src/jrummikub/control/network/LoginControl.java index a9dd5e8..e03625d 100644 --- a/src/jrummikub/control/network/LoginControl.java +++ b/src/jrummikub/control/network/LoginControl.java @@ -4,6 +4,8 @@ import jrummikub.util.Event; import jrummikub.util.Event3; import jrummikub.util.IEvent; import jrummikub.util.IEvent3; +import jrummikub.util.IListener; +import jrummikub.util.IListener3; import jrummikub.view.IView; public class LoginControl { @@ -11,8 +13,30 @@ public class LoginControl { private Event3 loginEvent = new Event3(); private Event cancelEvent = new Event(); - public LoginControl(IView view) { + public LoginControl(final IView view) { this.view = view; + view.getLoginPanel().getLoginEvent() + .add(new IListener3() { + @Override + public void handle(String userName, String password, + String channelName) { + view.showLoginPanel(false); + loginEvent.emit(userName, password, channelName); + } + }); + + view.getLoginPanel().getCancelEvent().add(new IListener() { + @Override + public void handle() { + view.showLoginPanel(false); + cancelEvent.emit(); + } + }); + } + + public void startLogin() { + view.clearView(); + view.showLoginPanel(true); } public IEvent3 getLoginEvent() { diff --git a/src/jrummikub/view/impl/View.java b/src/jrummikub/view/impl/View.java index 4f4fc53..ab6b4c2 100644 --- a/src/jrummikub/view/impl/View.java +++ b/src/jrummikub/view/impl/View.java @@ -144,6 +144,7 @@ public class View extends JFrame implements IView { public void clearView() { showScorePanel(false); showSettingsPanel(false); + showLoginPanel(false); getHandPanel().setStones( Collections.> emptyList()); getTablePanel().setStoneSets( -- cgit v1.2.3