From eca0b72f697b3e79690c2dc02014ad7953edd6cd Mon Sep 17 00:00:00 2001 From: Teemu Suo-Anttila Date: Fri, 15 Jan 2016 14:49:25 +0200 Subject: [PATCH] Split Filtering and page requests to different RPC calls Change-Id: I6c0a25f73ba98bf73f1df8382769aed98c3adc11 --- .../client/ui/combobox/ComboBoxConnector.java | 4 +++- server/src/com/vaadin/ui/ComboBox.java | 13 +++++++++- .../shared/ui/combobox/ComboBoxServerRpc.java | 24 +++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java b/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java index b20fa851c7..4b739cd85d 100644 --- a/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java +++ b/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java @@ -308,7 +308,9 @@ public class ComboBoxConnector extends AbstractFieldConnector implements * the page number to get */ public void requestPage(String filter, int page) { - rpc.requestPage(filter, page); + rpc.setFilter(filter); + // TODO: Replace with a DataSource ensureAvailability call. + rpc.requestPage(page); afterSendRequestToServer(); } diff --git a/server/src/com/vaadin/ui/ComboBox.java b/server/src/com/vaadin/ui/ComboBox.java index 1c43e72352..041803ca33 100644 --- a/server/src/com/vaadin/ui/ComboBox.java +++ b/server/src/com/vaadin/ui/ComboBox.java @@ -105,16 +105,27 @@ public class ComboBox extends AbstractSelect implements } @Override + @Deprecated public void requestPage(String filter, int page) { + setFilter(filter); + requestPage(page); + } + + @Override + public void setFilter(String filter) { filterstring = filter; if (filterstring != null) { filterstring = filterstring.toLowerCase(getLocale()); } + } + + @Override + public void requestPage(int page) { currentPage = page; // TODO this should trigger a data-only update instead of a full // repaint - requestRepaint(); + markAsDirty(); } }; diff --git a/shared/src/com/vaadin/shared/ui/combobox/ComboBoxServerRpc.java b/shared/src/com/vaadin/shared/ui/combobox/ComboBoxServerRpc.java index 863aadcbcd..69fbbf2551 100644 --- a/shared/src/com/vaadin/shared/ui/combobox/ComboBoxServerRpc.java +++ b/shared/src/com/vaadin/shared/ui/combobox/ComboBoxServerRpc.java @@ -48,6 +48,30 @@ public interface ComboBoxServerRpc extends ServerRpc { * mode * @param page * zero based page number + * @deprecated method split to two separate parts, see + * {@link ComboBoxServerRpc#setFilter(String)} and + * {@link ComboBoxServerRpc#requestPage(int)} */ + @Deprecated public void requestPage(String filter, int page); + + /** + * Sets a filter to the server-side data source. + * + * @param filter + * filter string interpreted according to the current filtering + * mode + * @since + */ + public void setFilter(String filter); + + /** + * Request the server to send a page of the item list. This request will get + * results filtered by filter string given with + * {@link ComboBoxServerRpc#setFilter(String)} + * + * @param page + * zero based page number + */ + public void requestPage(int page); } -- 2.39.5