HashMap<String, HashMap<SomeInnerKeyType, String>> selects = new HashMap<String, HashMap<SomeInnerKeyType, String>>(); ... for(HashMap<SomeInnerKeyType, String> h : selects.values()) { ComboBox cb = new ComboBox(); for(String s : h.values()) { cb.items.add(s); } }
parentNode.getChildren().remove(cboVet); cboVet = new ComboBox(); // do whatever else you need to format your ComboBox parentNode.add(cboVet);
HashMap<String, HashMap> selects = new HashMap<String, HashMap>(); for (String key : selects.keySet()) { HashMap<innerKey, String> boxHolder = selects.get(key); ComboBox cb = new ComboBox(); for (InnerKey innerKey : boxHolder.keySet()) { cb.items.add(boxHolder.get(innerKey)); } }
cb_company = new ComboBox("Company"); for(cCustomer cust : ListCust) { cb_company.addItem(cust.mgetId); cb_company.setItemcaption(cust.mgetId, cuts.mgetName); } //select the first item from the container cb_company.select(ListCust.get(0));
// Create a set of items String[] items = { "Red", "Blue", "Green", "Yellow" }; //create a combobox with String[] items ComboBox combobox = new ComboBox(items);
this.comboBox = new ComboBox({ id: "stateSelect", name: "state", value: "", store: stateStore, searchAttr: "name" }, "stateSelect");
var comboBoxDiv = domConstruct.create("div"); var myComboBox = new ComboBox({ name: "state" }); myComboBox.placeAt(comboBoxDiv);
@Override protected Component initContent() { VerticalLayout layout = new VerticalLayout(); setStyleName("colorselect"); setWidth("100%"); range = new ComboBox<>(null, EnumSet.allOf(ColorRange.class)); range.setEmptySelectionAllowed(false); range.setWidth("100%"); range.addValueChangeListener(this::valueChange); range.setValue(ColorRange.ALL); layout.addComponent(range); grid = new ColorPickerGrid(createAllColors(14, 10)); grid.setWidth("100%"); grid.addValueChangeListener(this::fireEvent); layout.addComponent(grid); return layout; }
ComboBox combobox = new ComboBox(); combobox.setEditable(true); combobox.getEditor().textProperty().addListener(new ChangeListener<String>() { @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) { System.out.println("Text changed"); } });
String[] comboData = new String[allResult.size()]; for (int i = 0; i < allResult.size(); i++){ ... String investorName = (String) ((Hashtable) obj).get("investorName"); comboData[i] = investorName ... } ComboBox investorNames = new ComboBox(comboData); details.addComponent(investorNames); ....
binder.setFieldFactory(new DefaultFieldGroupFieldFactory() { @Override public <T extends Field> T createField(Class<?> type, Class<T> fieldType) { if (type.isAssignableFrom(String.class) && fieldType.isAssignableFrom(ComboBox.class)) { return (T) new ComboBox(); } return super.createField(type, fieldType); } });
ComboBox box = new ComboBox(); box.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { } });
Statement statement = connection.createStatement(); ResultSet results = statement.executeQuery("SELECT * FROM test_table"); ComboBox cb = new ComboBox(); while(results.next()){ cb.getItems().add(results.getString("test_col")); }
// create store ListStore<String> store = new ListStore<String>(); store.add( Arrays.asList( new String[]{"A","B","C"})); ComboBox cb = new ComboBox(); cb.setStore(store);
DynamicForm df = new DynamicForm(); ComboBox cb = new ComboBox(); cb.setValueMap("cat", "dog", "bird"); cb.setTitle("Select:"); //other fields df.setFields(cb); // Use this to add fields layout.addMember(df);
private ComboBox<User> createUserBox() { ComboBox<User> box = new ComboBox(QIUtils.getCaptionFromId("user")); box.setItemCaptionGenerator(User::getNickAndId); UsersHelper usersHelper = new UsersHelper(); box.setDataProvider(usersHelper.getDataProvider()); box.setEmptySelectionAllowed(false); return box; }
ComboBox accountStatusChoice = new ComboBox(); accountStatusChoice.setCaption(MessageResource.getLocalizedString("caption.accountStatus")); accountStatusChoice.setRequired(true); accountStatusChoice.setRequiredError(MessageResource.getLocalizedString("error.required.accountStatus")); accountStatusChoice.setImmediate(true); for (AccountStatus accountStatus : AccountStatus.values()) { accountStatusChoice.addItem(accountStatus); accountStatusChoice.setItemCaption(accountStatus, MessageResource.getLocalizedString(accountStatus.name())); } return accountStatusChoice;
protected AbstractField createTextField() { ComboBox out = new ComboBox(); out.setItemCaptionPropertyId("title"); out.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY); out.setFilteringMode(Filtering.FILTERINGMODE_CONTAINS); out.setNullSelectionAllowed(false); //TODO container = new IndexedContainer(); // container.addContainerProperty("id", String.class, ""); container.addContainerProperty("title", String.class, ""); out.setContainerDataSource(container); return out; }
private ComboBox createType(Object itemId) { ComboBox select = new ComboBox(); for (AttribType type : AttribType.values()) select.addItem(type.name()); select.setValue(AttribType.valueOf(itemId).name()); select.setNullSelectionAllowed(false); select.setData(itemId); select.setBuffered(true); return select; }
@Override protected ComboBox<T> createSelectionField() { final ComboBox<T> select = new ComboBox<>(); select.setScrollToSelectedItem(getDefinition().isScrollToSelectedItem()); select.setEmptySelectionAllowed(getDefinition().isEmptySelectionAllowed()); select.setTextInputAllowed(getDefinition().isTextInputAllowed()); select.setPopupWidth(getDefinition().getPopWidth()); select.setEmptySelectionCaption(getDefinition().getEmptySelectionCaption()); select.setPageLength(getDefinition().getPageLength()); return select; } }