summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur.signell@itmill.com>2011-11-04 08:10:42 +0000
committerArtur Signell <artur.signell@itmill.com>2011-11-04 08:10:42 +0000
commita1c0cb9658aa5c86ae2f1cd92054b2cee5d482db (patch)
tree996a92aaa605f05e11e6a9c77db15379c9e456e9
parentc097303f508f6cf1fff441be4feb03fe7c29072d (diff)
downloadvaadin-framework-a1c0cb9658aa5c86ae2f1cd92054b2cee5d482db.tar.gz
vaadin-framework-a1c0cb9658aa5c86ae2f1cd92054b2cee5d482db.zip
#7839 Cleanup based on review
svn changeset:21893/svn branch:6.7
-rw-r--r--src/com/vaadin/ui/Table.java32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/com/vaadin/ui/Table.java b/src/com/vaadin/ui/Table.java
index ef483abc70..640fd927af 100644
--- a/src/com/vaadin/ui/Table.java
+++ b/src/com/vaadin/ui/Table.java
@@ -1583,8 +1583,6 @@ public class Table extends AbstractSelect implements Action.Container,
* The position where new rows should be inserted
* @param rows
* The number of rows that should be inserted
- * @param maxRows
- * The maximum number of rows that
* @return
*/
private Object[][] getVisibleCellsInsertIntoCache(int firstIndex, int rows) {
@@ -1659,19 +1657,25 @@ public class Table extends AbstractSelect implements Action.Container,
}
}
- // Create the new cache buffer and fill it with the data from the old
- // buffer as well as the inserted rows.
+ /*
+ * Create the new cache buffer and fill it with the data from the old
+ * buffer as well as the inserted rows.
+ */
Object[][] newPageBuffer = new Object[pageBuffer.length][newCachedRowCount];
- for (int ix = 0; ix < newCachedRowCount; ix++) {
- for (int i = 0; i < pageBuffer.length; i++) {
- if (ix >= firstIndexInPageBuffer
- && ix < firstIndexInPageBuffer + rows) {
- newPageBuffer[i][ix] = cells[i][ix - firstIndexInPageBuffer];
- } else if (ix >= firstIndexInPageBuffer + rows) {
- newPageBuffer[i][ix] = pageBuffer[i][ix - rows];
- } else {
- newPageBuffer[i][ix] = pageBuffer[i][ix];
- }
+
+ for (int i = 0; i < pageBuffer.length; i++) {
+ for (int row = 0; row < firstIndexInPageBuffer; row++) {
+ // Copy the first rows
+ newPageBuffer[i][row] = pageBuffer[i][row];
+ }
+ for (int row = firstIndexInPageBuffer; row < firstIndexInPageBuffer
+ + rows; row++) {
+ // Copy the newly created rows
+ newPageBuffer[i][row] = cells[i][row - firstIndexInPageBuffer];
+ }
+ for (int row = firstIndexInPageBuffer + rows; row < newCachedRowCount; row++) {
+ // Move the old rows down below the newly inserted rows
+ newPageBuffer[i][row] = pageBuffer[i][row - rows];
}
}
pageBuffer = newPageBuffer;