summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java23
1 files changed, 19 insertions, 4 deletions
diff --git a/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java b/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java
index 12cb892090..065810a7b4 100644
--- a/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java
+++ b/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java
@@ -854,7 +854,21 @@ public class SQLContainer implements Container, Container.Filterable,
* Does NOT remove sorting or filtering rules!
*/
public void refresh() {
- sizeDirty = true;
+ refresh(true);
+ }
+
+ /**
+ * Refreshes the container. If <code>setSizeDirty</code> is
+ * <code>false</code>, assumes that the current size is up to date. This is
+ * used in {@link #updateCount()} to refresh the contents when we know the
+ * size was just updated.
+ *
+ * @param setSizeDirty
+ */
+ private void refresh(boolean setSizeDirty) {
+ if (setSizeDirty) {
+ sizeDirty = true;
+ }
currentOffset = 0;
cachedItems.clear();
itemIndexes.clear();
@@ -1105,12 +1119,13 @@ public class SQLContainer implements Container, Container.Filterable,
"The query delegate doesn't support filtering", e);
}
int newSize = delegate.getCount();
+ sizeUpdated = new Date();
+ sizeDirty = false;
if (newSize != size) {
size = newSize;
- refresh();
+ // Size is up to date so don't set it back to dirty in refresh()
+ refresh(false);
}
- sizeUpdated = new Date();
- sizeDirty = false;
getLogger().log(Level.FINER,
"Updated row count. New count is: " + size);
} catch (SQLException e) {