aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenri Sara <hesara@vaadin.com>2015-11-09 12:58:52 +0200
committerHenri Sara <hesara@vaadin.com>2016-01-15 14:42:57 +0200
commit9ba4e15b677d42918eae32a08a6d6a2b12ff43e9 (patch)
tree7e35943869c6a5931d253daa9544739acb1f31fd
parent4bc60dad87f68d7da451799c8300c97ba632a2a8 (diff)
downloadvaadin-framework-9ba4e15b677d42918eae32a08a6d6a2b12ff43e9.tar.gz
vaadin-framework-9ba4e15b677d42918eae32a08a6d6a2b12ff43e9.zip
Request ComboBox pages with RPC (#19929)
All client to server communication of ComboBox is now done with RPC. There is still an empty changeVariables() methods to override the default behavior in AbstractSelect. Change-Id: Ic11ea48cac1846272609f6e4107bb0006d18494c
-rw-r--r--client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java8
-rw-r--r--server/src/com/vaadin/ui/ComboBox.java24
-rw-r--r--shared/src/com/vaadin/shared/ui/combobox/ComboBoxServerRpc.java11
3 files changed, 27 insertions, 16 deletions
diff --git a/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java b/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java
index 5c22e684f8..87f24845ab 100644
--- a/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java
+++ b/client/src/com/vaadin/client/ui/combobox/ComboBoxConnector.java
@@ -392,8 +392,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);
}
/**
@@ -410,10 +409,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/com/vaadin/ui/ComboBox.java b/server/src/com/vaadin/ui/ComboBox.java
index dc064e925b..de87ea0d17 100644
--- a/server/src/com/vaadin/ui/ComboBox.java
+++ b/server/src/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) {
@@ -718,16 +731,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/com/vaadin/shared/ui/combobox/ComboBoxServerRpc.java b/shared/src/com/vaadin/shared/ui/combobox/ComboBoxServerRpc.java
index 38704b5169..863aadcbcd 100644
--- a/shared/src/com/vaadin/shared/ui/combobox/ComboBoxServerRpc.java
+++ b/shared/src/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);
}