summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/data
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
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')
-rw-r--r--src/com/vaadin/data/util/AbstractContainer.java21
-rw-r--r--src/com/vaadin/data/util/AbstractProperty.java22
-rw-r--r--src/com/vaadin/data/util/IndexedContainer.java13
-rw-r--r--src/com/vaadin/data/util/PropertysetItem.java13
4 files changed, 69 insertions, 0 deletions
diff --git a/src/com/vaadin/data/util/AbstractContainer.java b/src/com/vaadin/data/util/AbstractContainer.java
index 53b9e75ba8..eed58c578a 100644
--- a/src/com/vaadin/data/util/AbstractContainer.java
+++ b/src/com/vaadin/data/util/AbstractContainer.java
@@ -2,6 +2,7 @@ package com.vaadin.data.util;
import java.io.Serializable;
import java.util.Collection;
+import java.util.Collections;
import java.util.EventObject;
import java.util.LinkedList;
@@ -222,4 +223,24 @@ public abstract class AbstractContainer implements Container {
return itemSetChangeListeners;
}
+ public Collection<?> getListeners(Class<?> eventType) {
+ if (Container.PropertySetChangeEvent.class.isAssignableFrom(eventType)) {
+ if (propertySetChangeListeners == null) {
+ return Collections.EMPTY_LIST;
+ } else {
+ return Collections
+ .unmodifiableCollection(propertySetChangeListeners);
+ }
+ } else if (Container.ItemSetChangeEvent.class
+ .isAssignableFrom(eventType)) {
+ if (itemSetChangeListeners == null) {
+ return Collections.EMPTY_LIST;
+ } else {
+ return Collections
+ .unmodifiableCollection(itemSetChangeListeners);
+ }
+ }
+
+ return Collections.EMPTY_LIST;
+ }
}
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;
+ }
+
}
diff --git a/src/com/vaadin/data/util/IndexedContainer.java b/src/com/vaadin/data/util/IndexedContainer.java
index 11e4c702ed..11ab3c2728 100644
--- a/src/com/vaadin/data/util/IndexedContainer.java
+++ b/src/com/vaadin/data/util/IndexedContainer.java
@@ -532,6 +532,19 @@ public class IndexedContainer extends
}
@Override
+ public Collection<?> getListeners(Class<?> eventType) {
+ if (Property.ValueChangeEvent.class.isAssignableFrom(eventType)) {
+ if (propertyValueChangeListeners == null) {
+ return Collections.EMPTY_LIST;
+ } else {
+ return Collections
+ .unmodifiableCollection(propertyValueChangeListeners);
+ }
+ }
+ return super.getListeners(eventType);
+ }
+
+ @Override
protected void fireItemAdded(int position, Object itemId, Item item) {
if (position >= 0) {
fireItemSetChange(new IndexedContainer.ItemSetChangeEvent(this,
diff --git a/src/com/vaadin/data/util/PropertysetItem.java b/src/com/vaadin/data/util/PropertysetItem.java
index 75f9114bc7..38be8561d0 100644
--- a/src/com/vaadin/data/util/PropertysetItem.java
+++ b/src/com/vaadin/data/util/PropertysetItem.java
@@ -220,6 +220,19 @@ public class PropertysetItem implements Item, Item.PropertySetChangeNotifier,
}
}
+ public Collection<?> getListeners(Class<?> eventType) {
+ if (Item.PropertySetChangeEvent.class.isAssignableFrom(eventType)) {
+ if (propertySetChangeListeners == null) {
+ return Collections.EMPTY_LIST;
+ } else {
+ return Collections
+ .unmodifiableCollection(propertySetChangeListeners);
+ }
+ }
+
+ return Collections.EMPTY_LIST;
+ }
+
/**
* Creates and returns a copy of this object.
* <p>