summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2009-04-04 20:27:20 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2009-04-04 20:27:20 +0000
commit60221b16a87d721a2d271f3d3ec4360a18d46c9b (patch)
treef63adcd2f2583245127addb837c9cafa76bd7967
parentc0e35f4ea8fcc7c61ae2b2d4882373217da1b3af (diff)
downloadvaadin-framework-60221b16a87d721a2d271f3d3ec4360a18d46c9b.tar.gz
vaadin-framework-60221b16a87d721a2d271f3d3ec4360a18d46c9b.zip
fixes #2823
svn changeset:7308/svn branch:6.0
-rw-r--r--src/com/itmill/toolkit/ui/Table.java34
1 files changed, 26 insertions, 8 deletions
diff --git a/src/com/itmill/toolkit/ui/Table.java b/src/com/itmill/toolkit/ui/Table.java
index b91fa614fd..1ad0eda6ad 100644
--- a/src/com/itmill/toolkit/ui/Table.java
+++ b/src/com/itmill/toolkit/ui/Table.java
@@ -1370,14 +1370,6 @@ public class Table extends AbstractSelect implements Action.Container,
// check in current pageBuffer already has row
int index = firstIndex + i;
if (p != null || isGenerated) {
- if (p instanceof Property.ValueChangeNotifier) {
- if (oldListenedProperties == null
- || !oldListenedProperties.contains(p)) {
- ((Property.ValueChangeNotifier) p)
- .addListener(this);
- }
- listenedProperties.add(p);
- }
if (index < firstIndexNotInCache
&& index >= pageBufferFirstIndex) {
// we have data already in our cache,
@@ -1397,6 +1389,32 @@ public class Table extends AbstractSelect implements Action.Container,
value = p.getValue();
} else if (p != null) {
value = getPropertyValue(id, colids[j], p);
+ /*
+ * If returned value is Component (via
+ * fieldfactory or overridden
+ * getPropertyValue) we excpect it to listen
+ * property value changes. Otherwise if
+ * property emits value change events, table
+ * will start to listen them and refresh
+ * content when needed.
+ */
+ if (!(value instanceof Component)
+ && p instanceof Property.ValueChangeNotifier) {
+ // only add listener to property once
+ if (oldListenedProperties == null
+ || !oldListenedProperties
+ .contains(p)) {
+ ((Property.ValueChangeNotifier) p)
+ .addListener(this);
+ }
+ /*
+ * register listened properties, so we
+ * can do proper cleanup to free memory.
+ * Essential if table has loads of data
+ * and it is used for a long time.
+ */
+ listenedProperties.add(p);
+ }
} else {
value = getPropertyValue(id, colids[j],
null);