]> source.dussan.org Git - vaadin-framework.git/commitdiff
[merge from 6.7] #8810 Fix row collapse animation as well
authorAutomerge <automerge@vaadin.com>
Fri, 18 May 2012 08:45:07 +0000 (08:45 +0000)
committerAutomerge <automerge@vaadin.com>
Fri, 18 May 2012 08:45:07 +0000 (08:45 +0000)
svn changeset:23764/svn branch:6.8

src/com/vaadin/terminal/gwt/client/ui/VTreeTable.java

index 13a60c74b9739373006695aed11830e38b10bd72..324efcb67dd079b6d376323bceb9c53f2a07bae7 100644 (file)
@@ -478,18 +478,23 @@ public class VTreeTable extends VScrollTable {
                     rowsToDelete.add(row);
                 }
             }
-            RowCollapseAnimation anim = new RowCollapseAnimation(rowsToDelete) {
-                @Override
-                protected void onComplete() {
-                    super.onComplete();
-                    // Actually unlink the rows and update the cache after the
-                    // animation is done.
-                    unlinkAndReindexRows(firstIndex, rows);
-                    discardRowsOutsideCacheWindow();
-                    ensureCacheFilled();
-                }
-            };
-            anim.run(150);
+            if (!rowsToDelete.isEmpty()) {
+                // #8810 Only animate if there's something to animate
+                RowCollapseAnimation anim = new RowCollapseAnimation(
+                        rowsToDelete) {
+                    @Override
+                    protected void onComplete() {
+                        super.onComplete();
+                        // Actually unlink the rows and update the cache after
+                        // the
+                        // animation is done.
+                        unlinkAndReindexRows(firstIndex, rows);
+                        discardRowsOutsideCacheWindow();
+                        ensureCacheFilled();
+                    }
+                };
+                anim.run(150);
+            }
         }
 
         protected List<VScrollTableRow> insertRowsAnimated(UIDL rowData,
@@ -747,6 +752,10 @@ public class VTreeTable extends VScrollTable {
 
             private final List<VScrollTableRow> rows;
 
+            /**
+             * @param rows
+             *            List of rows to animate. Must not be empty.
+             */
             public RowCollapseAnimation(List<VScrollTableRow> rows) {
                 super(rows);
                 this.rows = rows;