diff options
author | Henri Sara <henri.sara@gmail.com> | 2017-08-09 14:28:17 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-09 14:28:17 +0300 |
commit | ee9f287917056c61537559286577b38a1a93f70f (patch) | |
tree | ba08b34bd64c188db1507fae0587da0268d0dd0a /compatibility-server/src/main | |
parent | 0c993377de46dbe89909f1f1cab06d3851e90851 (diff) | |
download | vaadin-framework-ee9f287917056c61537559286577b38a1a93f70f.tar.gz vaadin-framework-ee9f287917056c61537559286577b38a1a93f70f.zip |
Fix occasional empty rows in Table and TreeTable (#9800)
Picked from #9551 in 7.7
There's an intermittently happening issue with both Table and TreeTable,
which results in row data disappearing.
This change removes a method which is probably a vestigial one from over
five years ago and other changes are handling the things the method used
to perform. Currently the method removes rows deemed unnecessary from
the row buffer. The problem is, those rows are visible to the user and
removing causes row contents to be lost.
Also included are manually runnable test cases which demonstrate that
this removal actually prevents the issue from happening.
Fixes #7964
Fixes #5030
Diffstat (limited to 'compatibility-server/src/main')
-rw-r--r-- | compatibility-server/src/main/java/com/vaadin/v7/ui/Table.java | 49 |
1 files changed, 1 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 |