diff options
author | Matti Tahvonen <matti.tahvonen@itmill.com> | 2009-06-03 06:20:32 +0000 |
---|---|---|
committer | Matti Tahvonen <matti.tahvonen@itmill.com> | 2009-06-03 06:20:32 +0000 |
commit | 924219e468066f37e137af2e3c660880f6b841b1 (patch) | |
tree | 6fef54f881c7e31b5b67ff51d054bbd89822492e /src | |
parent | cae08b25354ea55a720c9bcf89ecc265cadcf598 (diff) | |
download | vaadin-framework-924219e468066f37e137af2e3c660880f6b841b1.tar.gz vaadin-framework-924219e468066f37e137af2e3c660880f6b841b1.zip |
fixed a regression since #2823, removed old bad comment, extracted redundancy to private method
svn changeset:8119/svn branch:6.0
Diffstat (limited to 'src')
-rw-r--r-- | src/com/vaadin/ui/Table.java | 63 |
1 files changed, 24 insertions, 39 deletions
diff --git a/src/com/vaadin/ui/Table.java b/src/com/vaadin/ui/Table.java index 9a2fab3139..80e344443e 100644 --- a/src/com/vaadin/ui/Table.java +++ b/src/com/vaadin/ui/Table.java @@ -239,9 +239,6 @@ public class Table extends AbstractSelect implements Action.Container, /** * Set of properties listened - the list is kept to release the listeners * later. - * - * Note: This should be set or list. IdentityHashMap used due very heavy - * hashCode in indexed container */ private HashSet<Property> listenedProperties = null; @@ -1413,6 +1410,10 @@ public class Table extends AbstractSelect implements Action.Container, int indexInOldBuffer = index - pageBufferFirstIndex; value = pageBuffer[CELL_FIRSTCOL + j][indexInOldBuffer]; + if (!isGenerated && iscomponent[j] + || !(value instanceof Component)) { + listenProperty(p, oldListenedProperties); + } } else { if (isGenerated) { ColumnGenerator cg = columnGenerators @@ -1422,26 +1423,7 @@ public class Table extends AbstractSelect implements Action.Container, } else if (iscomponent[j]) { value = p.getValue(); - if (p instanceof Property.ValueChangeNotifier) { - /* - * Component in property may change -> - * listen value changes events. - */ - 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); - - } + listenProperty(p, oldListenedProperties); } else if (p != null) { value = getPropertyValue(id, colids[j], p); /* @@ -1453,22 +1435,8 @@ public class Table extends AbstractSelect implements Action.Container, * 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); + if (!(value instanceof Component)) { + listenProperty(p, oldListenedProperties); } } else { value = getPropertyValue(id, colids[j], @@ -1517,6 +1485,23 @@ public class Table extends AbstractSelect implements Action.Container, } + private void listenProperty(Property p, + HashSet<Property> oldListenedProperties) { + if (p instanceof Property.ValueChangeNotifier) { + 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); + + } + } + /** * Helper method to remove listeners and maintain correct component * hierarchy. Detaches properties and components if those are no more |