ClickEvent.getType());
selectedItemIcon.addDomHandler(VComboBox.this,
MouseDownEvent.getType());
- iconUpdating = true;
selectedItemIcon.addDomHandler(new LoadHandler() {
@Override
public void onLoad(LoadEvent event) {
afterSelectedItemIconChange();
- iconUpdating = false;
}
}, LoadEvent.getType());
panel.insert(selectedItemIcon, 0);
boolean preventNextBlurEventInIE = false;
private String explicitSelectedCaption;
- private boolean iconUpdating = false;
/*
* (non-Javadoc)
@Override
public boolean isWorkPending() {
return dataReceivedHandler.isWaitingForFilteringResponse()
- || suggestionPopup.lazyPageScroller.isRunning() || iconUpdating;
+ || suggestionPopup.lazyPageScroller.isRunning();
}
/**
import java.util.ArrayList;
import java.util.List;
+import com.vaadin.annotations.Widgetset;
+import com.vaadin.server.ThemeResource;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.ComboBox;
-/**
- *
- */
-@SuppressWarnings("serial")
+@Widgetset("com.vaadin.DefaultWidgetSet")
public class ComboBoxUI extends AbstractTestUI {
public static final List<String> currencies = new ArrayList<String>();
@Override
protected void setup(VaadinRequest request) {
- ComboBox comboBox = new ComboBox("NullAllowedComboBox", currencies);
+ ComboBox<String> comboBox = new ComboBox<>("NullAllowedComboBox",
+ currencies);
addComponent(comboBox);
- comboBox = new ComboBox("NullForbiddenComboBox", currencies);
+ comboBox = new ComboBox<>("NullForbiddenComboBox", currencies);
comboBox.setEmptySelectionAllowed(false);
addComponent(comboBox);
+
+ comboBox = new ComboBox<>("With icons", currencies);
+ comboBox.setId("with-icons");
+ comboBox.setItemIconGenerator(item -> {
+ if (item.equals("EUR")) {
+ return new ThemeResource("shared/img/spinner.gif");
+ } else {
+ return new ThemeResource("notfound.png");
+ }
+ });
+ addComponent(comboBox);
}
@Override
import com.vaadin.testbench.elements.ComboBoxElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
-/**
- * Validates that multiple calls to ComboBoxElement.selectByText(String) do not
- * append the input given each time to the previous one. The value in the
- * combobox's search field should be cleared before searching for a new one.
- */
public class ComboBoxUITest extends MultiBrowserTest {
@Before
cb.selectByText("foobar");
}
+ @Test
+ public void testSelectByTextWithIcons() {
+ ComboBoxElement cb = $(ComboBoxElement.class).id("with-icons");
+ cb.selectByText("GBP");
+ assertEquals("GBP", cb.getValue());
+ cb.selectByText("EUR");
+ assertEquals("EUR", cb.getValue());
+ }
+
private void testMultipleSelectByTextOperationsIn(
ComboBoxElement comboBox) {
// Select all items from the menu