diff options
author | Henrik Paul <henrik@vaadin.com> | 2014-09-29 10:45:23 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2014-10-02 14:16:37 +0000 |
commit | 0375cb57b53ffa45dbc1e6fbd94e3d15e23b9ec3 (patch) | |
tree | 1f8809b127bbfc2f62f6cbcbca8e1eb750ff284a | |
parent | ba6e9e43db694d4eb3d4bf58b6cf45e01e1c542c (diff) | |
download | vaadin-framework-0375cb57b53ffa45dbc1e6fbd94e3d15e23b9ec3.tar.gz vaadin-framework-0375cb57b53ffa45dbc1e6fbd94e3d15e23b9ec3.zip |
Renames "estimated size" to a more definite "size" (#13334)
Change-Id: I9f72cc85223df21e5fac0da29b493bcc89bd3b9c
7 files changed, 31 insertions, 31 deletions
diff --git a/client/src/com/vaadin/client/data/AbstractRemoteDataSource.java b/client/src/com/vaadin/client/data/AbstractRemoteDataSource.java index ca2d2bc83e..c42e6c5351 100644 --- a/client/src/com/vaadin/client/data/AbstractRemoteDataSource.java +++ b/client/src/com/vaadin/client/data/AbstractRemoteDataSource.java @@ -144,7 +144,7 @@ public abstract class AbstractRemoteDataSource<T> implements DataSource<T> { private DataChangeHandler dataChangeHandler; - private Range estimatedAvailableRange = Range.between(0, 0); + private Range availableDataRange = Range.between(0, 0); private CacheStrategy cacheStrategy = new CacheStrategy.DefaultCacheStrategy(); @@ -161,14 +161,14 @@ public abstract class AbstractRemoteDataSource<T> implements DataSource<T> { protected Collection<T> temporarilyPinnedRows = Collections.emptySet(); /** - * Sets the estimated number of rows in the data source. + * Sets the number of rows in the data source. * - * @param estimatedSize - * the estimated number of available rows + * @param size + * the number of available rows */ - protected void setEstimatedSize(int estimatedSize) { + protected void setSize(int size) { // TODO update dataChangeHandler if size changes - estimatedAvailableRange = Range.withLength(0, estimatedSize); + availableDataRange = Range.withLength(0, size); } private void ensureCoverageCheck() { @@ -258,8 +258,8 @@ public abstract class AbstractRemoteDataSource<T> implements DataSource<T> { protected abstract void requestRows(int firstRowIndex, int numberOfRows); @Override - public int getEstimatedSize() { - return estimatedAvailableRange.length(); + public int size() { + return availableDataRange.length(); } @Override @@ -395,7 +395,7 @@ public abstract class AbstractRemoteDataSource<T> implements DataSource<T> { .length()); cached = remainsBefore.combineWith(transposedRemainsAfter); } - setEstimatedSize(getEstimatedSize() - count); + setSize(size() - count); dataChangeHandler.dataRemoved(firstRowIndex, count); checkCacheCoverage(); @@ -441,7 +441,7 @@ public abstract class AbstractRemoteDataSource<T> implements DataSource<T> { } } - setEstimatedSize(getEstimatedSize() + count); + setSize(size() + count); dataChangeHandler.dataAdded(firstRowIndex, count); checkCacheCoverage(); @@ -481,18 +481,18 @@ public abstract class AbstractRemoteDataSource<T> implements DataSource<T> { private Range getMinCacheRange() { Range minCacheRange = cacheStrategy.getMinCacheRange( - requestedAvailability, cached, estimatedAvailableRange); + requestedAvailability, cached, availableDataRange); - assert minCacheRange.isSubsetOf(estimatedAvailableRange); + assert minCacheRange.isSubsetOf(availableDataRange); return minCacheRange; } private Range getMaxCacheRange() { Range maxCacheRange = cacheStrategy.getMaxCacheRange( - requestedAvailability, cached, estimatedAvailableRange); + requestedAvailability, cached, availableDataRange); - assert maxCacheRange.isSubsetOf(estimatedAvailableRange); + assert maxCacheRange.isSubsetOf(availableDataRange); return maxCacheRange; } diff --git a/client/src/com/vaadin/client/data/DataSource.java b/client/src/com/vaadin/client/data/DataSource.java index 24cef548c5..9643b5ea8f 100644 --- a/client/src/com/vaadin/client/data/DataSource.java +++ b/client/src/com/vaadin/client/data/DataSource.java @@ -159,11 +159,11 @@ public interface DataSource<T> { public T getRow(int rowIndex); /** - * Returns the current best guess for the number of rows in the container. + * Returns the number of rows in the data source. * - * @return the current estimation of the container size + * @return the current size of the data source */ - public int getEstimatedSize(); + public int size(); /** * Sets a data change handler to inform when data is updated, added or diff --git a/client/src/com/vaadin/client/data/RpcDataSourceConnector.java b/client/src/com/vaadin/client/data/RpcDataSourceConnector.java index 2819837504..866393db03 100644 --- a/client/src/com/vaadin/client/data/RpcDataSourceConnector.java +++ b/client/src/com/vaadin/client/data/RpcDataSourceConnector.java @@ -105,7 +105,7 @@ public class RpcDataSourceConnector extends AbstractExtensionConnector { @Override protected void extend(ServerConnector target) { - dataSource.setEstimatedSize(getState().containerSize); + dataSource.setSize(getState().containerSize); ((GridConnector) target).setDataSource(dataSource); registerRpc(DataProviderRpc.class, new DataProviderRpc() { diff --git a/client/src/com/vaadin/client/ui/grid/Grid.java b/client/src/com/vaadin/client/ui/grid/Grid.java index eb48d417d5..34b4ebe18e 100644 --- a/client/src/com/vaadin/client/ui/grid/Grid.java +++ b/client/src/com/vaadin/client/ui/grid/Grid.java @@ -1854,9 +1854,9 @@ public class Grid<T> extends ResizeComposite implements escalator.getBody().removeRows(0, previousRowCount); } - int estimatedSize = dataSource.getEstimatedSize(); - if (estimatedSize > 0) { - escalator.getBody().insertRows(0, estimatedSize); + int size = dataSource.size(); + if (size > 0) { + escalator.getBody().insertRows(0, size); } } diff --git a/client/src/com/vaadin/client/ui/grid/datasources/ListDataSource.java b/client/src/com/vaadin/client/ui/grid/datasources/ListDataSource.java index ef021a496a..167affe235 100644 --- a/client/src/com/vaadin/client/ui/grid/datasources/ListDataSource.java +++ b/client/src/com/vaadin/client/ui/grid/datasources/ListDataSource.java @@ -391,7 +391,7 @@ public class ListDataSource<T> implements DataSource<T> { } @Override - public int getEstimatedSize() { + public int size() { return ds.size(); } diff --git a/client/tests/src/com/vaadin/client/ui/grid/ListDataSourceTest.java b/client/tests/src/com/vaadin/client/ui/grid/ListDataSourceTest.java index 55a2b56ee2..5970d9c609 100644 --- a/client/tests/src/com/vaadin/client/ui/grid/ListDataSourceTest.java +++ b/client/tests/src/com/vaadin/client/ui/grid/ListDataSourceTest.java @@ -34,7 +34,7 @@ public class ListDataSourceTest { ListDataSource<Integer> ds = new ListDataSource<Integer>(0, 1, 2, 3); - assertEquals(4, ds.getEstimatedSize()); + assertEquals(4, ds.size()); assertEquals(0, (int) ds.getRow(0)); assertEquals(1, (int) ds.getRow(1)); assertEquals(2, (int) ds.getRow(2)); @@ -42,7 +42,7 @@ public class ListDataSourceTest { ds = new ListDataSource<Integer>(Arrays.asList(0, 1, 2, 3)); - assertEquals(4, ds.getEstimatedSize()); + assertEquals(4, ds.size()); assertEquals(0, (int) ds.getRow(0)); assertEquals(1, (int) ds.getRow(1)); assertEquals(2, (int) ds.getRow(2)); @@ -65,7 +65,7 @@ public class ListDataSourceTest { ds.asList().add(4); - assertEquals(5, ds.getEstimatedSize()); + assertEquals(5, ds.size()); assertEquals(0, (int) ds.getRow(0)); assertEquals(1, (int) ds.getRow(1)); assertEquals(2, (int) ds.getRow(2)); @@ -89,7 +89,7 @@ public class ListDataSourceTest { ds.asList().addAll(Arrays.asList(4, 5, 6)); - assertEquals(7, ds.getEstimatedSize()); + assertEquals(7, ds.size()); assertEquals(0, (int) ds.getRow(0)); assertEquals(1, (int) ds.getRow(1)); assertEquals(2, (int) ds.getRow(2)); @@ -115,7 +115,7 @@ public class ListDataSourceTest { ds.asList().remove(2); - assertEquals(3, ds.getEstimatedSize()); + assertEquals(3, ds.size()); assertEquals(0, (int) ds.getRow(0)); assertEquals(1, (int) ds.getRow(1)); assertEquals(3, (int) ds.getRow(2)); @@ -137,7 +137,7 @@ public class ListDataSourceTest { ds.asList().removeAll(Arrays.asList(0, 2, 3)); - assertEquals(1, ds.getEstimatedSize()); + assertEquals(1, ds.size()); assertEquals(1, (int) ds.getRow(0)); } @@ -157,7 +157,7 @@ public class ListDataSourceTest { ds.asList().clear(); - assertEquals(0, ds.getEstimatedSize()); + assertEquals(0, ds.size()); } @Test(expected = IllegalStateException.class) diff --git a/uitest/src/com/vaadin/tests/widgetset/client/grid/GridClientColumnRendererConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/grid/GridClientColumnRendererConnector.java index 4bdba3170b..d9daa6bc9b 100644 --- a/uitest/src/com/vaadin/tests/widgetset/client/grid/GridClientColumnRendererConnector.java +++ b/uitest/src/com/vaadin/tests/widgetset/client/grid/GridClientColumnRendererConnector.java @@ -101,8 +101,8 @@ public class GridClientColumnRendererConnector extends } @Override - public int getEstimatedSize() { - return ds.getEstimatedSize(); + public int size() { + return ds.size(); } @Override |