Hi folks !
I have note a strange thing on the comboBox if that component contains items with icons. The method to remove items (removeAllitems) doesn’t seem to work properly because after calling that method the selected icon’s item is still displayed.
See my code below to reproduce that case under Vaadin 6.2.5.
@SuppressWarnings("serial")
public class ApplicationTest extends Application implements Button.ClickListener {
private Window mainWindow = new Window("ComboBoxIconTest");
private ComboBox cb = new ComboBox("Test");
private Button btClear = new Button("Clear Button");
@Override
public void init() {
setTheme("runo");
setMainWindow(mainWindow);
cb.setImmediate(true);
btClear.setImmediate(true);
btClear.addListener(this);
loadComboBox();
mainWindow.addComponent(cb);
mainWindow.addComponent(btClear);
}
private void loadComboBox() {
cb.addItem(1);
cb.setItemCaption(1, "icon test");
cb.setItemIcon(1, new ThemeResource("icons/16/ok.png"));
}
@Override
public void buttonClick(ClickEvent event) {
if (event.getButton().equals(btClear)) {
cb.removeAllItems();
}
}
}
Can you tell if that normal or maybe I’m doing something wrong.
Thanks in advance !