summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/util/Event2.java
diff options
context:
space:
mode:
authorJannis Harder <harder@informatik.uni-luebeck.de>2011-05-05 19:49:59 +0200
committerJannis Harder <harder@informatik.uni-luebeck.de>2011-05-05 19:49:59 +0200
commit5c94d4f9a0648fcd36db3292abf229fb0767698a (patch)
tree2ecf62a1662dc1ca7aada951a6fcefd763a97c0a /src/jrummikub/util/Event2.java
parent53824198db2bade71c895c91caab14f338139fd2 (diff)
downloadJRummikub-5c94d4f9a0648fcd36db3292abf229fb0767698a.tar
JRummikub-5c94d4f9a0648fcd36db3292abf229fb0767698a.zip
Implemented Connection creation in event classes
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@151 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/util/Event2.java')
-rw-r--r--src/jrummikub/util/Event2.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/jrummikub/util/Event2.java b/src/jrummikub/util/Event2.java
index 4b6575f..7087975 100644
--- a/src/jrummikub/util/Event2.java
+++ b/src/jrummikub/util/Event2.java
@@ -14,9 +14,15 @@ public class Event2<T1, T2> implements IEvent2<T1, T2> {
private HashSet<IListener2<T1, T2>> listeners = new HashSet<IListener2<T1, T2>>();
@Override
- public Connection add(IListener2<T1, T2> listener) {
+ public Connection add(final IListener2<T1, T2> listener) {
listeners.add(listener);
- return null;
+ return new Connection() {
+
+ @Override
+ public void remove() {
+ Event2.this.remove(listener);
+ }
+ };
}
@Override