public class ComboBoxSuggestionOnDetach extends TestBase {
@Override
protected void setup() {
final Window popup = new Window();
VerticalLayout layout = new VerticalLayout();
layout.setMargin(true);
layout.setSizeUndefined();
popup.setContent(layout);
ComboBox comboBox = new ComboBox("Combo box", Arrays.asList("Option 1",
"Option 2", "Option 3"));
comboBox.addListener(new FieldEvents.FocusListener() {
@Override
public void focus(FocusEvent event) {
popup.close();
}
});
layout.addComponent(comboBox);
popup.setSizeUndefined();
popup.center();
getMainWindow().addWindow(popup);
}