aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/ui/Table.java
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2008-08-13 15:16:42 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2008-08-13 15:16:42 +0000
commit7e2317b6dc46228d1ecafff67cf2de0e0209e4ef (patch)
tree321f90d87c0c7b0b6295d11e13c087d078ae8861 /src/com/itmill/toolkit/ui/Table.java
parent04a7f32f8802f40863465c9d58bb5bd621489158 (diff)
downloadvaadin-framework-7e2317b6dc46228d1ecafff67cf2de0e0209e4ef.tar.gz
vaadin-framework-7e2317b6dc46228d1ecafff67cf2de0e0209e4ef.zip
added quick workaround for #1980 (IndexedContainer has sluggish equals/hashCode methods)
svn changeset:5181/svn branch:trunk
Diffstat (limited to 'src/com/itmill/toolkit/ui/Table.java')
-rw-r--r--src/com/itmill/toolkit/ui/Table.java35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/com/itmill/toolkit/ui/Table.java b/src/com/itmill/toolkit/ui/Table.java
index b75bf00413..d5ab6120c3 100644
--- a/src/com/itmill/toolkit/ui/Table.java
+++ b/src/com/itmill/toolkit/ui/Table.java
@@ -8,6 +8,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.LinkedList;
@@ -43,10 +44,6 @@ import com.itmill.toolkit.terminal.Resource;
* @VERSION@
* @since 3.0
*/
-/**
- * @author mattitahvonen
- *
- */
public class Table extends AbstractSelect implements Action.Container,
Container.Ordered, Container.Sortable {
@@ -232,15 +229,18 @@ public class Table extends AbstractSelect implements Action.Container,
private Object[][] pageBuffer = null;
/**
- * List of properties listened - the list is kept to release the listeners
+ * 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 LinkedList listenedProperties = null;
+ private Map listenedProperties = null;
/**
- * List of visible components - the is used for needsRepaint calculation.
+ * Set of visible components - the is used for needsRepaint calculation.
*/
- private LinkedList visibleComponents = null;
+ private HashSet visibleComponents = null;
/**
* List of action handlers.
@@ -1166,12 +1166,12 @@ public class Table extends AbstractSelect implements Action.Container,
if (isContentRefreshesEnabled) {
- LinkedList oldListenedProperties = listenedProperties;
- LinkedList oldVisibleComponents = visibleComponents;
+ Map oldListenedProperties = listenedProperties;
+ HashSet oldVisibleComponents = visibleComponents;
// initialize the listener collections
- listenedProperties = new LinkedList();
- visibleComponents = new LinkedList();
+ listenedProperties = new IdentityHashMap();
+ visibleComponents = new HashSet();
// Collects the basic facts about the table page
final Object[] colids = getVisibleColumns();
@@ -1273,11 +1273,12 @@ public class Table extends AbstractSelect implements Action.Container,
if (p != null || isGenerated) {
if (p instanceof Property.ValueChangeNotifier) {
if (oldListenedProperties == null
- || !oldListenedProperties.contains(p)) {
+ || !oldListenedProperties
+ .containsKey(p)) {
((Property.ValueChangeNotifier) p)
.addListener(this);
}
- listenedProperties.add(p);
+ listenedProperties.put(p, null);
}
if (index < firstIndexNotInCache
&& index >= pageBufferFirstIndex) {
@@ -1348,11 +1349,11 @@ public class Table extends AbstractSelect implements Action.Container,
}
if (oldListenedProperties != null) {
- for (final Iterator i = oldListenedProperties.iterator(); i
- .hasNext();) {
+ for (final Iterator i = oldListenedProperties.keySet()
+ .iterator(); i.hasNext();) {
Property.ValueChangeNotifier o = (ValueChangeNotifier) i
.next();
- if (!listenedProperties.contains(o)) {
+ if (!listenedProperties.containsKey(o)) {
o.removeListener(this);
}
}