aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorHenri Sara <hesara@vaadin.com>2015-11-05 13:06:20 +0200
committerArtur Signell <artur@vaadin.com>2016-08-08 08:22:12 +0000
commit9207d3f3442a6ab6b9fda29d8a76e2bee4929ab1 (patch)
tree95c3ac34b0b2cb70b4d204b136b3de5cd9c1f38c /server
parent44010cfbfbf4135f3bf3be02c6a852689b1cef8d (diff)
downloadvaadin-framework-9207d3f3442a6ab6b9fda29d8a76e2bee4929ab1.tar.gz
vaadin-framework-9207d3f3442a6ab6b9fda29d8a76e2bee4929ab1.zip
Create new items with RPC (#19929)
When the user creates a new item, send it with client to server RPC. Change-Id: Iaf60fc910d4e8b57b681b4cf13f124871c1a01b0
Diffstat (limited to 'server')
-rw-r--r--server/src/main/java/com/vaadin/ui/ComboBox.java22
1 files changed, 12 insertions, 10 deletions
diff --git a/server/src/main/java/com/vaadin/ui/ComboBox.java b/server/src/main/java/com/vaadin/ui/ComboBox.java
index d448f23ac7..bb87aed0bb 100644
--- a/server/src/main/java/com/vaadin/ui/ComboBox.java
+++ b/server/src/main/java/com/vaadin/ui/ComboBox.java
@@ -76,7 +76,18 @@ public class ComboBox extends AbstractSelect implements
}
private ComboBoxServerRpc rpc = new ComboBoxServerRpc() {
-
+ @Override
+ public void createNewItem(String itemValue) {
+ if (isNewItemsAllowed()) {
+ // New option entered (and it is allowed)
+ if (itemValue != null && itemValue.length() > 0) {
+ getNewItemHandler().addNewItem(itemValue);
+ // rebuild list
+ filterstring = null;
+ prevfilterstring = null;
+ }
+ }
+ }
};
/**
@@ -747,15 +758,6 @@ public class ComboBox extends AbstractSelect implements
filterstring = filterstring.toLowerCase(getLocale());
}
requestRepaint();
- } else if (isNewItemsAllowed()) {
- // New option entered (and it is allowed)
- final String newitem = (String) variables.get("newitem");
- if (newitem != null && newitem.length() > 0) {
- getNewItemHandler().addNewItem(newitem);
- // rebuild list
- filterstring = null;
- prevfilterstring = null;
- }
}
if (variables.containsKey(FocusEvent.EVENT_ID)) {