diff options
author | Henri Sara <henri.sara@itmill.com> | 2011-11-15 13:18:51 +0000 |
---|---|---|
committer | Henri Sara <henri.sara@itmill.com> | 2011-11-15 13:18:51 +0000 |
commit | 408e1b6c8923efaac5cb010b3220cb4ce25791d7 (patch) | |
tree | 13e11263a347ab3dee85e12352dea5c88e4870fa /src/com/vaadin/ui/TreeTable.java | |
parent | b3b248b17f63fdd815592d4b2685eca8313a73ae (diff) | |
download | vaadin-framework-408e1b6c8923efaac5cb010b3220cb4ce25791d7.tar.gz vaadin-framework-408e1b6c8923efaac5cb010b3220cb4ce25791d7.zip |
#7837 do not use partial updates in TreeTable if the container does not support item set change notifications
svn changeset:22007/svn branch:6.7
Diffstat (limited to 'src/com/vaadin/ui/TreeTable.java')
-rw-r--r-- | src/com/vaadin/ui/TreeTable.java | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/com/vaadin/ui/TreeTable.java b/src/com/vaadin/ui/TreeTable.java index 9cba7362ac..fb12ffe323 100644 --- a/src/com/vaadin/ui/TreeTable.java +++ b/src/com/vaadin/ui/TreeTable.java @@ -333,6 +333,12 @@ public class TreeTable extends Table implements Hierarchical { private boolean animationsEnabled; private boolean clearFocusedRowPending; + /** + * If the container does not send item set change events, always do a full + * repaint instead of a partial update when expanding/collapsing nodes. + */ + private boolean containerSupportsPartialUpdates; + private ContainerStrategy getContainerStrategy() { if (cStrategy == null) { if (getContainerDataSource() instanceof Collapsible) { @@ -464,7 +470,7 @@ public class TreeTable extends Table implements Hierarchical { @Override protected boolean isPartialRowUpdate() { - return toggledItemId != null; + return toggledItemId != null && containerSupportsPartialUpdates; } @Override @@ -515,13 +521,20 @@ public class TreeTable extends Table implements Hierarchical { // ensure that page still has first item in page, DON'T clear the // caches. setCurrentPageFirstItemIndex(getCurrentPageFirstItemIndex(), false); - requestRepaint(); if (isCollapsed(itemId)) { fireCollapseEvent(itemId); } else { fireExpandEvent(itemId); } + + if (containerSupportsPartialUpdates) { + requestRepaint(); + } else { + // For containers that do not send item set change events, always do + // full repaint instead of partial row update. + refreshRowCache(); + } } @Override @@ -537,6 +550,9 @@ public class TreeTable extends Table implements Hierarchical { @Override public void setContainerDataSource(Container newDataSource) { cStrategy = null; + + containerSupportsPartialUpdates = (newDataSource instanceof ItemSetChangeNotifier); + if (!(newDataSource instanceof Hierarchical)) { newDataSource = new ContainerHierarchicalWrapper(newDataSource); } |