diff options
3 files changed, 27 insertions, 16 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java b/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java index 01a8db571c..a7082048ca 100644 --- a/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java +++ b/client/src/main/java/com/vaadin/client/ui/combobox/ComboBoxConnector.java @@ -408,8 +408,7 @@ public class ComboBoxConnector extends AbstractFieldConnector implements */ public void requestFirstPage() { sendSelection(null); - getConnection().updateVariable(getConnectorId(), "filter", "", false); - getConnection().updateVariable(getConnectorId(), "page", 0, true); + requestPage("", 0); } /** @@ -426,10 +425,7 @@ public class ComboBoxConnector extends AbstractFieldConnector implements * the page number to get */ public void requestPage(String filter, int page) { - getConnection().updateVariable(getConnectorId(), "filter", filter, - false); - getConnection().updateVariable(getConnectorId(), "page", page, - immediate); + rpc.requestPage(filter, page); } /** diff --git a/server/src/main/java/com/vaadin/ui/ComboBox.java b/server/src/main/java/com/vaadin/ui/ComboBox.java index 73786b390c..2e58befaa5 100644 --- a/server/src/main/java/com/vaadin/ui/ComboBox.java +++ b/server/src/main/java/com/vaadin/ui/ComboBox.java @@ -103,6 +103,19 @@ public class ComboBox extends AbstractSelect implements } } } + + @Override + public void requestPage(String filter, int page) { + filterstring = filter; + if (filterstring != null) { + filterstring = filterstring.toLowerCase(getLocale()); + } + currentPage = page; + + // TODO this should trigger a data-only update instead of a full + // repaint + requestRepaint(); + } }; FocusAndBlurServerRpcImpl focusBlurRpc = new FocusAndBlurServerRpcImpl(this) { @@ -732,16 +745,7 @@ public class ComboBox extends AbstractSelect implements // Not calling super.changeVariables due the history of select // component hierarchy - String newFilter; - if ((newFilter = (String) variables.get("filter")) != null) { - // this is a filter request - currentPage = ((Integer) variables.get("page")).intValue(); - filterstring = newFilter; - if (filterstring != null) { - filterstring = filterstring.toLowerCase(getLocale()); - } - requestRepaint(); - } + // all the client to server requests are now handled by RPC } @Override diff --git a/shared/src/main/java/com/vaadin/shared/ui/combobox/ComboBoxServerRpc.java b/shared/src/main/java/com/vaadin/shared/ui/combobox/ComboBoxServerRpc.java index 38704b5169..863aadcbcd 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/combobox/ComboBoxServerRpc.java +++ b/shared/src/main/java/com/vaadin/shared/ui/combobox/ComboBoxServerRpc.java @@ -39,4 +39,15 @@ public interface ComboBoxServerRpc extends ServerRpc { * the id of a single item or null to deselect the current value */ public void setSelectedItem(String item); + + /** + * Request the server to send a page of the item list. + * + * @param filter + * filter string interpreted according to the current filtering + * mode + * @param page + * zero based page number + */ + public void requestPage(String filter, int page); } |