From e71db3b504d1ec3b6dbfa320af51b0b46725849e Mon Sep 17 00:00:00 2001 From: Mikhail Shabarov Date: Wed, 28 Oct 2020 15:49:58 +0200 Subject: [PATCH] refactor: expose the items count API to components --- .../vaadin/flow/data/provider/DataCommunicator.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/flow-data/src/main/java/com/vaadin/flow/data/provider/DataCommunicator.java b/flow-data/src/main/java/com/vaadin/flow/data/provider/DataCommunicator.java index 3051d8c125d..a506404d87d 100644 --- a/flow-data/src/main/java/com/vaadin/flow/data/provider/DataCommunicator.java +++ b/flow-data/src/main/java/com/vaadin/flow/data/provider/DataCommunicator.java @@ -872,14 +872,18 @@ public void setFetchEnabled(boolean fetchEnabled) { } /** - * Getter method for determining the item count of the data. Can be - * overridden by a subclass that uses a specific type of DataProvider and/or - * query. + * Getter method for determining the item count of the data. + *

+ * This method should be used only with defined size, i.e. when + * {@link #isDefinedSize()} returns {@code code}. + *

+ * Can be overridden by a subclass that uses a specific type of DataProvider + * and/or query. * * @return the size of data provider with current filter */ @SuppressWarnings({ "unchecked", "rawtypes" }) - protected int getDataProviderSize() { + public int getDataProviderSize() { assert definedSize : "This method should never be called when using undefined size"; if (countCallback != null) { return countCallback.count(new Query(getFilter()));