summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/data/util/AbstractProperty.java
diff options
context:
space:
mode:
authorArtur Signell <artur.signell@itmill.com>2011-04-19 13:20:32 +0000
committerArtur Signell <artur.signell@itmill.com>2011-04-19 13:20:32 +0000
commit88b3d7f78058f9c3b5b8e32982840d7280c0efab (patch)
treec13d26ffcc0a5a0f25d60030d76ea45970dccf2f /src/com/vaadin/data/util/AbstractProperty.java
parent8c57382cbf0b4ff6fb45b3a28a021edb288ed936 (diff)
downloadvaadin-framework-88b3d7f78058f9c3b5b8e32982840d7280c0efab.tar.gz
vaadin-framework-88b3d7f78058f9c3b5b8e32982840d7280c0efab.zip
#1410 getListeners method for all classes that have addListener/removeListener
svn changeset:18390/svn branch:6.6
Diffstat (limited to 'src/com/vaadin/data/util/AbstractProperty.java')
-rw-r--r--src/com/vaadin/data/util/AbstractProperty.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/com/vaadin/data/util/AbstractProperty.java b/src/com/vaadin/data/util/AbstractProperty.java
index 2b3fcf2c93..953ab664a3 100644
--- a/src/com/vaadin/data/util/AbstractProperty.java
+++ b/src/com/vaadin/data/util/AbstractProperty.java
@@ -1,5 +1,7 @@
package com.vaadin.data.util;
+import java.util.Collection;
+import java.util.Collections;
import java.util.LinkedList;
import com.vaadin.data.Property;
@@ -191,4 +193,24 @@ public abstract class AbstractProperty implements Property,
}
}
+ public Collection<?> getListeners(Class<?> eventType) {
+ if (Property.ValueChangeEvent.class.isAssignableFrom(eventType)) {
+ if (valueChangeListeners == null) {
+ return Collections.EMPTY_LIST;
+ } else {
+ return Collections.unmodifiableCollection(valueChangeListeners);
+ }
+ } else if (Property.ReadOnlyStatusChangeEvent.class
+ .isAssignableFrom(eventType)) {
+ if (readOnlyStatusChangeListeners == null) {
+ return Collections.EMPTY_LIST;
+ } else {
+ return Collections
+ .unmodifiableCollection(readOnlyStatusChangeListeners);
+ }
+ }
+
+ return Collections.EMPTY_LIST;
+ }
+
}