From e4ac4b55cd048f83b0c545026191c6df2ae990d0 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 10 Jun 2011 17:47:45 +0200 Subject: Move LoginControl to control package git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@402 72836036-5685-4462-b002-a69064685172 --- src/jrummikub/control/ApplicationControl.java | 1 - src/jrummikub/control/LoginControl.java | 61 +++++++++++++++++++++++++ src/jrummikub/control/network/LoginControl.java | 61 ------------------------- 3 files changed, 61 insertions(+), 62 deletions(-) create mode 100644 src/jrummikub/control/LoginControl.java delete mode 100644 src/jrummikub/control/network/LoginControl.java (limited to 'src/jrummikub') diff --git a/src/jrummikub/control/ApplicationControl.java b/src/jrummikub/control/ApplicationControl.java index 895733b..5cd1116 100644 --- a/src/jrummikub/control/ApplicationControl.java +++ b/src/jrummikub/control/ApplicationControl.java @@ -1,6 +1,5 @@ package jrummikub.control; -import jrummikub.control.network.LoginControl; import jrummikub.model.GameSettings; import jrummikub.model.GameState; import jrummikub.model.IRoundState; diff --git a/src/jrummikub/control/LoginControl.java b/src/jrummikub/control/LoginControl.java new file mode 100644 index 0000000..233a2d3 --- /dev/null +++ b/src/jrummikub/control/LoginControl.java @@ -0,0 +1,61 @@ +package jrummikub.control; + +import java.util.ArrayList; +import java.util.List; + +import jrummikub.util.Connection; +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 { + private IView view; + private Event3 loginEvent = new Event3(); + private Event cancelEvent = new Event(); + private List connections = new ArrayList(); + + public LoginControl(final IView view) { + this.view = view; + connections.add(view.getLoginPanel().getLoginEvent() + .add(new IListener3() { + @Override + public void handle(String userName, String password, + String channelName) { + abort(); + loginEvent.emit(userName, password, channelName); + } + })); + + connections.add(view.getLoginPanel().getCancelEvent().add(new IListener() { + @Override + public void handle() { + abort(); + cancelEvent.emit(); + } + })); + } + + public void startLogin() { + view.showLoginPanel(true); + } + + public IEvent3 getLoginEvent() { + return loginEvent; + } + + public IEvent getCancelEvent() { + return cancelEvent; + } + + public void abort() { + view.showLoginPanel(false); + for (Connection c : connections) { + c.remove(); + } + } + +} diff --git a/src/jrummikub/control/network/LoginControl.java b/src/jrummikub/control/network/LoginControl.java deleted file mode 100644 index 07e0b71..0000000 --- a/src/jrummikub/control/network/LoginControl.java +++ /dev/null @@ -1,61 +0,0 @@ -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; -import jrummikub.util.IEvent3; -import jrummikub.util.IListener; -import jrummikub.util.IListener3; -import jrummikub.view.IView; - -public class LoginControl { - private IView view; - private Event3 loginEvent = new Event3(); - private Event cancelEvent = new Event(); - private List connections = new ArrayList(); - - public LoginControl(final IView view) { - this.view = view; - connections.add(view.getLoginPanel().getLoginEvent() - .add(new IListener3() { - @Override - public void handle(String userName, String password, - String channelName) { - abort(); - loginEvent.emit(userName, password, channelName); - } - })); - - connections.add(view.getLoginPanel().getCancelEvent().add(new IListener() { - @Override - public void handle() { - abort(); - cancelEvent.emit(); - } - })); - } - - public void startLogin() { - view.showLoginPanel(true); - } - - public IEvent3 getLoginEvent() { - return loginEvent; - } - - public IEvent getCancelEvent() { - return cancelEvent; - } - - public void abort() { - view.showLoginPanel(false); - for (Connection c : connections) { - c.remove(); - } - } - -} -- cgit v1.2.3