Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Clear Combox items and Property.ValueChangeListener
Hi, all.
We need to provide a way to our users to search members in our ldap with a comboBox. To do so, i have subclass
comboBox and overwrite the changeVariables method.
@SuppressWarnings("serial")
public class SearchComboBox extends ComboBox {
private MemberDao memberDao;
public SearchComboBox() {
AccessManagerApplication app = (AccessManagerApplication) Root.getCurrentRoot();
memberDao = (MemberDao) app.getBean("memberDao");
}
@Override
public void changeVariables(Object source, Map<String, Object> variables) {
String filterString = (String) variables.get("filter");
if (filterString != null && filterString.length() > 2) {
items.removeAllItems();
List<Member> members = memberDao.retrieveAllByName(filterString, null, BUnit.A_UNIT);
for (Member member : members) {
addItem(member.getGivenName());
}
} else {
items.removeAllItems();
}
super.changeVariables(source, variables);
}
}
And in another class that implements Property.ValueChangeListener, i call my SearchComboBox but the event is
never fired
public class Header extends HorizontalLayout implements Property.ValueChangeListener {
...
private SearchComboBox searchBox;
public Header() {
...
searchBox = new SearchComboBox();
searchBox.addListener(this);
}
...
@Override
public void valueChange(ValueChangeEvent event) {
@SuppressWarnings("unchecked")
Property<String> property = event.getProperty();
/****** The notification is never shown ******/
Root.getCurrentRoot().showNotification(property.getValue());
}
}
I can't manage to work it out... Also is there a way to put a "timeout" in my search. Like i want (let's say)
250 milli sec between each key stroke instead of instant server request
Thanks a lot
Ok. I figured it out.
If i can help anyone having the same problem, please ask.