summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compatibility-server/src/main/java/com/vaadin/v7/ui/Table.java49
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/table/ComponentsDisappearWhenScrolling.java40
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/treetable/TreeTableComponentsDisappearWhenScrolling.java47
3 files changed, 88 insertions, 48 deletions
diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/Table.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/Table.java
index 301194fc0c..11f69f5b01 100644
--- a/compatibility-server/src/main/java/com/vaadin/v7/ui/Table.java
+++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/Table.java
@@ -56,6 +56,7 @@ import com.vaadin.shared.MouseEventDetails;
import com.vaadin.shared.ui.MultiSelectMode;
import com.vaadin.shared.util.SharedUtil;
import com.vaadin.ui.Component;
+import com.vaadin.ui.Grid;
import com.vaadin.ui.HasChildMeasurementHint;
import com.vaadin.ui.HasComponents;
import com.vaadin.ui.UniqueSerializable;
@@ -81,8 +82,6 @@ import com.vaadin.v7.shared.ui.table.TableConstants.Section;
import com.vaadin.v7.shared.ui.table.TableServerRpc;
import com.vaadin.v7.shared.ui.table.TableState;
-import com.vaadin.ui.Grid;
-
/**
* <p>
* <code>Table</code> is used for representing data or components in a pageable
@@ -1762,10 +1761,6 @@ public class Table extends AbstractSelect implements Action.Container,
if (rows > 0) {
pageBufferFirstIndex = firstIndex;
}
- if (getPageLength() != 0) {
- removeUnnecessaryRows();
- }
-
setRowCacheInvalidated(true);
markAsDirty();
maybeThrowCacheUpdateExceptions();
@@ -1832,48 +1827,6 @@ public class Table extends AbstractSelect implements Action.Container,
}
/**
- * Removes rows that fall outside the required cache.
- */
- private void removeUnnecessaryRows() {
- int minPageBufferIndex = getMinPageBufferIndex();
- int maxPageBufferIndex = getMaxPageBufferIndex();
-
- int maxBufferSize = maxPageBufferIndex - minPageBufferIndex + 1;
-
- /*
- * Number of rows that were previously cached. This is not necessarily
- * the same as pageLength if we do not have enough rows in the
- * container.
- */
- int currentlyCachedRowCount = pageBuffer[CELL_ITEMID].length;
-
- if (currentlyCachedRowCount <= maxBufferSize) {
- // removal unnecessary
- return;
- }
-
- /* Figure out which rows to get rid of. */
- int firstCacheRowToRemoveInPageBuffer = -1;
- if (minPageBufferIndex > pageBufferFirstIndex) {
- firstCacheRowToRemoveInPageBuffer = pageBufferFirstIndex;
- } else if (maxPageBufferIndex < pageBufferFirstIndex
- + currentlyCachedRowCount) {
- firstCacheRowToRemoveInPageBuffer = maxPageBufferIndex + 1;
- }
-
- if (firstCacheRowToRemoveInPageBuffer
- - pageBufferFirstIndex < currentlyCachedRowCount) {
- /*
- * Unregister all components that fall beyond the cache limits after
- * inserting the new rows.
- */
- unregisterComponentsAndPropertiesInRows(
- firstCacheRowToRemoveInPageBuffer, currentlyCachedRowCount
- - firstCacheRowToRemoveInPageBuffer);
- }
- }
-
- /**
* Requests that the Table should be repainted as soon as possible.
*
* Note that a {@code Table} does not necessarily repaint its contents when
diff --git a/uitest/src/main/java/com/vaadin/tests/components/table/ComponentsDisappearWhenScrolling.java b/uitest/src/main/java/com/vaadin/tests/components/table/ComponentsDisappearWhenScrolling.java
new file mode 100644
index 0000000000..3032e03f46
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/components/table/ComponentsDisappearWhenScrolling.java
@@ -0,0 +1,40 @@
+package com.vaadin.tests.components.table;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.ContentMode;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Label;
+import com.vaadin.v7.ui.Table;
+
+public class ComponentsDisappearWhenScrolling extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ Label label = new Label(getDescription(), ContentMode.HTML);
+ addComponent(label);
+
+ Table table = new Table();
+ table.setSizeFull();
+ table.setCacheRate(1.1);
+ table.addContainerProperty(0, Button.class, null);
+ for (int i = 0; i < 100; i++) {
+ table.addItem(new Object[] { new Button() }, i);
+ }
+ addComponent(table);
+ }
+
+ @Override
+ public String getDescription() {
+ return "Scroll all the way down, then slowly back up. More often than"
+ + " not this results in 'flattening' of several rows. This is "
+ + "due to component connectors being unregistered on "
+ + "components, which are on visible table rows.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 7964;
+ }
+
+}
diff --git a/uitest/src/main/java/com/vaadin/tests/components/treetable/TreeTableComponentsDisappearWhenScrolling.java b/uitest/src/main/java/com/vaadin/tests/components/treetable/TreeTableComponentsDisappearWhenScrolling.java
new file mode 100644
index 0000000000..f820d336af
--- /dev/null
+++ b/uitest/src/main/java/com/vaadin/tests/components/treetable/TreeTableComponentsDisappearWhenScrolling.java
@@ -0,0 +1,47 @@
+package com.vaadin.tests.components.treetable;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.ContentMode;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Label;
+import com.vaadin.v7.ui.TreeTable;
+
+public class TreeTableComponentsDisappearWhenScrolling extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ Label label = new Label(getDescription(), ContentMode.HTML);
+ addComponent(label);
+
+ TreeTable table = new TreeTable();
+ table.setSizeFull();
+ table.setCacheRate(1.1);
+ table.addContainerProperty(0, Button.class, null);
+ for (int i = 0; i < 100; i++) {
+ table.addItem(new Object[] { new Button(Integer.toString(i)) }, i);
+ if ((i + 1) % 5 == 0) {
+ for (int j = 0; j < 4; j++) {
+ table.setParent(i - j, i - 4);
+ }
+ }
+ }
+
+ addComponent(table);
+ }
+
+ @Override
+ public String getDescription() {
+ return "Expand nodes and scroll all the way down, then slowly back up"
+ + ". More often than"
+ + " not this results in 'flattening' of several rows. This is "
+ + "due to component connectors being unregistered on "
+ + "components, which are on visible table rows.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 7964;
+ }
+
+}