diff options
author | Artur Signell <artur.signell@itmill.com> | 2011-11-04 09:01:09 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2011-11-04 09:01:09 +0000 |
commit | a4d0d363bb6b8d9d2d5eeebe12ee39e97483d4e8 (patch) | |
tree | d091e4c14600038a7a43234d97dd742eb964201c /src/com | |
parent | 9d528ff42cc42673124db07173163b900b638e20 (diff) | |
download | vaadin-framework-a4d0d363bb6b8d9d2d5eeebe12ee39e97483d4e8.tar.gz vaadin-framework-a4d0d363bb6b8d9d2d5eeebe12ee39e97483d4e8.zip |
#7780 Don't do partial repaints if the item set has changed during an expand or collapse
svn changeset:21901/svn branch:6.7
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/vaadin/ui/TreeTable.java | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/com/vaadin/ui/TreeTable.java b/src/com/vaadin/ui/TreeTable.java index aa72793636..9cba7362ac 100644 --- a/src/com/vaadin/ui/TreeTable.java +++ b/src/com/vaadin/ui/TreeTable.java @@ -11,6 +11,7 @@ import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.logging.Logger; import com.google.gwt.user.client.ui.Tree; import com.vaadin.data.Container; @@ -50,6 +51,9 @@ import com.vaadin.ui.treetable.HierarchicalContainerOrderedWrapper; @ClientWidget(VTreeTable.class) public class TreeTable extends Table implements Hierarchical { + private static final Logger logger = Logger.getLogger(TreeTable.class + .getName()); + private interface ContainerStrategy extends Serializable { public int size(); @@ -220,6 +224,9 @@ public class TreeTable extends Table implements Hierarchical { boolean removed = openItems.remove(itemId); if (!removed) { openItems.add(itemId); + logger.finest("Item " + itemId + " is now expanded"); + } else { + logger.finest("Item " + itemId + " is now collapsed"); } clearPreorderCache(); } @@ -312,6 +319,16 @@ public class TreeTable extends Table implements Hierarchical { private ContainerStrategy cStrategy; private Object focusedRowId = null; private Object hierarchyColumnId; + + /** + * The item id that was expanded or collapsed during this request. Reset at + * the end of paint and only used for determining if a partial or full paint + * should be done. + * + * Can safely be reset to null whenever a change occurs that would prevent a + * partial update from rendering the correct result, e.g. rows added or + * removed during an expand operation. + */ private Object toggledItemId; private boolean animationsEnabled; private boolean clearFocusedRowPending; @@ -361,6 +378,7 @@ public class TreeTable extends Table implements Hierarchical { if (variables.containsKey("toggleCollapsed")) { String object = (String) variables.get("toggleCollapsed"); Object itemId = itemIdMapper.get(object); + toggledItemId = itemId; toggleChildVisibility(itemId); if (variables.containsKey("selectCollapsed")) { // ensure collapsed is selected unless opened with selection @@ -497,7 +515,6 @@ public class TreeTable extends Table implements Hierarchical { // ensure that page still has first item in page, DON'T clear the // caches. setCurrentPageFirstItemIndex(getCurrentPageFirstItemIndex(), false); - toggledItemId = itemId; requestRepaint(); if (isCollapsed(itemId)) { @@ -535,6 +552,9 @@ public class TreeTable extends Table implements Hierarchical { @Override public void containerItemSetChange( com.vaadin.data.Container.ItemSetChangeEvent event) { + // Can't do partial repaints if items are added or removed during the + // expand/collapse request + toggledItemId = null; getContainerStrategy().containerItemSetChange(event); super.containerItemSetChange(event); } |