public class ComboBoxExample extends LayoutContainer {
@Override
protected void onRender(Element parent, int index) {
super.onRender(parent, index);
VerticalPanel vp = new VerticalPanel();
vp.setSpacing(10);
ListStore<State> states = new ListStore<State>();
states.add(TestData.getStates());
ComboBox<State> combo = new ComboBox<State>();
combo.setEmptyText("Select a state...");
combo.setDisplayField("name");
combo.setWidth(150);
combo.setStore(states);
combo.setTypeAhead(true);
combo.setTriggerAction(TriggerAction.ALL);
vp.add(combo);
states = new ListStore<State>();
states.add(TestData.getStates());
combo = new ComboBox<State>();
combo.setEmptyText("Select a state...");
combo.setDisplayField("name");
combo.setTemplate(getTemplate());
combo.setWidth(150);
combo.setStore(states);
combo.setTypeAhead(true);
combo.setTriggerAction(TriggerAction.ALL);
vp.add(combo);
ListStore<Country> countries = new ListStore<Country>();
countries.add(TestData.getCountries());
ComboBox<Country> combo2 = new ComboBox<Country>();
combo2.setWidth(150);
combo2.setStore(countries);
combo2.setTemplate(getFlagTemplate(Examples.isExplorer() ? "" : "../../"));
combo2.setDisplayField("name");
combo2.setTypeAhead(true);
combo2.setTriggerAction(TriggerAction.ALL);
vp.add(combo2);
add(vp);
}