summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonatan Kronqvist <jonatan.kronqvist@itmill.com>2011-09-26 12:36:40 +0000
committerJonatan Kronqvist <jonatan.kronqvist@itmill.com>2011-09-26 12:36:40 +0000
commit8b5c7976153753f68cf4233634c8ee0a2fb9d230 (patch)
treec86ad08ca5e7438a5f98a04919db0f5760288750
parent9efa4aaaa650e5d7d4690f64a9c17cd86b9079f2 (diff)
downloadvaadin-framework-8b5c7976153753f68cf4233634c8ee0a2fb9d230.tar.gz
vaadin-framework-8b5c7976153753f68cf4233634c8ee0a2fb9d230.zip
Code cleanup based on review #7620
svn changeset:21307/svn branch:6.7
-rw-r--r--src/com/vaadin/ui/Table.java13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/com/vaadin/ui/Table.java b/src/com/vaadin/ui/Table.java
index fa871faa3a..9ca5a8abe0 100644
--- a/src/com/vaadin/ui/Table.java
+++ b/src/com/vaadin/ui/Table.java
@@ -1486,13 +1486,9 @@ public class Table extends AbstractSelect implements Action.Container,
: totalCachedRows;
int firstAppendedRow = newCachedRowCount > rows ? newCachedRowCount
- rows : firstIndex;
- int rowsToAdd = rows;
- if (rowsToAdd > totalCachedRows - firstAppendedRow) {
- rowsToAdd = totalCachedRows - firstAppendedRow;
- }
- if (rowsToAdd > totalRows - (firstAppendedRow + pageBufferFirstIndex)) {
- rowsToAdd = totalRows - (firstAppendedRow + pageBufferFirstIndex);
- }
+ int rowsToAdd = Math.min(rows, totalCachedRows - firstAppendedRow);
+ rowsToAdd = Math.min(rowsToAdd, totalRows
+ - (firstAppendedRow + pageBufferFirstIndex));
Object[][] cells = getVisibleCellsNoCache(firstAppendedRow, rowsToAdd,
false);
@@ -1518,8 +1514,7 @@ public class Table extends AbstractSelect implements Action.Container,
int cacheIx = firstIndex - pageBufferFirstIndex;
// update the new rows in the cache.
int totalCachedRows = pageBuffer[CELL_ITEMID].length;
- int end = cacheIx + rows > totalCachedRows ? totalCachedRows : cacheIx
- + rows;
+ int end = Math.min(cacheIx + rows, totalCachedRows);
for (int ix = cacheIx; ix < end; ix++) {
for (int i = 0; i < pageBuffer.length; i++) {
pageBuffer[i][ix] = cells[i][ix - cacheIx];