summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin
diff options
context:
space:
mode:
authorArtur Signell <artur.signell@itmill.com>2011-10-27 17:44:16 +0000
committerArtur Signell <artur.signell@itmill.com>2011-10-27 17:44:16 +0000
commitccf9c932d602018f9df8d418710de361da02ffb9 (patch)
treefce9e1172bfec687c636af44837311bb16037500 /src/com/vaadin
parent6e7274c8641d564da566da0a1c309c341dc49dd4 (diff)
downloadvaadin-framework-ccf9c932d602018f9df8d418710de361da02ffb9.tar.gz
vaadin-framework-ccf9c932d602018f9df8d418710de361da02ffb9.zip
#7836 Table repaint throws ArrayIndexOutOfBounds when using FileSystemContainer
svn changeset:21825/svn branch:6.7
Diffstat (limited to 'src/com/vaadin')
-rw-r--r--src/com/vaadin/data/util/ContainerOrderedWrapper.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/com/vaadin/data/util/ContainerOrderedWrapper.java b/src/com/vaadin/data/util/ContainerOrderedWrapper.java
index 958476240e..1bf9a49a3d 100644
--- a/src/com/vaadin/data/util/ContainerOrderedWrapper.java
+++ b/src/com/vaadin/data/util/ContainerOrderedWrapper.java
@@ -68,6 +68,13 @@ public class ContainerOrderedWrapper implements Container.Ordered,
private boolean ordered = false;
/**
+ * The last known size of the wrapped container. Used to check whether items
+ * have been added or removed to the wrapped container, when the wrapped
+ * container does not send ItemSetChangeEvents.
+ */
+ private int lastKnownSize = -1;
+
+ /**
* Constructs a new ordered wrapper for an existing Container. Works even if
* the to-be-wrapped container already implements the Container.Ordered
* interface.
@@ -457,7 +464,15 @@ public class ContainerOrderedWrapper implements Container.Ordered,
* here, we use the default documentation from implemented interface.
*/
public int size() {
- return container.size();
+ int newSize = container.size();
+ if (lastKnownSize != -1 && newSize != lastKnownSize
+ && !(container instanceof Container.ItemSetChangeNotifier)) {
+ // Update the internal cache when the size of the container changes
+ // and the container is incapable of sending ItemSetChangeEvents
+ updateOrderWrapper();
+ }
+ lastKnownSize = newSize;
+ return newSize;
}
/*